/* Elite Star patient portal — mobile first. Plus Jakarta Sans, light + dark. */
:root {
  --primary: #1a8fd6; --primary-press: #1478b5; --deep: #0f5f8f; --pale: #f0f6fe;
  --bg: #ffffff; --surface: #ffffff; --surface-2: #f7fafd; --text: #142231; --muted: #5a6b7c; --line: #e1e9f2;
  --amber: #a15c00; --amber-bg: #fff3df; --blue: #0f5f8f; --blue-bg: #e4f2fc; --green: #19774a; --green-bg: #e3f5eb; --red: #b42318; --red-bg: #fdecea;
  --radius: 16px; --radius-sm: 14px; --radius-lg: 18px; --shadow: 0 8px 28px rgba(15, 95, 143, .08);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--text); background: var(--bg); }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: clamp(24px, 4vw, 30px); font-weight: 800; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0; }
a { color: var(--deep); font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.boot { min-height: 100vh; display: flex; align-items: center; justify-content: center; color: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 20px; border-radius: var(--radius-sm);
  font: inherit; font-weight: 700; font-size: 15.5px; border: 1px solid transparent; cursor: pointer; text-decoration: none; text-align: center; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-press); }
.btn-primary:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }
.btn-outline { background: var(--surface); color: var(--deep); border-color: var(--line); }
.btn-outline:hover { border-color: var(--primary); }
.btn-wa { background: #1fa855; color: #fff; }
.btn-wa:hover { background: #178a45; }
.btn-danger { background: var(--red); color: #fff; }
.btn-text { background: none; border: 0; color: var(--deep); padding: 10px 8px; min-height: 44px; }
.btn-sm { min-height: 44px; padding: 8px 14px; font-size: 14.5px; }
.btn-block { width: 100%; }

/* Forms */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > label, .label { font-size: 14px; font-weight: 700; }
input, select, textarea { font: inherit; font-size: 16px; color: var(--text); background: var(--pale); border: 1px solid var(--line); border-radius: var(--radius-sm);
  min-height: 48px; padding: 12px 14px; width: 100%; }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
[aria-invalid="true"] { border-color: var(--red) !important; }
.err { color: var(--red); font-size: 13.5px; font-weight: 600; min-height: 0; }
.hint { color: var(--muted); font-size: 13.5px; }
.group { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr); gap: 8px; }
.pw { position: relative; }
.pw input { padding-inline-end: 52px; }
.pw button { position: absolute; inset-block: 0; inset-inline-end: 2px; width: 48px; background: none; border: 0; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.pw svg { width: 22px; height: 22px; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14.5px; cursor: pointer; }
.check input { width: 22px; height: 22px; min-height: 0; flex: none; margin-top: 1px; accent-color: var(--primary); }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--pale); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 18px; }
.seg label { position: relative; display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 11px; font-weight: 700; cursor: pointer; color: var(--muted); }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg label:has(input:checked) { background: var(--surface); color: var(--deep); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.seg label:has(input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 1px; }
.alert { border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14.5px; font-weight: 600; margin-bottom: 16px; }
.alert-error { background: var(--red-bg); color: var(--red); }
.alert-info { background: var(--blue-bg); color: var(--blue); }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
.brand-panel { display: none; }
.auth-main { width: 100%; max-width: 460px; margin: 0 auto; padding: 28px 20px 40px; }
.auth-logo { display: inline-block; background: #fff; border-radius: 14px; padding: 8px 12px; margin-bottom: 20px; }
.auth-logo img { height: 40px; width: auto; display: block; }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab { background: none; border: 0; font: inherit; font-weight: 700; font-size: 17px; color: var(--muted); padding: 12px 2px; min-height: 48px; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab[aria-selected="true"] { color: var(--deep); border-bottom-color: var(--deep); }
.subtitle { color: var(--muted); margin: -6px 0 18px; }
.otp-input { font-size: 26px; letter-spacing: .5em; text-align: center; font-weight: 800; padding-inline-start: calc(14px + .5em); }
.demo-code { background: var(--amber-bg); color: var(--amber); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; margin-bottom: 16px; }
.demo-code strong { font-size: 18px; letter-spacing: .15em; }
@media (min-width: 900px) {
  .auth { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .brand-panel { display: flex; flex-direction: column; justify-content: flex-end; position: relative; overflow: hidden; min-height: 100vh; position: sticky; top: 0; height: 100vh; padding: 56px; color: #fff; background: var(--deep); }
  .brand-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 62% 30%; }
  .brand-panel::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8, 26, 50, 0) 35%, rgba(8, 26, 50, .55) 60%, rgba(8, 26, 50, .92) 100%); }
  .brand-copy { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 14px; }
  .brand-panel .brand-logo { position: absolute; z-index: 1; top: 40px; left: 56px; padding: 14px 20px; border-radius: 18px; margin: 0; box-shadow: 0 8px 24px rgba(8, 26, 50, .18); }
  .brand-panel .brand-logo img { height: 84px; width: auto; }
  .btn-coord { align-self: flex-start; margin-top: 8px; background: #ffffff; color: #0f5f8f; border: 0; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
  .btn-coord:hover { background: #e9f4fc; }
  .btn-coord svg { width: 20px; height: 20px; }
  .brand-panel h1 { color: #fff; font-size: 40px; max-width: 440px; margin: 0; }
  .brand-panel p { color: #e3effa; max-width: 440px; font-size: 17px; margin: 0; }
  .auth-main { align-self: center; padding: 48px 32px; }
  .auth-main .auth-logo.mobile-only { display: none; }
}

/* ---------- App shell ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 10px 16px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; background: #fff; border-radius: 12px; padding: 4px 8px; }
.brand img { height: 34px; width: auto; display: block; }
.topnav { display: none; gap: 4px; margin-inline-start: 12px; }
.topnav a { text-decoration: none; color: var(--muted); padding: 10px 14px; border-radius: 12px; font-weight: 700; }
.topnav a[aria-current="page"] { color: var(--deep); background: var(--pale); }
.avatar-btn { margin-inline-start: auto; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--deep); color: #fff; font: inherit; font-weight: 800; cursor: pointer; }
.menu { position: absolute; inset-inline-end: 16px; top: 62px; width: min(300px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; z-index: 40; }
.menu-head { padding: 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head strong { display: block; }
.menu-head span { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 12px; background: none; border: 0;
  font: inherit; font-weight: 600; color: var(--text); text-decoration: none; cursor: pointer; text-align: start; }
.menu a:hover, .menu button:hover { background: var(--pale); }
.menu svg { width: 20px; height: 20px; color: var(--deep); }
.app-main { max-width: 1080px; margin: 0 auto; padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
.view-head { margin-bottom: 18px; display: grid; gap: 4px; }
.tabbar { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 64px; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 700; }
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--deep); }
@media (min-width: 900px) {
  .topnav { display: flex; }
  .tabbar { display: none; }
  .app-main { padding: 32px 24px 64px; }
}

/* Cards & lists */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; }
.stack { display: grid; gap: 12px; }
.counts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.count-pill { background: var(--pale); color: var(--deep); border-radius: 999px; padding: 6px 12px; font-size: 14px; font-weight: 700; }
.next-card { background: linear-gradient(135deg, var(--deep), var(--primary)); color: #fff; border: 0; border-radius: var(--radius-lg); padding: 20px; display: grid; gap: 14px; }
.next-card .eyebrow { font-size: 13px; font-weight: 700; opacity: .9; text-transform: uppercase; letter-spacing: .06em; }
.next-card h2 { color: #fff; font-size: 21px; }
.next-card dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin: 0; }
.next-card dt { font-size: 12.5px; opacity: .85; }
.next-card dd { margin: 0; font-weight: 700; }
.next-card .btn-outline { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.5); }
.next-card .btn-primary { background: #fff; color: #0f5f8f; }
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; }
.next-card .chip { background: rgba(255,255,255,.18); color: #fff; }
.actions-row { display: flex; gap: 10px; flex-wrap: wrap; }
.quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.quick a { display: grid; gap: 8px; justify-items: start; padding: 16px; border-radius: var(--radius); background: var(--pale); color: var(--text); text-decoration: none; border: 1px solid var(--line); min-height: 110px; }
.quick a:hover { border-color: var(--primary); }
.quick .ico { width: 42px; height: 42px; border-radius: 12px; background: var(--surface); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.quick .ico svg { width: 22px; height: 22px; }
.quick strong { font-size: 14.5px; line-height: 1.3; }
.section { margin-top: 26px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.help { background: var(--pale); border-radius: var(--radius-lg); padding: 18px; display: grid; gap: 12px; }
.empty { text-align: center; padding: 28px 16px; border: 1px dashed var(--line); border-radius: var(--radius-lg); display: grid; gap: 10px; justify-items: center; }
.empty svg { width: 44px; height: 44px; color: var(--primary); }
@media (max-width: 420px) { .quick { grid-template-columns: 1fr; } .quick a { grid-template-columns: auto 1fr; align-items: center; min-height: 64px; } }
@media (min-width: 900px) { .home-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 24px; align-items: start; } .home-grid .section:first-child { margin-top: 0; } }

/* Status chips + progress */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-pending { background: var(--amber-bg); color: var(--amber); }
.st-confirmed, .st-in_review { background: var(--blue-bg); color: var(--blue); }
.st-completed, .st-opinion_sent { background: var(--green-bg); color: var(--green); }
.st-cancelled { background: var(--red-bg); color: var(--red); }
.st-new { background: var(--amber-bg); color: var(--amber); }
.st-closed { background: var(--pale); color: var(--muted); }
.progress { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.progress span { display: grid; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.progress span::before { content: ""; height: 6px; border-radius: 3px; background: var(--line); }
.progress span.done::before { background: var(--primary); }
.progress span.done { color: var(--text); }
.progress.is-cancelled span.done::before { background: var(--red); }
.progress.is-complete span.done::before { background: var(--green); }

/* Appointment card */
.appt { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 14px; }
.date-block { background: var(--pale); color: var(--deep); border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px 4px; text-align: center; min-height: 88px; }
.date-block b { font-size: 28px; line-height: 1; font-weight: 800; }
.date-block span { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.appt-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.appt-meta { color: var(--muted); font-size: 14px; margin-top: 2px; }
.appt .actions-row { margin-top: 12px; }
.ref { font-size: 12.5px; color: var(--muted); font-weight: 600; }

/* Filter chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.fchip { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 8px 16px; min-height: 44px; font: inherit; font-weight: 700; font-size: 14.5px; cursor: pointer; }
.fchip[aria-pressed="true"] { background: var(--deep); color: #fff; border-color: var(--deep); }
.fchip b { margin-inline-start: 6px; opacity: .8; }

/* Booking */
.book-grid { display: grid; gap: 18px; }
.step { display: grid; gap: 12px; }
.step-title { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--deep); color: #fff; font-size: 14px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.types { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.type-card { position: relative; display: grid; gap: 6px; padding: 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); cursor: pointer; min-height: 96px; }
.type-card input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.type-card svg { width: 26px; height: 26px; color: var(--primary); }
.type-card strong { font-size: 15px; }
.type-card span { font-size: 13px; color: var(--muted); }
.type-card:has(input:checked) { border: 2px solid var(--primary); background: var(--pale); padding: 13px; }
.type-card:has(input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 2px; }
.two { display: grid; gap: 12px; }
.dates { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x proximity; }
.date-btn { flex: none; width: 70px; min-height: 78px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; scroll-snap-align: start; }
.date-btn small { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.date-btn b { font-size: 20px; }
.date-btn[aria-pressed="true"] { background: var(--deep); border-color: var(--deep); color: #fff; }
.date-btn[aria-pressed="true"] small { color: #d7ebfa; }
.date-btn:disabled { opacity: .45; cursor: not-allowed; background: var(--surface-2); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.slot { min-height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; font-size: 14.5px; cursor: pointer; }
.slot:hover:not(:disabled) { border-color: var(--primary); }
.slot[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.slot:disabled { text-decoration: line-through; color: var(--muted); background: var(--surface-2); cursor: not-allowed; opacity: .7; }
.summary { background: var(--pale); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; display: grid; gap: 12px; }
.summary dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; margin: 0; font-size: 14.5px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
@media (min-width: 600px) { .types { grid-template-columns: repeat(4, minmax(0, 1fr)); } .two { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .book-grid { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; } .summary { position: sticky; top: 84px; } }

/* Case review */
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px 16px; text-align: center; background: var(--pale); display: grid; gap: 8px; justify-items: center; }
.drop.is-over { border-color: var(--primary); }
.drop svg { width: 32px; height: 32px; color: var(--primary); }
.files { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.files li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.files .fn { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; font-size: 14.5px; }
.files .fs { color: var(--muted); font-size: 13px; white-space: nowrap; }
.case-grid { display: grid; gap: 22px; }
@media (min-width: 900px) { .case-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; } }

/* Dialog + toast */
.backdrop { position: fixed; inset: 0; background: rgba(6, 20, 33, .55); z-index: 50; display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
.dialog { width: 100%; max-width: 420px; background: var(--surface); border-radius: var(--radius-lg); padding: 22px; display: grid; gap: 14px; box-shadow: var(--shadow); }
@media (min-width: 600px) { .backdrop { align-items: center; } }
.toast { position: fixed; z-index: 60; inset-inline: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); margin: 0 auto; max-width: 420px; background: #0f2233; color: #fff;
  border-radius: 14px; padding: 14px 16px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
@media (min-width: 900px) { .toast { bottom: 24px; } }
@media (prefers-reduced-motion: no-preference) { .toast:not([hidden]) { animation: toast-in .2s ease-out; } @keyframes toast-in { from { transform: translateY(10px); opacity: 0; } } }

/* ---------- Sign-in page: always white form + help block ---------- */
.auth { background: #ffffff; }
.auth-main {
  color-scheme: light;
  --bg: #ffffff; --surface: #ffffff; --surface-2: #f7fafd; --text: #142231; --muted: #5a6b7c; --line: #e1e9f2; --pale: #f0f6fe;
  --deep: #0f5f8f; --amber: #a15c00; --amber-bg: #fff3df; --blue: #0f5f8f; --blue-bg: #e4f2fc; --green: #19774a; --green-bg: #e3f5eb;
  --red: #b42318; --red-bg: #fdecea; --shadow: 0 8px 28px rgba(15, 95, 143, .08);
  --primary: #1a8fd6; --primary-press: #1478b5;
  background: #ffffff; color: var(--text);
}
.auth-extra { margin-top: 22px; }
.or-line { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn-ai { background: var(--surface); color: var(--deep); border: 1.5px solid var(--deep); }
.btn-ai:hover { background: var(--pale); }
.btn-ai svg { width: 20px; height: 20px; }
.auth-address { display: flex; gap: 12px; align-items: flex-start; font-style: normal; color: var(--muted); font-size: 14.5px; line-height: 1.55;
  margin-top: 22px; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.auth-address svg { width: 20px; height: 20px; flex: none; color: var(--deep); margin-top: 2px; }
.auth-address strong { color: var(--text); }
/* The Ask AI button replaces the floating chat launcher on the sign-in screen */
body:has(#auth:not([hidden])) .esc-launcher { display: none; }

/* =====================================================================
   Corporate theme for the signed-in portal: white, brand navy, sidebar
   ===================================================================== */
#app, .backdrop, .toast {
  --primary: #14287a; --primary-press: #0c1a52; --deep: #14287a; --sky: #0e8fd6;
  --pale: #f3f6fb; --surface-2: #f7f9fc; --line: #e3e8f0; --text: #1c2433; --muted: #5b6778;
  --blue: #14287a; --blue-bg: #e9eefb;
  --radius: 10px; --radius-sm: 8px; --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
}
#app { background: #ffffff; min-height: 100vh; }
#app h1 { font-size: clamp(22px, 3vw, 28px); font-weight: 800; color: #101a33; letter-spacing: -.015em; }
#app h2 { font-size: 17px; color: #101a33; }
.section-head a, .app-main p a, .app-main .hint a, .app-main label a { color: var(--sky); }

/* Buttons and fields: quieter, squarer */
#app .btn { border-radius: var(--radius-sm); min-height: 44px; font-size: 15px; padding: 10px 18px; }
#app .btn-primary { background: var(--primary); color: #fff; }
#app .btn-primary:hover { background: var(--primary-press); }
#app .btn-outline { background: #fff; color: var(--primary); border-color: #cfd7e4; }
#app .btn-outline:hover { border-color: var(--primary); background: var(--pale); }
#app .btn-text { color: var(--primary); }
#app input, #app select, #app textarea { background: #fff; border-color: #cfd7e4; border-radius: var(--radius-sm); min-height: 44px; }
#app textarea { min-height: 110px; }
#app input:focus, #app select:focus, #app textarea:focus { outline: 3px solid rgba(14, 143, 214, .25); border-color: var(--sky); }

/* Top bar */
.topbar { background: #fff; border-bottom: 1px solid var(--line); box-shadow: none; }
.topbar-in { max-width: none; min-height: 64px; padding: 8px 20px; }
.brand { padding: 0; border-radius: 0; }
.brand img { height: 36px; }
.top-title { font-weight: 700; color: #101a33; font-size: 15px; padding-inline-start: 14px; border-inline-start: 1px solid var(--line); }
.avatar-btn { width: auto; height: 44px; border-radius: 999px; padding: 4px 6px; background: transparent; color: #101a33; display: inline-flex; align-items: center; gap: 10px; border: 1px solid transparent; }
.avatar-btn:hover { border-color: var(--line); background: var(--pale); }
.av-initials { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; }
.av-name { display: none; font-weight: 700; font-size: 14.5px; padding-inline-end: 8px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { border-radius: var(--radius); top: 60px; box-shadow: 0 12px 32px rgba(16, 24, 40, .14); }
.menu a, .menu button { border-radius: var(--radius-sm); color: var(--text); }
.menu svg { color: var(--primary); }

/* Page header with breadcrumb */
.view-head { margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--line); gap: 6px; }
.crumb { display: flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 600; color: var(--muted); }
.crumb span:last-child { color: var(--primary); }
.counts { margin-top: 10px; }
.count-pill { background: #fff; color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; font-size: 13.5px; }

/* Cards */
#app .card, .appt-card, .stack > article { box-shadow: var(--shadow); }
#app .card { border-radius: var(--radius-lg); }
.next-card { background: #14287a; background-image: linear-gradient(120deg, #14287a 0%, #1b3a9e 100%); border-radius: var(--radius-lg); box-shadow: 0 8px 24px rgba(20, 40, 122, .18); }
.next-card .eyebrow { letter-spacing: .04em; font-size: 12px; opacity: .8; }
#app .next-card h2 { color: #fff; }
#app .next-card .btn-primary { background: #fff; color: #14287a; }
#app .next-card .btn-primary:hover { background: #e9eefb; }
#app .next-card .btn-outline { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .45); }
#app .next-card .btn-outline:hover { background: rgba(255, 255, 255, .1); }
#app .quick a { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); }
.quick a:hover { border-color: var(--sky); }
.quick .ico { background: var(--blue-bg); color: var(--primary); border-radius: 8px; }
.help { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.section-head h2 { font-size: 16px; }
.section-head a { font-size: 14px; }
.date-block { background: var(--blue-bg); color: var(--primary); border-radius: var(--radius); }
.empty { border-radius: var(--radius-lg); background: var(--surface-2); }
.empty svg { color: var(--sky); }

/* Status chips */
.chip { border-radius: 6px; font-weight: 700; }
.progress span.done::before { background: var(--sky); }

/* Appointment filter: tabs with an underline */
.chips { gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 18px; padding-bottom: 0; }
.fchip { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 10px 16px; margin-bottom: -1px; color: var(--muted); }
.fchip:hover { color: var(--primary); }
.fchip[aria-pressed="true"] { background: transparent; color: var(--primary); border-bottom-color: var(--primary); }
.fchip b { background: var(--pale); border-radius: 999px; padding: 1px 8px; font-size: 12.5px; opacity: 1; }
.fchip[aria-pressed="true"] b { background: var(--blue-bg); }

/* Booking */
.step-num { background: var(--primary); border-radius: 6px; }
.type-card { border-radius: var(--radius); box-shadow: var(--shadow); }
.type-card svg { color: var(--primary); }
.type-card:has(input:checked) { border-color: var(--primary); background: var(--blue-bg); }
.date-btn { border-radius: var(--radius-sm); }
.date-btn[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); }
.slot { border-radius: var(--radius-sm); }
.slot:hover:not(:disabled) { border-color: var(--sky); }
.slot[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); }
.summary { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow); border-top: 4px solid var(--primary); }

/* Case review */
.drop { background: var(--surface-2); border-color: #cfd7e4; border-radius: var(--radius); }
.drop svg { color: var(--sky); }
.files li { border-radius: var(--radius-sm); }

/* Dialog + toast */
.dialog { border-radius: var(--radius-lg); }
.toast { background: #101a33; border-radius: var(--radius-sm); }

/* Sidebar parts are only used on wide screens */
.tabbar .side-brand, .tabbar .side-label, .tabbar .side-help { display: none; }

/* Phones and tablets: white bottom tab bar */
.tabbar { background: #fff; box-shadow: 0 -1px 0 var(--line); }
.tabbar a[aria-current="page"] { color: var(--primary); }

/* Wide screens: left sidebar navigation */
@media (min-width: 1000px) {
  .tabbar { display: flex; flex-direction: column; gap: 2px; position: fixed; inset-block: 0; inset-inline-start: 0; inset-inline-end: auto; bottom: 0;
    width: 248px; padding: 20px 14px; background: #fff; border-top: 0; border-inline-end: 1px solid var(--line); box-shadow: none; z-index: 35; }
  .tabbar .side-brand { display: block; min-height: 0; padding: 4px 10px 18px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
  .side-brand img { height: 52px; width: auto; display: block; }
  .tabbar .side-label { display: block; margin: 12px 12px 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
  .tabbar a[data-nav] { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 44px; padding: 10px 12px; border-radius: var(--radius-sm);
    font-size: 15px; font-weight: 600; color: #3b4659; position: relative; }
  .tabbar a[data-nav] svg { width: 20px; height: 20px; color: var(--muted); }
  .tabbar a[data-nav]:hover { background: var(--pale); color: var(--primary); }
  .tabbar a[data-nav][aria-current="page"] { background: var(--blue-bg); color: var(--primary); font-weight: 700; }
  .tabbar a[data-nav][aria-current="page"] svg { color: var(--primary); }
  .tabbar a[data-nav][aria-current="page"]::before { content: ""; position: absolute; inset-block: 8px; inset-inline-start: -14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
  .tabbar .side-help { display: grid; gap: 4px; margin-top: auto; padding: 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
  .side-help strong { color: #101a33; font-size: 14.5px; }
  .tabbar .side-help a { display: inline; min-height: 0; padding: 0; font-size: 14px; font-weight: 700; color: var(--sky); text-decoration: none; }
  .tabbar .side-help a:hover { text-decoration: underline; }
  .side-help { margin-bottom: 76px; } /* room for the chat button below */
  .topbar, .app-main { margin-inline-start: 248px; }
  .topbar .brand, .topnav { display: none; }
  .top-title { padding-inline-start: 0; border: 0; font-size: 16px; }
  .av-name { display: inline; }
  .app-main { max-width: 1180px; padding: 28px 36px 64px; }
}

/* Booking: messages inside the time grid use the full width */
.slots > :not(button) { grid-column: 1 / -1; }
legend.step-title { font-weight: 700; color: #101a33; }
/* Phones and tablets: keep the chat button above the bottom tab bar */
@media (max-width: 999px) {
  body:has(#app:not([hidden])) .esc-launcher { inset-block-end: calc(80px + env(safe-area-inset-bottom)); inset-inline-start: auto; inset-inline-end: 16px; }
}
