/* Design Zone CRM — "Departures Board".
   Concourse-grey ground, white working surfaces, navy shell, a deeper navy board with split-flap
   cells and signal lamps (aqua due, amber late, red overdue). Thmanyah Sans, self-hosted. */

@font-face { font-family: 'Thmanyah Sans'; src: url(/fonts/thmanyahsans-regular.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Thmanyah Sans'; src: url(/fonts/thmanyahsans-medium.woff2) format('woff2'); font-weight: 500 600; font-display: swap; }
@font-face { font-family: 'Thmanyah Sans'; src: url(/fonts/thmanyahsans-bold.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Thmanyah Sans'; src: url(/fonts/thmanyahsans-black.woff2) format('woff2'); font-weight: 800 900; font-display: swap; }

:root {
  --ground: #EEF2F5; --surface: #FFFFFF; --surface-2: #F6F9FB; --ink: #13212C; --soft: #5A6B79; --line: #D6DEE5; --line-2: #E6ECF1;
  --navy: #1A2D3E; --navy-2: #22394E; --board: #0F1C27; --flap: #16293A; --flap-ink: #FFFFFF;
  --aqua: #4FC8F4; --aqua-ink: #0B6A8F; --amber: #F2B33D; --red: #E2574C; --red-ink: #B23A30; --green: #2FA57A; --wa: #13834A;
  --st-new: #4FC8F4; --st-contacted: #7B9CC6; --st-qualified: #9B7FD1; --st-proposal: #C58B3A; --st-won: #2FA57A; --st-lost: #9AA8B5;
  --hot: var(--red); --ok: var(--green);
  --r: 4px; --r-lg: 6px;
  --shadow: 0 1px 2px rgba(15,28,39,.06), 0 6px 18px rgba(15,28,39,.07);
  --font: 'Thmanyah Sans', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --fs-xs: 12px; --fs-sm: 13.5px; --fs: 15px; --fs-md: 17px; --fs-lg: 21px; --fs-xl: 28px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
#app { min-height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--ground); font-size: var(--fs); line-height: 1.5; font-variant-numeric: tabular-nums; caret-color: var(--aqua-ink); scrollbar-color: #A9B8C4 transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--aqua-ink); text-underline-offset: 3px; }
::selection { background: var(--aqua); color: var(--board); }
:focus-visible { outline: 2px solid var(--aqua); outline-offset: 2px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--soft); font-size: var(--fs-sm); }
[dir="rtl"] th, [dir="rtl"] .sec-t, [dir="rtl"] .dep-head, [dir="rtl"] .login-flap { text-transform: none !important; letter-spacing: 0 !important; }

/* ── Split-flap cells (the signature) ── */
.flap { display: inline-flex; gap: 2px; direction: ltr; perspective: 300px; vertical-align: middle; }
.flap i { font-style: normal; width: 1.3em; height: 1.75em; border-radius: 3px; background: var(--flap); color: var(--flap-ink); display: grid; place-items: center; font-weight: 700; line-height: 1; position: relative; font-size: 0.95em; text-decoration: none; }
.flap i::after { content: ''; position: absolute; inset-inline: 0; top: 50%; height: 1px; background: rgba(0,0,0,.6); z-index: 3; }
/* The two leaves of a turning flap. Hidden at rest; visible only while the turn runs. */
.flap .lf { position: absolute; inset: 0; display: grid; place-items: center; background: inherit; color: inherit; border-radius: inherit; text-decoration: none; visibility: hidden; backface-visibility: hidden; transform-origin: 50% 50%; }
.flap .lt { clip-path: inset(0 0 50% 0); z-index: 2; background: #1C3348; }
.flap .lb { clip-path: inset(50% 0 0 0); z-index: 2; }
.flap .ub { clip-path: inset(50% 0 0 0); z-index: 1; }
.flip .flap .ub { animation: leaf-under 320ms linear backwards; animation-delay: calc(var(--d, 0) * 45ms); }
@keyframes leaf-under { 0%, 99% { visibility: visible; } 100% { visibility: hidden; } }
.flip .flap .lt { animation: leaf-top 170ms ease-in backwards; animation-delay: calc(var(--d, 0) * 45ms); }
.flip .flap .lb { animation: leaf-bottom 170ms ease-out both; animation-delay: calc(var(--d, 0) * 45ms + 150ms); }
@keyframes leaf-top { 0% { visibility: visible; transform: rotateX(0); } 100% { visibility: visible; transform: rotateX(-90deg); } }
@keyframes leaf-bottom { 0% { visibility: visible; transform: rotateX(90deg); } 100% { visibility: hidden; transform: rotateX(0); } }
.wait { display: inline-flex; align-items: center; gap: 6px; }
.wait small { font-size: var(--fs-sm); font-weight: 600; color: inherit; opacity: .78; line-height: 1; }

/* ── Signal lamps, score and stage markers ── */
.lamp { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: 0 0 auto; background: var(--st-lost); }
.lamp.due { background: var(--aqua); box-shadow: 0 0 0 3px rgba(79,200,244,.2); }
.lamp.late { background: var(--amber); box-shadow: 0 0 0 3px rgba(242,179,61,.22); }
.lamp.over { background: var(--red); box-shadow: 0 0 0 3px rgba(226,87,76,.22); }
.lamp.done { background: var(--green); }
.band-Hot.lamp { background: var(--red); box-shadow: 0 0 0 3px rgba(226,87,76,.18); }
.band-Warm.lamp { background: var(--amber); }
.band-Cold.lamp { background: #8FA3B4; }
.band-na.lamp { background: #C3CDD6; }
.score { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; white-space: nowrap; }
/* Score tiles take the strength colour so the number itself reads Hot / Warm / Cold at a glance. */
.score .flap i::after { background: rgba(0,0,0,.22); }
.score-Hot .flap i, .score-Hot .flap .lt { background: #B23A30; color: #fff; }
.score-Warm .flap i, .score-Warm .flap .lt { background: #F2B33D; color: #0F1C27; }
.score-Cold .flap i, .score-Cold .flap .lt { background: #546A7E; color: #fff; }
.score-na .flap i, .score-na .flap .lt { background: #E3E9EE; color: #5A6B79; }
.score-Hot .flap { filter: drop-shadow(0 0 6px rgba(226,87,76,.35)); }
.score .band.band-Hot { background: #FBE7E5; color: #B23A30; }
.score .band.band-Warm { background: #FDF1D8; color: #7A5410; }
.score .band.band-Cold { background: #E6ECF1; color: #3E5163; }
.band { color: #fff; border-radius: var(--r); padding: 1px 7px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .02em; }
.band.band-Hot { background: #B23A30; } .band.band-Warm { background: var(--amber); color: var(--board); } .band.band-Cold { background: #546A7E; }
.st { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.st i { width: 8px; height: 8px; border-radius: 2px; background: var(--st-lost); }
.st-New i { background: var(--st-new); } .st-Contacted i { background: var(--st-contacted); } .st-Qualified i { background: var(--st-qualified); }
.st-Proposal i { background: var(--st-proposal); } .st-Won i { background: var(--st-won); } .st-Lost i { background: var(--st-lost); }
.pill { display: inline-block; border-radius: var(--r); padding: 1px 8px; font-size: var(--fs-xs); font-weight: 700; background: var(--line-2); color: var(--soft); letter-spacing: .04em; }

/* ── Buttons & fields ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 7px 14px; cursor: pointer; font-weight: 700; font-size: var(--fs-sm); white-space: nowrap; color: var(--ink); text-decoration: none; transition: background .15s ease, border-color .15s ease; }
.btn:hover { border-color: #AEBCC8; background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); border-color: var(--navy-2); }
.btn-wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn-wa:hover { background: #0F6E3D; border-color: #0F6E3D; }
.btn-danger { color: var(--red-ink); }
.btn-danger:hover { border-color: var(--red); background: #FDF1EF; }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: var(--fs-xs); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn svg { width: 16px; height: 16px; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); border-radius: var(--r); padding: 9px 11px; background: var(--surface); min-height: 40px; }
textarea.input { resize: vertical; min-height: 90px; }
.input:hover { border-color: #B7C4CF; }
.input:focus { border-color: var(--aqua-ink); outline: none; box-shadow: 0 0 0 3px rgba(79,200,244,.25); }
.input[disabled] { background: var(--surface-2); color: var(--soft); }
.input::placeholder { color: #7D8C99; }
label.f { display: block; font-size: var(--fs-xs); font-weight: 700; color: var(--soft); margin-bottom: 5px; letter-spacing: .02em; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.fgrid .full { grid-column: 1 / -1; }
.field { margin-bottom: 14px; }

/* ── Sign in: the board as the welcome ── */
.login { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 22px; padding: 24px 16px; background: var(--board); }
.login-flap { display: grid; justify-items: center; gap: 10px; color: rgba(255,255,255,.62); font-size: var(--fs-sm); letter-spacing: .3em; text-transform: uppercase; }
.login-flap .flap { font-size: clamp(17px, 4.2vw, 30px); }
.login-flap .flap i { background: #1B3246; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: var(--r-lg); padding: 26px; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.login-card h2 { margin: 0 0 16px; font-size: var(--fs-lg); font-weight: 800; }
.login-err { color: var(--red-ink); font-size: var(--fs-sm); min-height: 20px; margin: 2px 0 10px; }
.login-links { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.linkbtn { background: none; border: 0; padding: 4px 0; color: var(--aqua-ink); font-weight: 700; cursor: pointer; font-size: var(--fs-sm); }
.linkbtn:hover { text-decoration: underline; }

/* ── Shell ── */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #fff; padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: var(--fs-md); }
.side .brand { flex-direction: column; align-items: flex-start; gap: 8px; }
.brand-logo { display: block; width: 100%; max-width: 190px; height: auto; }
.brand-tag { font-size: var(--fs-xs); font-weight: 800; letter-spacing: .28em; color: var(--aqua); padding-inline-start: 2px; }
.login-logo { display: block; width: min(320px, 78vw); height: auto; }
.boot-logo { display: block; width: 200px; height: auto; animation: boot-pulse 700ms ease-in-out infinite alternate; }
@media (prefers-reduced-motion: reduce) { .boot-logo { animation: none; } }
.side .brand { padding: 4px 8px 20px; }
.brand-mark { display: inline-flex; gap: 2px; direction: ltr; }
.brand-mark i { font-style: normal; width: 17px; height: 24px; background: var(--flap); border-radius: 2px; display: grid; place-items: center; color: var(--aqua); font-weight: 800; font-size: 14px; position: relative; }
.brand-mark i::after { content: ''; position: absolute; inset-inline: 0; top: 50%; height: 1px; background: rgba(0,0,0,.5); }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px; border-radius: var(--r); color: rgba(255,255,255,.72); text-decoration: none; font-weight: 600; font-size: var(--fs); }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.on { background: rgba(79,200,244,.15); color: #fff; }
.nav a.on svg { color: var(--aqua); }
.nav svg { width: 18px; height: 18px; flex: 0 0 auto; }
.nav .lbl-s { display: none; }
.nav .count { margin-inline-start: auto; background: var(--aqua); color: var(--board); border-radius: 3px; font-size: var(--fs-xs); font-weight: 800; padding: 0 6px; min-width: 22px; text-align: center; }
.side-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding-top: 12px; display: grid; gap: 8px; font-size: var(--fs-sm); color: rgba(255,255,255,.75); }
.side-foot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
.side-foot button { background: none; border: 1px solid rgba(255,255,255,.22); color: #fff; border-radius: var(--r); padding: 7px 10px; cursor: pointer; text-align: start; font-weight: 600; }
.side-foot button:hover { background: rgba(255,255,255,.07); }
.main { min-width: 0; padding: 26px 32px 64px; }
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.top h1 { font-size: var(--fs-xl); line-height: 1.15; margin: 0; margin-inline-end: auto; font-weight: 800; text-wrap: balance; }
.top .sub { display: block; font-size: var(--fs-sm); color: var(--soft); font-weight: 500; margin-top: 4px; }
.search { position: relative; }
.search input { padding-inline-start: 36px; width: 280px; }
.search svg { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); width: 16px; color: var(--soft); }
.demo-note { background: #FFF6DE; border: 1px solid #F0DDA6; color: #6B5212; border-radius: var(--r); padding: 8px 12px; font-size: var(--fs-sm); margin-bottom: 14px; }
.demo-note.info { background: #E8F6FD; border-color: #B8E2F5; color: var(--navy); }

/* ── Counter strip (replaces KPI cards) ── */
.kpis, .strip { display: flex; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 16px; }
.kpi, .strip > div { flex: 1 1 140px; padding: 12px 18px; border-inline-end: 1px solid var(--line-2); display: flex; align-items: baseline; gap: 10px; }
.kpi:last-child, .strip > div:last-child { border-inline-end: 0; }
.kpi b, .strip b { font-size: 26px; font-weight: 800; line-height: 1.1; }
.kpi span, .strip span { color: var(--soft); font-size: var(--fs-sm); font-weight: 500; }

/* ── Cards, filters, tables ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card-h { padding: 13px 16px; border-bottom: 1px solid var(--line-2); font-weight: 800; display: flex; align-items: center; gap: 8px; }
.card .pad, .pad { padding: 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.filters select { width: auto; min-height: 36px; padding: 6px 10px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 6px 12px; cursor: pointer; font-size: var(--fs-sm); font-weight: 600; min-height: 36px; }
.chip:hover { border-color: #AEBCC8; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: start; font-size: var(--fs-xs); color: rgba(255,255,255,.8); background: var(--navy); font-weight: 700; padding: 10px 14px; white-space: nowrap; text-transform: uppercase; letter-spacing: .08em; }
.tbl th:first-child { border-start-start-radius: 5px; } .tbl th:last-child { border-start-end-radius: 5px; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr { cursor: pointer; transition: background .12s ease; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .who b { display: block; font-weight: 700; }
.tbl .who span { color: var(--soft); font-size: var(--fs-sm); }
.empty { padding: 44px 16px; text-align: center; color: var(--soft); }
.empty b { display: block; color: var(--ink); font-size: var(--fs-md); margin-bottom: 4px; }

/* ── Today's calls: the departures board ── */
.depart { background: var(--board); border-radius: var(--r-lg); padding: 6px 16px 10px; color: #fff; box-shadow: var(--shadow); }
.dep-row { display: grid; grid-template-columns: 112px minmax(0,1.5fr) minmax(0,1.1fr) 150px 140px 200px; gap: 16px; align-items: center; padding: 11px 6px; border-bottom: 1px solid rgba(255,255,255,.08); cursor: pointer; transition: background .15s ease; }
.dep-row:hover { background: rgba(255,255,255,.04); }
.dep-row:last-child { border-bottom: 0; }
.dep-head { cursor: default; color: var(--aqua); font-size: var(--fs-xs); font-weight: 800; letter-spacing: .14em; text-transform: uppercase; padding: 12px 6px 10px; border-bottom: 1px solid rgba(255,255,255,.14); }
.dep-head:hover { background: none; }
.dep-row .flap { font-size: 18px; }
.dep-name b { display: block; font-size: var(--fs-md); font-weight: 700; color: #fff; }
.dep-name > span, .dep-svc > span { display: block; font-size: var(--fs-sm); color: rgba(255,255,255,.66); }
.dep-name .pill { background: rgba(255,255,255,.14); color: #fff; vertical-align: 2px; margin-inline-start: 6px; }
.dep-svc { font-size: var(--fs); }
.dep-row .band.band-Cold { background: #E6ECF1; color: #3E5163; }
.dep-st { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: var(--fs-sm); letter-spacing: .1em; text-transform: uppercase; }
.dep-st.late { color: var(--amber); } .dep-st.over { color: #FF9289; } .dep-st.due { color: #fff; }
[dir="rtl"] .dep-st { letter-spacing: 0; word-spacing: .18em; }
.dep-act { display: flex; gap: 6px; justify-content: flex-end; }
.dep-act .btn { min-height: 34px; }
.dep-act .btn-board { background: var(--aqua); border-color: var(--aqua); color: var(--board); }
.dep-act .btn-board:hover { background: #7AD6F7; border-color: #7AD6F7; }
.dep-act .btn-ghost { background: transparent; border-color: rgba(255,255,255,.3); color: #fff; }
.dep-act .btn-ghost:hover { background: rgba(255,255,255,.08); }
.dep-empty { padding: 48px 16px; text-align: center; color: rgba(255,255,255,.72); }
.dep-empty b { display: block; color: #fff; font-size: var(--fs-md); margin-bottom: 6px; }
.dep-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--soft); font-size: var(--fs-sm); margin-top: 10px; }
.legend { display: inline-flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ── Drawer & modal ── */
.overlay { position: fixed; inset: 0; background: rgba(15,28,39,.45); z-index: 40; }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(580px, 100%); background: var(--surface); z-index: 50; display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(15,28,39,.22); animation: slide 200ms cubic-bezier(.2,.8,.2,1); }
[dir="rtl"] .drawer { animation-name: slide-rtl; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide-rtl { from { transform: translateX(-24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-h { padding: 18px 20px 16px; background: var(--navy); color: #fff; }
.drawer-h .muted { color: rgba(255,255,255,.66); }
.drawer-h h2 { margin: 4px 0 2px; font-size: var(--fs-lg); font-weight: 800; }
.drawer-h .ref { margin-top: 4px; font-size: var(--fs-xs); }
.x svg { width: 16px; height: 16px; }
.drawer-h .st { color: #fff; }
.drawer-h .pill { background: rgba(255,255,255,.12); color: #fff; }
.drawer-h .btn:not(.btn-wa) { background: transparent; border-color: rgba(255,255,255,.3); color: #fff; }
.drawer-h .btn:not(.btn-wa):hover { background: rgba(255,255,255,.08); }
.drawer-h select.input { width: auto; background: var(--navy-2); border-color: rgba(255,255,255,.3); color: #fff; }
.drawer-b { overflow-y: auto; padding: 0 20px 40px; flex: 1; }
.x { position: absolute; top: 14px; inset-inline-end: 14px; border: 0; background: rgba(255,255,255,.12); color: #fff; width: 34px; height: 34px; border-radius: var(--r); cursor: pointer; font-size: 18px; }
.x:hover { background: rgba(255,255,255,.2); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 -20px 16px; padding: 0 20px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.tabs button { border: 0; background: none; padding: 12px; cursor: pointer; font-weight: 700; color: var(--soft); border-bottom: 2px solid transparent; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-color: var(--aqua); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; margin: 0 0 18px; }
.kv dt { color: var(--soft); font-size: var(--fs-sm); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.sec-t { font-size: var(--fs-xs); font-weight: 800; color: var(--aqua-ink); text-transform: uppercase; letter-spacing: .1em; margin: 22px 0 8px; }
.bars .row { display: grid; grid-template-columns: minmax(0,190px) 1fr 36px; gap: 14px; align-items: center; margin-bottom: 12px; font-size: var(--fs-sm); }
.bars .lbl { display: grid; min-width: 0; line-height: 1.3; }
.bars .lbl > span { font-weight: 600; }
.bars .lbl small { color: var(--soft); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .track { height: 8px; border-radius: 2px; background: var(--line-2); overflow: hidden; }
.bars .fill { height: 100%; background: var(--aqua); border-radius: 2px; }
.bars .row b { text-align: end; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px; padding-inline-start: 22px; }
.timeline li::before { content: ''; position: absolute; inset-inline-start: 3px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--aqua); }
.timeline li::after { content: ''; position: absolute; inset-inline-start: 7px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .t-meta { font-size: var(--fs-xs); color: var(--soft); margin-top: 2px; }
.modal { position: fixed; z-index: 60; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(580px, calc(100% - 24px)); max-height: calc(100% - 40px); overflow-y: auto; background: var(--surface); border-radius: var(--r-lg); padding: 22px; box-shadow: 0 30px 80px rgba(15,28,39,.35); }
.modal h3 { margin: 0 0 14px; font-size: var(--fs-lg); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.warn { background: #FDF1EF; border: 1px solid #F3C7C0; color: #8F2D24; border-radius: var(--r); padding: 9px 12px; font-size: var(--fs-sm); margin-top: 10px; }
.menu { position: absolute; z-index: 70; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 6px; min-width: 270px; max-width: 330px; }
.menu button { display: block; width: 100%; text-align: start; border: 0; background: none; padding: 9px 10px; border-radius: var(--r); cursor: pointer; }
.menu button:hover, .menu button:focus-visible { background: var(--surface-2); }
.menu small { display: block; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Pipeline ── */
.board { display: grid; grid-template-columns: repeat(6, minmax(210px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #E3E9EE; border-radius: var(--r-lg); padding: 0 10px 10px; min-height: 320px; outline: 2px dashed transparent; }
.col.drop { outline-color: var(--aqua); background: #E6F4FA; }
.col-h { display: flex; justify-content: space-between; align-items: center; font-weight: 800; padding: 12px 4px 10px; font-size: var(--fs-sm); }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; margin-bottom: 8px; cursor: grab; transition: box-shadow .15s ease; }
.kcard:hover { box-shadow: var(--shadow); }
.kcard b { display: block; }
.kcard .muted { display: block; margin: 2px 0 8px; }
.kcard-f { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kcard .flap { font-size: 13px; }

/* ── Reports & templates ── */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.trend { width: 100%; height: 180px; }
.tpl { padding: 14px 16px; border-bottom: 1px solid var(--line-2); display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; }
.tpl:last-child { border-bottom: 0; }
.tpl p { margin: 0; color: var(--soft); white-space: pre-wrap; font-size: var(--fs-sm); grid-column: 1 / -1; }
.tpl p.tpl-subj { color: var(--ink); }
/* Sub-tabs: Leads (Requests / Contacts) and Templates (WhatsApp / Email). */
.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.subtabs a, .subtabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; font: inherit; font-weight: 700; color: var(--soft); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subtabs a:hover, .subtabs button:hover { color: var(--ink); }
.subtabs .on { color: var(--ink); border-color: var(--aqua); }
.sec-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--aqua-ink); font: inherit; font-weight: 700; cursor: pointer; text-transform: none; letter-spacing: 0; text-decoration: underline; text-underline-offset: 3px; }
.modal.modal-wide { max-width: 620px; }
.btn svg { vertical-align: -3px; }
.ph { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; align-items: center; }
.ph button { border: 1px dashed var(--aqua-ink); background: #EEF9FE; border-radius: var(--r); padding: 2px 8px; font-size: var(--fs-xs); cursor: pointer; color: var(--aqua-ink); font-weight: 700; }
.preview { background: #E6F6EC; border-radius: var(--r); padding: 10px 12px; white-space: pre-wrap; font-size: var(--fs-sm); margin-top: 8px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--board); color: #fff; padding: 11px 18px; border-radius: var(--r); z-index: 90; font-size: var(--fs-sm); box-shadow: 0 10px 30px rgba(0,0,0,.25); }
[hidden] { display: none !important; }
.mobile-lang { display: none !important; }

/* ── Laptop / tablet: the board folds to two lines per row ── */
@media (max-width: 1240px) and (min-width: 901px) {
  .shell { grid-template-columns: 204px 1fr; } .main { padding-inline: 24px; }
  .dep-row { grid-template-columns: 96px minmax(0,1fr) 112px 112px 150px; grid-template-areas: "wait name score st act" "wait svc score st act"; column-gap: 12px; row-gap: 2px; }
  .dep-row .flap { font-size: 16px; }
  .dep-row > :nth-child(1) { grid-area: wait; } .dep-row > :nth-child(2) { grid-area: name; } .dep-row > :nth-child(3) { grid-area: svc; }
  .dep-row > :nth-child(4) { grid-area: score; } .dep-row > :nth-child(5) { grid-area: st; } .dep-row > :nth-child(6) { grid-area: act; }
  .dep-head { grid-template-areas: "wait name score st act"; } .dep-head > :nth-child(3) { display: none; }
  .dep-svc { font-size: var(--fs-sm); color: rgba(255,255,255,.75); } .dep-svc > span { display: inline; } .dep-svc > span::before { content: " · "; }
}

/* ── Phone ── */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; bottom: 0; top: auto; height: auto; width: 100%; flex-direction: row; padding: 6px max(6px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px)); z-index: 30; }
  .side .brand, .side-foot { display: none; }
  .nav { display: flex; width: 100%; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 2px; font-size: 10px; padding: 6px 1px; text-align: center; letter-spacing: -.01em; }
  .nav a { flex: 1 1 0; min-width: 0; }
  .nav .lbl { display: none; } .nav .lbl-s { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .filters { flex-wrap: nowrap; overflow-x: auto; margin-inline: -14px; padding-inline: 14px; scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .filters .chip { flex: 0 0 auto; }
  .nav a { position: relative; }
  .nav .count { display: block; position: absolute; top: 2px; inset-inline-start: calc(50% + 6px); margin: 0; min-width: 18px; padding: 0 4px; font-size: 10px; line-height: 16px; }
  .main { padding: 16px max(14px, env(safe-area-inset-right, 0px)) 96px max(14px, env(safe-area-inset-left, 0px)); }
  .top h1 { font-size: 23px; }
  .grid2, .fgrid { grid-template-columns: 1fr; }
  .search { flex: 1 1 100%; order: 3; } .search input { width: 100%; }
  .kv { grid-template-columns: 112px 1fr; }
  .tbl .hide-m, .hide-m { display: none; }
  .kpi, .strip > div { flex: 1 1 45%; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
  .mobile-lang:not([hidden]) { display: inline-flex !important; }
  .depart { padding: 4px 10px 8px; }
  .dep-head { display: none; }
  .dep-row { grid-template-columns: auto minmax(0,1fr) auto; grid-template-areas: "wait st score" "name name name" "svc svc svc" "act act act"; gap: 6px 12px; padding: 12px 2px; }
  .dep-name b { display: inline; } .dep-name > span { display: block; }
  .dep-act .btn { min-height: 38px; }
  .dep-row > :nth-child(1) { grid-area: wait; } .dep-row > :nth-child(2) { grid-area: name; } .dep-row > :nth-child(3) { grid-area: svc; }
  .dep-row > :nth-child(4) { grid-area: score; } .dep-row > :nth-child(5) { grid-area: st; } .dep-row > :nth-child(6) { grid-area: act; justify-content: stretch; }
  .dep-row .flap { font-size: 15px; }
  .dep-act .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .flip .flap i, .flip .flap .lf, .drawer, .boot .brand-mark i { animation: none !important; }
  .flap .lf { visibility: hidden !important; }
  * { transition: none !important; }
}
@media print { .side, .top .btn { display: none; } }

/* Loading screen shown before the app starts */
.boot { min-height: 100vh; display: grid; place-items: center; background: var(--ground); }
.boot .brand-mark i { width: 22px; height: 30px; font-size: 18px; animation: boot-pulse 700ms ease-in-out infinite alternate; }
@keyframes boot-pulse { from { opacity: .45; } to { opacity: 1; } }
.boot .brand-mark i + i { animation-delay: 120ms; }
@media (prefers-reduced-motion: reduce) { .boot .brand-mark i { animation: none; } }

/* Lead scoring switched off: hide every score element, and close the gap it leaves on the Today board. */
.no-score .c-score { display: none !important; }
.no-score .dep-row { grid-template-columns: 112px minmax(0,1.5fr) minmax(0,1.1fr) 140px 200px; }
@media (max-width: 1240px) {
  .no-score .dep-row { grid-template-columns: 96px minmax(0,1fr) 112px 150px; grid-template-areas: "wait name st act" "wait svc st act"; }
  .no-score .dep-head { grid-template-areas: "wait name st act"; }
}
@media (max-width: 900px) {
  .no-score .dep-row { grid-template-columns: auto minmax(0,1fr); grid-template-areas: "wait st" "name name" "svc svc" "act act"; }
}
