/* ============================================================================
   Seven Stars Clinic CRM — "Day sheet"
   Cool clinical porcelain, aubergine ink, gold only where the brand speaks.
   Signature: the gold "now" line with a star on today's appointment sheet.
   ========================================================================== */

:root {
  --porcelain: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fafafc;
  --ink: #1f1b24;
  --ink-2: #3d3746;
  --mist: #6e6878;
  --hairline: #e4e2e8;
  --hairline-2: #efedf2;

  --gold: #b38b3f;
  --gold-deep: #8d6a27;
  --gold-tint: #f7f0e1;
  --gold-grad: linear-gradient(100deg, #e6c97a 0%, #cfaa5a 45%, #b38b3f 100%);

  /* Lead status — every color encodes a stage of the patient journey. */
  --st-new: #3e63dd;       --st-new-bg: #edf1fd;
  --st-follow: #b36b0c;    --st-follow-bg: #fcf2e3;
  --st-booked: #7048c8;    --st-booked-bg: #f2edfb;
  --st-converted: #16805a; --st-converted-bg: #e5f5ee;
  --st-noshow: #c93b3b;    --st-noshow-bg: #fcebeb;
  --st-closed: #7f7a88;    --st-closed-bg: #f0eff2;

  --font-display: "Marcellus", "Times New Roman", serif;
  --font-body: "Manrope", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --r-lg: 14px;
  --r-md: 10px;
  --r-sm: 7px;
  --shadow-1: 0 1px 2px rgba(31, 27, 36, .05);
  --shadow-2: 0 1px 2px rgba(31, 27, 36, .04), 0 8px 24px rgba(31, 27, 36, .07);
  --shadow-3: 0 18px 48px rgba(31, 27, 36, .18);

  --rail-w: 232px;
  --tabbar-h: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--porcelain);
  color: var(--ink);
  font: 500 14.5px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--gold-deep); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
::selection { background: rgba(179, 139, 63, .22); }

.mono { font-family: var(--font-mono); font-size: .93em; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.muted { color: var(--mist); }
.ar { font-family: "IBM Plex Sans Arabic", var(--font-body); }
.nowrap { white-space: nowrap; }

/* ───────────── Boot + auth ───────────── */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--surface); }
.boot img { animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; } }

.auth { min-height: 100%; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(1200px 500px at 50% -10%, var(--gold-tint), transparent 70%), var(--porcelain); }
.auth__card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 18px; box-shadow: var(--shadow-2); padding: 34px 30px 28px; }
.auth__card img { display: block; width: 150px; height: auto; margin: 0 auto 6px; }
.auth__card h2 { font: 400 26px/1.2 var(--font-display); text-align: center; margin: 10px 0 4px; }
.auth__card p { text-align: center; color: var(--mist); margin: 0 0 22px; }
.auth__card .btn { width: 100%; justify-content: center; margin-top: 6px; }

/* ───────────── Shell ───────────── */
.shell { display: grid; grid-template-columns: var(--rail-w) 1fr; min-height: 100%; }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--hairline); padding: 22px 14px 14px; }
.rail__logo { width: 118px; height: auto; margin: 0 0 22px 10px; }
.rail__nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--r-md);
  color: var(--ink-2); text-decoration: none; font-weight: 600; border: 0; background: none; cursor: pointer; text-align: left; }
.nav-link svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-link:hover { background: var(--porcelain); }
.nav-link[aria-current="page"] { background: var(--ink); color: #fff; }
.nav-link .count { margin-left: auto; font: 500 11.5px/1 var(--font-mono); padding: 3px 6px; border-radius: 99px;
  background: var(--st-noshow); color: #fff; }
.nav-link[aria-current="page"] .count { background: var(--gold); }
.rail__foot { margin-top: auto; border-top: 1px solid var(--hairline); padding-top: 12px; }
.user-chip { width: 100%; display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 8px;
  border-radius: var(--r-md); cursor: pointer; text-align: left; }
.user-chip:hover { background: var(--porcelain); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--gold-tint); color: var(--gold-deep); font: 400 15px/1 var(--font-display); }
.avatar--btn { display: none; border: 0; cursor: pointer; width: 38px; height: 38px; }
.user-chip b { display: block; font-weight: 700; font-size: 13.5px; line-height: 1.25; }
.user-chip small { color: var(--mist); font-size: 12px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  padding: 16px 28px; background: rgba(244, 245, 247, .9); backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent; }
.topbar__heading { min-width: 0; margin-right: auto; }
.topbar__title { font: 400 25px/1.15 var(--font-display); margin: 0; letter-spacing: .01em; }
.topbar__clock { margin: 1px 0 0; color: var(--mist); font-size: 13px; }
.search input { width: 260px; height: 40px; border: 1px solid var(--hairline); background: var(--surface) no-repeat 12px 50%/16px
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e6878' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  border-radius: var(--r-md); padding: 0 12px 0 36px; }
.search input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-tint); }
.view { padding: 8px 28px 40px; outline: none; }

/* ───────────── Buttons ───────────── */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: var(--r-md);
  border: 1px solid var(--hairline); background: var(--surface); color: var(--ink); font-weight: 650; font-size: 14px;
  cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { border-color: #cfccd6; background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.btn--gold { background: var(--ink); border-color: var(--ink); color: #fff; position: relative; }
.btn--gold::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 5px; height: 2px; border-radius: 2px; background: var(--gold-grad); opacity: .9; }
.btn--gold:hover { background: #2e2835; border-color: #2e2835; }
.btn--wa { background: #1f8f4e; border-color: #1f8f4e; color: #fff; }
.btn--wa:hover { background: #197a42; border-color: #197a42; }
.btn--danger { color: var(--st-noshow); }
.btn--danger:hover { background: var(--st-noshow-bg); border-color: #f1c5c5; }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--ghost:hover { background: var(--hairline-2); border-color: transparent; }
.btn--sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn--icon { width: 36px; padding: 0; justify-content: center; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ───────────── Surfaces ───────────── */
.panel { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.panel__head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--hairline-2); }
.panel__head h2, .panel__head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.panel__head .spacer { flex: 1; }
.panel__body { padding: 16px 18px; }
.eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--mist); }
.empty { padding: 26px 18px; text-align: center; color: var(--mist); }
.empty b { display: block; color: var(--ink-2); font-weight: 700; margin-bottom: 2px; }

/* ───────────── Pills ───────────── */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 23px; padding: 0 9px; border-radius: 99px;
  font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--NEW { color: var(--st-new); background: var(--st-new-bg); }
.pill--FOLLOW_UP { color: var(--st-follow); background: var(--st-follow-bg); }
.pill--BOOKED, .pill--SCHEDULED, .pill--CONFIRMED { color: var(--st-booked); background: var(--st-booked-bg); }
.pill--CONVERTED, .pill--ATTENDED, .pill--QUALIFIED { color: var(--st-converted); background: var(--st-converted-bg); }
.pill--NO_SHOW, .pill--NOT_QUALIFIED { color: var(--st-noshow); background: var(--st-noshow-bg); }
.pill--CLOSED, .pill--CANCELLED, .pill--PENDING { color: var(--st-closed); background: var(--st-closed-bg); }
.pill--plain::before { display: none; }
.flag { display: inline-flex; align-items: center; height: 19px; padding: 0 6px; border-radius: 5px; font-size: 10.5px; font-weight: 800;
  letter-spacing: .04em; color: var(--st-noshow); background: var(--st-noshow-bg); vertical-align: 1px; }

/* ───────────── Forms ───────────── */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span, .field-label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.field small { color: var(--mist); font-size: 12px; }
.input, select.input, textarea.input { width: 100%; height: 40px; border: 1px solid var(--hairline); border-radius: var(--r-md);
  background: var(--surface); padding: 0 11px; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
select.input { appearance: none; padding-right: 32px; background: var(--surface) no-repeat right 11px center/12px
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%236e6878' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E"); }
.input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-tint); }
.input.is-invalid { border-color: var(--st-noshow); box-shadow: 0 0 0 3px var(--st-noshow-bg); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.hint { font-size: 12.5px; color: var(--mist); }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md); font-size: 13px;
  background: var(--st-follow-bg); color: #6d4309; }
.notice--danger { background: var(--st-noshow-bg); color: #8a2323; }
.notice--info { background: var(--st-new-bg); color: #243f99; }
.notice a, .notice button.linklike { color: inherit; font-weight: 700; }
.linklike { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* Chip choices: one tap for the answers the front desk gives fifty times a day. */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--hairline); background: var(--surface);
  font-size: 13px; font-weight: 650; cursor: pointer; color: var(--ink-2); }
.chip:hover { border-color: #cfccd6; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--hairline-2); }
.seg button { height: 32px; padding: 0 13px; border: 0; background: none; border-radius: 8px; font-size: 13px; font-weight: 700;
  color: var(--mist); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.seg--full { display: flex; }
.seg--full button { flex: 1; }
.seg button[data-tone="good"][aria-pressed="true"] { color: var(--st-converted); }
.seg button[data-tone="bad"][aria-pressed="true"] { color: var(--st-noshow); }

/* ───────────── Toolbar / filters ───────────── */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 14px; }
.toolbar .input { width: auto; height: 36px; font-size: 13.5px; }
.toolbar .spacer { flex: 1; }
.filter-sum { font-size: 13px; color: var(--mist); }

/* ───────────── Tables ───────────── */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--mist);
  padding: 10px 14px; border-bottom: 1px solid var(--hairline); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--hairline-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.is-clickable { cursor: pointer; }
.tbl tbody tr.is-clickable:hover td { background: #fbf9f4; }
.tbl .num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl th.num { font-family: var(--font-body); }
.tbl th button { font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.tbl .best td { background: #fbf6ea; }
.cell-main { font-weight: 700; }
.cell-sub { font-size: 12.5px; color: var(--mist); }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding: 12px 14px; border-top: 1px solid var(--hairline-2); }

/* ───────────── Today: queue + day sheet ───────────── */
.today { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.queue-tabs { display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--hairline-2); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.queue-tab { position: relative; display: flex; align-items: baseline; gap: 7px; padding: 10px 12px 12px; border: 0; background: none;
  font-weight: 700; color: var(--mist); cursor: pointer; white-space: nowrap; }
.queue-tab b { font: 500 13px/1 var(--font-mono); color: var(--ink-2); }
.queue-tab[aria-selected="true"] { color: var(--ink); }
.queue-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; background: var(--ink); border-radius: 2px; }
.queue-tab.is-urgent b { color: var(--st-noshow); }
.q-item { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; padding: 13px 18px; border-bottom: 1px solid var(--hairline-2); }
.q-item:last-child { border-bottom: 0; }
.q-item__who { min-width: 0; }
.q-item__who button { background: none; border: 0; padding: 0; font-weight: 750; font-size: 14.5px; cursor: pointer; text-align: left; }
.q-item__who button:hover { color: var(--gold-deep); }
.q-item__meta { font-size: 12.5px; color: var(--mist); display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 1px; }
.q-item__note { grid-column: 1 / -1; font-size: 13px; color: var(--ink-2); background: var(--surface-2); border-radius: var(--r-sm); padding: 6px 9px; }
.q-item__actions { display: flex; gap: 6px; align-items: center; align-self: center; }
.late { color: var(--st-noshow); font-weight: 700; }

.sheet { position: relative; padding: 14px 0 10px; }
.sheet__row { position: relative; display: grid; grid-template-columns: 64px 1fr; min-height: 58px; }
/* Labels sit on their hour line, so the gold "now" line reads correctly against them. */
.sheet__time { padding: 0 0 0 18px; transform: translateY(-6px); font: 500 12.5px/1 var(--font-mono); color: var(--mist); }
.sheet__slot { border-top: 1px solid var(--hairline-2); padding: 6px 14px 6px 10px; display: flex; flex-direction: column; gap: 6px; }
.appt { display: grid; grid-template-columns: 3px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px 8px 0; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--hairline-2); cursor: pointer; text-align: left; width: 100%; }
.appt:hover { border-color: var(--hairline); background: #fff; box-shadow: var(--shadow-1); }
.appt__bar { align-self: stretch; border-radius: 0 3px 3px 0; background: var(--st-booked); }
.appt--ATTENDED .appt__bar { background: var(--st-converted); }
.appt--NO_SHOW .appt__bar { background: var(--st-noshow); }
.appt--CANCELLED { opacity: .55; }
.appt--CANCELLED .appt__bar { background: var(--st-closed); }
.appt__open { min-width: 0; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; color: inherit; }
.appt__open:hover b { color: var(--gold-deep); }
.appt b { display: block; font-weight: 750; font-size: 13.5px; }
.appt small { color: var(--mist); font-size: 12px; }
.appt__time { font: 500 12px/1 var(--font-mono); color: var(--ink-2); }
/* Week columns are narrow: stack time, name and service instead of a row. */
.appt--compact { grid-template-columns: 3px 1fr; gap: 9px; padding: 7px 8px 7px 0; }
.appt__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.appt--compact b, .appt--compact small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appt--compact .appt__time { font-size: 11.5px; color: var(--mist); }
.appt--compact.appt--NO_SHOW .appt__time { color: var(--st-noshow); }
.appt--compact.appt--ATTENDED .appt__time { color: var(--st-converted); }

/* Signature: the clinic's "now", drawn in gold across the day sheet. */
.now-line { position: absolute; left: 70px; right: 12px; height: 0; border-top: 1.5px solid var(--gold); z-index: 2; pointer-events: none;
  transition: top .6s ease; }
.now-line::before { content: ""; position: absolute; left: -9px; top: -9px; width: 17px; height: 17px; background: var(--gold-grad);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.now-line span { position: absolute; right: 0; top: -19px; font: 500 11px/1 var(--font-mono); color: var(--gold-deep); background: var(--surface);
  padding: 2px 5px; border-radius: 4px; }

/* ───────────── Drawer + modal ───────────── */
.drawer, .modal { position: fixed; inset: 0; z-index: 50; }
.drawer__scrim, .modal__scrim { position: absolute; inset: 0; background: rgba(31, 27, 36, .32); animation: fade .18s ease; }
.drawer__panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--surface);
  box-shadow: var(--shadow-3); display: flex; flex-direction: column; animation: slide-in .22s cubic-bezier(.2, .8, .2, 1); }
.modal { display: grid; place-items: center; padding: 18px; }
.modal__panel { position: relative; width: min(540px, 100%); max-height: calc(100vh - 36px); overflow: auto; background: var(--surface);
  border-radius: 16px; box-shadow: var(--shadow-3); animation: pop .18s ease; }
.modal__panel.is-wide { width: min(780px, 100%); }
@keyframes fade { from { opacity: 0; } }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.985); opacity: 0; } }
.sheet-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 14px; border-bottom: 1px solid var(--hairline-2); }
.sheet-head h2 { font: 400 22px/1.2 var(--font-display); margin: 0; overflow-wrap: anywhere; }
.sheet-head p { margin: 3px 0 0; color: var(--mist); font-size: 13px; }
.sheet-head .close { margin-left: auto; }
.sheet-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.sheet-foot { display: flex; gap: 8px; align-items: center; padding: 14px 22px; border-top: 1px solid var(--hairline-2); background: var(--surface-2); }
.sheet-foot .spacer { flex: 1; }
.section-title { font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--mist);
  margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--hairline-2); }
.section-title:first-child { margin-top: 0; }
.dupe { margin-top: 6px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 20px; font-size: 13.5px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--hairline); }
.timeline li::after { content: ""; position: absolute; left: 7px; top: 17px; bottom: 0; width: 1px; background: var(--hairline-2); }
.timeline li:last-child::after { display: none; }
.timeline li[data-type="STATUS"]::before { background: var(--st-booked); }
.timeline li[data-type="WHATSAPP"]::before { background: #1f8f4e; }
.timeline li[data-type="CALL"]::before { background: var(--st-new); }
.timeline li[data-type="NOTE"]::before { background: var(--gold); }
.timeline .when { color: var(--mist); font-size: 12px; }
.timeline .body { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ───────────── Appointments week ───────────── */
.week { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.day-col { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-lg); min-height: 280px; display: flex; flex-direction: column; }
.day-col__head { padding: 10px 12px; border-bottom: 1px solid var(--hairline-2); display: flex; align-items: baseline; gap: 6px; }
.day-col__head b { font: 400 20px/1 var(--font-display); }
.day-col__head span { color: var(--mist); font-size: 12.5px; font-weight: 700; }
.day-col__head .cnt { margin-left: auto; font: 500 12px/1 var(--font-mono); color: var(--mist); }
.day-col.is-today { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-tint); }
.day-col.is-today .day-col__head b { color: var(--gold-deep); }
.day-col__list { padding: 8px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.day-col__add { margin: 0 8px 8px; }

/* ───────────── Dashboard ───────────── */
.funnel { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-1); }
.funnel__step { position: relative; padding: 18px 20px 16px; border-right: 1px solid var(--hairline-2); }
.funnel__step:last-child { border-right: 0; }
.funnel__step .eyebrow { display: block; margin-bottom: 6px; }
.funnel__value { font: 400 34px/1 var(--font-display); letter-spacing: .01em; }
.funnel__cost { margin-top: 10px; font-size: 12.5px; color: var(--mist); }
.funnel__cost b { font-family: var(--font-mono); font-weight: 500; color: var(--ink); }
.funnel__rate { position: absolute; top: 18px; right: 16px; font: 500 12px/1 var(--font-mono); color: var(--gold-deep);
  background: var(--gold-tint); padding: 4px 6px; border-radius: 5px; }
.funnel__bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--gold-grad); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 12px 0 18px; }
.stat { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 12px 14px; }
.stat .eyebrow { font-size: 10.5px; }
.stat__value { font: 500 19px/1.2 var(--font-mono); margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat__value.is-bad { color: var(--st-noshow); }
.stat__value.is-good { color: var(--st-converted); }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.trend { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding: 12px 18px 8px; }
.trend__col { flex: 1; min-width: 4px; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; position: relative; }
.trend__lead { background: var(--hairline); border-radius: 3px 3px 0 0; }
.trend__qual { background: var(--gold); border-radius: 3px 3px 0 0; position: absolute; left: 0; right: 0; bottom: 0; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--mist); padding: 0 18px 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.bar-cell { display: flex; align-items: center; gap: 8px; }
.bar-cell i { display: block; height: 6px; border-radius: 3px; background: var(--gold); min-width: 2px; }

/* ───────────── Settings ───────────── */
.tabs-line { display: flex; gap: 2px; border-bottom: 1px solid var(--hairline); margin-bottom: 18px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs-line button { padding: 10px 14px; border: 0; background: none; font-weight: 700; color: var(--mist); cursor: pointer; position: relative; white-space: nowrap; }
.tabs-line button[aria-selected="true"] { color: var(--ink); }
.tabs-line button[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; background: var(--gold); }
.list-editor { display: flex; flex-direction: column; gap: 6px; }
.list-editor__row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.list-editor__row.is-service { grid-template-columns: 1.2fr 1fr 130px auto; }
.upload { border: 1.5px dashed #d6d2dc; border-radius: var(--r-lg); padding: 22px; text-align: center; background: var(--surface-2); }
.upload input { max-width: 100%; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13.5px; }
.kv dt { color: var(--mist); }
.kv dd { margin: 0; font-weight: 650; }

/* ───────────── Toast ───────────── */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; background: var(--ink); color: #fff;
  padding: 11px 16px; border-radius: 11px; box-shadow: var(--shadow-3); font-weight: 600; font-size: 14px; max-width: calc(100% - 32px); animation: pop .18s ease; }
.toast.is-error { background: #8a2323; }

/* ───────────── Mobile tab bar ───────────── */
.tabbar { display: none; }

/* ───────────── Responsive ───────────── */
@media (max-width: 1180px) {
  .today { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .search input { width: 200px; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  .topbar__title { font-size: 22px; }
  .avatar--btn { display: grid; }
  .topbar__heading { flex: 1 1 0; }
  .topbar__clock { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .search { order: 3; flex-basis: 100%; }
  .search input { width: 100%; }
  .view { padding: 6px 16px calc(var(--tabbar-h) + 28px); }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--hairline); }
  .tabbar .nav-link { flex: 1; flex-direction: column; gap: 3px; justify-content: center; padding: 6px 2px; font-size: 11px; border-radius: 0; }
  .tabbar .nav-link[aria-current="page"] { background: none; color: var(--gold-deep); }
  .tabbar .nav-link .count { position: absolute; margin: -26px 0 0 22px; }
  .tabbar .nav-link { position: relative; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .funnel { grid-template-columns: 1fr 1fr; }
  .funnel__step:nth-child(2) { border-right: 0; }
  .funnel__step:nth-child(-n+2) { border-bottom: 1px solid var(--hairline-2); }
  .list-editor__row.is-service { grid-template-columns: 1fr 1fr; }
  .drawer__panel { width: 100%; }
  .modal { padding: 0; align-items: end; }
  .modal__panel { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .tbl--cards thead { display: none; }
  .tbl--cards, .tbl--cards tbody, .tbl--cards tr, .tbl--cards td { display: block; width: 100%; }
  .tbl--cards tr { padding: 12px 14px; border-bottom: 1px solid var(--hairline-2); }
  .tbl--cards td { padding: 2px 0; border: 0; }
  .tbl--cards td[data-label]::before { content: attr(data-label) " · "; color: var(--mist); font-size: 12px; font-weight: 600; }
  .tbl--cards td.num { text-align: left; }
  .tbl--cards td .pill { margin: 3px 6px 0 0; }
  .q-item { grid-template-columns: 1fr; }
  .q-item__actions { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
