/* Design tokens */
:root {
  --bg: #f4f3f0; --surface: #ffffff; --surface-2: #f8f7f4; --ink: #1c1917; --ink-2: #44403c; --muted: #78716c;
  --line: #e7e5e1; --line-2: #d6d3ce;
  --brand: #b5471b; --brand-ink: #ffffff; --brand-soft: #fbeae2; --brand-hover: #9c3c15; --brand-deep: #7f2f0f;
  --ok: #15803d; --ok-soft: #dcfce7; --warn: #b45309; --warn-soft: #fef3c7; --bad: #b91c1c; --bad-soft: #fee2e2;
  --info: #1d4ed8; --info-soft: #dbeafe; --violet: #6d28d9; --violet-soft: #ede9fe; --teal: #0f766e; --teal-soft: #ccfbf1;
  --dark: #1c1a19; --dark-2: #2a2725; --on-dark: #e7e5e4; --on-dark-2: #a8a29e;
  --radius: 14px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(28,25,23,.05), 0 2px 8px rgba(28,25,23,.06);
  --shadow-lg: 0 6px 24px rgba(28,25,23,.12);
  --sidebar: 240px; --touch: 46px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* The page never scrolls sideways; anything wider scrolls inside its own container. */
html, body { overflow-x: hidden; max-width: 100%; }
@supports (overflow-x: clip) { html, body { overflow-x: clip; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 18px; line-height: 1.2; }
h2 { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 26px 0 10px; text-transform: uppercase; letter-spacing: .06em; }
h1 .pill { vertical-align: middle; font-weight: 600; font-size: 12px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
svg { flex: none; }

/* Admin shell: sidebar + content */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: var(--dark); color: var(--on-dark); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px; font-weight: 800; font-size: 17px; color: #fff; letter-spacing: -0.01em; border-bottom: 1px solid rgba(255,255,255,.07); }
.sidebar .brand .mark, .plainbar .brand .mark, .login .brand .mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #d4602c, var(--brand)); display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 800; letter-spacing: 0; box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.sidebar .group { padding: 16px 14px 5px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--on-dark-2); font-weight: 600; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; margin: 1px 10px; border-radius: 9px; color: #d6d3d1; font-size: 14px; font-weight: 500; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(181,71,27,.4); }
.sidebar nav a svg { width: 18px; height: 18px; opacity: .85; }
.sidebar nav a.active svg { opacity: 1; }
.sidebar .user { margin-top: auto; padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.07); display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: #d6d3d1; }
.sidebar .user form { margin: 0; }
.sidebar .user button, .plainbar button { background: transparent; border: 1px solid rgba(255,255,255,.18); color: var(--on-dark); padding: 6px 11px; font-size: 12px; min-height: 0; box-shadow: none; }
.sidebar .user button:hover, .plainbar button:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.3); }
.sidebar .user svg { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.topbar { display: none; }
.scrim { display: none; }
main { padding: 28px 32px 60px; max-width: 1180px; width: 100%; min-width: 0; }
/* Grid and flex children default to min-width:auto, which lets a wide table push the whole page sideways. */
.shell > div, .plain > *, .grid-2 > *, .scan-layout > * { min-width: 0; }
.table-wrap { max-width: 100%; }
img { max-width: 100%; height: auto; }

/* Plain shell for everyone else: one bar on top, app-style tiles on Home */
.plain { min-height: 100vh; display: flex; flex-direction: column; }
.plain main { margin: 0 auto; padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
/* The top bar already names the page; drop the repeated heading unless it is marked to stay. */
.plain main > h1:first-child:not(.keep) { display: none; }
.plainbar { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 8px 16px; background: linear-gradient(180deg, var(--dark-2), var(--dark)); color: var(--on-dark); position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 4px 16px rgba(0,0,0,.18); }
.plainbar .brand { display: flex; align-items: center; gap: 9px; font-weight: 800; color: #fff; font-size: 17px; letter-spacing: -0.01em; }
.plainbar a.brand { padding: 8px 6px 8px 0; border-radius: 10px; font-weight: 600; font-size: 15px; color: #fff; }
.plainbar a.brand:hover { text-decoration: none; color: #fff; }
.plainbar a.brand svg { width: 22px; height: 22px; opacity: .9; }
.plainbar .title { font-weight: 700; font-size: 16px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plainbar .who { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; letter-spacing: .03em; color: #fff; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); padding: 6px 11px 6px 9px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.plainbar .who svg { width: 16px; height: 16px; opacity: .85; }
.plainbar form { margin: 0; }
.plainbar button.icon { padding: 7px; border-radius: 10px; }
.plainbar button.icon svg { width: 20px; height: 20px; }

.hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.hello h1 { margin: 0; }
.hello .date { color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; padding-bottom: 4px; }
.tiles.big { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tiles.big .tile { flex-direction: column; align-items: flex-start; gap: 12px; padding: 16px; min-height: 148px; }
.tiles.big .tile .ic { width: 46px; height: 46px; padding: 11px; border-radius: 13px; }
.tiles.big .tile b { font-size: 16px; margin-bottom: 2px; }
.tiles.big .tile span { font-size: 12.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tiles.big .tile:active { transform: scale(.98); }
.tile.g-Print .ic { background: var(--info-soft); color: var(--info); }
.tile.g-Manage .ic { background: var(--violet-soft); color: var(--violet); }
.tile.g-Tools .ic { background: var(--warn-soft); color: var(--warn); }
.tile.g-Reports .ic { background: var(--teal-soft); color: var(--teal); }
.tile.g-Admin .ic { background: var(--line); color: var(--ink-2); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(280px, 85vw); transform: translateX(-100%); transition: transform .2s ease; z-index: 30; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  body.nav-open .sidebar { transform: none; }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--dark); color: #fff; position: sticky; top: 0; z-index: 20; }
  .topbar .title { font-weight: 700; }
  .topbar button { background: transparent; border: 0; color: #fff; padding: 6px; display: grid; place-items: center; min-height: 0; box-shadow: none; }
  .topbar button svg { width: 24px; height: 24px; }
  .scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; }
  body.nav-open .scrim { display: block; }
  main { padding: 18px 16px 48px; }
  h1 { font-size: 22px; margin-bottom: 14px; }
  /* Under 16px iOS Safari zooms into a focused field, which makes the page wider than the screen. */
  input[type=text], input[type=password], input[type=number], select, textarea { font-size: 16px; }
  .plainbar { padding: 6px 12px; }
}
@media (max-width: 400px) { .tiles.big { grid-template-columns: 1fr 1fr; gap: 10px; } .tiles.big .tile { padding: 14px; min-height: 140px; } }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.card + .card { margin-top: 16px; }
.card h2:first-child { margin-top: 0; }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { align-items: flex-end; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
/* A date picker that looks like plain text: the native input sits invisibly over the label. */
.datepick { position: relative; display: inline-block; cursor: pointer; font-weight: 500; font-size: 14px; }
.datepick span { border-bottom: 1px dashed var(--line-2); }
.datepick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; min-height: 0; padding: 0; border: 0; }
.toolbar form.inline { flex: 1 1 auto; }
.toolbar .inline label { flex: 0 1 220px; }
@media (max-width: 860px) {
  .card { padding: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  /* A table wider than the phone scrolls inside its card instead of the page. */
  .card { overflow-x: auto; }
  .card table { margin: 0; width: 100%; }
  .card th, .card td { padding: 10px 8px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat .v { font-size: 26px; }
}

/* Sub-navigation tabs (admin) */
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--line); margin: -6px 0 20px; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }
@media (max-width: 860px) {
  /* On phones the admin tabs wrap as chips instead of scrolling off-screen. */
  .tabs { flex-wrap: wrap; overflow: visible; gap: 6px; border-bottom: 0; margin: 0 0 16px; }
  .tabs a { padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 999px; margin: 0; font-size: 13px; background: var(--surface); }
  .tabs a.on { background: var(--brand); border-color: var(--brand); color: #fff; }
}

/* Flash */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--info-soft); color: var(--info); margin-bottom: 18px; font-weight: 500; }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.flash.ok { background: var(--ok-soft); color: var(--ok); }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card table { margin: 0 -6px; width: calc(100% + 12px); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 14px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.card th, .card td { padding: 10px 6px; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: var(--surface-2); white-space: nowrap; }
.card th { background: transparent; border-bottom-color: var(--line-2); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
.card tbody tr:hover td { background: transparent; }
td.num, th.num { text-align: right; white-space: nowrap; }
td b, td code, td .pill, td a { white-space: nowrap; }
/* A leading numeric column (pack size) stays narrow. */
.card th.num:first-child, .card td.num:first-child { width: 1%; }
td.t { white-space: nowrap; color: var(--muted); font-size: 13px; }
tr.total th { background: var(--surface); color: var(--ink); font-size: 13px; text-transform: none; border-top: 2px solid var(--line-2); }

/* Forms */
label { display: grid; gap: 6px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
label.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; color: var(--ink); font-size: 14px; line-height: 1.45; }
label.check input { margin-top: 3px; flex: none; }
label.check span { flex: 1; }
input[type=text], input[type=password], input[type=number], select, textarea {
  font: inherit; padding: 10px 12px; min-height: var(--touch); border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); min-width: 0; width: 100%; font-weight: 400;
}
select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2378716c' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); }
.form { display: grid; gap: 14px; max-width: 560px; }
.form .actions, .actions { display: flex; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline label { flex: 1 1 160px; }
.inline label.short { flex: 0 0 110px; }
.inline label.wide { flex: 2 1 260px; }
.inline button { flex: none; }
/* Phones: filter fields share the row; the three pack-size counts share one row. Must follow the rules above. */
@media (max-width: 860px) {
  .toolbar .inline label { flex: 1 1 140px; }
  .inline label.short { flex: 1 1 0; min-width: 0; }
  .inline label.short input { padding-left: 10px; padding-right: 6px; }
  .inline .mixtotal { flex: 1 1 100%; padding: 4px 0 0; }
}
.mixes { display: flex; gap: 6px; flex-wrap: wrap; }
.mixes .mix { font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: 0.02em; }
.mixtotal { flex: 1 1 160px; padding-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
.mixtotal.ok, .ok { color: var(--ok); }
.mixtotal.warn, .warn { color: var(--warn); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 14px; }
.checks label { grid-template-columns: auto 1fr; align-items: center; gap: 8px; font-weight: 400; color: var(--ink); font-size: 14px; }

/* Buttons */
[hidden] { display: none !important; }
button, .btn { font: inherit; font-weight: 600; font-size: 14px; padding: 9px 16px; min-height: 40px; border-radius: var(--radius-sm); border: 1px solid var(--brand); background: linear-gradient(180deg, #c4521f, var(--brand)); color: var(--brand-ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; line-height: 1.2; box-shadow: 0 1px 2px rgba(28,25,23,.12), inset 0 1px 0 rgba(255,255,255,.15); transition: background .12s, box-shadow .12s, transform .05s; }
button:hover, .btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); text-decoration: none; }
button:active, .btn:active { transform: translateY(1px); box-shadow: none; }
button.secondary, .btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-2); box-shadow: 0 1px 2px rgba(28,25,23,.06); }
button.secondary:hover, .btn.secondary:hover { background: var(--surface-2); border-color: var(--line-2); }
button.danger, .btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.ghost, .btn.ghost { background: transparent; border-color: transparent; color: var(--brand); padding: 6px 8px; box-shadow: none; }
button.sm, .btn.sm { padding: 6px 10px; font-size: 13px; min-height: 32px; }
button svg, .btn svg { width: 18px; height: 18px; }
@media (max-width: 860px) { button:not(.sm), .btn:not(.sm) { min-height: var(--touch); } }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line); color: var(--ink-2); white-space: nowrap; line-height: 1.5; }
.pill.off { color: var(--muted); }
.pill.new { background: var(--line); color: var(--ink-2); }
.pill.labeled { background: var(--info-soft); color: var(--info); }
.pill.pack_started { background: var(--warn-soft); color: var(--warn); }
.pill.packed { background: var(--ok-soft); color: var(--ok); }
.pill.delivered { background: var(--teal-soft); color: var(--teal); }
.pill.picked_up { background: var(--violet-soft); color: var(--violet); }
.pill.voided { background: var(--bad-soft); color: var(--bad); }
.pill.filled { background: var(--teal-soft); color: var(--teal); }
.pill.unpacked { background: var(--warn-soft); color: var(--warn); }
.pill.expired { background: var(--bad-soft); color: var(--bad); }
.pill.active { background: var(--ok-soft); color: var(--ok); }
.pill.inactive { background: var(--line); color: var(--muted); }
.pill.printed { background: var(--ok-soft); color: var(--ok); }
.pill.failed { background: var(--bad-soft); color: var(--bad); }

/* Dashboard */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.stat .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.stat .v { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; margin-top: 4px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 4px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; color: var(--ink); display: flex; gap: 14px; align-items: flex-start; transition: box-shadow .15s, border-color .15s, transform .05s; }
.tile:hover { border-color: var(--line-2); box-shadow: var(--shadow-lg); text-decoration: none; }
/* The icon is centred by padding, which every engine gets right (iOS WebKit misplaced flex/grid centring here). */
.tile .ic { width: 40px; height: 40px; padding: 9px; border-radius: 11px; background: var(--brand-soft); color: var(--brand); display: block; flex: none; }
.tile .ic svg { width: 100%; height: 100%; display: block; }
.tile b { display: block; margin-bottom: 3px; font-size: 15px; }
.tile span { color: var(--muted); font-size: 13px; line-height: 1.4; }

/* Scan pages: hero card + scan card on top, the page's list full width below. */
.scan-top { display: grid; grid-template-columns: minmax(280px, 2fr) minmax(0, 3fr); gap: 18px; align-items: stretch; margin-bottom: 16px; }
.scan-top > * { min-width: 0; }
.card.hero { display: flex; align-items: center; gap: 22px; padding: 26px 28px; align-self: stretch; background: linear-gradient(135deg, #fff 0%, var(--brand-soft) 140%); }
.card.hero .ic { width: 96px; height: 96px; padding: 22px; border-radius: 26px; background: var(--brand-soft); color: var(--brand); flex: none; box-shadow: inset 0 0 0 1px rgba(181,71,27,.12); }
.card.hero .ic svg { width: 100%; height: 100%; display: block; }
.card.hero b { display: block; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 6px; }
.card.hero span:not(.ic) { color: var(--muted); font-size: 14px; line-height: 1.45; }
.card + .grid-2, .scan-top + .grid-2 { margin-top: 0; }
.grid-2 + .card, .card + .card { margin-top: 16px; }
.grid-2 > .card + .card, .scan-top > .card + .card { margin-top: 0; }
@media (max-width: 860px) {
  .scan-top { grid-template-columns: 1fr; gap: 14px; margin-bottom: 14px; }
  .card.hero { display: none; }
}
.scanrow { display: flex; gap: 8px; align-items: stretch; }
.scanrow .scanbox { flex: 1 1 auto; min-width: 0; }
.scanrow .cambtn { flex: none; width: 60px; padding: 0; border-radius: 12px; min-height: 0; }
.scanrow .cambtn svg { width: 26px; height: 26px; }
.camwrap { margin-top: 10px; background: #111; border-radius: 12px; overflow: hidden; position: relative; }
.camwrap video { display: block; width: 100%; max-height: 60vh; object-fit: cover; background: #000; }
.camwrap .camhint { color: #fff; font-size: 13px; padding: 8px 12px; }
.camwrap .camclose { position: absolute; top: 8px; right: 8px; }
/* input.scanbox outranks the input[type=text] rule above; at 15px iOS Safari zooms the page when the box takes focus. */
input.scanbox { font-size: 21px; padding: 14px 16px; min-height: 60px; border-radius: 12px; border: 2px solid var(--line-2); width: 100%; font-weight: 500; }
input.scanbox::placeholder { font-weight: 400; color: #a8a29e; font-size: 17px; }
input.scanbox:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.banner { display: flex; gap: 12px; align-items: flex-start; font-size: 19px; font-weight: 700; padding: 16px 18px; border-radius: var(--radius-sm); margin: 14px 0 0; line-height: 1.35; animation: pop .18s ease-out; }
.banner::before { flex: none; width: 28px; height: 28px; border-radius: 50%; margin-top: 1px; border: 2px solid currentColor; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 800; line-height: 1; }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.banner.ok::before { content: "\2713"; background: currentColor; color: var(--ok-soft); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.warn::before { content: "!"; }
.banner.error { background: var(--bad-soft); color: var(--bad); }
.banner.error::before { content: "\00d7"; background: currentColor; color: var(--bad-soft); font-size: 20px; }
.banner.info { background: var(--info-soft); color: var(--info); font-weight: 500; font-size: 16px; animation: none; }
.banner.info::before { content: "i"; font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 17px; width: 26px; height: 26px; }
@keyframes pop { from { transform: scale(.97); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .banner { animation: none; } }
.units { font-size: 48px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.units small { font-size: 18px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.meter { height: 14px; background: var(--line); border-radius: 7px; overflow: hidden; margin: 12px 0 16px; }
.meter div { height: 100%; background: linear-gradient(90deg, #22a04d, var(--ok)); transition: width .2s; border-radius: 7px; }
.meter.over div { background: linear-gradient(90deg, #d97706, var(--warn)); }
.empty { color: var(--muted); padding: 22px; text-align: center; font-size: 14px; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(900px 500px at 50% -10%, #f7e2d6 0%, var(--bg) 60%); }
.login { width: 100%; max-width: 380px; background: var(--surface); padding: 32px; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); }
.login .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 21px; margin-bottom: 22px; letter-spacing: -0.01em; }
.login .brand .mark { width: 36px; height: 36px; border-radius: 10px; font-size: 14px; }
.login button { width: 100%; justify-content: center; min-height: var(--touch); }

/* Pager: shown under a list only when it runs past one page. */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 2px 0; font-size: 13.5px; }
.pager .range { color: var(--muted); font-variant-numeric: tabular-nums; }
.pager .pages { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pager .pages a, .pager .pages span { display: inline-block; min-width: 32px; padding: 6px 9px; text-align: center; border-radius: 8px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pager .pages a { color: var(--ink); background: var(--surface); border: 1px solid var(--line); }
.pager .pages a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.pager .pages .on { background: var(--brand); color: #fff; }
.pager .pages .off { color: var(--muted); opacity: .5; }
.pager .pages .gap { min-width: 0; padding: 6px 2px; color: var(--muted); }
@media (max-width: 640px) { .pager { justify-content: center; } .pager .range { width: 100%; text-align: center; } }

/* Role form: permissions grouped by stage of the work, in sequence. */
.permgroups { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.permgroup { margin: 0; padding: 12px 14px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); min-width: 0; }
.permgroup legend { display: flex; align-items: center; gap: 8px; padding: 0 6px; font-weight: 700; font-size: 14px; }
.permgroup legend .n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; }
.permgroup .hint { color: var(--muted); font-size: 12.5px; margin: 0 0 10px; }
.permgroup .checks { grid-template-columns: 1fr; gap: 6px; }

/* Settings help: explanation card and per-field hints. */
.card.explain { background: var(--brand-soft); border-color: transparent; }
.card.explain ol, .card.explain ul { margin: 0; padding-left: 22px; max-width: 78ch; }
.card.explain li { margin: 6px 0; }
.card.explain ul { margin-top: 4px; }
label .help { display: block; font-weight: 400; font-size: 12.5px; color: var(--muted); margin-top: 4px; line-height: 1.45; }

/* Rows whose fields carry hints line up at the top, not the baseline. */
.inline.top { align-items: flex-start; }

/* A bordered table box inside a card keeps normal cell padding; the
   edge-to-edge card table rules are for bare tables only. */
.card .table-wrap { margin: 0; box-shadow: none; }
.card .table-wrap table { margin: 0; width: 100%; }
.card .table-wrap th, .card .table-wrap td { padding: 11px 14px; }
