/* Mr Masala – Design-Grundlagen (gemeinsam für Kunde, Küche, Admin) */
:root {
  --brand: #E23D28; --brand-2: #FFB800; --brand-ink: #fff; --brand-soft: #FDECEA; --brand-dark: #B92B19; --accent: #FFB800; --accent-ink: #141414;
  --bg: #F4F4F2; --card: #FFFFFF; --card-2: #EFEFEC; --ink: #141414; --ink-2: #3D3D3A; --muted: #7A7A75;
  --line: #E4E4E0; --ok: #2B8A3E; --ok-soft: #E6F6EA; --warn: #E67700; --warn-soft: #FFF4E0; --bad: #D6336C; --bad-soft: #FFE8EF;
  --info: #1C7ED6; --info-soft: #E7F3FF; --veg: #2B8A3E; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.2); --r: 16px; --r-sm: 12px; --r-lg: 22px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111111; --card: #1C1C1C; --card-2: #282828; --ink: #F4F4F2; --ink-2: #CFCFCB; --muted: #9A9A95; --line: #303030;
    --brand-soft: #3A1A15; --ok-soft: #14301C; --warn-soft: #3A2A10; --bad-soft: #3A1524; --info-soft: #12283D;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 24px rgba(0,0,0,.35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111111; --card: #1C1C1C; --card-2: #282828; --ink: #F4F4F2; --ink-2: #CFCFCB; --muted: #9A9A95; --line: #303030;
  --brand-soft: #3A1A15; --ok-soft: #14301C; --warn-soft: #3A2A10; --bad-soft: #3A1524; --info-soft: #12283D;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 24px rgba(0,0,0,.35); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: 16px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow-x: hidden; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand-text, var(--brand)); }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -0.02em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 14px; border: 0; font-weight: 700; font-size: 16px; background: var(--card-2); color: var(--ink); transition: transform .12s, background .2s, opacity .2s; text-decoration: none; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-bad { background: var(--bad); color: #fff; }
.btn-ghost { background: transparent; border: 1.5px solid var(--line); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn-lg { min-height: 56px; font-size: 17px; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--card); box-shadow: var(--shadow); display: inline-grid; place-items: center; font-size: 20px; flex: none; }

/* Formulare */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.input, select.input, textarea.input { width: 100%; min-height: 50px; padding: 12px 14px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--card); font-size: 16px; transition: border-color .2s, box-shadow .2s; }
textarea.input { min-height: 84px; resize: vertical; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.input.invalid { border-color: var(--bad); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

/* Chips & Badges */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--line); font-weight: 600; font-size: 14px; white-space: nowrap; }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--brand-soft); color: var(--brand-dark); letter-spacing: .01em; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
@media (prefers-color-scheme: dark) { .badge { color: #FFB38A; } }

.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); }

/* Segment-Schalter (Lieferung / Abholung) */
.segment { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--card-2); padding: 4px; border-radius: 14px; gap: 4px; }
.segment button { border: 0; background: transparent; min-height: 44px; border-radius: 11px; font-weight: 700; color: var(--ink-2); display: flex; align-items: center; justify-content: center; gap: 6px; transition: background .2s, color .2s, box-shadow .2s; }
.segment button.active { background: var(--card); color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.12); }

/* Bottom-Sheet / Modal */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(20,12,5,.5); z-index: 80; opacity: 0; transition: opacity .25s; backdrop-filter: blur(2px); }
.sheet-backdrop.open { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; max-height: 94dvh; background: var(--bg); border-radius: var(--r-lg) var(--r-lg) 0 0; transform: translateY(105%); transition: transform .32s cubic-bezier(.2,.9,.25,1); display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-lg); }
.sheet.open { transform: none; }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; position: absolute; left: 50%; translate: -50% 0; top: 0; z-index: 3; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; flex: 1; -webkit-overflow-scrolling: touch; }
.sheet-foot { padding: 12px 16px calc(12px + var(--safe-b)); background: var(--card); border-top: 1px solid var(--line); }
@media (min-width: 720px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(560px, 92vw); max-height: 88vh; border-radius: var(--r-lg); transform: translate(-50%, -45%) scale(.96); opacity: 0; transition: transform .25s, opacity .25s; pointer-events: none; }
  .sheet.open { transform: translate(-50%, -50%); opacity: 1; pointer-events: auto; }
  .sheet-grip { display: none; }
}

/* Toast */
.toasts { position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); left: 50%; translate: -50% 0; z-index: 200; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 14px; font-weight: 600; box-shadow: var(--shadow-lg); animation: toast-in .3s; pointer-events: auto; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(.97); } }

/* Stepper */
.stepper { display: inline-flex; align-items: center; background: var(--card-2); border-radius: 999px; padding: 4px; gap: 2px; }
.stepper button { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--card); font-size: 20px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.stepper span { min-width: 32px; text-align: center; font-weight: 800; font-size: 17px; }

/* Schalter */
.switch { position: relative; display: inline-block; width: 52px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background .2s; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(22px); }

/* Platzhalter-Bild für Gerichte ohne Foto */
.ph { display: grid; place-items: center; background: radial-gradient(120% 120% at 20% 10%, #FFD8A8 0%, #FFA94D 45%, #E8590C 100%); font-size: 44px; }
.ph[data-hue="1"] { background: radial-gradient(120% 120% at 20% 10%, #FFE8CC 0%, #FFC078 50%, #F08C00 100%); }
.ph[data-hue="2"] { background: radial-gradient(120% 120% at 20% 10%, #D3F9D8 0%, #8CE99A 50%, #2F9E44 100%); }
.ph[data-hue="3"] { background: radial-gradient(120% 120% at 20% 10%, #FFDEEB 0%, #FAA2C1 50%, #C2255C 100%); }
.ph[data-hue="4"] { background: radial-gradient(120% 120% at 20% 10%, #FFF3BF 0%, #FFE066 50%, #F59F00 100%); }
.ph[data-hue="5"] { background: radial-gradient(120% 120% at 20% 10%, #E5DBFF 0%, #B197FC 50%, #7048E8 100%); }
.ph span { filter: drop-shadow(0 6px 10px rgba(0,0,0,.25)); }

.veg { display: inline-grid; place-items: center; width: 16px; height: 16px; border: 1.5px solid var(--veg); border-radius: 3px; flex: none; }
.veg::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--veg); }
.nonveg { border-color: #C92A2A; }
.nonveg::after { background: #C92A2A; border-radius: 0; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 7px solid #C92A2A; background: none; }

.spinner { width: 22px; height: 22px; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--card-2) 0%, var(--line) 50%, var(--card-2) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 12px; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

/* Sheet-Kopf & Innenabstand (alle Ansichten) */
.pad { padding: 0 16px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 16px 10px; gap: 10px; }
.sheet-head h2 { font-size: 24px; font-weight: 900; }
