/* Hire — rental radio bookings. Same look as SSAT: contour-ink slate, field-book sage, hi-vis yellow.
   The loud element here is the scanner's result banner; everything else stays quiet. */
:root {
  --ink: #1c2b2a;
  --ink-2: #4b5b59;
  --ink-3: #7b8a87;
  --paper: #ffffff;
  --sage: #eef1ec;
  --sage-2: #dfe5dc;
  --rule: #cfd8cc;
  --hivis: #e8c51a;
  --hivis-ink: #2a2400;
  --go: #2f7d4f;
  --warn: #b5651d;
  --stop: #a3232f;
  --radius: 6px;
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-num: "Barlow Condensed", "Barlow", system-ui, sans-serif;
  --header-h: 52px;
  --tabbar-h: 0px;
  --tent: #8a8f8c;
  --conf: #2f6f8f;
  --out: #c9861a;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--sage);
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--hivis); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 600; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ---------- header and navigation ---------- */
.topbar {
  height: var(--header-h);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1rem;
  background: var(--ink); color: #fff;
  position: sticky; top: 0; z-index: 1000;
}
.brand { display: flex; align-items: baseline; gap: .5rem; text-decoration: none; white-space: nowrap; }
.brand b { font-family: var(--font-num); font-size: 1.5rem; letter-spacing: .02em; color: var(--hivis); }
.brand span { font-size: .8rem; color: #c9d3cf; }
.nav { display: flex; gap: .25rem; flex: 1; }
.nav a {
  text-decoration: none; padding: .4rem .7rem; border-radius: var(--radius);
  color: #d7e0dc; font-weight: 500;
}
.nav a:hover { background: rgba(255,255,255,.08); }
.nav a[aria-current="page"] { color: #fff; box-shadow: inset 0 -3px 0 var(--hivis); border-radius: 0; }
.topbar .who { display: flex; align-items: center; gap: .75rem; font-size: .875rem; color: #c9d3cf; }
.topbar .who form { margin: 0; }
.topbar .who button { background: none; border: 1px solid #5c6e6b; color: #d7e0dc; border-radius: var(--radius); padding: .2rem .6rem; cursor: pointer; }

.tabbar { display: none; }
.topbar .who .admin-link { display: none; color: #d7e0dc; }

@media (max-width: 760px) {
  :root { --header-h: 48px; --tabbar-h: 60px; }
  .nav { display: none; }
  .brand span { display: none; }
  .topbar { justify-content: space-between; }
  .topbar .who .name { display: none; }
  .topbar .who .admin-link { display: inline; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--paper); border-top: 1px solid var(--rule);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-decoration: none; font-size: .78rem; color: var(--ink-2); gap: 2px;
  }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a[aria-current="page"] { color: var(--ink); font-weight: 700; box-shadow: inset 0 3px 0 var(--hivis); }
  main.page { padding-bottom: calc(var(--tabbar-h) + 1.5rem + env(safe-area-inset-bottom)); }
}

/* ---------- generic page ---------- */
main.page { max-width: 1000px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
main.page.wide { max-width: 1500px; }
main.page.narrow { max-width: 680px; }
.flashes { max-width: 1000px; margin: 1rem auto 0; padding: 0 1rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.panel { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.panel > h2:first-child { margin-top: 0; }
.panel.empty { color: var(--ink-2); text-align: center; padding: 2rem 1rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; align-items: start; }
@media (max-width: 620px) { .two { grid-template-columns: 1fr; } }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 40px; padding: .45rem .9rem; border-radius: var(--radius);
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink);
  font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #2b3f3d; }
.btn.hivis { background: var(--hivis); border-color: #c9a90b; color: var(--hivis-ink); }
.btn.danger { color: var(--stop); }
.btn.small { min-height: 32px; padding: .2rem .6rem; font-size: .875rem; }
.btn.big { min-height: 52px; padding: .6rem 1.4rem; font-size: 1.1rem; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.btn-row form, form.inline { display: inline; margin: 0; }
.linklike { background: none; border: 0; padding: 0; color: var(--ink-2); text-decoration: underline; cursor: pointer; font-size: .85rem; }
.linklike:hover { color: var(--stop); }
input[type=text], input[type=number], input[type=search], input[type=date], input[type=email], input[type=tel], select, textarea {
  width: 100%; padding: .5rem .6rem; border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--paper); min-height: 40px;
}
textarea { min-height: 80px; resize: vertical; }
label.field, div.field { display: block; margin-bottom: .75rem; }
.field > span { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
.field > span small { font-weight: 400; }
label.check { display: flex; gap: .5rem; align-items: flex-start; cursor: pointer; padding: .25rem 0; }
label.check input { width: 20px; height: 20px; flex: none; margin-top: .1rem; }
fieldset.plainset { border: 0; padding: 0; margin: 0 0 .75rem; }
fieldset.plainset legend { font-weight: 600; font-size: .9rem; padding: 0; margin-bottom: .25rem; }
table.grid { width: 100%; border-collapse: collapse; background: var(--paper); }
table.grid th, table.grid td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--sage-2); vertical-align: top; }
table.grid th { font-size: .85rem; color: var(--ink-2); font-weight: 600; background: var(--sage); white-space: nowrap; }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid tr.archived td { opacity: .55; }
.big-num { font-family: var(--font-num); font-size: 1.35rem; font-weight: 600; line-height: 1.1; }
.big-num.zero { color: var(--stop); }
.big-num.warn { color: var(--warn); }
.flash { padding: .6rem .9rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.flash.ok { background: #e6f2ea; border-color: #a9cdb5; }
.flash.error { background: #f8e6e7; border-color: #e0a9ae; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + 1rem + env(safe-area-inset-bottom));
  background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: var(--radius);
  z-index: 3000; max-width: calc(100% - 2rem); box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
.toast.error { background: var(--stop); }
ul.plain { list-style: none; margin: 0 0 .75rem; padding: 0; }
ul.plain li { padding: .35rem 0; border-bottom: 1px solid var(--sage-2); }
.history { list-style: none; margin: 0 0 .75rem; padding: 0; font-size: .92rem; max-height: 26rem; overflow-y: auto; }
.history li { padding: .45rem 0; border-bottom: 1px solid var(--sage-2); display: grid; grid-template-columns: 1fr auto; gap: .1rem 1rem; }
.history .when { color: var(--ink-2); font-size: .82rem; text-align: right; }
@media (max-width: 620px) { .history li { grid-template-columns: 1fr; } .history .when { text-align: left; } }
.pill { display: inline-block; border-radius: 999px; padding: .05rem .6rem; font-size: .8rem; font-weight: 700; white-space: nowrap; vertical-align: middle; }
.st-tentative { background: #e9ebea; color: #4d5351; outline: 1px dashed var(--tent); outline-offset: -1px; }
.st-confirmed { background: #dcebf2; color: #1f5670; }
.st-out { background: #fbf0d6; color: #8a5a08; }
.st-overdue { background: var(--stop); color: #fff; }
.st-returned { background: #e3f2e8; color: #23603c; }
.st-cancelled { background: #eee; color: var(--ink-3); }
.u-in_service { background: #e3f2e8; color: #23603c; }
.u-faulty, .u-lost { background: #fde3e5; color: var(--stop); }
.u-decommissioned { background: #eee; color: var(--ink-3); }
.seg { display: inline-flex; flex-wrap: wrap; gap: .4rem; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label, .chip {
  border: 1px solid var(--rule); border-radius: 999px; padding: .35rem .85rem; cursor: pointer; background: var(--paper);
  min-height: 38px; display: inline-flex; align-items: center; user-select: none; text-decoration: none; font-weight: 500;
}
.seg input:checked + label, .chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.seg input:focus-visible + label { outline: 3px solid var(--hivis); outline-offset: 2px; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; align-items: center; }
.filters input[type=search] { flex: 1 1 240px; width: auto; }
details.inline-edit { position: relative; display: inline-block; }
details.inline-edit > summary { list-style: none; }
details.inline-edit > summary::-webkit-details-marker { display: none; }
.edit-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; width: min(320px, 86vw); background: var(--paper);
  border: 1px solid var(--ink-3); border-radius: var(--radius); padding: .75rem; box-shadow: 0 8px 24px rgba(0,0,0,.18); text-align: left; }
.cat-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .5rem; }
.cat-head h2 { margin: 0; }
.add-line { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: flex-end; margin-top: 1rem; }
.add-line .field { margin: 0; }
.add-line .grow { flex: 1 1 200px; }
.add-line .qty { flex: 0 0 6.5rem; }
.avail-hint { flex-basis: 100%; margin: 0; min-height: 1.3em; }
.avail { font-size: .85rem; font-weight: 600; margin-top: .15rem; }
.avail.ok { color: var(--go); font-weight: 500; }
.avail.tight { color: var(--warn); }
.avail.short { color: var(--stop); }
.avail a { font-weight: 600; }
.login { max-width: 420px; margin: 12vh auto 0; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 2rem; }
.login .brand b { font-size: 2.6rem; color: var(--ink); }
.login .brand { display: block; margin-bottom: .25rem; }
.login p { color: var(--ink-2); }
code { background: var(--sage); padding: 0 .3rem; border-radius: 3px; }

/* ---------- job list ---------- */
.joblist { list-style: none; margin: 0; padding: 0; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); }
.joblist li + li { border-top: 1px solid var(--sage-2); }
.joblist a { display: grid; grid-template-columns: 1fr auto; gap: .15rem .75rem; padding: .7rem .9rem; text-decoration: none; }
.joblist a:hover { background: #f7f9f6; }
.jl-main b { font-family: var(--font-num); font-size: 1.1rem; margin-right: .35rem; }
.jl-dates { grid-column: 1 / -1; font-weight: 500; }
.jl-sum { grid-column: 1 / -1; }

/* ---------- job page ---------- */
.job-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: .75rem; }
.job-head h1 { margin: .15rem 0; }
.job-head p { margin: .15rem 0; }
.job-dates { font-size: 1.1rem; font-weight: 600; }
.job-notes { white-space: pre-wrap; background: #fbf7df; border-left: 4px solid var(--hivis); padding: .4rem .7rem; }
.job-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.job-actions form { margin: 0; }
table.lines .prog { color: var(--ink-2); }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions form { display: inline-block; margin: 0 0 0 .25rem; }
.unit-chips { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.unit-chips li { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--rule); border-radius: var(--radius); padding: .2rem .55rem; background: var(--paper); }
.unit-chips li a { font-family: var(--font-num); font-size: 1.1rem; font-weight: 600; text-decoration: none; }
.unit-chips li.returned { background: var(--sage); }
.unit-chips li.returned a { color: var(--ink-2); }
.unit-chips form { margin: 0; display: inline; }
.tag { font-size: .72rem; font-weight: 700; color: var(--go); text-transform: uppercase; letter-spacing: .03em; }
.tag.bad { color: var(--stop); }
.copy-link { display: flex; gap: .5rem; margin: .5rem 0 .75rem; }
.copy-link input { font-size: .85rem; color: var(--ink-2); }
.contract-send { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: flex-end; }
.contract-send .field { margin: 0; flex: 1 1 240px; }

/* ---------- stock ---------- */
.stock-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 1rem; align-items: start; }
.tree { padding: .5rem; position: sticky; top: calc(var(--header-h) + .75rem); max-height: calc(100dvh - var(--header-h) - 1.5rem); overflow-y: auto; }
.tree summary { display: none; }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree a { display: flex; justify-content: space-between; gap: .5rem; padding: .35rem .6rem; border-radius: var(--radius); text-decoration: none; }
.tree a:hover { background: var(--sage); }
.tree a.d0 { font-weight: 700; margin-top: .35rem; }
.tree a.empty { color: var(--ink-3); }
.tree a[aria-current="true"] { background: var(--ink); color: #fff; }
.tree .n { font-family: var(--font-num); color: var(--ink-3); }
.tree a[aria-current="true"] .n { color: #c9d3cf; }
@media (max-width: 899px) {
  .stock-layout { grid-template-columns: 1fr; }
  .tree { position: static; max-height: none; }
  .tree summary { display: block; cursor: pointer; font-weight: 700; padding: .35rem .6rem; }
  .tree summary::after { content: " ▾"; color: var(--ink-3); }
  .tree a { min-height: 40px; align-items: center; }
}
.date-search .field.grow { flex: 1 1 14rem; }
.cat-manage li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.line-notes { color: var(--ink); }
.add-line .wide { flex: 1 1 100%; }
.prefixed { display: flex; align-items: stretch; }
.prefixed > span { display: flex; align-items: center; padding: 0 .6rem; background: var(--sage); border: 1px solid var(--rule); border-right: 0;
  border-radius: var(--radius) 0 0 var(--radius); font-weight: 700; margin: 0; }
.field > span.prefixed { display: flex; font-weight: 400; font-size: 1rem; margin: 0; }
.prefixed > input { border-radius: 0 var(--radius) var(--radius) 0; }
.date-search { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: flex-end; }
.date-search .field { margin: 0; flex: 0 1 11rem; }
.date-search .check { min-height: 40px; align-items: center; }
table.stock td:first-child { width: 50%; }
.tight-dot { display: inline-block; margin-left: .25rem; color: var(--warn); font-weight: 700; cursor: help; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 1rem; text-align: center; }
.stat-row div { padding: .6rem .4rem; }
.stat-row div + div { border-left: 1px solid var(--rule); }
.stat-row b { display: block; font-family: var(--font-num); font-size: 2rem; line-height: 1; }
.stat-row span { font-size: .82rem; color: var(--ink-2); }
.status-form textarea { min-height: 60px; }

/* ---------- calendar ---------- */
.today-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.today-group { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: .6rem .8rem; border-top: 4px solid var(--conf); }
.today-group.overdue { border-top-color: var(--stop); }
.today-group.due { border-top-color: var(--out); }
.today-group h3 { margin: 0 0 .25rem; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.today-group a { display: block; text-decoration: none; padding: .15rem 0; }
.today-group a b { font-family: var(--font-num); }
.cal-controls { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.cal-controls select { width: auto; }
.cal-wrap { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); overflow: auto; position: relative; max-height: 72vh; }
.cal { position: relative; --day-w: 38px; --lane-h: 34px; --label-w: 0px; }
.cal-days { display: flex; position: sticky; top: 0; z-index: 5; background: var(--sage); border-bottom: 1px solid var(--rule); margin-left: var(--label-w); }
.cal-day { flex: 0 0 var(--day-w); text-align: center; font-size: .72rem; color: var(--ink-2); padding: .25rem 0; border-left: 1px solid var(--sage-2); line-height: 1.2; }
.cal-day b { display: block; font-family: var(--font-num); font-size: 1rem; color: var(--ink); }
.cal-day.we { background: #e4e9e1; }
.cal-day.today { background: var(--hivis); color: var(--hivis-ink); }
.cal-day.m1 { border-left: 2px solid var(--ink-3); }
.cal-body { position: relative; min-height: 120px;
  background-image: linear-gradient(to right, var(--sage-2) 1px, transparent 1px); background-size: var(--day-w) 100%; }
.cal-today-line { position: absolute; top: 0; bottom: 0; width: var(--day-w); background: rgba(232, 197, 26, .16); pointer-events: none; }
.cal-bar { position: absolute; height: calc(var(--lane-h) - 6px); border-radius: 5px; padding: 0 .5rem; display: flex; align-items: center; gap: .4rem;
  text-decoration: none; overflow: hidden; white-space: nowrap; font-size: .85rem; color: #fff; background: var(--conf); border: 1px solid rgba(0,0,0,.15); }
.cal-bar b { font-family: var(--font-num); font-weight: 600; }
.cal-bar span { overflow: hidden; text-overflow: ellipsis; }
.cal-bar.tentative { background: repeating-linear-gradient(135deg, #a3a8a5, #a3a8a5 8px, #8f9491 8px, #8f9491 16px); }
.cal-bar.out { background: var(--out); }
.cal-bar.overdue { background: var(--stop); }
.cal-bar.returned { background: #9bbfa8; }
.cal-bar.open-end { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 3px dashed #fff; }
.cal-bar.cut-end { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cal-bar.cut-start { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.cal-bar:hover, .cal-bar:focus-visible { filter: brightness(1.1); z-index: 3; }
.cal-title { font-family: var(--font-num); font-size: 1.35rem; font-weight: 600; margin: 0; min-width: 11rem; }
.weeks { min-width: 640px; }
.wk-head, .wk-days { display: grid; grid-template-columns: repeat(7, 1fr); }
.wk-head { position: sticky; top: 0; z-index: 5; background: var(--sage); border-bottom: 1px solid var(--rule); }
.wk-head div { padding: .3rem .5rem; font-size: .8rem; font-weight: 600; color: var(--ink-2); border-left: 1px solid var(--sage-2); }
.wk { position: relative; border-bottom: 1px solid var(--rule); padding-top: 30px; }
.wk-days { position: absolute; inset: 0; }
.wk-day { border-left: 1px solid var(--sage-2); padding: .2rem .4rem; display: flex; justify-content: space-between; align-items: flex-start; }
.wk-day .dom { font-family: var(--font-num); font-size: 1.05rem; font-weight: 600; line-height: 1.3; }
.wk-day.other { background: #f3f5f1; } .wk-day.other .dom { color: var(--ink-3); font-weight: 500; }
.wk-day.we { background: #f3f5f1; }
.wk-day.today { background: rgba(232, 197, 26, .2); }
.wk-day.today .dom { background: var(--hivis); color: var(--hivis-ink); border-radius: 999px; padding: 0 .45rem; }
.wk-day .add { text-decoration: none; color: var(--ink-3); font-weight: 700; width: 24px; height: 24px; display: grid; place-content: center; border-radius: 50%; opacity: 0; }
.wk-day:hover .add, .wk-day .add:focus-visible { opacity: 1; background: var(--sage-2); color: var(--ink); }
@media (hover: none) { .wk-day .add { opacity: .7; } }
.wk-bars { position: relative; }
.weeks .cal-bar { height: calc(var(--lane-h) - 4px); }
.weeks.week-view { --lane-h: 50px; }
.weeks.week-view .cal-bar { flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; line-height: 1.25; }
.weeks.week-view .cal-bar span { max-width: 100%; }
.weeks.month-view { --lane-h: 26px; }
.weeks.month-view .cal-bar { font-size: .8rem; padding: 0 .35rem; }
.cal-key { margin-top: .5rem; display: flex; flex-wrap: wrap; gap: .25rem .9rem; align-items: center; }
.cal-key .key { display: inline-block; width: .9rem; height: .9rem; border-radius: 3px; margin-right: .3rem; vertical-align: -2px; background: var(--conf); }
.cal-key .key.tentative { background: #a3a8a5; } .cal-key .key.out { background: var(--out); }
.cal-key .key.overdue { background: var(--stop); } .cal-key .key.returned { background: #9bbfa8; }
table.cal-types { border-collapse: separate; border-spacing: 0; font-size: .85rem; }
table.cal-types th, table.cal-types td { border-bottom: 1px solid var(--sage-2); border-left: 1px solid var(--sage-2); padding: .25rem 0; text-align: center; min-width: 38px; font-variant-numeric: tabular-nums; }
table.cal-types thead th { position: sticky; top: 0; z-index: 4; background: var(--sage); font-weight: 400; font-size: .72rem; color: var(--ink-2); line-height: 1.2; }
table.cal-types thead th b { display: block; font-family: var(--font-num); font-size: 1rem; color: var(--ink); }
table.cal-types thead th.today { background: var(--hivis); }
table.cal-types th.name { position: sticky; left: 0; z-index: 3; background: var(--paper); text-align: left; padding: .3rem .6rem; white-space: nowrap; font-weight: 600; min-width: 150px; border-left: 0; }
table.cal-types thead th.name { z-index: 6; background: var(--sage); }
table.cal-types th.name a { text-decoration: none; }
table.cal-types tr.cat th { background: var(--sage); text-align: left; padding: .25rem .6rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); position: sticky; left: 0; }
table.cal-types td { font-family: var(--font-num); font-size: 1rem; }
table.cal-types td.low { background: #fbf0d6; color: #8a5a08; font-weight: 600; }
table.cal-types td.none { background: #fde3e5; color: var(--stop); font-weight: 700; }
table.cal-types td.past { color: var(--ink-3); background: #f6f7f5; }

/* ---------- scanner ---------- */
main.page.scan-page { max-width: 640px; }
.scan-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: .5rem; }
.scan-head h1, .scan-head p { margin: 0; }
.viewfinder { position: relative; background: #0d1514; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; max-height: 46vh; width: 100%;
  outline: 6px solid transparent; outline-offset: -6px; transition: outline-color .12s; }
.viewfinder video { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .15s; }
.viewfinder.zoomed video { transform: scale(2); }
.viewfinder.zoomed .reticle { width: min(78%, 330px); }
@media (prefers-reduced-motion: reduce) { .viewfinder video { transition: none; } }
.viewfinder.flash-ok { outline-color: #37d67a; }
.viewfinder.flash-warn { outline-color: var(--hivis); }
.viewfinder.flash-bad { outline-color: #ff3b4e; }
.reticle { position: absolute; left: 50%; top: 50%; width: min(56%, 240px); aspect-ratio: 1; transform: translate(-50%, -50%);
  border: 2px solid rgba(255,255,255,.75); border-radius: 12px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.18); pointer-events: none; }
.cam-off { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: .5rem; background: #0d1514; color: #d7e0dc; text-align: center; padding: 1rem; }
.cam-off.hidden + .cam-tools { display: flex; }
.cam-tools { position: absolute; right: .5rem; left: .5rem; bottom: .5rem; display: flex; gap: .4rem; justify-content: flex-end; flex-wrap: wrap; }
.cam-tools .btn { background: rgba(13,21,20,.75); color: #fff; border-color: rgba(255,255,255,.4); }
.cam-tools .btn[aria-pressed="true"] { background: var(--hivis); color: var(--hivis-ink); }
.last-scan { margin: .6rem 0; padding: .7rem .9rem; border-radius: var(--radius); background: var(--paper); border: 1px solid var(--rule);
  min-height: 64px; display: flex; align-items: center; gap: .75rem; }
.last-scan .code { font-family: var(--font-num); font-size: 2rem; font-weight: 700; line-height: 1; }
.last-scan .code { max-width: 62%; overflow-wrap: anywhere; }
.last-scan .what { line-height: 1.25; min-width: 0; }
.last-scan.ok { background: #1f7a48; border-color: #1f7a48; color: #fff; }
.last-scan.warn { background: var(--hivis); border-color: #c9a90b; color: var(--hivis-ink); }
.last-scan.bad { background: var(--stop); border-color: var(--stop); color: #fff; }
.ask { background: var(--paper); border: 2px solid var(--ink); border-radius: var(--radius); padding: .8rem .9rem; margin-bottom: .6rem; }
.ask p { margin: 0 0 .6rem; font-weight: 600; }
.ask #ask-fields > * { margin-bottom: .6rem; }
.ask #ask-fields input { font-family: var(--font-num); font-size: 1.5rem; font-weight: 600; min-height: 52px; }
.pending { display: flex; gap: .75rem; align-items: center; justify-content: space-between; background: #fbf7df; border: 1px solid #c9a90b;
  border-radius: var(--radius); padding: .5rem .75rem; margin-bottom: .6rem; }
.manual { display: flex; gap: .5rem; margin-bottom: .75rem; }
.progress { display: grid; gap: .35rem; margin-bottom: .75rem; }
.prog-row { display: grid; grid-template-columns: 1fr auto; gap: .1rem .75rem; align-items: baseline; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: .45rem .7rem; }
.prog-row .n { font-family: var(--font-num); font-size: 1.4rem; font-weight: 700; }
.prog-row .bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--sage-2); overflow: hidden; }
.prog-row .bar i { display: block; height: 100%; background: var(--conf); }
.prog-row.done .bar i { background: var(--go); }
.prog-row.done .n { color: var(--go); }
.prog-row.over .n { color: var(--warn); }
.bulk-row { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: center; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: .45rem .7rem; margin-bottom: .35rem; }
.stepper { display: inline-flex; align-items: center; gap: .25rem; }
.stepper button { width: 44px; height: 44px; border-radius: var(--radius); border: 1px solid var(--rule); background: var(--paper); font-size: 1.4rem; font-weight: 700; cursor: pointer; }
.stepper input { width: 4.2rem; text-align: center; font-family: var(--font-num); font-size: 1.3rem; font-weight: 700; min-height: 44px; }
.list-title { font-size: 1rem; margin-top: 1rem; }
.scan-list { list-style: none; margin: 0; padding: 0; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); }
.scan-list:empty { display: none; }
.scan-list li { display: grid; grid-template-columns: auto 1fr auto; gap: .75rem; align-items: center; padding: .45rem .7rem; }
.scan-list li + li { border-top: 1px solid var(--sage-2); }
.scan-list .code { font-family: var(--font-num); font-size: 1.35rem; font-weight: 700; min-width: 3.2rem; }
.scan-list .meta { font-size: .85rem; color: var(--ink-2); line-height: 1.25; }
.scan-list li.new { animation: newrow 1.2s ease-out; }
@keyframes newrow { from { background: #d8f0e1; } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .scan-list li.new { animation: none; } }
.scan-foot { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); background: var(--sage); padding: .75rem 0; margin-top: 1rem;
  display: flex; justify-content: space-between; gap: .75rem; z-index: 10; }
dialog.sheet { border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem; width: min(440px, calc(100% - 2rem)); }
dialog.sheet::backdrop { background: rgba(10, 18, 17, .5); }

/* ---------- customer signing page ---------- */
.sign-body { background: var(--sage); }
.sign-doc { max-width: 760px; margin: 0 auto; background: var(--paper); padding: 1.5rem 1.25rem 3rem; min-height: 100%; }
@media (min-width: 800px) { .sign-doc { margin: 2rem auto; border: 1px solid var(--rule); border-radius: var(--radius); padding: 2.5rem; min-height: 0; } }
.sign-top { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 2px solid var(--ink); padding-bottom: .75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.sign-title { text-align: right; }
.sign-title h1 { margin: 0; }
.sign-doc h2 { margin-top: 1.5rem; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0 0 1rem; }
dl.facts dt { color: var(--ink-2); }
dl.facts dd { margin: 0; font-weight: 500; }
.pre { white-space: pre-wrap; }
.terms { font-size: .95rem; }
.sign-form { border-top: 2px solid var(--ink); margin-top: 2rem; }
.sig-wrap { position: relative; border: 2px dashed var(--ink-3); border-radius: var(--radius); background: #fff; }
.sig-wrap canvas { display: block; width: 100%; height: 180px; touch-action: none; cursor: crosshair; }
.sig-wrap .btn { position: absolute; right: .4rem; top: .4rem; }
@media print { .sign-form, .btn { display: none !important; } .sign-doc { border: 0; margin: 0; } }
