/* LUNOX ZP pilot — light, KumoDoc-inspired theme. Brand #470054. */
:root {
  --brand: #470054;
  --brand-dark: #33003d;
  --brand-light: #6a2178;
  --brand-tint: #f5ecf7;
  --brand-tint-2: #ede0f1;
  --bg: #f4f2f7;
  --card: #ffffff;
  --text: #2a1f2e;
  --muted: #7a6c80;
  --line: #e9e2ec;
  --ok: #1a7a3c;      --ok-bg: #e3f4e8;
  --warn: #9a5b00;    --warn-bg: #fdf0dc;
  --bad: #b3261e;     --bad-bg: #fde7e5;
  --info: #0b5fa5;    --info-bg: #e3effa;
  --neutral-bg: #efeaf2;
  --shadow: 0 2px 12px rgba(71, 0, 84, .07);
  --shadow-lift: 0 8px 24px rgba(71, 0, 84, .13);
  /* mattress material colours (always paired with a printed name) */
  --mat-latex: #f6f0da;
  --mat-memory: #d4ecd0;
  --mat-soft: #f8e9a8;
  --mat-medium: #e0d2f0;
  --mat-hard: #d2e5f7;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 15px/1.5 "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100vh;
}
a { color: var(--brand); }
h1 { font-size: 1.4rem; margin: 0 0 .8rem; font-weight: 700; }
h2 { font-size: 1.05rem; margin: 1rem 0 .5rem; font-weight: 700; }
h3 { font-size: .95rem; margin: .75rem 0 .35rem; font-weight: 700; }

/* ---- layout: light sidebar, airy content ---- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: 0 0 232px; background: var(--card); color: var(--text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; border-right: 1px solid var(--line);
}
.sidebar .logo { padding: 18px 16px 12px; }
.sidebar .logo img { display: block; width: 100%; max-width: 168px; height: auto; }
.sidebar .logo .sub {
  font-size: .68rem; color: var(--muted); letter-spacing: .1em; margin-top: 8px;
  font-weight: 600;
}
.sidebar nav { flex: 1; padding: 6px 10px 10px; }
.sidebar nav a {
  display: flex; gap: 11px; align-items: center; color: var(--muted); text-decoration: none;
  padding: 9px 12px; font-size: .9rem; border-radius: 10px; margin: 1px 0; font-weight: 500;
  transition: background .12s, color .12s;
}
.sidebar nav a:hover { background: var(--brand-tint); color: var(--brand); }
.sidebar nav a.active { background: var(--brand); color: #fff; font-weight: 600; box-shadow: var(--shadow); }
.sidebar nav a .ic { width: 21px; height: 21px; flex: none; display: inline-flex; }
.sidebar nav a .ic svg { width: 100%; height: 100%; }
.sidebar .foot {
  padding: 10px 16px 14px; font-size: .7rem; color: var(--muted);
  border-top: 1px solid var(--line);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 10px 22px; display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 10;
}
.topbar .pagetitle { font-weight: 700; font-size: 1.05rem; }
.topbar .who {
  margin-left: auto; display: flex; align-items: center; gap: 9px;
  background: var(--bg); border-radius: 999px; padding: 4px 14px 4px 4px;
  font-size: .82rem; color: var(--muted);
}
.topbar .avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; flex: none;
}
.topbar .iconbtn {
  width: 38px; height: 38px; min-height: 0; padding: 0; border-radius: 50%;
  background: var(--brand-tint); color: var(--brand); border: none; flex: none;
}
.topbar .iconbtn:hover { background: var(--brand-tint-2); }
.topbar .iconbtn svg { width: 19px; height: 19px; }
.content { padding: 20px 22px; max-width: 1320px; width: 100%; }

/* ---- components ---- */
.card {
  background: var(--card); border: none; border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 12px; }
.kpis { grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); }
.kpi { text-align: left; }
.kpi .v { font-size: 1.5rem; font-weight: 800; color: var(--brand); letter-spacing: -.01em; }
.kpi .l { font-size: .76rem; color: var(--muted); font-weight: 600; margin-top: 2px; }

table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
th { color: var(--muted); font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
tr.click { transition: background .1s; }
tr.click:hover { background: var(--brand-tint); cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

button, .btn {
  font: inherit; border: none; background: var(--brand); color: #fff;
  border-radius: 999px; padding: 10px 20px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-size: .9rem; font-weight: 600; min-height: 42px;
  box-shadow: 0 2px 6px rgba(71, 0, 84, .22);
  transition: background .12s, transform .06s, box-shadow .12s;
}
button:hover, .btn:hover { background: var(--brand-light); box-shadow: var(--shadow-lift); }
button:active, .btn:active { transform: translateY(1px); box-shadow: none; }
button.ghost, .btn.ghost {
  background: var(--brand-tint); color: var(--brand); box-shadow: none;
}
button.ghost:hover, .btn.ghost:hover { background: var(--brand-tint-2); box-shadow: none; }
button.danger { background: var(--bad); }
button.danger:hover { background: #8f1e18; }
button.small, .btn.small { padding: 6px 14px; font-size: .8rem; min-height: 32px; }
button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

input, select, textarea {
  font: inherit; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--text); width: 100%; max-width: 100%; min-height: 42px;
  transition: border-color .12s, box-shadow .12s;
}
textarea { min-height: 60px; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-light);
  box-shadow: 0 0 0 3px var(--brand-tint-2);
}
button:focus-visible { outline: 2px solid var(--brand-light); outline-offset: 2px; }
input[type="checkbox"] { min-height: 0; width: 20px; height: 20px; accent-color: var(--brand); cursor: pointer; }
label { display: block; font-size: .78rem; color: var(--muted); margin: 9px 0 4px; font-weight: 600; }
fieldset { border: 1.5px solid var(--line); border-radius: 12px; margin: 10px 0; }
legend { font-size: .78rem; color: var(--muted); padding: 0 6px; font-weight: 600; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 130px; }
.row > .fix { flex: 0 0 auto; min-width: 0; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input, .toolbar select { width: auto; }

/* soft filled status badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 11px; border-radius: 999px; font-size: .74rem;
  font-weight: 700; white-space: nowrap; border: none;
  background: var(--neutral-bg); color: var(--muted);
}
.badge::before { content: "●"; font-size: .55rem; }
.b-pending, .b-draft, .b-open { background: var(--info-bg); color: var(--info); }
.b-arrived, .b-in_progress, .b-submitted, .b-in_production { background: var(--warn-bg); color: var(--warn); }
.b-completed, .b-resolved, .b-issued, .b-ready, .b-delivered, .b-acknowledged, .b-signed { background: var(--ok-bg); color: var(--ok); }
.b-cancelled, .b-no_show, .b-replaced, .b-withdrawn, .b-superseded, .b-exception { background: var(--bad-bg); color: var(--bad); }
.b-waiting_customer, .b-waiting_factory, .b-revision_requested { background: var(--neutral-bg); color: var(--muted); }

.muted { color: var(--muted); font-size: .85rem; }
.error { color: var(--bad); font-size: .88rem; margin: 6px 0; white-space: pre-wrap; }
.notice {
  background: var(--brand-tint); border: none; border-radius: 12px;
  padding: 10px 14px; font-size: .85rem; margin: 8px 0;
}

/* ---- modal (pop-up) ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(42, 31, 46, .45);
  backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center; padding: 4vh 12px; z-index: 50;
  overflow-y: auto;
}
.modal {
  background: var(--card); border-radius: 18px; width: 100%; max-width: 640px;
  padding: 0 22px 20px; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); margin-bottom: 4vh;
  animation: modal-in .16s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal.wide { max-width: 960px; }
.modal .modal-head {
  display: flex; align-items: center; gap: 10px; padding: 16px 0 10px;
  border-bottom: 2px solid var(--brand-tint-2); margin-bottom: 12px;
  position: sticky; top: 0; background: var(--card); z-index: 2;
}
.modal .modal-head h2 { margin: 0; color: var(--brand); flex: 1; font-size: 1.1rem; }
.modal .modal-x {
  width: 34px; height: 34px; min-height: 0; padding: 0; border-radius: 50%;
  background: var(--brand-tint); color: var(--brand); box-shadow: none;
  font-size: 1rem; flex: none;
}
.modal .modal-x:hover { background: var(--bad-bg); color: var(--bad); box-shadow: none; }
.modal .actions {
  display: flex; gap: 9px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap;
  border-top: 1px solid var(--line); padding-top: 14px;
}

/* ---- toast ---- */
.toast {
  position: fixed; bottom: 20px; right: 20px; background: var(--brand-dark); color: #fff;
  padding: 12px 18px; border-radius: 14px; z-index: 99; box-shadow: var(--shadow-lift);
  max-width: 400px; font-size: .9rem; display: flex; gap: 9px; align-items: flex-start;
  animation: toast-in .2s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
.toast.err { background: var(--bad); }

/* ---- appointments calendar ---- */
.cal { display: grid; grid-template-columns: 52px repeat(7, 1fr); gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.cal .hd { background: var(--brand-tint); font-size: .78rem; font-weight: 700; text-align: center; padding: 7px 2px; color: var(--brand); }
.cal .hd.today { background: var(--brand); color: #fff; }
.cal .timecol { background: #fff; font-size: .68rem; color: var(--muted); text-align: right; padding: 2px 5px; }
.cal .slot { background: #fff; min-height: 40px; position: relative; }
.cal .slot:hover { background: var(--brand-tint); cursor: pointer; }
/* drag-and-drop landing preview: dashed band on the target quarter-hour */
.cal .slot.drop-top::after, .cal .slot.drop-bottom::after {
  content: attr(data-droptime);
  position: absolute; left: 1px; right: 1px; height: calc(50% - 2px);
  border: 2px dashed var(--brand); border-radius: 6px; background: var(--brand-tint-2);
  color: var(--brand); font-size: .68rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  z-index: 4; pointer-events: none;
}
.cal .slot.drop-top::after { top: 1px; }
.cal .slot.drop-bottom::after { bottom: 1px; }
/* Block colour = clinician (via --pc-*), thin top line = status (--status-c). */
.cal .appt {
  position: absolute; left: 2px; right: 2px; z-index: 2; border-radius: 8px; padding: 5px 6px 2px;
  background: var(--pc-bg, var(--brand-tint)); color: var(--text); font-size: .7rem; overflow: hidden;
  cursor: grab; border: 1px solid var(--pc-line, var(--brand-light)); box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.cal .appt::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--status-c, var(--muted));
}
.cal .appt.s-cancelled, .cal .appt.s-no_show { opacity: .55; text-decoration: line-through; }
.cal .appt.blocked {
  background: repeating-linear-gradient(45deg, #eceaee, #eceaee 7px, #e0dde4 7px, #e0dde4 14px);
  color: var(--muted); border-color: #b9b2bf;
}
.cal .appt .t { font-weight: 700; }
.cal .appt .rem {
  font-size: .64rem; color: var(--muted); font-style: italic;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-legend { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 10px; align-items: center; }
.cal-legend .chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 700;
  padding: 2px 10px; border-radius: 999px; background: var(--pc-bg); border: 1px solid var(--pc-line);
}
.cal-legend .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--status-c); }

/* ---- mattress illustration (side view) ---- */
.stack { max-width: 520px; margin: 10px 0; }
.stack .cap {
  font-size: .74rem; color: var(--muted); display: flex; justify-content: space-between;
  padding: 2px 10px; font-weight: 600; letter-spacing: .03em;
}
.stack .mattress {
  position: relative; border: 3px solid #7a6a80; border-radius: 26px; overflow: hidden;
  background: #fff; box-shadow: 0 14px 24px -12px rgba(71, 0, 84, .35);
}
.stack .mattress::after {
  content: "LABEL"; position: absolute; right: -2px; top: 42%;
  background: #fff; border: 2px solid #7a6a80; border-right: none;
  border-radius: 6px 0 0 6px; font-size: .58rem; font-weight: 700; color: #7a6a80;
  padding: 3px 6px 3px 8px; letter-spacing: .1em;
}
.stack .layer {
  display: flex; min-height: 40px; font-size: .8rem; text-align: center;
  align-items: stretch; border-top: 2px solid rgba(122, 106, 128, .55);
}
.stack .layer:first-child { border-top: none; }
.stack .layer.fabric {
  min-height: 44px; font-weight: 600;
  background:
    repeating-linear-gradient(45deg, rgba(122, 106, 128, .16) 0 1.5px, transparent 1.5px 22px),
    repeating-linear-gradient(-45deg, rgba(122, 106, 128, .16) 0 1.5px, transparent 1.5px 22px),
    linear-gradient(#ffffff, #f2ecf5);
  border-bottom: 2px dashed rgba(122, 106, 128, .7);
}
.stack .layer.base {
  min-height: 74px; font-weight: 600; border-top: 2px solid #7a6a80;
}
.stack .layer.base.spring {
  background:
    repeating-linear-gradient(90deg, transparent 0 5px, rgba(122, 106, 128, .28) 5px 7px, transparent 7px 22px),
    repeating-linear-gradient(180deg, transparent 0 12px, rgba(122, 106, 128, .14) 12px 14px),
    linear-gradient(#f4eff6, #e5dcea);
}
.stack .layer.base.foam {
  background:
    radial-gradient(rgba(122, 106, 128, .12) 1.5px, transparent 1.5px) 0 0 / 14px 14px,
    linear-gradient(#f4eff6, #e5dcea);
}
.stack .side {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 6px 8px;
  box-shadow: inset 0 -8px 10px -8px rgba(0, 0, 0, .18), inset 0 6px 8px -6px rgba(255, 255, 255, .8);
}
.stack .side .matname { font-weight: 600; }
.stack .side small { display: block; font-weight: 400; color: rgba(34, 24, 38, .6); font-size: .68rem; }
.stack .layer .side + .side { border-left: 3px dashed rgba(122, 106, 128, .8); }
.stack .m-latex_topper, .stack .m-latex { background-color: var(--mat-latex); }
.stack .m-memory_foam { background-color: var(--mat-memory); }
.stack .m-soft_foam { background-color: var(--mat-soft); }
.stack .m-medium_foam { background-color: var(--mat-medium); }
.stack .m-hard_foam { background-color: var(--mat-hard); }
.stack .dims { text-align: center; font-size: .76rem; color: var(--muted); margin-top: 6px; }
.stack .dims .rule {
  height: 8px; border-left: 2px solid var(--muted); border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted); margin: 2px 24px 3px; border-radius: 0 0 4px 4px;
}
.superseded-banner {
  background: var(--bad); color: #fff; font-weight: 700; text-align: center;
  padding: 7px; border-radius: 10px; letter-spacing: .08em; margin: 8px 0;
}

/* ---- production status stepper ---- */
.steps { display: flex; flex-wrap: wrap; gap: 0; margin: 10px 0 14px; }
.step { display: flex; align-items: center; gap: 7px; padding: 4px 0; }
.step .dot {
  width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center;
  justify-content: center; font-size: .78rem; font-weight: 700; flex: none;
  background: #fff; border: 2px solid var(--line); color: var(--muted);
}
.step .lbl { font-size: .78rem; color: var(--muted); white-space: nowrap; font-weight: 600; }
.step::after { content: ""; width: 26px; height: 2px; background: var(--line); margin: 0 8px; flex: none; }
.step:last-child::after { display: none; }
.step.done .dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.step.done .lbl { color: var(--text); }
.step.now .dot { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 4px var(--brand-tint-2); }
.step.now .lbl { color: var(--brand); }

/* ---- definition rows ---- */
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 5px 12px; font-size: .9rem; margin: 8px 0; }
.kv dt { color: var(--muted); font-size: .78rem; padding-top: 2px; font-weight: 600; }
.kv dd { margin: 0; }

/* ---- Custom Mochi assessment ---- */
.mochi-wrap { position: relative; }
.mochi-bg { position: absolute; inset: 0; color: var(--brand-tint); pointer-events: none; }
.mochi-bg svg { width: 100%; height: 100%; display: block; }
.mochi-pa {
  position: relative;
  display: grid; grid-template-columns: minmax(120px, 1fr) minmax(180px, 2fr) minmax(120px, 1fr);
  grid-template-rows: auto auto auto; gap: 8px;
  padding: 26px 34px 40px;
}
.pocket {
  background: rgba(255, 255, 255, .7); border: 2px dashed var(--brand-tint-2);
  border-radius: 16px; padding: 10px 8px; text-align: center;
}
.pocket.d { grid-row: span 3; display: flex; flex-direction: column; justify-content: center; }
/* outer pockets follow the pillow contour */
.pocket.p-d1 { border-radius: 60px 14px 14px 60px; padding-left: 14px; }
.pocket.p-d2 { border-radius: 14px 60px 60px 14px; padding-right: 14px; }
.pocket.p-b { border-radius: 30px 30px 12px 12px; }
.pocket.p-c { border-radius: 12px 12px 38px 38px; }
.pocket h4 { margin: 0 0 2px; font-size: .74rem; letter-spacing: .07em; text-transform: uppercase; color: var(--brand); }
.pocket .sub { font-size: .68rem; color: var(--muted); margin-bottom: 6px; }
.pocket .gram { width: 84px; text-align: center; margin: 0 auto; }
.pocket.hot { border-color: var(--brand); border-style: solid; }
.layerstack { display: flex; flex-direction: column; gap: 3px; margin: 4px 0; }
.layerstack .lay {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  background: #fff; border: 1.5px solid var(--brand-tint-2); border-radius: 9px;
  padding: 4px 7px 4px 11px; font-size: .76rem; font-weight: 700; color: var(--brand);
  min-height: 32px; text-align: left;
}
.layerstack .lay.thin { min-height: 21px; padding-top: 1px; padding-bottom: 1px; }
.layerstack .lay.mf { background: var(--brand-tint); }
.layerstack .lay button {
  min-height: 0; padding: 0; width: 20px; height: 20px; border-radius: 50%; flex: none;
  background: transparent; color: var(--bad); box-shadow: none; font-size: .68rem;
}
.stacksum { font-size: .72rem; color: var(--muted); font-weight: 700; margin: 3px 0 5px; }
.lay[draggable="true"] { cursor: grab; }
.lay .grip { color: var(--brand-tint-2); font-size: .8rem; flex: none; letter-spacing: -2px; }
.lay.dragging { opacity: .45; }
.lay.dragtarget { outline: 2px dashed var(--brand); outline-offset: 2px; }
select.addpad {
  min-height: 32px; padding: 4px 28px 4px 12px; font-size: .78rem; width: auto;
  border-radius: 999px; background: var(--brand-tint); border: none; color: var(--brand);
  font-weight: 700; cursor: pointer; margin-top: 2px;
}
.optrow { display: flex; gap: 8px; flex-wrap: wrap; }
.optrow button { flex: 1; min-width: 110px; }
.optrow button.off { background: var(--neutral-bg); color: var(--muted); box-shadow: none; }
.optrow button.off:hover { background: var(--brand-tint); color: var(--brand); }
.hline { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 7px 0; }
.hline .v { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ok); }
.hline .v.over { color: var(--bad); }
.guide-panel { background: var(--brand-tint); border-radius: 14px; padding: 12px 14px; font-size: .86rem; }
.guide-panel dt { color: var(--brand); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; margin-top: 8px; }
.guide-panel dd { margin: 1px 0 0; font-weight: 600; }

/* ---- phone view (mobile.html) ---- */
.mob { max-width: 680px; margin: 0 auto; padding: 0 12px 30px; }
.mob-head {
  position: sticky; top: 0; z-index: 20; background: var(--bg);
  padding: 10px 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 10px;
}
.mob-head .brand { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.mob-head .brand img { height: 26px; width: auto; }
.mob-head .brand .who { margin-left: auto; font-size: .78rem; color: var(--muted); font-weight: 700; }
.mob-daynav { display: flex; gap: 6px; align-items: center; }
.mob-daynav button { min-height: 40px; padding: 6px 14px; }
.mob-daynav input[type="date"] { flex: 1; min-height: 40px; }
.mob-appt {
  display: block; width: 100%; text-align: left; background: var(--pc-bg, var(--card));
  color: var(--text); border: 1px solid var(--pc-line, var(--line)); border-radius: 14px;
  padding: 10px 12px 10px 14px; margin-bottom: 8px; position: relative; overflow: hidden;
  box-shadow: var(--shadow); min-height: 0; font-weight: 500; font-size: .9rem;
}
.mob-appt::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 5px;
  background: var(--status-c, var(--muted));
}
.mob-appt .l1 { display: flex; gap: 8px; align-items: baseline; font-weight: 800; }
.mob-appt .l1 .time { font-variant-numeric: tabular-nums; }
.mob-appt .l2 { font-size: .78rem; color: var(--muted); margin-top: 1px; }
.mob-appt.blocked { background: repeating-linear-gradient(45deg, #eceaee, #eceaee 7px, #e0dde4 7px, #e0dde4 14px); }
.mob-fabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 25;
  display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--line);
}
.mob-fabbar button { flex: 1; }
.mob .card { padding: 12px 14px; }
.mob .statusrow { display: flex; gap: 6px; flex-wrap: wrap; }
.mob .statusrow button { flex: 1 1 30%; min-height: 44px; box-shadow: none; }
.mob-photos img { max-height: 120px; max-width: 46vw; border-radius: 10px; display: block; }
.mob-week { display: flex; gap: 2px; }
.mob-week .tcol { position: relative; width: 20px; flex: none; }
.mob-week .tcol span {
  position: absolute; right: 2px; font-size: .58rem; color: var(--muted); font-weight: 700;
}
.mob-wcol { flex: 1; min-width: 0; }
.mob-whd {
  display: block; width: 100%; min-height: 0; padding: 3px 0 4px; border-radius: 8px;
  background: var(--brand-tint); color: var(--brand); font-size: .64rem; font-weight: 800;
  box-shadow: none; line-height: 1.1; text-align: center;
}
.mob-whd span { display: block; font-size: .72rem; }
.mob-whd.today { background: var(--brand); color: #fff; }
.mob-wbody {
  position: relative; margin-top: 2px; background: #fff; border-radius: 8px; cursor: pointer;
  background-image: repeating-linear-gradient(to bottom, transparent 0 47px, var(--line) 47px 48px);
}
.mob-wapp {
  position: absolute; left: 1px; right: 1px; min-height: 0; padding: 0 2px; overflow: hidden;
  border-radius: 4px; background: var(--pc-bg); color: var(--text); font-size: .56rem;
  font-weight: 800; text-align: left; box-shadow: none;
  border: 1px solid var(--pc-line); border-left: 3px solid var(--status-c);
}
.mob-wapp.s-cancelled, .mob-wapp.s-no_show { opacity: .5; text-decoration: line-through; }
.mob-wapp.blocked { background: repeating-linear-gradient(45deg, #eceaee, #eceaee 5px, #e0dde4 5px, #e0dde4 10px); color: var(--muted); }

/* ---- login ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--brand) 0%, var(--brand-dark) 100%); padding: 16px; }
.login-card { background: #fff; border-radius: 20px; padding: 30px 32px; width: 100%; max-width: 400px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .35); }
.login-card .login-logo { display: block; width: 230px; max-width: 80%; height: auto; margin: 0 auto 6px; }

/* ---- print (FPO, customer invoice copy) ---- */
@media print {
  .sidebar, .topbar, .no-print, .toast { display: none !important; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
  .card { box-shadow: none; }
  body:has(.modal-backdrop) .shell { display: none !important; }
  .modal-backdrop { position: static; padding: 0; background: #fff; overflow: visible; display: block; backdrop-filter: none; }
  .modal { box-shadow: none; max-width: 100%; margin: 0; padding: 0; animation: none; }
  .modal .actions, .modal .modal-x { display: none !important; }
}

/* ---- responsive ---- */
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .sidebar nav a { padding: 7px 10px; }
  .cal { grid-template-columns: 40px repeat(7, minmax(80px, 1fr)); }
  .cal-scroll { overflow-x: auto; }
  .content { padding: 14px; }
}

/* ---- motion -------------------------------------------------------------
   Movement here is functional: screens settle in, controls answer the moment
   they are pressed, and anything that changed draws the eye for a moment.
   Nothing loops, nothing delays the work, and the whole layer switches off
   for anyone whose device asks for reduced motion (guard at the end).      */

/* A page settles in section by section. */
.content > * { animation: rise .3s cubic-bezier(.22, .9, .3, 1) backwards; }
.content > *:nth-child(1) { animation-delay: .02s; }
.content > *:nth-child(2) { animation-delay: .06s; }
.content > *:nth-child(3) { animation-delay: .1s; }
.content > *:nth-child(n+4) { animation-delay: .14s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* Controls answer the press. */
button:active:not(:disabled), .btn:active:not(:disabled) { transform: scale(.976); }
.sidebar nav a { transition: background .12s, color .12s, padding-left .14s ease; }
.sidebar nav a:hover { padding-left: 16px; }
.topbar .iconbtn { transition: background .12s, transform .12s; }
.topbar .iconbtn:active { transform: scale(.94); }
.card { transition: box-shadow .18s ease, border-color .18s ease; }
tr.click:hover { transition: background .12s; }

/* Numbers that just refreshed deserve a beat of attention. */
.kpi .v { animation: rise .42s .06s cubic-bezier(.22, .9, .3, 1) backwards; }

/* The backdrop fades so the modal does not arrive on a hard black flash. */
.modal-backdrop { animation: fade .14s ease-out; }
@keyframes fade { from { opacity: 0; } }

/* Calendar: blocks fade in when the day (re)loads — the confirmation that a
   drag, a status change or a new booking actually landed. Deliberately no
   movement, so nothing fights the drag-and-drop preview band. */
.cal .appt { animation: fade .16s ease-out; }
.cal .slot { transition: background .1s; }
.cal .slot.drop-top::after, .cal .slot.drop-bottom::after { animation: fade .1s ease-out; }

/* Builder stacks (Mochi pads, mattress layers) settle as they are edited. */
.stack .layer, .stack .side { animation: fade .14s ease-out; }

/* Status pills ease between colours instead of snapping. */
.badge { transition: background .18s ease, color .18s ease; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}

/* ---- Mattress station (iPad touch mode) ----------------------------------
   Chips replace dropdowns; every target is >= 48px; the price panel sticks.
   Each state re-asserts BOTH background and colour (cascade lesson learnt). */
.st-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr); gap: 16px; align-items: start; }
@media (max-width: 920px) { .st-grid { grid-template-columns: 1fr; } }
.st-chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 2px; }
.st-chip {
  background: var(--card); color: var(--text); border: 2px solid var(--line);
  border-radius: 16px; padding: 12px 18px; font-size: 1rem; font-weight: 600;
  min-height: 50px; cursor: pointer;
}
.st-chip:hover { background: var(--brand-tint); color: var(--text); }
.st-chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.st-chip.on:hover { background: var(--brand-dark); color: #fff; }
.st-chip:active { transform: scale(.97); }
.st-step { display: inline-flex; align-items: center; gap: 10px; }
.st-step button {
  width: 52px; height: 52px; border-radius: 14px; font-size: 1.5rem; padding: 0;
  background: var(--brand-tint-2); color: var(--brand); font-weight: 800;
}
.st-step button:hover { background: var(--brand-tint); color: var(--brand); }
.st-step .v { min-width: 84px; text-align: center; font-size: 1.2rem; font-weight: 800; }
.st-price { position: sticky; top: 12px; }
.st-total { font-size: 2.3rem; font-weight: 800; color: var(--brand); letter-spacing: -.02em; }
.st-select {
  font-size: 1rem; min-height: 48px; width: 100%;
}
.station-page h2 { font-size: 1.12rem; margin-top: 1.2rem; }
.station-page input[type="text"], .station-page input[type="number"] { font-size: 1.05rem; min-height: 48px; }
.st-level { border: 2px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 8px 0; background: var(--card); }
.st-level .lvhead { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.st-level .lvhead h3 { margin: 0; flex: 1; }
.st-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.st-split > div + div { border-left: 2px solid var(--line); padding-left: 14px; }

/* ---- calendar "now" line: red, moving with the clock ---- */
.cal .now-line {
  position: absolute; height: 0; border-top: 2px solid #dc2626;
  z-index: 5; pointer-events: none;
}
.cal .now-line::before {
  content: ""; position: absolute; left: -5px; top: -5px;
  width: 8px; height: 8px; border-radius: 50%; background: #dc2626;
}
.cal .now-line .now-time {
  position: absolute; left: -50px; top: -9px; font-size: .68rem;
  font-weight: 800; color: #fff; background: #dc2626;
  padding: 1px 5px; border-radius: 7px;
}
