/* Themes. Dark is the default; the sidebar picker switches and remembers the choice per browser.
   Every component below reads these variables, so a theme only sets colours. */
:root {                                   /* Vivid — default: dark with bright blue / violet */
  --bg: #0b0d1a; --bg-glow: rgba(99, 102, 241, .22); --bg-glow2: rgba(236, 72, 153, .14);
  --card: #13172e; --card-border: rgba(255, 255, 255, .085); --card-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 12px 32px -16px rgba(0, 0, 0, .8);
  --ink: #f7f8ff; --muted: #c6cbea; --line: #2a3158;
  --input-bg: #0f1227; --input-border: #303866; --thead-bg: #181d3b; --row-hover: #1b2044; --warn-row: #2f2612;
  --ro-bg: #1a1e3a; --code-bg: #22284e;
  --brand: #8ab4ff; --brand-ink: #ffffff; --brand-soft: rgba(138, 180, 255, .16);
  --btn-bg: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%); --btn-shadow: 0 8px 22px -8px rgba(139, 92, 246, .75); --focus: rgba(138, 180, 255, .38);
  --brand-text: linear-gradient(90deg, #60a5fa, #a78bfa 55%, #f472b6);
  --side: #0a0c1d; --side-ink: #e2e6ff; --side-hover: rgba(255, 255, 255, .06); --side-active-bg: linear-gradient(135deg, #3b82f6, #8b5cf6); --side-active-ink: #fff;
  --group-ink: #c4b5fd;
  --ok: #4ade80; --warn: #fbbf24; --bad: #fb7185; --info: #60a5fa;
  --c-blue: #60a5fa; --c-violet: #a78bfa; --c-cyan: #22d3ee; --c-emerald: #34d399; --c-orange: #fb923c; --c-pink: #f472b6;
  --glass-bg: rgba(255, 255, 255, .07); --glass-bg-hover: rgba(255, 255, 255, .12); --glass-tint: rgba(138, 180, 255, .10);
  --glass-rim-hi: rgba(255, 255, 255, .55); --glass-rim-lo: rgba(255, 255, 255, .10); --glass-spec: rgba(255, 255, 255, .32);
  --glass-shine: rgba(255, 255, 255, .26); --glass-shadow: 0 12px 32px -14px rgba(0, 0, 0, .85), 0 1px 2px rgba(0, 0, 0, .4);
}
html[data-theme="dark"] {                 /* Dark — graphite with a warm gold accent; one colour, used sparingly */
  --bg: #0b0c0f; --bg-glow: rgba(230, 189, 112, .07); --bg-glow2: rgba(255, 255, 255, .025);
  --card: #141619; --card-border: rgba(255, 255, 255, .07); --card-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 12px 30px -16px rgba(0, 0, 0, .85);
  --ink: #ededf0; --muted: #a3a8b4; --line: #24272d;
  --input-bg: #0f1114; --input-border: #2f333a; --thead-bg: #191c21; --row-hover: #1b1e24; --warn-row: #2b2410;
  --ro-bg: #1a1d22; --code-bg: #1f2329;
  --brand: #e6bd70; --brand-ink: #111114; --brand-soft: rgba(230, 189, 112, .14);
  --btn-bg: #f2f2f4; --btn-shadow: 0 6px 18px -12px rgba(255, 255, 255, .35); --focus: rgba(230, 189, 112, .4);
  --btn-secondary: #d8dae0; --accent-bar: #e6bd70; --nav-active-shadow: inset 3px 0 0 #e6bd70;
  --brand-text: #ffffff;
  --side: #08090b; --side-ink: #c9ccd4; --side-hover: rgba(255, 255, 255, .05); --side-active-bg: rgba(255, 255, 255, .08); --side-active-ink: #ffffff;
  --group-ink: #8b8f99;
  --ok: #4ade80; --warn: #fb923c; --bad: #fb7185; --info: #93c5fd;
  --c-blue: #e6bd70; --c-violet: #e6bd70; --c-cyan: #e6bd70; --c-emerald: #e6bd70; --c-orange: #fb923c; --c-pink: #fb7185;
  --glass-bg: rgba(255, 255, 255, .06); --glass-bg-hover: rgba(255, 255, 255, .10); --glass-tint: rgba(230, 189, 112, .08);
  --glass-rim-hi: rgba(255, 255, 255, .45); --glass-rim-lo: rgba(255, 255, 255, .08); --glass-spec: rgba(255, 255, 255, .26);
  --glass-shine: rgba(255, 244, 214, .22); --glass-shadow: 0 12px 32px -14px rgba(0, 0, 0, .9), 0 1px 2px rgba(0, 0, 0, .5);
}
html[data-theme="indigo"] {               /* Indigo — light */
  --bg: #f5f5fb; --bg-glow: rgba(79, 70, 229, .08); --bg-glow2: transparent; --card: #fff; --card-border: #e1e0ee; --card-shadow: 0 1px 2px rgba(30, 27, 75, .06);
  --ink: #14112e; --muted: #4a4868; --line: #e2e1ee;
  --input-bg: #fff; --input-border: #c9c8dc; --thead-bg: #f2f1fa; --row-hover: #eeedfa; --warn-row: #fff6e0; --ro-bg: #efeff6; --code-bg: #e7e6f4;
  --brand: #4f46e5; --brand-ink: #fff; --brand-soft: #dfe2fb; --btn-bg: #4f46e5; --btn-shadow: none; --focus: rgba(79, 70, 229, .3);
  --brand-text: #fff; --group-ink: currentColor;
  --side: #1e1b4b; --side-ink: #eeedfc; --side-hover: rgba(255, 255, 255, .08); --side-active-bg: #6366f1; --side-active-ink: #fff;
  --ok: #1a7f4b; --warn: #b7791f; --bad: #b42318; --info: #4f46e5;
  --c-blue: #2563eb; --c-violet: #7c3aed; --c-cyan: #0891b2; --c-emerald: #059669; --c-orange: #ea580c; --c-pink: #db2777;
  --glass-bg: rgba(255, 255, 255, .52); --glass-bg-hover: rgba(255, 255, 255, .68); --glass-tint: rgba(79, 70, 229, .06);
  --glass-rim-hi: rgba(255, 255, 255, .95); --glass-rim-lo: rgba(30, 27, 75, .14); --glass-spec: rgba(255, 255, 255, .9);
  --glass-shine: rgba(255, 255, 255, .75); --glass-shadow: 0 10px 28px -14px rgba(30, 27, 75, .35), 0 1px 2px rgba(30, 27, 75, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14.5px/1.5 "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; color: var(--ink);
  background: radial-gradient(1100px 560px at 12% -10%, var(--bg-glow), transparent 60%), radial-gradient(900px 500px at 100% 100%, var(--bg-glow2), transparent 60%), var(--bg);
  background-attachment: fixed;
  display: flex; min-height: 100vh; -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 23px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 4px; }
h2 { font-size: 15px; font-weight: 650; margin: 20px 0 10px; display: flex; align-items: center; gap: 8px; } h2:first-child { margin-top: 0; }
.card > h2::before, .card > div > h2::before, .cols h2::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: var(--accent-bar, var(--btn-bg)); flex: none; }
p { margin: 0 0 8px; } .muted { color: var(--muted); } .small { font-size: 12px; font-weight: normal; } .nowrap { white-space: nowrap; }
code { background: var(--code-bg); padding: 1px 6px; border-radius: 4px; font-size: 13px; }

/* Sidebar */
nav.side { width: 228px; flex: 0 0 228px; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--card-border); }
nav.side .brand { padding: 22px 20px 12px; display: flex; flex-direction: column; gap: 2px; }
nav.side .brand a { color: #fff; font-weight: 800; font-size: 17px; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
nav.side .brand a b { background: var(--brand-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
nav.side .brand a::before { content: ""; width: 28px; height: 28px; border-radius: 8px; background: url(icon.svg) center / contain no-repeat; box-shadow: 0 0 0 3px var(--brand-soft); flex: none; }
nav.side .brand span { font-size: 11px; opacity: .85; padding-left: 36px; }
nav.side ul { list-style: none; margin: 8px 0 0; padding: 0 12px; flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .18) transparent; }
nav.side li.group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--group-ink); opacity: .95; padding: 16px 10px 5px; }
nav.side li a { display: block; padding: 7px 12px; border-radius: 8px; color: var(--side-ink); font-weight: 500; transition: background .15s, color .15s; }
nav.side li a:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
nav.side li a.active { background: var(--side-active-bg); color: var(--side-active-ink); font-weight: 600; box-shadow: var(--nav-active-shadow, var(--btn-shadow)); }
nav.side ul { padding-bottom: 16px; }
main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
main > .content { padding: 20px 32px 56px; flex: 1; }
body.anon main { align-items: center; justify-content: center; } body.anon main > .content { flex: none; }

/* Top bar: where the page is, and the account menu at the top right */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 32px; background: color-mix(in srgb, var(--bg) 76%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.topbar.scrolled { border-bottom-color: var(--card-border); }
.crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb .sep { color: var(--muted); opacity: .5; } .crumb strong { font-weight: 600; }
.topright { display: flex; align-items: center; gap: 10px; flex: none; }

/* Liquid glass, as on iOS: a translucent blurred fill with a refractive rim, a specular edge along the
   top, a highlight that follows the pointer, and a springy press. Used for the floating controls only. */
.glass { position: relative; isolation: isolate; overflow: hidden; border: 0; background: linear-gradient(180deg, var(--glass-spec) 0%, transparent 38%) top / 100% 100% no-repeat, linear-gradient(135deg, var(--glass-tint), transparent 60%), var(--glass-bg);
  -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%);
  box-shadow: inset 0 1px 0 var(--glass-spec), inset 0 -1px 0 rgba(0, 0, 0, .12), var(--glass-shadow);
  transition: background-color .25s, box-shadow .25s, transform .35s cubic-bezier(.2, 1.4, .4, 1); }
.glass::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(135deg, var(--glass-rim-hi) 0%, var(--glass-rim-lo) 38%, var(--glass-rim-lo) 62%, var(--glass-rim-hi) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude; }
.glass::after { content: ""; position: absolute; inset: -60%; pointer-events: none; opacity: 0; transition: opacity .35s;
  background: radial-gradient(closest-side, var(--glass-shine), transparent 70%); transform: translate(calc(var(--mx, 50%) - 50%), calc(var(--my, 50%) - 50%)); }
.glass:hover { background-color: var(--glass-bg-hover); } .glass:hover::after { opacity: 1; }
.glass:active { transform: scale(.96); transition-duration: .08s; }
.glass > * { position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) { .glass, .glass::after { transition: none; } .glass:active { transform: none; } }

.topbtn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px 8px 12px; border-radius: 999px; color: var(--ink); font-size: 13px; font-weight: 500; }
.topbtn svg { width: 17px; height: 17px; color: var(--brand); } .topbtn:hover { text-decoration: none; }
.topbtn.active { color: var(--brand); box-shadow: inset 0 1px 0 var(--glass-spec), inset 0 -1px 0 rgba(0, 0, 0, .12), 0 0 0 2px var(--focus), var(--glass-shadow); }
.topbtn:focus-visible { outline: none; box-shadow: inset 0 1px 0 var(--glass-spec), 0 0 0 3px var(--focus), var(--glass-shadow); }
details.account { position: relative; flex: none; }
details.account > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: 999px; cursor: pointer; user-select: none; }
details.account > summary::-webkit-details-marker { display: none; }
details.account[open] > summary { background-color: var(--glass-bg-hover); }
details.account > summary:focus-visible { outline: none; box-shadow: inset 0 1px 0 var(--glass-spec), 0 0 0 3px var(--focus), var(--glass-shadow); }
details.account .who { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
details.account .who strong { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
details.account .who .muted { font-size: 11.5px; text-transform: capitalize; }
details.account .chev { width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin: -4px 2px 0 2px; transition: transform .15s, margin .15s; }
details.account[open] .chev { transform: rotate(-135deg); margin-top: 4px; }
details.account .menu { position: absolute; right: 0; top: calc(100% + 8px); width: 292px; padding: 8px; border-radius: 18px; z-index: 30; animation: menu-in .22s cubic-bezier(.2, 1.2, .4, 1); transform-origin: top right;
  background: linear-gradient(180deg, var(--glass-spec) 0%, transparent 12%) top / 100% 100% no-repeat, linear-gradient(135deg, var(--glass-tint), transparent 60%), color-mix(in srgb, var(--card) 90%, transparent);
  -webkit-backdrop-filter: blur(40px) saturate(180%); backdrop-filter: blur(40px) saturate(180%);
  box-shadow: inset 0 1px 0 var(--glass-spec), 0 30px 60px -18px rgba(0, 0, 0, .75), var(--glass-shadow); }
details.account .menu::after { display: none; } details.account .menu:active { transform: none; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-8px) scale(.96); } to { opacity: 1; transform: none; } }
.menu-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head .text { display: flex; flex-direction: column; gap: 2px; min-width: 0; } .menu-head strong { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .menu-head .muted { font-size: 12.5px; }
.menu-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 10px; border-radius: 9px; color: var(--ink); background: none; border: 0; font: inherit; font-weight: 500; text-align: left; cursor: pointer; transition: background .12s; }
.menu-item:hover { background: var(--row-hover); text-decoration: none; } .menu-item:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.menu-item svg { width: 17px; height: 17px; flex: none; color: var(--muted); } .menu-item:hover svg { color: var(--brand); }
.menu-item.danger { color: var(--bad); } .menu-item.danger svg, .menu-item.danger:hover svg { color: var(--bad); }
.menu-theme { padding: 10px 10px 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 6px 0; }
.menu-theme .label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.theme-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.theme-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 9px 4px 7px; border-radius: 10px; border: 1px solid var(--card-border); background: var(--input-bg); color: var(--ink); font: inherit; font-size: 12px; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.theme-opt:hover { border-color: var(--brand); } .theme-opt.active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--focus); font-weight: 600; }
.sw { width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25), 0 1px 3px rgba(0, 0, 0, .4); }
.sw-vivid { background: conic-gradient(from 210deg, #0b0d1a 0 50%, #3b82f6 50% 76%, #a855f7 76% 100%); }
.sw-dark { background: conic-gradient(from 210deg, #0b0c0f 0 62%, #e6bd70 62% 82%, #f2f2f4 82% 100%); }
.sw-indigo { background: conic-gradient(from 210deg, #f5f5fb 0 55%, #4f46e5 55% 80%, #1e1b4b 80% 100%); }
.menu-signout { margin-top: 2px; }

/* Page chrome */
header.page { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
header.page .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--card-border); border-radius: 12px; padding: 20px 22px; box-shadow: var(--card-shadow); }
.card.plain { border: 0; padding: 0; box-shadow: none; } .card.narrow { max-width: 420px; }
.btn { display: inline-block; background: var(--btn-bg); color: var(--brand-ink); border: 1px solid transparent; border-radius: 8px; padding: 8px 15px; font: inherit; font-weight: 600; cursor: pointer; line-height: 1.2; box-shadow: var(--btn-shadow); transition: filter .15s, transform .05s; }
.btn:hover { filter: brightness(1.08); text-decoration: none; } .btn:active { transform: translateY(1px); }
.btn.secondary { background: transparent; color: var(--btn-secondary, var(--brand)); border-color: var(--btn-secondary, var(--brand)); font-weight: 500; box-shadow: none; } .btn.secondary:hover { background: var(--brand-soft); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.tiny { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
button.link { background: none; border: 0; padding: 0; color: #fff; font: inherit; cursor: pointer; text-decoration: underline; }
form.inline { display: inline; }
.flashes { margin-bottom: 14px; } .flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; border: 1px solid; }
.flash.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); border-color: color-mix(in srgb, var(--ok) 40%, transparent); color: var(--ink); }
.flash.error { background: color-mix(in srgb, var(--bad) 14%, transparent); border-color: color-mix(in srgb, var(--bad) 45%, transparent); color: var(--ink); }
.flash.info { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 45%, transparent); color: var(--ink); }
.hint { background: color-mix(in srgb, var(--warn) 12%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); padding: 10px 12px; border-radius: 8px; margin-top: 14px; font-size: 13px; }

/* Filters, inputs */
form.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
form.filters input[type=search] { min-width: 260px; flex: 1; } form.filters select { max-width: 260px; }
form.filters .clear { margin-left: 4px; } form.filters label.check { display: inline-flex; gap: 6px; align-items: center; }
form.filters label.check input { width: auto; }
.count { margin: 4px 0 8px; }
input, select, textarea { font: inherit; padding: 7px 10px; border: 1px solid var(--input-border); border-radius: 8px; background: var(--input-bg); color: var(--ink); width: 100%; transition: border-color .15s, box-shadow .15s; }
input[type=search] { width: auto; } form.filters select, form.filters input { width: auto; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus); }
input.ro { background: var(--ro-bg); color: var(--muted); }
input::placeholder { color: var(--muted); opacity: 1; }
input[type=date]::-webkit-calendar-picker-indicator { filter: invert(.6); }

/* Tables */
.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--card-border); border-radius: 12px; box-shadow: var(--card-shadow); }
table { border-collapse: collapse; width: 100%; } th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink); background: var(--thead-bg); white-space: nowrap; position: sticky; top: 0; }
tbody tr { transition: background .1s; } tbody tr:hover { background: var(--row-hover); } tbody tr:last-child td { border-bottom: 0; }
tr.warn td { background: var(--warn-row); } tr.inactive td { color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; } td.date { white-space: nowrap; }
td.empty { text-align: center; color: var(--muted); padding: 28px; }
/* The actions column stays visible while a wide table scrolls sideways. */
td.rowactions, th.rowactions { text-align: right; white-space: nowrap; position: sticky; right: 0; background: var(--card); box-shadow: -10px 0 10px -10px rgba(0, 0, 0, .55); }
tbody tr:hover td.rowactions { background: var(--row-hover); } th.rowactions { background: var(--thead-bg); }
td.warn { color: var(--bad); font-weight: 600; } table.dense th, table.dense td { padding: 7px 10px; font-size: 13px; }
td.changes { font-size: 12px; } .chg { display: inline-block; margin: 0 8px 2px 0; }
.locdesc { display: block; font-size: 11.5px; color: var(--muted); white-space: normal; }
th.loc, td.loc { min-width: 200px; }
td.bar { width: 140px; } .barfill { height: 8px; background: var(--accent-bar, var(--btn-bg)); border-radius: 4px; min-width: 2px; }
.card table th { position: static; }
nav.pager { display: flex; gap: 16px; align-items: center; justify-content: center; margin-top: 12px; }

/* Status pills: tinted with the semantic colour so they read on light and dark alike */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--muted); background: color-mix(in srgb, var(--muted) 14%, transparent); border: 1px solid color-mix(in srgb, var(--muted) 30%, transparent); }
.b-ok, .b-available, .b-returned, .b-working { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.b-reorder, .b-not-available { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.b-out-of-stock, .b-overdue, .b-not-working, .b-faulty { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.b-under-repair, .b-issued { color: var(--info); background: color-mix(in srgb, var(--info) 14%, transparent); border-color: color-mix(in srgb, var(--info) 35%, transparent); }
.b-calibrated, .b-done { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.b-due-soon, .b-due { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.calibration-panel { margin-bottom: 16px; border-color: color-mix(in srgb, var(--warn) 45%, transparent); }

/* Forms */
.formgrid { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 16px; align-items: start; }
.formgrid form.card h2 { padding-top: 10px; border-top: 1px solid var(--line); margin-top: 20px; }
.formgrid form.card h2:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; color: var(--ink); } .field.wide { grid-column: 1 / -1; }
.field .help { font-size: 12.5px; color: var(--muted); margin-top: 4px; } .field .error { font-size: 12px; color: var(--bad); margin-top: 4px; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--bad); }
.req { color: var(--bad); } .lookup { font-size: 12px; margin-top: 4px; min-height: 1em; } .lookup.hit { color: var(--ok); } .lookup.miss { color: var(--bad); }
.formactions { display: flex; gap: 10px; align-items: center; margin-top: 20px; }
aside.info dl { display: grid; grid-template-columns: auto 1fr; gap: 7px 12px; margin: 0; } aside.info dt { color: var(--muted); font-size: 12.5px; } aside.info dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
aside.info form.quick { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; } aside.info form.quick label { font-size: 12px; }
form.dangerzone { margin-top: 18px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; } .inline-form input { flex: 1; min-width: 180px; }

/* Dashboard */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { --tile: var(--brand); position: relative; overflow: hidden; background: var(--card); border: 1px solid var(--card-border); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; color: var(--ink); box-shadow: var(--card-shadow); transition: transform .12s, border-color .12s; }
.tile::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--tile); }
.tile::after { content: ""; position: absolute; width: 130px; height: 130px; right: -44px; top: -56px; border-radius: 50%; background: var(--tile); opacity: .13; }
.tile:hover { text-decoration: none; transform: translateY(-2px); border-color: color-mix(in srgb, var(--tile) 55%, transparent); }
.tile .n { font-size: 28px; font-weight: 750; line-height: 1.1; letter-spacing: -.02em; color: var(--tile); } .tile span:last-child { font-size: 12.5px; font-weight: 500; color: var(--ink); }
.tile.c-blue { --tile: var(--c-blue); } .tile.c-violet { --tile: var(--c-violet); } .tile.c-cyan { --tile: var(--c-cyan); } .tile.c-emerald { --tile: var(--c-emerald); }
.tile.c-orange { --tile: var(--c-orange); } .tile.c-pink { --tile: var(--c-pink); } .tile.quiet { --tile: var(--muted); }
.tile.warn { --tile: var(--warn); } .tile.bad { --tile: var(--bad); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
.cols .card { overflow-x: auto; } .cols > .card:first-child, .cols > .card.wide { grid-column: 1 / -1; }   /* Low stock and Recent activity get the full width */
.cols h2 .muted { font-weight: normal; font-size: 12px; margin-left: 6px; }
nav.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; } nav.tabs a { padding: 6px 13px; border-radius: 8px; border: 1px solid var(--card-border); background: var(--card); color: var(--ink); }
nav.tabs a:hover { text-decoration: none; border-color: var(--brand); } nav.tabs a.active { background: var(--btn-bg); color: var(--brand-ink); border-color: transparent; font-weight: 600; box-shadow: var(--btn-shadow); }

/* Sign-in: what the app is on the left, the form on the right */
body.anon main > .content { width: 100%; max-width: 960px; margin: 0 auto; padding: 32px; }        /* pages readable before sign-in, e.g. the terms */
body.anon main > .content:has(> .auth) { flex: 1; max-width: none; margin: 0; padding: 0; }
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.auth-hero { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 56px 64px; color: var(--side-ink); background: var(--side); border-right: 1px solid var(--card-border); }
.auth-hero::before { content: ""; position: absolute; width: 640px; height: 640px; right: -260px; top: -300px; border-radius: 50%; background: radial-gradient(circle, var(--bg-glow), transparent 68%); pointer-events: none; }
.auth-hero::after { content: ""; position: absolute; width: 520px; height: 520px; left: -240px; bottom: -280px; border-radius: 50%; background: radial-gradient(circle, var(--bg-glow2), transparent 68%); pointer-events: none; }
.auth-hero > * { position: relative; }
.auth-brand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 18px; color: #fff; }
.auth-brand::before { content: ""; align-self: center; width: 36px; height: 36px; border-radius: 10px; background: url(icon.svg) center / contain no-repeat; box-shadow: 0 0 0 4px var(--brand-soft); margin-right: 6px; }
.auth-brand b { font-weight: 800; background: var(--brand-text); -webkit-background-clip: text; background-clip: text; color: transparent; } .auth-brand span { font-size: 13px; opacity: .8; }
.auth-hero h1 { font-size: clamp(28px, 3vw, 40px); line-height: 1.12; letter-spacing: -.02em; margin: 6px 0 0; max-width: 560px; color: #fff; }
.auth-hero .lead { font-size: 16px; line-height: 1.6; max-width: 540px; margin: 0; opacity: .92; }
.auth-points { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 14px; max-width: 560px; }
.auth-points li { display: flex; gap: 14px; align-items: flex-start; }
.auth-points svg { width: 22px; height: 22px; flex: none; color: var(--brand); margin-top: 1px; }
.auth-points strong { display: block; color: #fff; font-weight: 600; } .auth-points span { font-size: 13.5px; line-height: 1.5; opacity: .82; }
.auth-foot { margin: 18px 0 0; font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; opacity: .6; }
.auth-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 48px 32px; }
.auth-card { width: min(420px, 100%); position: relative; overflow: hidden; background: var(--card); border: 1px solid var(--card-border); border-radius: 16px; padding: 30px 32px 26px; box-shadow: var(--card-shadow); animation: card-in .3s ease-out; }
@keyframes card-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .auth-card { animation: none; } }
.auth-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--btn-bg); }
.auth-card h2 { font-size: 22px; margin: 0 0 4px; display: block; } .auth-card > .muted { margin: 0; }
.auth-card .field { margin-top: 16px; } .auth-card input { padding: 10px 12px; }
.auth-error { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; padding: 10px 12px; border-radius: 10px; font-size: 13.5px; color: var(--ink); background: color-mix(in srgb, var(--bad) 14%, transparent); border: 1px solid color-mix(in srgb, var(--bad) 45%, transparent); }
.auth-error svg { width: 18px; height: 18px; flex: none; color: var(--bad); margin-top: 1px; }
.pw-wrap { position: relative; } .pw-wrap input { padding-right: 46px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.pw-toggle:hover { color: var(--brand); background: var(--brand-soft); } .pw-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.pw-toggle svg { width: 18px; height: 18px; } .pw-toggle .eye-off, .pw-toggle.on .eye { display: none; } .pw-toggle.on .eye-off { display: block; }
.caps { display: none; margin-top: 6px; font-size: 12.5px; color: var(--warn); } .caps.on { display: block; }
.auth-submit { width: 100%; margin-top: 22px; padding: 11px; font-size: 15px; }
.auth-help { margin: 18px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.auth-terms { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.auth-panel .hint { width: min(420px, 100%); margin: 0; }
.auth-back { margin-top: 14px; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; min-height: auto; }
  .auth-hero { padding: 26px 20px 22px; gap: 10px; border-right: 0; border-bottom: 1px solid var(--card-border); }
  .auth-hero h1 { font-size: 24px; } .auth-hero .lead { font-size: 14.5px; } .auth-points, .auth-foot { display: none; }
  .auth-panel { padding: 24px 16px 40px; } .auth-card { padding: 24px 22px 20px; }
}

/* The sidebar slides: collapse it from the menu button and it hides off screen, peeking back out when the
   pointer reaches the left edge; on phones it is a drawer behind the same button. */
nav.side { transition: transform .28s cubic-bezier(.2, .8, .2, 1), box-shadow .28s; z-index: 40; }
html.side-collapsed nav.side { position: fixed; left: 0; top: 0; height: 100vh; transform: translateX(-100%); box-shadow: none; }
html.side-collapsed nav.side.peek { transform: none; box-shadow: 24px 0 60px -20px rgba(0, 0, 0, .7); }
.side-edge { display: none; } html.side-collapsed .side-edge { display: block; position: fixed; left: 0; top: 0; bottom: 0; width: 16px; z-index: 39; }
.side-backdrop { display: none; position: fixed; inset: 0; background: rgba(4, 6, 12, .55); backdrop-filter: blur(2px); z-index: 38; }
.navtoggle { flex: none; width: 36px; height: 36px; border: 0; border-radius: 10px; background: none; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; margin-left: -6px; }
.navtoggle svg { width: 20px; height: 20px; } .navtoggle:hover { background: var(--row-hover); color: var(--ink); } .navtoggle:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
@media (max-width: 900px) {
  nav.side { position: fixed; left: 0; top: 0; height: 100vh; width: 268px; flex: none; transform: translateX(-100%); border-right: 1px solid var(--card-border); }
  html.side-open nav.side { transform: none; box-shadow: 24px 0 60px -20px rgba(0, 0, 0, .7); }
  html.side-open .side-backdrop { display: block; } .side-edge { display: none !important; }
  main > .content { padding: 14px 16px 40px; } .topbar { padding: 8px 16px; } .crumb { display: none; } details.account { margin-left: auto; }
  details.account .who { display: none; } details.account .menu { width: min(292px, calc(100vw - 32px)); }
  .topbtn span { display: none; } .topbtn { padding: 8px 10px; } .topright { margin-left: auto; }
  .formgrid { grid-template-columns: 1fr; } .cols { grid-template-columns: 1fr; }
}

/* People: who has what */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.person-card { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--card-border); border-radius: 12px; padding: 14px 16px; color: var(--ink); box-shadow: var(--card-shadow); transition: transform .12s, border-color .12s; }
.person-card:hover { text-decoration: none; transform: translateY(-2px); border-color: color-mix(in srgb, var(--brand) 55%, transparent); }
.person-card.empty { opacity: .72; }
.person-card .who { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; color: var(--ink); }
.person-card .who:hover { text-decoration: none; } .person-card .who:hover strong { color: var(--brand); }
.person-card .text { display: flex; flex-direction: column; gap: 2px; min-width: 0; } .person-card .text .muted { font-size: 12.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; } form.dangerzone { display: flex; align-items: center; gap: 12px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--btn-bg); color: var(--brand-ink); font-weight: 700; font-size: 16px; letter-spacing: .02em; display: inline-flex; align-items: center; justify-content: center; flex: none; box-shadow: var(--btn-shadow); }
img.avatar { object-fit: cover; background: var(--card); }
.avatar.mini { width: 32px; height: 32px; font-size: 12.5px; box-shadow: none; }
.avatar.big { width: 54px; height: 54px; font-size: 22px; }
.avatar.xl { width: 96px; height: 96px; font-size: 34px; }
.avatar.ring { box-shadow: 0 0 0 4px var(--brand-soft), var(--btn-shadow); }
.namecell { display: inline-flex; align-items: center; gap: 8px; } .namecell .avatar.small { box-shadow: none; }
.person-head { display: flex; align-items: center; gap: 14px; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); margin-left: 8px; vertical-align: middle; }
.checkout-pick { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; padding: 14px 18px; }
.checkout-pick label { font-weight: 600; } .checkout-pick input { flex: 1; min-width: 240px; width: auto; }

/* Check out / check in on record pages */
.aside-actions { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; } .aside-actions .btn { text-align: center; width: 100%; }
aside.info h3 { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 6px; }
.outlist { list-style: none; margin: 0; padding: 0; }
.outlist li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }
td.rowactions .btn + .btn, td.rowactions form + form { margin-left: 4px; }

/* View-only forms: fields are visibly locked but still readable */
input:disabled, select:disabled, textarea:disabled { opacity: .8; cursor: not-allowed; border-style: dashed; }

/* Users admin */
.cols.even > .card:first-child { grid-column: auto; }          /* equal cards, no full-width first card */
.cols.one-col { grid-template-columns: minmax(0, 1fr); }          /* one full-width card per row: a person's tables need the width */
.cols.even .inline-form select { width: auto; min-width: 180px; flex: 0 0 auto; }
.card.secret { border-color: color-mix(in srgb, var(--warn) 55%, transparent); background: color-mix(in srgb, var(--warn) 8%, var(--card)); margin-bottom: 16px; }
.card.secret .big { font-size: 22px; margin: 6px 0 8px; } .card.secret code { font-size: 22px; padding: 6px 12px; letter-spacing: .08em; }
.dangerzone-card { border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.cols form + p { margin-top: 8px; }

/* Audit trail timeline */
.day { margin-bottom: 18px; }
.dayhead { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 6px; }
.dayhead::before { display: none; } .dayhead .muted { text-transform: none; letter-spacing: 0; font-weight: normal; }
.timeline { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--card-border); border-radius: 12px; box-shadow: var(--card-shadow); }
.entry { display: grid; grid-template-columns: 52px 30px minmax(0, 1fr); gap: 12px; align-items: start; padding: 11px 16px; border-top: 1px solid var(--line); }
.entry:first-child { border-top: 0; }
.entry .time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; padding-top: 5px; white-space: nowrap; }
.timeline.compact .entry { grid-template-columns: 118px 30px minmax(0, 1fr); padding: 9px 12px; }
.avatar.small { width: 28px; height: 28px; font-size: 12px; box-shadow: none; }
.entry .line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; line-height: 1.4; padding-top: 3px; }
.entry .line strong { font-weight: 600; }
.entry .open { font-size: 12.5px; }
.changes { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.changes li { background: var(--code-bg); border-radius: 6px; padding: 3px 9px; font-size: 12.5px; display: inline-flex; gap: 6px; align-items: baseline; max-width: 100%; }
.changes .k { color: var(--muted); } .changes .old { text-decoration: line-through; opacity: .75; } .changes .arrow { color: var(--muted); }
.changes .new { font-weight: 500; overflow-wrap: anywhere; }
.morechanges { margin-top: 6px; } .morechanges summary { cursor: pointer; font-size: 12.5px; color: var(--brand); }

/* Requests */
.navbadge { display: inline-block; min-width: 20px; padding: 1px 6px; margin-left: 8px; border-radius: 999px; font-size: 11px; font-weight: 700; text-align: center; background: var(--warn); color: #1a1200; vertical-align: middle; }
.tabcount { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px; font-size: 11px; background: color-mix(in srgb, currentColor 18%, transparent); }
.b-pending { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.requests-panel { margin-bottom: 16px; border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
form.decline { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 6px; } form.decline input { width: 150px; padding: 4px 8px; font-size: 12.5px; }

/* Terms dialog */
.modal-backdrop { position: fixed; inset: 0; background: rgba(4, 6, 12, .72); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal { width: min(680px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.modal-body { padding: 22px 26px 8px; overflow-y: auto; } .modal-body h2 { margin-top: 0; }
ol.terms { margin: 0; padding-left: 22px; } ol.terms li { margin: 0 0 10px; line-height: 1.5; }
.modal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 26px 18px; border-top: 1px solid var(--line); background: var(--thead-bg); }
.modal-actions .spacer { flex: 1; } .modal-actions label.check { display: inline-flex; gap: 8px; align-items: center; } .modal-actions label.check input { width: auto; }
.card.narrow-wide { max-width: 760px; }

/* Profile page and a person's page under Users: settings rows, text on the left and the control on the right */
.stack { display: flex; flex-direction: column; gap: 16px; max-width: 900px; }
.settings .setting { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 32px; align-items: center; padding: 16px 0; border-top: 1px solid var(--line); }
.settings h2 + .setting { border-top: 0; padding-top: 2px; } .settings .setting:last-child { padding-bottom: 2px; }
.setting h3 { margin: 0 0 3px; font-size: 14px; font-weight: 650; } .setting .about p { margin: 0; font-size: 13px; line-height: 1.45; }
.setting .control { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin: 0; }
.setting .control select { width: auto; min-width: 140px; } .setting .control.value { font-weight: 500; }
.card.settings.danger { border-color: color-mix(in srgb, var(--bad) 45%, transparent); } .card.settings.danger .setting { border-top: 0; padding: 2px 0; }
.photo-row { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.photo-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.photo-preview { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); } .photo-preview[hidden] { display: none; }
.photo-preview .avatar { box-shadow: 0 0 0 3px var(--brand-soft); }
.photo-row .help { margin: 0; font-size: 12.5px; color: var(--muted); }
label.btn.file { cursor: pointer; display: inline-flex; align-items: center; gap: 8px; } label.btn.file svg { width: 16px; height: 16px; }
@media (max-width: 720px) { .settings .setting { grid-template-columns: 1fr; } .setting .control { justify-content: flex-start; } }

/* Help & guide */
.help { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; align-items: start; }
.help-toc { position: sticky; top: 66px; display: flex; flex-direction: column; gap: 2px; padding: 6px 0; max-height: calc(100vh - 90px); overflow-y: auto; scrollbar-width: thin; }
.help-toc .label { margin: 12px 0 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); } .help-toc .label:first-child { margin-top: 0; }
.help-toc a { display: block; padding: 5px 10px; border-radius: 8px; color: var(--ink); font-size: 13.5px; border-left: 2px solid transparent; }
.help-toc a:hover { background: var(--row-hover); text-decoration: none; } .help-toc a.active { border-left-color: var(--brand); color: var(--brand); font-weight: 600; background: var(--brand-soft); }
.help-body { max-width: 860px; min-width: 0; }
.help-body section { margin-bottom: 44px; scroll-margin-top: 70px; }
.help-body h2 { font-size: 21px; margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.help-body h2::before { content: none; } .help-body h3 { font-size: 15.5px; margin: 22px 0 8px; }
.help-body p, .help-body li { line-height: 1.6; } .help-body p { margin: 0 0 10px; }
.steps { margin: 8px 0 12px; padding-left: 22px; } .steps li { margin: 0 0 6px; }
ul.plain { padding-left: 20px; margin: 8px 0 12px; } ul.plain li { margin-bottom: 6px; }
.tip, .warn { margin: 14px 0; padding: 12px 14px; border-radius: 10px; font-size: 13.5px; line-height: 1.55; background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 40%, transparent); }
.warn { background: color-mix(in srgb, var(--warn) 12%, transparent); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 4px; margin: 12px 0 16px; }
.flow .step { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--card); border: 1px solid var(--card-border); font-size: 13px; font-weight: 500; box-shadow: var(--card-shadow); }
.flow .step b { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; align-items: center; justify-content: center; background: var(--btn-bg); color: var(--brand-ink); font-size: 12px; }
.flow .arrow { width: 18px; height: 2px; background: var(--muted); opacity: .5; position: relative; margin: 0 2px; }
.flow .arrow::after { content: ""; position: absolute; right: -1px; top: -4px; border: 5px solid transparent; border-left: 6px solid var(--muted); border-right: 0; }
.shot { margin: 14px 0 24px; }
.shot img { display: block; width: 100%; height: auto; border: 1px solid var(--card-border); border-radius: 12px; box-shadow: var(--card-shadow); background: var(--card); }
.shot figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); }
.legend { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px 18px; font-size: 13px; line-height: 1.45; }
.legend li { display: flex; gap: 8px; align-items: flex-start; }
.legend .n { flex: none; display: inline-flex; width: 22px; height: 22px; border-radius: 50%; align-items: center; justify-content: center; background: linear-gradient(135deg, #f472b6, #a855f7); color: #fff; font-weight: 700; font-size: 12px; margin-top: 1px; }
table.roles { width: 100%; border-collapse: collapse; margin: 8px 0 14px; background: var(--card); border: 1px solid var(--card-border); border-radius: 10px; overflow: hidden; font-size: 13.5px; }
table.roles th, table.roles td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; } table.roles tr:last-child td { border-bottom: 0; }
table.roles th { position: static; } table.roles td.yes { color: var(--ok); font-weight: 600; } table.roles td.no { color: var(--muted); }
.loc-code { display: flex; align-items: flex-start; gap: 6px; flex-wrap: wrap; margin: 12px 0 8px; }
.loc-code > div { display: flex; flex-direction: column; align-items: center; gap: 4px; } .loc-code code { font-size: 20px; font-weight: 700; padding: 6px 12px; border-radius: 8px; background: var(--code-bg); color: var(--brand); }
.loc-code span { font-size: 12px; color: var(--muted); } .loc-code .dash { font-size: 22px; color: var(--muted); padding-top: 4px; }
dl.glossary, dl.faq { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 20px; }
dl.faq { grid-template-columns: 1fr; gap: 2px; } dl.faq dt { font-weight: 600; margin-top: 10px; } dl.faq dd { margin: 0; color: var(--muted); }
dl.glossary dt { font-weight: 600; } dl.glossary dd { margin: 0; }
section.admin h2 { border-bottom-color: color-mix(in srgb, var(--warn) 45%, transparent); }
section.admin h2::after { content: "Admin"; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); margin-left: 10px; vertical-align: middle; }
.nudge { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.nudge .text { flex: 1; min-width: 240px; } .nudge .text strong { display: block; margin-bottom: 2px; } .nudge .text p { margin: 0; font-size: 13.5px; }
.nudge .btns { display: flex; gap: 8px; }
@media (max-width: 900px) { .help { grid-template-columns: 1fr; } .help-toc { position: static; max-height: none; flex-direction: row; flex-wrap: wrap; gap: 4px; } .help-toc .label { width: 100%; } .help-toc a { font-size: 12.5px; padding: 4px 8px; background: var(--card); border: 1px solid var(--card-border); } dl.glossary { grid-template-columns: 1fr; gap: 2px; } dl.glossary dt { margin-top: 8px; } }
@media print {
  nav.side, .topbar, .help-toc, header.page .actions, .flashes { display: none !important; } body { display: block; background: #fff; color: #000; }
  main > .content { padding: 0; } .help { display: block; } .help-body { max-width: none; } .shot img { box-shadow: none; } a { color: inherit; text-decoration: none; }
  .help-body section { break-inside: avoid-page; } .shot { break-inside: avoid; }
}

/* Browsing a register: a filter rail on the left, like a shop, and the results on the right */
.browse { display: grid; grid-template-columns: 238px minmax(0, 1fr); gap: 20px; align-items: start; }
.browse.nofacets { grid-template-columns: minmax(0, 1fr); } .browse.nofacets .facets { display: none; }
.results { min-width: 0; }
.facets { position: sticky; top: 64px; max-height: calc(100vh - 78px); overflow-y: auto; scrollbar-width: thin; background: var(--card); border: 1px solid var(--card-border); border-radius: 12px; padding: 12px 14px 14px; box-shadow: var(--card-shadow); }
.facet-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 8px; font-size: 13.5px; } .facet-head a { font-size: 12.5px; }
.facet { border-top: 1px solid var(--line); padding: 6px 0 6px; }
.facet > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); user-select: none; }
.facet > summary::-webkit-details-marker { display: none; }
.facet > summary::after { content: ""; margin-left: auto; margin-right: 4px; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.facet[open] > summary::after { transform: rotate(-135deg); }
.facet .fsel { min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--btn-bg); color: var(--brand-ink); font-size: 11px; letter-spacing: 0; text-align: center; }
.facet-list { list-style: none; margin: 2px 0 0; padding: 0; }
.facet-list li.extra { display: none; } .facet.expanded li.extra { display: block; }
.facet.expanded .facet-list.long { max-height: 300px; overflow-y: auto; scrollbar-width: thin; padding-right: 4px; }
.facet-list label { display: flex; align-items: center; gap: 9px; padding: 4px 4px; margin: 0 -4px; border-radius: 6px; cursor: pointer; font-size: 13.5px; font-weight: normal; color: var(--ink); }
.facet-list label:hover { background: var(--row-hover); }
.facet-list input[type=checkbox] { width: 15px; height: 15px; margin: 0; flex: none; accent-color: var(--brand); }
.facet-list .v { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facet-list .v small { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.facet-list .n { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.facet-more { display: block; background: none; border: 0; padding: 4px 0 2px; color: var(--brand); font: inherit; font-size: 12.5px; cursor: pointer; }
.facet-apply { width: 100%; margin-top: 12px; } html.js .facet-apply { display: none; }
.searchbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.searchbar input[type=search] { flex: 1; min-width: 160px; width: auto; } .facets-toggle { display: none; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 10px; border-radius: 999px; font-size: 12.5px; color: var(--ink); background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 40%, transparent); transition: border-color .12s; }
.chip .k { color: var(--muted); } .chip .x { font-size: 15px; line-height: 1; color: var(--muted); }
.chip:hover { text-decoration: none; border-color: var(--bad); } .chip:hover .x { color: var(--bad); }
.chip.clear { background: none; border-color: var(--card-border); color: var(--brand); } .chip.clear:hover { border-color: var(--brand); }
@media (max-width: 1000px) {
  .browse { grid-template-columns: minmax(0, 1fr); }
  .facets { display: none; position: static; max-height: none; } .browse.show-facets .facets { display: block; }
  .facets-toggle { display: inline-block; }
}

/* Search palette (Ctrl+K) */
.searchbtn kbd { font: 600 10.5px/1 system-ui, sans-serif; padding: 3px 5px; border-radius: 5px; background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--muted); margin-left: 4px; }
.palette-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(4, 6, 12, .55); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; }
.palette-backdrop[hidden] { display: none; }
.palette { width: min(640px, 100%); max-height: 76vh; display: flex; flex-direction: column; border-radius: 18px; overflow: hidden; animation: menu-in .18s cubic-bezier(.2, 1.2, .4, 1);
  background: color-mix(in srgb, var(--card) 92%, transparent); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%); }
.palette::after { display: none; } .palette:active { transform: none; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.palette-input svg { width: 20px; height: 20px; color: var(--brand); flex: none; }
.palette-input input { flex: 1; border: 0; background: none; font-size: 16px; padding: 6px 0; color: var(--ink); } .palette-input input:focus { outline: none; box-shadow: none; }
.palette kbd { font: 600 11px/1 system-ui, sans-serif; padding: 3px 6px; border-radius: 5px; background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--muted); }
.palette-results { overflow-y: auto; padding: 6px; scrollbar-width: thin; }
.palette-hint, .palette-empty { padding: 18px 14px; margin: 0; color: var(--muted); font-size: 13.5px; }
.palette-group { padding: 8px 10px 2px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.hit { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.hit.active, .hit:hover { background: var(--row-hover); }
.hit .hit-id { flex: none; min-width: 92px; font-size: 12.5px; font-weight: 600; color: var(--brand); font-variant-numeric: tabular-nums; }
.hit .hit-text { flex: 1; min-width: 0; } .hit .hit-name { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hit .hit-sub { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hit .hit-actions { display: flex; gap: 6px; flex: none; }
.palette-foot { display: flex; gap: 16px; padding: 8px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.palette-foot kbd { margin-right: 4px; }

/* Undo toasts */
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 55; display: flex; flex-direction: column; gap: 8px; width: min(560px, calc(100vw - 32px)); }
.toast { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; border-radius: 14px; background: color-mix(in srgb, var(--card) 94%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 45%, transparent); box-shadow: 0 24px 60px -18px rgba(0, 0, 0, .8), var(--card-shadow); backdrop-filter: blur(16px); animation: toast-in .25s cubic-bezier(.2, 1.2, .4, 1); }
.toast .toast-msg { flex: 1; font-size: 13.5px; line-height: 1.4; } .toast form { flex: none; }
.toast-x { flex: none; width: 28px; height: 28px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; } .toast-x:hover { background: var(--row-hover); color: var(--ink); }
.toast.leaving { opacity: 0; transform: translateY(8px); transition: opacity .3s, transform .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Saved views */
details.views { position: relative; } details.views > summary { list-style: none; cursor: pointer; white-space: nowrap; } details.views > summary::-webkit-details-marker { display: none; }
.views-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 300px; padding: 8px; border-radius: 14px; z-index: 30; background: color-mix(in srgb, var(--card) 92%, transparent); }
.views-menu::after { display: none; } .views-menu:active { transform: none; }
.view-row { display: flex; align-items: center; gap: 6px; } .view-row a { flex: 1; padding: 7px 10px; border-radius: 8px; color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .view-row a:hover { background: var(--row-hover); text-decoration: none; }
.view-x { border: 0; background: none; color: var(--muted); font-size: 17px; line-height: 1; width: 28px; height: 28px; border-radius: 8px; cursor: pointer; } .view-x:hover { color: var(--bad); background: var(--row-hover); }
.view-save { display: flex; gap: 6px; padding: 8px 4px 4px; border-top: 1px solid var(--line); margin-top: 6px; } .view-save input { flex: 1; padding: 6px 10px; font-size: 13px; }
.views-menu .muted.small { padding: 6px 10px 2px; margin: 0; }
.linkbtn { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; color: var(--brand); font: inherit; font-size: 12.5px; cursor: pointer; border-radius: 8px; } .linkbtn:hover { background: var(--row-hover); }

/* Record history tab */
.record-tabs { margin-bottom: 14px; } .record-history .day:first-child .dayhead { margin-top: 0; }
[data-tabpane][hidden] { display: none; }

/* Audit trail: the date range lives in the rail */
.facet-dates { display: flex; flex-direction: column; gap: 8px; padding: 4px 0 2px; }
.facet-dates label { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.facet-dates input[type=date] { padding: 5px 8px; font-size: 13px; min-width: 0; }
.facet-dates .presets { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.facet-dates .presets a { padding: 3px 9px; border-radius: 999px; border: 1px solid var(--card-border); font-size: 12px; color: var(--ink); }
.facet-dates .presets a:hover { text-decoration: none; border-color: var(--brand); } .facet-dates .presets a.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.results .day:first-of-type .dayhead { margin-top: 4px; }

/* Phones: register rows become cards, each cell labelled */
@media (max-width: 700px) {
  .results .tablewrap { overflow: visible; background: none; border: 0; box-shadow: none; }
  .results table, .results tbody, .results tr, .results td { display: block; }
  .results thead { display: none; }
  .results tr { background: var(--card); border: 1px solid var(--card-border); border-radius: 12px; padding: 6px 12px 10px; margin-bottom: 10px; box-shadow: var(--card-shadow); }
  .results td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 5px 0; border: 0; text-align: right; }
  .results td::before { content: attr(data-label); flex: none; width: 42%; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
  .results td:empty, .results td[data-label=""]:empty { display: none; }
  .results td.rowactions { position: static; box-shadow: none; justify-content: flex-start; flex-wrap: wrap; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); margin-top: 4px; }
  .results td.rowactions::before { display: none; } .results td.rowactions .btn + .btn, .results td.rowactions form + form { margin-left: 0; }
  .results td.num, .results td.date { white-space: normal; } .results td.loc { min-width: 0; } .results td .locdesc { text-align: right; }
  .searchbtn span, .searchbtn kbd { display: none; } .searchbtn { padding: 8px 10px; }
}

/* Register tables scroll inside their box, so the heading row (and the actions column) stay put */
.results .tablewrap { overflow: auto; max-height: calc(100vh - 240px); overscroll-behavior: contain; scrollbar-width: thin; }
.results thead th { z-index: 2; } .results th.rowactions { z-index: 3; } .results td.rowactions { z-index: 1; }
@media (max-width: 700px) { .results .tablewrap { max-height: none !important; overflow: visible; overscroll-behavior: auto; } }

/* Shipments */
.ship-add { margin-bottom: 18px; }
.ship-form { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.ship-form .field { flex: 1 1 180px; margin: 0; } .ship-form .field.grow { flex: 2 1 260px; } .ship-form .field.act { flex: 0 0 auto; } .ship-form .field.act .btn { white-space: nowrap; }
.ship-form .field.carrier { flex: 0 1 170px; }
.ship-add .muted.small { margin: 10px 0 0; }
.ship-search { margin-left: auto; } .ship-search input { width: 260px; padding: 6px 10px; }
nav.tabs .ship-search { display: inline-flex; }
.pill-ok, .pill-warn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.pill-ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.pill-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.pill-ok::before, .pill-warn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.warn-text { color: var(--warn); }
.ship-events .entry { grid-template-columns: 118px 18px minmax(0, 1fr); }
.ship-events .dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 8px; background: var(--muted); border: 2px solid var(--card); box-shadow: 0 0 0 2px var(--line); }
.ship-events .dot.b-ok { background: var(--ok); } .ship-events .dot.b-issued { background: var(--info); } .ship-events .dot.b-pending { background: var(--warn); }
@media (max-width: 700px) { .ship-search { margin-left: 0; width: 100%; } .ship-search input { width: 100%; } }
.explain { margin-bottom: 18px; border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.explain-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 24px; }
.explain-grid > div { position: relative; padding-left: 36px; } .explain-grid .n { position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--btn-bg); color: var(--brand-ink); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.explain-grid strong { display: block; margin-bottom: 4px; } .explain-grid p { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
details.paste { margin-top: 12px; } details.paste > summary { cursor: pointer; color: var(--brand); font-size: 13.5px; list-style: none; } details.paste > summary::-webkit-details-marker { display: none; }
details.paste > summary::before { content: "+ "; } details.paste[open] > summary::before { content: "\2212  "; }
.paste-form { margin-top: 10px; } .paste-form textarea { font-size: 13px; }
.paste-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; } .paste-row input { flex: 1 1 200px; }

/* Bulk selection on registers (admins) */
th.pick, td.pick { width: 34px; padding-left: 12px; padding-right: 0; } td.pick input, th.pick input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); cursor: pointer; }
tr.picked td { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.bulkbar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 45; max-width: calc(100vw - 32px); display: flex; align-items: center; gap: 12px; white-space: nowrap; padding: 10px 14px; border-radius: 14px; background: color-mix(in srgb, var(--card) 94%, transparent); border: 1px solid color-mix(in srgb, var(--brand) 45%, transparent); box-shadow: 0 24px 60px -18px rgba(0, 0, 0, .8), var(--card-shadow); backdrop-filter: blur(16px); animation: toast-in .2s ease-out; }
.bulkbar[hidden] { display: none; } .bulk-count { font-size: 13.5px; margin-right: 6px; } .bulkbar form[hidden] { display: none; }
@media (max-width: 700px) { .results td.pick { justify-content: flex-start; padding: 0 0 6px; } .results td.pick::before { display: none; } }
.bulkbar form.decline { display: inline-flex; gap: 6px; margin: 0; } .bulkbar form.decline input { width: 160px; padding: 4px 8px; font-size: 12.5px; }
.card table th.pick { position: static; }
[hidden] { display: none !important; }        /* an element hidden by the page stays hidden whatever its own display */
