/* Nile Therapy portal. Colors come from the Nile Therapy logo:
   wordmark blue, river blues, coral figures, leaf greens, slate-teal roof. */
:root {
  /* brand */
  --brand: #0f7d74;        /* "Nile Therapy" wordmark blue: buttons, links, numbers */
  --brand-hover: #0b6a62;
  --brand-ink: #0b4f5c;    /* deep river: sidebar, headings */
  --river: #12917f;
  --water: #9fdccf;
  --water-soft: #e3f6f1;
  --coral: #e0583f;        /* the figures */
  --coral-ink: #a63a26;
  --coral-soft: #fdece8;
  --leaf: #5fa84a;
  --leaf-ink: #2f6b2a;
  --leaf-soft: #e8f4e2;
  --roof: #487878;
  /* surfaces + text */
  --bg: #f3f8f7;
  --surface: #ffffff;
  --surface-2: #eef5f3;
  --ink: #14303a;
  --muted: #557078;
  --line: #dae8e4;
  --line-soft: #e9f2ef;
  --danger: #b3372a;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(11, 79, 92, .05), 0 6px 18px rgba(11, 79, 92, .05);
  --font: "Outfit", "Readex Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h1, h2, h3 { margin: 0; font-weight: 700; color: var(--brand-ink); }
h1 { font-size: 26px; letter-spacing: -.01em; }
h2 { font-size: 20px; }
h3 { font-size: 15px; font-weight: 600; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--water-soft); color: var(--brand-ink); padding: 48px 56px 140px; display: flex; flex-direction: column; gap: 28px; position: relative; overflow: hidden; }
.login-logo { width: 220px; height: auto; }
.login-art h1 { font-size: 40px; line-height: 1.15; max-width: 14ch; }
.login-art p { max-width: 40ch; color: #33506d; margin: 12px 0 0; }
.login-art p.small { margin-top: auto; position: relative; z-index: 1; }
.login-art .waves { position: absolute; inset: auto -10% -4% -10%; width: 120%; height: 160px; }
.login-form { display: grid; place-items: center; padding: 32px; background: var(--surface); }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { margin-bottom: 4px; font-size: 24px; }
.role-switch { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface-2); border-radius: 999px; padding: 4px; margin: 24px 0 18px; }
.role-switch button { border: 0; background: transparent; padding: 9px; border-radius: 999px; cursor: pointer; color: var(--muted); font-weight: 600; }
.role-switch button.on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }

/* ---------- brand row (sidebar) ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: #fff; display: grid; place-items: center; flex: none; }
.brand-mark img { width: 34px; height: 34px; }

/* ---------- forms ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: #3a4a5a; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
input, select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 125, 116, .16); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 999px; padding: 10px 20px; font-weight: 600; cursor: pointer; background: var(--brand); color: #fff; transition: background .15s, transform .05s; text-decoration: none; }
.btn:hover { background: var(--brand-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.block { width: 100%; padding: 12px 20px; }
.btn.ghost { background: var(--surface); color: var(--brand); border-color: var(--line); }
.btn.ghost:hover { background: var(--water-soft); border-color: #c5d9ea; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.danger { background: var(--surface); color: var(--danger); border-color: #efc9c3; }
.btn.danger:hover { background: #fbeeec; }
.error { color: var(--danger); font-size: 13px; min-height: 20px; margin-top: 8px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--brand-ink); color: #d6e4f2; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.side .brand { color: #fff; padding: 0 8px 22px; }
.nav-list { display: flex; flex-direction: column; gap: 4px; }
.nav { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); color: inherit; text-decoration: none; border: 0; background: transparent; cursor: pointer; text-align: start; width: 100%; font-weight: 600; }
.nav:hover { background: rgba(255, 255, 255, .07); }
.nav.on { background: rgba(159, 220, 207, .2); color: #fff; box-shadow: inset 3px 0 0 var(--water); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.side .spacer { flex: 1; }
.side-menu { display: flex; flex-direction: column; flex: 1; }
.m-title, .menu-btn { display: none; }
.me { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .12); margin-top: 8px; font-size: 13px; }
.me strong { color: #fff; display: block; }
.me .muted { color: #a9c0d6; }
.me .row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.me .row button { white-space: nowrap; }
.me button { background: rgba(255, 255, 255, .1); color: #e3eef8; border: 0; border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 12px; }
.me button:hover { background: rgba(255, 255, 255, .18); }
.main { padding: 32px 40px 60px; min-width: 0; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.head p { margin: 4px 0 0; }

/* ---------- cards / stats ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; border-top: 3px solid var(--water); }
.stat:nth-child(2) { border-top-color: var(--leaf); }
.stat:nth-child(3) { border-top-color: var(--coral); }
.stat:nth-child(4) { border-top-color: var(--roof); }
.stat .n { font-size: 28px; font-weight: 700; color: var(--brand-ink); line-height: 1.15; }
.stat .l { font-size: 13px; color: var(--muted); }

/* ---------- toolbar + table ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.toolbar .field { margin: 0; }
.toolbar input, .toolbar select { padding: 9px 10px; }
.toolbar .grow { flex: 1; min-width: 180px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: 13px; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: start; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.c-time { display: block; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f7fafd; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--leaf-soft); color: var(--leaf-ink); white-space: nowrap; }
.pill.home { background: var(--coral-soft); color: var(--coral-ink); }
.pill.online { background: var(--water-soft); color: var(--brand); }
.pill.off { background: #eef1f4; color: var(--muted); }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.group { margin-bottom: 18px; }
.group-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.group.card { padding: 0; }
.group .table-wrap { padding: 0 6px 6px; }
.link { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- doctors ---------- */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.doc { cursor: pointer; text-align: start; transition: border-color .12s, box-shadow .12s; border: 1px solid var(--line); }
.doc:hover { border-color: #b9d2e8; box-shadow: 0 8px 22px rgba(11, 79, 92, .09); }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--water-soft); color: var(--brand); border: 2px solid #d6f0ea; display: grid; place-items: center; font-weight: 700; font-size: 16px; flex: none; }
.avatar.lg { width: 72px; height: 72px; font-size: 24px; }
.doc-top { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.doc { position: relative; }
.doc-link { color: inherit; text-decoration: none; }
.doc-link::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
.doc-link:focus-visible { outline: none; } .doc:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.doc-phone { display: grid; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.doc-phone bdi { white-space: nowrap; }
.doc-phone .ct-btns { display: flex; margin: 0; }
.doc-phone .ct-btn { flex: 1; justify-content: center; }
.ct-btns { display: inline-flex; gap: 6px; position: relative; z-index: 1; vertical-align: middle; margin-inline-start: 8px; }
.ct-btn { display: inline-flex; align-items: center; gap: 5px; min-height: 34px; padding: 0 11px; border-radius: 999px; font-size: 13px; font-weight: 600; text-decoration: none; color: #fff; }
.ct-btn svg { width: 16px; height: 16px; flex: none; }
.ct-btn.wa { background: #1fa855; }
.ct-btn.call { background: var(--brand); }
.ct-btn:hover { filter: brightness(1.08); }
.ct-btn:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
.kv .ct-btns { display: flex; margin: 8px 0 0; }
.doc-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.doc-nums b { display: block; font-size: 18px; color: var(--brand-ink); }
.doc-nums span { font-size: 12px; color: var(--muted); }
.profile { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 8px; font-size: 14px; margin-top: 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 999px; padding: 4px 10px; font-size: 13px; }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 40, 66, .45); display: grid; place-items: center; padding: 20px; z-index: 1100; }
.modal { background: var(--surface); border-radius: 18px; padding: 26px; width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; box-shadow: 0 30px 80px rgba(15, 40, 66, .25); }
.modal h2 { margin-bottom: 16px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.secret { font-family: ui-monospace, Menlo, monospace; background: var(--water-soft); padding: 12px 14px; border-radius: var(--radius-sm); font-size: 15px; }

/* ---------- doctor portal ---------- */
.portal { display: grid; grid-template-columns: minmax(0, 440px) 1fr; gap: 20px; align-items: start; }
.type-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.type-pick button { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm); padding: 10px 6px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
.type-pick button.on { border-color: var(--brand); background: var(--water-soft); color: var(--brand); }

/* ---------- chat ---------- */
.chat-wrap { display: grid; grid-template-columns: 1fr 280px; gap: 18px; height: calc(100vh - 150px); min-height: 480px; }
.chat { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.chat-head select { width: auto; padding: 7px 10px; font-size: 13px; }
.msgs { flex: 1; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 78%; padding: 12px 16px; border-radius: 16px; white-space: normal; overflow-wrap: anywhere; }
.msg p { margin: 0 0 8px; } .msg p:last-child { margin: 0; }
.msg ul { margin: 4px 0 8px; padding-inline-start: 20px; }
.msg code { background: rgba(0, 0, 0, .06); padding: 1px 5px; border-radius: 5px; font-size: 13px; }
.msg.user { align-self: flex-end; background: var(--brand); color: #fff; border-end-end-radius: 4px; }
.msg.user code { background: rgba(255, 255, 255, .15); }
.msg.assistant { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line-soft); border-end-start-radius: 4px; }
.msg.thinking { color: var(--muted); font-style: italic; }
.msg .meta { font-size: 11px; opacity: .6; margin-top: 6px; }
.composer { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--line); background: #f9fbfd; align-items: flex-end; }
.composer textarea { min-height: 46px; max-height: 180px; resize: none; }
.welcome { margin: auto; text-align: center; max-width: 420px; color: var(--muted); }
.welcome h2 { margin-bottom: 8px; }
.suggest { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.suggest button { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer; text-align: start; font-size: 14px; }
.suggest button:hover { border-color: var(--brand); background: var(--water-soft); }
.banner { background: #fdf3dc; color: #6b4f10; border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; margin: 12px 18px 0; }
.banner[hidden] { display: none; }
.memory { overflow-y: auto; }
.memory h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.mem-item { display: flex; gap: 8px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.mem-item span { flex: 1; }
.mem-item button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 4px; }
.mem-item button:hover { color: var(--danger); }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--brand-ink); color: #fff; padding: 10px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: .2s; z-index: 1200; font-size: 14px; }
#toast.show { opacity: 1; transform: translateX(-50%); }

/* ---------- overview + charts ---------- */
.ov-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ov-wide { grid-column: 1 / -1; }
.ov-grid > *, .rep-cols > *, .week > * { min-width: 0; } /* let cards shrink on phones; wide tables scroll inside */
.card-title { font-size: 17px; }
.sub-title { margin: 20px 0 8px; font-size: 14px; }
.kpi-extra { margin-top: 6px; font-size: 12px; }
.delta { color: var(--muted); font-weight: 600; }
.delta.up { color: var(--leaf-ink); }
.delta.down { color: var(--coral-ink); }
.colchart-wrap { margin: 14px 0 0; }
.colchart { display: flex; align-items: stretch; gap: 6px; height: 190px; padding-top: 18px; border-bottom: 1px solid var(--line); }
.col { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.col .bar { width: 100%; max-width: 44px; background: var(--water); border-radius: 4px 4px 0 0; transition: background .15s; }
.col.current .bar { background: var(--brand); }
.col:hover .bar { background: var(--river); }
.col .v { font-size: 12px; font-weight: 700; color: var(--ink); min-height: 16px; }
.col .x { position: absolute; top: 100%; margin-top: 4px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.colchart-wrap .as-table { margin-top: 30px; font-size: 13px; }
.as-table summary { cursor: pointer; color: var(--brand); font-weight: 600; }
.as-table table { margin-top: 8px; max-width: 320px; }
.as-table td { padding: 4px 8px; }
.colchart.many .x { display: none; }
.barlist { display: grid; gap: 8px; margin-top: 12px; }
.bl-row { display: grid; grid-template-columns: minmax(90px, 38%) 1fr 34px; align-items: center; gap: 10px; font-size: 14px; }
.bl-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-label a { color: inherit; text-decoration: none; } .bl-label a:hover { color: var(--brand); text-decoration: underline; }
.bl-track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bl-bar { display: block; height: 100%; background: var(--brand); border-radius: 999px; min-width: 2px; }
.bl-v { font-weight: 700; text-align: end; }
.stack { display: flex; gap: 2px; height: 14px; border-radius: 999px; overflow: hidden; margin: 14px 0 10px; }
.stack span { flex-basis: 0; }
.seg-home { background: var(--coral); } .seg-online { background: var(--river); } .seg-clinic { background: var(--leaf); } .seg-other { background: #b8c4d0; }
.legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 14px; }
.legend li { display: grid; grid-template-columns: 12px 1fr auto 44px; gap: 8px; align-items: center; }
.legend .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend .muted { text-align: end; }
.alerts { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; }
.alerts li { display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; align-items: center; font-size: 14px; }
.alerts .alert-icon { align-self: start; padding-top: 2px; }
.alert-icon { color: #9f6000; }
.ok-line { color: var(--leaf-ink); font-weight: 600; }

/* ---------- schedule ---------- */
.sched-bar { align-items: center; }
.sched-bar .seg button { min-width: 36px; font-size: 14px; }
.sched-range { font-size: 15px; color: var(--brand-ink); }
.check { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; cursor: pointer; }
.check input { width: auto; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-height: 180px; display: flex; flex-direction: column; overflow: hidden; }
.day header { display: flex; align-items: baseline; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: 13px; }
.day header b { color: var(--brand-ink); font-size: 18px; }
.day header em { font-style: normal; margin-inline-start: auto; background: var(--brand); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 600; }
.day.today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.day.past { background: #fafbfd; }
.day-items { padding: 8px; display: grid; gap: 6px; align-content: start; }
.day-empty { color: #b3bfcb; text-align: center; padding: 8px 0; }
.appt { display: grid; gap: 2px; text-align: start; border: 1px solid var(--line); border-inline-start: 3px solid var(--brand); background: var(--surface); border-radius: 8px; padding: 7px 8px; cursor: pointer; font-size: 13px; }
.appt:hover { border-color: #b9d2e8; border-inline-start-color: var(--brand); background: var(--water-soft); }
.appt-time { font-size: 12px; font-weight: 700; color: var(--brand); }
.appt-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.appt .pill { font-size: 11px; padding: 1px 8px; }
.appt.done { border-inline-start-color: var(--leaf); background: #f6fbf4; }
.appt.done .appt-time { color: var(--leaf-ink); }
.appt.cancelled { border-inline-start-color: #b8c4d0; opacity: .75; }
.appt.cancelled strong { text-decoration: line-through; }
.status { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 1px 8px; background: var(--water-soft); color: var(--brand); }
.status.done { background: var(--leaf-soft); color: var(--leaf-ink); }
.status.cancelled { background: #eef1f4; color: var(--muted); }

/* ---------- monthly report ---------- */
.rep-tools { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.rep-tools .field { margin: 0; }
.rep-tools input { padding: 9px 10px; }
.report { padding: 28px; }
.rep-head { display: flex; gap: 18px; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 18px; margin-bottom: 20px; }
.rep-head img { width: 96px; height: auto; }
.rep-head h2 { font-size: 22px; }
.rep-kpis { grid-template-columns: repeat(5, 1fr); }
.rep-section { margin: 26px 0 10px; font-size: 16px; }
.rep-table td, .rep-table th { white-space: nowrap; }
.rep-table tr.total td { border-top: 2px solid var(--line); font-weight: 700; background: var(--surface-2); }
.rep-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media print {
  @page { margin: 14mm; }
  body { background: #fff; font-size: 12px; }
  .side, .no-print, #toast, .as-table, .lang-btn { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .card, .stat { box-shadow: none; }
  .report { border: 0; padding: 0; }
  .rep-section, .rep-table, .rep-cols, .colchart-wrap { break-inside: avoid; }
  .bl-bar, .stack span, .col .bar, .legend .sw { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- chat: files + voice ---------- */
.composer-tools { display: flex; gap: 4px; align-items: center; }
.tool-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 17px; display: grid; place-items: center; padding: 0; }
.tool-btn:hover { background: var(--water-soft); border-color: #c5d9ea; }
.tool-btn.lang-mini { width: 32px; height: 32px; font-size: 12px; font-weight: 700; color: var(--brand); }
.tool-btn.listening { background: var(--danger); border-color: var(--danger); box-shadow: 0 0 0 4px rgba(179, 55, 42, .18); }
.composer-note { margin: 0; padding: 0 16px 10px; background: #f9fbfd; }
.pending-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px 0; border-top: 1px solid var(--line); background: #f9fbfd; }
.pending-files + .composer { border-top: 0; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 10px; font-size: 13px; color: var(--ink); }
button.file-chip { cursor: pointer; } button.file-chip:hover:not(:disabled) { border-color: var(--brand); }
.file-chip .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.file-chip button { border: 0; background: none; cursor: pointer; font-size: 16px; line-height: 1; color: var(--muted); padding: 0 2px; }
.file-chip button:hover { color: var(--danger); }
.msg-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.msg.user .file-chip { background: rgba(255, 255, 255, .15); border-color: rgba(255, 255, 255, .35); color: #fff; }
.msg-thumb { padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 10px; overflow: hidden; }
.msg-thumb img { display: block; max-width: 180px; max-height: 140px; min-width: 60px; min-height: 40px; object-fit: cover; background: rgba(255, 255, 255, .2); border-radius: 10px; }
.chat.dropping { outline: 3px dashed var(--brand); outline-offset: -6px; }

/* ---------- AI action cards ---------- */
.act-card { align-self: flex-start; max-width: 78%; border: 1px solid #c5d9ea; border-inline-start: 4px solid var(--brand); background: var(--surface); border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-top: -6px; }
.act-card.done { border-inline-start-color: var(--leaf); }
.act-card.cancelled, .act-card.failed { border-inline-start-color: #b8c4d0; }
.act-title { font-weight: 700; color: var(--brand-ink); margin-bottom: 6px; }
.act-table { font-size: 13px; }
.act-table th { text-transform: none; letter-spacing: 0; font-size: 13px; padding: 3px 12px 3px 0; border: 0; color: var(--muted); font-weight: 500; }
[dir="rtl"] .act-table th { padding: 3px 0 3px 12px; }
.act-table td { padding: 3px 0; border: 0; }
.act-table s { color: var(--muted); }
.act-buttons { display: flex; gap: 8px; margin-top: 10px; }
.act-status { margin: 8px 0 0; font-weight: 600; font-size: 13px; color: var(--muted); }
.act-status.done { color: var(--leaf-ink); }
.act-status.failed { color: var(--danger); }

/* ---------- confirm dialog ---------- */
.btn-red { background: var(--danger); color: #fff; }
.btn-red:hover { background: #962b20; }
.confirm-box { max-width: 420px; }
.confirm-box h2 { margin-bottom: 8px; }
.confirm-box p { margin: 0 0 18px; }
.modal:has(.confirm-box) { max-width: 440px; }

/* ---------- first-day, empty states, tips ---------- */
.first-day { margin-bottom: 18px; border-color: #c5d9ea; background: linear-gradient(var(--water-soft), var(--surface) 70%); }
.first-day > p { margin: 4px 0 14px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.steps li { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; }
.steps a { color: var(--brand-ink); text-decoration: none; } .steps a:hover { text-decoration: underline; }
.step-n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.steps li.done .step-n { background: var(--leaf); }
.empty-note { color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 10px 14px; margin: 0 0 12px; }
.empty.friendly .big { font-size: 28px; display: block; margin-bottom: 6px; }
.empty.friendly p { max-width: 36ch; margin: 0 auto; }
.tip-card { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid #c5d9ea; border-radius: var(--radius); padding: 10px 12px; margin-bottom: 16px; font-size: 14px; }
.tip-card img { border-radius: 10px; border: 1px solid var(--line); flex: none; }
.tip-card p { margin: 0; flex: 1; }
.tip-close { border: 0; background: none; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 8px; }
#install { background: var(--water); color: var(--brand-ink); font-weight: 600; }

/* ---------- change history ---------- */
.hist-list { padding: 4px 0; }
.hist-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 14px; align-items: start; padding: 12px 18px; border-bottom: 1px solid var(--line-soft); }
.hist-row:last-child { border-bottom: 0; }
.hist-when { display: grid; font-size: 13px; }
.hist-tag { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 1px 8px; background: var(--water-soft); color: var(--brand); }
.hist-tag.insert { background: var(--leaf-soft); color: var(--leaf-ink); }
.hist-tag.delete { background: var(--coral-soft); color: var(--coral-ink); }
.hist-diff { margin: 6px 0 0; padding-inline-start: 18px; font-size: 13px; }
.hist-diff s { color: var(--muted); }

/* ---------- language switch + Arabic / right-to-left ---------- */
.lang-btn { font-weight: 600; }
.me .lang-btn { margin-inline-start: auto; }
.login-form { position: relative; }
.lang-btn.corner { position: absolute; top: 20px; inset-inline-end: 20px; border: 1px solid var(--line); background: var(--surface); color: var(--brand); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: 13px; }
.lang-btn.corner:hover { background: var(--water-soft); }
html[lang="ar"] body { font-family: "Readex Pro", "Outfit", system-ui, sans-serif; }
html[lang="ar"] .lang-btn, :lang(en).lang-btn { font-family: "Outfit", system-ui, sans-serif; }
html[lang="ar"] .lang-btn:lang(ar) { font-family: "Readex Pro", sans-serif; }
html[lang="ar"] th { letter-spacing: 0; text-transform: none; font-size: 13px; }
html[lang="ar"] h1 { letter-spacing: 0; }
[dir="rtl"] .nav.on { box-shadow: inset -3px 0 0 var(--water); }

/* ---------- coverage map ---------- */
.cov-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; margin-bottom: 16px; align-items: start; }
.map-card { padding: 0; overflow: hidden; }
.map { height: 520px; position: relative; z-index: 0; isolation: isolate; background: #dfe9f1; } /* keeps the map's layers below dialogs and the top bar */
.small-map { height: 280px; }
.map.drawing, .map.drawing .leaflet-interactive { cursor: crosshair; }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 10px 14px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line-soft); }
.map-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-inline-end: 6px; vertical-align: -1px; }
.pin span { display: block; width: 22px; height: 22px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
.vertex { background: #fff; border: 3px solid var(--brand); border-radius: 50%; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); cursor: grab; }
.drawbar { padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--water-soft); font-size: 14px; }
.drawbar p { margin: 0 0 8px; }
.drawbar-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.color-pick { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; }
.color-pick input { width: 40px; height: 32px; padding: 2px; }
.cov-side { max-height: 600px; overflow-y: auto; }
.doc-area { display: grid; grid-template-columns: 14px 1fr auto auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.doc-area:last-child { border-bottom: 0; }
.swatch { width: 14px; height: 14px; border-radius: 4px; }
.icon-x { border: 0; background: none; color: var(--muted); font-size: 18px; cursor: pointer; padding: 2px 4px; }
.icon-x:hover { color: var(--danger); }
.cov-requests .seg { margin-bottom: 12px; }
.cov-requests .seg b { color: var(--coral-ink); }
.req-row { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; padding: 12px 4px; border-bottom: 1px solid var(--line-soft); border-inline-start: 4px solid transparent; padding-inline-start: 12px; }
.req-row.founders { border-inline-start-color: #b3372a; } .req-row.waiting { border-inline-start-color: #c98a12; } .req-row.done { border-inline-start-color: var(--leaf); }
.req-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.search-row { display: flex; gap: 8px; }
.search-results { display: grid; gap: 4px; margin-top: 6px; }
.search-results button { text-align: start; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 10px; cursor: pointer; font-size: 13px; }
.search-results button:hover { border-color: var(--brand); background: var(--water-soft); }
.mini-map { height: 240px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); position: relative; z-index: 0; isolation: isolate; }
.modal:has(.mini-map) { max-width: 640px; }
.assign-list { display: grid; gap: 6px; margin: 12px 0; }
.assign-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; text-align: start; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer; }
.assign-row:hover { border-color: var(--brand); background: var(--water-soft); }
.assign-row .load { font-weight: 700; color: var(--leaf-ink); }
.assign-row .load.full { color: var(--coral-ink); }
.open-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 16px; }
.open-card { display: grid; gap: 6px; }
.open-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 17px; }
.attention-card { display: grid; grid-template-columns: 24px 1fr auto; gap: 12px; align-items: center; margin-bottom: 16px; text-decoration: none; color: var(--ink); border-color: #efc9c3; background: linear-gradient(135deg, #fdece8, var(--surface) 70%); }
.attention-card .alert-icon { font-size: 20px; color: #b3372a; }
.leaflet-container { font-family: var(--font); }
.pin span { display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700; line-height: 1; }
.map-legend i.check { background: var(--leaf); color: #fff; font-style: normal; font-size: 8px; display: inline-grid; place-items: center; }
.map-link { white-space: nowrap; font-weight: 600; text-decoration: none; margin-inline-start: 4px; }
.map-link:hover { text-decoration: underline; }
.map-link-field .search-row input { flex: 1; min-width: 0; }
.here-btn { white-space: nowrap; }
.appt.logged { border-inline-start-color: var(--water); background: #f8fbfd; }
.appt.logged .appt-time { color: var(--muted); }
.status.logged { background: var(--water-soft); color: var(--brand); }

/* ---------- gradients (same brand colors, softly blended) ----------
   White text was checked on every gradient color: at least 4.8:1 (WCAG AA needs 4.5). */
:root {
  --grad-brand: linear-gradient(135deg, #0f7d74 0%, #12917f 100%);
  --grad-brand-hover: linear-gradient(135deg, #0b6a62 0%, #0a7a6d 100%);
  --grad-navy: linear-gradient(170deg, #0b4f5c 0%, #0d6672 55%, #0f7d74 100%);
  --grad-water: linear-gradient(160deg, #e3f6f1 0%, #d2efe8 55%, #e8f4e2 100%);
}
body { background: linear-gradient(180deg, #e7f1fa 0, var(--bg) 380px) no-repeat, var(--bg); }
.side { background: var(--grad-navy); }
.btn { background: var(--grad-brand); }
.btn:hover { background: var(--grad-brand-hover); }
.btn.ghost, .btn.danger { background: var(--surface); }
.btn.ghost:hover { background: var(--water-soft); }
.btn-red, .btn-red:hover { background: linear-gradient(135deg, #b3372a, #962b20); }
.login-art { background: var(--grad-water); }
.nav.on { background: linear-gradient(90deg, rgba(159, 220, 207, .3), rgba(159, 220, 207, .08)); }
[dir="rtl"] .nav.on { background: linear-gradient(270deg, rgba(159, 220, 207, .3), rgba(159, 220, 207, .08)); }
.stat { border-top-width: 1px; border-top-color: var(--line); position: relative; overflow: hidden; padding-top: 19px; }
.stat::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--water), var(--river)); }
.stat:nth-child(2)::before { background: linear-gradient(90deg, #b5dba4, var(--leaf)); }
.stat:nth-child(3)::before { background: linear-gradient(90deg, #f4ad9e, var(--coral)); }
.stat:nth-child(4)::before { background: linear-gradient(90deg, #8fb3b3, var(--roof)); }
.stat:nth-child(5)::before { background: linear-gradient(90deg, var(--water), var(--brand)); }
.col .bar { background: linear-gradient(to top, #9fdccf, #c6e1ef); }
.col.current .bar { background: linear-gradient(to top, #0b4f5c, #0f7d74); }
.col:hover .bar { background: linear-gradient(to top, #12917f, #6fb3d8); }
.bl-bar { background: linear-gradient(90deg, #0f7d74, #3a9fd0); }
.msg.user { background: var(--grad-brand); }
.avatar { background: linear-gradient(135deg, #f1f7fc, #d6f0ea); }
.step-n { background: var(--grad-brand); }
.day.today { background: linear-gradient(180deg, #e3f6f1 0, var(--surface) 120px); }
.first-day { background: linear-gradient(135deg, #e3f6f1 0%, #f4f9fd 55%, #eef7ea 100%); }
#toast { background: var(--grad-navy); }
.tool-btn svg { width: 20px; height: 20px; color: var(--brand); }
.tool-btn.listening svg { color: #fff; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 28px 24px 110px; gap: 18px; }
  .login-logo { width: 150px; }
  .login-art h1 { font-size: 28px; }
  .login-art .waves { height: 110px; }
  .login-form { padding: 28px 16px 40px; }
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  /* Phone: a slim top bar (logo, page name, ☰). The menu opens as a panel under it. */
  .side { position: sticky; top: 0; z-index: 40; height: auto; padding: 0; gap: 0; }
  .side-top { display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: 56px; }
  .side .brand { padding: 0; } .side .brand-name { display: none; }
  .brand-mark { width: 36px; height: 36px; border-radius: 10px; } .brand-mark img { width: 30px; height: 30px; }
  .m-title { display: block; flex: 1; color: #fff; font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .menu-btn { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .1); color: #fff; font-size: 20px; cursor: pointer; }
  .side-menu { display: none; padding: 4px 12px 14px; border-top: 1px solid rgba(255, 255, 255, .12); max-height: calc(100dvh - 56px); overflow-y: auto; }
  .side.open .side-menu { display: block; box-shadow: 0 16px 30px rgba(0, 0, 0, .25); }
  .side .spacer { display: none; }
  .nav { padding: 12px; font-size: 16px; }
  .lang-btn.corner { top: 12px; inset-inline-end: 12px; }
  .me { margin-top: 6px; }
  .main { padding: 18px 14px 40px; }
  /* 16px text in boxes stops iPhones from zooming the page when you tap one */
  input, select, textarea { font-size: 16px; }
  h1 { font-size: 22px; }
  .head { margin-bottom: 16px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  /* minmax(0, …) lets wide tables scroll inside their card instead of stretching the page */
  .portal, .profile, .chat-wrap { grid-template-columns: minmax(0, 1fr); }
  .portal > *, .profile > *, .chat-wrap > * { min-width: 0; }
  .side { background: linear-gradient(100deg, #0b4f5c 0%, #0d6672 60%, #0f7d74 100%); }
  .m-title { display: none !important; }
  .side .brand { flex: 1; } .side .brand-name { display: inline; font-size: 17px; }
  /* page buttons: one tidy row, single line each */
  .head > div:last-child:not(:first-child) { width: 100%; }
  .head > div:last-child:not(:first-child) > .btn { flex: 1 1 0; }
  .head .btn { padding: 10px 12px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .head > .btn { width: 100%; }
  .card { padding: 16px; }
  .card.chat, .card.group, .card.hist-list { padding: 0; }
  /* numbers at the top */
  .stats { gap: 10px; }
  .stat { padding: 16px 14px 12px; }
  .stat .n { font-size: 24px; }
  .stat .l { font-size: 12.5px; line-height: 1.35; }
  .delta-label { display: none; }
  .col .x.skip-phone { visibility: hidden; }
  /* tables become cards on a phone */
  .table-wrap.cards table, .table-wrap.cards tbody { display: block; }
  .table-wrap.cards thead { display: none; }
  .table-wrap.cards tr { display: grid; grid-template-columns: auto auto 1fr auto; grid-template-areas: "patient patient patient edit" "date date date edit" "doctor doctor doctor doctor" "type loc loc min" "notes notes notes notes"; gap: 4px 10px; padding: 12px 6px; border-bottom: 1px solid var(--line-soft); align-items: center; }
  .table-wrap.cards tr:last-child { border-bottom: 0; }
  .table-wrap.cards td { padding: 0; border: 0; white-space: normal !important; }
  .table-wrap.cards td:empty { display: none; }
  .c-patient { grid-area: patient; font-size: 16px; } .c-date { grid-area: date; color: var(--muted); font-size: 13px; }
  .c-time { display: inline; margin-inline-start: 6px; } .c-doctor { grid-area: doctor; font-size: 13px; } .c-type { grid-area: type; }
  .c-loc { grid-area: loc; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
  .c-min { grid-area: min; font-size: 13px; color: var(--muted); white-space: nowrap; } .c-min:not(:empty)::after { content: " " attr(data-unit); }
  .c-notes { grid-area: notes; color: var(--muted); } .c-edit { grid-area: edit; align-self: center; }
  .group-head { padding: 12px 14px; }
  .cov-grid { grid-template-columns: minmax(0, 1fr); }
  .map { height: 58vh; min-height: 340px; }
  .cov-side { max-height: none; }
  .req-row { flex-direction: column; }
  .req-actions { justify-content: flex-start; }
  .card.map-card { padding: 0; }
  .attention-card { grid-template-columns: 24px 1fr; }
  .attention-card .btn { grid-column: 1 / -1; }
  .mini-map { height: 200px; }
  .map-link-field .search-row { flex-wrap: wrap; }
  .map-link-field .here-btn { flex: 1 1 100%; }
  /* AI room on a phone: the chat fills the screen under the top bar; memory comes after it. */
  .chat-wrap { height: auto; gap: 14px; }
  .chat { height: calc(100dvh - 56px - 32px); min-height: 420px; border-radius: 12px; }
  .chat-head { padding: 10px 12px; flex-wrap: wrap; }
  .chat-head strong { display: none; }
  .chat-head > div { width: 100%; } .chat-head select { flex: 1; }
  .msgs { padding: 14px 12px; }
  .msg { padding: 10px 13px; font-size: 15px; }
  .composer { padding: 8px; gap: 6px; flex-wrap: wrap; }
  .composer textarea { flex: 1 1 100%; order: -1; min-height: 44px; }
  .composer-tools { flex: 1; }
  .composer-note { display: none; }
  .tool-btn { width: 44px; height: 44px; }
  .tool-btn.lang-mini { width: 36px; height: 36px; }
  .chat-page-head { display: none; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .msg, .act-card { max-width: 92%; }
  .ov-grid, .rep-cols { grid-template-columns: minmax(0, 1fr); }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .hist-row { grid-template-columns: 1fr auto; }
  .hist-when { grid-column: 1 / -1; display: flex; gap: 8px; }
  .rep-kpis { grid-template-columns: repeat(2, 1fr); }
  .week { grid-template-columns: 1fr; }
  .day { min-height: 0; }
  .day.past:not(.today) .day-items:has(.day-empty) { display: none; }
  .colchart .x { font-size: 10px; }
  .report { padding: 18px; }
}
@media (max-width: 480px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat .n { font-size: 22px; }
  .head .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- live alerts, nav count, smart search, doctor map, lasso ---------- */
#alerts:empty { display: none; }
.alert-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 12px 16px; border-radius: var(--radius); text-decoration: none; color: var(--ink); border: 1px solid; box-shadow: var(--shadow); }
.alert-bar > span:nth-child(2) { flex: 1; min-width: 0; }
.alert-bar .small { color: var(--muted); }
.alert-bar.info { background: linear-gradient(135deg, #e3f6f1, #f1f8fc); border-color: #b9d6ea; }
.alert-bar.danger { background: linear-gradient(135deg, #fdece8, #fbe1db); border-color: #eeb1a5; color: #6e1d14; animation: alert-pulse 2.4s ease-in-out infinite; }
.alert-bar.danger b { color: var(--danger); }
.alert-ico { font-size: 22px; line-height: 1; }
.alert-bar .btn { flex: none; }
@keyframes alert-pulse { 0%, 100% { box-shadow: var(--shadow); } 50% { box-shadow: 0 0 0 4px rgba(179, 55, 42, .15), var(--shadow); } }
@media (prefers-reduced-motion: reduce) { .alert-bar.danger { animation: none; } }
@media (max-width: 640px) { .alert-bar { flex-wrap: wrap; } .alert-bar .btn { width: 100%; text-align: center; } }
.nav-badge { margin-inline-start: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--water); color: var(--brand-ink); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.nav-badge.red { background: var(--danger); color: #fff; }
.search-box input { width: 100%; }
.map-search { position: relative; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.map-search input { width: 100%; }
.map-search .search-results:not(:empty) { position: absolute; inset-inline: 12px; top: 100%; z-index: 1000; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px; box-shadow: 0 10px 30px rgba(11, 79, 92, .18); margin-top: -4px; }
.search-results button.active { border-color: var(--brand); background: var(--water-soft); }
.search-results .muted { padding: 6px 4px; font-size: 13px; }
.section-title { font-size: 17px; margin: 22px 0 10px; color: var(--brand-ink); }
.leaflet-tooltip.name-tip { padding: 3px 8px; font-size: 12px; border-radius: 8px; border: 0; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); white-space: nowrap; }
.vertex-mid { background: rgba(255, 255, 255, .85); border: 2px dashed var(--brand); border-radius: 50%; color: var(--brand); font: 700 11px/10px var(--font); text-align: center; cursor: copy; }
.map.lasso, .map.lasso .leaflet-interactive { cursor: crosshair !important; touch-action: none; }
.drawbar .seg button { padding: 5px 12px; }
/* Leaflet places pins/labels with left offsets; keep the map itself left-to-right (labels still use dir="auto"). */
.leaflet-container { direction: ltr; }
.leaflet-container .leaflet-tooltip, .leaflet-container .leaflet-popup-content { direction: rtl; }
[dir="ltr"] .leaflet-container .leaflet-tooltip, [dir="ltr"] .leaflet-container .leaflet-popup-content { direction: ltr; }
.map-legend i.dot { width: 9px; height: 9px; background: var(--brand); box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--line); }

/* ===================== Polish round 2 (2026-11-23) ===================== */
/* Page and dialog entrance: quick and subtle. */
.page-in > * { animation: page-in .22s ease-out both; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.modal-bg { animation: fade-in .15s ease-out; }
.modal { animation: pop-in .18s ease-out; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .page-in > *, .modal, .modal-bg, .sk-line { animation: none !important; } }

/* Loading placeholders. */
.skeleton { display: grid; gap: 12px; }
.skeleton.card { padding: 14px 18px; gap: 0; }
.sk-head { display: grid; gap: 10px; margin-bottom: 8px; }
.sk-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.sk-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 10px; }
.sk-card.tall { min-height: 200px; align-content: start; }
.sk-row { display: flex; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.sk-row:last-child { border-bottom: 0; }
.sk-line { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, #e9eff5 0%, #f4f7fa 50%, #e9eff5 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.sk-head .sk-line:first-child { height: 22px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (max-width: 980px) { .sk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Errors: a clear box instead of loose red text. */
.error:not(:empty) { background: var(--coral-soft); border: 1px solid #f3c2b8; color: #8c2a1c; border-radius: var(--radius-sm); padding: 9px 12px; font-weight: 500; }
.error:not(:empty)::before { content: "⚠ "; }
.btn.loading { opacity: .75; cursor: progress; }
.btn.loading::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Cards with a title row. */
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card-head h2 { font-size: 18px; margin: 0; }
.today-card, .closing-card { margin-bottom: 20px; }
.closing-card { border-color: #f0c9a8; background: linear-gradient(180deg, #fff8f1, var(--surface) 60%); }
.closing-card h2 { color: #8a4b14; }
.small-empty { padding: 18px; }

/* A visit as a row: time, patient, one big action. */
.visit-row { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 4px; border-top: 1px solid var(--line-soft); }
.visit-row:first-of-type { border-top: 0; }
.vr-time { display: grid; color: var(--brand-ink); font-weight: 700; font-size: 15px; line-height: 1.2; }
.vr-time b { font-size: 12px; color: var(--muted); font-weight: 600; }
.vr-main { display: grid; gap: 2px; min-width: 0; }
.vr-main b { font-size: 15px; }
.vr-main .muted { overflow: hidden; text-overflow: ellipsis; }
.vr-actions { display: flex; gap: 6px; align-items: center; }
.visit-row.done .vr-main b { color: var(--muted); }
@media (max-width: 640px) {
  .visit-row { grid-template-columns: 84px minmax(0, 1fr); }
  .vr-actions { grid-column: 1 / -1; }
  .vr-actions .btn:not(.ghost) { flex: 1; padding: 12px; font-size: 15px; }
}

/* Patient picker. */
.patient-field { position: relative; }
.patient-field > .search-results:not(:empty) { position: absolute; inset-inline: 0; top: 70px; z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px; box-shadow: 0 12px 30px rgba(11, 79, 92, .16); max-height: 260px; overflow-y: auto; }
.search-results button { display: block; width: 100%; }
.search-results .new-patient { color: var(--brand); font-weight: 600; border-style: dashed; }
.patient-more { margin-top: 8px; }
.patient-more summary { cursor: pointer; color: var(--brand); font-size: 13px; font-weight: 600; list-style: none; }
.patient-more summary::-webkit-details-marker { display: none; }
.patient-more summary::before { content: "＋ "; }
.patient-more[open] summary::before { content: "－ "; }
.patient-more .grid2 { margin-top: 10px; }
.patient-more .field { margin-bottom: 4px; }

/* Booking: how full is the doctor's day. */
.load-note:not(:empty) { margin: -4px 0 14px; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--water-soft); color: var(--brand-ink); font-size: 13px; line-height: 1.5; }
.load-note.free { background: var(--leaf-soft); color: var(--leaf-ink); }
.load-note.warn { background: #fff3e0; color: #7a4510; border: 1px solid #f2cf9c; }

/* Drafts and the offline outbox. */
.draft-note { margin: 0 0 12px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--water-soft); font-size: 13px; }
.link { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }
.outbox-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 12px 16px; border-radius: var(--radius); background: #fff8e6; border: 1px solid #f1d48a; }
.outbox-bar > span:nth-child(2) { flex: 1; min-width: 0; }
.outbox-bar.bad { background: var(--coral-soft); border-color: #f3c2b8; }
.outbox-bar .small { color: var(--muted); }

/* Reassigning visits, merging patients. */
.reassign-list { display: grid; gap: 8px; margin-bottom: 12px; max-height: 45vh; overflow-y: auto; }
.reassign-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 200px); gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); font-size: 14px; }
.merge-box { margin: 6px 0 12px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.merge-box summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.merge-box .search-row { margin-top: 8px; }
.range-hint { margin: -4px 0 12px; }

/* Tables: calmer header, row hover on desktop. */
@media (hover: hover) { tbody tr:hover td { background: #f7fafd; } }
th { background: var(--surface-2); }

/* Schedule: a clearer day header. */
.day header { padding: 10px 12px; background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
.day.today { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(15, 125, 116, .12); }
.day.past { opacity: .82; }
.phone-only { display: none; }
.past-toggle { margin: 0 0 10px; }
@media (max-width: 980px) {
  .phone-only { display: inline-flex; }
  .week.hide-past .day.past { display: none; }
}

/* Phone: the alert becomes one compact line. */
@media (max-width: 640px) {
  .alert-bar { flex-wrap: nowrap; padding: 8px 12px; gap: 8px; margin-bottom: 12px; animation: none; }
  .alert-bar .small { display: none; }
  .alert-bar b { font-size: 13px; line-height: 1.35; }
  .alert-bar .alert-ico { font-size: 16px; }
  .alert-bar .btn { width: auto; padding: 6px 12px; font-size: 12px; }
  .outbox-bar { padding: 10px 12px; }
  .reassign-row { grid-template-columns: 1fr; }
}

/* Doctors on phones: a bottom tab bar instead of the menu for the 3 pages. */
.tabbar { display: none; }
@media (max-width: 980px) {
  .doc-shell .nav-list { display: none; }
  .doc-shell .main { padding-bottom: 96px; }
  .doc-shell .tabbar { display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; inset-inline: 0; bottom: 0; z-index: 50;
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 20px rgba(11, 79, 92, .08); }
  .tab { display: grid; justify-items: center; gap: 3px; padding: 6px 4px; border-radius: 12px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600; position: relative; }
  .tab svg { width: 24px; height: 24px; }
  .tab.on { color: var(--brand); background: var(--water-soft); }
  .tab .nav-badge { position: absolute; top: 2px; inset-inline-end: calc(50% - 22px); margin: 0; }
}
.pill.web { background: var(--water-soft); color: var(--brand-ink); }

/* ===== Lotus brand pass (2026-11-23): richer teal gradients, no leftover blues ===== */
:root {
  --grad-brand: linear-gradient(135deg, #0f7d74 0%, #14998a 100%);
  --grad-brand-hover: linear-gradient(135deg, #0b6a62 0%, #0f8679 100%);
  --grad-navy: linear-gradient(165deg, #083e49 0%, #0b4f5c 35%, #0f7d74 85%, #1a9886 100%);
  --grad-water: linear-gradient(155deg, #f4faf8 0%, #e3f6f1 45%, #c9ece3 100%);
}
body { background: linear-gradient(180deg, #e6f4f0 0, var(--bg) 380px) no-repeat, var(--bg); }
.side { overflow: hidden; } /* keeps position: sticky from above; clips the watermark */
.side::after { content: ""; position: absolute; width: 240px; height: 240px; inset-inline-end: -70px; bottom: -60px; pointer-events: none; opacity: .07;
  background: url("logo-mark.png") center / contain no-repeat; filter: brightness(0) invert(1); }
.login-art::before { content: ""; position: absolute; width: 420px; height: 420px; inset-inline-end: -110px; top: -90px; opacity: .08; pointer-events: none;
  background: url("logo-mark.png") center / contain no-repeat; }
.stat::before { background: linear-gradient(90deg, #9fdccf, #0f7d74); }
.stat:nth-child(2)::before { background: linear-gradient(90deg, #c9ece3, #5cc9b5); }
.stat:nth-child(3)::before { background: linear-gradient(90deg, #5cc9b5, #0b4f5c); }
.stat:nth-child(4)::before { background: linear-gradient(90deg, #f4b9a6, #c8502f); }
.stat:nth-child(5)::before { background: linear-gradient(90deg, #9fdccf, #0b4f5c); }
.col .bar { background: linear-gradient(to top, #9fdccf, #d6f0ea); }
.col:hover .bar { background: linear-gradient(to top, #12917f, #5cc9b5); }
.bl-bar { background: linear-gradient(90deg, #0f7d74, #5cc9b5); }
.avatar { background: linear-gradient(135deg, #f4faf8, #c9ece3); color: var(--brand-ink); }
.brand-mark { background: #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, .15); }

/* Several areas per doctor */
.doc-area-main { flex: 1; min-width: 0; }
.area-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.area-chip { display: inline-flex; align-items: center; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 13px; }
.area-chip .link { font-size: 13px; text-decoration: none; }
.area-chip .icon-x { width: 22px; height: 22px; font-size: 15px; }
.area-name { display: flex; gap: 8px; align-items: center; font-size: 13px; margin: 0 0 8px; } .area-name input { max-width: 220px; padding: 6px 10px; }
.doc-area { grid-template-columns: 14px 1fr auto; align-items: start; } .doc-area .swatch { margin-top: 5px; }
.area-chip .link { white-space: nowrap; }

/* ---------- Founders' calendar (calendar.js) and founder-only fees ---------- */
.fee-box { border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 6px 12px 0; margin: 4px 0 12px; }
.fee-box legend { font-size: 12px; color: var(--muted); padding: 0 6px; }
.fee-tag { display: block; margin-top: 3px; font-size: 12px; color: var(--coral-ink); font-weight: 600; }
.alert-bar.warn { background: linear-gradient(135deg, #fff6e5, #fdece8); border-color: #f1d1a8; }
.k-session { --k: #e0583f; --k-soft: #fdece8; --k-ink: #a63a26; }
.k-meeting { --k: #0f7d74; --k-soft: #e3f6f1; --k-ink: #0b4f5c; }
.k-reminder { --k: #c98a12; --k-soft: #fdf3dd; --k-ink: #7a5208; }
.k-other { --k: #6b7c93; --k-soft: #eef1f4; --k-ink: #3c4a5c; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--k, var(--muted)); }
.cal-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-nav h2 { margin: 0 6px; font-size: 22px; min-width: 9ch; text-align: center; color: var(--brand-ink); }
.cal-nav .btn.sm:not(#today) { width: 36px; padding-inline: 0; font-size: 20px; line-height: 1; }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.cal-card { padding: 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-wd { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; padding: 4px 0 6px; }
.cal-cell { min-height: 112px; border: 1px solid var(--line-soft); border-radius: 10px; padding: 6px; background: var(--surface); cursor: pointer; display: flex; flex-direction: column; gap: 3px; min-width: 0; transition: border-color .15s, background .15s; }
.cal-cell:hover { border-color: var(--water); }
.cal-cell:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.cal-cell.out { background: #f8fbfa; }
.cal-cell.out .cal-num { color: #a9b9bd; }
.cal-cell.sel { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; background: #fbfefd; }
.cal-num { font-size: 13px; font-weight: 600; color: var(--ink); align-self: flex-start; min-width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-cell.is-today .cal-num { background: var(--grad-brand); color: #fff; }
.cal-items { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-chip { display: block; width: 100%; text-align: start; border: 0; border-inline-start: 3px solid var(--k); background: var(--k-soft); color: var(--k-ink); border-radius: 6px; padding: 3px 6px; font: inherit; font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal-chip .t { font-weight: 700; margin-inline-end: 4px; }
.cal-chip.done { opacity: .55; text-decoration: line-through; }
.who-tag { display: inline-block; font-size: 10px; background: var(--surface); border-radius: 4px; padding: 0 3px; margin-inline-end: 4px; }
.cal-more { font-size: 11px; color: var(--muted); padding-inline-start: 4px; }
.cal-dots { display: none; gap: 3px; justify-content: center; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); padding: 10px 4px 2px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-day { position: sticky; top: 16px; }
.cal-day .card-head h2 { font-size: 17px; }
.ev-row { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 10px; padding: 10px 10px; border-radius: 10px; background: var(--k-soft); border-inline-start: 4px solid var(--k); margin-bottom: 8px; align-items: start; }
.ev-row.done .ev-main b { text-decoration: line-through; opacity: .6; }
.ev-time { font-size: 12px; font-weight: 700; color: var(--k-ink); padding-top: 2px; }
.ev-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ev-main b { overflow-wrap: anywhere; }
.ev-notes { color: var(--ink); opacity: .8; white-space: pre-wrap; overflow-wrap: anywhere; }
.ev-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.check.sm { font-size: 12px; }
.kind-pick { grid-template-columns: repeat(4, 1fr); }
.kind-pick button.on { border-color: var(--k); background: var(--k-soft); color: var(--k-ink); }
@media (max-width: 1100px) { .cal-layout { grid-template-columns: minmax(0, 1fr); } .cal-day { position: static; } }
@media (max-width: 700px) {
  .cal-card { padding: 6px; }
  .cal-grid { gap: 2px; }
  .cal-cell { min-height: 54px; padding: 4px 2px; align-items: center; border-radius: 8px; }
  .cal-num { align-self: center; }
  .cal-items { display: none; }
  .cal-dots { display: flex; }
  .cal-nav h2 { font-size: 18px; }
  .cal-bar .seg { overflow-x: auto; max-width: 100%; }
  .kind-pick { grid-template-columns: repeat(2, 1fr); }
  .ev-row { grid-template-columns: minmax(0, 1fr) auto; }
  .ev-time { grid-column: 1 / -1; padding: 0; }
}
.cal-bar .seg { overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.cal-bar .seg button { white-space: nowrap; flex: none; }

/* Side menu: stays in view while the page scrolls; scrolls itself on short screens. */
@media (min-width: 981px) {
  .side-menu { min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .25) transparent; }
}
/* Collapsible menu groups (founders). */
.nav-group { border-radius: var(--radius-sm); }
.nav-sum { list-style: none; user-select: none; }
.nav-sum::-webkit-details-marker { display: none; }
.nav-sum .chev { margin-inline-start: auto; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); opacity: .7; transition: transform .2s; flex: none; }
[dir="rtl"] .nav-sum .chev { transform: rotate(135deg); }
.nav-group[open] > .nav-sum .chev { transform: rotate(45deg); }
.nav-sum:has(.nav-badge) .chev { margin-inline-start: 8px; order: 2; }
.nav-group[open] .sum-badge { display: none; }
.nav-group[open] > .nav-sum { color: #fff; }
.nav-sub { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px; padding-inline-start: 14px; border-inline-start: 1px solid rgba(255, 255, 255, .14); margin-inline-start: 20px; }
.nav-sub .nav { padding: 8px 10px; font-weight: 500; font-size: 14px; }
.nav-sub .nav svg { width: 16px; height: 16px; }
@media (prefers-reduced-motion: reduce) { .nav-sum .chev { transition: none; } }
/* Tables: Arabic names/places in English pages line up with their column (and the other way round). */
html[dir="ltr"] td[dir="auto"], html[dir="ltr"] td [dir="auto"] { text-align: left; }
html[dir="rtl"] td[dir="auto"], html[dir="rtl"] td [dir="auto"] { text-align: right; }

/* Technical team card (side menu). */
.tech-team { margin: 10px 0 0; border-radius: 12px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); color: #e3eef8; position: relative; z-index: 1; }
.tech-team summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none; border-radius: 12px; }
.tech-team summary::-webkit-details-marker { display: none; }
.tech-team summary:hover { background: rgba(255, 255, 255, .06); }
.tech-team summary:focus-visible { outline: 2px solid var(--water); outline-offset: 2px; }
.tech-faces { display: flex; flex: none; }
.tech-faces i, .tech-av { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, #9fdccf, #5cc9b5); color: #0b4f5c; font-style: normal; font-size: 11px; font-weight: 700; border: 2px solid #0d5f69; }
.tech-faces i + i { margin-inline-start: -9px; background: linear-gradient(135deg, #f4faf8, #c9ece3); }
.tech-head { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.tech-head b { color: #fff; font-size: 13px; }
.tech-head span { font-size: 11.5px; color: #a9c0d6; }
.tech-team .chev { margin-inline-start: auto; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); opacity: .6; transition: transform .2s; flex: none; }
.tech-team[open] .chev { transform: rotate(-135deg); }
.tech-intro { margin: 0 12px 8px; font-size: 12px; line-height: 1.5; color: #c4d6e4; }
.tech-person { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid rgba(255, 255, 255, .08); }
.tech-av { width: 34px; height: 34px; font-size: 12px; flex: none; border: 0; }
.tech-who { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.tech-who b { color: #fff; font-size: 13px; }
.tech-who span { font-size: 11.5px; color: #a9c0d6; }
.tech-btns { display: flex; gap: 6px; flex: none; }
.tech-btn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; text-decoration: none; transition: transform .15s, filter .15s; }
.tech-btn svg { width: 17px; height: 17px; }
.tech-btn.wa { background: #25d366; }
.tech-btn.call { background: rgba(255, 255, 255, .16); }
.tech-btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.tech-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (max-width: 980px) { .tech-team { margin: 10px 0 4px; } .tech-btn { width: 40px; height: 40px; } }
@media (prefers-reduced-motion: reduce) { .tech-team .chev, .tech-btn { transition: none; } }
/* Name + buttons on one line, the role underneath across the card (the side menu is narrow). */
.tech-person { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; grid-template-areas: "av name btns" "av role role"; column-gap: 10px; row-gap: 2px; align-items: center; }
.tech-av { grid-area: av; align-self: start; margin-top: 2px; }
.tech-who { display: contents; }
.tech-who b { grid-area: name; }
.tech-who span { grid-area: role; }
.tech-btns { grid-area: btns; }
/* Desktop side menu: only the page list scrolls; the technical team card and the account stay pinned at the bottom. */
@media (min-width: 981px) {
  .side-menu { overflow: hidden; }
  .side .nav-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .25) transparent; padding-bottom: 8px; }
  .side .spacer { display: none; }
  .tech-team, .me { flex: none; }
  .tech-team[open] { max-height: 46vh; overflow-y: auto; scrollbar-width: thin; }
}

/* Notes to the technical team (founders' button in the card + the modal). */
.tech-note-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: calc(100% - 24px); margin: 4px 12px 12px; padding: 9px 12px; border-radius: 10px; border: 1px dashed rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .08); color: #fff; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.tech-note-btn svg { width: 16px; height: 16px; }
.tech-note-btn:hover { background: rgba(255, 255, 255, .14); }
.tech-note-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.tn-form textarea { width: 100%; resize: vertical; min-height: 96px; }
.tn-list-h { margin: 18px 0 8px; font-size: 15px; }
.tn-list { display: grid; gap: 10px; max-height: 42vh; overflow-y: auto; }
.tn-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface); }
.tn-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.tn-meta .tn-withdraw { margin-inline-start: auto; font-size: 12.5px; }
.tn-body { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.tn-reply { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); font-size: 13.5px; white-space: pre-wrap; }
.tn-st { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.tn-new { background: #fdecd2; color: #8a4b00; }
.tn-in_progress { background: #dbeefe; color: #134a7c; }
.tn-done { background: #dcf3e6; color: #1d6b3f; }
/* The technical team's own page. */
.tech-shell { min-height: 100vh; background: var(--bg); }
.tech-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 20px; background: var(--grad-side, #0b4f5c); color: #fff; }
.tech-bar .brand { display: flex; align-items: center; gap: 10px; }
.tech-bar .brand-mark { background: #fff; border-radius: 10px; padding: 3px; display: grid; }
.tech-bar .brand b { display: block; font-size: 15px; } .tech-bar .brand small { display: block; font-size: 12px; opacity: .8; }
.tech-bar .row { display: flex; gap: 8px; flex-wrap: wrap; }
.tech-bar .btn.ghost, .tech-bar .lang-btn { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .25); }
.tech-main { max-width: 860px; margin: 0 auto; padding: 24px 16px 60px; }
.tn-card { display: grid; gap: 8px; margin-bottom: 14px; padding: 18px; }
.tn-edit { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; align-items: start; }
.tn-edit label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.tn-edit textarea { width: 100%; resize: vertical; }
.tn-card .actions { display: flex; justify-content: flex-end; }
@media (max-width: 600px) { .tn-edit { grid-template-columns: 1fr; } .tech-bar { padding: 10px 14px; } }

/* Live updates: a small bar when the page couldn't be redrawn (someone is typing, a dialog is open, a map page). */
.live-bar { position: fixed; z-index: 60; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 999px; background: var(--brand-ink, #0b4f5c); color: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .22); font-size: 14px; animation: live-in .25s ease-out; max-width: calc(100vw - 32px); }
[dir="rtl"] .live-bar { padding: 8px 16px 8px 8px; }
.live-bar button { border: 0; border-radius: 999px; padding: 7px 14px; background: #fff; color: var(--brand-ink, #0b4f5c); font: inherit; font-weight: 700; cursor: pointer; }
.live-bar button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@keyframes live-in { from { opacity: 0; transform: translate(-50%, 10px); } }
@media (max-width: 980px) { .live-bar { bottom: 84px; } }
@media (prefers-reduced-motion: reduce) { .live-bar { animation: none; } }

/* Partners + referred patients */
.p-tabs { display: flex; gap: 4px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; }
.p-tabs a { padding: 12px 14px; color: var(--muted); font-weight: 600; text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; }
.p-tabs a.on { color: var(--brand-ink, #0b4f5c); border-bottom-color: var(--brand, #0f7d74); }
.p-tabs a:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.ref-form fieldset { border: 0; padding: 0; margin: 0 0 10px; }
.ref-form legend { font-weight: 700; color: var(--brand-ink, #0b4f5c); margin-bottom: 8px; font-size: 15px; }
.ref-form textarea { width: 100%; resize: vertical; }
.ref-form .actions { display: flex; justify-content: flex-end; }
.ref-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.ref-kpis .card { padding: 14px 16px; display: grid; gap: 2px; }
.ref-kpis b { font-size: 24px; color: var(--brand-ink, #0b4f5c); } .ref-kpis span { font-size: 13px; color: var(--muted); }
.ref-card { margin-bottom: 12px; display: grid; gap: 6px; }
.ref-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ref-top h3 { margin: 0; margin-inline-end: auto; font-size: 17px; }
.ref-cond, .ref-notes { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ref-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 14px; margin: 6px 0 0; }
.ref-facts.wide { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.ref-facts dt { font-size: 12px; color: var(--muted); } .ref-facts dd { margin: 0; font-weight: 600; }
.ref-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.ref-st { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.ref-received { background: #fdecd2; color: #8a4b00; } .ref-assigned { background: #dbeefe; color: #134a7c; } .ref-treat { background: #d9f2ec; color: #0b5f55; }
.ref-done { background: #dcf3e6; color: #1d6b3f; } .ref-declined { background: #eceff1; color: #52606a; } .ref-urgent { background: #fde2dd; color: #9a2a14; }
.ref-visit { border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin: 6px 0; }
.ref-visit legend { padding: 0 6px; font-weight: 600; }
.pt-card.off { opacity: .65; }
.pt-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
@media (max-width: 700px) { .ref-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ref-facts { grid-template-columns: 1fr 1fr; } }

/* Doctor activity, inbox, money, tech tabs (2026-11-26) */
.act-flag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; margin: 1px 0; }
.act-flag.ok { background: #dcf3e6; color: #1d6b3f; } .act-flag.amber { background: #fdecd2; color: #8a4b00; } .act-flag.red { background: #fde2dd; color: #9a2a14; }
.inbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 22px; }
.inbox-card { display: grid; gap: 4px; align-content: start; }
.inbox-card h3 { margin: 4px 0 0; font-size: 17px; } .inbox-card p { margin: 0; }
.ib-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.ib-why { font-weight: 600; color: var(--brand-ink, #0b4f5c); font-size: 14px; }
.ib-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.ib-h { font-size: 16px; margin: 6px 0 10px; }
.src { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.src-web { background: #dbeefe; color: #134a7c; } .src-partner { background: #efe4fb; color: #5b2d8a; } .src-manual { background: #eceff1; color: #52606a; }
.month-nav button:disabled { opacity: 1; cursor: default; font-weight: 700; min-width: 140px; }
.m-h { font-size: 17px; margin: 22px 0 4px; }
.fee-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; padding: 10px 0; border-bottom: 1px solid var(--line); }
.fee-row > b { min-width: 170px; align-self: center; }
.fee-row label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.fee-row input { width: 130px; }
.fee-add { padding-top: 12px; } .fee-add select { max-width: 320px; }
.small-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 14px; } .small-stats .stat .n { font-size: 22px; }
.err-item { margin-bottom: 8px; padding: 12px 16px; } .err-item summary { cursor: pointer; display: grid; gap: 2px; list-style: none; }
.err-msg { font-family: ui-monospace, Consolas, monospace; font-size: 13.5px; color: #9a2a14; overflow-wrap: anywhere; }
.err-item pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; background: var(--surface-2); padding: 10px; border-radius: 8px; max-height: 260px; overflow: auto; }
.use-bar { display: grid; grid-template-columns: 140px minmax(0, 1fr) 56px; gap: 10px; align-items: center; padding: 5px 0; font-size: 14px; }
.use-track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; } .use-track i { display: block; height: 100%; background: var(--brand, #0f7d74); border-radius: 999px; }
@media (max-width: 700px) { .small-stats { grid-template-columns: 1fr 1fr; } .fee-row input { width: 110px; } .use-bar { grid-template-columns: 100px minmax(0, 1fr) 44px; } }

/* Email alerts (tech page) */
.mail-form { display: grid; gap: 12px; }
.mail-form textarea { font-family: inherit; }
.mail-help { margin-top: 14px; }
.mail-help ol { margin: 10px 0 0; padding-inline-start: 20px; display: grid; gap: 6px; }
.mail-st { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line, #e3efec); }
.mail-sent { background: #dff3ea; color: #135c3a; }
.mail-failed { background: #fde4df; color: #8a2a17; }
