/* dosen.dk – Werte aus dem Design System (Kontraste in beiden Themen geprüft).
   Hell ist der Standard; Dunkel folgt dem System (auto) oder wird per Schalter (data-theme) erzwungen. */
:root {
  --bg: #f4f6f8; --surface: #ffffff; --surface-sunken: #eceff3; --line: #d5dbe2; --line-strong: #7d8895;
  --text: #151a1f; --muted: #56616d; --accent: #1b5fb0; --on-accent: #ffffff; --accent-soft: #e4eefb;
  --ok: #17702f; --warn: #865400; --danger: #b3261e; --on-danger: #ffffff; --focus: #0b57d0;
  --shadow-bar: 0 -2px 12px rgba(16, 24, 40, 0.08);
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: Fixedsys, "Cascadia Mono", "Lucida Console", Consolas, "Courier New", monospace;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
  --radius-sm: 8px; --radius-md: 12px; --radius-pill: 999px;
  --touch-min: 44px; --control-h: 40px; --row-h: 68px; --thumb: 48px; --content-max: 760px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161a; --surface: #1b2026; --surface-sunken: #252c34; --line: #323a43; --line-strong: #76818e;
    --text: #e9edf1; --muted: #a2adb9; --accent: #79afff; --on-accent: #08121f; --accent-soft: #1b2c44;
    --ok: #58d17b; --warn: #e8b04a; --danger: #ff8f86; --on-danger: #240605; --focus: #9bc2ff;
    --shadow-bar: 0 -2px 12px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12161a; --surface: #1b2026; --surface-sunken: #252c34; --line: #323a43; --line-strong: #76818e;
  --text: #e9edf1; --muted: #a2adb9; --accent: #79afff; --on-accent: #08121f; --accent-soft: #1b2c44;
  --ok: #58d17b; --warn: #e8b04a; --danger: #ff8f86; --on-danger: #240605; --focus: #9bc2ff;
  --shadow-bar: 0 -2px 12px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/22px var(--font-sans); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Kopfleiste, Navigation, Sprache, Darstellung */
header { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 6px var(--space-4); background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
nav { display: flex; flex-wrap: wrap; gap: 0 var(--space-4); align-items: center; }
nav a, button.link { color: var(--accent); background: none; border: 0; padding: 10px 0; min-height: var(--touch-min); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.tools { margin-left: auto; display: flex; align-items: center; gap: var(--space-1); }
.langs { display: flex; }
.langs a { color: var(--muted); text-decoration: none; min-width: var(--touch-min); min-height: var(--touch-min); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }
.langs a[aria-current] { color: var(--text); text-decoration: underline; }
#theme { min-width: var(--touch-min); padding: 10px 8px; font-size: 1.1rem; justify-content: center; }
main { max-width: var(--content-max); margin: 0 auto; padding: var(--space-4); }

/* Typografie */
h1 { font-size: 22px; line-height: 28px; margin: 0 0 var(--space-3); }
h2 { font-size: 18px; line-height: 24px; margin: 20px 0 var(--space-2); }
.bar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); }
.muted { color: var(--muted); font-size: 13px; line-height: 18px; }
.error { color: var(--danger); font-weight: 600; }
.ok { color: var(--ok); font-weight: 600; }
.pre { white-space: pre-wrap; margin: 4px 0; }
.big { font-size: 1.3rem; }

/* Formulare */
.stack { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-4); }
label { display: flex; flex-direction: column; gap: var(--space-1); font-weight: 600; }
label.check { flex-direction: row; align-items: center; gap: var(--space-2); }
input, select, button, .btn, .btn-sec { font: inherit; min-height: var(--touch-min); border-radius: var(--radius-sm); }
input, select, textarea { padding: 8px 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); width: 100%; }
input::placeholder { color: var(--muted); }
textarea { font: inherit; border-radius: var(--radius-sm); }
input[type=checkbox] { width: 24px; min-height: 24px; accent-color: var(--accent); }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); margin: var(--space-3) 0; }
.filters input[type=search] { grid-column: 1 / -1; }
.inline { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.inline input { width: auto; flex: 1 1 140px; }

/* Buttons */
button, .btn { background: var(--accent); color: var(--on-accent); border: 0; padding: 8px var(--space-4); font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn-sec { border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); padding: 8px var(--space-4); font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
button.danger, button.danger-outline { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
button:disabled { opacity: .45; cursor: not-allowed; }

/* Karten, Listen, Zeilen */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-3); margin-bottom: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); }
.card > summary { margin: -6px 0; }
.card p { margin: 0; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.row { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 10px; align-items: center; padding: var(--space-2) 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); }
.row .main { grid-column: 2; }
.row .thumb + .main { grid-column: 2; }
.row:not(:has(.thumb)) .main { grid-column: 1 / 3; }
.row.off .main { opacity: .6; }
.main { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.main strong { font-size: 16px; overflow-wrap: anywhere; }
.row .price { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.thumb { width: 44px; height: 44px; object-fit: contain; border-radius: var(--radius-sm); background: #fff; border: 1px solid var(--line); flex: none; }
.preview { max-width: 180px; max-height: 180px; object-fit: contain; border-radius: var(--radius-sm); background: #fff; border: 1px solid var(--line); }
.chip { background: transparent; border: 1px solid currentColor; padding: 2px 14px; min-height: var(--touch-min); border-radius: var(--radius-pill); }
.chip.on { color: var(--ok); }
.chip.off { color: var(--warn); }
.badge { font-size: 12px; line-height: 16px; font-weight: 600; padding: 2px 10px; border-radius: var(--radius-pill); border: 1px solid currentColor; }
.badge.on { color: var(--ok); }
.badge.off, .badge.warn { color: var(--warn); }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { display: flex; justify-content: space-between; gap: var(--space-2); padding: 6px 0; border-bottom: 1px solid var(--line); }
.plain li.off { text-decoration: line-through; opacity: .6; }
.total { text-align: right; margin: var(--space-2) 0 0; }
details { margin: var(--space-3) 0; }
summary { cursor: pointer; padding: 10px 0; font-weight: 600; }
.crow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.crow .main { flex: 1 1 150px; }
input.sel { width: 24px; min-height: 24px; flex: none; }
fieldset.pick { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px var(--space-3); margin: 0; }
fieldset.pick legend { font-weight: 700; padding: 0 6px; }
fieldset.pick label.check { padding: 6px 0; font-weight: 400; }

/* Bestellformular: aufklappbare Warengruppen, schmale Artikelzeilen */
.orderform { display: flex; flex-direction: column; gap: var(--space-2); }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: 2px; }
.toolbar button { min-height: 36px; padding: 4px 14px; font-size: 14px; }
details.group { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
details.group > summary { display: flex; align-items: center; gap: 10px; padding: 14px; min-height: var(--touch-min); list-style: none; background: var(--surface); }
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary::after { content: ''; width: 8px; height: 8px; margin-left: auto; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; flex: none; }
details.group[open] > summary::after { transform: rotate(-135deg); }
.gname { font-weight: 700; font-size: 17px; }
.count { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: var(--radius-pill); padding: 2px 10px; }
.count:empty { display: none; }
details.group .list { gap: 0; }
.item { display: flex; align-items: center; gap: var(--space-3); padding: 10px 14px; min-height: var(--row-h); border-top: 1px solid var(--line); }
.item.has { background: var(--accent-soft); }
.item .thumb { width: var(--thumb); height: var(--thumb); padding: 2px; }
.item .main { flex: 1; gap: 2px; }
.item .main strong { font-size: 16px; font-weight: 600; }
.item .main .muted { font-size: 13px; }
.item.off { opacity: .6; }
/* Mengenwahl: eine zusammenhängende Pille [ − 1 + ] ohne Browser-Pfeile im Zahlenfeld */
.stepper { display: inline-flex; align-items: center; flex: none; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--surface); overflow: hidden; }
.item.has .stepper { border-color: var(--accent); }
.stepper button { width: var(--control-h); height: var(--control-h); min-height: var(--control-h); padding: 0; font-size: 1.3rem; line-height: 1; border-radius: 0; background: transparent; color: var(--accent); }
.stepper button:disabled { color: var(--muted); opacity: .45; }
.stepper input { width: 34px; height: var(--control-h); min-height: var(--control-h); padding: 0; border: 0; border-radius: 0; background: transparent; text-align: center; font-weight: 700; font-size: 16px; -moz-appearance: textfield; appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.item.has .stepper input { color: var(--accent); }
.sticky { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: 10px var(--space-4); background: var(--surface); border-top: 1px solid var(--line); box-shadow: var(--shadow-bar); z-index: 5; }
.sticky strong { font-variant-numeric: tabular-nums; }

/* Bestellübersicht: Spalten für Menge × Name, Gebinde und Preis stehen untereinander */
.plain.lines li { display: grid; grid-template-columns: minmax(0, 1fr) 9.5rem auto; gap: 2px 12px; align-items: baseline; }
.plain.lines .pack { white-space: nowrap; }
.plain.lines .price { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) {
  .plain.lines li { grid-template-columns: minmax(0, 1fr) auto; }
  .plain.lines .pack { grid-column: 1; grid-row: 2; }
}

/* Link zum Ändern: Festbreitenschrift (Fixedsys-ähnlich) mit Kopierbutton */
.copyrow { display: flex; gap: var(--space-2); align-items: stretch; }
.copyrow .btn-sec { flex: none; }
input.mono { font-family: Fixedsys, "Cascadia Mono", "Lucida Console", Consolas, "Courier New", monospace; font-size: 14px; letter-spacing: 0; }

/* Orga: Bestellungen einer Runde als aufklappbare Karten (mobil lesbar, nichts läuft aus dem Container) */
.orders { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.order { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; min-width: 0; }
.order details { margin: 0; }
.order summary { display: grid; grid-template-columns: minmax(0, 1fr) auto 12px; gap: 4px var(--space-3); align-items: center; padding: 10px var(--space-3); list-style: none; cursor: pointer; }
.order summary::-webkit-details-marker { display: none; }
.order summary::after { content: ''; grid-column: 3; grid-row: 1; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.order details[open] > summary::after { transform: rotate(-135deg); }
.order .oname { min-width: 0; overflow-wrap: anywhere; }
.order .ototal { font-weight: 700; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.order .obadges { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.order .obody { padding: 4px var(--space-3) var(--space-3); border-top: 1px solid var(--line); }
.order .actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); margin-top: 10px; }
.order .actions form { display: block; margin: 0; }
.order .actions .chip, .order .actions .btn-sec { width: 100%; min-height: var(--touch-min); padding: 6px var(--space-2); text-align: center; }

/* Seiten mit fester Fußleiste (Summe/Speichern): Platz lassen, damit nichts dahinter verschwindet */
body:has(.sticky) main { padding-bottom: 104px; }

/* Startseite: ruhiges Wiedererkennungszeichen aus Pillenformen (ohne Text, nur Dekoration) */
body:has(.motif) main { padding-top: 56px; }
.motif { display: flex; gap: var(--space-2); margin-top: var(--space-6); }
.motif span { width: 64px; height: 32px; border-radius: var(--radius-pill); background: var(--accent); }
.motif span:nth-child(2) { background: var(--accent-soft); }
.motif span:nth-child(3) { background: transparent; border: 2px solid var(--line-strong); }

/* Bildvergrößerung (Dialog): Escape, Schließen-Knopf und Klick daneben schließen; Fokus kehrt zum Vorschaubild zurück */
a.zoomlink { display: inline-flex; flex: none; border-radius: var(--radius-sm); }
dialog.zoom { position: fixed; border: 0; padding: var(--space-4); border-radius: var(--radius-md); background: var(--surface); color: var(--text); width: min(92vw, 480px); max-height: 92vh; overflow: auto; }
dialog.zoom::backdrop { background: rgba(0, 0, 0, .65); }
dialog.zoom img { display: block; max-width: 100%; max-height: 68vh; margin: var(--space-6) auto 0; object-fit: contain; background: #fff; border-radius: var(--radius-sm); }
.zoom-cap { text-align: center; margin: var(--space-3) 0 0; font-weight: 600; overflow-wrap: anywhere; }
dialog.zoom form { margin: 0; }
.zoom-close { position: absolute; top: var(--space-2); right: var(--space-2); width: var(--touch-min); height: var(--touch-min); padding: 0; display: grid; place-items: center; background: transparent; color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--radius-pill); }
/* Das Kreuz besteht aus zwei Strichen, damit es exakt mittig sitzt (ein Textzeichen sitzt je nach Schrift zu hoch oder tief) */
.zoom-close::before, .zoom-close::after { content: ''; grid-area: 1 / 1; width: 18px; height: 2px; background: currentColor; border-radius: 1px; }
.zoom-close::before { transform: rotate(45deg); }
.zoom-close::after { transform: rotate(-45deg); }

/* Orga-Katalog am Desktop: eine Tabelle in festen Spalten (Checkbox | Bild | Name | Preis | Status | Bearbeiten), mobil bleibt die Karten-Liste */
.row.has { background: var(--accent-soft); }
.thumb-ph { display: block; width: var(--thumb); height: var(--thumb); flex: none; }
@media (min-width: 721px) {
  ul.catalog { gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
  ul.catalog .row { display: grid; grid-template-columns: 24px var(--thumb) minmax(0, 1fr) 96px 150px auto; gap: var(--space-4); align-items: center; padding: 10px var(--space-4); min-height: var(--row-h); background: transparent; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
  ul.catalog .row:first-child { border-top: 0; }
  ul.catalog .row.has { background: var(--accent-soft); }
  ul.catalog .row .main { grid-column: auto; }
  ul.catalog .row .price { text-align: right; }
  ul.catalog .row form { margin: 0; }
  ul.catalog .row .chip { justify-self: start; }
  ul.catalog .row .btn-sec { justify-self: end; }
}
@media (min-width: 721px) {
  .filters { grid-template-columns: 2fr 1fr 1fr auto; align-items: center; }
  .filters input[type=search] { grid-column: auto; }
  #bulk { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: var(--space-3); align-items: end; margin-bottom: 0; }
  #bulk > p { grid-column: 1 / -1; }
}

/* Datums- und Zeitwähler: Symbol und Feld folgen dem Thema (color-scheme), Zeiger und Fokus wie bei den anderen Feldern */
input[type=date], input[type=datetime-local], input[type=time] { min-height: var(--touch-min); font-variant-numeric: tabular-nums; }
input[type=date]::-webkit-calendar-picker-indicator, input[type=datetime-local]::-webkit-calendar-picker-indicator { cursor: pointer; border-radius: 4px; padding: 4px; opacity: .85; }
input[type=date]::-webkit-calendar-picker-indicator:hover, input[type=datetime-local]::-webkit-calendar-picker-indicator:hover { opacity: 1; background: var(--surface-sunken); }

/* Orga: Rundenliste als antippbare Zeilen (Titel, Frist, Status), Link ohne Browser-Standardfarbe */
.badge.muted { color: var(--muted); }
.rowlink { display: flex; align-items: center; gap: var(--space-3); min-height: 60px; padding: var(--space-2) var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); color: var(--text); text-decoration: none; }
.rowlink:hover { background: var(--surface-sunken); }
.rowlink .main { flex: 1; gap: 2px; }
.rowlink .main strong { font-weight: 600; }
.rowlink::after { content: ''; width: 8px; height: 8px; flex: none; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); }

/* Orga: Warengruppen als schmale Zeilen mit einheitlichen Bedienelementen (alles 44 px hoch), seltene Aktionen eingeklappt */
ul.groups { list-style: none; margin: 0 0 var(--space-4); padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.grp { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2) var(--space-3); align-items: center; padding: var(--space-2) var(--space-3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); }
.grp.inactive { background: var(--surface-sunken); }
.grp-rename { display: flex; gap: var(--space-2); margin: 0; grid-column: 1 / -1; }
.grp-rename input { flex: 1; min-width: 0; width: auto; }
.grp-tools { display: flex; align-items: center; gap: var(--space-2); justify-self: end; }
.grp-tools form { margin: 0; }
.btn-sec.icon { width: var(--touch-min); padding: 0; font-size: 1.1rem; }
.grp-more { grid-column: 1 / -1; margin: 0; }
.grp-more summary { padding: 0; min-height: 36px; display: flex; align-items: center; color: var(--muted); font-size: 14px; }
.grp-actions { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3); padding: var(--space-2) 0; }
.grp-actions form { margin: 0; }
.grp-bulk { display: flex; flex-wrap: wrap; gap: var(--space-2); width: 100%; }
.grp-bulk input { flex: 1 1 200px; width: auto; }
.grp-new { margin-top: var(--space-2); }
@media (min-width: 640px) {
  .grp { grid-template-columns: minmax(0, 1fr) 84px auto; }
  .grp-rename { grid-column: auto; }
  .grp-count { text-align: right; }
}

/* Mobil: Name und Darstellungsknopf in einer Zeile, Orga-Navigation darunter über die volle Breite (spart eine Kopfzeile) */
@media (max-width: 640px) {
  header .brand { order: 1; }
  header .tools { order: 2; }
  header nav { order: 3; flex-basis: 100%; }
}
