/* Calm, warm and plain: sage and sand on a soft off-white. Mobile first. */
:root {
  --ink: #26343a; --muted: #67777a; --faint: #95a2a2; --line: #e4e0d7; --line-2: #eeebe4; --bg: #f7f5f0; --card: #fff;
  --brand: #3f7a74; --brand-2: #4b8c85; --brand-ink: #2c5b56; --brand-soft: #e7f0ec; --sand: #c9a36a; --sand-soft: #f6eedf;
  --ok: #2f7d4f; --ok-soft: #e5f3ea; --bad: #b4433a; --bad-soft: #fbeae7; --warn: #9a6512; --warn-soft: #fbf0d9; --info: #2f6f9a; --info-soft: #e5f0f7;
  --s1: #2f7fb5; --s2: #c06a1f;
  --radius: 12px; --shadow: 0 1px 2px rgba(38, 52, 58, .05), 0 4px 14px rgba(38, 52, 58, .05);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-ink); }
h1 { font: 600 24px/1.25 var(--serif); margin: 18px 0 4px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 22px 0 10px; font-weight: 650; }
h3 { font-size: 15px; margin: 0 0 6px; font-weight: 650; }
.sub { color: var(--muted); margin: 0 0 16px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.right { text-align: right; } .nowrap { white-space: nowrap; } .center { text-align: center; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 14px; }
[hidden] { display: none !important; }

/* ---------- top bar */
.top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.bar { display: flex; align-items: center; gap: 14px; min-height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand .logo { width: 34px; height: 34px; flex: none; }
.brand b { font: 600 17px/1.1 var(--serif); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { color: var(--muted); font-size: 12px; display: block; }
nav.main { display: none; gap: 2px; margin-left: 18px; }
nav.main a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 9px; font-size: 14.5px; font-weight: 500; }
nav.main a:hover { background: var(--bg); color: var(--ink); }
nav.main a.on { background: var(--brand-soft); color: var(--brand-ink); }
.who { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-weight: 650; font-size: 13px; border: none; cursor: pointer; padding: 0; }
.menu { position: absolute; right: 12px; top: 54px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.12); min-width: 230px; padding: 6px; z-index: 50; }
.menu a, .menu button { display: block; width: 100%; text-align: left; background: none; border: none; color: var(--ink); padding: 9px 12px; border-radius: 8px; font: inherit; text-decoration: none; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--bg); }
.menu .meta { padding: 8px 12px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }

/* bottom tabs on phones */
.tabs-bottom { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); display: flex; z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
.tabs-bottom a { flex: 1; text-align: center; padding: 7px 2px 6px; color: var(--muted); text-decoration: none; font-size: 11px; }
.tabs-bottom a svg { display: block; margin: 0 auto 2px; width: 22px; height: 22px; }
.tabs-bottom a.on { color: var(--brand); }
body.has-tabs main { padding-bottom: 80px; }
@media (min-width: 900px) {
  nav.main { display: flex; }
  .tabs-bottom { display: none; }
  body.has-tabs main { padding-bottom: 30px; }
}

/* ---------- building blocks */
main { padding-bottom: 30px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card.flat { box-shadow: none; }
.card + .card { margin-top: 14px; }
.grid > .card + .card, .row > .card + .card { margin-top: 0; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 6px 0 14px; }
.pagehead h1 { margin-bottom: 0; }

button, .btn { font: inherit; font-weight: 550; border: 1px solid var(--brand); background: var(--brand); color: #fff; padding: 8px 15px; border-radius: 9px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; line-height: 1.25; min-height: 38px; }
button:hover, .btn:hover { background: var(--brand-2); border-color: var(--brand-2); }
button.ghost, .btn.ghost { background: #fff; color: var(--brand-ink); border-color: #cfd9d5; }
button.ghost:hover, .btn.ghost:hover { background: var(--brand-soft); }
button.quiet { background: none; border-color: transparent; color: var(--brand-ink); }
button.quiet:hover { background: var(--brand-soft); }
button.danger { background: #fff; color: var(--bad); border-color: #e8c3bd; }
button.danger:hover { background: var(--bad-soft); }
button.small, .btn.small { padding: 4px 10px; font-size: 13px; min-height: 30px; }
button.icon { padding: 6px 9px; min-height: 36px; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { font: inherit; font-size: 16px; padding: 9px 11px; border: 1px solid #d3d8d3; border-radius: 9px; background: #fff; color: var(--ink); min-width: 0; }
@media (min-width: 700px) { input, select, textarea { font-size: 15px; } }
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 1px; }
label { display: block; font-size: 13px; color: var(--muted); font-weight: 500; }
label > input:not([type=checkbox]):not([type=radio]), label > select, label > textarea { display: block; width: 100%; margin-top: 4px; color: var(--ink); font-weight: 400; }
.form { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form .full { grid-column: 1 / -1; }
.check { display: flex; gap: 8px; align-items: flex-start; color: var(--ink); font-size: 14.5px; font-weight: 400; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--brand); }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 0; }
legend { font-size: 13px; font-weight: 650; color: var(--muted); padding: 0 6px; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: #eef0ec; color: var(--muted); white-space: nowrap; line-height: 1.6; }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.info { background: var(--info-soft); color: var(--info); }
.badge.brand { background: var(--brand-soft); color: var(--brand-ink); } .badge.sand { background: var(--sand-soft); color: #7d5a22; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 6px 13px; border-radius: 99px; font-size: 14px; font-weight: 500; min-height: 34px; }
.chip:hover { background: var(--brand-soft); color: var(--ink); border-color: var(--line); }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.seg { display: inline-flex; border: 1px solid #cfd9d5; border-radius: 10px; overflow: hidden; background: #fff; }
.seg button { border: none; border-radius: 0; background: #fff; color: var(--brand-ink); min-height: 34px; padding: 5px 13px; font-weight: 550; }
.seg button + button { border-left: 1px solid #cfd9d5; }
.seg button.on { background: var(--brand-soft); color: var(--brand-ink); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 6px 0 16px; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { padding: 10px 14px; color: var(--muted); text-decoration: none; border: none; background: none; border-bottom: 2px solid transparent; border-radius: 0; font-weight: 550; white-space: nowrap; min-height: 0; }
.tabs a:hover, .tabs button:hover { color: var(--ink); background: none; }
.tabs a.on, .tabs button.on { color: var(--brand-ink); border-bottom-color: var(--brand); }

table.list { width: 100%; border-collapse: collapse; background: #fff; }
table.list th, table.list td { padding: 10px 10px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: middle; }
table.list th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: #fbfaf7; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: #fbfaf6; }
table.list td.n, table.list th.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.list tfoot td { font-weight: 650; background: #fbfaf7; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.tablewrap table.list tr:last-child td { border-bottom: none; }
@media (max-width: 699px) { .hide-sm { display: none !important; } }
@media (min-width: 700px) { .show-sm { display: none !important; } }

.stat { padding: 14px 16px; }
.stat .v { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 14.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { .kv { grid-template-columns: 1fr; gap: 0; } .kv dd { margin-bottom: 8px; } }
.notice { border-radius: 10px; padding: 10px 14px; background: var(--info-soft); color: #23526f; font-size: 14px; }
.notice.warn { background: var(--warn-soft); color: #6f4a0c; } .notice.ok { background: var(--ok-soft); color: #245f3b; } .notice.bad { background: var(--bad-soft); color: #8c2f27; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- modal and toast */
.modal { position: fixed; inset: 0; background: rgba(30, 40, 42, .38); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; width: 100%; max-height: 92vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 18px 18px 22px; box-shadow: 0 -10px 40px rgba(0,0,0,.15); }
.sheet h2 { margin-top: 0; font: 600 20px/1.3 var(--serif); }
.sheet .close { position: sticky; float: right; top: 0; margin: -6px -6px 0 0; }
@media (min-width: 700px) {
  .modal { align-items: center; padding: 20px; }
  .sheet { max-width: 560px; border-radius: 16px; }
  .sheet.wide { max-width: 860px; }
}
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: #26343a; color: #fff; padding: 11px 16px; border-radius: 10px; z-index: 80; box-shadow: 0 8px 24px rgba(0,0,0,.2); display: flex; gap: 14px; align-items: center; max-width: calc(100vw - 24px); font-size: 14.5px; }
.toast.bad { background: #8c2f27; } .toast.ok { background: #2a5e45; }
.toast button { background: none; border: 1px solid rgba(255,255,255,.5); color: #fff; min-height: 28px; padding: 3px 10px; }
@media (min-width: 900px) { .toast { bottom: 24px; } }

/* ---------- login */
.login { max-width: 420px; margin: 6vh auto 30px; }
.login .card { padding: 26px; }
.demo-logins { display: grid; gap: 8px; margin-top: 14px; }
.demo-logins button { justify-content: space-between; width: 100%; }

/* ---------- calendar */
.calbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 10px; }
.calbar .title { font: 600 19px/1.2 var(--serif); margin: 0 6px; min-width: 0; }
.calstrip { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.calstrip .badge { font-size: 12.5px; padding: 4px 10px; }
.cal { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; position: relative; max-height: calc(100vh - 210px); min-height: 420px; -webkit-overflow-scrolling: touch; }
.cal-head { display: grid; position: sticky; top: 0; z-index: 6; background: #fff; border-bottom: 1px solid var(--line); }
.cal-head div { padding: 8px 6px; text-align: center; font-size: 13px; color: var(--muted); border-left: 1px solid var(--line-2); cursor: pointer; }
.cal-head div b { display: block; color: var(--ink); font-size: 16px; }
.cal-head div.today b { color: #fff; background: var(--brand); border-radius: 99px; display: inline-block; min-width: 28px; padding: 0 6px; }
.cal-head div.closed { color: var(--faint); }
.cal-body { display: grid; position: relative; }
.gutter { position: relative; border-right: 1px solid var(--line-2); }
.gutter span { position: absolute; right: 6px; font-size: 11.5px; color: var(--faint); transform: translateY(-7px); white-space: nowrap; }
.col { position: relative; border-left: 1px solid var(--line-2); touch-action: pan-x pan-y; }
.col .hr { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line-2); pointer-events: none; }
.col .hr.half { border-top-style: dashed; border-top-color: #f3f1ec; }
.col .off { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, #f6f4ef, #f6f4ef 6px, #f1eee7 6px, #f1eee7 12px); pointer-events: none; }
.col .now { position: absolute; left: 0; right: 0; border-top: 2px solid #d0603f; z-index: 4; pointer-events: none; }
.col .now::before { content: ''; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: #d0603f; }
.appt { position: absolute; left: 3px; right: 3px; border-radius: 8px; padding: 4px 7px 3px 9px; font-size: 12.5px; line-height: 1.3; overflow: hidden; cursor: pointer; z-index: 2; border: 1px solid rgba(0,0,0,.06);
  background: var(--tint); border-left: 4px solid var(--c); color: #1f2c31; user-select: none; -webkit-user-select: none; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.appt:hover { box-shadow: 0 3px 10px rgba(0,0,0,.12); z-index: 3; }
.appt .t { font-size: 11.5px; color: #4b5a5e; font-variant-numeric: tabular-nums; }
.appt .n { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt .s { color: #4b5a5e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt .icons { position: absolute; right: 5px; top: 4px; display: flex; gap: 3px; }
.appt .ic { font-size: 10px; font-weight: 700; border-radius: 4px; padding: 0 4px; background: rgba(255,255,255,.85); color: #4b5a5e; line-height: 15px; }
.appt .ic.new { background: #fff3d6; color: #8a5a00; } .appt .ic.paid { color: var(--ok); } .appt .ic.owe { color: var(--bad); } .appt .ic.chart { color: #7a4fa0; }
.appt.arrived { box-shadow: inset 0 0 0 2px #2f7d4f; }
.appt.completed { opacity: .82; }
.appt.noshow { background: repeating-linear-gradient(135deg, #fbeae7, #fbeae7 5px, #fff 5px, #fff 10px); border-left-color: var(--bad); }
.appt.noshow .n { text-decoration: line-through; }
.appt.cancelled { opacity: .45; background: #fff; border-style: dashed; border-left-style: solid; }
.appt.cancelled .n { text-decoration: line-through; }
.appt.dragging { opacity: .35; }
.appt.ghost { opacity: .92; z-index: 10; box-shadow: 0 8px 24px rgba(0,0,0,.22); pointer-events: none; outline: 2px solid var(--brand); }
.blk { position: absolute; left: 3px; right: 3px; border-radius: 8px; background: repeating-linear-gradient(135deg, #eceae4, #eceae4 5px, #e4e1da 5px, #e4e1da 10px); color: #5d6a6c; font-size: 12px; padding: 3px 8px; z-index: 1; cursor: pointer; overflow: hidden; border: 1px solid #dcd8cf; user-select: none; }
.blk b { font-weight: 600; }
.col.drop { background: #f5faf8; }
.slotpop { position: absolute; z-index: 20; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.15); padding: 6px; min-width: 200px; }
.slotpop button { display: flex; width: 100%; background: none; color: var(--ink); border: none; justify-content: flex-start; font-weight: 500; }
.slotpop button:hover { background: var(--bg); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.legend span { display: inline-flex; gap: 5px; align-items: center; }

/* ---------- patient */
.phead { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 12px 0 4px; }
.bigavatar { width: 56px; height: 56px; border-radius: 50%; background: var(--sand-soft); color: #7d5a22; display: grid; place-items: center; font: 600 20px var(--serif); flex: none; }
.phead h1 { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--line-2); display: flex; gap: 12px; align-items: flex-start; }
.timeline li:last-child { border-bottom: none; }
.doc { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.doc .ficon { width: 36px; height: 44px; border-radius: 6px; background: var(--bad-soft); color: var(--bad); font-size: 10px; font-weight: 700; display: grid; place-items: center; flex: none; }
.intake dl { margin: 0; }

/* ---------- charting */
.chart-layout { display: grid; gap: 16px; }
@media (min-width: 1000px) { .chart-layout { grid-template-columns: minmax(0, 1fr) 440px; align-items: start; } .chart-side { position: sticky; top: 72px; } }
.soap { margin-bottom: 14px; }
.soap > h3 { display: flex; align-items: center; gap: 10px; font: 600 16px var(--serif); margin: 0 0 12px; }
.soap > h3 .L { width: 28px; height: 28px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font: 700 14px system-ui; }
.scale { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.scale button { min-width: 34px; min-height: 34px; padding: 0; justify-content: center; background: #fff; color: var(--ink); border-color: #d3d8d3; font-weight: 500; }
.scale button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.locked { background: #fbfaf6; }
.ro { white-space: pre-wrap; padding: 6px 0 2px; color: var(--ink); font-size: 14.5px; min-height: 22px; }
.ro.emptyv { color: var(--faint); }
.body-views { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.body-views figure { margin: 0; text-align: center; }
.body-views figcaption { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
svg.body { width: 100%; height: auto; max-height: 520px; touch-action: manipulation; }
svg.body .sil { fill: #efe7da; }
svg.body .sil-line { fill: none; stroke: #ddd2c0; stroke-width: 1; }
svg.body .pt { fill: #fff; stroke: #9aa9a6; stroke-width: 1.3; cursor: pointer; }
svg.body .pt:hover { stroke: var(--brand); stroke-width: 2; }
svg.body .pt.on { fill: var(--bad); stroke: #fff; stroke-width: 1.5; }
svg.body .hit { fill: transparent; cursor: pointer; }
svg.body .lbl { font-size: 8.5px; fill: #7a8786; pointer-events: none; font-family: system-ui, sans-serif; }
svg.body .lbl.on { fill: var(--bad); font-weight: 700; }
svg.body .cm { fill: #7a4fa0; stroke: #fff; stroke-width: 1.5; }
svg.body.adding { cursor: crosshair; }
svg.body text.side { font-size: 9px; fill: #a7b1b0; font-weight: 700; }
.marks { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.marks .badge { cursor: pointer; }
.amend { border-left: 3px solid var(--sand); padding: 6px 12px; background: var(--sand-soft); border-radius: 0 8px 8px 0; margin-top: 8px; font-size: 14px; }
.savestate { font-size: 12.5px; color: var(--muted); }

/* ---------- reports */
.chartbox { position: relative; height: 220px; margin: 8px 0 4px; }
.chartbox svg { width: 100%; height: 100%; overflow: visible; }
.chartbox .gl { stroke: #eceae4; stroke-width: 1; }
.chartbox .ax { font-size: 11px; fill: var(--muted); }
.chartbox .bar { cursor: default; }
.chartbox .bar:hover { opacity: .85; }
.tip { position: absolute; pointer-events: none; background: #26343a; color: #fff; font-size: 12.5px; padding: 6px 9px; border-radius: 7px; white-space: nowrap; z-index: 5; transform: translate(-50%, -110%); }
.keyrow { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.keyrow span { display: inline-flex; align-items: center; gap: 6px; }
.keyrow i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ---------- messages */
.msg { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--line-2); cursor: pointer; align-items: start; }
.msg:hover { background: #fbfaf6; }
.msg .ch { width: 28px; height: 28px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.msg .ch.sms { background: var(--sand-soft); color: #7d5a22; }
.msg .prev { color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
pre.body { white-space: pre-wrap; font: 14px/1.5 system-ui, sans-serif; background: var(--bg); padding: 12px; border-radius: 10px; margin: 0; }

/* ---------- import */
.drop { border: 2px dashed #cdd6d2; border-radius: 12px; padding: 22px; text-align: center; color: var(--muted); background: #fcfbf8; }
.drop.over { border-color: var(--brand); background: var(--brand-soft); }
tr.st-error td { background: #fdf3f1; } tr.st-warn td { background: #fdf9ef; } tr.st-skip td { color: var(--faint); } tr.st-update td { background: #f2f8fb; }

/* ---------- settings */
.settings-layout { display: grid; gap: 16px; }
@media (min-width: 900px) { .settings-layout { grid-template-columns: 220px 1fr; } }
.side-nav { display: flex; gap: 4px; overflow-x: auto; }
.side-nav a { padding: 8px 12px; border-radius: 9px; color: var(--muted); text-decoration: none; white-space: nowrap; font-weight: 500; }
.side-nav a.on { background: var(--brand-soft); color: var(--brand-ink); }
.side-nav a:hover { background: #fff; }
@media (min-width: 900px) { .side-nav { flex-direction: column; } }
.hours-row { display: grid; grid-template-columns: 110px auto 1fr 1fr; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.fieldrow { display: grid; grid-template-columns: 1fr 120px 70px; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: #fff; }
.fieldrow .opts { grid-column: 1 / -1; }
.fieldrow .act { grid-column: 1 / -1; display: flex; gap: 6px; justify-content: flex-end; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.logline { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line-2); white-space: pre-wrap; word-break: break-word; }
.logline.err { background: #fdf3f1; }

/* ---------- portal and public booking */
.portal-hero { background: linear-gradient(135deg, var(--brand-soft), var(--sand-soft)); border-radius: 16px; padding: 20px; margin: 14px 0; }
.appt-card { display: flex; gap: 14px; align-items: center; }
.datebox { width: 58px; flex: none; text-align: center; border-radius: 10px; background: #fff; border: 1px solid var(--line); overflow: hidden; }
.datebox small { display: block; background: var(--brand); color: #fff; font-size: 11px; font-weight: 600; text-transform: uppercase; padding: 2px 0; }
.datebox b { display: block; font: 600 22px/1.3 var(--serif); }

.book-wrap { max-width: 760px; margin: 0 auto; padding: 0 14px 40px; }
.book-head { text-align: center; padding: 26px 10px 8px; }
.book-head .logo { width: 48px; height: 48px; }
.book-head h1 { margin: 8px 0 4px; font-size: 26px; }
.steps { display: flex; justify-content: center; gap: 6px; margin: 14px 0 18px; flex-wrap: wrap; }
.steps span { font-size: 12.5px; color: var(--faint); padding: 3px 10px; border-radius: 99px; }
.steps span.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.steps span.done { color: var(--brand-ink); }
.svc { display: flex; gap: 14px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; margin-bottom: 10px; cursor: pointer; transition: border-color .15s, box-shadow .15s; text-align: left; width: 100%; color: var(--ink); font-weight: 400; }
.svc:hover { border-color: var(--brand-2); box-shadow: var(--shadow); background: #fff; }
.svc .bar { width: 5px; align-self: stretch; border-radius: 4px; flex: none; }
.svc h3 { margin: 0 0 2px; font-size: 16px; }
.svc .meta { color: var(--muted); font-size: 13.5px; }
.svc .price { margin-left: auto; text-align: right; font-weight: 650; white-space: nowrap; }
.month { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.month .mhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.month .grid7 { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.month .dow { font-size: 12px; color: var(--muted); padding: 4px 0; font-weight: 600; }
.month .day { aspect-ratio: 1 / 1; border-radius: 50%; border: none; background: none; color: var(--faint); font-weight: 500; padding: 0; min-height: 0; justify-content: center; font-size: 15px; max-width: 48px; margin: 0 auto; width: 100%; }
.month .day.avail { color: var(--brand-ink); background: var(--brand-soft); font-weight: 650; cursor: pointer; }
.month .day.avail:hover { background: #d5e7e0; }
.month .day.sel { background: var(--brand); color: #fff; }
.month .day:disabled { cursor: default; opacity: 1; }
.times { display: grid; grid-template-columns: repeat(auto-fill, minmax(94px, 1fr)); gap: 8px; }
.times button { background: #fff; color: var(--brand-ink); border-color: #cfd9d5; justify-content: center; }
.times button:hover, .times button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.summary { background: var(--sand-soft); border-radius: 12px; padding: 12px 16px; font-size: 14.5px; }
.policy { font-size: 13.5px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.confirm-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin: 10px auto; }
.foot { color: var(--faint); font-size: 12.5px; text-align: center; padding: 20px 14px 30px; }

@media print {
  .top, .tabs-bottom, .noprint, .toast, .calbar { display: none !important; }
  body { background: #fff; }
}

/* phones: calendar title on its own line so nothing pushes the page sideways */
@media (max-width: 699px) {
  .calbar .title { order: -1; flex-basis: 100%; margin: 0; font-size: 18px; }
  .calbar #caldate { flex: 1; min-width: 0; }
  .calbar button { padding-left: 11px; padding-right: 11px; }
  .calstrip .check { margin-left: 0 !important; }
  .sheet { max-width: 100vw; }
}
html, body { max-width: 100%; }
