/* Haxko Food – bewusst ohne Framework. Mobil zuerst, Dunkelmodus automatisch. */

:root {
  --bg: #f5f4f0;
  --flaeche: #ffffff;
  --text: #1c1b19;
  --leise: #67645c;
  --rand: #dad7cf;
  --akzent: #2a63d4;
  --akzent-text: #ffffff;
  --akzent-hell: #e7eefc;
  --gut: #1d7f47;
  --gut-hell: #e3f4ea;
  --warn: #a35f00;
  --warn-hell: #fdf1df;
  --schlecht: #b3261e;
  --radius: 12px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413;
    --flaeche: #1e1e1c;
    --text: #ecebe6;
    --leise: #a3a097;
    --rand: #3a3934;
    --akzent: #78a2ff;
    --akzent-text: #0c1424;
    --akzent-hell: #1d2940;
    --gut: #5ccb8b;
    --gut-hell: #173325;
    --warn: #f0b04d;
    --warn-hell: #3a2c14;
    --schlecht: #ff7b72;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main { max-width: 860px; margin: 0 auto; padding: 0 16px 48px; }

a { color: var(--akzent); }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 1.15rem; line-height: 1.3; margin: 0 0 12px; }
h2.abschnitt { margin-top: 32px; }
p { margin: 0 0 12px; }

.kopf {
  max-width: 860px; margin: 0 auto; padding: 16px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.marke { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.fuss { max-width: 860px; margin: 0 auto; padding: 24px 16px 40px; color: var(--leise); font-size: .9rem; }
.fuss a { color: var(--leise); }

.leise { color: var(--leise); font-size: .92em; font-weight: normal; }
.notiz { background: var(--akzent-hell); padding: 8px 12px; border-radius: 8px; }
.warnung { color: var(--warn); }
.gut { color: var(--gut); }
.fehler { color: var(--schlecht); display: block; font-size: .92em; }

/* Karten */
.karte {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius);
  padding: 16px; margin: 0 0 16px; display: block;
}
a.karte { color: inherit; text-decoration: none; }
/* Die ganze Karte ist klickbar, Knöpfe darin bleiben eigenständig. */
.bestellkarte { position: relative; }
.bestellkarte:hover, .bestellkarte:focus-within { border-color: var(--akzent); }
.karten-link { color: inherit; text-decoration: none; }
.karten-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.bestellkarte .knopfreihe, .bestellkarte form { position: relative; z-index: 1; }
.bestellkarte .wie-letztes-mal {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  background: var(--gut-hell); border-radius: 10px; padding: 10px 12px; margin: 0 0 12px;
}
.bestellkarte .wie-letztes-mal p { margin: 0; }
.karte.wie-letztes-mal { border-color: var(--gut); background: var(--gut-hell); }
.bestellkarte-kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.bestellkarte-kopf h1, .bestellkarte-kopf h2 { margin-bottom: 4px; }
.bestellkarte-fakten { color: var(--leise); }
.leer { text-align: center; padding: 32px 16px; }
details.karte > summary { cursor: pointer; list-style: none; }
details.karte > summary::-webkit-details-marker { display: none; }
details.karte > summary h2 { display: inline; }
details.karte > summary::before { content: "▸ "; color: var(--leise); }
details.karte[open] > summary::before { content: "▾ "; }
details.karte[open] > summary { margin-bottom: 12px; }

/* Status */
.status {
  font-size: .85rem; font-weight: 600; padding: 2px 10px; border-radius: 99px; white-space: nowrap;
  background: var(--rand); color: var(--text);
}
.status-offen { background: var(--gut-hell); color: var(--gut); }
.status-geschlossen { background: var(--warn-hell); color: var(--warn); }
.status-erledigt { background: var(--akzent-hell); color: var(--akzent); }

.etikett {
  display: inline-block; font-size: .75rem; font-weight: 600; padding: 0 6px; border-radius: 6px;
  border: 1px solid var(--rand); color: var(--leise); vertical-align: middle;
}
.etikett.warnung { border-color: var(--warn); color: var(--warn); }

/* Knöpfe und Felder */
button, .knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 16px; border-radius: 10px;
  border: 1px solid var(--rand); background: var(--flaeche); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
button:hover, .knopf:hover { border-color: var(--akzent); }
button.haupt, .knopf.haupt { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
button.gefahr { color: var(--schlecht); border-color: var(--schlecht); background: transparent; }
.knopf.klein, button.klein { min-height: 36px; padding: 4px 12px; font-size: .9rem; }
.knopfreihe { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.knopfreihe form { margin: 0; }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--rand); border-radius: 8px; padding: 10px 12px; min-height: 44px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--akzent); outline-offset: 1px; }
input.schmal { width: 6.5em; }
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92rem; }
label { display: block; font-weight: 600; font-size: .92rem; }
label > input, label > select, label > textarea { margin-top: 4px; font-weight: normal; }

.formular label { margin-bottom: 16px; }
.schmal-formular { max-width: 420px; margin: 32px auto; }

.zeile { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin: 8px 0; }
.zeile .breit, .leiste .breit { flex: 1 1 200px; }

/* Bestellformular */
.nickname { margin-bottom: 16px; }
.suche { margin-bottom: 8px; }
.sprungleiste { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; }
.sprungleiste a {
  flex: none; padding: 4px 12px; border-radius: 99px; border: 1px solid var(--rand);
  text-decoration: none; color: var(--text); font-size: .9rem;
}
fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
legend { font-weight: 700; padding: 0; margin-bottom: 4px; }

label.haken { display: flex; align-items: center; gap: 8px; font-weight: normal; margin: -8px 0 16px; }
label.haken input { width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--akzent); }

.produkt {
  display: grid; grid-template-columns: 2.6em minmax(0, 1fr) auto; gap: 6px 8px; align-items: start;
  padding: 10px 8px; border-radius: 8px;
}
.produkt + .produkt { border-top: 1px solid var(--rand); }
.produkt.gewaehlt { background: var(--akzent-hell); border-top-color: transparent; }
.produkt-nr { color: var(--leise); font-variant-numeric: tabular-nums; }
.preis { font-variant-numeric: tabular-nums; white-space: nowrap; }
.produkt-wahl {
  grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center;
}
.produkt-wahl select { width: auto; min-width: 0; flex: 1 1 8em; max-width: 16em; min-height: 40px; padding: 6px 8px; }
.stepper { flex: none; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button { min-height: 40px; width: 40px; padding: 0; font-size: 1.25rem; line-height: 1; }
.stepper input { width: 3.2em; min-height: 40px; padding: 6px 2px; text-align: center; }
html:not(.js) .stepper button { display: none; }
.produkt-anmerkung { grid-column: 2 / -1; display: none; min-height: 40px; padding: 6px 10px; }
.produkt.gewaehlt .produkt-anmerkung { display: block; }
@media (min-width: 700px) {
  .produkt { grid-template-columns: 2.6em minmax(0, 1fr) auto auto; align-items: center; }
  .produkt-wahl { grid-column: auto; }
}
.freitext { display: grid; grid-template-columns: minmax(0, 1fr) 7em 5em; gap: 8px; padding: 4px 8px 0; }
.freitext .ganz { grid-column: 1 / -1; }

.leiste {
  position: sticky; bottom: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--flaeche); border-top: 1px solid var(--rand); margin: 0 -16px; padding: 10px 16px;
}
.auswahl { color: var(--leise); }
.auswahl.voll { color: var(--text); font-weight: 600; }

/* Eigene Positionen */
.position {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px;
  padding: 10px 0; border-bottom: 1px solid var(--rand);
}
.position .aendern { grid-column: 1 / -1; }
.aendern > summary { cursor: pointer; color: var(--akzent); font-size: .9rem; }
.aendern form { margin: 8px 0; }
.summe { margin: 12px 0 0; }

.liste { list-style: none; padding: 0; margin: 0; }
.liste li { padding: 6px 0; border-bottom: 1px solid var(--rand); }
.liste li:last-child { border-bottom: 0; }
.hinweis { color: var(--warn); }

/* Orga-Tabelle */
.tabelle-rahmen { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.tabelle { width: 100%; border-collapse: collapse; min-width: 560px; }
.tabelle th, .tabelle td { text-align: left; vertical-align: top; padding: 10px 8px; border-bottom: 1px solid var(--rand); }
.tabelle th { font-size: .85rem; color: var(--leise); }
.tabelle .zahl { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tabelle tfoot td { border-bottom: 0; padding-top: 6px; padding-bottom: 6px; }
.tabelle tfoot .gesamt td { font-weight: 700; border-top: 2px solid var(--text); }
.tabelle .nick { white-space: nowrap; }
.orga-position { margin-bottom: 6px; }
.anmerkung { color: var(--warn); }
.bezahlt form { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.bezahlt button { min-width: 7.5em; }
.bezahlt button.ja { background: var(--gut-hell); border-color: var(--gut); color: var(--gut); }
.bezahlt button.nein { border-style: dashed; }
.code { font-family: ui-monospace, monospace; font-size: 1.2rem; letter-spacing: .15em; }
.trenner span + span::before { content: " · "; }

/* Durchgabe */
.durchgabe-liste { font-size: 1.25rem; line-height: 1.7; padding-left: 1.6em; }
.durchgabe-liste .mit-anmerkung { font-weight: 700; }

/* Meine Bestellungen (Startseite) */
.meine-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.meine-zeile .preis { margin-left: auto; font-weight: 600; }
form.bezahlt { margin: 0; }

/* Meldungen */
.meldungen { list-style: none; padding: 0; margin: 0 0 16px; }
.meldung { padding: 10px 14px; border-radius: 10px; margin-bottom: 8px; border: 1px solid var(--rand); background: var(--flaeche); }
.meldung.success { border-color: var(--gut); background: var(--gut-hell); }
.meldung.error { border-color: var(--schlecht); color: var(--schlecht); }
.meldung.warning, .meldung.info { border-color: var(--warn); background: var(--warn-hell); }

.text ul { padding-left: 20px; }

@media (max-width: 520px) {
  h1 { font-size: 1.3rem; }
  .freitext { grid-template-columns: minmax(0, 1fr) 6em; padding: 4px 0 0; }
  .freitext .breit { grid-column: 1 / -1; }
  .produkt { grid-template-columns: 2.2em minmax(0, 1fr) auto; }
  /* Größe und Anzahl nutzen auf dem Handy die volle Breite, damit sie in eine Zeile passen. */
  .produkt-wahl, .produkt-anmerkung { grid-column: 1 / -1; }
}

@media print {
  .kopf, .fuss, .nicht-drucken, .meldungen { display: none; }
  body { background: #fff; color: #000; }
  .karte { border: 0; padding: 0; }
}
