:root {
  --primary: #1D5FA8;
  --primary-dark: #164A84;
  --primary-soft: #E8F0FA;
  --surface: #FFFFFF;
  --bg: #F6F8FB;
  --text: #1E293B;
  --muted: #64748B;
  --line: #E2E8F0;
  --line-soft: #F1F5F9;
  --danger: #DC2626;
  --success: #16A34A;
  --warn: #D97706;
  --font-h: "DM Sans", system-ui, sans-serif;
  --font-b: "Source Sans 3", system-ui, sans-serif;
  --slot: 22px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font-b); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; font-size: 15px; }
h1, h2, h3, h4 { font-family: var(--font-h); margin: 0; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--text); }
a { color: var(--primary); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "JetBrains Mono", Menlo, monospace; font-size: 13px; }
.small { font-size: 12px; }

/* ---------- layout ---------- */
.shell { min-height: 100vh; display: flex; }
.sidebar { width: 248px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { padding: 20px 22px; border-bottom: 1px solid var(--line-soft); }
.brand h1 { font-size: 17px; color: var(--primary); line-height: 1.2; }
.brand p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.nav { flex: 1; padding: 14px; display: flex; flex-direction: column; gap: 3px; }
.nav button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 12px; border: 0; background: none; border-radius: 9px; color: var(--muted); font-weight: 500; font-size: 14px; text-align: left; }
.nav button:hover { background: var(--line-soft); color: var(--text); }
.nav button.active { background: var(--primary-soft); color: var(--primary); }
.nav svg { width: 19px; height: 19px; }
.side-foot { padding: 14px; border-top: 1px solid var(--line-soft); }
.me { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; color: #fff; flex-shrink: 0; }
.me b { display: block; font-size: 14px; }
.me span { font-size: 12px; color: var(--muted); }
.foot-btns { display: flex; gap: 6px; }
.foot-btns button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 7px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; color: var(--muted); font-size: 12px; }
.foot-btns button:hover { color: var(--text); background: var(--line-soft); }
.foot-btns svg { width: 14px; height: 14px; }
.main { flex: 1; min-width: 0; padding-bottom: 40px; }
.demo-banner { background: #FEF3C7; color: #92400E; font-size: 12.5px; padding: 6px 20px; border-bottom: 1px solid #FDE68A; text-align: center; }
.page { padding: 24px 28px; max-width: 1400px; margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h2 { font-size: 22px; }
.page-head p { margin: 3px 0 0; color: var(--muted); font-size: 14px; }
.mobile-nav { display: none; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 500; font-size: 14px; white-space: nowrap; }
.btn:hover { background: var(--line-soft); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 7px 13px; font-size: 13.5px; color: var(--muted); font-weight: 500; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--primary-soft); color: var(--primary); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.input, .field input, .field select, .field textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.field textarea { min-height: 74px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.card-pad { padding: 18px; }
.card h3 { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card h3 svg { width: 17px; height: 17px; color: var(--primary); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line-soft); color: var(--muted); }
.pill.red { background: #FEE2E2; color: #B91C1C; }
.pill.green { background: #DCFCE7; color: #15803D; }
.pill.blue { background: var(--primary-soft); color: var(--primary); }
.pill.amber { background: #FEF3C7; color: #92400E; }
.pill.violet { background: #EDE9FE; color: #6D28D9; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.warn-box { background: #FEF2F2; border: 1px solid #FECACA; color: #991B1B; padding: 10px 12px; border-radius: 9px; font-size: 13.5px; }
svg.small { width: 16px; height: 16px; flex-shrink: 0; vertical-align: -3px; }
.warn-box svg { width: 16px; height: 16px; flex-shrink: 0; vertical-align: -3px; }
.info-box { background: var(--primary-soft); border: 1px solid #C7DAF2; color: var(--primary-dark); padding: 10px 12px; border-radius: 9px; font-size: 13.5px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(160deg, #E8F0FA 0%, #F6F8FB 60%); }
.login-card { width: 100%; max-width: 440px; padding: 30px; }
.login-card h1 { font-size: 24px; color: var(--primary); }
.login-list { display: flex; flex-direction: column; gap: 9px; margin-top: 20px; }
.login-list button { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); text-align: left; }
.login-list button:hover { border-color: var(--primary); background: var(--primary-soft); }
.login-list b { display: block; }
.login-list span { font-size: 13px; color: var(--muted); }

/* ---------- calendar ---------- */
.cal-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-toolbar h3 { font-size: 17px; min-width: 210px; }
.icon-btn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; color: var(--text); }
.icon-btn:hover { background: var(--line-soft); }
.icon-btn svg { width: 17px; height: 17px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.stat { padding: 12px 14px; }
.stat b { font-family: var(--font-h); font-size: 22px; display: block; }
.stat span { font-size: 12.5px; color: var(--muted); }
.cal-wrap { overflow-x: auto; }
.cal { display: grid; min-width: 720px; position: relative; }
.cal-head { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 10px; display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 14px; border-left: 1px solid var(--line-soft); }
.cal-head .sub { font-weight: 400; font-size: 12px; color: var(--muted); }
.cal-head.today { color: var(--primary); }
.cal-times { position: relative; }
.cal-time { height: calc(var(--slot) * 4); font-size: 11.5px; color: var(--muted); text-align: right; padding: 0 8px 0 0; transform: translateY(-7px); }
.cal-col { position: relative; border-left: 1px solid var(--line-soft); }
.cal-cell { height: var(--slot); border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.cal-cell.hour { border-bottom-color: var(--line); }
.cal-cell.off { background: repeating-linear-gradient(45deg, #F8FAFC, #F8FAFC 6px, #EEF2F6 6px, #EEF2F6 12px); cursor: not-allowed; }
.cal-cell:not(.off):hover { background: var(--primary-soft); }
.cal-cell.drop { background: #DBEAFE !important; }
.block-label { position: absolute; left: 4px; right: 4px; font-size: 11px; color: var(--muted); font-weight: 600; pointer-events: none; padding: 3px 6px; z-index: 1; text-transform: uppercase; letter-spacing: .03em; }
.appt { position: absolute; left: 4px; right: 4px; border-radius: 7px; padding: 3px 7px; font-size: 12px; overflow: hidden; cursor: pointer; z-index: 2; border-left: 4px solid; background: #fff; box-shadow: 0 1px 2px rgba(15,23,42,.08); line-height: 1.25; }
.appt:hover { box-shadow: 0 3px 10px rgba(15,23,42,.18); z-index: 4; }
.appt b { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.appt.completed { opacity: .62; }
.appt.cancelled, .appt.noshow { opacity: .45; text-decoration: line-through; }
.appt.arrived { box-shadow: 0 0 0 2px #22C55E inset, 0 1px 2px rgba(15,23,42,.08); }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 5; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }

/* ---------- patients ---------- */
.search { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); }
.search input { padding-left: 36px; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 11px 14px; border-bottom: 1px solid var(--line); background: #FAFBFD; }
table.list td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); font-size: 14px; vertical-align: middle; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover { background: #F8FAFF; }
.pname { display: flex; align-items: center; gap: 10px; }
.pname b { font-weight: 600; }
.initials { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; flex-shrink: 0; }
.cards-mobile { display: none; }

/* ---------- patient folder ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); background: none; border: 0; padding: 0; margin-bottom: 14px; font-size: 14px; }
.back:hover { color: var(--text); }
.back svg { width: 16px; height: 16px; }
.folder-head { padding: 20px 22px; display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.folder-head .initials { width: 58px; height: 58px; font-size: 20px; }
.folder-head h2 { font-size: 23px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 8px; font-size: 14px; color: var(--muted); }
.facts b { color: var(--text); font-weight: 600; }
.folder-grid { display: grid; grid-template-columns: 360px 1fr; gap: 16px; margin-top: 16px; align-items: start; }
.kv { display: grid; grid-template-columns: 128px 1fr; gap: 7px 10px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }
.aid-card { background: linear-gradient(135deg, #1D5FA8, #2B7BD3); color: #fff; border-radius: 13px; padding: 16px 18px; position: relative; overflow: hidden; }
.aid-card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: rgba(255,255,255,.09); }
.aid-card .scheme { font-family: var(--font-h); font-size: 18px; font-weight: 700; }
.aid-card .plan { opacity: .85; font-size: 13.5px; }
.aid-card .num { font-family: ui-monospace, Menlo, monospace; font-size: 17px; letter-spacing: .08em; margin: 14px 0 8px; }
.aid-card .meta { display: flex; justify-content: space-between; font-size: 12.5px; opacity: .9; gap: 10px; }
.aid-card.cash { background: linear-gradient(135deg, #475569, #64748B); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tl { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--line-soft); cursor: pointer; border-radius: 8px; }
.tl-item:hover { background: #F8FAFF; }
.tl-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tl-icon svg { width: 18px; height: 18px; }
.tl-item b { font-weight: 600; font-size: 14.5px; }
.tl-item p { margin: 2px 0 0; font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.appt-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.appt-row:last-child { border-bottom: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -4px -4px 12px; }
.tabs button { border: 0; background: none; padding: 9px 12px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; font-size: 14px; }
.tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }

/* FAB: a round + that turns into an X */
.fab-wrap { position: fixed; right: 26px; bottom: 26px; z-index: 40; display: flex; flex-direction: column; align-items: flex-end; }
.fab { width: 62px; height: 62px; border-radius: 50%; background: var(--primary); color: #fff; border: 0; box-shadow: 0 4px 20px rgba(29,95,168,.45); display: flex; align-items: center; justify-content: center; }
.fab:hover { background: var(--primary-dark); }
.fab svg { width: 28px; height: 28px; transition: transform .2s; }
.fab.open svg { transform: rotate(45deg); }
.fab-menu { margin-bottom: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 10px 30px rgba(15,23,42,.16); min-width: 270px; max-height: calc(100vh - 130px); overflow-y: auto; padding: 6px 0; }
.fab-menu button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 16px; border: 0; background: none; text-align: left; font-size: 14px; color: var(--text); }
.fab-menu button:hover { background: var(--line-soft); }
.fab-menu svg { width: 17px; height: 17px; color: var(--primary); flex-shrink: 0; }
.fab-menu .sep { height: 1px; background: var(--line-soft); margin: 5px 12px; }
.fab-menu .group { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 8px 16px 4px; }
.fab-menu .sub button { padding-left: 44px; font-size: 13.5px; }
.fab-menu .chev { margin-left: auto; transition: transform .15s; color: var(--muted) !important; }
.fab-menu .chev.open { transform: rotate(90deg); }

/* ---------- document editor / viewer ---------- */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.paper { background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 2px 12px rgba(15,23,42,.06); padding: 36px 40px; font-size: 14px; line-height: 1.5; color: #111827; }
.letterhead { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--primary); padding-bottom: 12px; margin-bottom: 20px; }
.letterhead h2 { font-size: 19px; color: var(--primary); }
.letterhead .lh-r { text-align: right; font-size: 12px; color: #475569; }
.letterhead .lh-l { font-size: 12px; color: #475569; }
.paper h3 { font-size: 16px; text-transform: uppercase; letter-spacing: .06em; margin: 6px 0 14px; text-align: center; }
.paper .pt-box { background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 6px; padding: 9px 12px; margin-bottom: 16px; font-size: 13px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 14px; }
.paper table { width: 100%; border-collapse: collapse; margin: 8px 0 14px; font-size: 13.5px; }
.paper th, .paper td { border-bottom: 1px solid #E5E7EB; padding: 7px 6px; text-align: left; vertical-align: top; }
.paper th { font-size: 11.5px; text-transform: uppercase; color: #6B7280; letter-spacing: .04em; }
.paper .rx { font-family: Georgia, serif; font-size: 28px; color: var(--primary); font-style: italic; }
.paper .sig { margin-top: 44px; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; font-size: 13px; }
.paper .sig .line { border-top: 1px solid #111827; padding-top: 4px; min-width: 220px; }
.paper .foot { margin-top: 30px; padding-top: 8px; border-top: 1px solid #E5E7EB; font-size: 11px; color: #6B7280; text-align: center; }
.paper .sec { margin-bottom: 12px; }
.paper .sec b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #475569; margin-bottom: 2px; }
.paper .vitals { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; margin-bottom: 12px; }
.med-row { display: grid; grid-template-columns: 2fr 2fr 70px 70px 34px; gap: 8px; align-items: end; }
.quick-meds { display: flex; flex-wrap: wrap; gap: 6px; }
.quick-meds button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; }
.quick-meds button:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- availability / services ---------- */
.av-table { width: 100%; border-collapse: collapse; }
.av-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px; text-transform: uppercase; letter-spacing: .04em; }
.av-table td { padding: 7px 8px; border-top: 1px solid var(--line-soft); }
.av-table input[type=time] { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; width: 112px; }
.av-table tr.off td:not(:first-child):not(:nth-child(2)) { opacity: .35; }
.switch { position: relative; width: 38px; height: 22px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #CBD5E1; border-radius: 999px; transition: .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(16px); }
.doc-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.doc-tabs button { display: flex; align-items: center; gap: 9px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); font-weight: 500; }
.doc-tabs button.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.svc-card { padding: 16px; display: flex; gap: 14px; align-items: flex-start; }
.svc-swatch { width: 10px; align-self: stretch; border-radius: 6px; }

/* ---------- modal + toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.42); z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; }
.modal { width: 100%; max-width: 560px; background: var(--surface); border-radius: 16px; box-shadow: 0 20px 50px rgba(15,23,42,.3); }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.picker { border: 1px solid var(--line); border-radius: 9px; max-height: 190px; overflow-y: auto; margin-top: 6px; }
.picker button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 8px 10px; border: 0; background: none; text-align: left; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.picker button:hover, .picker button.on { background: var(--primary-soft); }
.slots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; max-height: 150px; overflow-y: auto; }
.slots button { border: 1px solid var(--line); background: var(--surface); padding: 5px 9px; border-radius: 7px; font-size: 13px; }
.slots button.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.slots button:disabled { opacity: .35; text-decoration: line-through; cursor: not-allowed; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #0F172A; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; z-index: 80; box-shadow: 0 8px 24px rgba(15,23,42,.3); }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .folder-grid { grid-template-columns: 1fr; }
  .doc-layout { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .sidebar { display: none; }
  .main { padding-bottom: 76px; }
  .page { padding: 16px; }
  .mobile-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); z-index: 50; overflow-x: auto; }
  .mobile-nav button { flex: 1; min-width: 70px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border: 0; background: none; font-size: 11px; color: var(--muted); font-weight: 500; }
  .mobile-nav button.on { color: var(--primary); }
  .mobile-nav svg { width: 20px; height: 20px; }
  .fab-wrap { bottom: 86px; right: 16px; }
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .table-desktop { display: none; }
  .cards-mobile { display: flex; flex-direction: column; }
  .cards-mobile > div { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
  .paper { padding: 20px 18px; }
  .kv { grid-template-columns: 110px 1fr; }
  .med-row { grid-template-columns: 1fr 1fr; }
  .cal-toolbar h3 { min-width: 0; width: 100%; order: -1; }
}

/* ---------- print: only the document ---------- */
@media print {
  body { background: #fff; }
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area { position: absolute; left: 0; top: 0; width: 100%; }
  #print-area .paper { border: 0; box-shadow: none; padding: 0; }
  .demo-banner, .fab-wrap, .mobile-nav { display: none !important; }
}

/* ---------- calendar doctor chooser ---------- */
.doc-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.doc-chips button { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 13.5px; font-weight: 500; color: var(--muted); }
.doc-chips button .chk { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--c); display: inline-flex; align-items: center; justify-content: center; }
.doc-chips button .chk svg { width: 11px; height: 11px; stroke-width: 3.5; }
.doc-chips button.on { color: var(--text); border-color: var(--c); }
.doc-chips button.on .chk { background: var(--c); color: #fff; }
.doc-chips button.all { padding: 6px 12px; color: var(--primary); }
.cal-page .cal-toolbar h3 { min-width: 0; }

/* ---------- appointment action menu ---------- */
.act-menu { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.act-menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; border: 0; background: none; text-align: left; border-bottom: 1px solid var(--line-soft); }
.act-menu button:last-child { border-bottom: 0; }
.act-menu button:hover { background: var(--line-soft); }
.act-menu button > svg { width: 18px; height: 18px; color: var(--primary); flex-shrink: 0; }
.act-menu button b { display: block; font-weight: 600; font-size: 14px; }
.act-menu button small { color: var(--muted); font-size: 12.5px; }
.act-menu button.warn > svg { color: var(--warn); }
.act-menu button.danger > svg, .act-menu button.danger b { color: var(--danger); }
.act-menu .sep { height: 6px; background: var(--line-soft); }

/* ---------- tasks ---------- */
.task-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.task-row:last-child { border-bottom: 0; }
.task-row.done b { text-decoration: line-through; color: var(--muted); }
.tick { width: 22px; height: 22px; border-radius: 6px; border: 2px solid #CBD5E1; background: #fff; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 0; color: #fff; }
.tick.on { background: var(--success); border-color: var(--success); }
.tick svg { width: 14px; height: 14px; stroke-width: 3; }
.badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; min-width: 19px; height: 19px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; }
.mobile-nav button { position: relative; }
.mobile-nav .badge { position: absolute; top: 3px; right: 50%; margin-right: -20px; }

/* ---------- practice stats ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.kpi { padding: 14px 16px 10px; }
.kpi-l { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.kpi-i svg { width: 16px; height: 16px; color: var(--primary); }
.kpi-v { font-family: var(--font-h); font-size: 25px; margin-top: 2px; }
.spark { width: 100%; height: 28px; margin-top: 6px; display: block; }
.delta { font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 999px; white-space: nowrap; display: inline-block; }
.delta.up { background: #DCFCE7; color: #15803D; }
.delta.down { background: #FEE2E2; color: #B91C1C; }
.delta.flat { background: var(--line-soft); color: var(--muted); }
.st-tabs { margin: 0 0 16px; }
.stats-grid .card h3 { margin-bottom: 4px; }
.cols { display: flex; align-items: flex-end; gap: 2px; height: 210px; padding-top: 18px; }
.col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; cursor: default; }
.col-bar { width: 72%; max-width: 34px; background: #BCD2EC; border-radius: 4px 4px 0 0; min-height: 2px; }
.col:hover .col-bar { background: #93B6DE; }
.col.cmp .col-bar { background: #6B97CC; }
.col.on .col-bar { background: var(--primary); }
.col-val { font-size: 11.5px; font-weight: 600; color: var(--text); height: 16px; white-space: nowrap; }
.col-lab { font-size: 11.5px; color: var(--muted); margin-top: 5px; white-space: nowrap; }
.col.on .col-lab { color: var(--text); font-weight: 600; }
.key-sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--primary); vertical-align: -1px; }
.key-sw.cmp { background: #6B97CC; }
.stat-table th.r, .stat-table td.r { text-align: right; }
.stat-table td { cursor: default; }
.stat-table tbody tr { cursor: default; }
.stat-table td .delta { margin-top: 3px; }
.stat-table tr.grp td { background: #FAFBFD; font-weight: 700; font-family: var(--font-h); padding-top: 14px; }
.share { display: inline-block; width: 60px; height: 6px; background: var(--line-soft); border-radius: 999px; vertical-align: middle; margin-right: 6px; overflow: hidden; }
.share > div { height: 100%; background: var(--primary); border-radius: 999px; }
td.r .share { display: block; margin: 5px 0 0 auto; }
.line-chart { width: 100%; height: auto; display: block; }
.line-chart .grid { stroke: var(--line); stroke-width: 1; }
.line-chart .axis { font-size: 11px; fill: var(--muted); font-family: var(--font-b); }
.line-chart .end-label { font-size: 12px; fill: var(--text); font-weight: 600; font-family: var(--font-b); }
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hbar { display: grid; grid-template-columns: 150px 1fr 90px 80px; align-items: center; gap: 10px; font-size: 14px; }
.hbar-track { height: 16px; background: var(--line-soft); border-radius: 4px; overflow: hidden; }
.hbar-fill { height: 100%; background: var(--primary); border-radius: 0 4px 4px 0; }
.hbar-fill.cash { background: #64748B; }
.hbar-val { text-align: right; }
.heat { display: grid; gap: 3px; min-width: 560px; }
.heat-h { font-size: 11.5px; color: var(--muted); text-align: center; }
.heat-d { font-size: 13px; font-weight: 600; display: flex; align-items: center; }
.heat-c { height: 40px; border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; cursor: default; }
.heat-key { display: inline-block; width: 90px; height: 10px; border-radius: 3px; background: linear-gradient(90deg, color-mix(in oklab, #1D5FA8 12%, #F1F5F9), #1D5FA8); }
.chart-tip { position: fixed; z-index: 90; background: #0F172A; color: #fff; font-size: 12.5px; padding: 6px 10px; border-radius: 7px; pointer-events: none; max-width: 320px; box-shadow: 0 6px 18px rgba(15,23,42,.25); }
@media (max-width: 1000px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) {
  .hbar { grid-template-columns: 1fr 70px; }
  .hbar-track { grid-column: 1 / -1; order: 3; }
  .hbar-d { display: none; }
  .cols .col:nth-child(odd) .col-lab { visibility: hidden; }
}

/* ---------- admin: My Day ---------- */
.day-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.day-chips button { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px 5px 6px; font-size: 13px; color: var(--muted); }
.day-chips button b { background: var(--primary); color: #fff; border-radius: 999px; min-width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; padding: 0 6px; }
.day-chips button.zero b { background: #CBD5E1; }
.day-chips button:hover { border-color: var(--primary); color: var(--text); }
.sec { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 14px; overflow: hidden; scroll-margin-top: 12px; }
.sec.rose { border-color: #FECDD3; } .sec.amber { border-color: #FDE68A; } .sec.blue { border-color: #BFDBFE; } .sec.violet { border-color: #DDD6FE; } .sec.green { border-color: #BBF7D0; }
.sec-head { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; padding: 14px 16px; text-align: left; }
.sec-head:hover { background: #FAFBFD; }
.sec-head b { font-size: 15px; font-family: var(--font-h); }
.sec-head small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.sec-ic { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sec-ic svg { width: 18px; height: 18px; }
.sec.rose .sec-ic { background: #FFE4E6; color: #BE123C; } .sec.amber .sec-ic { background: #FEF3C7; color: #B45309; } .sec.blue .sec-ic { background: #DBEAFE; color: #1D4ED8; } .sec.violet .sec-ic { background: #EDE9FE; color: #6D28D9; } .sec.green .sec-ic { background: #DCFCE7; color: #15803D; }
.sec-badge { background: var(--danger); color: #fff; border-radius: 999px; min-width: 20px; height: 20px; padding: 0 6px; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.sec.blue .sec-badge, .sec.green .sec-badge { background: var(--primary); }
.sec.amber .sec-badge { background: #D97706; } .sec.violet .sec-badge { background: #7C3AED; }
.chev2 { width: 18px; height: 18px; color: var(--muted); transition: transform .15s; flex-shrink: 0; }
.chev2.open { transform: rotate(90deg); }
.sec-body { border-top: 1px solid var(--line-soft); }
.sec-empty { padding: 14px 16px; color: var(--muted); font-size: 14px; }
.sec-row { display: flex; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); align-items: flex-start; }
.sec-row:last-child { border-bottom: 0; }
.sec-row .task-row { flex: 1; padding: 0; border: 0; }
.sec-main { flex: 1; min-width: 0; font-size: 14px; }
.sec-main a { color: var(--text); text-decoration: none; }
.sec-main a:hover { color: var(--primary); text-decoration: underline; }
.sec-main > div { margin-top: 2px; }
.sec-acts { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.quote { font-size: 13.5px; color: var(--muted); font-style: italic; }
.bubble { background: #DCF8C6; color: #1F2937; border-radius: 10px 10px 10px 2px; padding: 8px 11px; font-size: 13.5px; margin-top: 7px !important; max-width: 560px; line-height: 1.4; }
.rem-list { display: flex; flex-direction: column; gap: 2px; margin-top: 8px !important; font-size: 13px; color: var(--muted); max-height: 220px; overflow-y: auto; }
.linkbtn { border: 0; background: none; color: var(--primary); padding: 0; font-size: 13px; margin-top: 6px; }
@media (max-width: 760px) { .sec-row { flex-direction: column; } .sec-acts { justify-content: flex-start; } }

/* Billing module (design preview) */
.warn-box.amber { background: #FEF3C7; border-color: #FDE68A; color: #92400E; }
table.list th.r, table.list td.r { text-align: right; }
table.list.static tbody tr { cursor: default; }
table.list.static tbody tr:hover { background: transparent; }
table.list tbody tr.rm-det { cursor: default; }
table.list tbody tr.rm-det:hover { background: #FAFBFD; }
.rm-det > td { background: #FAFBFD; padding: 4px 14px 14px 36px; }
.rm-det table.list th { background: transparent; }
.modal.xwide { max-width: 900px; }
@media (max-width: 760px) { .modal.xwide .grid2 { grid-template-columns: 1fr; } }

/* Receipt / document preview: .sec inside .paper was picking up the My Day card
   chrome (border, radius, overflow:hidden) with no padding, which clipped the
   section label against the border. Give it its own padded box instead. */
.paper .sec { background: #F8FAFC; border: 1px solid #E6EDF4; border-radius: 10px; padding: 10px 12px; overflow: visible; }
