:root {
  --ink: #12232d; --muted: #5d6c76; --line: #e2e7ea; --bg: #f3f5f6; --card: #fff;
  --accent: #278079; --accent-ink: #fff; --accent-soft: #e3f1ef;
  --upper: #0f8f87; --upper-soft: #d5efed; --lower: #6d55d3; --lower-soft: #e7e2fa;
  --today: #d9480f; --today-soft: #fff0e6; --ok: #2b8a3e; --danger: #c92a2a;
  --radius: 14px; --shadow: 0 1px 2px rgba(16,36,47,.05), 0 4px 16px rgba(16,36,47,.04);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { -webkit-tap-highlight-color: transparent; }
body { font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 20px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0; letter-spacing: .01em; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); } .sm { font-size: 13.5px; } .xs { font-size: 12px; } .strong { font-weight: 600; }
.ok { color: var(--ok); } .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
.right { text-align: right; white-space: nowrap; } .spacer { flex: 1; }

/* buttons */
button, .btn { font: inherit; font-weight: 600; font-size: 14px; border-radius: 10px; border: 1px solid transparent; padding: 9px 16px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none !important; transition: background .15s, border-color .15s; }
button:disabled { opacity: .6; cursor: default; }
.primary { background: var(--accent); color: var(--accent-ink); }
.primary:hover { background: #1f6761; }
.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.ghost:hover { border-color: #c9d2d7; }
.danger { background: var(--danger); color: #fff; }
.link { background: none; border: 0; padding: 4px 6px; color: var(--accent); font-weight: 600; }
.link:hover { text-decoration: underline; }
.danger-text { color: var(--danger) !important; }
button.sm, .btn.sm { padding: 6px 12px; font-size: 13px; }
.block { width: 100%; justify-content: center; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* top bar */
.top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top-in { max-width: 1180px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 22px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 700; font-size: 16px; text-decoration: none !important; }
.brand .logo { width: 30px; height: 30px; object-fit: contain; }
.brand span b { color: var(--accent); }
.top nav { display: flex; gap: 4px; }
.top nav a { padding: 7px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none; }
.top nav a.on, .top nav a:hover { background: var(--accent-soft); color: var(--accent); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.who { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.iconbtn { background: none; border: 0; color: var(--muted); font-size: 13px; font-weight: 600; padding: 6px 4px; }
.iconbtn:hover { color: var(--ink); text-decoration: none; }
.lang-pick { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 0 2px 0 7px; background: #fff; color: var(--muted); cursor: pointer; }
.lang-pick svg { width: 16px; height: 16px; flex-shrink: 0; }
.lang-select { border: 0; min-height: 30px; padding: 3px 4px; font-size: 13px; font-weight: 600; width: auto; background: transparent; color: var(--ink); cursor: pointer; }
.lang-select:focus { outline: none; }
.lang-pick:focus-within { border-color: var(--accent); }
.m-langs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.m-langs button { justify-content: center; background: #f1f4f5; border: 1px solid transparent; color: var(--ink); padding: 10px; border-radius: 10px; font-size: 14px; }
.m-langs button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.lang button { border-radius: 0; padding: 4px 9px; font-size: 12px; background: #fff; color: var(--muted); border: 0; }
.lang button.on { background: var(--ink); color: #fff; }

.chip { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: #edf1f3; color: var(--muted); vertical-align: middle; letter-spacing: .02em; }
.role-admin { background: #fff3bf; color: #8a6100; } .role-doctor { background: var(--accent-soft); color: var(--accent); } .role-patient { background: var(--lower-soft); color: var(--lower); }
.st-active { background: var(--accent-soft); color: var(--accent); }
.chip.st-inactive { background: #e9ecef; color: #495057; }
.alert.inactive-banner { background: #f1f3f5; border-color: #ced4da; color: #343a40; } .st-completed { background: #e6f4ea; color: var(--ok); } .st-not_started { background: #edf1f3; }
.pill { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.pill.today { background: var(--today-soft); color: var(--today); }

/* layout */
.wrap { max-width: 1180px; margin: 0 auto; padding: 26px 20px 60px; }
.narrow { max-width: 460px; margin: 30px auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.back { display: inline-block; font-size: 13.5px; font-weight: 600; margin-bottom: 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1.15fr; gap: 18px; margin-bottom: 0; }
.grid2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; }
.grid3 > .card, .grid2 > .card { margin-bottom: 18px; }
details.card > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
details.card > summary::before { content: '▸'; color: var(--muted); transition: transform .15s; }
details.card[open] > summary::before { transform: rotate(90deg); }
details.card[open] > summary { margin-bottom: 14px; }
.loading { height: 200px; border-radius: var(--radius); background: linear-gradient(90deg, #eef1f3, #f7f9fa, #eef1f3); background-size: 200% 100%; animation: sh 1.2s infinite; }
@keyframes sh { to { background-position: -200% 0; } }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.alert { background: var(--today-soft); color: #8f3209; border: 1px solid #ffd8bf; padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.notice { background: var(--accent-soft); color: var(--accent); padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.banner.today { background: var(--today); color: #fff; font-weight: 700; padding: 14px 18px; border-radius: var(--radius); margin-bottom: 18px; font-size: 16px; }
.tip { background: var(--bg); border-radius: 10px; padding: 12px 14px; font-size: 13.5px; color: var(--muted); margin-top: 12px; }

/* jaw & end cards */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot.upper { background: var(--upper); } .dot.lower { background: var(--lower); }
.kicker { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 8px; }
.jaw-card { border-top: 4px solid var(--upper); display: flex; flex-direction: column; }
.jaw-card.lower { border-top-color: var(--lower); }
.big { font-size: 44px; font-weight: 750; line-height: 1.05; letter-spacing: -.02em; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.big small { font-size: 20px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.jaw-card.upper .big:not(.muted):not(.ok) { color: var(--upper); } .jaw-card.lower .big:not(.muted):not(.ok) { color: var(--lower); }
.jaw-card .pill { align-self: flex-start; margin-top: 6px; }
.next { margin-top: 14px; display: grid; gap: 1px; }
.next span { font-size: 12px; color: var(--muted); font-weight: 600; }
.next b { font-size: 16px; } .next em { font-style: normal; font-size: 13px; color: var(--accent); font-weight: 600; }
.foot { margin-top: auto; padding-top: 16px; display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.bar { height: 7px; background: #e9eef0; border-radius: 9px; overflow: hidden; min-width: 60px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 9px; }
.bar.upper i { background: var(--upper); } .bar.lower i { background: var(--lower); }
.end-card { background: linear-gradient(160deg, #143c39, #24706a); color: #fff; border: 0; }
.end-card .kicker, .end-card .muted { color: #a9c9c4; }
.end-card { display: flex; flex-direction: column; }
.end-row { display: flex; align-items: center; gap: 18px; flex: 1; }
.end-date { font-size: 20px; font-weight: 700; line-height: 1.25; margin-bottom: 4px; }
.ring { width: 92px; height: 92px; flex-shrink: 0; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 8; } .ring-bg { stroke: rgba(255,255,255,.14); } .ring-fg { stroke: #5fe0cf; stroke-linecap: round; transition: stroke-dashoffset .6s; }
.ring text { transform: rotate(90deg); transform-origin: 40px 40px; fill: #fff; font-size: 17px; font-weight: 700; }

/* timeline */
.timeline { padding: 6px 0 0; }
.tl-body { position: relative; }
.lane { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 12px; margin-bottom: 16px; }
.lane-name { font-weight: 700; font-size: 13px; display: flex; align-items: center; }
.lane-name small { margin-left: 6px; color: var(--muted); font-weight: 600; }
.lane-track { position: relative; height: 42px; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), #eef1f3 calc(10% - 1px) 10%); border-radius: 8px; }
.seg { position: absolute; top: 14px; bottom: 0; }
.seg-label { position: absolute; top: -15px; left: 0; font-size: 10.5px; font-weight: 700; color: var(--muted); white-space: nowrap; text-transform: uppercase; letter-spacing: .05em; }
.blocks { display: flex; gap: 2px; height: 100%; }
.blocks i { flex: 1; min-width: 1px; border-radius: 3px; background: var(--upper-soft); }
.seg.lower .blocks i { background: var(--lower-soft); }
.seg.upper .blocks i.done { background: var(--upper); } .seg.lower .blocks i.done { background: var(--lower); }
.blocks i.cur { background: var(--today) !important; box-shadow: 0 0 0 2px rgba(217,72,15,.25); }
.tl-overlay { position: absolute; top: -6px; bottom: -6px; left: 104px; right: 0; pointer-events: none; }
.today-mark { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--today); }
.today-mark span { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: 10.5px; font-weight: 800; color: #fff; background: var(--today); padding: 1px 6px; border-radius: 5px; text-transform: uppercase; letter-spacing: .05em; }
.tl-axis { position: relative; height: 22px; margin-left: 104px; border-top: 1px solid var(--line); margin-top: 6px; }
.tick { position: absolute; top: 4px; font-size: 11px; color: var(--muted); transform: translateX(-2px); white-space: nowrap; }
.tick::before { content: ''; position: absolute; left: 0; top: -5px; height: 5px; border-left: 1px solid #c9d2d7; }

/* tables */
.table-wrap { overflow: auto; max-height: 560px; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 9px 12px; border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 1; white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid #eef1f3; vertical-align: top; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover { background: #f8fafb; }
table.list tr.inactive td { color: #98a2a8; } table.list tr.inactive td a.strong { color: #7d8a91; } table.list tr.inactive td button { opacity: 1; }
td.prog { min-width: 110px; } td.prog .bar { margin: 6px 0 3px; }
.sched tr.past { color: #9aa6ad; } .sched tr.past b { font-weight: 600; }
.sched tr.is-today { background: var(--today-soft); }
.sched tr.is-today td:first-child { box-shadow: inset 3px 0 var(--today); }
.ev small { color: var(--muted); } .ev.start b { color: var(--accent); } .ev.fin { color: var(--ok); font-weight: 600; font-size: 13px; }
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input[type=search] { flex: 1; min-width: 200px; max-width: 340px; }
.fchips { display: flex; gap: 6px; flex-wrap: wrap; }
.fchip { background: #fff; border: 1px solid var(--line); color: var(--muted); padding: 6px 12px; font-size: 13px; border-radius: 99px; }
.fchip b { color: var(--ink); margin-left: 2px; }
.fchip.on { background: var(--ink); border-color: var(--ink); color: #fff; } .fchip.on b { color: #fff; }

/* stages */
.stages { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.stage-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 10px; }
.stage-top { display: flex; align-items: center; gap: 8px; }
.stage-no { width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.stage-jaw { font-size: 14px; }
.stage-jaw .xs { margin-left: 15px; }

/* forms */
.form h3 { margin: 6px 0 12px; }
.form h3:not(:first-child) { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.field { display: grid; gap: 5px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.narrow-field { max-width: 360px; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid #d3dbe0; border-radius: 10px; padding: 9px 12px; width: 100%; min-height: 40px; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(39,128,121,.25); border-color: var(--accent); }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.jaw-fields { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px 10px; margin: 0 0 14px; border-left: 4px solid var(--upper); }
.jaw-fields.lower { border-left-color: var(--lower); }
.jaw-fields legend { font-weight: 700; font-size: 14px; padding: 0 6px; }
.jaw-fields .field { margin-bottom: 6px; }
.jaw-preview { min-height: 20px; margin: 4px 0 2px; font-weight: 600; color: var(--accent); }
.segmented { display: flex; border: 1px solid #d3dbe0; border-radius: 10px; overflow: hidden; min-height: 40px; }
.seg-opt { flex: 1; position: relative; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span { display: grid; place-items: center; height: 100%; padding: 8px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg-opt + .seg-opt span { border-left: 1px solid #d3dbe0; }
.seg-opt input:checked + span { background: var(--accent); color: #fff; }
.seg-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -3px; }
.form-error { background: #fff5f5; color: var(--danger); border: 1px solid #ffc9c9; padding: 9px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 12px; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.inline-field { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 6px; }
.inline-field select { width: auto; min-height: 32px; padding: 4px 10px; }

/* auth */
.auth { min-height: 86vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 400px; padding: 30px; }
.auth-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; }
.auth-brand .logo { width: 52px; height: 52px; object-fit: contain; flex-shrink: 0; }
.auth-brand h1 { font-size: 24px; margin: 0; } .auth-brand h1 b { color: var(--accent); }
.auth-foot { display: flex; justify-content: center; margin-top: 18px; }

/* modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(16,36,47,.45); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .15s; }
.modal { background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 460px; max-height: 92vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 720px; }
.modal h3 { font-size: 18px; margin-bottom: 12px; }
@keyframes fade { from { opacity: 0; } }
.cred { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; background: var(--bg); border-radius: 12px; padding: 14px; margin: 12px 0; }
.cred span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.cred b { font-size: 16px; word-break: break-all; }
.invite { font-size: 13px; color: var(--muted); resize: vertical; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; }
.toast.show { opacity: 1; transform: translate(-50%, 0); } .toast.err { background: var(--danger); }

/* demo strip */
.demo { background: #12232d; color: #cfe0e6; font-size: 13px; padding: 8px 20px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.demo button { background: rgba(255,255,255,.1); color: #fff; padding: 4px 10px; font-size: 12.5px; border-radius: 99px; }
.demo button:hover { background: rgba(255,255,255,.2); }
.demo button.link { background: none; color: #8fd3c9; }

/* interactive aligner chart */
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); font-weight: 600; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }
.sw.done { background: linear-gradient(90deg, var(--upper) 50%, var(--lower) 50%); }
.sw.cur { background: var(--today); }
.sw.up { background: linear-gradient(90deg, var(--upper-soft) 50%, var(--lower-soft) 50%); }
.gantt { display: grid; grid-template-columns: 84px minmax(0, 1fr); }
.g-band { position: relative; height: 26px; }
.g-lane { position: relative; height: 56px; margin: 4px 0; }
.g-axis { position: relative; height: 26px; }
.g-labels .g-lane { display: flex; align-items: center; font-weight: 700; font-size: 13px; }
.g-labels .g-lane small { margin-left: 6px; color: var(--muted); font-weight: 600; }
.g-scroll { overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; scroll-behavior: smooth; }
.g-inner { position: relative; }
.g-inner .g-lane { background: #f6f8f9; border-radius: 8px; }
.g-inner .g-axis { border-top: 1px solid var(--line); }
.g-lines { position: absolute; inset: 26px 0 26px 0; pointer-events: none; }
.mline { position: absolute; top: 0; bottom: 0; border-left: 1px dashed #d3dbe0; }
.band-seg { position: absolute; top: 4px; height: 18px; line-height: 18px; padding: 0 8px; border-left: 2px solid var(--ink); background: #eef1f3; border-radius: 0 6px 6px 0; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.al { position: absolute; top: 6px; bottom: 6px; padding: 0; min-width: 0; border-radius: 7px; border: 2px solid #f6f8f9; font-size: 11.5px; font-weight: 750; display: grid; place-items: center; overflow: hidden; font-variant-numeric: tabular-nums; transition: transform .12s, box-shadow .12s; }
.al span { pointer-events: none; }
.al.upper.up { background: var(--upper-soft); color: var(--upper); } .al.lower.up { background: var(--lower-soft); color: var(--lower); }
.al.upper.done { background: var(--upper); color: #fff; } .al.lower.done { background: var(--lower); color: #fff; }
.al.cur { background: var(--today); color: #fff; }
.al:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(16,36,47,.18); z-index: 2; }
.al.sel { box-shadow: 0 0 0 3px var(--ink); z-index: 3; transform: translateY(-2px); }
.al:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.g-today { position: absolute; top: 18px; bottom: 26px; width: 2px; margin-left: -1px; background: var(--today); z-index: 4; pointer-events: none; }
.g-today span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 800; color: #fff; background: var(--today); padding: 1px 6px; border-radius: 5px; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.g-axis .tick { top: 6px; }
.al-detail { margin-top: 14px; border: 1px solid var(--line); border-left: 4px solid var(--upper); border-radius: 12px; padding: 14px 16px 16px; background: #fcfdfd; }
.al-detail.lower { border-left-color: var(--lower); }
.al-detail:empty { display: none; }
.al-head { display: flex; align-items: center; gap: 12px; }
.al-title { flex: 1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.al-title h3 { font-size: 17px; }
.navbtn { width: 36px; height: 36px; padding: 0; justify-content: center; font-size: 20px; line-height: 1; }
.pill.done { background: #e6f4ea; color: var(--ok); } .pill.cur { background: var(--today-soft); color: var(--today); } .pill.up { background: #edf1f3; color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 14px 18px; margin-top: 14px; }
.fact > span { display: block; font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.fact b { font-size: 15px; display: block; }
.fact small { display: block; color: var(--muted); font-size: 12.5px; }

/* confirmations & notifications */
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.pill.warn { background: #fff4d6; color: #9a6700; } .pill.bad { background: #ffe8e8; color: var(--danger); }
.bad-text { color: var(--danger) !important; }
.shift-line { color: #ffd8a8; font-weight: 600; }
.block-notice { margin-bottom: 14px; }
.banner.okb { background: #e6f4ea; color: var(--ok); font-weight: 700; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; }
.confirm-card { display: flex; gap: 16px; padding: 20px; border-radius: var(--radius); margin-bottom: 18px; background: linear-gradient(135deg, #fff3ea, #fff); border: 2px solid var(--today); box-shadow: var(--shadow); }
.confirm-card.late { border-color: var(--danger); background: linear-gradient(135deg, #fff1f1, #fff); }
.cc-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--today); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.confirm-card.late .cc-icon { background: var(--danger); }
.cc-icon svg { width: 26px; height: 26px; }
.cc-body { flex: 1; min-width: 0; }
.cc-body h3 { font-size: 18px; margin-bottom: 4px; }
.cc-body p { color: var(--muted); }
.cf-items { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.cf-item { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 15px; cursor: pointer; }
.cf-item input { width: auto; min-height: 0; margin: 0 4px 0 0; accent-color: var(--accent); }
.cf-item small { color: var(--muted); }
.cc-date { max-width: 240px; }
.cc-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
button.big { padding: 13px 22px; font-size: 16px; border-radius: 12px; }
.reminder { display: flex; gap: 12px; align-items: center; background: #fff8db; border: 1px solid #ffe28a; color: #6b4f00; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; font-size: 14.5px; }
.reminder svg { width: 22px; height: 22px; flex-shrink: 0; }
.bell-wrap { position: relative; }
.bell { background: none; border: 0; padding: 6px; color: var(--ink); position: relative; }
.bell svg { width: 22px; height: 22px; }
.bell b { position: absolute; top: 0; right: -2px; background: var(--danger); color: #fff; font-size: 10.5px; min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
.notif-panel { position: absolute; right: 0; top: 40px; width: 330px; max-width: 90vw; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px rgba(16,36,47,.18); z-index: 30; overflow: hidden; }
.notif-head { font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.notif { padding: 12px 16px; border-bottom: 1px solid #eef1f3; display: grid; gap: 2px; font-size: 13.5px; border-left: 3px solid transparent; }
.notif b { font-size: 14px; } .notif small { color: var(--muted); font-size: 11.5px; }
.notif.unread { background: #f4fbfa; }
.notif.today { border-left-color: var(--today); } .notif.overdue { border-left-color: var(--danger); } .notif.h24 { border-left-color: #f0b400; } .notif.h48 { border-left-color: #c9d2d7; }
.notif-empty { padding: 18px 16px; }
.stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.stats b { color: var(--ink); font-size: 15px; margin-right: 3px; }
.table-wrap.short { max-height: 360px; }
.al.cf::after { content: '✓'; position: absolute; top: -1px; right: 2px; font-size: 9px; line-height: 1; opacity: .9; }
.al.cf.off::before { content: ''; position: absolute; left: 3px; top: 3px; width: 6px; height: 6px; border-radius: 50%; background: #ffd43b; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.al.miss { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.62) 0 2.5px, transparent 2.5px 6px) !important; box-shadow: inset 0 0 0 1.5px rgba(201,42,42,.85); }
.al.miss span { background: rgba(0,0,0,.28); border-radius: 4px; padding: 0 3px; }
.al.miss.sel { box-shadow: 0 0 0 3px var(--ink), inset 0 0 0 1.5px rgba(201,42,42,.85); }
.sw.cfm { background: var(--upper); color: #fff; font-size: 8px; font-style: normal; display: inline-grid; place-items: center; }
.sw.miss { background: repeating-linear-gradient(135deg, rgba(255,255,255,.62) 0 1.5px, transparent 1.5px 3.5px), var(--upper); box-shadow: inset 0 0 0 1px rgba(201,42,42,.85); }

.check { display: flex; align-items: center; gap: 10px; font-size: 14px; margin: 4px 0 6px; cursor: pointer; }
.check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }

/* ================= phone version (patients) ================= */
.m-app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; background: var(--bg); }
.m-top { display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: #fff; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.m-top .logo { width: 26px; height: 26px; object-fit: contain; }
.m-brand { font-weight: 700; font-size: 16px; } .m-brand b { color: var(--accent); }
.m-bell { margin-left: auto; color: var(--ink); position: relative; padding: 4px; display: grid; }
.m-bell svg { width: 24px; height: 24px; }
.m-bell b, .m-tabs a b { position: absolute; top: -2px; right: -4px; background: var(--danger); color: #fff; font-size: 10.5px; min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
.m-main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px 14px 28px; }
.m-tabs { display: grid; grid-template-columns: repeat(4, 1fr); background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); flex-shrink: 0; }
.m-tabs a { display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none !important; padding: 4px 0; position: relative; }
.m-tabs a svg { width: 25px; height: 25px; }
.m-tabs a.on { color: var(--accent); }
.m-tabs a b { right: calc(50% - 20px); top: 0; }
.m-hello { font-size: 24px; margin: 2px 2px 14px; }
.m-title { font-size: 24px; margin: 2px 2px 14px; }
.m-app .confirm-card { flex-direction: column; padding: 16px; border-radius: 20px; gap: 6px; }
.m-app .cc-icon { display: none; }
.m-app .cc-body h3 { font-size: 19px; }
.m-app .cf-items { flex-direction: column; }
.m-app .cf-item { padding: 12px 14px; font-size: 16px; }
.m-app .cc-actions { flex-direction: column; align-items: stretch; }
.m-app .cc-actions .big { width: 100%; justify-content: center; padding: 16px; font-size: 17px; border-radius: 14px; }
.m-app .cc-date { max-width: none; }
.m-app .reminder, .m-app .alert, .m-app .notice, .m-app .banner { border-radius: 16px; font-size: 14px; }
.m-hero { background: linear-gradient(155deg, #143c39, #278079); color: #fff; border-radius: 24px; padding: 18px 18px 16px; margin-bottom: 14px; box-shadow: 0 10px 24px rgba(20,60,57,.22); }
.m-hero.today { background: linear-gradient(155deg, #b13d0b, #ea6a1c); box-shadow: 0 10px 24px rgba(217,72,15,.25); }
.m-hero.done { background: linear-gradient(155deg, #1f6b33, #2f9e4a); }
.m-hero-top span { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; opacity: .85; }
.m-count { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 0; }
.m-count big { font-size: 64px; font-weight: 800; line-height: 1.02; letter-spacing: -.03em; }
.m-count big.word { font-size: 46px; }
.m-count small { font-size: 20px; font-weight: 600; opacity: .9; }
.m-hero-date { font-size: 15px; font-weight: 600; opacity: .95; }
.m-hero-date::first-letter, .m-big::first-letter { text-transform: uppercase; }
.m-jaws { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.m-jaw { background: rgba(255,255,255,.14); border-radius: 16px; padding: 10px 12px; display: grid; gap: 1px; }
.m-jaw > span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; opacity: .9; display: flex; align-items: center; }
.m-jaw .dot { box-shadow: 0 0 0 2px rgba(255,255,255,.6); }
.m-jaw b { font-size: 28px; letter-spacing: -.02em; } .m-jaw small { opacity: .75; font-weight: 600; }
.mbar { height: 5px; border-radius: 5px; background: rgba(255,255,255,.22); overflow: hidden; margin: 6px 0 4px; }
.mbar i { display: block; height: 100%; background: #fff; border-radius: 5px; }
.m-jaw em { font-style: normal; font-size: 11.5px; opacity: .9; }
.m-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin-bottom: 12px; }
.m-label { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.m-big { font-size: 20px; font-weight: 750; }
.shift-dark { color: #9a4a00; font-weight: 600; margin-top: 2px; }
.m-prog { display: flex; align-items: center; gap: 10px; margin: 10px 0 4px; } .m-prog .bar { flex: 1; height: 8px; } .m-prog b { font-size: 14px; }
.m-section { display: flex; justify-content: space-between; align-items: center; margin: 18px 4px 8px; }
.m-section span { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.m-section a { font-size: 13px; font-weight: 600; }
.m-contact { display: grid; gap: 8px; margin-top: 10px; } .m-contact .btn { justify-content: center; font-size: 14px; word-break: break-all; }
.m-month { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 18px 4px 8px; }
.m-ev { display: flex; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px; margin-bottom: 8px; }
.m-ev.today { border: 2px solid var(--today); background: var(--today-soft); }
.m-ev.past { background: #f8f9fa; }
.m-ev.past .m-date b, .m-ev.past .m-line b { color: var(--muted); }
.m-date { width: 44px; flex-shrink: 0; text-align: center; border-right: 1px solid var(--line); padding-right: 10px; display: grid; align-content: center; }
.m-date b { font-size: 24px; line-height: 1.05; } .m-date span { font-size: 12px; font-weight: 700; color: var(--accent); text-transform: lowercase; }
.m-date small { font-size: 11px; color: var(--muted); text-transform: capitalize; }
.m-ev-body { flex: 1; min-width: 0; display: grid; gap: 5px; align-content: center; }
.m-line { display: flex; align-items: center; gap: 5px; font-size: 14.5px; flex-wrap: wrap; }
.m-line small { color: var(--muted); font-size: 12px; }
.m-line.fin { color: var(--ok); font-weight: 600; font-size: 13.5px; }
.m-st { margin-left: auto; font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.m-st.ok { color: var(--ok); } .m-st.miss { color: var(--danger); }
.m-st.miss i { width: 12px; height: 9px; border-radius: 2px; background: repeating-linear-gradient(135deg, rgba(255,255,255,.62) 0 1.5px, transparent 1.5px 3.5px), var(--upper); box-shadow: inset 0 0 0 1px rgba(201,42,42,.85); }
.m-rel { font-size: 12px; font-weight: 600; color: var(--accent); }
.m-ev.today .m-rel { color: var(--today); }
.m-seg { display: flex; background: #e9eef0; border-radius: 12px; padding: 3px; margin-bottom: 4px; }
.m-seg button { flex: 1; background: none; border: 0; color: var(--muted); padding: 9px; border-radius: 10px; justify-content: center; }
.m-seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.m-stats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; padding: 14px 8px; }
.m-stats b { display: block; font-size: 20px; } .m-stats span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.m-stats > div + div { border-left: 1px solid var(--line); }
.m-list { background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; margin-bottom: 12px; }
.m-list > * { display: flex; width: 100%; padding: 15px 16px; border: 0; border-bottom: 1px solid var(--line); background: none; font: inherit; font-weight: 600; color: var(--ink); text-align: left; border-radius: 0; text-decoration: none !important; }
.m-list > *:last-child { border-bottom: 0; }
.m-install { background: var(--accent-soft); border-color: transparent; } .m-install p { margin: 6px 0 0; }
.m-app .notif { border-left-width: 4px; border-radius: 14px; }
.m-note { margin: 10px 4px; }
.m-app .tip { border-radius: 16px; }
.m-app .form-error { border-radius: 12px; }
.m-app .narrow { margin: 0; } .m-app .narrow .card { border-radius: 18px; }
/* demo: phone frame on desktop */
.phone-stage { display: grid; place-items: center; padding: 28px 16px 40px; background: radial-gradient(circle at 50% 0, #e8eef0, #d5dde1); min-height: calc(100vh - 44px); }
.phone-frame { width: 390px; height: 820px; max-height: calc(100vh - 90px); border-radius: 46px; border: 11px solid #10242f; overflow: hidden; background: var(--bg); box-shadow: 0 30px 70px rgba(16,36,47,.35); }
.phone-frame .m-app { height: 100%; }
.phone-frame .m-top { padding-top: 14px; }
.demo .phone-btn { background: #278079; }
body.phone-mode .toast { bottom: calc(86px + env(safe-area-inset-bottom)); }
@media (max-width: 720px) { .demo { font-size: 11.5px; padding: 6px 10px; gap: 5px; } .demo > span { display: none; } .demo button { font-size: 11.5px; padding: 3px 8px; } .demo .phone-btn { display: none; } } .demo .phone-btn.on { background: #e8590c; }

@media (max-width: 900px) {
  .grid3 { grid-template-columns: 1fr 1fr; } .grid3 .end-card { grid-column: 1 / -1; }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .top-in { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .top-right { width: 100%; justify-content: space-between; margin-left: 0; }
  .who b { display: none; }
  .wrap { padding: 18px 14px 50px; }
  .confirm-card { flex-direction: column; } .cc-actions .big { width: 100%; justify-content: center; }
  .grid3, .row3, .cred { grid-template-columns: 1fr; }
  .big { font-size: 38px; }
  .lane { grid-template-columns: 1fr; gap: 4px; }
  .tl-overlay { left: 0; top: 22px; } .tl-axis { margin-left: 0; }
  h1 { font-size: 22px; }
  .timeline .tick:nth-child(even) { display: none; }
  .gantt { grid-template-columns: 64px minmax(0, 1fr); }
  table.list th:nth-child(n+5), table.list td:nth-child(n+5) { display: none; }
}
