/* REMM brand webfonts (app/assets). Each file has one weight: the range stops the browser
   from faking bold, like remmfacials.com does (font-synthesis: none + a hairline stroke). */
@font-face { font-family: "TAN Pearl"; src: url(assets/TAN-PEARL.woff2) format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Futura BT"; src: url(assets/futurabt-light-webfont.woff2) format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  --bg: #EAE5D4;
  --surface: #FBF9F3;
  --surface-2: #F4F0E5;
  --line: #DCD4BF;
  --line-soft: #E8E2D2;
  --navy: #1C3569;
  --ink: #1C3569;
  --ink-2: #47557A;
  --muted: #727B92;
  --sand: #DDBDA3;
  --sand-soft: #F1E3D6;
  --clay: #B9774A;
  --series-1: #34508F;
  --series-2: #B9774A;
  --series-1-soft: #6F8FD6;
  --cap-80: #B8890B;   /* busy: ochre yellow (3:1 on cards) */
  --cap-90: #D2691E;   /* almost full: orange */
  --cap-full: #B3362B; /* fully booked: red */
  --good: #3D7350;
  --good-bg: #E3EEE3;
  --warn: #8F5A0B;
  --warn-bg: #F6E8CF;
  --crit: #A1362B;
  --crit-bg: #F5DEDA;
  --serif: "TAN Pearl", Georgia, serif;
  --label: "Futura BT", "Raleway", sans-serif;
  --sans: "Raleway", -apple-system, "Helvetica Neue", sans-serif;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(28, 53, 105, .05), 0 6px 24px rgba(28, 53, 105, .06);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  font-weight: 450;
  font-variant-numeric: lining-nums;
}
a { color: var(--navy); }
h1, h2, h3 { font-family: var(--label); font-weight: 400; letter-spacing: .01em; margin: 0; line-height: 1.15; }
h1, h2, h3, .stat .value, .compare .big, .qty-big, .wordmark { font-variant-numeric: lining-nums tabular-nums; font-feature-settings: "lnum" 1, "tnum" 1; }
h1 { font-size: 2.3rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 .6em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(234, 229, 212, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; gap: 18px;
}
.brand { display: flex; align-items: baseline; gap: 12px; text-decoration: none; }
.wordmark { font-family: var(--serif); font-size: 1.9rem; font-weight: 600; color: var(--navy); letter-spacing: .04em; }
.brand-sub { font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-2); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  text-decoration: none; color: var(--ink-2); font-weight: 500;
  padding: 7px 11px; border-radius: 999px; font-size: .9rem; white-space: nowrap;
}
.nav a:hover { background: rgba(28, 53, 105, .06); }
.nav a.active { background: var(--navy); color: var(--surface); }
.nav a.nav-icon { display: inline-grid; place-items: center; padding: 7px; margin-left: 6px; }
.nav a.nav-icon svg { width: 19px; height: 19px; display: block; }
.topbar-status { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.save-state { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.save-state.error { color: var(--crit); font-weight: 600; }

/* ---------- Layout ---------- */
.main { max-width: 1120px; margin: 0 auto; padding: 32px 24px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--ink-2); max-width: 640px; }
.stack > * + * { margin-top: 20px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }

.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head p { margin: 4px 0 0; }
.card.soft { background: var(--surface-2); box-shadow: none; }
.card.accent { background: var(--navy); color: var(--surface); border-color: var(--navy); }
.card.accent .muted, .card.accent p { color: rgba(251, 249, 243, .78); }

/* ---------- Stat tiles ---------- */

/* ---------- Buttons ---------- */
.btn {
  appearance: none; border: 1px solid var(--navy); background: var(--navy); color: var(--surface);
  font: inherit; font-weight: 600; font-size: .92rem;
  padding: 10px 18px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #142850; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.secondary { background: transparent; color: var(--navy); }
.btn.secondary:hover { background: rgba(28, 53, 105, .06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--navy); padding: 6px 10px; }
.btn.ghost:hover { background: rgba(28, 53, 105, .06); }
.btn.danger { background: transparent; color: var(--crit); border-color: var(--crit); }
.btn.small { padding: 6px 12px; font-size: .84rem; }
.btn.light { background: var(--surface); color: var(--navy); border-color: var(--surface); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, .nav a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .seg button:focus-visible {
  outline: 2px solid var(--clay); outline-offset: 2px;
}
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--navy); text-decoration: underline; cursor: pointer; }

/* segmented control */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button {
  appearance: none; border: 0; background: transparent; font: inherit; font-weight: 600; font-size: .88rem;
  padding: 7px 16px; border-radius: 999px; color: var(--ink-2); cursor: pointer;
}
.seg button.on { background: var(--navy); color: var(--surface); }

/* ---------- Forms ---------- */
label.field { display: block; }
label.field > span.lbl { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; }
label.field > span.help { display: block; font-size: .8rem; color: var(--muted); margin-top: 5px; }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=url], input[type=search], select, textarea {
  -webkit-appearance: none; appearance: none;
  font: inherit; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 12px; width: 100%;
}
input.qty { width: 84px; text-align: right; font-variant-numeric: tabular-nums; padding: 7px 10px; }
input.qty.wide { width: 110px; }
input.qty.edited { border-color: var(--clay); background: var(--sand-soft); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.choice { display: flex; gap: 8px; flex-wrap: wrap; }
.choice label {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: #fff; cursor: pointer; font-weight: 500;
}
.choice label:has(input:checked) { border-color: var(--navy); background: rgba(28, 53, 105, .05); box-shadow: inset 0 0 0 1px var(--navy); }
.choice input { accent-color: var(--navy); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 10px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
th { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: var(--surface-2); }
.pname { font-weight: 600; }
.psub { font-size: .8rem; color: var(--muted); }
tfoot td { font-weight: 700; border-top: 1px solid var(--line); border-bottom: 0; }
.group-title { font-family: var(--label); font-size: 1.25rem; margin: 6px 0 6px; display: flex; align-items: baseline; gap: 10px; }
.group-title .muted { font-family: var(--sans); font-size: .82rem; }

.why-row td { background: var(--surface-2); padding: 14px 18px; }
.why { display: grid; gap: 6px; font-size: .88rem; }
.why .line { display: grid; grid-template-columns: 220px 80px 1fr; gap: 12px; align-items: baseline; }
.why .line .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.why .line .n { color: var(--ink-2); }
.why .line.total { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 2px; }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2);
}
.chip svg { width: 12px; height: 12px; }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.crit { background: var(--crit-bg); color: var(--crit); }
.chip.sand { background: var(--sand-soft); color: #7A4A2A; }

.confidence { display: inline-flex; gap: 3px; vertical-align: middle; }
.confidence i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.confidence i.on { background: var(--series-1); }

/* ---------- Steps ---------- */
.steps { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.steps button {
  appearance: none; font: inherit; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px 8px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); font-weight: 600; font-size: .9rem;
}
.steps button .dot {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); font-size: .82rem;
}
.steps button.on { border-color: var(--navy); color: var(--navy); }
.steps button.on .dot { background: var(--navy); color: var(--surface); }
.steps button.done .dot { background: var(--sand); color: var(--navy); }
.step-actions { display: flex; gap: 10px; justify-content: space-between; margin-top: 22px; flex-wrap: wrap; }

.compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.compare button {
  appearance: none; font: inherit; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 16px 18px; color: var(--ink);
}
.compare button.on { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.compare .t { font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.compare .big { font-family: var(--sans); font-size: 1.9rem; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.compare .s { color: var(--ink-2); font-size: .85rem; }

.callout { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--sand-soft); color: #5E3A20; font-size: .9rem; }
.callout.info { background: rgba(52, 80, 143, .08); color: var(--ink); }
.callout svg { flex: none; width: 18px; height: 18px; margin-top: 2px; }

.empty { text-align: center; padding: 40px 20px; color: var(--ink-2); }
.empty h3 { margin-bottom: 8px; }

.onboard ol { margin: 12px 0 0; padding-left: 20px; }
.onboard li { margin-bottom: 6px; }

/* ---------- Chart ---------- */
.legend { display: flex; gap: 16px; font-size: .82rem; color: var(--ink-2); margin-bottom: 8px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.chart .grid line { stroke: var(--line-soft); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover { fill: rgba(28, 53, 105, .05); }
.tooltip {
  position: fixed; z-index: 50; pointer-events: none;
  background: var(--navy); color: var(--surface); border-radius: 10px; padding: 10px 12px;
  font-size: .82rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); min-width: 160px;
}
.tooltip .tt-title { font-weight: 700; margin-bottom: 4px; }
.tooltip .tt-row { display: flex; justify-content: space-between; gap: 14px; }
.tooltip .tt-row i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 6px; }

/* ---------- Order list ---------- */
.checklist td.check { width: 40px; }
.checklist input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--navy); }
.checklist tr.done td { color: var(--muted); }
.checklist tr.done .pname { text-decoration: line-through; }
.qty-big { font-family: var(--sans); font-size: 1.4rem; font-weight: 600; }

/* ---------- Dialog / toast ---------- */
.dialog {
  border: 0; border-radius: 18px; padding: 0; width: min(680px, calc(100vw - 32px));
  margin: 5vh auto auto; max-height: 90vh;
  background: var(--surface); color: var(--ink); box-shadow: 0 24px 64px rgba(0, 0, 0, .25);
}
.dialog::backdrop { background: rgba(28, 53, 105, .35); }
.dialog form { padding: 26px 28px; }
.dialog .dlg-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.dialog .dlg-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; align-items: center; }
.kind-fields[hidden] { display: none; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--navy); color: var(--surface); padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: .9rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .compare { grid-template-columns: 1fr; }
  .topbar-inner { flex-wrap: wrap; gap: 10px 20px; padding: 12px 16px; }
  .topbar-status { margin-left: 0; }
  .main { padding: 24px 16px 64px; }
}
@media (max-width: 600px) {
  h1 { font-size: 1.9rem; }
  .form-grid { grid-template-columns: 1fr; }
  .why .line { grid-template-columns: 1fr auto; }
  .why .line .n { grid-column: 1 / -1; }
  .card { padding: 18px 16px; }
}

/* ---------- Print (order list) ---------- */
@media print {
  body { background: #fff; }
  .topbar, .no-print, .step-actions { display: none !important; }
  .main { padding: 0; }
  .card { box-shadow: none; border: 0; padding: 0; }
}
@media (max-width: 900px) { .topbar { position: static; } }

/* ---------- v2: stock, treatments, sales ---------- */
.nowrap { white-space: nowrap; }
.block { display: block; }
.lbl.block { font-weight: 600; font-size: .88rem; margin-bottom: 6px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* a row of loose pills (no surrounding track), so it can wrap onto two lines without a boxy outline */
.seg.wrap { flex-wrap: wrap; gap: 6px; background: none; border: 0; padding: 0; border-radius: 0; }
.seg.wrap button { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.seg.wrap button:hover:not(.on) { box-shadow: inset 0 0 0 1px var(--ink-2); }
.seg.wrap button.on { background: var(--navy); box-shadow: none; }

.stock-tools { gap: 12px; }
.search { position: relative; display: flex; align-items: center; flex: 1; min-width: 220px; max-width: 360px; }
.search svg { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 36px; border-radius: 999px; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.stock-big { font-family: var(--sans); font-size: 1.55rem; font-weight: 600; font-feature-settings: "lnum" 1, "tnum" 1; }
.stock-table td { padding-top: 8px; padding-bottom: 8px; }

.details summary { cursor: pointer; list-style: none; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.details summary::-webkit-details-marker { display: none; }
.details summary::before { content: "▸"; color: var(--ink-2); }
.details[open] summary::before { content: "▾"; }

.progress { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pstep { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--muted); }
.pstep .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: .82rem; border: 1px solid var(--line); }
.pstep.on { color: var(--navy); }
.pstep.on .dot { background: var(--navy); color: var(--surface); border-color: var(--navy); }
.pstep.done { color: var(--ink-2); }
.pstep.done .dot { background: var(--sand); color: var(--navy); border-color: var(--sand); }
.pline { flex: 0 0 32px; height: 1px; background: var(--line); }

tr.current td { background: rgba(221, 189, 163, .16); }

.stepper { display: flex; align-items: stretch; gap: 6px; }
.stepper input { text-align: center; font-size: 1.2rem; font-weight: 600; }
.stepper button { appearance: none; width: 44px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); font: inherit; font-size: 1.2rem; color: var(--navy); cursor: pointer; }

.chart .ref-line { stroke: var(--ink-2); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .ref-label { fill: var(--ink-2); font-size: 11px; font-family: var(--sans); font-weight: 600; }
.chart .direct-label { fill: var(--ink); font-size: 12px; font-family: var(--sans); font-weight: 700; }
.spark { display: block; overflow: visible; }
.spark .ref-line { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; opacity: .7; }
.chart-empty { padding: 48px 20px; background: var(--surface-2); border-radius: var(--radius-sm); }

@media (max-width: 900px) {
  .grid-3, .form-grid.three { grid-template-columns: 1fr; }
}

/* ---------- brand fonts ---------- */
/* TAN Pearl is for the REMM wordmark only; headings use Futura Light */
.wordmark { font-synthesis: none; -webkit-text-stroke: .5px currentColor; }
h1, h2, h3, .group-title {
  font-family: var(--label); font-weight: 400; font-synthesis: none; letter-spacing: .005em;
  -webkit-text-stroke: .2px currentColor;
}
/* TAN Pearl's figures are decorative; numbers stay in Raleway so they read at a glance */
.stat .value, .stock-big, .qty-big, .compare .big {
  font-family: var(--sans); font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums lining-nums;
}
.brand-sub, th {
  font-family: var(--label); font-weight: 400; color: var(--ink); letter-spacing: .12em;
}

/* ---------- treatments: quality small multiples ---------- */
.q-trend { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .82rem; min-height: 1.6em; margin-top: 6px; }
.quality .chart { margin-top: 10px; }
.chart.small .axis text { font-size: 12px; }

.ink { color: var(--ink); }
.month-link { font-weight: 700; text-decoration: none; }
.month-link:hover { text-decoration: underline; }

/* ---------- tiles: one style everywhere (label · figure · hint) ---------- */
.stat .label, .label-title {
  font-family: var(--label); font-weight: 400; font-size: .78rem; line-height: 1.4;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink);
}
.stat .value, .q-value {
  font-family: var(--sans); font-weight: 600; font-size: 2.1rem; line-height: 1.15; letter-spacing: -.01em;
  margin: 6px 0 4px; font-variant-numeric: tabular-nums lining-nums; color: var(--ink);
}
.stat .value .value-text { font-size: 1.35rem; line-height: 1.25; display: block; padding-top: 6px; letter-spacing: 0; }
.stat .hint, .card > .hint { font-family: var(--sans); font-size: .82rem; font-weight: 450; line-height: 1.45; color: var(--muted); }
input[type=checkbox].check { width: 18px; height: 18px; accent-color: var(--navy); }
/* tiles in a row share their label/figure/hint lines, so the figures always line up */
@supports (grid-template-rows: subgrid) {
  .grid > .stat { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 0; align-content: start; }
  .grid > .stat .value { align-self: start; }
}

.appt-form .choice label { padding: 12px 16px; }
.appt-net { margin-bottom: 0; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: .92rem; }
.dialog:has(.appt-form) { width: min(520px, calc(100vw - 32px)); }

/* ---------- sales: month picker and highlighted month ---------- */
.month-bar { padding-top: 16px; padding-bottom: 16px; }
.chart .sel-band { fill: rgba(28, 53, 105, .07); }
.chart .axis text.sel { fill: var(--ink); font-weight: 700; }
tr.selected td { background: rgba(221, 189, 163, .22); }
.stat .hint br + * { margin-top: 2px; }
.cap-legend { margin: 10px 0 0; }

/* ---------- clients ---------- */
.inner-tiles { margin-top: 6px; }
.inner-tiles .stat { box-shadow: none; background: var(--surface-2); border-color: transparent; }
.chart .grid line.zero { stroke: var(--ink-2); stroke-width: 1; }
.warn-text { color: var(--warn); font-weight: 600; }

/* ---------- month header & tiles ---------- */
.month-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.month-head h2 { margin: 0; }
.month-ctrl { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.round-btn {
  appearance: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  font: inherit; font-size: 1.3rem; line-height: 1; color: var(--navy); cursor: pointer; display: grid; place-items: center; padding-bottom: 3px;
}
.round-btn:hover:not(:disabled) { border-color: var(--navy); }
.round-btn:disabled { opacity: .3; cursor: default; }
.round-btn:focus-visible { outline: 2px solid var(--clay); outline-offset: 2px; }
.month-bar .month-head { margin-bottom: 0; }

/* ---------- treatment list ---------- */
.log-table td { padding-top: 8px; padding-bottom: 8px; }
.list-modes { margin: 0 0 14px; }
/* the explanation wraps under the title, so the search box stays on the right whichever sort is picked */
.list-head { flex-wrap: nowrap; }
.list-head > div { flex: 1; min-width: 0; }
.list-head .search { flex: 0 1 320px; }
@media (max-width: 600px) { .list-head { flex-wrap: wrap; } .list-head .search { flex-basis: 100%; max-width: none; } }
.link-btn.strong { font-weight: 600; text-decoration: none; text-align: left; }
.link-btn.strong:hover { text-decoration: underline; }

/* ---------- this month: a big number and a bar per length ---------- */
.big-figure { font-family: var(--sans); font-weight: 600; font-size: 2.6rem; line-height: 1; margin: 0 0 16px; font-variant-numeric: tabular-nums; }
.big-figure span { font-size: 1rem; font-weight: 500; color: var(--ink-2); }
.hbars { display: grid; gap: 10px; margin-bottom: 12px; }
.hbar-row { display: grid; grid-template-columns: 64px 1fr 36px; align-items: center; gap: 12px; }
.hbar-label { font-weight: 600; font-size: .9rem; white-space: nowrap; }
.hbar { display: flex; gap: 2px; height: 22px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.hbar i { display: block; height: 100%; }
.hbar i:first-child { border-radius: 6px 0 0 6px; }
.hbar-val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.month-foot { display: grid; gap: 4px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); color: var(--ink-2); }
.month-foot strong { color: var(--ink); }
.month-foot .sep { margin: 0 8px; color: var(--line); }

/* ---------- analytics ---------- */
.section-title { margin-top: 36px !important; }
.name-list { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 8px; }
.name-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- discount: number + % / € ---------- */
.seg.radio label { display: block; padding: 7px 16px; border-radius: 999px; font-weight: 600; font-size: .88rem; color: var(--ink-2); cursor: pointer; }
.seg.radio input { position: absolute; opacity: 0; pointer-events: none; }
.seg.radio label:has(input:checked) { background: var(--navy); color: var(--surface); }
.seg.radio label:has(input:focus-visible) { outline: 2px solid var(--clay); outline-offset: 2px; }

/* ---------- sale dialog: one line per product ---------- */
.sale-lines { display: grid; gap: 6px; max-height: 42vh; overflow-y: auto; padding: 2px; }
.sale-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px 8px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.sale-line.on { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); background: rgba(28, 53, 105, .03); }
.stepper.small input { width: 52px; font-size: 1rem; padding: 6px 4px; }
.stepper.small button { flex: none; width: 36px; font-size: 1.1rem; }
.dialog:has(.sale-form) { width: min(560px, calc(100vw - 32px)); }

/* ---------- date picker ---------- */
.datepick { position: relative; display: inline-block; }
.field .datepick { display: block; }
.date-btn {
  appearance: none; width: 100%; display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer;
  font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; white-space: nowrap;
}
.date-btn svg { width: 16px; height: 16px; flex: none; color: var(--ink-2); }
.date-btn:hover { border-color: var(--ink-2); }
.date-btn:focus-visible { outline: 2px solid var(--clay); outline-offset: 2px; }
.date-pop {
  position: fixed; z-index: 100; width: 288px; padding: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
}
.date-pop-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.date-pop-head .round-btn { width: 32px; height: 32px; }
.date-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.date-grid .dow { font-size: .72rem; font-weight: 600; text-align: center; color: var(--muted); padding: 4px 0; }
.date-grid button {
  appearance: none; border: 0; background: transparent; font: inherit; font-size: .9rem; height: 34px; border-radius: 8px;
  color: var(--ink); cursor: pointer; font-variant-numeric: tabular-nums;
}
.date-grid button:hover:not(:disabled) { background: var(--surface-2); }
.date-grid button.today { box-shadow: inset 0 0 0 1px var(--navy); font-weight: 700; }
.date-grid button.on { background: var(--navy); color: var(--surface); }
.date-grid button:disabled { color: var(--line); cursor: default; }
.date-grid button:focus-visible { outline: 2px solid var(--clay); outline-offset: 1px; }
.date-pop-foot { display: flex; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-soft); }

/* ---------- Login gate: covers the app until someone is logged in ---------- */
body.locked > .topbar, body.locked > .main { display: none; }
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
body:not(.locked) .gate { position: fixed; inset: 0; z-index: 50; background: rgba(234, 229, 212, .97); }
.gate-card {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 28px 24px;
}
.gate-brand { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.gate h1 { font-family: var(--serif); font-weight: 400; font-size: 1.6rem; margin: 0 0 6px; }
.gate p { margin: 0 0 14px; }
.gate form > * + * { margin-top: 14px; }
.gate .btn { width: 100%; justify-content: center; }
.gate .row .btn { width: auto; }
.gate-alert { padding: 9px 12px; border-radius: var(--radius-sm); font-size: .9rem; }
.gate-alert.error { background: var(--crit-bg); color: var(--crit); }
.gate-alert.warning { background: var(--warn-bg); color: var(--warn); }
.gate-alert.info { background: var(--surface-2); color: var(--ink-2); }
.gate-list { list-style: none; padding: 0; margin: 0 0 14px; }
.gate-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line-soft); }

/* Settings: who can open this space */
.people { list-style: none; padding: 0; margin: 0; }
.people li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.people li:first-child { border-top: 0; }
.invite-form { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.invite-form input { flex: 1 1 220px; width: auto; }

/* A dot on the gear when a backup download is due */
.nav a.nav-icon { position: relative; }
.nav a.nav-icon.due::after {
  content: ""; position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--clay); box-shadow: 0 0 0 2px var(--surface);
}

/* ---------- Phone: sections run edge to edge instead of floating cards ----------
   A card inside the page gutter would put a box in a box, with two margins around everything.
   On a phone a card becomes a full-width band: its text lines up with the page title, 16px from the edge. */
@media (max-width: 600px) {
  /* top bar: logo and save state on one line, the menu below */
  .topbar-inner { padding: 10px 16px 8px; gap: 4px 12px; }
  .wordmark { font-size: 1.6rem; }
  .topbar-status { order: 1; margin-left: auto; }
  .nav { order: 2; flex-basis: 100%; }

  /* iPhone zooms in on a field with text under 16px, and stays zoomed: the page then scrolls sideways */
  input[type=text], input[type=email], input[type=number], input[type=date], input[type=url], input[type=search], select, textarea { font-size: 16px; }
  .stepper input { font-size: 1.2rem; }
  .stepper.small input { font-size: 1rem; }

  .main { padding: 20px 16px 56px; }
  .page-head { margin-bottom: 18px; }
  .stack > * + * { margin-top: 12px; }
  .grid { gap: 12px; }
  .section-title { margin-top: 28px !important; }
  /* month title and ‹ › on one line, the "in progress" chip under it */
  .month-head > :not(h2):not(.month-ctrl) { order: 1; }
  .stock-tools .search { flex-basis: 100%; max-width: none; }
  .stock-tools .spacer { display: none; }
  /* action buttons: smaller, so a row of them doesn't take half the screen */
  .main .btn:not(.small):not(.ghost) { padding: 8px 14px; font-size: .86rem; }
  /* order progress on one line: smaller steps, and a step's date under its name */
  .progress { flex-wrap: nowrap; gap: 6px; }
  .pstep { gap: 6px; font-size: .8rem; line-height: 1.25; white-space: nowrap; }
  .pstep:has(.small) { display: grid; grid-template-columns: auto auto; align-items: center; column-gap: 6px; }
  .pstep .dot { grid-row: span 2; width: 22px; height: 22px; font-size: .72rem; }
  .pstep .small { font-size: .7rem; font-weight: 500; }
  .pline { flex: 1 1 8px; min-width: 8px; }

  .main .card { margin-inline: -16px; padding: 20px 16px; border-radius: 0; border-width: 1px 0; box-shadow: none; }
  .main .card .table-wrap { margin-inline: -16px; padding-inline: 16px; }
  .main .card .table-wrap th:first-child, .main .card .table-wrap td:first-child { padding-left: 0; }
  .main .card .table-wrap th:last-child, .main .card .table-wrap td:last-child { padding-right: 0; }
  /* wide tables scroll sideways; the product name keeps enough room not to break into four lines */
  .table-wrap td:has(> .pname) { min-width: 150px; }

  /* a row of figure tiles is one band too, split by hairlines */
  .main .grid:not(.inner-tiles):has(> .card.stat) { margin-inline: -16px; gap: 1px; background: var(--line-soft); border-block: 1px solid var(--line-soft); }
  .main .grid > .card.stat { margin: 0; border: 0; padding: 16px; }
  .stat .value { font-size: 1.75rem; }

  /* figures inside a section: no box around them, just a line above each */
  .inner-tiles { column-gap: 16px; row-gap: 0; }
  .main .inner-tiles > .card.stat, .dialog .inner-tiles > .card.stat { margin: 0; padding: 12px 0 8px; background: none; border: 0; border-top: 1px solid var(--line-soft); border-radius: 0; }

  /* dialogs sit at the bottom as a full-width sheet */
  .dialog, .dialog:has(.appt-form), .dialog:has(.sale-form) {
    width: 100%; max-width: 100%; max-height: 92dvh; margin: auto 0 0; border-radius: 18px 18px 0 0;
  }
  .dialog form { padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
  .dialog .dlg-head { margin-bottom: 14px; }
  /* Save stays in reach at the bottom of the sheet; the sheet scrolls as one, without a list scrolling inside it */
  .dialog form:has(> .dlg-foot:last-child) { padding-bottom: 0; }
  .dialog .dlg-foot:last-child {
    position: sticky; bottom: 0; z-index: 1; flex-wrap: wrap; margin: 18px -16px 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line-soft);
  }
  .dialog .dlg-foot .btn { padding-inline: 14px; }
  .sale-lines { max-height: none; overflow: visible; }
}
