/* ─────────────────────────────────────────────────────────────
   CROSTO HACCP — UI
   Design-Sprache an CrostoPOS angelehnt: Navy/Orange/Cream,
   DM Sans + DM Mono, runde Cards, weiche Schatten, Light-Theme.
   Keine Produktbilder (bewusst weggelassen).
   ───────────────────────────────────────────────────────────── */
:root {
  /* Marke */
  --navy: #35347B;
  --navy-light: #3F3E8A;
  --navy-press: #2A2963;
  --orange: #E49924;
  --orange-light: #EDC36B;
  --orange-press: #C9831A;
  --cream: #FFF8F0;

  /* Flächen / Text */
  --bg: var(--cream);
  --panel: #FFFFFF;
  --panel-2: #FFFFFF;
  --text: #1C1C1E;
  --muted: #8E8E93;       /* in JS referenziert */
  --line: #ECE7DF;

  /* Semantik (in JS referenziert: --accent, --danger) */
  --accent: #34C759;      /* Erfolg (Toast/„gespeichert") */
  --accent-press: #28a745;
  --danger: #FF3B30;

  --radius: 16px;
  --shadow-sm: 0 2px 10px rgba(53,52,123,.07);
  --shadow-md: 0 8px 28px rgba(53,52,123,.12);
  --shadow-lg: 0 24px 70px rgba(28,28,46,.28);

  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "DM Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: var(--font);
  user-select: none; -webkit-user-select: none;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
body { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Header (Navy-Gradient) ── */
header {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 22px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: #fff;
  padding-top: calc(16px + env(safe-area-inset-top));
  box-shadow: var(--shadow-sm);
}
header h1 {
  font-size: 21px; margin: 0; font-weight: 800; letter-spacing: .3px;
}
header .store { color: rgba(255,255,255,.72); font-size: 14px; font-weight: 500; }
header .spacer { flex: 1; }
header a.navlink {
  color: #fff; text-decoration: none; font-size: 15px; font-weight: 600;
  padding: 9px 16px; border-radius: 999px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
}
header a.navlink:active { background: rgba(255,255,255,.26); }

/* ── Kategorie-Filter (POS-Stil) ── */
.catbar {
  display: flex; gap: 10px; padding: 18px 22px 2px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.catbar::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: 0 0 auto; padding: 9px 18px; border-radius: 999px;
  font-size: 15px; font-weight: 700; white-space: nowrap;
  background: var(--panel); border: 1.5px solid var(--line); color: var(--navy);
  box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform .08s ease, background .12s ease;
}
.cat-chip:active { transform: scale(.96); }
.cat-chip.active {
  background: var(--orange); border-color: transparent; color: #fff;
}

/* ── Produkt-Grid ── */
.grid {
  flex: 1; display: grid; gap: 16px; padding: 18px 22px 28px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  align-content: start;
}
.tile {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 18px;
  min-height: 124px; display: flex; flex-direction: column; justify-content: space-between;
  font-size: 23px; font-weight: 700; color: var(--navy); text-align: left;
  box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform .08s ease, box-shadow .12s ease;
}
.tile:active { transform: scale(.98); box-shadow: var(--shadow-md); }
.tile .tag {
  align-self: flex-start; margin-top: 16px; font-size: 12px; font-weight: 700;
  color: var(--orange-press); background: #FCEFD8; padding: 5px 11px; border-radius: 999px;
  letter-spacing: .6px; text-transform: uppercase;
}

/* ── Modal ── */
.overlay {
  position: fixed; inset: 0; background: rgba(28,28,46,.45);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.overlay.show { display: flex; }
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px;
  width: min(560px, 100%); max-height: 92vh; overflow: auto; padding: 28px;
  box-shadow: var(--shadow-lg);
}
.modal h2 { margin: 0 0 6px; font-size: 30px; font-weight: 800; color: var(--navy); }
.modal .sub { color: var(--muted); font-size: 17px; margin-bottom: 22px; }
.modal .actions { display: flex; gap: 14px; margin-top: 26px; }

.btn {
  flex: 1; padding: 20px; border-radius: 14px; font-size: 20px; font-weight: 700;
  border: none; color: #fff; background: var(--panel-2);
  font-family: var(--font); cursor: pointer;
  transition: transform .08s ease, filter .12s ease;
}
.btn:active { transform: scale(.98); }
.btn.primary {
  background: linear-gradient(135deg, var(--orange) 0%, var(--orange-light) 100%);
  color: #fff; box-shadow: 0 8px 22px rgba(228,153,36,.28);
}
.btn.primary:active { background: var(--orange-press); }
.btn.ghost { background: #F3F0EA; color: var(--text); }

/* ── Ergebnis ── */
.preview-wrap {
  background: #fff; border: 1px solid var(--line);
  border-radius: 14px; padding: 12px; display: flex; justify-content: center;
}
.preview-wrap img { width: 100%; max-width: 360px; image-rendering: pixelated; }
.times { margin: 18px 0 4px; border-collapse: collapse; width: 100%; font-size: 18px; }
.times td { padding: 9px 6px; border-bottom: 1px solid var(--line); font-family: var(--font-mono); }
.times td.k { color: var(--muted); width: 46%; font-weight: 600; font-family: var(--font); }
.times tr.discard td { color: var(--danger); font-weight: 700; font-size: 20px; }
.meta { color: var(--muted); font-size: 14px; margin-top: 12px; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--danger); color: #fff; padding: 14px 22px; border-radius: 999px;
  font-size: 18px; font-weight: 600; display: none; z-index: 60;
  box-shadow: var(--shadow-md);
}
.toast.show { display: block; }

/* ═══════════════════════════════════════════════════════════════
   ADMIN — Backoffice-Shell (Sidebar + Header + Content)
   Designsprache an crosto-backoffice angelehnt. MHD ist EIN Modul;
   weitere HACCP-Module (Temperatur, Cleaning, CIP) folgen in der Nav.
   Scope: body.bo — der Kiosk bleibt unberuehrt.
   Backoffice-Palette: navy-deep #141332, gold #E49924, bg #F8F7F5,
   g100 #F5F4F2, g200 #EDEBE8, g500 #6B665E.
   ═══════════════════════════════════════════════════════════════ */
body.bo {
  display: block; height: 100vh; min-height: 0; overflow: hidden;
  background: #F8F7F5; color: #1A1918;
}
.shell { display: flex; height: 100vh; }

/* Sidebar */
.sidebar {
  width: 212px; flex-shrink: 0; background: #141332; color: #fff;
  display: flex; flex-direction: column; overflow: hidden;
  transition: width .18s ease;
}
.brand { display: flex; flex-direction: column; align-items: center; padding: 18px 14px 12px; }
.brand-img { width: 144px; height: auto; display: block; }
.brand-mini {
  display: none; width: 30px; height: 30px; border-radius: 8px;
  background: var(--orange); color: #141332; font-weight: 800; font-size: 15px;
  align-items: center; justify-content: center;
}
.brand-sub { font-size: 10px; font-weight: 700; letter-spacing: 4px; color: var(--orange); margin-top: 4px; }

/* Collapse-Toggle */
.collapse-btn {
  height: 40px; border: none; border-top: 1px solid rgba(255,255,255,.10);
  background: transparent; color: rgba(255,255,255,.5); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.collapse-btn:hover { color: #fff; }
.collapse-btn svg { width: 16px; height: 16px; }

/* Eingeklappter Zustand: nur Icons */
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .brand-img,
.sidebar.collapsed .brand-sub,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .soon { display: none; }
.sidebar.collapsed .brand-mini { display: flex; }
.sidebar.collapsed .brand { padding: 16px 0 12px; }
.sidebar.collapsed .nav-item { justify-content: center; gap: 0; padding: 11px 0; }
.nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 12px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; border-radius: 9px;
  padding: 10px 12px; font-size: 14px; font-weight: 600; text-decoration: none;
  color: rgba(255,255,255,.72); cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item .nav-label { flex: 1; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.10); color: var(--orange); }
.nav-item.disabled { color: rgba(255,255,255,.32); cursor: default; }
.nav-item.disabled:hover { background: transparent; color: rgba(255,255,255,.32); }
.soon {
  font-size: 9px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  background: rgba(255,255,255,.10); color: rgba(255,255,255,.55);
  padding: 2px 7px; border-radius: 6px;
}
.nav-foot { padding: 8px; border-top: 1px solid rgba(255,255,255,.10); }

/* Hauptbereich */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 52px; flex-shrink: 0; background: #fff; border-bottom: 1px solid #EDEBE8;
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
}
.topbar-left { display: flex; align-items: center; }
.topbar h1 { margin: 0; font-size: 16px; font-weight: 700; color: #141332; }
.pill {
  margin-left: 10px; background: #F5F4F2; color: #6B665E;
  border-radius: 999px; padding: 3px 11px; font-size: 12px; font-weight: 600;
}
.topbtn {
  text-decoration: none; font-size: 13px; font-weight: 600; color: #fff;
  background: #141332; border-radius: 9px; padding: 8px 14px;
}
.topbtn:hover { background: var(--navy); }
.content { flex: 1; overflow-y: auto; padding: 22px 28px 40px; }

/* Platzhalter-Seiten kommender Module */
.ph-card {
  max-width: 460px; margin: 8vh auto 0; text-align: center;
  background: #fff; border: 1px solid #EDEBE8; border-radius: 14px;
  padding: 40px 32px;
}
.ph-icon {
  width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 16px;
  background: #F3F1FB; color: var(--navy);
  display: flex; align-items: center; justify-content: center;
}
.ph-icon svg { width: 30px; height: 30px; }
.ph-card h2 { margin: 0 0 8px; font-size: 20px; font-weight: 800; color: #141332; }
.ph-card p { margin: 0 0 18px; font-size: 14px; color: #6B665E; line-height: 1.5; }
.soon-pill {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; color: var(--orange-press);
  background: #FCEFD8; border: 1px solid #F3DCB3; border-radius: 999px; padding: 5px 14px;
}

/* ── Tabellen / Formulare (flach, neutral — backoffice-Stil) ── */
.section-title {
  font-size: 15px; font-weight: 700; color: #141332;
  margin: 22px 0 10px; letter-spacing: .2px;
}
.section-title:first-child { margin-top: 4px; }

/* Card-Tabelle: weiss, duenner g200-Rahmen, rounded-xl, kaum Schatten */
table.products {
  width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px;
  background: #fff; border: 1px solid #EDEBE8; border-radius: 12px;
  overflow: hidden;
}
table.products th, table.products td {
  padding: 11px 14px; border-bottom: 1px solid #EDEBE8; text-align: left;
}
table.products tr:last-child td { border-bottom: none; }
table.products th {
  color: #6B665E; font-weight: 600; font-size: 11px; letter-spacing: .6px;
  text-transform: uppercase; background: #FAF9F7;
}
table.products input, table.products select {
  background: #fff; color: #141332; border: 1px solid #E5E3DF;
  border-radius: 8px; padding: 8px 10px; font-size: 14px; width: 100%; font-family: var(--font);
}
table.products input:focus, table.products select:focus {
  outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(228,153,36,.14);
}
table.products input[type=number] { width: 92px; font-family: var(--font-mono); font-weight: 600; }

/* Primaere Aktionen: flaches Gold (kein Verlauf/Schatten) */
.row-actions button, .admin-add {
  background: var(--orange); color: #fff; border: none; border-radius: 9px;
  padding: 9px 16px; font-size: 13px; font-weight: 700; font-family: var(--font); cursor: pointer;
  transition: background .12s ease;
}
.row-actions button:hover, .admin-add:hover { background: var(--orange-press); }
.admin-add { padding: 10px 18px; }
.row-actions .ghost-btn {
  background: #fff; color: var(--g500, #6B665E); border: 1px solid #E5E3DF;
}
.row-actions .ghost-btn:hover { background: #FDECEB; color: var(--danger); border-color: #F3C9C6; }
.saved { color: var(--green, #4CAF50); font-size: 13px; font-weight: 600; margin-left: 6px; }
