:root {
  color-scheme: light;
  --bg: #f5f1e8;
  --surface: #fffdf9;
  --surface-2: #f4efe4;
  --surface-3: #ede6d6;
  --ink: #0a0a0a;
  --ink-2: #4f4b44;
  --muted: #857f73;
  --line: #e4ddce;
  --line-strong: #d3cab6;
  --brass: #b9975b;
  --brass-ink: #7d6333;
  --brass-soft: rgba(185, 151, 91, 0.14);
  --brass-soft-2: rgba(185, 151, 91, 0.26);
  --good: #0f7a2e;
  --good-bg: rgba(12, 163, 12, 0.11);
  --bad: #b3261e;
  --bad-bg: rgba(208, 59, 59, 0.11);
  --info: #1f5fae;
  --info-bg: rgba(42, 120, 214, 0.11);
  --warn: #8a5a00;
  --warn-bg: rgba(250, 178, 25, 0.18);
  --neutral-bg: rgba(10, 10, 10, 0.06);
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --grid: #ebe5d8;
  --axis: #cfc7b5;
  --bubble-patient: #ffffff;
  --bubble-ai: #efe5d0;
  --bubble-staff: #dfeaf8;
  --chat-bg: #f1ece1;
  --shadow: 0 1px 2px rgba(10, 10, 10, 0.04), 0 8px 24px rgba(10, 10, 10, 0.05);
  --shadow-lg: -24px 0 60px rgba(10, 10, 10, 0.16);
  --seq-0: #f1ede4;
  --seq-1: #cde2fb;
  --seq-2: #9ec5f4;
  --seq-3: #6da7ec;
  --seq-4: #3987e5;
  --seq-5: #256abf;
  --seq-6: #184f95;
  --seq-7: #0d366b;
  --fn-1: #184f95;
  --fn-2: #256abf;
  --fn-3: #3987e5;
  --fn-4: #6da7ec;
  --fn-5: #86b6ef;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0a0a;
    --surface: #161614;
    --surface-2: #1d1c19;
    --surface-3: #25231f;
    --ink: #f4efe4;
    --ink-2: #c9c2b2;
    --muted: #8e887c;
    --line: #2a2824;
    --line-strong: #3a3731;
    --brass: #c8a76a;
    --brass-ink: #d9bd85;
    --brass-soft: rgba(200, 167, 106, 0.13);
    --brass-soft-2: rgba(200, 167, 106, 0.24);
    --good: #4cc26a;
    --good-bg: rgba(12, 163, 12, 0.16);
    --bad: #ef7b7b;
    --bad-bg: rgba(208, 59, 59, 0.2);
    --info: #7fb2f0;
    --info-bg: rgba(57, 135, 229, 0.18);
    --warn: #f3c160;
    --warn-bg: rgba(250, 178, 25, 0.15);
    --neutral-bg: rgba(244, 239, 228, 0.08);
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --grid: #262521;
    --axis: #3a3833;
    --bubble-patient: #22211d;
    --bubble-ai: #3a3122;
    --bubble-staff: #1c2d44;
    --chat-bg: #10100e;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-lg: -24px 0 60px rgba(0, 0, 0, 0.55);
    --seq-0: #1f1e1b;
    --seq-1: #0d366b;
    --seq-2: #104281;
    --seq-3: #184f95;
    --seq-4: #256abf;
    --seq-5: #3987e5;
    --seq-6: #6da7ec;
    --seq-7: #9ec5f4;
    --fn-1: #9ec5f4;
    --fn-2: #6da7ec;
    --fn-3: #3987e5;
    --fn-4: #256abf;
    --fn-5: #184f95;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0a0a;
  --surface: #161614;
  --surface-2: #1d1c19;
  --surface-3: #25231f;
  --ink: #f4efe4;
  --ink-2: #c9c2b2;
  --muted: #8e887c;
  --line: #2a2824;
  --line-strong: #3a3731;
  --brass: #c8a76a;
  --brass-ink: #d9bd85;
  --brass-soft: rgba(200, 167, 106, 0.13);
  --brass-soft-2: rgba(200, 167, 106, 0.24);
  --good: #4cc26a;
  --good-bg: rgba(12, 163, 12, 0.16);
  --bad: #ef7b7b;
  --bad-bg: rgba(208, 59, 59, 0.2);
  --info: #7fb2f0;
  --info-bg: rgba(57, 135, 229, 0.18);
  --warn: #f3c160;
  --warn-bg: rgba(250, 178, 25, 0.15);
  --neutral-bg: rgba(244, 239, 228, 0.08);
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --grid: #262521;
  --axis: #3a3833;
  --bubble-patient: #22211d;
  --bubble-ai: #3a3122;
  --bubble-staff: #1c2d44;
  --chat-bg: #10100e;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lg: -24px 0 60px rgba(0, 0, 0, 0.55);
  --seq-0: #1f1e1b;
  --seq-1: #0d366b;
  --seq-2: #104281;
  --seq-3: #184f95;
  --seq-4: #256abf;
  --seq-5: #3987e5;
  --seq-6: #6da7ec;
  --seq-7: #9ec5f4;
  --fn-1: #9ec5f4;
  --fn-2: #6da7ec;
  --fn-3: #3987e5;
  --fn-4: #256abf;
  --fn-5: #184f95;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: inherit; }
.ar, [dir="rtl"] { font-family: "IBM Plex Sans Arabic", "Inter", system-ui, sans-serif; }
.num { font-variant-numeric: tabular-nums; }

.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: #0a0a0a; color: #f4efe4;
  display: flex; flex-direction: column;
  padding: 22px 16px;
  border-right: 1px solid #1f1e1b;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px; overflow: hidden; flex: none;
  background: #000; border: 1px solid rgba(185, 151, 91, 0.45);
  display: grid; place-items: center;
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.75); }
.brand-name { font-family: "Fraunces", Georgia, serif; font-size: 18px; letter-spacing: 0.01em; line-height: 1.15; }
.brand-sub { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: #b9975b; margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: rgba(244, 239, 228, 0.72); text-decoration: none; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: rgba(244, 239, 228, 0.06); color: #f4efe4; }
.nav a.active { background: rgba(185, 151, 91, 0.16); color: #f4efe4; box-shadow: inset 2px 0 0 #b9975b; }
.nav .count { margin-left: auto; font-size: 11px; padding: 1px 8px; border-radius: 99px; background: rgba(185, 151, 91, 0.22); color: #e9d6ae; }

.agent-card {
  margin-top: 22px; padding: 14px; border-radius: 12px;
  background: rgba(244, 239, 228, 0.04); border: 1px solid rgba(244, 239, 228, 0.08);
}
.agent-card .row { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.agent-card p { margin: 6px 0 0; color: rgba(244, 239, 228, 0.6); font-size: 12px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #34c759; box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.6); animation: pulse 2s infinite; flex: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.55); } 70% { box-shadow: 0 0 0 8px rgba(52, 199, 89, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0); } }

.powered { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid rgba(244, 239, 228, 0.08); }
.powered .pm { width: 30px; height: 30px; border-radius: 8px; overflow: hidden; display: grid; place-items: center; background: #000; flex: none; }
.powered .pm img { width: 100%; height: 100%; transform: scale(1.75); }
.powered small { display: block; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(244, 239, 228, 0.5); }
.powered strong { font-family: "Fraunces", Georgia, serif; font-weight: 500; font-size: 14px; color: #f4efe4; }

.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: 18px 32px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-family: "Fraunces", Georgia, serif; font-weight: 500; font-size: 26px; margin: 0; letter-spacing: -0.01em; }
.topbar .sub { color: var(--muted); font-size: 13px; }
.topbar .spacer { flex: 1; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); display: grid; place-items: center;
}
.icon-btn:hover { border-color: var(--brass); }
.icon-btn svg { width: 18px; height: 18px; }
.live-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--line); font-size: 12px; font-weight: 500; color: var(--ink-2);
}

.content { padding: 28px 32px 48px; display: flex; flex-direction: column; gap: 24px; max-width: 1480px; width: 100%; }

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.section-title { font-family: "Fraunces", Georgia, serif; font-weight: 500; font-size: 19px; margin: 0; }
.muted { color: var(--muted); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 18px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi .label { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 12.5px; font-weight: 500; }
.kpi .label .ic { width: 28px; height: 28px; border-radius: 8px; background: var(--brass-soft); color: var(--brass-ink); display: grid; place-items: center; }
.kpi .label .ic svg { width: 15px; height: 15px; }
.kpi .value { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin: 12px 0 4px; line-height: 1.1; }
.kpi .value small { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.kpi .foot { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; padding: 1px 7px; border-radius: 99px; font-size: 11.5px; }
.delta.up { color: var(--good); background: var(--good-bg); }
.delta.down { color: var(--bad); background: var(--bad-bg); }
.delta.flat { color: var(--ink-2); background: var(--neutral-bg); }
.kpi.accent { background: #0a0a0a; color: #f4efe4; border-color: #0a0a0a; }
.kpi.accent .label { color: rgba(244, 239, 228, 0.75); }
.kpi.accent .label .ic { background: rgba(185, 151, 91, 0.22); color: #e3c98f; }
.kpi.accent .foot { color: rgba(244, 239, 228, 0.6); }
.kpi.accent .value small { color: rgba(244, 239, 228, 0.55); }
.kpi.accent .delta.up { color: #7fe08f; background: rgba(12, 163, 12, 0.22); }
.kpi.accent .delta.down { color: #ff9c9c; background: rgba(208, 59, 59, 0.25); }
:root[data-theme="dark"] .kpi.accent { background: #221d14; border-color: #3a3122; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .kpi.accent { background: #221d14; border-color: #3a3122; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 14px; flex-wrap: wrap; }
.card-head .grow { flex: 1; }
.card-body { padding: 4px 20px 20px; }

.search {
  display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 36px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2); min-width: 240px;
}
.search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; }
.search svg { width: 16px; height: 16px; color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); padding: 10px 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--surface-2); white-space: nowrap;
}
td { padding: 12px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { cursor: pointer; transition: background 0.12s; }
tbody tr:hover { background: var(--brass-soft); }
tbody tr.sel { background: var(--brass-soft-2); }
tbody tr:last-child td { border-bottom: 0; }
.pt { display: flex; align-items: center; gap: 12px; min-width: 190px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 600; font-size: 13px; background: var(--surface-3); color: var(--ink-2); border: 1px solid var(--line);
}
.pt .nm { font-weight: 600; }
.pt .sm { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.chan-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dt { white-space: nowrap; }
.dt .d { font-weight: 500; }
.dt .t { font-size: 12px; color: var(--muted); }
.proc { white-space: nowrap; }
.notes { max-width: 220px; color: var(--ink-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notes.empty { color: var(--muted); }
.phone { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ink-2); }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chip svg { width: 12px; height: 12px; }
.chip.good { color: var(--good); background: var(--good-bg); }
.chip.bad { color: var(--bad); background: var(--bad-bg); }
.chip.info { color: var(--info); background: var(--info-bg); }
.chip.warn { color: var(--warn); background: var(--warn-bg); }
.chip.neutral { color: var(--ink-2); background: var(--neutral-bg); }
.chip.brass { color: var(--brass-ink); background: var(--brass-soft); }

.pager { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.pager .grow { flex: 1; }
.btn {
  border: 1px solid var(--line); background: var(--surface); padding: 7px 14px; border-radius: 9px; font-size: 13px; font-weight: 500;
}
.btn:hover:not(:disabled) { border-color: var(--brass); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.empty-state { padding: 40px 20px; text-align: center; color: var(--muted); }

.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; align-items: start; }
.cal-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px; flex-wrap: wrap; }
.cal-head h2 { font-family: "Fraunces", Georgia, serif; font-weight: 500; font-size: 22px; margin: 0; min-width: 190px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.cal-dow { padding: 10px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cal-cell {
  min-height: 112px; padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px; text-align: left; background: transparent; border-top: 0; border-left: 0;
  transition: background 0.12s; min-width: 0;
}
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell:hover { background: var(--brass-soft); }
.cal-cell.out { color: var(--muted); background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.cal-cell.closed .dnum { color: var(--muted); }
.cal-cell.sel { background: var(--brass-soft-2); box-shadow: inset 0 0 0 2px var(--brass); }
.cal-cell .top { display: flex; align-items: center; justify-content: space-between; }
.dnum { font-weight: 600; font-size: 13px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; }
.cal-cell.today .dnum { background: var(--ink); color: var(--bg); }
.cnt { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--brass); color: #0a0a0a; }
.mini { font-size: 11.5px; padding: 2px 6px; border-radius: 5px; background: var(--surface-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 2px solid var(--brass); }
.mini.done { border-left-color: var(--good); }
.mini.miss { border-left-color: var(--bad); }
.more { font-size: 11px; color: var(--muted); padding-left: 4px; }
.closed-lbl { font-size: 11px; color: var(--muted); }

.day-panel { position: sticky; top: 92px; }
.day-panel .card-head { border-bottom: 1px solid var(--line); }
.day-title { font-family: "Fraunces", Georgia, serif; font-weight: 500; font-size: 20px; margin: 0; line-height: 1.2; }
.day-list { list-style: none; margin: 0; padding: 8px; max-height: calc(100vh - 260px); overflow-y: auto; }
.appt {
  display: grid; grid-template-columns: 74px 1fr; gap: 12px; padding: 12px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; width: 100%; background: transparent; text-align: left;
}
.appt:hover { background: var(--brass-soft); border-color: var(--line); }
.appt .time { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.appt .time small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); }
.appt .who { font-weight: 600; }
.appt .meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.appt + .appt { border-top-color: var(--line); }
.rank { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-3); font-size: 11px; font-weight: 700; color: var(--ink-2); margin-right: 6px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { font-family: "Inter", system-ui, sans-serif; }
.heat-wrap { overflow-x: auto; }
.heat-wrap svg { min-width: 640px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 3px; width: 14px; border-radius: 2px; }
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mstat { background: var(--surface-2); border-radius: 12px; padding: 14px; }
.mstat .v { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.mstat .l { font-size: 12px; color: var(--muted); }
.hbar-row { display: grid; grid-template-columns: 150px 1fr 92px; gap: 12px; align-items: center; padding: 6px 0; }
.hbar-row .lbl { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-row .val { font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.hbar-row .val small { color: var(--muted); display: block; font-size: 11px; white-space: nowrap; }
.hbar-track { height: 18px; display: flex; gap: 2px; }
.hbar-track div { height: 100%; }
.hbar-track div:first-child { border-radius: 4px 0 0 4px; }
.hbar-track div:last-child { border-radius: 0 4px 4px 0; }
.hbar-track div:only-child { border-radius: 4px; }

.tip {
  position: fixed; z-index: 100; pointer-events: none; opacity: 0; transition: opacity 0.1s;
  background: var(--ink); color: var(--bg); padding: 8px 11px; border-radius: 9px; font-size: 12.5px; line-height: 1.45;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); max-width: 260px;
}
.tip.on { opacity: 1; }
.tip b { font-weight: 600; }
.tip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

.scrim { position: fixed; inset: 0; background: rgba(10, 10, 10, 0.38); opacity: 0; pointer-events: none; transition: opacity 0.25s; z-index: 50; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(580px, 100vw); z-index: 60;
  background: var(--surface); box-shadow: var(--shadow-lg); transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1); display: flex; flex-direction: column;
  border-left: 1px solid var(--line);
}
.drawer.on { transform: translateX(0); }
.dr-head { padding: 20px 22px 0; }
.dr-top { display: flex; align-items: flex-start; gap: 14px; }
.dr-top .avatar { width: 52px; height: 52px; font-size: 17px; background: var(--brass-soft-2); color: var(--brass-ink); border-color: transparent; }
.dr-top h3 { margin: 0; font-family: "Fraunces", Georgia, serif; font-weight: 500; font-size: 22px; line-height: 1.2; }
.dr-top .arn { color: var(--muted); font-size: 14px; }
.dr-top .grow { flex: 1; min-width: 0; }
.dr-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.book-banner {
  margin-top: 16px; border-radius: 12px; padding: 12px 14px; display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); background: var(--surface-2);
}
.book-banner .flag { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.book-banner .yn { font-size: 20px; font-weight: 700; }
.book-banner.yes { background: var(--good-bg); border-color: transparent; }
.book-banner.yes .yn { color: var(--good); }
.book-banner.no .yn { color: var(--ink-2); }
.book-banner .when { margin-left: auto; text-align: right; font-size: 13px; }
.book-banner .when b { display: block; font-size: 15px; }
.tabs { display: flex; gap: 4px; margin-top: 16px; border-bottom: 1px solid var(--line); }
.tabs button {
  border: 0; background: transparent; padding: 10px 14px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: inline-flex; align-items: center; gap: 6px;
}
.tabs button.on { color: var(--ink); border-bottom-color: var(--brass); }
.tabs .n { font-size: 11px; background: var(--surface-3); padding: 0 7px; border-radius: 99px; color: var(--ink-2); }
.dr-body { flex: 1; overflow-y: auto; }
.dr-pad { padding: 20px 22px 28px; display: flex; flex-direction: column; gap: 18px; }
.kv-group h4 { margin: 0 0 10px; font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.kv > div { background: var(--surface); padding: 11px 14px; }
.kv .k { font-size: 11.5px; color: var(--muted); }
.kv .v { font-weight: 500; margin-top: 1px; }
.kv .full { grid-column: 1 / -1; }
.note-box { background: var(--brass-soft); border-radius: 12px; padding: 12px 14px; color: var(--ink); }
.note-box.empty { background: var(--surface-2); color: var(--muted); }

.chat { background: var(--chat-bg); min-height: 100%; padding: 18px 16px 28px; display: flex; flex-direction: column; gap: 8px; }
.chat-sep { align-self: center; font-size: 11.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); padding: 3px 12px; border-radius: 99px; margin: 8px 0; }
.sys { align-self: center; font-size: 12px; color: var(--brass-ink); background: var(--brass-soft); padding: 5px 12px; border-radius: 8px; text-align: center; max-width: 90%; display: inline-flex; gap: 6px; align-items: center; }
.sys svg { width: 13px; height: 13px; flex: none; }
.bub { max-width: 82%; padding: 9px 12px 6px; border-radius: 14px; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06); white-space: pre-wrap; word-wrap: break-word; font-size: 14px; line-height: 1.55; }
.bub .who { font-size: 11px; font-weight: 700; margin-bottom: 2px; display: flex; align-items: center; gap: 5px; }
.bub .tm { font-size: 10.5px; color: var(--muted); text-align: right; margin-top: 2px; font-variant-numeric: tabular-nums; }
.bub.patient { align-self: flex-start; background: var(--bubble-patient); border-top-left-radius: 4px; }
.bub.ai { align-self: flex-end; background: var(--bubble-ai); border-top-right-radius: 4px; }
.bub.ai .who { color: var(--brass-ink); }
.bub.staff { align-self: flex-end; background: var(--bubble-staff); border-top-right-radius: 4px; }
.bub.staff .who { color: var(--info); }
.bub .txt[dir="rtl"] { text-align: right; }
.chat-meta { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 2; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 20px 34px; }
.timeline li::before { content: ""; position: absolute; left: 11px; top: 24px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .dot { position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); }
.timeline .dot svg { width: 13px; height: 13px; }
.timeline .dot.good { background: var(--good-bg); color: var(--good); }
.timeline .dot.brass { background: var(--brass-soft-2); color: var(--brass-ink); }
.timeline .dot.info { background: var(--info-bg); color: var(--info); }
.timeline .dot.bad { background: var(--bad-bg); color: var(--bad); }
.timeline .t1 { font-weight: 600; }
.timeline .t2 { font-size: 12.5px; color: var(--muted); }

.hide-sm { }
@media (max-width: 1560px) {
  .hide-lg { display: none; }
}
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal-layout { grid-template-columns: 1fr; }
  .day-panel { position: static; }
  .day-list { max-height: none; }
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 30; height: auto; flex-direction: row; align-items: center; padding: 10px 16px; gap: 8px; }
  .brand { padding: 0; }
  .brand-sub, .agent-card, .powered { display: none; }
  .brand-name { font-size: 15px; }
  .nav { flex-direction: row; margin: 0 0 0 auto; }
  .nav a { padding: 8px 10px; }
  .nav a span, .nav .count { display: none; }
  .topbar { top: 62px; padding: 14px 16px; }
  .topbar h1 { font-size: 21px; }
  .live-chip { display: none; }
  .content { padding: 18px 16px 40px; }
  .grid-2 { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .search { min-width: 0; flex: 1; }
  .cal-cell { min-height: 64px; padding: 4px; }
  .cal-cell .mini, .cal-cell .more, .closed-lbl { display: none; }
  .cal-dow { padding: 8px 4px; font-size: 10px; letter-spacing: 0.02em; }
  .cnt { padding: 0 6px; }
  .hbar-row { grid-template-columns: 104px 1fr 56px; gap: 8px; }
  .stat-row { grid-template-columns: 1fr; }
  .footer-brand { display: flex; }
}
@media (max-width: 520px) {
  .kpi .value { font-size: 24px; }
  .kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .cal-cell .top { flex-direction: column; align-items: flex-start; gap: 2px; }
  .kv { grid-template-columns: 1fr; }
  .book-banner { flex-wrap: wrap; }
  .book-banner .when { margin-left: 0; text-align: left; width: 100%; }
}
.footer-brand { display: none; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 12px; padding: 10px 0 0; }
.footer-brand b { font-family: "Fraunces", Georgia, serif; font-weight: 500; color: var(--ink); }
