/* Primoura CRM — Prime Vision dark + gold. Arabic RTL by default; English flips to LTR (<html dir>). */

/* Self-hosted OFL fonts (licenses in /fonts/OFL-*.txt), Google Fonts subsets: Alexandria (Arabic + Latin,
   variable) for headings and big numbers; IBM Plex Sans Arabic (Arabic only, 400–700) + IBM Plex Sans
   (Latin, variable) for text. Browsers fetch only the subsets/weights a page uses. */
@font-face { font-family: 'Alexandria'; font-weight: 100 900; font-display: swap; src: url(/fonts/Alexandria-arabic-var.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1; }
@font-face { font-family: 'Alexandria'; font-weight: 100 900; font-display: swap; src: url(/fonts/Alexandria-latin-var.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-weight: 400; font-display: swap; src: url(/fonts/IBMPlexSansArabic-arabic-400.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-weight: 500; font-display: swap; src: url(/fonts/IBMPlexSansArabic-arabic-500.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-weight: 600; font-display: swap; src: url(/fonts/IBMPlexSansArabic-arabic-600.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-weight: 700; font-display: swap; src: url(/fonts/IBMPlexSansArabic-arabic-700.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1; }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 100 700; font-display: swap; src: url(/fonts/IBMPlexSans-latin-var.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }


:root {
  color-scheme: dark;
  --bg: #0A0907;
  --surface: #15130F;
  --surface-2: #1C1914;
  --surface-3: #25211A;
  --line: #2C271E;
  --line-strong: #3B3428;
  --text: #F2EDE3;
  --text-2: #C9C0AF;
  --muted: #8F8675;
  /* brand golds sampled from the Prime Vision logo (pv-logo.png) */
  --gold-deep: #B17516;
  --gold: #D4A63D;
  --gold-2: #E6C056;
  --gold-3: #F9E184;
  --gold-ink: #1A1206;
  --gold-grad: linear-gradient(180deg, #F9E184 0%, #E6C056 42%, #C79228 100%);
  --danger: #E0604A;
  --ok: #2FB383;
  --warn: #E07B3C;
  /* status hues (validated as a set on --surface; always shown with a text label) */
  --st-new: #3987E5;
  --st-contacted: #D55181;
  --st-booked: #C98500;
  --st-attended: #199E70;
  --st-no_show: #D95926;
  --st-lost: #7D7568;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 12px 40px rgba(0, 0, 0, .5);
  /* Text: IBM Plex Sans for Latin, IBM Plex Sans Arabic for Arabic (its Latin subset isn't loaded).
     Headings + big numbers: --font-head (Alexandria). */
  --font: 'IBM Plex Sans', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --font-head: 'Alexandria', var(--font);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; font-family: var(--font-head); }
.tile-value, .b-time, .col-title, .day-title { font-family: var(--font-head); }
h1 { font-size: 18px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; color: var(--text-2); }
p { margin: .4em 0; }
/* Arabic inside code (e.g. form snippets) falls back to the UI font so letters stay joined. */
code, pre, .mono { font-family: ui-monospace, 'SF Mono', Menlo, 'IBM Plex Sans Arabic', monospace; font-size: 12.5px; }
.mono { unicode-bidi: isolate; }
html[dir=rtl] :is(div, .sub).mono[dir=ltr] { text-align: right; }
/* Read-only value inside a form grid (e.g. the lead's ad ids): looks like a quiet input. */
.ro-value { padding: 8px 10px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--text-2); line-height: 20px; }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; overflow-x: auto; color: var(--text-2); text-align: left;
  white-space: pre-wrap; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; display: inline-block; vertical-align: bottom;
  unicode-bidi: plaintext; }
/* Long names/campaigns: up to two lines, then "…" (full text in the auto tooltip). plaintext = an English
   name in the Arabic UI (or the reverse) is cut at its own end, not its start. */
.clamp2 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  white-space: normal; overflow-wrap: anywhere; unicode-bidi: plaintext; }
/* plaintext would align each text by its own language; keep columns aligned with the page instead. */
html[dir=rtl] :is(.ellipsis, .clamp2, selectedcontent) { text-align: right; }
html[dir=ltr] :is(.ellipsis, .clamp2, selectedcontent) { text-align: left; }
.sub { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); font-weight: 400; }
.sub.clamp2 { display: -webkit-box; }
.nowrap { white-space: nowrap; }
.cards-grid > *, .tiles > *, .grid2 > *, .grid4 > *, .profile-grid > *, .kv > *, .hours-day > * { min-width: 0; }
td.ellipsis { display: table-cell; max-width: 220px; }
.spacer { flex: 1; }
.empty { color: var(--muted); text-align: center; padding: 28px 12px; }
.stale { opacity: .55; transition: opacity .15s; pointer-events: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.icon { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.boot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; height: 100vh; background: #000; }
.boot img { width: 112px; height: 112px; filter: drop-shadow(0 10px 30px rgba(212, 166, 61, .25)); }
.boot-bar { width: 120px; height: 3px; border-radius: 999px; background: var(--surface-3); overflow: hidden; position: relative; }
.boot-bar::after { content: ''; position: absolute; inset: 0; width: 40%; background: var(--gold-grad); border-radius: inherit; animation: boot 1.1s ease-in-out infinite; }
@keyframes boot { from { transform: translateX(-110%); } to { transform: translateX(260%); } }
html[dir=rtl] .boot-bar::after { animation-direction: reverse; }
@keyframes pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .boot-bar::after { animation: none; width: 100%; } }

/* ---------- controls ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  height: 34px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-3); border-color: #4a4132; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--gold-grad); border-color: var(--gold-deep); color: var(--gold-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; height: 42px; }
.btn.wa { border-color: #1f6b47; color: #6fe0a8; }
.btn.big { height: 46px; padding: 0 20px; font-size: 15px; font-weight: 600; min-width: 108px; }
.btn.ok { background: #123d2c; border-color: var(--st-attended); color: #8ef0c4; }
.btn.warn { background: #3a1d10; border-color: var(--st-no_show); color: #ffb58f; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

input, select, textarea {
  width: 100%; min-height: 36px; padding: 7px 10px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font: inherit;
}
textarea { resize: vertical; }
/* Selects in the brand style: gold chevron, dark list. Chromium's customizable select
   (appearance: base-select) also styles the open list; other browsers keep their native list. */
select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  padding-inline-end: 32px;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23D4A63D' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat left 10px center / 14px;
}
html[dir=ltr] select { background-position: right 10px center; }
select:hover { border-color: #4a4132; }
select option { background: var(--surface-2); color: var(--text); }
@supports (appearance: base-select) {
  select, ::picker(select) { appearance: base-select; }
  select { background-image: none; display: flex; align-items: center; gap: 8px; padding-inline-end: 10px; max-width: 100%; }
  /* The chosen label sits in <selectedcontent> (added by ui.js) so it can end in "…". */
  select > button { all: unset; display: flex; flex: 1; min-width: 0; }
  select selectedcontent { display: block; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    unicode-bidi: plaintext; }
  select option { white-space: normal; max-width: min(460px, 92vw); }
  select::picker-icon { color: var(--gold); transition: rotate .15s; }
  select:open::picker-icon { rotate: 180deg; }
  select:open { border-color: var(--gold); }
  ::picker(select) {
    background: var(--surface-2); color: var(--text); border: 1px solid var(--line-strong); border-radius: 10px;
    box-shadow: var(--shadow); padding: 4px; margin-block: 4px; max-height: min(60vh, 360px); overflow-y: auto;
  }
  select option { padding: 7px 10px; border-radius: 6px; background: transparent; gap: 8px; }
  select option:hover, select option:focus-visible { background: var(--surface-3); color: var(--gold-3); outline: none; }
  select option:checked { background: color-mix(in srgb, var(--gold) 14%, transparent); color: var(--gold-2); font-weight: 600; }
  select option::checkmark { color: var(--gold); }
}
input[type=date], input[type=time], input[type=datetime-local] { color-scheme: dark; }
input[type=file] { padding: 5px; cursor: pointer; }
input[type=file]::file-selector-button { font: inherit; margin-inline-end: 10px; padding: 4px 12px; border-radius: var(--radius-sm); border: 1px solid var(--gold-deep); background: var(--surface-3); color: var(--gold-2); cursor: pointer; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 166, 61, .2); }
input:disabled, select:disabled, textarea:disabled { opacity: .75; background: var(--surface); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--gold); margin: 0; flex: none; }
input[dir=ltr] { text-align: left; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.span2 { grid-column: 1 / -1; }
.end { display: flex; justify-content: flex-end; }
.form-error { color: var(--danger); min-height: 1.2em; font-size: 13px; }

/* chips */
.chip {
  display: inline-block; vertical-align: middle; height: 22px; line-height: 20px; padding: 0 8px; max-width: 100%;
  border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--surface-3); color: var(--text-2); border: 1px solid transparent;
}
.chip[class*="st-"]::before { content: ''; display: inline-block; vertical-align: middle; margin: -2px 0 0; margin-inline-end: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.st-new { --c: var(--st-new); } .st-contacted { --c: var(--st-contacted); } .st-booked { --c: var(--st-booked); }
.st-attended { --c: var(--st-attended); } .st-no_show { --c: var(--st-no_show); } .st-lost { --c: var(--st-lost); }
.chip[class*="st-"] { background: color-mix(in srgb, var(--c) 16%, transparent); color: color-mix(in srgb, var(--c) 45%, white); border-color: color-mix(in srgb, var(--c) 35%, transparent); }
.chip.src { background: transparent; border-color: var(--line-strong); }
.chip.ok, .cv-sent { color: #8ef0c4; background: rgba(25, 158, 112, .14); }
.cv-failed { color: #ffab95; background: rgba(224, 96, 74, .16); }
.cv-pending { color: var(--gold-2); background: rgba(212, 166, 61, .14); }
.muted-chip, .cv-skipped { color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); display: inline-block; }

/* ---------- auth ---------- */

.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 500px at 50% -10%, rgba(212, 166, 61, .14), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.auth-logo { display: block; width: 240px; max-width: 70%; height: auto; margin: 0 auto 4px; }
.auth-card h1 { text-align: center; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 44px; height: auto; flex: none; }
.brand-name { font: 600 12px/1.2 var(--font); letter-spacing: 2.5px; direction: ltr;
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 3px; direction: ltr; text-align: right; }
html[dir=ltr] .brand-sub { text-align: left; }
.auth-card { position: relative; }
.lang-switch { position: absolute; top: 14px; inset-inline-end: 14px; display: inline-flex; gap: 6px; align-items: center; background: transparent; border: 1px solid var(--line-strong); color: var(--text-2); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12.5px; cursor: pointer; }
.lang-switch:hover { color: var(--gold-2); border-color: var(--gold-deep); }

/* ---------- layout ---------- */

.layout { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px;
  padding: 18px 12px; background: var(--surface); border-inline-end: 1px solid var(--line); }
.sidebar .brand { padding: 0 6px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-short { display: none; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text-2); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--surface-3); color: var(--gold-2); box-shadow: inset -2px 0 0 var(--gold); }
html[dir=ltr] .nav a.active { box-shadow: inset 2px 0 0 var(--gold); }
.me { display: flex; align-items: center; gap: 4px; padding: 10px 6px 0; border-top: 1px solid var(--line); }
.me-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: var(--text); border-radius: var(--radius-sm); padding: 4px; margin: -4px; text-decoration: none !important; }
.me-link:hover { background: var(--surface-2); }
.lang-code { font-size: 12px; font-weight: 600; letter-spacing: .5px; }
.lang-btn:hover { color: var(--gold-2); }
.me-info { flex: 1; min-width: 0; line-height: 1.3; }
.me-info small { display: block; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--gold-2); font-weight: 600; flex: none; }

.page { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 14px 24px; border-bottom: 1px solid var(--line); }
.topbar-end { display: flex; align-items: center; gap: 8px; min-width: 0; }
.scope { display: flex; align-items: center; gap: 8px; min-width: 0; }
.client-select { width: auto; min-width: 180px; max-width: 280px; }
.branch-select { width: auto; min-width: 140px; max-width: 220px; }
.bell { position: relative; width: 38px; height: 38px; color: var(--text-2); }
.bell:hover { color: var(--gold-2); }
.bell .badge { position: absolute; top: 2px; inset-inline-end: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--gold-grad); color: var(--gold-ink); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg); font-variant-numeric: tabular-nums; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 24px; border-bottom: 1px solid var(--line); }
.toolbar:empty { display: none; }
.toolbar select, .toolbar input:not([type=checkbox]) { width: auto; min-height: 32px; padding: 4px 10px; }
.toolbar input.search { width: 290px; }
.range { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.custom-range { display: inline-flex; gap: 6px; align-items: center; }
.content { padding: 20px 24px 40px; min-width: 0; flex: 1; }
.list-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
/* Wide tables scroll sideways on small screens with an always-visible bar (like the board). */
.table-wrap::-webkit-scrollbar, .import-preview::-webkit-scrollbar { height: 10px; width: 10px; }
.table-wrap::-webkit-scrollbar-track, .import-preview::-webkit-scrollbar-track { background: var(--surface); }
.table-wrap::-webkit-scrollbar-thumb, .import-preview::-webkit-scrollbar-thumb { background: var(--gold-deep); border-radius: 999px; border: 2px solid var(--surface); }
@supports not selector(::-webkit-scrollbar) { .table-wrap, .import-preview { scrollbar-color: var(--gold-deep) var(--surface); } }
.table td.cell-text { white-space: normal; min-width: 96px; max-width: 200px; }
.table td.cell-text.wide { max-width: 240px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: start; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 9px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.table td { padding: 9px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr[tabindex] { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { font-variant-numeric: tabular-nums; }
tr.inactive { opacity: .55; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; }

/* ---------- board ---------- */

.view-board { padding: 16px 24px; overflow: hidden; }
/* All six statuses side by side; below ~1250px the board scrolls sideways with a visible bar. */
.board { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 10px; height: calc(100vh - 150px); }
.board::-webkit-scrollbar { height: 10px; }
.board::-webkit-scrollbar-track { background: var(--surface); border-radius: 999px; border: 1px solid var(--line); }
.board::-webkit-scrollbar-thumb { background: var(--gold-deep); border-radius: 999px; border: 2px solid var(--surface); }
.board::-webkit-scrollbar-thumb:hover { background: var(--gold); }
@supports not selector(::-webkit-scrollbar) { .board { scrollbar-color: var(--gold-deep) var(--surface); } }
.col { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .12s, opacity .12s, background .12s; }
.col { min-width: 0; }
.col header { display: flex; align-items: center; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); font-weight: 600; flex-wrap: wrap; }
.col-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.col-value { flex-basis: 100%; }
.col .count { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.col-body { flex: 1; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 6px; }
.board.dragging .col.no { opacity: .4; }
.board.dragging .col.ok { border-color: var(--line-strong); border-style: dashed; }
.col.over { border-color: var(--gold) !important; background: #1d170b; }
.card { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: border-color .12s, transform .12s; }
.card:hover { border-color: var(--line-strong); }
.card[draggable=true] { cursor: grab; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; min-width: 0; }
.card-top strong { min-width: 0; flex: 1 1 110px; }
.card-top .chip { flex: none; max-width: 100%; }
.card-foot { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.card-foot > :first-child { flex: 1; min-width: 0; }
.card-foot > :last-child { flex: none; white-space: nowrap; }
.card .booking { color: var(--gold-2); display: flex; align-items: center; gap: 4px; }
.more { text-align: center; padding: 6px; }

/* ---------- drawer ---------- */

.drawer { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(560px, 100vw); z-index: 40;
  background: var(--surface); border-inline-start: 1px solid var(--line-strong); box-shadow: var(--shadow);
  display: flex; flex-direction: column; transform: translateX(-100%); transition: transform .2s ease; }
.drawer.open { transform: none; }
html[dir=ltr] .drawer { transform: translateX(100%); }
html[dir=ltr] .drawer.open { transform: none; }
.drawer .loading { padding: 40px; text-align: center; color: var(--muted); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.meta-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; font-size: 13px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px 40px; display: flex; flex-direction: column; gap: 20px; }
.drawer-body section h3 { margin-bottom: 10px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.status-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.status-now, .status-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.st-btn { border-color: color-mix(in srgb, var(--c) 50%, transparent); }
.st-btn:hover { background: color-mix(in srgb, var(--c) 18%, transparent); }
.conv-row { display: flex; gap: 8px; align-items: center; padding: 6px 0; }
.note-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; margin-bottom: 12px; }
.timeline { list-style: none; margin: 0; padding: 0; border-inline-start: 1px solid var(--line-strong); }
.ev { position: relative; padding: 4px 16px 14px; }
.ev::before { content: ''; position: absolute; inset-inline-start: -5px; top: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--line-strong); }
.ev-note::before { }
.ev.ev-note::before { background: var(--gold); border-color: var(--gold); }
.ev.ev-status::before { background: var(--gold-2); border-color: var(--gold-2); }
.ev-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.ev-note { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 6px 0 0; }

/* ---------- modal / toast / tooltip ---------- */

.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .6); display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 16px; }
.modal.wide { width: min(980px, 100%); }
.modal { width: min(620px, 100%); max-width: 100%; min-width: 0; max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow); }
.modal header, .modal footer { display: flex; align-items: center; gap: 8px; padding: 14px 18px; }
.modal header { justify-content: space-between; border-bottom: 1px solid var(--line); }
.modal footer { justify-content: flex-end; border-top: 1px solid var(--line); }
.modal-body { padding: 18px; overflow-y: auto; }
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--surface-3); border: 1px solid var(--line-strong); border-inline-start: 3px solid var(--gold); padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); transition: opacity .3s, transform .3s; max-width: 90vw; }
.toast.err { border-inline-start-color: var(--danger); }
.toast.out { opacity: 0; transform: translateY(6px); }
.tooltip { position: fixed; z-index: 90; pointer-events: none; background: #000; color: var(--text); border: 1px solid var(--line-strong); padding: 5px 9px; border-radius: 6px; font-size: 12.5px; max-width: 320px; white-space: pre-wrap; }

/* ---------- dashboard ---------- */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.tile-label, .tile-sub { overflow-wrap: anywhere; }
.money .cur { font-size: .55em; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.tile-label { color: var(--text-2); font-size: 13px; }
.tile-value { font-size: 26px; font-weight: 600; margin-top: 4px; color: var(--text); line-height: 1.25; overflow-wrap: anywhere; }
.tile-sub { font-size: 12px; margin-top: 2px; }
.status-strip { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 16px; }
.strip-item { display: inline-flex; gap: 6px; align-items: center; font-variant-numeric: tabular-nums; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.panel .table-wrap { border: 0; border-radius: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.bars-cell { width: 34%; min-width: 160px; }
.fbars { display: flex; flex-direction: column; gap: 2px; }
.fbar-track { height: 8px; display: flex; }
.fbar { height: 100%; border-radius: 0 4px 4px 0; }
[dir=rtl] .fbar { border-radius: 4px 0 0 4px; }
.chart-wrap { width: 100%; min-height: 190px; }
.chart { display: block; }
.chart .chart-empty { fill: var(--muted); font-size: 13px; font-family: var(--font); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .bar { fill: var(--gold); }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: rgba(255, 255, 255, .04); }
.conv-sum { display: flex; flex-direction: column; gap: 6px; }

/* ---------- today ---------- */

.view-today { max-width: 900px; }
.day-title { margin-inline-start: 8px; }
.today-list { display: flex; flex-direction: column; gap: 10px; }
.booking-row { display: grid; grid-template-columns: minmax(76px, auto) 1fr auto auto; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.b-time { font-size: 17px; font-weight: 600; color: var(--gold-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.b-main { cursor: pointer; min-width: 0; }
.b-tags, .b-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.st-row-attended { border-inline-start: 3px solid var(--st-attended); }
.st-row-no_show { border-inline-start: 3px solid var(--st-no_show); opacity: .8; }

/* ---------- settings ---------- */

.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { white-space: nowrap; }
.tabs a { padding: 6px 12px; border-radius: var(--radius-sm); color: var(--text-2); }
.tabs a.active { background: var(--surface-3); color: var(--gold-2); }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; }
.client-card { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.client-card.inactive { opacity: .6; }
.client-card h3 { color: var(--text); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.copy-row { display: flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding-block: 4px; padding-inline: 8px 4px; }
.copy-row code { flex: 1; min-width: 0; color: var(--text-2); }
.help summary { cursor: pointer; color: var(--gold-2); }
.help { margin-top: 16px; }
.client-checks { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; }
.client-checks legend { color: var(--text-2); font-size: 12.5px; padding: 0 4px; }

/* ---------- mobile ---------- */

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; bottom: 0; top: auto; inset-inline: 0; height: auto; z-index: 30; flex-direction: row; padding: 6px; border: 0; border-top: 1px solid var(--line); gap: 0; }
  .sidebar .brand, .me-info { display: none; }
  .me { border: 0; padding: 0; }
  /* Bottom bar: pages + avatar only (language and sign-out live on the profile page), every item
     gets an equal share and a short label of up to two lines. */
  .nav { flex-direction: row; justify-content: space-around; min-width: 0; gap: 0; }
  .nav a { flex-direction: column; gap: 2px; font-size: 10.5px; line-height: 1.25; padding: 5px 2px; flex: 1 1 0; min-width: 0; text-align: center; }
  .nav-full { display: none; }
  .nav-short { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; max-width: 100%; }
  .me .lang-btn, .me .logout-btn { display: none; }
  .me-link { margin: 0; padding: 0; }
  .sidebar { gap: 4px; }
  .nav a.active { box-shadow: none; }
  .page { padding-bottom: 64px; }
  .topbar, .toolbar, .content, .view-board { padding-inline: 16px; }
  .toolbar input.search { width: 100%; }
  /* One full column per screen, snapping on swipe (no half-visible neighbour). */
  .board { height: calc(100vh - 230px); grid-template-columns: repeat(6, calc(100vw - 32px)); scroll-snap-type: x mandatory; gap: 16px; }
  .board .col { scroll-snap-align: start; }
  .topbar { flex-wrap: wrap; }
  .topbar-end { width: 100%; }
  .scope { flex: 1; }
  .scope select { flex: 1; min-width: 0; max-width: none; }
  .me-link { flex: none; }
  .avatar { display: grid; }
  .grid2 { grid-template-columns: 1fr; }
  .booking-row { grid-template-columns: auto 1fr; }
  .b-time { white-space: nowrap; }
  .b-tags, .b-actions { grid-column: 1 / -1; }
  .b-actions .btn { flex: 1; }
  .cards-grid { grid-template-columns: 1fr; }
  .drawer { width: 100vw; }
  .client-select { min-width: 0; max-width: 55vw; }
}

/* ---------- WhatsApp menu & contact buttons ---------- */

.btn.icon-only { width: 30px; padding: 0; }
.row-actions { display: flex; gap: 4px; }
.menu { position: fixed; z-index: 70; min-width: 240px; max-width: min(340px, calc(100vw - 16px)); max-height: 60vh; overflow-y: auto;
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; }
.menu-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: start;
  padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); outline: none; }
.menu-item.sep { border-top: 1px solid var(--line); border-radius: 0 0 6px 6px; margin-top: 4px; }
.menu-title { font-weight: 500; }
.menu-preview { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.warn-text { color: var(--warn); }
.late { color: #ff9b7a; }
.status-btns.follow strong { font-weight: 600; }

/* ---------- call list / no-shows ---------- */

.view-followups { max-width: 1100px; }
.call-section { margin-bottom: 22px; }
.call-section h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.call-section h3 .count { color: var(--muted); font-weight: 500; }
.call-section.overdue h3 { color: #ff9b7a; }
.call-list, .call-section { display: flex; flex-direction: column; gap: 8px; }
.call-row { display: grid; grid-template-columns: minmax(150px, 1.2fr) auto minmax(160px, 1.4fr) auto; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.call-section.overdue .call-row { border-inline-start: 3px solid var(--st-no_show); }
.call-info { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; min-width: 0; color: var(--text-2); }
.call-info .ellipsis { flex-basis: 100%; }
.warn-chip { color: #ffb58f; background: rgba(217, 89, 38, .16); }

/* ---------- response-time bars ---------- */

.hbars { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 16px; }
.hbar-row { display: grid; grid-template-columns: 130px 1fr 90px; align-items: center; gap: 12px; font-size: 13px; }
.hbar-track { height: 12px; display: flex; }
.hbar { height: 100%; background: var(--gold); border-radius: 4px 0 0 4px; min-width: 2px; }
html[dir=ltr] .hbar { border-radius: 0 4px 4px 0; }
.hbar-row .num { font-variant-numeric: tabular-nums; }

/* ---------- templates ---------- */

select.auto { width: auto; min-width: 200px; }
.tpl-card { display: flex; flex-direction: column; gap: 12px; }
.tpl-edit { display: flex; flex-direction: column; gap: 10px; }
.wa-preview { margin-top: 4px; background: #0b2a20; border: 1px solid #1d4d3b; color: #e8f5ee; border-radius: 10px 10px 2px 10px;
  padding: 10px 12px; white-space: pre-wrap; min-height: 80px; font-size: 13.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-btn { cursor: pointer; border: 1px solid var(--line-strong); font-family: var(--font); }
.chip-btn:hover { border-color: var(--gold); color: var(--gold-2); }
.end.gap { gap: 8px; }
.section-title { margin: 18px 0 10px; }

@media (max-width: 860px) {
  .call-row { grid-template-columns: 1fr auto; }
  .call-info, .call-row .b-actions { grid-column: 1 / -1; }
  .hbar-row { grid-template-columns: 96px 1fr 70px; }
}

/* ---------- work hours ---------- */

.hours-panel { display: flex; flex-direction: column; gap: 14px; }
.modes { display: flex; gap: 20px; }
.hours-grid { display: flex; flex-direction: column; gap: 6px; }
.hours-day { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.hours-day.closed { opacity: .6; }
.day-name { font-weight: 500; color: var(--text); }
.shifts { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.shift { display: inline-flex; align-items: center; gap: 6px; }
.shift input[type=time] { width: 120px; }
@media (max-width: 860px) { .hours-day { grid-template-columns: 1fr; } }

/* ---------- settings: client cards, branches, connection guide ---------- */

.gap-row { display: flex; gap: 6px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; }
.kv > span:nth-child(even) { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-width: 0; }
.link-btn { background: none; border: 0; padding: 0; color: var(--gold-2); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.form-section { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--text); }
.branches-editor { display: flex; flex-direction: column; gap: 10px; }
.branch-list { display: flex; flex-direction: column; gap: 6px; }
.branch-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center; }
.branch-row.add { grid-template-columns: 1fr auto; padding-top: 10px; border-top: 1px solid var(--line); }
.branch-row.inactive input:not([type=checkbox]) { opacity: .6; }
.guide { display: flex; flex-direction: column; gap: 10px; }
.guide h3 { color: var(--text); margin-top: 8px; }
.steps { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 4px; color: var(--text-2); }
.copy-block { display: flex; flex-direction: column; gap: 4px; }
.copy-block-head { display: flex; justify-content: space-between; align-items: center; }
.copy-block pre { margin: 0; max-height: 260px; overflow-y: auto; }
.help ul { margin: 6px 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 4px; }

/* ---------- import ---------- */

.import { display: flex; flex-direction: column; gap: 14px; }
.import-map { display: flex; flex-direction: column; gap: 8px; }
.import-map:empty, .import-summary:empty, .import-preview:empty { display: none; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.import-summary { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.import-preview { max-height: 320px; overflow: auto; }

/* ---------- dashboard: team ---------- */

.rate { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.rate .num { min-width: 38px; }
.rate-track { flex: 1; height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; display: flex; }
.rate-bar { height: 100%; background: var(--gold); border-radius: 999px; }
.rate-bar.alt { background: var(--gold-deep); }

/* ---------- profile / activity ---------- */

.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; max-width: 900px; align-items: start; }
.profile-card { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.profile-card h3 { color: var(--text); }
.view-activity { max-width: 1000px; }
.activity-list .ev { padding-bottom: 12px; }
.ev.ev-system::before { background: var(--surface-3); border-color: var(--gold-deep); }
.last-note { display: flex; align-items: center; gap: 4px; }

@media (max-width: 860px) {
  .grid4 { grid-template-columns: 1fr 1fr; }
  .branch-row { grid-template-columns: 1fr auto; }
  .kv { grid-template-columns: 1fr; }
}

/* ---------- phones: tables as cards, tiles ---------- */

@media (max-width: 860px) {
  .tiles > .tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tbody tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .table tbody tr:last-child { border-bottom: 0; }
  /* Label on one side, the cell's content stacked on the other. */
  .table td, .table td.cell-text, .table td.cell-text.wide { display: grid; grid-template-columns: minmax(0, 40%) minmax(0, 1fr); column-gap: 12px;
    align-items: center; padding: 4px 12px; border: 0; white-space: normal; max-width: none; min-width: 0; text-align: end; }
  .table td > * { grid-column: 2; justify-self: end; min-width: 0; max-width: 100%; }
  .table td::before { content: attr(data-label); grid-column: 1; grid-row: 1 / span 4; color: var(--muted); font-size: 12px; text-align: start; }
  .table td[data-label=""] { display: flex; justify-content: flex-start; gap: 6px; }
  .table td[data-label=""]::before { content: none; }
  html[dir=rtl] .table td > :is(.clamp2, .ellipsis) { text-align: left; }
  html[dir=ltr] .table td > :is(.clamp2, .ellipsis) { text-align: right; }
  /* First cell = the row's title (name + phone): stacked, no label. */
  .table td:first-child { display: block; font-size: 15px; text-align: start; }
  .table td:first-child > * { text-align: inherit; }
  html[dir=rtl] .table td:first-child > :is(.clamp2, .sub) { text-align: right; }
  html[dir=ltr] .table td:first-child > :is(.clamp2, .sub) { text-align: left; }
  .table td:first-child::before { content: none; }
  .table td.empty { display: block; text-align: center; }
  .table .bars-cell { width: 100%; }
  .table .bars-cell .fbars { width: 100%; }
  .rate { flex: 1; max-width: 220px; }
}

/* Staging marker (never shown in production). */
.env-banner { background: repeating-linear-gradient(135deg, #3a2a05 0 12px, #2e2104 12px 24px); color: var(--gold-3);
  border-bottom: 1px solid var(--gold-deep); padding: 6px 24px; font-size: 12.5px; font-weight: 600; text-align: center; }

.notice { border: 1px solid var(--line-strong); background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; overflow-wrap: anywhere; }
.notice.ok { border-color: #1d5c43; background: rgba(25, 158, 112, .1); color: #a9f0cf; }
.notice.err { border-color: #7a3424; background: rgba(224, 96, 74, .1); color: #ffc2b3; }

/* ---------- two-step verification ---------- */
.code-input { font: 600 22px/1.2 ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: 6px; text-align: center !important; min-height: 48px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.qr-box { display: grid; place-items: center; padding: 6px; }
.qr { border-radius: 8px; background: #fff; max-width: 100%; height: auto; }
.secret { display: block; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font-size: 15px; letter-spacing: 1px; text-align: center; overflow-wrap: anywhere; user-select: all; }
.manual-key summary { cursor: pointer; color: var(--gold-2); }
.manual-key .secret { margin-top: 8px; }
.recovery { display: flex; flex-direction: column; gap: 10px; }
.recovery-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; margin: 0; padding: 12px 12px 12px 34px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font-size: 15px; }
.grid1 { display: flex; flex-direction: column; gap: 12px; }
.enroll-inline { display: flex; flex-direction: column; gap: 12px; }
.enroll-inline h1 { font-size: 16px; }
.user-resets { padding-top: 10px; border-top: 1px solid var(--line); }

.rules { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); }

/* ---------- privacy policy (static page) ---------- */
.doc-page { min-height: 100%; }
.doc { max-width: 820px; margin: 0 auto; padding: 24px 20px 64px; line-height: 1.8; }
.doc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.doc h1 { font-size: 24px; margin-bottom: 4px; }
.doc h2 { font-size: 17px; margin: 26px 0 8px; color: var(--gold-2); }
.doc ul { padding-inline-start: 22px; margin: 0; }
.doc li { margin: 4px 0; }
.doc hr { border: 0; border-top: 1px solid var(--line-strong); margin: 40px 0; }
.auth-foot { text-align: center; font-size: 12px; }

.alert-steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.alert-steps li { overflow-wrap: anywhere; }

.lp-editor input[type=color] { min-height: 40px; padding: 4px; cursor: pointer; }

.platforms { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.platform-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.platform-main { min-width: 0; flex: 1; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.platform-main > div { flex-basis: 100%; }
.err-text { color: #ffab95; }

.view { min-width: 0; }

/* Sign-in header: app icon next to the platform name. */
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 6px 0 4px; }
.auth-icon { width: 64px; height: 64px; flex: none; filter: drop-shadow(0 6px 18px rgba(212, 166, 61, .25)); }
.auth-name { font: 700 24px/1.1 var(--font-head); letter-spacing: .5px; direction: ltr; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-sub { font-size: 12px; letter-spacing: 3px; color: var(--muted); direction: ltr; text-transform: uppercase; margin-top: 4px; }
html[dir=rtl] .auth-sub, html[dir=rtl] .auth-name { text-align: right; }

/* ---------- install the app ---------- */
.install-banner { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--surface-2); border-bottom: 1px solid var(--gold-deep); }
.install-banner img { flex: none; }
.install-text { flex: 1; min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.install { display: flex; flex-direction: column; gap: 14px; }
.install-os { display: flex; flex-direction: column; gap: 10px; }
.install-os h3 { color: var(--text); }
.install-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.install-steps li { display: flex; gap: 10px; align-items: flex-start; overflow-wrap: anywhere; }
.step-n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--gold-grad); color: var(--gold-ink); font-weight: 700; font-size: 13px; }
.inline-icon { vertical-align: middle; color: var(--gold-2); }
.install-more summary { cursor: pointer; color: var(--gold-2); }
.install-more[open] { display: flex; flex-direction: column; gap: 14px; }

/* ---------- one hand on phones: thumb-size targets, actions at the bottom ---------- */
.drawer-foot, .fab { display: none; }
.quick-contact { display: contents; }
@media (max-width: 860px) {
  /* 16px stops iPhone Safari from zooming into fields on focus. */
  input, select, textarea { font-size: 16px; }
  .b-actions .btn, .call-row .btn, .status-btns .btn, .drawer .btn, .booking-row .btn, .modal footer .btn, .pager .btn { min-height: 44px; }
  .btn.icon-only { width: 44px; height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .call-row .b-actions, .booking-row .b-actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
  .call-row .b-actions .btn, .booking-row .b-actions .btn { width: 100%; }
  .sidebar { padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  .page { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  /* Lead window: contact + next step in a bottom bar */
  .drawer .quick-contact { display: none; }
  .drawer-foot { display: flex; align-items: center; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-strong); background: var(--surface-2); }
  .drawer-foot .btn { min-height: 48px; }
  .drawer-foot .btn.icon-only { width: 48px; height: 48px; padding: 0; }
  .drawer-foot .grow { flex: 1; min-width: 0; }
  /* Round, icon only (label for screen readers): covers as little of the list as possible. */
  .fab { position: fixed; inset-inline-end: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 25; display: grid; place-items: center;
    width: 56px; height: 56px; padding: 0; border-radius: 50%; border: 0; background: var(--gold-grad); color: var(--gold-ink);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .55); cursor: pointer; }
  .fab span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .view-today .today-list { margin-bottom: 84px; }
  .view-today .today-list, .view-leads .pager { margin-bottom: 70px; }
}
