/* MenuKit Admin — one CSS file, no preprocessor, no external assets.
   Tokens und Maße aus context/prototype (Design-Quelle). */

@font-face {
  font-family: "Hanken Grotesk";
  src: url("fonts/HankenGrotesk-VariableFont_wght.ttf") format("truetype-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("fonts/HankenGrotesk-Italic-VariableFont_wght.ttf") format("truetype-variations");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

:root {
  /* Color */
  --color-bg: #f7f4ef;
  --color-surface: #fffdfa;
  --color-border: #e6e0d6;
  --color-text: #292521;
  --color-text-muted: #82796b;
  --color-accent: #A85A38;
  --color-accent-soft: color-mix(in oklab, var(--color-accent) 9%, #fffdfa);
  --color-danger: #B3402E;
  --color-success: #3E7A5E;
  --color-warning: #9A7517;

  /* Type */
  --font-ui: "Hanken Grotesk", system-ui, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;

  /* Spacing — 4px base scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Radii & shadow */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-1: 0 1px 2px rgba(41, 37, 33, 0.06);
  --shadow-2: 0 4px 16px rgba(41, 37, 33, 0.10);
}

* { box-sizing: border-box; }

/* `hidden` must always win. The UA's `[hidden] { display: none }` lives in the
   user-agent origin, so ANY author rule that sets `display` (a component that
   is display:flex, say) silently defeats it and the element stays visible.
   One authoritative rule instead of remembering it per component. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-md);
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

code {
  font-size: 0.9em;
  background: var(--color-accent-soft);
  border-radius: var(--radius-sm);
  padding: 1px var(--space-1);
}

::placeholder { color: #b3aa9b; }

input:focus { outline: 2px solid var(--color-accent); outline-offset: -1px; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* --- Animations (Prototyp) --------------------------------------------- */

@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes bar-in   { from { opacity: 0; transform: translateY(16px); }     to { opacity: 1; transform: translateY(0); } }
@keyframes dlg-in   { from { opacity: 0; transform: scale(.97); }           to { opacity: 1; transform: scale(1); } }
@keyframes pane-in  { from { opacity: 0; transform: translateY(6px); }      to { opacity: 1; transform: translateY(0); } }
@keyframes spin     { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* --- Top bar — exact values from the prototype header ------------------ */

/* Always visible, content scrolls underneath (prototype). The editor route
   never scrolls the document (height:100dvh + overflow:hidden), so sticky is a
   no-op there and carries the header on every other route — including the
   editor's mobile fallback, where the document does scroll. Below the save bar
   and the dialogs in the stack (z 40/50/70). */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 56px;
  padding: 0 16px 0 20px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex: none;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.brand-site {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-mark {
  font-size: 11px;
  color: var(--color-text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-link {
  display: inline-block;
  font-size: 13.5px;
  font-weight: 400;
  padding: 6px 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-muted);
  text-decoration: none;
}

.nav-link.is-active {
  background: var(--color-accent-soft);
  color: var(--color-text);
  font-weight: 600;
}

a.nav-link:hover { color: var(--color-text); }

.nav-link.is-disabled { cursor: not-allowed; }

.account {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 6px 0 12px;
  border-radius: 10px;
}

.account-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

/* --- Main / generic page shell ------------------------------------------ */

.main {
  flex: 1;
  width: 100%;
  min-height: 0;
  padding: var(--space-6) var(--space-5) var(--space-8);
}

.page-title {
  margin: 0 0 var(--space-5);
  font-size: var(--text-2xl);
  font-weight: 650;
  letter-spacing: -0.01em;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: var(--space-6);
}

.hint {
  margin: var(--space-5) 0 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.footer {
  width: 100%;
  padding: var(--space-4) var(--space-5) var(--space-6);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* --- Editor shell — full height, no page scroll ------------------------- */

.route-editor { height: 100dvh; overflow: hidden; }
.route-editor .main { padding: 0; display: flex; }

.editor {
  display: flex;
  flex: 1;
  min-height: 0;
  width: 100%;
}

.editor-error {
  padding: var(--space-6);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* --- Tree pane ----------------------------------------------------------- */

.tree {
  width: 480px;
  flex: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--color-border);
  background: var(--color-surface);
}

@media (max-width: 1100px) { .tree { width: 380px; } }

.tree-tabs {
  display: flex;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  flex: none;
}

.tree-tab {
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text-muted);
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 7px;
}

.tree-tab.is-active {
  border-color: color-mix(in oklab, var(--color-accent) 30%, #fff);
  background: var(--color-accent-soft);
  color: var(--color-text);
  font-weight: 600;
}

.tree-tab:disabled, .tree-tab-add:disabled { cursor: not-allowed; opacity: .55; }

.tree-tab-add {
  width: 34px;
  height: 34px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed var(--color-border);
  background: transparent;
  border-radius: 8px;
  color: var(--color-accent);
  cursor: pointer;
}

.tree-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 6px 12px 140px;
}

.tree-section.is-nested { margin-left: 16px; }

.tree-section-head {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  margin-top: 14px;
  padding: 0 4px;
  border-radius: 8px;
}

.tree-section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-item {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 8px;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text);
  text-decoration: none;
  transition: background .12s ease-out;
}

.tree-item:hover { background: rgba(0, 0, 0, 0.035); }

.tree-item.is-active, .tree-item.is-active:hover { background: var(--color-accent-soft); }

.tree-item .is-dim { opacity: .45; }

.tree-item-nr {
  font-size: 11px;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
  width: 22px;
  text-align: right;
  flex: none;
}

.tree-item-thumb {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 6px;
  overflow: hidden;
  margin: 0 4px;
  background: var(--color-bg);
}
.tree-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* whole dish visible, never cropped */
  display: block;
}
.tree-item-thumb.is-empty {
  border: 1.5px dashed var(--color-border);
  opacity: .6;
  background: none;
}

.tree-item-title {
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-item-price {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
  flex: none;
  padding-left: 8px;
}

.pill-soldout,
.pill-hidden {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  flex: none;
  margin-left: 4px;
  white-space: nowrap;
}
.pill-soldout { background: #f3ead3; color: #8a6d1f; }
.pill-hidden  { background: #e9e4db; color: #7a7266; }

.tree-section-empty {
  font-size: 12.5px;
  color: var(--color-text-muted);
  padding: 8px 24px 2px;
}

.tree-add {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 0 8px 0 16px;
  border: none;
  background: transparent;
  color: var(--color-accent);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

/* Hover tints only the label pill, not the full-width row. */
.tree-add-label {
  padding: 5px 8px;
  border-radius: 6px;
  transition: background .12s ease-out;
}
.tree-add:hover .tree-add-label, .tree-add.is-active .tree-add-label { background: var(--color-accent-soft); }

.tree-add-section {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  margin-top: 18px;
  padding: 0;
  border: 1.5px dashed var(--color-border);
  background: transparent;
  border-radius: 10px;
  color: var(--color-text-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.tree-add-section:hover { color: var(--color-accent); border-color: var(--color-accent); }

.tree-add-section:hover, .tree-add-section.is-active {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.tree-empty {
  margin: 36px 6px;
  padding: 32px 22px;
  border: 1.5px dashed var(--color-border);
  border-radius: 12px;
  text-align: center;
}

.tree-empty-title { font-size: 14.5px; font-weight: 600; }

.tree-empty-text {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: 6px 0 16px;
}

/* --- Detail pane ---------------------------------------------------------- */

.pane {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  /* Query container so the dish form can go two-column based on the space it
     actually has (like the prototype's formW measurement), not the viewport. */
  container: pane / inline-size;
}

.pane-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 14px;
  padding: 24px;
  text-align: center;
}

.pane-form {
  width: 100%;
  max-width: 680px;
  padding: 24px 28px 150px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: pane-in .18s ease-out;
}

.pane-back {
  display: none;
  align-items: center;
  gap: 4px;
  height: 40px;
  padding: 0 10px 0 4px;
  border-radius: 8px;
  color: var(--color-accent);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  align-self: flex-start;
}

.crumb {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.pane-title {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Meta-Zeile unter dem Gericht-Titel: Allergen-Kürzel + Kennzeichnungen
   (Pill-Stil wie die Badges der öffentlichen Karte im Prototyp). */
.pane-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
}
.meta-allergen {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-accent-soft);
  border: 1px solid color-mix(in oklab, var(--color-accent) 28%, #fff);
  color: var(--color-accent);
  font-size: 10.5px;
  font-weight: 700;
  cursor: default;
}
.meta-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.form-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Dish-form columns (prototype): main (Identität, Preise) beside the Bild rail.
   Single column until the pane is wide enough to fit both comfortably. */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px 26px;
  align-items: start;
}
.form-main,
.form-rail {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}

@container pane (min-width: 960px) {
  .pane-form { max-width: 1260px; }
  .form-grid { grid-template-columns: minmax(0, 2fr) minmax(280px, 0.85fr); }
}

.fcard {
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  padding: 18px;
}

.fcard-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 14px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  font: inherit;
  font-size: 14px;
  color: var(--color-text);
}

.input.has-error { border-color: var(--color-danger); }
.input.has-error:focus { outline-color: var(--color-danger); }

.price-row { display: flex; gap: 8px; align-items: center; }

.amount-wrap { position: relative; width: 104px; flex: none; }

.input-amount {
  padding: 0 26px 0 12px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.amount-unit {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 13px;
}

.field-error {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--color-danger);
}

.field-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--color-text-muted);
}

/* --- Image upload zone (Bild) — matches context/prototype -------------------- */
/* The zone switches its states via the [hidden] attribute — the global rule at
   the top of this file keeps that authoritative over their display:flex. */

/* Hidden native file input — opened programmatically by the picker button. */
.imgzone-input {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* Empty/busy/error states share a 168×168 footprint, centered in the stage;
   the done state breaks out to the full card width (see .imgzone-photo-box). */
.imgzone-stage {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.imgzone-pick,
.imgzone-box {
  width: 168px;
  height: 168px;
  box-sizing: border-box;
  border-radius: 10px;
}

/* Empty: dashed picker button. */
.imgzone-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1.5px dashed var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.imgzone-pick:hover,
.imgzone-pick:focus-visible,
.imgzone-pick.is-dragover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}
.imgzone-pick-title { font-size: 12.5px; font-weight: 500; }
.imgzone-pick-hint  { font-size: 11px; }

/* Busy / done / error boxes share the solid-border frame. */
.imgzone-box {
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* Uploading: label + progress bar + percentage. */
.imgzone-uploading { gap: 10px; }
.imgzone-uploading-label { font-size: 12px; text-align: center; color: var(--color-text); }
.imgzone-bar {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--color-border);
  overflow: hidden;
}
.imgzone-bar-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: 3px;
  transition: width .15s ease-out;
}
.imgzone-pct {
  font-size: 11px;
  text-align: center;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

/* Processing: spinner + note. */
.imgzone-processing { gap: 10px; }
.imgzone-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex: none;
}
.imgzone-processing-label { font-size: 11.5px; text-align: center; color: var(--color-text-muted); }

/* Done: the image fills the 168×168 frame. */
/* Done: the photo spans the card, uncropped, inset by twice the card padding
   per side — dish photos are often cutouts on transparency, so no frame, no
   background, no fixed square. */
.imgzone-photo-box {
  padding: 0 36px;
  overflow: hidden;
  width: 100%;
  height: auto;
  border: none;
  background: none;
}
.imgzone-photo { width: 100%; height: auto; object-fit: contain; display: block; }

/* Error (no prototype equivalent — same frame, danger-toned). */
.imgzone-error {
  gap: 10px;
  border-color: color-mix(in oklab, var(--color-danger) 40%, var(--color-border));
  background: color-mix(in oklab, var(--color-danger) 7%, var(--color-bg));
}
.imgzone-error-text { font-size: 12px; text-align: center; color: var(--color-danger); }
.imgzone-retry-link {
  background: none; border: none;
  color: var(--color-accent);
  font: inherit; font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

/* Alt-Text section below the frame (done state only). */
.imgzone-alt { margin-top: 14px; }
.imgzone-alt-label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.imgzone-alt-req { color: var(--color-danger); }
.imgzone-remove-link {
  background: none; border: none;
  color: var(--color-text-muted);
  font: inherit; font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  padding: 6px 0 0;
}
.imgzone-remove-link:hover { color: var(--color-danger); }

/* --- Verfügbarkeit & Standorte (rail card) ---------------------------------- */

.avail-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}
.avail-row--sep {
  border-top: 1px solid var(--color-border);
  margin-top: 14px;
  padding-top: 14px;
}
.avail-text { flex: 1; min-width: 0; }
.avail-name { font-size: 13.5px; font-weight: 600; }
.avail-hint { font-size: 12.5px; color: var(--color-text-muted); margin-top: 2px; }

.avail-delete {
  border-top: 1px solid var(--color-border);
  margin-top: 14px;
  padding-top: 14px;
}
.avail-delete .danger-hint { margin-top: 8px; }

/* Pill toggle built from a native checkbox (works without JS; the label
   submits it, and the styled track is the visual switch). */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex: none;
}
.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}
.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--color-border);
  transition: background .15s ease-out;
}
.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  transition: left .15s ease-out;
}
.switch input:checked ~ .switch-track { background: var(--color-success); }
.switch input:checked ~ .switch-track::after { left: 21px; }
.switch input:focus-visible ~ .switch-track {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* --- Full item form (feature 05) — matches context/prototype ---------------- */

/* Identität: Nummer (fixed) + Titel (fluid). */
.id-row { display: flex; gap: 10px; }
.id-nr { width: 96px; flex: none; }
.id-title { flex: 1; min-width: 0; }

/* Nummer helper zone: next-free hint, "ist frei" note, conflict alert. */
.nr-help:empty { display: none; }
.nr-next { margin-top: 6px; font-size: 12px; color: var(--color-text-muted); }
.nr-next-btn {
  border: none; background: none; padding: 4px;
  color: var(--color-accent); font: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; text-decoration: underline;
}
.nr-free { margin-top: 6px; font-size: 12px; color: var(--color-success); }
.nr-conflict {
  margin-top: 8px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  padding: 10px 12px;
  border: 1px solid color-mix(in oklab, var(--color-warning) 45%, #fff);
  background: #faf4e0;
  border-radius: 8px;
}
.nr-conflict-msg { font-size: 12.5px; color: #6f5a14; line-height: 1.45; flex: 1; min-width: 180px; }
.nr-jump {
  min-height: 40px; padding: 0 14px;
  border: 1px solid color-mix(in oklab, var(--color-warning) 55%, #fff);
  background: var(--color-surface); border-radius: 8px;
  color: var(--color-text); font: inherit; font-size: 12.5px; font-weight: 600;
  cursor: pointer; flex: none;
}

/* Card header with a right-aligned meta (Beschreibung char count). */
.fcard-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 12px;
}
.fcard-head .fcard-eyebrow { margin-bottom: 0; }
.desc-count { font-size: 11.5px; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.desc-count.is-over { color: var(--color-danger); }

/* Beschreibung: rich text (JS) over a plain textarea (no-JS baseline). */
.desc { border: 1px solid var(--color-border); border-radius: 8px; overflow: hidden; background: var(--color-surface); }
.desc-bar {
  display: none;
  align-items: center; gap: 2px;
  padding: 4px 6px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}
.js .desc-bar { display: flex; }
.desc-btn {
  width: 44px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 6px; background: transparent;
  color: var(--color-text); font-size: 14px; cursor: pointer;
}
.desc-btn-b { font-weight: 700; }
.desc-btn-i { font-style: italic; font-family: Georgia, serif; font-size: 15px; }
.desc-btn[aria-pressed="true"] { background: var(--color-accent-soft); color: var(--color-accent); }
.desc-kbd { margin-left: auto; font-size: 11px; color: var(--color-text-muted); padding-right: 6px; }
.desc-rich {
  display: none;
  min-height: 84px; max-height: 190px; overflow-y: auto;
  padding: 10px 12px; font-size: 14px; line-height: 1.5; outline: none;
}
.js .desc-rich { display: block; }
.desc-rich:empty::before { content: attr(data-placeholder); color: var(--color-text-muted); }
.desc-rich strong { font-weight: 700; }
.desc-rich em { font-style: italic; }
.desc-plain {
  display: block; width: 100%; min-height: 84px; height: auto;
  padding: 10px 12px; border: none; border-radius: 0; resize: vertical;
  font: inherit; font-size: 14px; line-height: 1.5;
}
/* With JS the rich editor is authoritative; keep the textarea submittable but hidden. */
.js .desc-plain { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }

/* Preise: repeatable rows. */
.price-row + .price-row,
.prices .price-row { margin-bottom: 8px; }
.price-label { flex: 1; min-width: 0; }
.price-remove {
  width: 34px; height: 34px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; border-radius: 8px;
  color: var(--color-text-muted); cursor: pointer;
}
.price-remove:hover { background: rgba(0, 0, 0, 0.06); color: var(--color-danger); }
.price-add {
  height: 36px; padding: 0 10px;
  border: none; background: transparent; border-radius: 8px;
  color: var(--color-accent); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.price-add:hover { background: var(--color-accent-soft); }
.price-max { margin-top: 2px; }

/* Allergene & Kennzeichnung: collapsible accordion. */
.fcard--accordion { padding: 0; }
.acc-head {
  width: 100%; box-sizing: border-box;
  display: flex; align-items: center; gap: 8px;
  min-height: 50px; padding: 0 18px;
  border: none; background: transparent; cursor: pointer; text-align: left;
  border-radius: 12px; font: inherit;
}
.acc-title { flex: none; margin-bottom: 0; }
.acc-summary {
  font-size: 12px; color: var(--color-text-muted);
  margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.acc-chevron { display: flex; flex: none; color: var(--color-text-muted); transition: transform .15s ease-out; }
.acc-head[aria-expanded="true"] .acc-chevron { transform: rotate(180deg); }
.acc-body { padding: 0 18px 18px; display: flex; flex-direction: column; gap: 16px; }
.js .acc-body { display: none; }
.js .acc-head[aria-expanded="true"] ~ .acc-body { display: flex; }
.acc-group-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* Chip = a native checkbox styled as a pressable pill (works without JS). */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 12px;
  border: 1px solid var(--color-border); border-radius: 999px;
  background: var(--color-surface); color: var(--color-text-muted);
  font-size: 12.5px; cursor: pointer; user-select: none;
}
.chip--badge { font-size: 13px; font-weight: 500; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.chip-code { font-weight: 700; font-size: 11px; }
.chip.is-active {
  background: var(--color-accent-soft);
  border-color: color-mix(in oklab, var(--color-accent) 45%, #fff);
  color: var(--color-text);
}
.chip:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: 2px; }

.danger-zone { padding: 14px 18px 16px; }

.danger-hint {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 8px;
}

.confirm-text { margin: 0 0 18px; font-size: 14px; line-height: 1.5; }

.confirm-actions { display: flex; align-items: center; gap: 10px; }

/* --- Buttons --------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 16px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: color-mix(in oklab, var(--color-accent) 88%, #000); }

.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
  font-weight: 400;
  font-size: 13px;
}
.btn-ghost:hover { background: rgba(0, 0, 0, 0.04); }

.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: color-mix(in oklab, var(--color-danger) 88%, #000); }

.btn-danger-ghost {
  background: transparent;
  color: var(--color-danger);
  border-color: color-mix(in oklab, var(--color-danger) 35%, #fff);
  font-size: 13px;
}
.btn-danger-ghost:hover { background: color-mix(in oklab, var(--color-danger) 7%, #fff); }

.form-actions { display: flex; align-items: center; gap: 10px; }

/* Mit JS übernimmt die Speicherleiste; Formular-Buttons sind der No-JS-Pfad. */
.js .form-actions { display: none; }

/* --- Notices (No-JS-Fallback; JS wandelt sie in Toasts um) ----------------- */

.notice {
  margin: 16px 28px 0;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  border: 1px solid;
  max-width: 624px;
}

.notice-ok {
  color: var(--color-success);
  border-color: color-mix(in oklab, var(--color-success) 35%, var(--color-surface));
  background: color-mix(in oklab, var(--color-success) 8%, var(--color-surface));
}

.notice-warn {
  color: var(--color-warning);
  border-color: color-mix(in oklab, var(--color-warning) 45%, #fff);
  background: color-mix(in oklab, var(--color-warning) 8%, var(--color-surface));
}

.js .notice { display: none; }

/* --- Speicherleiste (JS) ---------------------------------------------------- */

.savebar-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  padding: 14px 16px;
  pointer-events: none;
}

.savebar {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  background: #2b2620;
  color: #fff;
  padding: 10px 10px 10px 18px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(40, 30, 20, .28);
  animation: bar-in .15s ease-out;
  max-width: 100%;
}

.savebar-label { font-size: 13.5px; white-space: nowrap; }

.savebar-discard {
  height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .28);
  background: transparent;
  border-radius: 8px;
  color: #fff;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.savebar-discard:hover { background: rgba(255, 255, 255, .1); }

.savebar-save {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border: none;
  background: var(--color-accent);
  border-radius: 8px;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex: none;
}

/* --- Toast (JS) -------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 6px 20px rgba(40, 30, 20, .14);
  animation: toast-in .2s ease-out;
  max-width: calc(100vw - 32px);
}

.toast.is-raised { bottom: 84px; }

.toast-icon { display: flex; flex: none; color: var(--color-success); }

.toast.is-warn  { border-color: color-mix(in oklab, var(--color-warning) 45%, #fff); }
.toast.is-warn  .toast-icon { color: var(--color-warning); }
.toast.is-error { border-color: color-mix(in oklab, var(--color-danger) 40%, #fff); }
.toast.is-error .toast-icon { color: var(--color-danger); }

.toast-text { font-size: 13.5px; }

.toast-close {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: var(--color-text-muted);
  cursor: pointer;
}
.toast-close:hover { background: rgba(0, 0, 0, 0.06); }

/* --- Dialog (JS) --------------------------------------------------------------- */

.dlg-overlay {
  position: fixed;
  inset: 0;
  background: rgba(41, 37, 33, .42);
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: background-color .18s ease-out;
}

/* Sanfter Einstieg des Overlay-Hintergrunds beim ersten Rendern. */
@starting-style {
  .dlg-overlay { background: rgba(41, 37, 33, 0); }
}

.dlg {
  width: 440px;
  max-width: 100%;
  background: var(--color-surface);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(40, 30, 20, .3);
  padding: 22px;
  animation: dlg-in .14s ease-out;
}

.dlg-title { font-size: 16px; font-weight: 700; margin: 0 0 10px; }

.dlg-text { font-size: 13.5px; line-height: 1.5; color: var(--color-text); margin: 0; }

.dlg-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

/* --- Feature 06: Baum-Steuerungen, Karten-Tabs, Dialoge ------------------------ */

/* Karten-Tabs (mehrere Karten, umbenennbar) */
a.tree-tab, .tree-tab-add { text-decoration: none; }
.tree-tab-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 168px;
}
.tree-tab.is-hidden .tree-tab-label { opacity: .5; }
.tree-tab-edit {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  margin: -2px -4px -2px 0;
  border-radius: 5px;
  color: var(--color-text-muted);
  opacity: .6;
}
.tree-tab-edit:hover { opacity: 1; background: rgba(0, 0, 0, 0.08); }

/* Greifpunkt (Drag), Steuer-Buttons, Spacer */
.tree-grip {
  display: flex;
  flex: none;
  padding: 2px;
  color: var(--color-text-muted);
  opacity: .5;
  cursor: grab;
}
.tree-grip:active { cursor: grabbing; }
.tree-ctl-form { display: contents; }
.tree-ctl-group {
  display: flex;
  align-items: center;
  gap: 1px;
  flex: none;
}
.tree-ctl {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: var(--color-text-muted);
  cursor: pointer;
}
.tree-ctl:hover { background: rgba(0, 0, 0, 0.06); color: var(--color-text); }
.tree-ctl-spacer { flex: 0; }

/* Selektierbarer Titelbereich in Kopfzeile/Zeile */
.tree-section-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
  border-radius: 6px;
  padding: 3px 4px;
}
.tree-section-head.is-active { background: var(--color-accent-soft); }
.tree-section.is-hidden .tree-section-title { opacity: .55; }

.tree-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0;
  text-decoration: none;
  color: inherit;
}
.tree-item.is-dim .tree-item-main,
.tree-item.is-dim .tree-item-price { opacity: .45; }
.tree-item[draggable="true"] { cursor: default; }
.tree-item.is-dragging { opacity: .4; }
.tree-item.drop-before { box-shadow: inset 0 2px 0 var(--color-accent); }
.tree-item.drop-after { box-shadow: inset 0 -2px 0 var(--color-accent); }

/* Verfügbarkeits-Schalter in der Baumzeile */
.tree-avail {
  position: relative;
  width: 34px;
  height: 20px;
  flex: none;
  margin-left: 2px;
  border: none;
  border-radius: 999px;
  background: #d6cfc2;
  cursor: pointer;
  padding: 0;
  transition: background .15s ease-out;
}
.tree-avail.is-on { background: var(--color-success); }
.tree-avail-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  transition: left .15s ease-out;
}
.tree-avail.is-on .tree-avail-knob { left: 16px; }

/* Speicherleiste: Konflikt-Punkt + blockierter Speichern-Knopf */
.savebar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-warning);
  flex: none;
}
.savebar-save.is-blocked { opacity: .6; }

/* Kategorie-Beschreibung: getrenntes Feld unterhalb des Namens (wie avail-row--sep) */
.field--sep {
  border-top: 1px solid var(--color-border);
  margin-top: 14px;
  padding-top: 14px;
}
.field--sep .fcard-head { margin-bottom: 8px; }
.field--sep .field-label { margin-bottom: 0; }

/* Unterkategorie-Aktion in der Kategorie-Karte (außerhalb der JS-versteckten form-actions) */
.fcard-action {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
}

/* Unterkategorien-Liste in den Kategorie-Einstellungen */
.subsec-head {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}
.subsec-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.subsec-list:not(:empty) { margin-bottom: 12px; }
.subsec-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
  transition: background .12s ease-out;
}
.subsec-row:hover { background: var(--color-accent-soft); }
.subsec-name {
  font-size: 13.5px;
  font-weight: 500;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.subsec-count {
  margin-left: auto;
  flex: none;
  font-size: 12.5px;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}
.subsec-chev { display: flex; flex: none; color: var(--color-text-muted); }

/* Löschkarte (Kategorie/Karte) + Dialog-Abstandshalter */
.avail-delete-card { display: flex; flex-direction: column; gap: 8px; }
.avail-delete-card form { margin: 0; }
.dlg-spacer { flex: 1; }
.dlg .field { margin-top: 4px; }

/* --- Mobil: gestapelte Navigation über URL-Zustände ---------------------------- */

@media (max-width: 800px) {
  .route-editor { height: auto; overflow: auto; }
  .tree { width: 100%; border-right: none; }
  .editor.has-pane .tree { display: none; }
  .editor:not(.has-pane) .pane { display: none; }
  .pane-back { display: flex; }
  .pane-form { padding: 12px 16px 150px; gap: 18px; }
  .notice { margin: 16px 16px 0; }
}

/* --- Auth gate (login + forced password change) — 05-login.png ----------- */

.gate {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-5);
}

.gate-brand { text-align: center; margin-bottom: var(--space-6); }
.gate-site { font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.01em; }
.gate-mark {
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.28em;
  color: var(--color-text-muted);
}

/* Extends .card — only the gate-specific deltas live here. */
.gate-card {
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-2);
}

.gate-title {
  margin: 0 0 var(--space-4);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.gate-hint {
  margin: calc(-1 * var(--space-2)) 0 var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.gate-error {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  background: color-mix(in oklab, var(--color-danger) 9%, var(--color-surface));
  border: 1px solid color-mix(in oklab, var(--color-danger) 30%, var(--color-border));
  color: var(--color-danger);
}

.gate-error.is-lock {
  background: color-mix(in oklab, var(--color-warning) 10%, var(--color-surface));
  border-color: color-mix(in oklab, var(--color-warning) 32%, var(--color-border));
  color: var(--color-warning);
}

.gate-form .field { margin-bottom: var(--space-4); }

.gate-submit {
  width: 100%;
  height: 44px;
  font-size: var(--text-md);
  margin-top: var(--space-2);
}

.gate-forgot {
  display: block;
  margin-top: var(--space-4);
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
}
.gate-forgot:hover { text-decoration: underline; }

.gate-footer {
  margin-top: var(--space-8);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-align: center;
}

.gate-logout { margin-top: var(--space-4); text-align: center; }
.gate-logout-btn {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  text-decoration: underline;
}
.gate-logout-btn:hover { color: var(--color-text); }

/* --- Topbar: Konto-Chip (Abmelden wohnt auf der Konto-Seite, Feature 10) --- */

a.account { color: inherit; text-decoration: none; }
a.account:hover,
a.account.is-active { background: var(--color-accent-soft); }
.account-name {
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
@media (max-width: 720px) { .account-name { display: none; } }

/* --- Einstellungen (Feature 08) — Maße und Farben aus dem Prototyp --------- */

.settings {
  max-width: 820px;
  margin: 0 auto;
}

.settings-head { margin: var(--space-2) 0 var(--space-6); }
.settings-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.settings-sub {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: var(--color-text-muted);
}

.settings-card { margin-bottom: 26px; border-radius: 14px; }
.settings-card--flush { padding: 0; overflow: hidden; }
.settings-card--flush .settings-card-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 0;
}
.settings-card-head { margin-bottom: 16px; }
.settings-card-title { margin: 0; font-size: 15px; font-weight: 700; }
.settings-hint {
  margin: 2px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--color-text-muted);
}

/* Standort-Zeile: Avatar · Felder · Aktionen. Jede Zeile ist ein eigenes
   Formular (No-JS-Fallback mit Speichern-Knopf; JS entfernt ihn). */
.loc-list { display: flex; flex-direction: column; }
.loc-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}

.loc-avatar {
  flex: none;
  width: 34px;
  height: 34px;
  margin-top: 2px;
  border-radius: 9px;
  background: var(--color-accent-soft);
  border: 1px solid color-mix(in oklab, var(--color-accent) 30%, #fff);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

.loc-fields {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.loc-name-input { height: 40px; background: var(--color-bg); font-size: 14px; font-weight: 600; }
.loc-slug-input { height: 38px; background: var(--color-bg); font-size: 13px; color: var(--color-text-muted); }

/* .switch mit Textlabel daneben: Track aus dem absoluten Layout der Basis-
   klasse in den Flex-Fluss holen, damit der Text nicht überlagert wird. */
.loc-published {
  width: auto;
  height: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  margin-top: 2px;
  cursor: pointer;
}
.loc-published .switch-track {
  position: relative;
  inset: auto;
  flex: none;
  width: 44px;
  height: 26px;
}
.loc-published-label { font-size: 12.5px; font-weight: 500; color: var(--color-text-muted); }
.loc-published input:checked ~ .loc-published-label { color: var(--color-success); }

.loc-actions {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.loc-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
}
.loc-delete:hover { color: var(--color-danger); background: color-mix(in oklab, var(--color-danger) 7%, #fff); }

/* Hinzufügen: No-JS-Inline-Formular; settings.js ersetzt es durch die
   Dialog-Zeile .loc-add-row am Listenende (Prototyp). */
.loc-add {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 20px;
}
.loc-add .input { max-width: 340px; background: var(--color-bg); }
.loc-add-btn { flex: none; color: var(--color-accent); }
.loc-add-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 48px;
  padding: 0 20px;
  border: none;
  background: transparent;
  color: var(--color-accent);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.loc-add-row:hover { background: var(--color-accent-soft); }

/* Katalog-Chips: dunkler Text auf --color-bg (Prototyp-Einstellungen);
   Links bzw. Buttons, No-JS: Bearbeiten-Pane, JS: Dialog. */
.settings-chips { gap: 8px; }
.settings-chips .chip {
  height: auto;
  background: var(--color-bg);
  color: var(--color-text);
}
a.chip-link { padding: 5px 12px 5px 6px; text-decoration: none; }
a.chip--badge.chip-link { padding: 7px 14px; font-size: 12.5px; }
a.chip-link:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
  color: var(--color-text);
}
.settings-chips .chip-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-accent-soft);
  border: 1px solid color-mix(in oklab, var(--color-accent) 28%, #fff);
  color: var(--color-accent);
  font-size: 10.5px;
  font-weight: 700;
}
.settings-chips a.chip-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: auto;
  padding: 6px 12px;
  border: 1.5px dashed var(--color-border);
  background: transparent;
  color: var(--color-accent);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}
.settings-chips a.chip-add:hover { border-color: var(--color-accent); background: transparent; }

/* No-JS-Bearbeitungs-Panes unter den Karten. */
.settings-pane { border-color: color-mix(in oklab, var(--color-accent) 35%, var(--color-border)); }
.settings-pane-fields {
  display: flex;
  gap: 12px;
  margin: 14px 0 16px;
}
.settings-pane-fields .field { flex: 1; margin: 0; }
.settings-pane-fields .field--code { flex: 0 0 120px; }
.settings-pane-delete {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 560px) {
  .loc-row { flex-wrap: wrap; }
  .loc-actions { flex-direction: row; width: 100%; justify-content: flex-end; }
  .loc-add { flex-wrap: wrap; }
  .settings-pane-fields { flex-direction: column; }
  .settings-pane-fields .field--code { flex: 1; }
}

/* --- Vorschau (Feature 09) — 02-menu-preview.png ---------------------------- */

.route-preview .main { padding: 0; display: flex; flex-direction: column; }

.preview { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* Subheader bar: title + hint left, segmented switchers right. */
/* Sticks under the topbar (56px) so the Standort/Gerät switchers stay reachable
   while a long card scrolls past — the prototype's preview head is sticky too. */
.preview-head {
  position: sticky;
  top: 56px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-5);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.preview-head-text {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  min-width: 0;
}

.preview-title {
  margin: 0;
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.preview-sub {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.preview-controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* Segmented control (Mobil | Desktop, Karten) — links, so it works without JS. */
.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
}

.seg-btn {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  white-space: nowrap;
}

.seg-btn:hover { color: var(--color-text); }

.seg-btn.is-active {
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 600;
  box-shadow: var(--shadow-1);
}

/* Stage: warm background, sheet centered; page scrolls as one. */
.preview-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-8) var(--space-5) 96px; /* bottom clears the floating Edit button */
}

.preview-notice {
  margin: 0 0 var(--space-5);
  padding: 6px 14px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--color-warning) 12%, #fffdfa);
  border: 1px solid color-mix(in oklab, var(--color-warning) 30%, #fffdfa);
  color: var(--color-warning);
  font-size: var(--text-sm);
  font-weight: 500;
}

/* The sheet is the white card around the iframe; the iframe viewport IS the
   simulated device width, so the fragment's own media queries respond to it.
   Both widths are the prototype's card (760 / 375 px) — with the frame's own
   padding they yield exactly the text column the design was drawn at. */
.preview-sheet {
  width: min(100%, 84rem); /* matches the demo start page column so the hover-reveal stage layout previews true */
  background: #fffdf8;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(40, 30, 20, 0.06);
  overflow: hidden;
  transition: width 0.25s ease;
}

.preview-sheet.is-mobil { width: min(100%, 375px); }

.preview-frame {
  display: block;
  width: 100%;
  height: 75vh; /* no-JS fallback: scrolls internally; preview.js grows it to fit */
  border: 0;
  background: #fffdf8;
}

/* Empty state — no fragment yet / no visible Karte. */
.preview-empty {
  max-width: 32rem;
  text-align: center;
  margin-top: var(--space-8);
}

.preview-empty-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-lg);
  font-weight: 650;
}

.preview-empty-text {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.preview-empty-meta {
  margin: var(--space-4) 0 0;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

/* Floating Edit button back to the editor (built design: bottom center pill). */
.preview-edit {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--color-accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-2);
  z-index: 40;
}

.preview-edit:hover { background: color-mix(in oklab, var(--color-accent) 88%, #000); }

@media (max-width: 560px) {
  .preview-head-text { flex-direction: column; gap: 2px; }
  .preview-sub { white-space: normal; }
  .preview-controls { margin-left: 0; width: 100%; }
  .preview-stage { padding: var(--space-5) var(--space-3) 96px; }
}

/* --- Benutzer & Konto (Feature 10) ------------------------------------------ */

/* Anders als in Editor/Einstellungen sind die Formular-Buttons hier auch mit
   JS der Speicherpfad (kein Dialog-/Speicherleisten-Ersatz) — die globale
   No-JS-Regel `.js .form-actions` gilt für diese Seiten nicht. */
.js .users .form-actions,
.js .konto .form-actions { display: flex; }

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a7266' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}

/* Benutzer-Liste — Zeilenaufbau wie die Standort-Zeilen der Einstellungen */
.user-list { display: flex; flex-direction: column; }
.user-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}
.user-row:last-child { border-bottom: 0; }
.user-row.is-inactive .user-avatar,
.user-row.is-inactive .user-edit { opacity: 0.55; }

.user-main { flex: 1; min-width: 0; }
.user-edit { display: flex; gap: 8px; align-items: center; }
.user-name-input { height: 40px; background: var(--color-bg); font-size: 14px; font-weight: 600; }
.user-role-select { width: 110px; flex: none; height: 40px; background-color: var(--color-bg); font-size: 13px; }

.user-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--color-text-muted);
}
.user-email { font-variant-numeric: tabular-nums; }
.user-meta-sep { color: var(--color-border); }

.pill-you,
.pill-inactive,
.pill-must-change {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
.pill-you         { background: var(--color-accent-soft); color: var(--color-accent); }
.pill-inactive    { background: #e9e4db; color: #7a7266; }
.pill-must-change { background: #f3ead3; color: #8a6d1f; }

.user-actions {
  flex: none;
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 2px;
}
.user-actions .btn { font-size: 12.5px; }

.user-create-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 130px;
  gap: 12px;
  margin-bottom: 16px;
}

/* Einmal-Passwort — wird genau einmal angezeigt (03-admin §6) */
.otp-card { border-color: color-mix(in oklab, var(--color-accent) 35%, var(--color-border)); }
.otp-hint { margin-top: 4px; }
.otp-row { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
.otp-value {
  max-width: 260px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  letter-spacing: 0.06em;
  font-weight: 600;
  background: var(--color-bg);
}

/* Konto */
.konto-card-title { margin-bottom: 14px; }
.konto .field { margin-bottom: 16px; }
.konto-pw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.konto-pw-grid .field { margin-bottom: 16px; }
.konto-pw-actions .field-hint { margin: 0; }
.konto-logout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.konto-logout .konto-card-title { margin-bottom: 0; }

@media (max-width: 720px) {
  .user-row { flex-wrap: wrap; }
  .user-main { flex-basis: calc(100% - 48px); }
  .user-actions { margin-left: 48px; flex-wrap: wrap; }
  .user-create-fields { grid-template-columns: 1fr; }
  .konto-pw-grid { grid-template-columns: 1fr; }
}

/* --- Multi-Standort (Feature 11) --------------------------------------------- */
/* Verfügbarkeit & Standorte: eine Zeile pro Standort — Schalter (verfügbar/
   ausverkauft) links, Standortname, Auge (sichtbar auf dieser Karte) rechts. */
.avail-locs-hint {
  margin: 0 0 4px;
  font-size: 12.5px;
  color: var(--color-text-muted);
}
.avail-locs { display: flex; flex-direction: column; }
.avail-loc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}
.avail-loc-name { font-size: 13.5px; flex: 1; min-width: 0; }
.loc-eye {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  color: var(--color-text);
  flex: none;
}
.loc-eye:hover { background: rgba(0, 0, 0, 0.06); }
.loc-eye input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.loc-eye .loc-eye-on,
.loc-eye .loc-eye-off { display: flex; pointer-events: none; }
.loc-eye input:checked ~ .loc-eye-off { display: none; }
.loc-eye input:not(:checked) ~ .loc-eye-on { display: none; }
.loc-eye input:not(:checked) ~ .loc-eye-off { color: var(--color-text-muted); }
.loc-eye input:focus-visible ~ .loc-eye-on,
.loc-eye input:focus-visible ~ .loc-eye-off {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Abweichende Preise: getönter Override-Block mit Standort-Badge (Prototyp). */
.ov-standard-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.ov-standard-title { font-size: 13px; font-weight: 600; }
.ov-standard-note { font-size: 12px; color: var(--color-text-muted); }
.ov-block {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid color-mix(in oklab, var(--color-accent) 38%, #fff);
  border-radius: 10px;
  background: var(--color-accent-soft);
}
.ov-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.ov-badge {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--color-accent);
  color: #fff;
}
.ov-note { font-size: 12px; color: var(--color-text-muted); }
.ov-reset {
  margin-left: auto;
  height: 32px;
  padding: 0 8px;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: var(--color-accent);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}
.ov-hint { margin-top: 2px; }
.ov-add {
  display: block;
  width: 100%;
  margin-top: 12px;
  min-height: 40px;
  padding: 0 12px;
  border: 1.5px dashed var(--color-border);
  background: transparent;
  border-radius: 10px;
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.ov-add:hover { color: var(--color-accent); border-color: var(--color-accent); }

/* Baumzeilen: kompakte Standort-Chips (grün = verfügbar, blass = ausverkauft). */
.tree-locchips { display: flex; gap: 4px; flex: none; align-items: center; }
.tree-locchip {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: #b8b0a2;
  text-decoration: line-through;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}
.tree-locchip.is-on {
  border-color: color-mix(in oklab, var(--color-success) 35%, #fff);
  background: color-mix(in oklab, var(--color-success) 12%, #fffdfa);
  color: var(--color-success);
  text-decoration: none;
}

/* Teil-Sichtbarkeit ("Hafen: aus") — Pill bleibt einzeilig lesbar. */
.pill-partial { white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }

/* „Sichtbar in“ — Checkbox-Zeilen für Kategorien, Karten und den Karten-Dialog. */
.visin .avail-hint { margin-top: 1px; }
.visin-rows { display: flex; flex-direction: column; margin-top: 6px; }
.visin-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  cursor: pointer;
}
.visin-row input {
  position: absolute;
  opacity: 0;
  width: 20px;
  height: 20px;
  margin: 0;
  cursor: pointer;
}
.visin-box {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  flex: none;
}
.visin-row input:checked + .visin-box {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: #fff;
}
.visin-row input:focus-visible + .visin-box {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
.visin-name { font-size: 14px; }
.visin--dlg { margin-bottom: 4px; }
.form-actions--tight { margin-top: 14px; }

/* Vorschau: Standort-Umschalter — Entwurfs-Standorte sind markiert. */
.seg-draft {
  margin-left: 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 1px 6px;
}
.preview-notice--draft { display: block; }

/* --- Feature 14: Multilanguage, Preis-Zusatz & Hinweis ---------------------- */

/* Preiszeilen: Label + Zusatz + Betrag; auf schmalen Panes umbrechen die
   Eingaben zeilenweise statt zu quetschen (Prototyp "Editor v2 Standorte"). */
.price-row { flex-wrap: wrap; }
.price-label { flex: 1 1 110px; min-width: 110px; }
.price-zusatz { flex: 1.4 1 150px; min-width: 150px; }

/* "optional"-Marker hinter Feld-Labels. */
.field-opt { font-weight: 400; color: var(--color-text-muted); }

/* Übersetzung — Englisch: eine Box pro Preiszeile mit deutscher Referenz
   (fett) und je einer EN-Eingabe für Label und Zusatz — beide immer, auch wenn
   die deutsche Zeile nur eines davon hat. */
.trans-variants { display: flex; flex-direction: column; gap: 8px; }
.trans-variant {
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
}
.trans-variant-ref {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}
.trans-variant-ref strong { color: var(--color-text); font-weight: 600; }
.trans-variant-fields { display: flex; flex-wrap: wrap; gap: 8px; }
.trans-variant-fields .input { flex: 1 1 150px; min-width: 150px; height: 38px; font-size: 13.5px; }
.trans-hint { line-height: 1.5; }

/* Einstellungen: Sprachen-Karte — Schalter im Kopf, Darstellungs-Radios als
   Karten darunter (nur sichtbar, wenn Englisch an ist). */
.lang-head { display: flex; align-items: flex-start; gap: 16px; }
.lang-head .settings-card-head { flex: 1; min-width: 0; margin-bottom: 0; }
.lang-switch { flex: none; margin-top: 2px; }
.langmodes {
  margin: 16px 0 0;
  padding: 0;
  border: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.langmodes-title {
  padding: 0;
  margin-bottom: 2px;
  font-size: 13px;
  font-weight: 600;
}
.langmode {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  cursor: pointer;
}
.langmode.is-active {
  border-color: color-mix(in oklab, var(--color-accent) 45%, #fff);
  background: var(--color-accent-soft);
}
.langmode input[type="radio"] { margin-top: 2px; accent-color: var(--color-accent); flex: none; }
.langmode-body { min-width: 0; }
.langmode-name { display: block; font-size: 13.5px; font-weight: 600; }
.langmode-desc { display: block; font-size: 12.5px; color: var(--color-text-muted); margin-top: 1px; line-height: 1.45; }

/* ============================================================
   Wartung + Selbst-Check (Feature 13)
   ============================================================ */

/* Loud persistent banner (06-security §5) — above the main content on every
   authed page while the self-check reports failures. */
.syscheck-banner {
  padding: 12px 32px;
  background: color-mix(in oklab, var(--color-danger) 10%, #fffdfa);
  border-bottom: 1px solid color-mix(in oklab, var(--color-danger) 35%, #fff);
  color: color-mix(in oklab, var(--color-danger) 80%, #000);
  font-size: 13.5px;
  line-height: 1.5;
}
.syscheck-banner a { color: inherit; font-weight: 600; }

.wartung-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 40px;
  margin: 0 0 20px;
}
.wartung-fact dt {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}
.wartung-fact dd { margin: 2px 0 0; font-size: 14.5px; font-weight: 500; }
.wartung-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.check-list { list-style: none; margin: 0; padding: 0; }
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 24px;
  border-top: 1px solid var(--color-border);
}
.check-row:first-child { border-top: none; }
.check-badge {
  flex: none;
  margin-top: 1px;
  min-width: 62px;
  text-align: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.check-badge--ok   { background: color-mix(in oklab, var(--color-success) 12%, #fffdfa); color: var(--color-success); }
.check-badge--warn { background: #f3ead3; color: #8a6d1f; }
.check-badge--fail { background: color-mix(in oklab, var(--color-danger) 12%, #fffdfa); color: var(--color-danger); }
.check-main { min-width: 0; }
.check-label { display: block; font-size: 13.5px; font-weight: 600; }
.check-detail { display: block; font-size: 12.5px; color: var(--color-text-muted); margin-top: 1px; line-height: 1.5; overflow-wrap: anywhere; }
.check-row.is-fail .check-detail { color: color-mix(in oklab, var(--color-danger) 75%, #000); }

.audit-empty { padding: 16px 24px; }
.audit-scroll { max-height: 420px; overflow: auto; }
.audit-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.audit-table th {
  position: sticky;
  top: 0;
  background: var(--color-surface);
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
}
.audit-table td {
  padding: 7px 12px;
  border-bottom: 1px solid color-mix(in oklab, var(--color-border) 55%, #fffdfa);
  vertical-align: top;
}
.audit-table th:first-child, .audit-table td:first-child { padding-left: 24px; }
.audit-table th:last-child, .audit-table td:last-child { padding-right: 24px; }
.audit-time { white-space: nowrap; color: var(--color-text-muted); }
.audit-user { white-space: nowrap; font-weight: 500; }
.audit-action { white-space: nowrap; }
.audit-summary { color: var(--color-text-muted); overflow-wrap: anywhere; }

/* Re-Login-Dialog (Session abgelaufen — relogin.js) */
.relogin-form { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.relogin-error { margin: 0; font-size: 12.5px; color: var(--color-danger); }
