/* Design uebernommen von DP+ (app.dpplus.app), redesign-preview.css-Tokensystem.
   Schriften selbst gehostet statt Google-Fonts-CDN (DSGVO, gleiches Muster wie
   bei DP+/HSK/Office). */

@font-face {
  font-family: 'IBM Plex Sans'; font-weight: 400; font-style: normal; font-display: swap;
  src: url('fonts/plexsans400.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans'; font-weight: 600; font-style: normal; font-display: swap;
  src: url('fonts/plexsans600.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans'; font-weight: 700; font-style: normal; font-display: swap;
  src: url('fonts/plexsans700.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono'; font-weight: 400; font-style: normal; font-display: swap;
  src: url('fonts/plexmono400.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono'; font-weight: 600; font-style: normal; font-display: swap;
  src: url('fonts/plexmono600.woff2') format('woff2');
}

:root {
  /* DP+-Systemfarben: Chrome (Admin/Lieferant/Hotelbetreiber), Formulare, Struktur */
  --bg: #F3F5F4;
  --surface: #ffffff;
  --surface-sunken: #E9ECEA;
  --border: #DCE1DE;
  --border-strong: #C2C9C5;
  --text: #10161A;
  --text-muted: #445055;
  /* 3J-HappyBox-Logo (2026-10-20): Dunkelblau als Akzent, Orange sparsam als Markenstreifen.
     Synchron halten mit DEFAULT_COLOR_PRIMARY/-SECONDARY und BRAND_ORANGE in app.py. */
  --accent: #101D26;
  --accent-strong: #0A131A;
  --accent-soft: #E4E8EB;
  --brand-orange: #ED7D03;
  --success: #2E8B63;
  --success-soft: #DEF0E6;
  --warn: #D99A2B;
  --warn-soft: #FBEDD3;
  --danger: #C0463A;
  --danger-soft: #F8E1DE;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --font-body: 'IBM Plex Sans', -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  /* Gastseiten-Akzent: wird je Hotel aus dem hochgeladenen Logo abgeleitet
     (siehe app.py::extract_brand_colors) und per Inline-<style> ueberschrieben.
     Ohne eigenes Logo gilt das 3J-HappyBox-Dunkelblau als Standard. */
  --yolk: var(--accent);
  --sage: var(--accent-strong);

  /* Rueckwaertskompatible Alias-Namen (aeltere Regeln unten nutzen noch --ink/--paper) */
  --paper: var(--bg);
  --ink: var(--text);
  --ink-soft: var(--text-muted);
  --line: var(--border);
  --white: var(--surface);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
}

a { color: var(--accent-strong); }
a:hover { color: var(--accent); }

.wrap {
  max-width: 34rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.wrap-wide { max-width: 60rem; }

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent), var(--bg);
}

.login-card {
  width: 100%;
  max-width: 26rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 6px solid var(--brand-orange);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem;
  box-shadow: 0 24px 60px rgba(16, 29, 38, 0.12);
}

.login-logo { display: block; margin: 0 auto 0.5rem; max-width: 260px; width: 100%; height: auto; }

/* --- Gastansicht ------------------------------------------------------- */

.room-tag {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.8rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--surface);
}

.lede {
  margin: 1.4rem 0 0.2rem;
  font-size: 2rem;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-family: var(--font-body);
}

.lede span { display: block; color: var(--sage); }

.sub {
  margin: 0.6rem 0 2rem;
  color: var(--text-muted);
}

fieldset { border: 0; margin: 0; padding: 0; }

.choice {
  display: block;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.15rem;
  margin-bottom: 0.7rem;
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(20, 66, 111, 0.06);
}

.choice input { position: absolute; opacity: 0; }

.choice:has(input:checked) {
  border-color: var(--yolk);
  box-shadow: inset 0 0 0 1.5px var(--yolk);
}

.choice:has(input:focus-visible) { outline: 3px solid var(--yolk); outline-offset: 2px; }

.choice-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-weight: 600;
}

.choice-photo {
  display: block;
  width: 100%;
  height: 140px;
  border-radius: var(--radius-md);
  margin-bottom: 0.7rem;
  overflow: hidden;
}

.choice-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.choice-photo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 2.75rem;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface-sunken));
}

.choice-price { white-space: nowrap; font-variant-numeric: tabular-nums; font-family: var(--font-mono); }

.choice-desc {
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.field { margin: 0 0 1.1rem; }

/* Grid-Items collapsen ihre Margins nicht mit dem grid-gap - sonst addiert
   sich das gap zur eigenen Feld-Margin und die Abstaende wirken doppelt so
   gross wie beabsichtigt. */
.grid2 .field { margin: 0; }

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.45rem;
}

.stepper {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}

.stepper button {
  width: 3rem;
  height: 3rem;
  border: 0;
  background: none;
  font-size: 1.4rem;
  color: var(--text);
  cursor: pointer;
}

.stepper button:hover { background: var(--accent-soft); color: var(--accent-strong); }

.stepper output {
  width: 3rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-weight: 600;
}

input[type="text"], input[type="email"], input[type="time"], input[type="number"], input[type="date"],
input[type="password"], textarea, select {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  color: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input[type="color"] {
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0.3rem;
  height: 2.6rem;
  cursor: pointer;
}

input[type="file"] { font: inherit; color: var(--text); }

textarea { resize: vertical; }

.total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

.btn {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.7rem 1.1rem;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--border-strong);
  color: var(--text);
}

.btn-ghost:hover { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }

.deadline {
  margin-top: 1.6rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  border-left: 3px solid var(--yolk);
  background: var(--surface);
  font-size: 0.92rem;
  color: var(--text-muted);
}

.stamp {
  margin: 2.5rem 0 1rem;
  font-size: 3.4rem;
  line-height: 1;
}

/* --- Admin ------------------------------------------------------------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  height: 68px;
  background: var(--surface);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 -3px 0 var(--brand-orange);
}

.topbar strong { font-weight: 700; }

.brand { display: flex; align-items: center; gap: 0.6rem; }
.brand-logo { height: 60px; width: auto; display: block; }
.brand { min-width: 0; }
.nav-hotel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Hotel-Umschalter in der Kopfleiste (wie CleanMyRoom): kompakt statt der globalen
   select-Breite von 100 %, die ihn sonst quer ueber den Bildschirm zieht. */
.topbar select.hotel-select {
  width: auto;
  max-width: 220px;
  padding: 0.3rem 0.5rem;
  font-size: 0.88rem;
  font-weight: 700;
  border-width: 1px;
  text-overflow: ellipsis;
  cursor: pointer;
}

.hero-greeting {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface));
}

.hero-greeting-icon { font-size: 2rem; line-height: 1; }

.hero-greeting h2 { margin: 0; font-size: 1.4rem; font-weight: 700; }

.topbar a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
}

.topbar a:hover { background: var(--accent-soft); color: var(--accent-strong); }

.topnav { display: flex; align-items: center; gap: 0.4rem; }

.topnav a.nav-link.active { background: var(--accent); color: #fff; }
.topnav a.nav-link.active:hover { background: var(--accent-strong); color: #fff; }

.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}
.nav-hamburger span { display: block; width: 100%; height: 2px; background: var(--text); border-radius: 2px; }

.mobile-nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 22, 26, 0.4);
  z-index: 40;
}

@media (max-width: 880px) {
  .nav-hamburger { display: flex; }
  .topbar select.hotel-select { max-width: 150px; }

  .topnav {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: min(78vw, 320px);
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    padding: 4.5rem 1.25rem 1.5rem;
    background: var(--surface);
    box-shadow: -4px 0 16px rgba(16, 22, 26, 0.15);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 50;
  }
  .topnav a { width: 100%; padding: 0.6rem 0.6rem; }

  body.nav-open .topnav { transform: translateX(0); }
  body.nav-open .mobile-nav-backdrop { display: block; }
}

.btn-small {
  display: inline-block;
  width: auto;
  margin-top: 0;
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
}

.preview-banner, .preview-switcher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1.5rem;
  font-size: 0.88rem;
  font-weight: 500;
}

.preview-banner {
  background: var(--warn-soft);
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.preview-switcher {
  background: var(--surface-sunken);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

/* --- Admin: Systemuebersicht (Ampeln, Kacheln, Charts) ------------------ */

.ampel-row { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-bottom: 0.6rem; }

.ampel {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
}

.ampel-dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; flex-shrink: 0; }
.ampel-dot.green { background: var(--success); }
.ampel-dot.yellow { background: var(--warn); }
.ampel-dot.red { background: var(--danger); }

.ampel-problems {
  margin: 0 0 1.3rem 1.2rem;
  padding: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.tile {
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
}

.tile-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}

.tile-value {
  margin-top: 0.3rem;
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

.chart-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.bar-chart { display: flex; align-items: flex-end; gap: 0.5rem; height: 8rem; padding-top: 0.5rem; }

.bar-chart-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  flex: 1;
  height: 100%;
  justify-content: flex-end;
}

.bar-chart-fill { width: 100%; max-width: 2.2rem; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar-chart-count { font-size: 0.7rem; font-weight: 600; font-family: var(--font-mono); color: var(--text-muted); }
.bar-chart-label { font-size: 0.65rem; color: var(--text-muted); text-align: center; }

.events-list { font-size: 0.85rem; list-style: none; margin: 0; padding: 0; }
.events-list li { padding: 0.4rem 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 1rem; }
.events-list li:last-child { border-bottom: none; }
.events-time { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.76rem; white-space: nowrap; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.3rem 1.4rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 14px 34px rgba(20, 66, 111, 0.06);
}

.panel h2 {
  margin: 0 0 1rem;
  font-size: 1.2rem;
  font-weight: 600;
}

.panel h3 {
  margin: 0 0 0.9rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.day-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.count {
  font-size: 2.2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}

table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.92rem; }

/* Breite Tabellen (z. B. Hotel-Bestellungen) mobil seitlich scrollbar statt die Seite zu verbreitern */
.table-scroll { overflow-x: auto; }

/* Datum als Auswahllisten Tag/Monat/Jahr (Hotel-Bestellung) */
.date-selects { display: grid; grid-template-columns: minmax(4rem, 0.8fr) minmax(0, 2fr) minmax(5rem, 1fr); gap: 0.4rem; }
.date-selects select { min-width: 0; padding-left: 0.5rem; padding-right: 0.3rem; }

th, td {
  text-align: left;
  padding: 0.65rem 0.6rem 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-sunken);
}

th:first-child { padding-left: 0.6rem; }
td:first-child { padding-left: 0.6rem; }

tr:hover td { background: var(--surface-sunken); }

.grid2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
}

.flash {
  margin: 1rem 1.5rem 0;
  padding: 0.7rem 1rem;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 500;
}

.sent { color: var(--success); font-size: 0.9rem; font-weight: 500; }
.open { color: var(--warn); font-size: 0.9rem; font-weight: 500; }

.inline-form { display: inline; }

/* Kennzeichnung von Hotel-Bestellungen (Abrechnung per Rechnung statt Stripe) */
.billing-tag {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

/* --- QR-Druckbogen ----------------------------------------------------- */

.qr-sheet {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.qr-card {
  border: 1px solid var(--border);
  border-top: 4px solid var(--yolk);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  text-align: center;
  background: var(--surface);
  page-break-inside: avoid;
}

.qr-card img { width: 100%; max-width: 190px; }

.qr-card img.logo { max-height: 36px; max-width: 80%; margin: 0 auto 0.6rem; display: block; }

.qr-card h3 { margin: 0 0 0.2rem; font-size: 1.4rem; font-weight: 700; }

.qr-card p { margin: 0.2rem 0 0.8rem; color: var(--text-muted); font-size: 0.9rem; }

/* --- Admin: Zimmer nach Etage (Floor-Grid) ------------------------------ */

.floor-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 1rem 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.floor-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.25rem; }

.room-cell {
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.5rem;
  text-align: center;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  background: var(--surface);
  flex: 0 0 98px;
}

.room-cell.inactive { background: var(--surface-sunken); color: var(--text-muted); }

.room-cell .num { font-weight: 600; display: block; margin-bottom: 0.2rem; color: var(--text); font-size: 0.85rem; }

.cell-actions { display: flex; flex-direction: column; gap: 0.2rem; align-items: center; margin-top: 0.3rem; }

.cell-actions a { font-size: 0.72rem; color: var(--accent); text-decoration: none; font-weight: 500; }
.cell-actions a:hover { text-decoration: underline; }

.x-btn { background: none; border: none; color: var(--text-muted); font-size: 0.72rem; cursor: pointer; padding: 0; font-weight: 500; }
.x-btn:hover { text-decoration: underline; }

@media (max-width: 920px) {
  .room-cell { flex: 0 0 110px; }
}

@media print {
  .no-print { display: none; }
  body { background: #fff; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* --- Mehrtagesbestellung ---------------------------------------------- */

.field-label { display: block; margin-bottom: 0.5rem; font-weight: 600; padding: 0; }
.day-presets { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.7rem; }
.day-presets .btn-ghost { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.day-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.6rem, 1fr)); gap: 0.5rem; }
.field .day-chip {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.55rem 0.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-align: center;
}
.field .day-chip input { position: absolute; opacity: 0; }
.day-chip:has(input:checked) { border-color: var(--yolk); box-shadow: inset 0 0 0 1.5px var(--yolk); }
.day-chip:has(input:focus-visible) { outline: 3px solid var(--yolk); outline-offset: 2px; }
.day-name { font-weight: 700; }
.day-date { font-size: 0.8rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.total small { font-weight: 400; color: var(--text-muted); }

/* Liefer-Hinweis je Boxtyp auf der Gast-Bestellseite (FR 6:30 Uhr / Snack in X Minuten) */
.delivery-note {
  margin: -0.2rem 0 0.8rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--sage);
}
fieldset + fieldset { margin-top: 1.4rem; }

/* Wer verkauft/liefert (Lieferant) vs. wer vermittelt (3J) - Nutzerwunsch 2026-10-20 */
.supplier-line { margin: -1.4rem 0 1.6rem; font-size: 0.92rem; color: var(--text-muted); }
.supplier-line a { color: inherit; }
.supplier-address { line-height: 1.6; margin: 0 0 0.6rem; }
.intermediary-note { margin-top: 1.4rem; font-size: 0.82rem; }
