:root {
  color-scheme: light dark;
  --bg: #f4f4f5; --card: #fff; --text: #18181b; --muted: #52525b; --placeholder: #71717a;
  --line: #e4e4e7; --line-strong: #d4d4d8; --field-line: #71717a;
  --brand: #b91c1c; --brand-text: #b91c1c;
  --primary: #18181b; --on-primary: #fff;
  --ok: #166534; --ok-bg: #dcfce7;
  --red: #991b1b; --red-bg: #fee2e2;
  --orange: #9a3412; --orange-bg: #ffedd5; --orange-line: #c2410c;
  --yellow: #854d0e; --yellow-bg: #fef9c3;
  --neutral: #3f3f46; --neutral-bg: #f4f4f5;
  --purple: #7e22ce; --blue: #1d4ed8;
  --radius: 12px; --control: 10px;
}
/* Dark mode: follows the system unless the viewer picked light or dark (localStorage "theme", shared with the admin) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #18181b; --card: #27272a; --text: #f4f4f5; --muted: #b4b4bd; --placeholder: #a1a1aa;
    --line: #3f3f46; --line-strong: #52525b; --field-line: #a1a1aa;
    --brand-text: #fca5a5;
    --primary: #f4f4f5; --on-primary: #18181b;
    --ok: #bbf7d0; --ok-bg: #14532d;
    --red: #fecaca; --red-bg: #7f1d1d;
    --orange: #fed7aa; --orange-bg: #7c2d12; --orange-line: #fb923c;
    --yellow: #fef08a; --yellow-bg: #713f12;
    --neutral: #e4e4e7; --neutral-bg: #3f3f46;
    --purple: #d8b4fe; --blue: #93c5fd;
  }
}
:root[data-theme="dark"] {
  --bg: #18181b; --card: #27272a; --text: #f4f4f5; --muted: #b4b4bd; --placeholder: #a1a1aa;
  --line: #3f3f46; --line-strong: #52525b; --field-line: #a1a1aa;
  --brand-text: #fca5a5;
  --primary: #f4f4f5; --on-primary: #18181b;
  --ok: #bbf7d0; --ok-bg: #14532d;
  --red: #fecaca; --red-bg: #7f1d1d;
  --orange: #fed7aa; --orange-bg: #7c2d12; --orange-line: #fb923c;
  --yellow: #fef08a; --yellow-bg: #713f12;
  --neutral: #e4e4e7; --neutral-bg: #3f3f46;
  --purple: #d8b4fe; --blue: #93c5fd;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* Base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; padding-bottom: 68px; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); }
body.focus { padding-bottom: 0; }
main { max-width: 1280px; margin: 0 auto; padding: 16px; }
[hidden] { display: none !important; }
h1, h2, h3, p, ul { margin: 0; }
.card > h2 { margin-bottom: 6px; }
.card h3 { margin-top: 14px; }
h1 { font-size: 1.25rem; line-height: 1.25; }
h2 { font-size: .9375rem; }
h3 { font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
a { color: var(--text); }
:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }
.appbar :focus-visible { outline-color: #fff; }
.muted { color: var(--muted); font-weight: 400; font-size: .875rem; }
.since { display: block; font-size: .75rem; }
.ok { color: var(--ok); }
.error { color: var(--brand-text); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 20; padding: 10px 14px; border-radius: var(--control);
  background: var(--primary); color: var(--on-primary); }
.skip-link:focus { top: 8px; }

/* App bar and navigation: bottom tab bar on phones, inline in the header on desktop */
.appbar { background: var(--brand); color: #fff; }
.appbar-row { display: flex; align-items: center; gap: 8px; min-height: 56px; max-width: 1280px; margin: 0 auto; padding: 6px 12px 6px 16px; }
.appbar-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 2px; }
.brand { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 44px; min-height: 44px; font-size: 1.0625rem; font-weight: 700; color: #fff; text-decoration: none; }
.back { flex: none; display: grid; place-items: center; width: 44px; height: 44px; margin-left: -12px; border-radius: var(--control); color: #fff; }
.titles { min-width: 0; }
.titles h1 { font-size: 1.0625rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.titles p { font-size: .8125rem; }
.logout { margin: 0; }
.menu-logout { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--line); }
.menu-logout button { display: flex; align-items: center; justify-content: flex-start; width: 100%; min-height: 48px; padding: 0 12px; border: 0; background: none; color: var(--text); font: inherit; font-size: .9375rem; text-align: left; }
@media (max-width: 799px) { .appbar-row > .logout { display: none; } }
@media (min-width: 800px) { .menu-logout { display: none; } }
.station-switch { margin: 0; }
.station-switch select { display: block; width: auto; min-height: 44px; max-width: 46vw; margin: 0; padding: 0 28px 0 12px; border: 0; border-radius: 22px; background-color: rgba(255, 255, 255, .18);
  color: #fff; font: 600 .875rem system-ui, sans-serif; }
.station-switch option { color: var(--text); background: var(--card); }
body.focus .station-switch, body.sub .appbar .station-switch { display: none; }
.logout button { min-height: 44px; padding: 0 14px; border-radius: 22px; background: rgba(255, 255, 255, .18); color: #fff; font-size: .875rem; }
.appbar-progress { max-width: 1280px; margin: 0 auto; padding: 0 16px 14px; }
.appbar-progress .progress { background: rgba(255, 255, 255, .3); }
.appbar-progress .progress div { background: #fff; }
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress div { height: 100%; border-radius: 3px; background: var(--ok); }

.mainnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  padding: 4px; background: var(--card); border-top: 1px solid var(--line); }
.mainnav a, .nav-more summary { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px;
  border-radius: var(--control); font-size: .65625rem; font-weight: 500; color: var(--muted); text-decoration: none; }
.mainnav a[aria-current], .nav-more summary.current { color: var(--brand-text); font-weight: 700; }
.mainnav :focus-visible { outline-color: #2563eb; }
.mainnav svg, .back svg, .chevron { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
body.focus .mainnav, body.focus .logout, body.sub .logout { display: none; }

/* Secondary entries: "Mehr" sheet on phones, dropdown on desktop */
.nav-more summary { list-style: none; cursor: pointer; }
.nav-more summary::-webkit-details-marker { display: none; }
.nav-more[open] summary::before { content: ""; position: fixed; inset: 0; z-index: 1; background: rgba(0, 0, 0, .35); cursor: default; }
.nav-menu { position: fixed; right: 8px; bottom: 72px; z-index: 2; min-width: 220px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.mainnav .nav-menu a { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 48px; padding: 0 12px; font-size: .9375rem; color: var(--text); }
.mainnav .nav-menu a[aria-current] { color: var(--brand-text); }

@media (min-width: 800px) {
  body { padding-bottom: 0; }
  main { padding: 24px; }
  .appbar-row { padding: 6px 24px; }
  .appbar-progress { padding: 0 24px 14px; }
  .mainnav, body.focus .mainnav { position: static; display: flex; gap: 2px; padding: 0; background: none; border: 0; }
  .mainnav a, .mainnav a[aria-current], .nav-more summary, .nav-more summary.current { flex-direction: row; min-height: 44px; padding: 0 12px;
    font-size: .9375rem; color: #fff; white-space: nowrap; }
  .mainnav a:hover, .mainnav a[aria-current], .nav-more summary:hover, .nav-more summary.current, .nav-more[open] summary { background: rgba(255, 255, 255, .18); }
  .mainnav svg { display: none; }
  .mainnav :focus-visible { outline-color: #fff; }
  .nav-more { position: relative; }
  .nav-more summary::after { content: ""; margin: 5px 0 0 6px; border: 4px solid transparent; border-top-color: currentColor; }
  .nav-more[open] summary::before { background: none; }
  .nav-menu { position: absolute; top: calc(100% + 6px); right: 0; bottom: auto; }
  .mainnav .nav-menu a, .mainnav .nav-menu a[aria-current] { min-height: 44px; background: none; color: var(--text); }
  .mainnav .nav-menu a:hover { background: var(--neutral-bg); }
  .mainnav .nav-menu a[aria-current] { color: var(--brand-text); }
  .mainnav .nav-menu :focus-visible { outline-color: #2563eb; }
  body.focus .logout, body.sub .logout { display: block; }
}

/* Light/dark toggle (sidebar head, app bar) */
.theme-toggle { flex: none; display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 22px;
  background: rgba(255, 255, 255, .18); color: #fff; }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .icon-sun, .theme-toggle.is-dark .icon-moon { display: none; }
.theme-toggle.is-dark .icon-sun { display: block; }
body.focus .appbar .theme-toggle { display: none; }

/* Desktop sidebar: replaces the header navigation from 1000px on */
.sidebar { display: none; }
@media (min-width: 1000px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 5; display: flex; flex-direction: column; width: 264px; overflow-y: auto;
    background: var(--card); border-right: 1px solid var(--line); }
  .sidebar ~ .appbar, .sidebar ~ main { margin-left: 264px; }
  .sidebar-head { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 0 8px 0 12px; background: var(--brand); }
  .sidebar-brand { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 44px; color: #fff; white-space: nowrap;
    font-size: .875rem; font-weight: 700; text-decoration: none; }
  .sidebar-brand-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .sidebar-mark { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: #fff; color: var(--brand); }
  .sidebar svg { flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; }
  .sidebar-nav a { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: var(--control);
    color: var(--text); font-weight: 500; text-decoration: none; }
  .sidebar-nav a:hover { background: var(--neutral-bg); }
  .sidebar-nav a[aria-current] { background: var(--red-bg); color: var(--brand-text); font-weight: 700; }
  .sidebar-section { margin: 10px 12px 2px; font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
  .sidebar-foot { display: flex; flex-direction: column; gap: 10px; margin-top: auto; padding: 12px; border-top: 1px solid var(--line); }
  .sidebar-foot .station-switch select { width: 100%; max-width: none; border-radius: var(--control); background-color: var(--neutral-bg); color: var(--text); }
  .sidebar-user { display: flex; align-items: center; gap: 10px; }
  .avatar { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--red-bg);
    color: var(--brand-text); font-size: .875rem; font-weight: 700; letter-spacing: .02em; }
  .sidebar-user-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
  .sidebar-user-text strong, .sidebar-user-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar-user-text strong { font-size: .9375rem; }
  .sidebar-user-text span { font-size: .8125rem; color: var(--muted); }
  .sidebar-user form { margin: 0; }
  .icon-button { width: 40px; min-height: 40px; height: 40px; padding: 0; border: 0; border-radius: var(--control); background: none; color: var(--muted); }
  .icon-button:hover { background: var(--neutral-bg); color: var(--brand-text); }
  .sidebar ~ .appbar .mainnav, .sidebar ~ .appbar .station-switch, .sidebar ~ .appbar .logout, .sidebar ~ .appbar .theme-toggle { display: none !important; }
  body:not(.sub):not(.focus) .sidebar ~ .appbar { display: none; }
}

/* Scan lookup result on the article page */
.scan-hit { border: 2px solid var(--ok); }
.scan-hit h2 { margin-bottom: 6px; }
.scan-hit p { margin-bottom: 12px; }
.row.is-scanned { margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: var(--control); background: var(--ok-bg); }

/* Cards, lists, pills */
.card { background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.page-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 16px; }
.hint-toggle { display: inline-grid; place-items: center; width: 22px; height: 22px; min-height: 0; padding: 0; margin-left: 2px; vertical-align: middle;
               border-radius: 50%; border: 1.5px solid var(--muted); background: transparent; color: var(--muted);
               font: italic 700 .8rem/1 Georgia, serif; position: relative; }
.hint-toggle::after { content: ""; position: absolute; inset: -11px; }
.hint-toggle[aria-expanded="true"] { background: var(--muted); color: var(--card); }
.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.columns { display: grid; gap: 0 16px; align-items: start; }
@media (min-width: 900px) { .columns { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.columns > .span-all { grid-column: 1 / -1; }

.rows { list-style: none; padding: 0; }
.rows > li { border-bottom: 1px solid var(--line); }
.rows > li:last-child { border-bottom: 0; }
.row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 0; color: var(--text); text-decoration: none; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; overflow-wrap: break-word; }
.row-title { font-size: .9375rem; font-weight: 500; }
.row-sub { font-size: .8125rem; color: var(--muted); }
.chevron { flex: none; color: var(--muted); }
.rows > li.group { position: sticky; top: 0; z-index: 1; padding: 14px 0 6px; background: var(--card);
  font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.level { flex: none; font-size: .875rem; font-weight: 600; color: var(--brand-text); font-variant-numeric: tabular-nums; }
.qty { flex: none; min-width: 2.5rem; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

.pill { flex: none; display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap;
  background: var(--neutral-bg); color: var(--neutral); }
.pill.date { min-width: 4.25rem; border-radius: 6px; text-align: center; font-variant-numeric: tabular-nums; }
.pill.expired, .pill.low { background: var(--red-bg); color: var(--red); }
.pill.due30, .pill.diff { background: var(--orange-bg); color: var(--orange); }
.pill.due60, .pill.warn { background: var(--yellow-bg); color: var(--yellow); }
.pill.done { background: var(--ok-bg); color: var(--ok); }
.tag { display: inline-block; padding: 0 4px; border: 1px solid currentColor; border-radius: 4px; font-size: .6875rem; font-weight: 700;
  line-height: 1.5; vertical-align: middle; color: var(--muted); }
.tag.sg { color: var(--purple); }
.tag.cold { color: var(--blue); }

.messages { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.msg { padding: 12px 14px; border-radius: var(--control); background: var(--card); border-left: 4px solid var(--line-strong); font-weight: 500; }
.msg.success { background: var(--ok-bg); color: var(--ok); border-color: currentColor; }
.msg.error { background: var(--red-bg); color: var(--red); border-color: currentColor; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { display: flex; flex-direction: column; justify-content: center; gap: 6px; min-height: 76px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); color: var(--text); font-size: .9375rem; font-weight: 600; text-decoration: none; }
.tile svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 800px) { .tiles { display: none; } }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.stats > div { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--radius); background: var(--card); }
.stats span { font-size: .8125rem; color: var(--muted); }
.stats strong { font-size: 1.5rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
@media (min-width: 800px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Tables: wide ones scroll inside their box, never the page */
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.table-wrap table { min-width: 760px; }
.table-wrap table.compact { min-width: 0; }
.table-wrap table.compact td:first-child { min-width: 0; }
.table-wrap table.compact .num { white-space: nowrap; }
.table-wrap td:first-child { min-width: 11rem; }
table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: .75rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
th.num, td.num { text-align: right; }
tr.group-row th { padding-top: 16px; text-transform: uppercase; letter-spacing: .04em; white-space: normal; }
.diff-neg { color: var(--orange); font-weight: 700; }
.diff-pos { color: var(--ok); font-weight: 700; }

/* Forms and buttons */
label { display: block; font-size: .875rem; font-weight: 600; }
input, select { display: block; width: 100%; min-height: 48px; margin-top: 4px; padding: 0 12px; font: inherit; font-size: 1rem;
  border: 1px solid var(--field-line); border-radius: var(--control); background: var(--card); color: var(--text); }
input::placeholder { color: var(--placeholder); opacity: 1; font-weight: 400; }
input[type=checkbox] { flex: none; width: 22px; height: 22px; min-height: 0; margin: 0; padding: 0; accent-color: var(--primary); }
label.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 500; }
button, a.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px;
  border: 1px solid var(--primary); border-radius: var(--control); background: var(--primary); color: var(--on-primary);
  font: inherit; font-size: .9375rem; font-weight: 600; text-align: center; text-decoration: none; cursor: pointer; }
button.secondary, a.button.secondary { background: var(--card); border-color: var(--line-strong); color: var(--text); }
button.dashed { width: 100%; background: none; border: 1px dashed var(--field-line); color: var(--text); font-weight: 500; }
.logout button { border: 0; }
.block { width: 100%; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar form { margin: 0; }
.toolbar > :first-child { flex: 1; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.inline-form select { flex: 1 1 180px; width: auto; margin: 0; }
.list-search { position: relative; margin-bottom: 12px; }
.list-search svg { position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); fill: none; stroke: var(--muted);
  stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.list-search input { margin: 0; padding-left: 44px; }
.narrow-search { max-width: 560px; margin-bottom: 16px; }
.segmented { display: flex; margin-bottom: 16px; padding: 3px; border-radius: var(--control); background: var(--line); }
.segmented a { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 14px; border-radius: 8px;
  font-size: .875rem; font-weight: 500; color: var(--text); text-decoration: none; }
.segmented a[aria-current] { background: var(--card); font-weight: 700; box-shadow: 0 1px 2px rgba(0, 0, 0, .15); }

/* Sticky action bar at the bottom of task pages */
.action-bar { position: sticky; bottom: 0; z-index: 5; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 10px;
  margin: 0 -16px; padding: 10px 16px 14px; background: var(--bg); border-top: 1px solid var(--line); }
.action-bar.single { grid-template-columns: minmax(0, 1fr); }
.action-bar button { min-height: 52px; padding: 0 10px; }
@media (min-width: 800px) {
  .action-bar { margin: 0; padding: 12px 0; }
  .action-bar.single { justify-content: end; grid-template-columns: auto; }
}

/* Login: brand band with the form card overlapping it, same layout on all widths */
body.auth .appbar { display: none; }
body.auth main { max-width: none; padding: 0; }
.auth-shell { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.auth-brand { padding: 28px 24px 60px; color: #fff; background: linear-gradient(160deg, #b91c1c, #7f1d1d); }
.auth-logo { display: flex; align-items: center; gap: 12px; max-width: 420px; margin: 0 auto; }
.auth-logo > span:last-child { display: flex; flex-direction: column; font-size: .875rem; }
.auth-logo strong { font-size: 1.25rem; line-height: 1.25; }
.auth-logo span span { opacity: .85; }
.auth-mark { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: #fff; color: var(--brand); }
.auth-mark svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.auth-panel { flex: 1; padding: 0 16px 24px; }
.auth-form { max-width: 420px; margin: -36px auto 0; padding: 24px 20px; border-radius: 16px; background: var(--card);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 10px 30px rgba(0, 0, 0, .1); }
.auth-form h1 { font-size: 1.5rem; }
.auth-form .msg { margin-top: 16px; }
.auth-form input { font-weight: 400; }
.auth-form form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.auth-form button { min-height: 52px; margin-top: 4px; background: #b91c1c; border-color: #b91c1c; color: #fff; font-size: 1rem; }
.auth-form button:hover { background: #991b1b; border-color: #991b1b; }
.login-choices { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.login-choice { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--card); }
.login-choice[open] { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.login-choice > summary { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 14px; list-style: none; cursor: pointer; }
.login-choice > summary::-webkit-details-marker { display: none; }
.login-choice[open] > summary .chevron { transform: rotate(180deg); }
.login-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--red-bg); color: var(--brand-text); }
.login-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.login-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.login-text span { font-size: .8125rem; color: var(--muted); }
.login-choice > form, .login-choice > .msg, .login-choice > .muted { margin: 0 14px 14px; }
.login-choice > .msg { margin-top: 0; }
.auth-note { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: .8125rem; color: var(--muted); }
@media (min-width: 800px) {
  .auth-brand { padding: 56px 24px 96px; }
  .auth-form { margin-top: -56px; padding: 32px; }
}

/* Stock count: list */
.count-list .row { min-height: 56px; }

/* Stock count: one article */
.count-card { border: 2px solid var(--primary); padding: 18px 16px 20px; }
.count-title { font-size: 1.25rem; line-height: 1.25; margin: 2px 0; overflow-wrap: break-word; }
.eyebrow { font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.count-rows { margin: 14px 0 4px; border-top: 1px solid var(--line); }
.count-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.count-row:last-child { border-bottom: 0; }
.count-row .tag { align-self: flex-start; margin-top: 4px; color: var(--muted); }
.count-row label { flex: 1 1 120px; display: flex; flex-direction: column; gap: 1px; font-size: .9375rem; }
.count-row label span { font-size: .8125rem; font-weight: 400; color: var(--muted); }
.stepper { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.stepper input { width: 4.75rem; min-height: 52px; margin: 0; padding: 0 4px; border-width: 2px; text-align: center;
  font-size: 1.375rem; font-weight: 700; font-variant-numeric: tabular-nums; appearance: textfield; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper button { width: 52px; min-height: 52px; padding: 0; background: var(--card); border-color: var(--line-strong); color: var(--text);
  font-size: 1.5rem; line-height: 1; touch-action: manipulation; }
.count-note { flex: 1 0 100%; font-size: .8125rem; font-weight: 600; text-align: right; }
.count-note:empty { display: none; }
.since-row { flex: 1 0 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.count-row .since-row label { flex: 0 1 auto; flex-direction: row; align-items: center; gap: 8px; font-size: .875rem; }
.since-row input { width: 7.5em; }
.since-row .usable { font-size: .8125rem; color: var(--muted); }
.count-row.is-diff input { border-color: var(--orange-line); background: var(--orange-bg); }
.count-row.is-diff .count-note { color: var(--orange); }
.count-row.is-match input { border-color: var(--ok); }
.count-row.is-match .count-note { color: var(--ok); }
.new-batch { margin: 20px 0 4px; border: 1px dashed var(--field-line); border-radius: var(--control); }
.new-batch > .scanner { padding: 16px 16px 0; gap: 12px; }
.new-batch > .scan-result { margin: 12px 16px 0; }
.new-batch summary { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; font-size: .9375rem; font-weight: 500; cursor: pointer; list-style: none; }
.new-batch summary::-webkit-details-marker { display: none; }
.new-batch summary::before { content: "+"; font-size: 1.25rem; font-weight: 600; line-height: 1; }
.new-batch[open] summary::before { content: "−"; }
.new-batch[open] summary { border-bottom: 1px dashed var(--line-strong); }
.new-batch-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; align-items: end; padding: 16px; }
.new-batch-fields button { grid-column: 1 / -1; min-height: 48px; }

/* Loading list review (Zuordnung) */
.review-head { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; margin-bottom: 10px; }
.review-form { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; }
.review-option { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 320px; min-width: 0; }
.review-option input, .review-option select { margin: 0; flex: 1 1 160px; width: auto; min-width: 0; }
.bulk-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
@media (min-width: 800px) { .bulk-bar { position: sticky; top: 0; z-index: 2; box-shadow: 0 1px 4px rgba(0, 0, 0, .15); } }

/* Grid tables (stock, order proposal): stacked rows on phones, aligned columns on desktop */
.ghead { display: none; }
.grow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 12px 0; }
summary.grow { cursor: pointer; list-style: none; }
summary.grow::-webkit-details-marker { display: none; }
.g-main { flex: 1 0 100%; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-weight: 400; overflow-wrap: break-word; }
.g-cell { font-size: .875rem; }
.g-cell.num { text-align: left; }
.g-label { margin-right: 6px; font-size: .75rem; color: var(--muted); }
.g-toggle { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; color: var(--muted); white-space: nowrap; }
.g-toggle .chevron { width: 18px; height: 18px; }
details[open] > summary .g-toggle .chevron { transform: rotate(180deg); }
.batch-box { margin-bottom: 12px; padding: 2px 12px; border-radius: var(--control); background: var(--bg); overflow-x: auto; }
.batch-box table { font-size: .875rem; }
.batch-box th, .batch-box td { padding: 8px; }
.summary-pills { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

.filters { padding-bottom: 2px; }
.filters .list-search { margin: 0; }
.filters select { min-height: 44px; margin: 0; font-weight: 400; }
.filter-more > summary { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: .9375rem; font-weight: 600; cursor: pointer; list-style: none; }
.filter-more > summary::-webkit-details-marker { display: none; }
.filter-more .chevron { width: 18px; height: 18px; margin-left: auto; transition: transform .15s; }
.filter-more[open] .chevron { transform: rotate(180deg); }
.filter-panel { display: grid; gap: 4px; padding-bottom: 10px; }
.filter-checks { display: flex; flex-wrap: wrap; gap: 0 18px; }
.filter-actions { display: flex; gap: 10px; }
.filter-actions:not(:has(> :not([hidden]))) { display: none; }
.filter-actions > * { flex: 1; min-height: 44px; }

.order-table .grow { align-items: flex-start; }
.order-table .g-main { flex: 1 1 0; }
@media (max-width: 799px) {
  .order-table .g-cell { order: 1; }
  .stock-table .g-main { flex: 1 1 60%; }
  .stock-table .g-toggle { order: 1; }
  .stock-table .g-cell:not(.g-toggle) { order: 2; }
}
.g-check { display: grid; place-items: center; min-height: 28px; }
.g-reason { flex: 1 0 100%; }
.g-qty { flex: 1 0 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.g-qty input { width: 6rem; min-height: 44px; margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.field-error { flex: 1 0 100%; font-size: .8125rem; font-weight: 600; color: var(--orange); }
.has-error .g-qty input { border-color: var(--orange-line); background: var(--orange-bg); }

@media (min-width: 800px) {
  .ghead, .grow, .order-table .grow { display: grid; gap: 0 16px; align-items: center; }
  .ghead { padding: 8px 0; border-bottom: 1px solid var(--line-strong); font-size: .75rem; font-weight: 600; color: var(--muted); }
  .stock-table .ghead, .stock-table .grow { grid-template-columns: minmax(0, 2.6fr) minmax(0, 1fr) 4.5rem 7rem 11rem 7rem; }
  .order-table .ghead, .order-table .grow { grid-template-columns: 22px 6.5rem minmax(0, 2fr) minmax(0, 2fr) 3rem 6.5rem 9.5rem; }
  summary.grow:hover { background: var(--bg); box-shadow: -8px 0 var(--bg), 8px 0 var(--bg); }
  .g-cell.num { text-align: right; }
  .g-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .g-toggle { margin-left: 0; justify-content: flex-end; }
  .filter-panel { grid-template-columns: minmax(0, 18rem) auto auto; justify-content: start; align-items: center; gap: 0 24px; }
  .filter-actions > * { flex: none; }
}

/* Links from article names to the article detail page */
.article-link { color: inherit; text-decoration: none; hyphens: auto; }
.article-link:hover, .article-link:focus-visible { text-decoration: underline; }
p > .article-link.muted { font-size: .875rem; text-decoration: underline; }

/* Dashboard: expiry grouped into collapsible buckets */
.buckets { display: flex; flex-direction: column; }
.bucket { border-top: 1px solid var(--line); }
.bucket:first-child { border-top: 0; }
.bucket > summary, .bucket.is-empty { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 0; }
.bucket > summary { cursor: pointer; list-style: none; }
.bucket > summary::-webkit-details-marker { display: none; }
.bucket-count { min-width: 2.25rem; text-align: center; font-variant-numeric: tabular-nums; }
.bucket-label { font-weight: 600; }
.bucket-meta { margin-left: auto; color: var(--muted); font-size: .8125rem; white-space: nowrap; }
.bucket .chevron { width: 18px; height: 18px; flex: none; transition: transform .15s; }
.bucket[open] .chevron { transform: rotate(180deg); }
.bucket.is-empty { color: var(--muted); }
.bucket.is-empty .bucket-label { font-weight: 400; }
.rows.compact .row { min-height: 0; padding-top: 6px; padding-bottom: 6px; }

/* Count page: batch overview separates counting from "Charge erfassen" */
.batch-summary { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.batch-total { display: flex; gap: 16px; font-weight: 600; }
.batch-total > :first-child { flex: 1; }
.batch-total strong { font-variant-numeric: tabular-nums; }
.batch-table > summary { display: inline-flex; align-items: center; min-height: 44px; font-size: .875rem; color: var(--muted); text-decoration: underline; cursor: pointer; }
.batch-summary .table-wrap table { min-width: 0; }
.batch-summary .table-wrap td:first-child { min-width: 0; }
.batch-summary .pending { color: var(--muted); }
.batch-summary + .new-batch, .count-card > .new-batch { margin-top: 20px; }

/* --- NFS withdrawal confirmation/review and report headers --- */
.msg.warning { background: var(--orange-bg); color: var(--orange); border-color: var(--orange-line); }
.done-card { display: flex; flex-direction: column; gap: 14px; }
.done-head { display: flex; align-items: center; gap: 12px; margin: -14px -16px 0; padding: 18px 16px; border-radius: var(--radius) var(--radius) 0 0;
  background: var(--ok-bg); color: var(--ok); }
.done-head svg { flex: none; width: 44px; height: 44px; padding: 8px; border-radius: 50%; background: var(--ok); stroke: var(--ok-bg); stroke-width: 3;
  fill: none; stroke-linecap: round; stroke-linejoin: round; }
.done-head h1 { font-size: 1.375rem; }
.done-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.withdrawal-row { flex-wrap: wrap; }
.withdrawal-row .row-main { flex: 1 1 220px; }
.report-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; }
.report-head .hint { grid-column: 1 / -1; }
a.report-excel { grid-row: 1; grid-column: 2; min-height: 40px; padding: 0 14px; font-size: .875rem; }
.report-crumb { display: inline-block; margin: -14px -6px; padding: 14px 6px; }
.report-filter { display: flex; flex-wrap: wrap; gap: 10px; }
.report-filter label { flex: 1 1 160px; font-size: .8125rem; color: var(--muted); }
.report-filter select { color: var(--text); font-weight: 400; }
.report-filter button { align-self: flex-end; }
a.report-edit { display: inline-block; padding: 4px 0; font-size: .8125rem; }
a.button.row-action { flex: none; min-height: 40px; padding: 0 10px; font-size: .8125rem; font-weight: 500; }
.cell-link { display: block; margin: -10px -8px; padding: 10px 8px; min-height: 44px; }
.cell-link .muted { display: block; }

/* Inventory count header, dashboard status line, stock list rows */
.count-actions { display: grid; gap: 10px; }
.count-actions-split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 10px; }
.count-actions-split form { margin: 0; }
.count-actions-split button, .count-actions-split .button { width: 100%; padding: 0 8px; font-size: .9375rem; }
.all-reviewed { font-size: .875rem; text-align: center; }
.stock-table a.g-main { justify-content: center; min-height: 44px; color: var(--text); }

/* Confirming a recognized ampoule: expiry warning, suggestions, new-batch check, recognition hint */
.scan-flag { padding: .6rem .8rem; border-radius: 10px; font-size: .9rem; font-weight: 600; }
.scan-flag:empty { display: none; }
.scan-flag.red { background: var(--red-bg); color: var(--red); }
.scan-flag.yellow { background: var(--yellow-bg); color: var(--yellow); }
.scan-hint:empty, .scan-suggest:empty { display: none; }
.scan-suggest { display: flex; flex-direction: column; gap: 8px; }
.scan-suggest button { width: 100%; min-height: 44px; white-space: normal; }
.new-batch-check { display: grid; gap: 6px; padding: .6rem .8rem; border: 1px solid currentColor; border-radius: 10px;
  background: var(--yellow-bg); color: var(--yellow); }
.new-batch-check[hidden] { display: none; }
.new-batch-check p { font-weight: 700; }
.new-batch-check label { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; color: inherit; }
.new-batch-check input { width: 22px; height: 22px; min-height: 0; margin: 0; accent-color: var(--yellow); }
.article-filter { width: 100%; }
.new-batch-fields .new-batch-check { grid-column: 1 / -1; }
.new-batch > .scan-flag, .new-batch > .scan-hint, .new-batch > .scan-suggest { margin: 12px 16px 0; }

/* --- Paper checklist transfer (one row per printed row number) --- */
.paper-form { display: grid; gap: 16px; }
.paper-form .msg ul { margin: 6px 0 0; padding-left: 20px; font-weight: 500; }
.paper-checker { max-width: 24rem; margin-top: 12px; }
.table-wrap table.paper-table { min-width: 860px; }
.paper-table td { vertical-align: top; }
.table-wrap .paper-table td:first-child { min-width: 0; width: 3rem; }
.paper-table td.nr { font-weight: 700; }
.paper-table td:nth-child(2) { min-width: 12rem; }
.paper-table input, .paper-table select { min-height: 38px; margin: 0; padding: 0 8px; }
.paper-table input[type=number] { width: 5.5rem; }
.paper-table input.lot { width: 8rem; }
.paper-table input.month { width: 6.5rem; }
.paper-table tr.extra td { background: var(--bg); }
.paper-table tr.expired td:nth-child(2) { color: var(--red); font-weight: 600; }
.paper-confirm { min-height: 32px; margin-top: 4px; font-size: .8125rem; white-space: nowrap; }
.paper-confirm input[type=checkbox] { width: 18px; height: 18px; }
.count-actions-split.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.paper-note { margin: 0; }

/* Training instance: black header with yellow name and a warning-striped banner (contrast to the live red) */
.training .appbar, .training .sidebar-head { background: #111; }
.training .brand, .training .sidebar-brand { color: #facc15; }
.training .sidebar-mark { background: #facc15; color: #111; }
.training-banner { padding: 5px 16px; text-align: center; background: repeating-linear-gradient(-45deg, #facc15 0 12px, #111 12px 24px); }
.training-banner span { display: inline-block; padding: 2px 10px; border-radius: 4px; background: #facc15; color: #111;
  font-size: .8125rem; font-weight: 800; letter-spacing: .04em; }
