/* Weismehl Cockpit
   Farben, Schriften und Formen laut Projektdokument Abschnitt 7.1 (verbindlich,
   von weismehlmedia.de uebernommen). Theme-Wechsel ueber body[data-firm].
   Aufbau: Seitenmenue ab 900px, darunter Untermenue am unteren Rand (iPhone). */

*, *::before, *::after { box-sizing: border-box; }

body[data-firm='media'] {
  --bg: #090924;
  --flaeche: #101031;
  --flaeche-2: #16163c;
  --linie: #23234d;
  --akzent: #1990c8;
  --akzent-weich: rgba(25, 144, 200, 0.16);
  --text: #ffffff;
  --text-weich: #a9aecd;
  --schatten: 0 2px 20px rgba(0, 0, 0, 0.35);
}

body[data-firm='edeka'] {
  --bg: #f4f6f9;
  --flaeche: #ffffff;
  --flaeche-2: #ffffff;
  --linie: #dfe5ee;
  --akzent: #123f9b;
  --akzent-weich: rgba(18, 63, 155, 0.1);
  --gelb: #ffd500;
  --text: #122a52;
  --text-weich: #5b6b88;
  --schatten: 0 2px 14px rgba(18, 42, 82, 0.08);
}

:root {
  --gut: #2e9e5b;
  --warn: #d99000;
  --schlecht: #e5484d;
  --menue-breite: 236px;
  --unten: env(safe-area-inset-bottom, 0px);
}

/* Das HTML-Attribut hidden muss auch gegen komponenteneigene display-Regeln gewinnen. */
[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Montserrat, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

h1, h2, h3 { font-family: Lato, Montserrat, sans-serif; font-weight: 700; margin: 0; letter-spacing: -0.01em; }

/* ── Grundgerüst ──────────────────────────────────────────────────────── */
.app { min-height: 100vh; min-height: 100dvh; }

.seitenmenue { display: none; }

.inhalt { padding: 18px 16px calc(84px + var(--unten)); }

@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: var(--menue-breite) 1fr; }
  .seitenmenue {
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
    padding: 22px 14px;
    background: var(--flaeche);
    border-right: 1px solid var(--linie);
  }
  .inhalt { padding: 26px 30px 60px; }
  .untermenue { display: none; }
  .firmenwahl.kompakt { display: none; }
}

/* ── Menükopf ─────────────────────────────────────────────────────────── */
.menue-kopf { display: flex; align-items: center; gap: 11px; padding: 0 8px 20px; }
.menue-kopf img { height: 34px; width: auto; display: block; }
.menue-titel strong { display: block; font-family: Lato, sans-serif; font-size: 14px; }
.menue-titel small { display: block; color: var(--text-weich); font-size: 11px; word-break: break-all; }

body[data-firm='edeka'] .logo-media { display: none; }
body[data-firm='media'] .logo-edeka { display: none; }
.logo-edeka .kachel {
  width: 34px; height: 34px; display: grid; place-items: center;
  background: var(--akzent); color: var(--gelb); border-radius: 8px;
  font-family: Lato, sans-serif; font-weight: 700; font-size: 20px;
}

/* ── Menü ─────────────────────────────────────────────────────────────── */
.menue { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.menue a {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; border-radius: 11px;
  color: var(--text-weich); text-decoration: none;
  font-size: 14px; font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}
.menue a:hover { background: var(--flaeche-2); color: var(--text); }
.menue a[aria-current='page'] { background: var(--akzent); color: #fff; }
.menue .ikon { width: 18px; text-align: center; font-size: 15px; opacity: 0.9; }
.zaehler {
  margin-left: auto; min-width: 22px; padding: 1px 7px;
  background: var(--akzent-weich); color: var(--akzent);
  border-radius: 999px; font-size: 11.5px; font-weight: 700; text-align: center;
}
.menue a[aria-current='page'] .zaehler { background: rgba(255,255,255,0.25); color: #fff; }

/* ── Menüfuß ──────────────────────────────────────────────────────────── */
.menue-fuss { padding-top: 14px; border-top: 1px solid var(--linie); }
.stand-zeile { display: flex; align-items: center; gap: 8px; margin: 12px 4px 0; color: var(--text-weich); font-size: 11.5px; }
.punkt { width: 7px; height: 7px; border-radius: 50%; background: var(--gut); flex: none; }
.punkt.laedt { background: var(--warn); animation: pulsieren 1s ease-in-out infinite; }
.punkt.fehler { background: var(--schlecht); }
@keyframes pulsieren { 50% { opacity: 0.3; } }

/* ── Firmenwahl ───────────────────────────────────────────────────────── */
.firmenwahl { display: flex; gap: 4px; padding: 4px; background: var(--flaeche-2); border: 1px solid var(--linie); border-radius: 999px; }
.firmenwahl button {
  flex: 1; appearance: none; border: 0; cursor: pointer;
  padding: 8px 14px; border-radius: 999px; background: transparent;
  color: var(--text-weich); font: inherit; font-weight: 600; font-size: 12.5px;
  transition: background 0.18s ease, color 0.18s ease;
}
.firmenwahl button[aria-pressed='true'] { background: var(--akzent); color: #fff; }
.firmenwahl button:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }

/* ── Kopfleiste ───────────────────────────────────────────────────────── */
.kopfleiste { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.kopfleiste h1 { font-size: clamp(21px, 4vw, 28px); }
.kopfleiste p { margin: 3px 0 0; color: var(--text-weich); font-size: 13px; }
.kopf-aktionen { display: flex; align-items: center; gap: 8px; }

/* ── Knöpfe ───────────────────────────────────────────────────────────── */
.knopf {
  appearance: none; cursor: pointer; font: inherit; font-weight: 600; font-size: 13px;
  padding: 10px 17px; border-radius: 999px; border: 1px solid var(--linie);
  background: var(--flaeche); color: var(--text);
  min-height: 40px; transition: filter 0.15s ease, background 0.15s ease;
}
.knopf:hover { filter: brightness(1.12); }
.knopf:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
.knopf.haupt { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.knopf.leise { background: transparent; }
.knopf.gefahr { color: var(--schlecht); border-color: var(--schlecht); }
.knopf:disabled { opacity: 0.5; cursor: not-allowed; }
.knopf.klein { padding: 7px 13px; font-size: 12px; min-height: 34px; }

/* ── Karten & Raster ──────────────────────────────────────────────────── */
.raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; }
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 15px; padding: 17px 18px; box-shadow: var(--schatten); }
.karte .wert { font-family: Lato, sans-serif; font-size: 31px; font-weight: 700; line-height: 1.05; }
.karte.betont .wert { color: var(--akzent); }
.karte .label { margin-top: 4px; font-size: 12.5px; font-weight: 600; }
.karte .hinweis { margin-top: 2px; font-size: 11px; color: var(--text-weich); }

.tafel { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 15px; padding: 19px 20px; box-shadow: var(--schatten); margin-top: 16px; }
.tafel > h2 { font-size: 15.5px; }
.tafel > .unter { margin: 5px 0 14px; font-size: 12px; color: var(--text-weich); }

/* ── Listeneinträge ───────────────────────────────────────────────────── */
.zeile { padding: 13px 0; border-top: 1px solid var(--linie); }
.zeile:first-of-type { border-top: 0; padding-top: 2px; }
.zeile-kopf { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; }
.zeile .titel { font-weight: 600; font-size: 13.5px; }
.zeile .meta { color: var(--text-weich); font-size: 11.5px; white-space: nowrap; }
.zeile .von { color: var(--text-weich); font-size: 12px; margin-top: 2px; }
.zeile .text { color: var(--text-weich); font-size: 12px; margin-top: 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.zeile-aktionen { display: flex; gap: 8px; margin-top: 11px; flex-wrap: wrap; }

.marke { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 700; vertical-align: middle; margin-left: 6px; }
.marke.bereit { background: rgba(46,158,91,0.15); color: var(--gut); }
.marke.unklar { background: rgba(217,144,0,0.15); color: var(--warn); }
.marke.dublette { background: var(--akzent-weich); color: var(--akzent); }
.marke.neu { background: var(--akzent-weich); color: var(--akzent); }

.leer { color: var(--text-weich); font-size: 13px; padding: 16px 0; text-align: center; }
.leer strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

.hinweisbox { border-left: 3px solid var(--warn); background: var(--flaeche-2); border-radius: 10px; padding: 12px 15px; margin: 12px 0; font-size: 12.5px; color: var(--text-weich); }
.hinweisbox.fehler { border-left-color: var(--schlecht); }

.lade { display: grid; place-items: center; padding: 50px 0; color: var(--text-weich); font-size: 13px; }

/* ── Untermenü (iPhone) ───────────────────────────────────────────────── */
.untermenue {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: space-around;
  padding: 7px 4px calc(7px + var(--unten));
  background: color-mix(in srgb, var(--flaeche) 92%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--linie);
}
.untermenue a {
  position: relative;
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 2px; min-height: 48px;
  color: var(--text-weich); text-decoration: none;
  font-size: 10px; font-weight: 600;
}
.untermenue a span { font-size: 17px; line-height: 1; }
.untermenue a[aria-current='page'] { color: var(--akzent); }
.punkt-zaehler { position: absolute; top: 3px; right: 22%; width: 8px; height: 8px; border-radius: 50%; background: var(--schlecht); }

/* ── Dialog & Toast ───────────────────────────────────────────────────── */
.ueberlagerung {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center; padding: 20px;
  background: rgba(0,0,0,0.55);
}
.dialog { width: min(460px, 100%); background: var(--flaeche); border: 1px solid var(--linie); border-radius: 17px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,0.4); }
.dialog h2 { font-size: 17px; margin-bottom: 10px; }
.dialog-knoepfe { display: flex; gap: 9px; justify-content: flex-end; margin-top: 20px; }
.dialog dl { margin: 0; font-size: 13px; }
.dialog dt { color: var(--text-weich); font-size: 11.5px; margin-top: 9px; }
.dialog dd { margin: 1px 0 0; word-break: break-word; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(78px + var(--unten)); z-index: 70;
  padding: 12px 20px; border-radius: 999px;
  background: var(--flaeche); border: 1px solid var(--linie);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  font-size: 13px; font-weight: 600; max-width: 90vw; text-align: center;
}
.toast.gut { border-color: var(--gut); color: var(--gut); }
.toast.fehler { border-color: var(--schlecht); color: var(--schlecht); }
@media (min-width: 900px) { .toast { bottom: 26px; } }

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