/* ============================================================
   PLATE N PALLET — "Trade Paper" Design System
   Creme-Papier-Arbeitsfläche · Koralle als Punkt im Satz ·
   Pallet-Tags · Gummistempel · Prüfspur · Poster-Bänder
   ============================================================ */

:root {
  /* Farb-Token */
  --page-bg: #FAF3E3;
  --surface: #FFFDF6;
  --ink: #26221B;
  --muted: #6F6455;
  --hairline: #E8DCC3;
  --coral: #FF5A3C;
  --coral-glow: #FFA184;
  --coral-deep: #B5321A;
  --coral-tint: #FFE3D9;
  --navy: #22304E;
  --navy-tint: #E9EDF5;
  --teal: #1E6B5E;
  --teal-tint: #E2EFEB;
  --terracotta: #A05C2C;
  --terracotta-tint: #F3E7DA;
  --success: #2F7A4D;
  --success-tint: #E3F0E7;
  --warn: #B7791F;
  --warn-tint: #F7ECD8;

  /* Typo */
  --f-display: 'Anton', 'Arial Narrow', sans-serif;
  --f-text: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --f-mono: 'IBM Plex Mono', Consolas, monospace;
  --f-serif: 'Fraunces', Georgia, serif;

  /* Rolle (wird per body-Klasse gesetzt) */
  --role: var(--navy);
  --role-tint: var(--navy-tint);

  /* Masse */
  --topbar-h: 64px;
  --sidebar-w: 240px;
  --r-pill: 999px;
  --r-card: 20px;
  --shadow-overlay: 0 8px 24px rgba(38, 34, 27, .12);
}
body.role-operator { --role: var(--navy); --role-tint: var(--navy-tint); }
body.role-supplier { --role: var(--teal); --role-tint: var(--teal-tint); }
body.role-admin    { --role: var(--terracotta); --role-tint: var(--terracotta-tint); }
body.role-public   { --role: var(--coral-deep); --role-tint: var(--coral-tint); }

/* ---------- Reset & Basis ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--f-text);
  font-size: 15px; line-height: 1.5;
  color: var(--ink);
  background: var(--page-bg);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
.icon { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.5; fill: none;
        stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Typo-Bausteine ---------- */
.display { font-family: var(--f-display); text-transform: uppercase; letter-spacing: .01em; font-weight: 400; }
h1.display { font-size: 28px; line-height: 1.1; }
h2.display { font-size: 20px; line-height: 1.15; }
.kicker {
  font: 700 11px/1.3 var(--f-text); letter-spacing: .12em; text-transform: uppercase;
  color: var(--role); display: flex; align-items: center; gap: 8px;
}
.kicker .count { font-family: var(--f-mono); font-weight: 500; color: var(--muted); letter-spacing: 0; }
.mono { font-family: var(--f-mono); font-size: 12px; }
.meta { font-size: 12px; color: var(--muted); }
.serif-note { font-family: var(--f-serif); font-style: italic; font-size: 16px; color: var(--muted); }

/* Zeitungs-Doppellinie unter Sektionstiteln */
.section-head { position: relative; padding-bottom: 10px; border-bottom: 3px solid var(--ink); margin-bottom: 18px; }
.section-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; border-bottom: 1px solid var(--hairline); }
.section-head .kicker { margin-bottom: 6px; }
.section-head h2 { font-family: var(--f-display); text-transform: uppercase; font-size: 20px; font-weight: 400; }

/* ---------- App-Shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  background: var(--surface);
  border-top: 3px solid var(--role);
  border-bottom: 1px solid var(--hairline);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
}
.wordmark { display: flex; align-items: center; gap: 12px; }
.wordmark-badge {
  width: 38px; height: 38px; border-radius: var(--r-pill);
  background: radial-gradient(circle at 50% 45%, var(--coral) 0%, var(--coral-glow) 100%);
  color: #fff; font-family: var(--f-display); font-size: 13px;
  display: flex; align-items: center; justify-content: center; letter-spacing: .02em;
}
.wordmark-name { font-family: var(--f-display); text-transform: uppercase; font-size: 17px; letter-spacing: .02em; }
.pill-role {
  background: var(--role); color: #fff; border-radius: var(--r-pill);
  font: 700 11px/1 var(--f-text); letter-spacing: .08em; text-transform: uppercase;
  padding: 6px 12px; display: inline-flex; align-items: center; gap: 6px;
}
.topbar-spacer { flex: 1; }
.topbar .avatar { width: 34px; height: 34px; font-size: 12px; }

.layout { display: flex; min-height: calc(100vh - var(--topbar-h)); }
.sidebar {
  width: var(--sidebar-w); flex: none;
  padding: 24px 16px; border-right: 1px solid var(--hairline);
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-pill);
  font: 600 14px/1 var(--f-text); color: var(--ink);
  position: relative; margin-bottom: 2px;
}
.nav-item .icon { color: var(--role); }
.nav-item:hover { background: var(--surface); }
.nav-item.active { background: var(--coral-tint); color: var(--coral-deep); }
.nav-item.active .icon { color: var(--coral-deep); }
.nav-item.active::before {
  content: ""; position: absolute; left: -16px; top: 8px; bottom: 8px;
  width: 3px; background: var(--coral); border-radius: 2px;
}
.nav-item.locked { color: var(--muted); }
.nav-item.locked .icon { color: var(--muted); }
.nav-item .mini-tag {
  margin-left: auto; font: 700 9px/1 var(--f-text); letter-spacing: .08em;
  color: var(--muted); border: 1px solid var(--hairline); border-radius: var(--r-pill); padding: 3px 7px;
}
.nav-group { margin: 18px 12px 8px; font: 700 10px/1 var(--f-text); letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); }

.main { flex: 1; min-width: 0; padding: 28px 32px 64px; }
.main-inner { max-width: 1200px; margin: 0 auto; }

/* Mobile Bottom-Nav */
.bottomnav {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--surface); border-top: 1px solid var(--hairline);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}
.bottomnav .nav-item { flex-direction: column; gap: 4px; font-size: 10px; padding: 6px 4px;
  flex: 1; text-align: center; border-radius: 12px; }
.bottomnav .nav-item.active::before { display: none; }
.bottomnav-inner { display: flex; gap: 4px; max-width: 480px; margin: 0 auto; }

/* ---------- Poster-Band (nur Onboarding/Empty/Erfolg/Public-Hero) ---------- */
.poster {
  background: radial-gradient(circle at 50% 45%, var(--coral) 0%, var(--coral-glow) 100%);
  color: #fff; padding: 28px 32px; min-height: 120px;
  display: flex; flex-direction: column; justify-content: center; gap: 8px;
}
.poster .display { font-size: 34px; }
.poster-kicker {
  font: 700 13px/1.3 var(--f-text); letter-spacing: .18em; text-transform: uppercase; color: #fff;
}
.poster .icon { width: 26px; height: 26px; }

/* ---------- Karten & Entitätskanten ---------- */
.card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-card); padding: 20px;
}
.card + .card { margin-top: 12px; }
.edge-venue    { border-left: 3px solid var(--navy); }
.edge-supplier { border-left: 3px solid var(--teal); }
.edge-admin    { border-left: 3px solid var(--terracotta); }

/* ---------- Pallet-Tags (Match-Begründungen, Filter, Status) ---------- */
.tag {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  border-radius: var(--r-pill); padding: 6px 14px 6px 26px;
  font: 600 12px/1.2 var(--f-text); letter-spacing: .02em;
  background: var(--surface); border: 1px solid var(--hairline); color: var(--ink);
}
.tag::before {
  content: ""; position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--page-bg); box-shadow: 0 0 0 1.5px var(--muted);
}
.tag .pre { font-size: 10px; font-weight: 700; letter-spacing: .06em; white-space: nowrap; }
.tag--mandatory { background: var(--coral-tint); border: 1.5px solid var(--coral-deep); color: var(--coral-deep); }
.tag--mandatory::before { box-shadow: 0 0 0 1.5px var(--coral-deep); }
.tag--gap { background: transparent; border: 1.5px dashed var(--coral-deep); color: var(--coral-deep); }
.tag--gap::before { box-shadow: 0 0 0 1.5px var(--coral-deep); }
.tag--ghost { color: var(--muted); background: transparent; }
.tag--success { background: var(--success-tint); border-color: var(--success); color: var(--success); }
.tag--success::before { box-shadow: 0 0 0 1.5px var(--success); }
.tag--warn { background: var(--warn-tint); border-color: var(--warn); color: var(--warn); }
.tag--warn::before { box-shadow: 0 0 0 1.5px var(--warn); }
.tag--filter-active { background: var(--coral-tint); border: 1.5px solid var(--coral-deep); color: var(--coral-deep); }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* Match-Grad */
.grade { font-family: var(--f-display); text-transform: uppercase; font-size: 13px;
  letter-spacing: .05em; color: var(--coral-deep); }
.grade--good { color: var(--ink); }

/* ---------- Verifikations-Stempel ---------- */
.stamp {
  width: 66px; height: 66px; border: 2px solid var(--success); border-radius: 50%;
  transform: rotate(-6deg); color: var(--success);
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--f-display); font-size: 9px; letter-spacing: .08em;
  text-transform: uppercase; line-height: 1.4; text-align: center; flex: none;
}
.stamp--pending { border-color: var(--warn); color: var(--warn); }
.stamp--rejected { border-color: var(--coral-deep); color: var(--coral-deep); }
.stamp--sm { width: 50px; height: 50px; font-size: 7.5px; }
.verified-inline { display: inline-flex; align-items: center; gap: 5px;
  font: 700 11px/1 var(--f-text); letter-spacing: .06em; text-transform: uppercase; color: var(--success); }
.verified-inline .icon { width: 14px; height: 14px; }

/* ---------- Prüfspur (Audit-Trail) ---------- */
.trail { position: relative; margin-left: 6px; border-left: 2px dotted var(--hairline); }
.trail-item { position: relative; padding: 0 0 18px 24px; }
.trail-item:last-child { padding-bottom: 4px; }
.trail-item::before {
  content: ""; position: absolute; left: -8px; top: 3px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--hairline);
}
.trail-item--done::before    { border-color: var(--success); background: var(--success); }
.trail-item--current::before { border-color: var(--coral-deep); background: var(--coral-tint); }
.trail-item--warn::before    { border-color: var(--warn); background: var(--warn-tint); }
.trail-time { font-family: var(--f-mono); font-size: 11px; color: var(--muted); display: block; margin-top: 2px; }
.trail-item strong { font-weight: 600; }

/* ---------- Journey-Stepper ---------- */
.steps { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.step { font: 700 11px/1 var(--f-text); letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); padding: 7px 12px; border: 1px solid var(--hairline); border-radius: var(--r-pill);
  display: inline-flex; align-items: center; gap: 5px; }
.step--done { color: var(--success); border-color: var(--success); }
.step--current { color: #fff; background: var(--coral-deep); border-color: var(--coral-deep); }
.step-sep { color: var(--hairline); font-size: 14px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--r-pill); padding: 0 20px; height: 40px;
  font: 600 14px/1 var(--f-text); white-space: nowrap;
}
.btn--primary { background: var(--coral-deep); color: #fff; font-weight: 700; }
.btn--hero { background: var(--coral); color: #fff; font-size: 19px; font-weight: 700; height: 52px; padding: 0 28px; }
.btn--ghost { border: 1px solid var(--hairline); background: var(--surface); color: var(--ink); }
.btn--danger-ghost { border: 1px solid var(--coral-deep); background: transparent; color: var(--coral-deep); }
.btn--sm { height: 32px; padding: 0 14px; font-size: 12.5px; }
.btn .icon { width: 16px; height: 16px; }

/* ---------- KPI / Zahlen ---------- */
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi-num { font-family: var(--f-display); font-size: 36px; line-height: 1; color: var(--coral-deep); }
.kpi-label { font: 700 10px/1.3 var(--f-text); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.kpi-row { display: flex; gap: 32px; flex-wrap: wrap; }

/* ---------- Tabellen ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  font: 700 11px/1.3 var(--f-text); letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--hairline);
}
.table td { padding: 12px; height: 44px; font-size: 14px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.table td.num, .table th.num { font-family: var(--f-mono); font-size: 12.5px; text-align: right; white-space: nowrap; }
.table tr:hover td { background: var(--surface); }

/* ---------- Filterleiste ---------- */
.filterbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  position: sticky; top: var(--topbar-h); z-index: 40;
  background: var(--page-bg); padding: 12px 0; margin-bottom: 8px;
}

/* ---------- Formulare ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label { font: 700 12px/1.3 var(--f-text); letter-spacing: .08em; text-transform: uppercase; color: var(--ink); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, select.input {
  height: 42px; border-radius: var(--r-pill); border: 1px solid var(--hairline);
  background: var(--surface); padding: 0 16px; font: 400 14px var(--f-text); color: var(--ink); width: 100%;
}
textarea.input { height: auto; min-height: 96px; border-radius: var(--r-card); padding: 12px 16px; resize: vertical; }
.input:focus { outline: 2px solid var(--coral-deep); outline-offset: 1px; }
.input::placeholder { color: var(--muted); }
.switch { width: 40px; height: 22px; border-radius: var(--r-pill); background: var(--hairline); position: relative; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(38,34,27,.2); }
.switch.on { background: var(--success); }
.switch.on::after { left: 21px; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--hairline); }

/* ---------- Avatare & Fotos ---------- */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font: 700 13px/1 var(--f-text); background: var(--role-tint); color: var(--role);
}
.avatar--venue { background: var(--navy-tint); color: var(--navy); }
.avatar--supplier { background: var(--teal-tint); color: var(--teal); }
.avatar--admin { background: var(--terracotta-tint); color: var(--terracotta); }
.photo { border-radius: 24px; border: 1px solid var(--hairline); object-fit: cover; width: 100%; }
.photo--thumb { width: 56px; height: 56px; border-radius: 16px; flex: none; }
.photo--card { height: 160px; }

/* ---------- Sonstiges ---------- */
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); display: inline-block; flex: none; }
.badge-count { background: var(--coral); color: #fff; font: 700 10px/1 var(--f-text);
  border-radius: var(--r-pill); padding: 3px 7px; min-width: 18px; text-align: center; }
.divider-dotted { border: none; border-top: 2px dotted var(--hairline); margin: 16px 0; }
.hr { border: none; border-top: 1px solid var(--hairline); margin: 16px 0; }
.progress { height: 8px; border-radius: var(--r-pill); background: var(--hairline); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: var(--r-pill); background: var(--success); }
.progress--coral > span { background: var(--coral); }

/* Layout-Helfer */
.row { display: flex; align-items: center; gap: 12px; }
.row--between { justify-content: space-between; }
.row--top { align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-main-side { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  :root { --topbar-h: 56px; }
  .sidebar { display: none; }
  .bottomnav { display: block; }
  .main { padding: 20px 16px 96px; }
  .poster { min-height: 88px; padding: 20px; }
  .poster .display { font-size: 26px; }
  .grid-2, .grid-3, .grid-main-side { grid-template-columns: minmax(0, 1fr); }
  .row { flex-wrap: wrap; }
  .filterbar { top: var(--topbar-h); overflow-x: auto; flex-wrap: nowrap; padding-bottom: 8px; }
  .filterbar .tag { white-space: nowrap; flex: none; }
  .kpi-num { font-size: 30px; }
  .topbar { padding: 0 16px; }
  .wordmark-name { display: none; }
  .table-wrap { overflow-x: auto; }
  .table { min-width: 640px; }
  h1.display { font-size: 24px; }
}
