/* ==========================================================================
   Dr. Debanjan Sur — Appointment System UI
   Breakpoints:  phone < 700px · tablet 700–1099px · laptop/desktop ≥ 1100px
   ========================================================================== */

:root {
  --bg: #f4f6f4;
  --surface: #ffffff;
  --surface-2: #f9faf9;
  --ink: #15201e;
  --ink-2: #3a4845;
  --muted: #66736f;
  --line: #e1e7e4;
  --line-2: #cfd8d4;
  --brand: #0f5c55;
  --brand-2: #127a70;
  --brand-soft: #e3f1ee;
  --accent: #c9822b;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --ok: #157f3b;
  --ok-soft: #e5f4ea;
  --warn: #9a5b00;
  --warn-soft: #fff4e0;
  --info: #2c5fa8;
  --info-soft: #e8eff9;
  --violet: #6b3fa0;
  --violet-soft: #f1eafa;

  --ch-1: #0f766e; --ch-2: #b45309; --ch-3: #4338ca;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 32, 30, .06), 0 4px 16px rgba(16, 32, 30, .06);
  --shadow-lg: 0 10px 40px rgba(16, 32, 30, .16);
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: var(--font);   /* one font everywhere (DM Sans, as in the doctor sidebar) */
  --sidebar: 248px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: var(--brand-2); }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-family: var(--font); font-weight: 700; font-size: clamp(1.8rem, 4vw, 2.7rem); }
h2 { font-size: 1.3rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.sr-only { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* ---------- Buttons ---------------------------------------------------- */
.btn {
  --b: var(--surface); --c: var(--ink); --l: var(--line-2);
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  min-height: 42px; padding: .55em 1.05em; border: 1px solid var(--l); border-radius: 10px;
  background: var(--b); color: var(--c); font: 600 .93rem/1 var(--font); text-decoration: none;
  cursor: pointer; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand-2) 45%, transparent); outline-offset: 2px;
}
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn--primary { --b: var(--brand); --c: #fff; --l: var(--brand); }
.btn--primary:hover { --b: var(--brand-2); border-color: var(--brand-2); }
.btn--danger { --b: var(--danger-soft); --c: var(--danger); --l: #f3c3be; }
.btn--ok { --b: var(--ok-soft); --c: var(--ok); --l: #b8dfc5; }
.btn--warn { --b: var(--warn-soft); --c: var(--warn); --l: #f0d3a3; }
.btn--ghost { --b: transparent; --l: transparent; }
.btn--ghost:hover { --b: var(--surface-2); border-color: var(--line); }
.btn--sm { min-height: 34px; padding: .4em .7em; font-size: .84rem; border-radius: 8px; }
.btn--icon { min-width: 36px; padding: .4em; }
.btn--block { width: 100%; }
.btn--lg { min-height: 52px; font-size: 1.02rem; padding-inline: 1.4em; }

/* ---------- Forms ------------------------------------------------------ */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span, .label { font-size: .84rem; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--muted); font-size: .8rem; }
input[type=text], input[type=tel], input[type=number], input[type=password], input[type=date],
input[type=search], input[type=time], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: 400 1rem/1.3 var(--font);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.grid-2 { display: grid; gap: 0 14px; grid-template-columns: 1fr 1fr; }
.grid-3 { display: grid; gap: 0 14px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 699px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label, .seg button { padding: 7px 13px; border-radius: 8px; font-weight: 600; font-size: .88rem; cursor: pointer; color: var(--muted); border: 0; background: none; font-family: inherit; }
.seg input:checked + label, .seg button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- Cards, chips, tables -------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card__head h2, .card__head h3 { margin: 0; }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; letter-spacing: .01em; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip--booked { background: var(--info-soft); color: var(--info); border-color: #cbdaf0; }
.chip--confirmed { background: var(--brand-soft); color: var(--brand); border-color: #bfe0da; }
.chip--arrived { background: var(--violet-soft); color: var(--violet); border-color: #dccdf0; }
.chip--completed { background: var(--ok-soft); color: var(--ok); border-color: #b8dfc5; }
.chip--no_show { background: var(--danger-soft); color: var(--danger); border-color: #f3c3be; }
.chip--cancelled { color: var(--muted); }
.chip--rescheduled { background: var(--warn-soft); color: var(--warn); border-color: #f0d3a3; }
.chip--online { background: none; }
.chip--plain::before { display: none; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; }
@media (max-width: 699px) {
  .table--stack thead { display: none; }
  .table--stack tr { display: block; padding: 12px 4px; border-bottom: 1px solid var(--line); }
  .table--stack td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 8px; border: 0; }
  .table--stack td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; font-weight: 600; }
  .table--stack td.r { text-align: right; }
}

.empty { text-align: center; padding: 28px 16px; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--radius-sm); background: var(--surface-2); }

.toast-inline { margin: 0 0 16px; padding: 12px 14px; border-radius: 10px; font-weight: 600; background: var(--ok-soft); color: var(--ok); border: 1px solid #b8dfc5; }
.toast-inline--err { background: var(--danger-soft); color: var(--danger); border-color: #f3c3be; }
.toast-inline--warn { background: var(--warn-soft); color: var(--warn); border-color: #f0d3a3; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); z-index: 90; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; transition: transform .25s ease, opacity .25s, visibility .25s; max-width: calc(100% - 32px); opacity: 0; visibility: hidden; pointer-events: none; }
.toast.is-show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.toast.is-err { background: var(--danger); }
@media (max-width: 1099px) { .area-staff .toast, .area-doctor .toast { bottom: 84px; } }

/* ---------- Public site ----------------------------------------------- */
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand small { display: block; color: var(--muted); font-size: .78rem; }
.brand__mark { display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 11px; background: var(--brand); color: #fff; font: 600 .95rem var(--serif); letter-spacing: .02em; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.site-header__in { display: flex; align-items: center; justify-content: space-between; min-height: 66px; gap: 16px; }
.site-nav { display: flex; gap: 4px; }
.site-nav a { padding: 8px 12px; border-radius: 9px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .92rem; }
.site-nav a:hover { background: var(--surface-2); }
@media (max-width: 699px) { .site-nav a:not(:first-child) { display: none; } .site-nav a:first-child { background: var(--brand); color: #fff; } }

.hero { padding: 40px 0 28px; }
.hero__grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 32px; align-items: end; }
.hero p.lead { font-size: 1.08rem; color: var(--ink-2); max-width: 36em; }
.hero__facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.fact strong { display: block; font-size: 1.3rem; font-family: var(--serif); color: var(--brand); }
.fact span { font-size: .8rem; color: var(--muted); }
@media (max-width: 899px) { .hero__grid { grid-template-columns: 1fr; gap: 18px; } .hero { padding-top: 26px; } }

.booker { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; padding-bottom: 40px; }
@media (max-width: 1099px) { .booker { grid-template-columns: 1fr; } }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.step__head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.step__num { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.step.is-active { border-color: var(--brand, #0f5c55); border-width: 2px; box-shadow: 0 0 0 3px var(--brand-soft, #e3f1ee), var(--shadow); }
.step.is-active .step__num { background: var(--brand, #0f5c55); color: #fff; }
@media (max-width: 1099px) { .step.is-active { border-width: 1.5px; box-shadow: 0 0 0 2px var(--brand-soft, #e3f1ee); } }
.step.is-locked { opacity: .55; }
.step.is-locked .step__body { pointer-events: none; }
.step__head h2 { margin: 0; font-size: 1.1rem; }

.chamber-picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 899px) { .chamber-picks { grid-template-columns: 1fr; } }
.pick { position: relative; display: block; cursor: pointer; }
.pick input { position: absolute; opacity: 0; }
.pick__box { display: block; height: 100%; padding: 14px 16px 14px 18px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); transition: border-color .15s, background .15s; position: relative; overflow: hidden; }
.pick__box::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--c, var(--brand)); }
.pick__box strong { display: block; font-size: 1.02rem; }
.pick__box small { display: block; color: var(--muted); margin-top: 2px; }
.pick__days { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.pick__days span { font-size: .72rem; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.pick input:checked + .pick__box { border-color: var(--c, var(--brand)); background: color-mix(in srgb, var(--c, var(--brand)) 7%, #fff); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c, var(--brand)) 18%, transparent); }
.pick input:focus-visible + .pick__box { outline: 3px solid var(--brand-soft); }

.date-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.date-strip button { scroll-snap-align: start; flex: 0 0 68px; display: grid; gap: 1px; justify-items: center; padding: 9px 4px; border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; cursor: pointer; font-family: inherit; color: var(--ink); }
.date-strip button small { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.date-strip button strong { font-size: 1.25rem; line-height: 1.1; }
.date-strip button em { font-style: normal; font-size: .68rem; color: var(--muted); }
.date-strip button.is-open em { color: var(--ok); font-weight: 700; }
.date-strip button.is-off { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.date-strip button.is-off strong { text-decoration: line-through; text-decoration-color: var(--line-2); }
.date-strip button.is-blackout em { color: var(--danger); font-weight: 700; }
.date-strip button.is-sel { border-color: var(--brand); background: var(--brand); color: #fff; }
.date-strip button.is-sel small, .date-strip button.is-sel em { color: #d9efeb; }

.slot-group + .slot-group { margin-top: 14px; }
.slot-group h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.slots button { min-height: 46px; border: 1.5px solid var(--line); background: var(--surface); border-radius: 10px; font: 600 .92rem var(--font); cursor: pointer; color: var(--ink); display: grid; line-height: 1.15; padding: 5px; }
.slots button small { font-size: .68rem; color: var(--ok); font-weight: 600; }
.slots button:hover:not([disabled]) { border-color: var(--brand-2); }
.slots button[disabled] { background: var(--surface-2); color: #a4afab; cursor: not-allowed; }
.slots button[disabled] small { color: #a4afab; }
.slots button.is-sel { background: var(--brand); border-color: var(--brand); color: #fff; }
.slots button.is-sel small { color: #d9efeb; }
.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: .92rem; }
.notice--danger { background: var(--danger-soft); color: var(--danger); }
.notice--info { background: var(--info-soft); color: var(--info); }

.summary { position: sticky; top: 84px; }
.summary dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0 0 16px; }
.summary dt { color: var(--muted); font-size: .85rem; }
.summary dd { margin: 0; font-weight: 600; text-align: right; }
@media (max-width: 1099px) { .summary { position: static; } }

.ticket { text-align: center; padding: 26px 20px; border-radius: 18px; background: linear-gradient(160deg, var(--brand) 0%, #0b4640 100%); color: #fff; position: relative; overflow: hidden; }
.ticket::after { content: ""; position: absolute; left: -12px; right: -12px; top: 58%; border-top: 2px dashed rgba(255,255,255,.28); }
.ticket__label { text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; opacity: .8; }
.ticket__serial { font: 600 4.2rem/1 var(--serif); margin: 6px 0 4px; letter-spacing: .02em; }
.ticket__meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 34px; text-align: left; font-size: .9rem; position: relative; z-index: 1; }
.ticket__meta span { display: block; opacity: .72; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.ticket-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.ticket-actions .btn { flex: 1; }

.chamber-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding-bottom: 40px; }
@media (max-width: 899px) { .chamber-cards { grid-template-columns: 1fr; } }
.chamber-card { border-top: 5px solid var(--c); }
.sched-list { list-style: none; padding: 0; margin: 10px 0 0; font-size: .9rem; }
.sched-list li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.sched-list li:last-child { border: 0; }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 26px 0 36px; font-size: .9rem; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 8px 0 16px; }

/* ---------- Login ------------------------------------------------------ */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(1200px 500px at 10% -10%, #dcefeb 0%, transparent 60%),
  radial-gradient(800px 400px at 110% 110%, #f6e6cf 0%, transparent 55%), var(--bg); }
.login--doctor { background: radial-gradient(1200px 500px at 10% -10%, #d4ede8 0%, transparent 60%),
  radial-gradient(800px 400px at 110% 110%, #c8e6df 0%, transparent 55%), #eef6f4; }
.login--doctor .login__icon { color: #0f5c55; }
.login--doctor .login__role { color: #0f5c55; }
.login--doctor .btn--primary { background: #0f5c55; }
.login--doctor .btn--primary:hover { background: #127a70; }
.login--staff { background: radial-gradient(1200px 500px at 10% -10%, #f5e0e6 0%, transparent 60%),
  radial-gradient(800px 400px at 110% 110%, #f0d0d8 0%, transparent 55%), #fdf2f5; }
.login--staff .login__icon { color: #a03050; }
.login--staff .login__role { color: #a03050; }
.login--staff .btn--primary { background: #a03050; }
.login--staff .btn--primary:hover { background: #b83d60; }
.login__card { width: min(400px, 100%); }
.login__card .brand { margin-bottom: 18px; }
.login__icon { display: flex; justify-content: center; margin-bottom: 16px; }
.login__icon span { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); }
.login__icon svg { width: 24px; height: 24px; }
.login__role { display: inline-block; margin-bottom: 6px; font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }

/* ---------- App shell (staff / doctor) -------------------------------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 18px 14px; background: #0f2a27; color: #d6e5e1; }
.sidebar__brand { display: flex; gap: 10px; align-items: center; padding: 4px 6px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar__brand strong { color: #fff; display: block; font-size: .95rem; }
.sidebar__brand small { color: #93b0aa; font-size: .78rem; }
.sidebar__brand .brand__mark { background: #1d7a70; }
.sidebar__nav { display: grid; gap: 3px; }
.sidebar__nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #c2d6d1; text-decoration: none; font-weight: 600; font-size: .93rem; }
.sidebar__nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar__nav a.is-active { background: #1d4a45; color: #fff; }
.sidebar__user { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 6px 0; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar__user strong { color: #fff; display: block; font-size: .9rem; }
.sidebar__user small { color: #93b0aa; }
.sidebar__user .btn { color: #c2d6d1; }
.shell__main { min-width: 0; display: flex; flex-direction: column; }
.content { padding: 24px 28px 40px; width: 100%; max-width: 1480px; }
.topbar { display: none; }
.bottomnav { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 1.75rem; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: #9fb3ae; display: inline-block; }
.sync-dot.is-live { background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.18); }
.sync-dot.is-off { background: var(--danger); }
.live-label { display: inline-flex; align-items: center; gap: 7px; font-size: .82rem; color: var(--muted); font-weight: 600; }

/* tablet: icon rail */
@media (max-width: 1099px) and (min-width: 700px) {
  .shell { grid-template-columns: 76px 1fr; }
  .sidebar { padding: 16px 10px; align-items: center; }
  .sidebar__brand { padding: 0 0 12px; }
  .sidebar__brand > div, .sidebar__nav a span, .sidebar__user > div { display: none; }
  .sidebar__nav a { justify-content: center; padding: 12px; }
  .sidebar__user { flex-direction: column; padding-inline: 0; }
  .sidebar__user .btn { font-size: .72rem; padding: 6px; }
  .content { padding: 20px 20px 40px; }
}
/* phone: top bar + bottom nav */
@media (max-width: 699px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; padding: 10px 16px; background: #0f2a27; color: #fff; }
  .topbar .brand__mark { width: 32px; height: 32px; font-size: .8rem; background: #1d7a70; }
  .topbar__title { flex: 1; font-size: 1rem; }
  .topbar__logout { color: #c2d6d1; font-size: .85rem; text-decoration: none; }
  .content { padding: 16px 16px 96px; }
  .page-head h1 { font-size: 1.4rem; }
  .bottomnav { display: flex; position: fixed; inset: auto 0 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottomnav a { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 4px 2px; color: var(--muted); text-decoration: none; font-size: .64rem; font-weight: 700; border-radius: 8px; }
  .bottomnav a.is-active { color: var(--brand); background: var(--brand-soft); }
}

/* ---------- KPIs ------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.kpi span { display: block; font-size: .78rem; color: var(--muted); font-weight: 600; }
.kpi strong { display: block; font-size: 1.55rem; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); font-size: .78rem; }
.kpi--brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.kpi--brand span, .kpi--brand small { color: #cfe7e2; }

/* ---------- Board (doctor dashboard / staff list) --------------------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .date-nav { display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 3px; }
.toolbar .date-nav input { border: 0; min-height: 36px; width: 150px; padding: 4px 8px; }
.toolbar .search { flex: 1; min-width: 180px; max-width: 320px; }
.toolbar .search input { min-height: 42px; }

.tabs { display: none; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.tabs button { flex: 1 0 auto; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 14px; border-radius: 11px; border: 1.5px solid var(--line); background: var(--surface); font: 700 .9rem var(--font); cursor: pointer; color: var(--ink-2); }
.tabs button .count { background: var(--surface-2); border-radius: 999px; padding: 1px 8px; font-size: .78rem; }
.tabs button.is-active { border-color: var(--c); color: var(--c); background: color-mix(in srgb, var(--c) 7%, #fff); }
.tabs button .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }

.board { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 16px; align-items: start; }
.lane { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lane__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 13px 14px; background: var(--surface); border-bottom: 1px solid var(--line); border-top: 4px solid var(--c); }
.lane__head h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.lane__stats { display: flex; gap: 6px; flex-wrap: wrap; font-size: .75rem; }
.lane__stats span { padding: 2px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 700; color: var(--ink-2); }
.lane__body { padding: 10px; display: grid; gap: 10px; max-height: calc(100vh - 290px); overflow-y: auto; }
.lane__off { padding: 10px 12px; margin: 10px 10px 0; }
.lane__daylabel { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; padding: 6px 4px 0; }
@media (max-width: 1099px) {
  .tabs { display: flex; }
  .board { grid-template-columns: 1fr; }
  .board .lane:not(.is-active) { display: none; }
  .lane__body { max-height: none; }
}

.appt { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 8px; }
.appt.is-done { opacity: .72; }
.appt.is-noshow { border-color: #f3c3be; }
.appt__top { display: flex; gap: 12px; align-items: flex-start; }
.appt__token { flex: none; min-width: 54px; text-align: center; padding: 6px 6px 5px; border-radius: 10px; background: color-mix(in srgb, var(--c, var(--brand)) 10%, #fff); color: var(--c, var(--brand)); font: 700 1.05rem/1 var(--font); font-variant-numeric: tabular-nums; }
.appt__token small { display: block; font-size: .64rem; font-weight: 700; margin-top: 3px; color: var(--muted); }
.appt__who { flex: 1; min-width: 0; }
.appt__who strong { display: block; font-size: .98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appt__who .meta { color: var(--muted); font-size: .82rem; }
.appt__actions { display: flex; flex-wrap: wrap; gap: 6px; }
.appt__actions .btn { flex: 1 1 auto; }
.appt__note { font-size: .8rem; color: var(--warn); font-weight: 600; }
.appt__fee { font-weight: 700; color: var(--ok); font-size: .88rem; }

/* ---------- Modal ------------------------------------------------------ */
dialog.modal { border: 0; padding: 0; border-radius: 18px; width: min(520px, calc(100% - 24px)); box-shadow: var(--shadow-lg); color: var(--ink); }
dialog.modal::backdrop { background: rgba(10, 25, 23, .45); backdrop-filter: blur(2px); }
.modal__head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal__head h3 { margin: 0; }
.modal__body { padding: 18px 20px; max-height: 70vh; overflow-y: auto; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
@media (max-width: 699px) {
  dialog.modal { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 18px 18px 0 0; }
}

/* ---------- Layout helpers -------------------------------------------- */
.cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
.cols--even { grid-template-columns: 1fr 1fr; }
.cols--side { grid-template-columns: 380px 1fr; }
@media (max-width: 1099px) { .cols, .cols--even, .cols--side { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* staff big serial */
.serial-banner { display: flex; align-items: center; gap: 18px; padding: 18px; border-radius: 14px; background: var(--brand); color: #fff; margin-bottom: 14px; }
.serial-banner .big { font: 600 3rem/1 var(--serif); }
.serial-banner small { color: #cfe7e2; display: block; }

/* medication rows */
.med-row { display: grid; grid-template-columns: 2fr .8fr auto; gap: 8px; margin-bottom: 8px; }
.med-row input[type="text"] { min-height: 40px; }
.med-row input[type="hidden"] { display: none; }
@media (max-width: 699px) { .med-row { grid-template-columns: 1fr .5fr auto; } }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--c, var(--brand)); border: 2px solid var(--surface); }
.timeline li:last-child { border-color: transparent; }
.rx { margin: 6px 0 0; padding-left: 18px; font-size: .9rem; }

/* earnings bars */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 190px; padding: 10px 0 0; border-bottom: 1px solid var(--line-2); }
.bars .bar { flex: 1; min-width: 4px; display: flex; flex-direction: column-reverse; border-radius: 4px 4px 0 0; overflow: hidden; background: var(--surface-2); position: relative; }
.bars .bar i { display: block; }
.bars .bar:hover { outline: 2px solid var(--ink-2); outline-offset: 1px; }
.bar-labels { display: flex; gap: 4px; margin-top: 6px; }
.bar-labels span { flex: 1; min-width: 4px; font-size: .66rem; color: var(--muted); text-align: center; overflow: hidden; white-space: nowrap; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.split { display: grid; gap: 8px; }
.split__row { display: grid; grid-template-columns: 120px 1fr 90px; gap: 10px; align-items: center; font-size: .9rem; }
.split__track { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.split__track i { display: block; height: 100%; border-radius: 99px; }

/* ---------- Print (prescription / visit summary) ---------------------- */
@media print {
  .sidebar, .topbar, .bottomnav, .no-print, .toast, .site-header, .site-footer { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; padding: 0; }
}

/* grid children must be allowed to shrink below their content width
   (otherwise the scrolling date strip / tables stretch the column on phones) */
.booker > *, .cols > *, .board > *, .hero__grid > *, .step, .card { min-width: 0; }
.cols > .card + .card, .cols > * + .card { margin-top: 0; }

/* footer login icons */
.footer-logins { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.icon-link { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line-2); color: var(--muted); background: var(--surface); transition: color .15s, border-color .15s, background .15s; }
.icon-link:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }

/* hourly slot ranges need wider buttons */
.slots { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
.slots button { min-height: 52px; font-size: .9rem; }
@media (max-width: 480px) { .slots { grid-template-columns: 1fr 1fr; gap: 6px; } .slots button { font-size: .74rem; white-space: nowrap; padding: 6px 2px; letter-spacing: -.01em; } }

/* v1.2: chamber dropdown detail + compact date chips */
.chamber-detail { border: 1.5px solid var(--c); background: color-mix(in srgb, var(--c) 6%, #fff); }
.date-strip button { flex: 0 0 auto; display: inline-flex; align-items: center; padding: 11px 16px; font: 700 .95rem var(--font); white-space: nowrap; }
.slots button { align-items: center; }

/* Settings → slot grid */
.sg th, .sg td { text-align: center; padding: 8px 4px; white-space: nowrap; }
.sg thead th { font-size: .66rem; letter-spacing: .02em; text-transform: none; }
.sg .sg-group { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; border-left: 1px solid var(--line); }
.sg .sg-h span { color: var(--muted); font-weight: 600; }
.sg tbody th { text-align: left; padding-left: 12px; font-size: .9rem; }
.sg-c label { position: relative; display: inline-grid; place-items: center; cursor: pointer; }
.sg-c input { position: absolute; inset: 0; opacity: 0; margin: 0; }
.sg-c span { width: 30px; height: 30px; border-radius: 8px; border: 1.5px solid var(--line-2); background: var(--surface); display: grid; place-items: center; transition: background .12s, border-color .12s; }
.sg-c input:checked + span { background: var(--brand); border-color: var(--brand); }
.sg-c input:checked + span::after { content: ""; width: 10px; height: 6px; border: 2.5px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.sg-c input:focus-visible + span { outline: 3px solid var(--brand-soft); }
.shell__main > .content { min-width: 0; }

/* Front desk appointment list */
.chdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.plist tr.is-off td { color: var(--muted); text-decoration: line-through; }
.plist tr.is-off td .chip { text-decoration: none; }
.print-head { display: none; }
@media print {
  .area-staff .cols, .area-doctor .cols { display: block; }
  #listCard { box-shadow: none; border: 0; padding: 0; }
  .print-head { display: block; margin-bottom: 12px; font-size: 14px; }
  .print-head div { font-size: 12px; color: #444; margin-top: 2px; }
  .plist { font-size: 11px; }
  .plist th, .plist td { border: 1px solid #999 !important; padding: 5px 7px !important; display: table-cell !important; }
  .plist thead { display: table-header-group !important; }
  .plist tr { display: table-row !important; }
  .plist td::before { display: none !important; }
  .plist a { color: inherit; text-decoration: none; }
  .table-wrap { overflow: visible; }
  @page { size: A4; margin: 12mm; }
}
.plist td, .plist th { white-space: nowrap; }
.area-staff .cols--side, #listCard:only-child { grid-template-columns: 330px minmax(0, 1fr); }
@media (max-width: 1099px) { .area-staff .cols--side { grid-template-columns: 1fr; } }
@media print {
  .plist .no-print, .plist th.no-print, .plist td.no-print { display: none !important; }
  .plist td, .plist th { white-space: normal; }
}
.plist.no-date th:nth-child(1), .plist.no-date td:nth-child(1),
.plist.no-ch th:nth-child(2), .plist.no-ch td:nth-child(2) { display: none !important; }

/* public footer: centered + credit line */
.site-footer { padding-bottom: 0; }
.site-footer__in { text-align: center; }
.site-footer__in .footer-logins { justify-content: center; }
.site-footer__in .muted { max-width: 640px; margin-inline: auto; }
.site-credit { margin-top: 22px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); text-align: center; font-size: .85rem; color: var(--muted); background: var(--surface-2); }
.site-credit a { color: var(--brand); font-weight: 600; text-decoration: none; }
.site-credit a:hover { text-decoration: underline; }
.appt__top { flex-wrap: wrap; } .appt__top > .chip { margin-left: auto; } .appt { overflow: hidden; }

/* Settings → sitting hours (time blocks) */
.daypick { display: flex; flex-wrap: wrap; gap: 6px; }
.daypick label { position: relative; cursor: pointer; }
.daypick input { position: absolute; inset: 0; opacity: 0; margin: 0; }
.daypick span { display: inline-block; padding: 8px 12px; border-radius: 9px; border: 1.5px solid var(--line-2); font-weight: 600; font-size: .88rem; background: var(--surface); }
.daypick input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.daypick input:focus-visible + span { outline: 3px solid var(--brand-soft); }
.weekblocks th { width: 64px; background: none; font-size: .88rem; text-transform: none; letter-spacing: 0; color: var(--ink-2); vertical-align: middle; }
.weekblocks td { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.blockchip { display: inline-flex; align-items: center; gap: 2px; padding: 3px 4px 3px 12px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: .88rem; }
.blockchip .btn { min-height: 28px; min-width: 28px; color: var(--brand); }

/* single-font polish */
.brand__mark { font-family: var(--font); font-weight: 700; }
.ticket__serial { font-family: var(--font); font-weight: 700; letter-spacing: -.01em; }
.serial-banner .big { font-family: var(--font); font-weight: 700; }
.fact strong { font-family: var(--font); font-weight: 700; }
.slots { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }

/* Doctor dashboard: list view */
.ch-select { width: auto; min-height: 42px; font-weight: 700; }
.alist td { vertical-align: middle; }
/* Board cards — each date+chamber is a rounded card */
.board-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.board-card__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-top: 3px solid var(--c); background: color-mix(in srgb, var(--c) 8%, #fff); }
.board-card__head strong { color: var(--c); font-size: 1.02rem; margin-right: 8px; }
.board-card .table { margin: 0; }
.board-card .table thead th { background: var(--surface); }
.grp-note { font-size: .82rem; color: var(--muted); font-weight: 600; }
.grp-note--off { color: var(--danger); }
.grp-right { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.grp-count { background: var(--danger, #dc2626); color: #fff; border: none; border-radius: 999px; min-width: 26px; height: 26px; line-height: 26px; text-align: center; padding: 0 7px; font-size: .82rem; font-weight: 700; display: inline-block; }
.grp-pdf { font-size: .75rem; padding: .25em .6em; border: 1px solid var(--line-2); border-radius: 6px; text-decoration: none; font-weight: 700; }
.alist .tok { display: inline-block; min-width: 48px; text-align: center; padding: 4px 8px; border-radius: 8px; font-weight: 700; color: var(--c); background: color-mix(in srgb, var(--c) 10%, #fff); white-space: nowrap; }
.alist .pname { color: var(--ink); font-weight: 700; text-decoration: none; }
.alist .pname:hover { text-decoration: underline; }
.alist .acts { text-align: right; white-space: nowrap; }
.alist .acts .btn { margin: 2px 0 2px 4px; }
.alist tr.is-done td { opacity: .7; }
.alist tr.is-noshow td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.alist .appt__note { margin-top: 2px; }
/* WhatsApp icon button */
.btn--wa { background: #25D366; color: #fff; border-color: #25D366; padding: .35em .5em; }
.btn--wa:hover { background: #1da851; border-color: #1da851; }
.btn--wa svg { display: block; }
@media (max-width: 699px) {
  .board-card__head { flex-wrap: wrap; }
  .alist .acts { text-align: left; white-space: normal; }
  .alist .acts .btn { margin: 4px 4px 0 0; }
  .alist td.acts::before { display: none; }
}
.alist th, .alist td { padding-left: 10px; padding-right: 10px; }
.alist .acts { white-space: nowrap; min-width: 0; }
.alist .acts .btn { min-height: 32px; padding: .35em .65em; font-size: .8rem; }
@media (min-width: 1100px) and (max-width: 1400px) { .alist td[data-label="Booked by"], .alist th:nth-child(6) { display: none; } }

/* Calendar-tile date picker (public) — overrides base .date-strip scroll */
.date-strip { gap: 8px; padding-bottom: 14px; align-items: center; overflow-x: visible; overflow: visible; scroll-snap-type: none; flex-wrap: wrap; }
/* Before select: white bg, thick teal border, month gray top, date black middle, day gray bottom */
.date-strip button.cal { flex: 0 0 auto; display: block; padding: 0; width: 76px; border: 3px solid var(--brand, #0f5c55); border-radius: 14px; background: #fff; overflow: hidden; text-align: center; line-height: 1; cursor: pointer; transition: border-color .2s, background .2s, box-shadow .2s; }
.cal__m { display: block; font-size: .82rem; font-weight: 700; color: #888; letter-spacing: .06em; padding: 10px 0 2px; text-transform: uppercase; }
.cal__d { display: block; font-size: 2rem; font-weight: 800; color: #111; padding: 4px 0 4px; font-variant-numeric: tabular-nums; }
.cal__w { display: block; font-size: .78rem; font-weight: 700; color: #888; padding-bottom: 10px; text-transform: uppercase; letter-spacing: .05em; }
.date-strip button.cal:hover { background: var(--brand-soft, #e3f1ee); }
/* After select: deep teal bg, ALL text white */
.date-strip button.cal.is-sel { border-color: var(--brand, #0f5c55); background: var(--brand, #0f5c55); }
.date-strip button.cal.is-sel .cal__m { color: #fff; }
.date-strip button.cal.is-sel .cal__d { color: #fff; }
.date-strip button.cal.is-sel .cal__w { color: #fff; }
@media (max-width: 480px) { .date-strip button.cal { width: 66px; } .cal__d { font-size: 1.7rem; } }

/* sticky "Book your visit with …" strap */
.site-strap { background: var(--brand); color: #fff; font-size: .95rem; padding: 7px 0; }
.site-strap strong { font-weight: 700; }
@media (max-width: 699px) { .site-strap { font-size: .88rem; } .site-header__in { min-height: 56px; } }

/* emergency time blocks */
.sched-list li.is-emg { color: var(--danger, #c0392b); }
.sched-list li.is-emg small { font-size: .7rem; font-weight: 700; margin-left: 4px; }
.blockchip.is-emg { background: var(--danger-soft); color: var(--danger); }
.blockchip.is-emg .btn { color: var(--danger); }
.slots button.is-emg { border-color: #f3c3be; color: var(--danger); }
.slots button.is-emg small { display: block; font-size: .7rem; font-weight: 700; color: var(--danger); }
.slots button.is-emg.is-sel { background: var(--danger); border-color: var(--danger); color: #fff; }
.slots button.is-emg.is-sel small { color: #fde3e0; }
.btn--emg { --b: var(--danger); --c: #fff; --l: var(--danger); }
.btn--emg:hover { --b: #98160d; border-color: #98160d; }
