/* ============================================================
   The Collection Hub — Steep design system (DESIGN.md)
   Serif analytics on warm paper · light theme only (bewusst)
   ============================================================ */

@font-face {
  font-family: "Sohne";
  src: url("fonts/inter-var.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Signifier";
  src: url("fonts/source-serif-4-var.woff2") format("woff2-variations");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Signifier";
  src: url("fonts/source-serif-4-italic-var.woff2") format("woff2-variations");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

:root {
  /* Colors */
  --ink: #17191c;
  --paper: #ffffff;
  --mist: #f2f2f3;
  --fog: #fafafb;
  --slate: #777b86;
  --ash: #979799;
  --smoke: #a3a6af;
  --peach: #fbe1d1;
  --sienna: #5d2a1a;
  --hairline: #ececec;

  /* Type */
  --serif: "Signifier", "Source Serif 4", Georgia, ui-serif, serif;
  --sans: "Sohne", "Inter", ui-sans-serif, system-ui, "Segoe UI", sans-serif;

  /* Radii */
  --r-card: 24px;
  --r-elevated: 20px;
  --r-input: 16px;
  --r-small: 16px;
  --r-pill: 9999px;

  /* Shadows — nur Floating Artifacts & Overlays */
  --shadow-float: 0 0 0 1px rgba(4,23,43,.05), 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.1);
  --shadow-overlay: 0 0 0 1px rgba(0,0,0,.05), 0 8px 40px 0 rgba(0,0,0,.1);

  --page-max: 1200px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.35;
  font-variation-settings: "wght" 400;
}
h1,h2,h3 { margin: 0; font-weight: 400; }
p { margin: 0; }
a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); }
[hidden] { display: none !important; }

.wrap { max-width: var(--page-max); margin: 0 auto; padding: 0 24px 96px; }
.muted { color: var(--slate); }
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ---------- Typo-Rollen ---------- */
.eyebrow {
  font-size: 14px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ash); font-variation-settings: "wght" 480;
}
.display {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1.22; letter-spacing: -0.015em;
}
.display em, .serif-sm em, .headline em { font-style: italic; }
.headline {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.25; letter-spacing: -0.015em;
}
.serif-sm {
  font-family: var(--serif); font-weight: 400;
  font-size: 26px; line-height: 1.2; letter-spacing: -0.009em;
}
.section-kicker {
  font-size: 14px; color: var(--ash); font-variation-settings: "wght" 450;
  margin: 0 0 10px;
}

/* ---------- Pills ---------- */
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--r-pill);
  padding: 10px 20px;
  font-size: 16px; line-height: 1;
  border: 1px solid transparent;
  background: transparent;
  white-space: nowrap;
}
.pill-filled { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pill-filled:hover { background: #000; }
.pill-ghost { border-color: var(--ink); color: var(--ink); }
.pill-ghost:hover { background: var(--fog); }
.pill-sm { padding: 7px 14px; font-size: 15px; }
.pill-big { padding: 16px 28px; font-size: 18px; min-height: 56px; }
.pill-wide { width: 100%; }
.pill[disabled] { opacity: .45; cursor: default; }
.pill-peach { background: var(--peach); color: var(--sienna); border-color: var(--peach); }

.link-arrow { font-size: 16px; padding: 8px 0; background: none; border: 0; }
.link-arrow::after { content: " →"; }
.link-arrow:hover { text-decoration: underline; }

/* ---------- Karten ---------- */
.card { background: var(--mist); border-radius: var(--r-card); padding: 24px; }
.card-peach { background: var(--peach); color: var(--sienna); border-radius: var(--r-card); padding: 28px; }
.card-peach .eyebrow, .card-peach .muted { color: var(--sienna); opacity: .75; }
.card-float {
  background: var(--paper); border-radius: var(--r-elevated);
  box-shadow: var(--shadow-float);
  padding: 18px 20px;
}
.card-small { background: var(--mist); border-radius: var(--r-small); padding: 16px; }

/* ---------- Status-Chips (achromatisch + Peach — nie Rot/Grün) ---------- */
.chip {
  display: inline-block; border-radius: var(--r-pill);
  font-size: 14px; padding: 4px 12px; line-height: 1.35;
  font-variation-settings: "wght" 450;
  white-space: nowrap;
}
.chip-overdue { background: var(--ink); color: var(--paper); }
.chip-soon { background: var(--peach); color: var(--sienna); }
.chip-quiet { color: var(--slate); padding-left: 0; }

/* ---------- Topbar ---------- */
.topbar { position: sticky; top: 0; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); z-index: 40; }
.topbar-inner {
  max-width: var(--page-max); margin: 0 auto;
  display: flex; align-items: center; gap: 20px;
  padding: 14px 24px;
}
.brand { display: flex; align-items: baseline; gap: 10px; background: none; border: 0; padding: 0; }
.brand-eyebrow {
  font-size: 12px; letter-spacing: .16em; color: var(--paper);
  background: var(--ink); border-radius: 6px; padding: 3px 6px;
  font-variation-settings: "wght" 500;
}
.brand-name { font-family: var(--serif); font-size: 20px; letter-spacing: -0.01em; }
.tabs { display: flex; gap: 4px; margin: 0 auto; }
.tabs button {
  background: none; border: 0; border-radius: var(--r-pill);
  padding: 8px 14px; font-size: 16px; color: var(--slate);
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-current="true"] { color: var(--ink); background: var(--mist); }
.account { display: flex; align-items: center; gap: 10px; }
.who { font-size: 15px; color: var(--slate); max-width: 140px; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Bottom-Tab-Bar (mobil) ---------- */
.tabbar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--paper); border-top: 1px solid var(--hairline);
  padding: 6px max(8px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-bottom));
}
.tabbar button {
  flex: 1; background: none; border: 0; color: var(--slate);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 12px; padding: 6px 2px; border-radius: 12px; min-height: 48px;
}
.tabbar button svg { width: 22px; height: 22px; }
.tabbar button[aria-current="true"] { color: var(--ink); }

@media (max-width: 767px) {
  .tabs { display: none; }
  .tabbar { display: flex; }
  .wrap { padding: 0 16px 110px; }
  .topbar-inner { padding: 12px 16px; }
  .who { display: none; }
}

/* ---------- Login ---------- */
.screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-wrap { width: min(420px, 100%); text-align: center; display: grid; gap: 18px; justify-items: center; }
.wordmark { font-family: var(--serif); font-weight: 400; font-size: clamp(36px, 7vw, 52px); letter-spacing: -0.015em; }
.login-card {
  width: 100%; text-align: left;
  background: var(--mist); border-radius: var(--r-card); padding: 28px;
  display: grid; gap: 16px; margin-top: 8px;
}
.wait-card { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; font-size: 15px; color: var(--slate); }
.field input, .field select {
  background: var(--paper); border: 1px solid var(--hairline);
  border-radius: var(--r-input); padding: 12px 14px; font-size: 17px; width: 100%;
}
.field input:focus, .field select:focus { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
.form-error { color: var(--ink); background: var(--paper); border: 1px solid var(--ink); border-radius: 12px; padding: 10px 12px; font-size: 15px; }
.login-foot { font-size: 14px; color: var(--ash); }
.login-foot a { text-decoration: underline; }

/* ---------- Hero / Übersicht ---------- */
.hero { padding: 56px 0 8px; }
.hero .display { max-width: 17ch; }
.hero-sub { margin-top: 12px; color: var(--slate); font-size: 17px; }
.collage {
  display: grid; gap: 20px;
  grid-template-columns: repeat(3, 1fr);
  align-items: start;
  margin: 36px 0 8px;
}
.collage .card-float:nth-child(2) { transform: translateY(18px); }
.collage .card-float:nth-child(3) { transform: translateY(-6px); }
.collage .card-peach { grid-column: 1 / -1; }
@media (min-width: 900px) {
  .collage { grid-template-columns: repeat(3, 1fr) 1.25fr; }
  .collage .card-peach { grid-column: 4; transform: translateY(-26px); }
}
@media (max-width: 640px) {
  .hero { padding: 28px 0 4px; }
  .collage { grid-template-columns: 1fr; }
  .collage .card-float, .collage .card-peach { transform: none !important; }
}
.stat-label { font-size: 14px; color: var(--slate); }
.stat-value { font-size: 30px; font-variation-settings: "wght" 500; letter-spacing: -0.01em; margin-top: 4px; }
.stat-foot { font-size: 14px; color: var(--ash); margin-top: 6px; }

.section { margin-top: 56px; }
.section-fog { background: var(--fog); border-radius: var(--r-card); padding: 28px; }

/* ---------- Steep-Tabelle (auf Canvas, nie in Karte) ---------- */
.table-scroll { overflow-x: auto; }
table.steep { width: 100%; border-collapse: collapse; }
table.steep th {
  text-align: left; font-size: 14px; font-weight: 400; font-variation-settings: "wght" 400;
  color: var(--ash); padding: 10px 14px 10px 0; border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
table.steep td {
  padding: 14px 14px 14px 0; border-bottom: 1px solid var(--hairline);
  font-size: 16px; vertical-align: middle;
}
table.steep th.num, table.steep td.num {
  text-align: right; font-variant-numeric: tabular-nums; font-feature-settings: "tnum";
}
table.steep tbody tr:hover { background: var(--fog); }
table.steep .rowsub { font-size: 14px; color: var(--ash); margin-top: 2px; }
table.steep td.actions { text-align: right; white-space: nowrap; }
.row-expand { background: var(--fog); }
.row-expand > td { padding: 16px 0 18px; font-size: 15px; color: var(--slate); }
.inactive-row td { color: var(--smoke); }

/* Mobile: Tabellen zu Karten */
@media (max-width: 640px) {
  table.steep.stackable thead { display: none; }
  table.steep.stackable, table.steep.stackable tbody, table.steep.stackable tr, table.steep.stackable td { display: block; width: 100%; }
  table.steep.stackable tr { border-bottom: 1px solid var(--hairline); padding: 12px 0; }
  table.steep.stackable td { border: 0; padding: 3px 0; }
  table.steep.stackable td.num { text-align: left; }
  table.steep.stackable td[data-th]::before {
    content: attr(data-th) " · "; color: var(--ash); font-size: 13px;
  }
  table.steep.stackable td.cell-primary { font-size: 18px; }
  table.steep.stackable td.actions { text-align: left; padding-top: 8px; }
}

/* ---------- Formulare / Dialoge ---------- */
dialog#dlg {
  border: 0; border-radius: var(--r-card); padding: 0;
  width: min(520px, calc(100vw - 32px));
  box-shadow: var(--shadow-overlay);
}
dialog#dlg::backdrop { background: rgba(23,25,28,.35); }
dialog#dlg.wide { width: min(980px, calc(100vw - 24px)); }
dialog#dlg.wide .dlg-body { padding: 24px; }
.dlg-body { padding: 28px; display: grid; gap: 16px; }
.dlg-title { font-family: var(--serif); font-size: 26px; letter-spacing: -0.009em; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .grid-2 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: center; font-size: 16px; color: var(--ink); }

@keyframes sheetup { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
dialog#dlg[open] { animation: sheetup 150ms ease-out; }
@media (prefers-reduced-motion: reduce) { dialog#dlg[open] { animation: none; } .sheet { animation: none !important; } }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 90; display: grid; gap: 8px; justify-items: center; pointer-events: none;
}
.toast-item {
  background: var(--ink); color: var(--paper);
  border-radius: var(--r-pill); padding: 10px 20px; font-size: 15px;
  box-shadow: var(--shadow-overlay);
}
@media (max-width: 767px) { #toast { bottom: 96px; } }

/* ---------- Scan ---------- */
.scan-stage {
  position: relative; border-radius: var(--r-elevated); overflow: hidden;
  background: var(--ink); box-shadow: var(--shadow-float);
  aspect-ratio: 4 / 5; max-height: 62dvh; width: 100%;
}
@media (min-width: 900px) { .scan-stage { aspect-ratio: 16 / 10; max-height: 520px; } }
.scan-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-reticle {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
}
.scan-reticle span {
  width: min(56%, 260px); aspect-ratio: 1; border-radius: 24px;
  border: 2px solid rgba(255,255,255,.85);
}
.scan-topcontrols { position: absolute; top: 12px; right: 12px; display: flex; gap: 8px; }
.scan-topcontrols .pill { background: rgba(255,255,255,.92); border-color: transparent; }
.scan-hint {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(255,255,255,.92); color: var(--ink);
  border-radius: var(--r-pill); font-size: 14px; padding: 6px 14px;
}
.sheet {
  background: var(--paper); border-radius: var(--r-elevated);
  box-shadow: var(--shadow-float); padding: 20px;
  animation: sheetup 200ms ease-out;
  margin-top: 16px;
}
.sheet-error { outline: 2px solid var(--ink); }
.scan-manual { display: flex; gap: 10px; margin-top: 16px; }
.scan-manual input { flex: 1; }
.scan-history { margin-top: 20px; }
.scan-history-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--hairline); font-size: 15px;
}

/* ---------- Kalkulator ---------- */
.calc-layout { display: grid; gap: 24px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) {
  .calc-layout { grid-template-columns: 1.1fr .9fr; }
  .calc-result { position: sticky; top: 84px; }
}
.calc-form { display: grid; gap: 14px; }
.money-row { display: grid; grid-template-columns: 1fr 96px; gap: 10px; }
.calc-result .big {
  font-size: 40px; font-variation-settings: "wght" 500; letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}
.calc-vk-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.calc-lines { margin-top: 14px; display: grid; gap: 6px; font-size: 15px; }
.calc-lines .line { display: flex; justify-content: space-between; gap: 14px; }
.fx-status { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--hairline); font-size: 14px; color: var(--slate); }

/* Artikel-Pillliste */
.article-pills { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 22px; }
.article-pills button {
  border: 1px solid var(--hairline); background: var(--paper); color: var(--slate);
  border-radius: var(--r-pill); padding: 8px 16px; font-size: 15px;
}
.article-pills button[aria-current="true"] { border-color: var(--ink); color: var(--ink); background: var(--mist); }

/* Shipments-Strip */
.ship-strip { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin: 16px 0 8px; }
.ship-card { display: grid; gap: 6px; }
.ship-eta { font-size: 14px; color: var(--slate); }

/* Alarm-Liste */
.alarm-list { display: grid; }
.alarm-item {
  display: flex; gap: 14px; justify-content: space-between; align-items: center;
  padding: 14px 0; border-bottom: 1px solid var(--hairline);
}
.alarm-main { min-width: 0; }
.alarm-title { font-size: 16px; }
.alarm-sub { font-size: 14px; color: var(--slate); margin-top: 2px; }

/* Skeleton */
@keyframes pulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
.skel { border-radius: var(--r-card); background: var(--mist); animation: pulse 1.4s ease-in-out infinite; }

/* Empty-State */
.empty {
  background: var(--mist); border-radius: var(--r-card); padding: 40px 28px;
  display: grid; gap: 10px; justify-items: start;
}
.empty .serif-sm { max-width: 26ch; }

/* Checkliste (Kaltstart, Peach — die eine Peach-Karte der Übersicht) */
.checklist { display: grid; gap: 10px; margin: 14px 0 18px; counter-reset: step; }
.checklist li { list-style: none; display: flex; gap: 12px; align-items: baseline; font-size: 17px; }
.checklist li::before {
  counter-increment: step; content: counter(step);
  font-family: var(--serif); font-size: 20px; min-width: 20px;
}
.checklist li.done { opacity: .55; text-decoration: line-through; }

.freshness { font-size: 14px; color: var(--slate); margin: 8px 0 18px; }
.legend { font-size: 13px; color: var(--ash); margin-top: 14px; }

/* ---------- Print (Etiketten) ---------- */
.print-root { display: none; }
@media print {
  @page { size: A4; margin: 10mm; }
  body > *:not(.print-root) { display: none !important; }
  .print-root { display: block !important; }
  .label-grid { display: flex; flex-wrap: wrap; gap: 4mm; }
  .label {
    width: 46mm; height: 46mm; border: .2mm dashed #bbb;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    page-break-inside: avoid; padding: 1.5mm;
  }
  .label svg { width: 34mm; height: 34mm; }
  .label .cap { font-family: var(--sans); font-size: 8pt; text-align: center; line-height: 1.15; margin-top: 1mm; }
  .board { page-break-after: always; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 265mm; }
  .board svg { width: 120mm; height: 120mm; }
  .board .cap { font-family: var(--serif); font-size: 26pt; margin-top: 8mm; text-align: center; }
  .board .cap small { display: block; font-family: var(--sans); font-size: 13pt; color: #555; margin-top: 2mm; }
}
