/* Tassen-Teiler – MAX4Kids Corporate Design (CI-Manual 2025)
   Farben: MAX Rot/Blau/Grün + MAX4Kids-Pastelltöne. Fließtext schwarz.
   Schrift: Brandon Text (Fließtext) und DJB Coffee Shoppe Espresso (Titel), eingebettet als
   verkleinerte WOFF-Dateien (nur lateinische/deutsche Zeichen). */

@font-face { font-family: "Brandon"; src: url("fonts/brandon-regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Brandon"; src: url("fonts/brandon-bold.woff") format("woff"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Coffee"; src: url("fonts/coffee-shoppe.woff") format("woff"); font-weight: 400 700; font-display: swap; }

:root {
  --red: #d71d24;
  --blue: #0063a5;
  --green: #009c49;
  --grey: #9d9d9c;
  --orange: #f39768;
  --lblue: #93d5f6;
  --yellow: #ffd962;
  --pink: #ef7983;

  --ink: #000;
  --muted: #6b6b6a;
  --line: #e7e7e6;
  --field: #d4d4d3;
  --bg: #fff;
  --soft: #f6f6f5;
  --blue-t: #e6f0f7;    /* Blau 10 % */
  --green-t: #e6f5ed;   /* Grün 10 % */
  --orange-t: #fdeee6;  /* Orange 20 % */
  --r: 10px;
  --tap: 46px;
  --font: "Brandon", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --title: "Coffee", var(--font);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 17px/1.45 var(--font);
  color: var(--ink);
  background: var(--bg);
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}
button, input, select { font: inherit; color: inherit; }

/* ---------- Kopf ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: calc(14px + env(safe-area-inset-top)) 20px 0;
}
.top-row { max-width: 640px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
/* Schutzraum laut CI: Breite des „A“ in MAX (~ halbe Logohöhe) rundherum frei */
.logo { height: 36px; width: auto; display: block; }
.app-name { font-family: var(--title); font-weight: 400; color: var(--blue); font-size: 22px; line-height: 1; }

.steps { max-width: 640px; margin: 16px auto 0; display: flex; gap: 6px; }
.steps button {
  flex: 1; border: 0; background: none; padding: 0 0 8px; min-height: 36px;
  font-size: 12px; color: var(--grey); text-align: left; cursor: pointer; white-space: nowrap; min-width: 0;
  display: flex; flex-direction: column; gap: 5px;
}
.steps .bar { display: block; height: 4px; border-radius: 2px; background: var(--line); }
.steps button.done .bar { background: var(--green); }
.steps button.done { color: var(--muted); }
.steps button.on .bar { background: var(--blue); }
.steps button.on { color: var(--blue); font-weight: 700; }
.steps button[disabled] { cursor: default; }

/* ---------- Inhalt ---------- */
main { max-width: 640px; margin: 0 auto; padding: 16px; outline: none; }
h1 { font-family: var(--title); font-size: 32px; line-height: 1.1; margin: 2px 0 6px; color: var(--blue); font-weight: 400; }
h2 { font-size: 17px; margin: 0 0 2px; }
h3 { font-size: 15px; margin: 16px 0 6px; font-weight: 700; }
p.lead { margin: 0 0 16px; color: var(--muted); font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.card { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin: 0 0 12px; background: #fff; }
.card.plain { border: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row + .row { margin-top: 8px; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 8px; }
.sub { font-size: 14px; color: var(--muted); margin: 0 0 10px; }

/* ---------- Knöpfe ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 0 16px; border-radius: var(--r);
  border: 1px solid var(--field); background: #fff; color: var(--blue);
  font-weight: 700; font-size: 16px; cursor: pointer; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { background: var(--soft); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:active { background: #00548c; }
.btn.big { width: 100%; min-height: 54px; font-size: 17px; }
.btn.block { width: 100%; }
.btn.link { border: 0; background: none; padding: 0 4px; min-height: 40px; font-weight: 600; }
.btn.small { min-height: 38px; font-size: 14px; padding: 0 12px; }
.btn.x {
  border: 0; background: none; color: var(--grey); width: 36px; min-height: 36px; padding: 0; font-size: 18px; font-weight: 400;
}
.btn.x:active { color: var(--red); }
.btn.danger { color: var(--red); }
.btn[disabled] { opacity: .35; }

/* ---------- Eingaben ---------- */
input[type=text], input[type=number], select {
  min-height: 44px; border: 1px solid var(--field); border-radius: 8px;
  padding: 6px 10px; background: #fff; width: 100%;
}
input:focus, select:focus { border-color: var(--blue); outline: 2px solid var(--blue-t); }
input.num { width: 72px; text-align: center; }
input.num-s { width: 58px; text-align: center; padding: 6px 4px; }
label.lbl { display: block; font-size: 13px; color: var(--muted); margin-bottom: 2px; }
details summary { cursor: pointer; font-weight: 700; color: var(--blue); min-height: 28px; }

/* ---------- Gruppen ---------- */
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; display: inline-block; }
.gname { font-weight: 700; }

/* ---------- Sonderkost ---------- */
.grp + .grp { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.sk-list { margin: 2px 0 0 20px; }
.sk-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.sk-row input { min-height: 38px; font-size: 15px; }
.sk-diet { flex: 1; min-width: 0; }
input.sk-kz { width: 84px; flex: none; }
.sk-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sk-block + .sk-block { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.sk-g { min-width: 80px; font-weight: 600; font-size: 15px; }
.kid-chip {
  border: 1px solid var(--field); background: #fff; border-radius: 999px; padding: 4px 12px; margin: 2px 4px 2px 0;
  font-size: 14px; font-weight: 600; min-height: 34px; cursor: pointer;
}
.kid-chip.on { background: var(--green-t); border-color: var(--green); color: #00743a; }
.kid-chip.off { color: var(--grey); text-decoration: line-through; }
.chip.sk { background: var(--blue-t); color: var(--blue); }

/* ---------- Zähler ---------- */
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--field);
  background: #fff; font-size: 20px; line-height: 1; color: var(--blue); cursor: pointer;
}
.stepper button:active { background: var(--blue-t); }
.stepper input { width: 52px; text-align: center; font-size: 17px; font-weight: 700; min-height: 40px; padding: 4px; }

.sum { margin-top: 10px; font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.sum.ok { color: var(--green); }
.sum.warn { color: #b4501c; }

.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 13px;
  background: var(--soft); color: var(--muted); font-weight: 600; white-space: nowrap;
}
.badge.ok { background: var(--green-t); color: var(--green); }
.badge.warn { background: var(--orange-t); color: #b4501c; }

.note { border-left: 3px solid var(--orange); background: var(--orange-t); padding: 8px 12px; margin: 0 0 14px; font-size: 15px; border-radius: 0 8px 8px 0; }
.note.info { border-left-color: var(--blue); background: var(--blue-t); }

/* ---------- Lieferschein-Editor ---------- */
.ls-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.ls-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
input.menu-name { font-weight: 700; border-color: transparent; padding-left: 0; font-size: 17px; }
input.menu-name:focus { padding-left: 10px; border-color: var(--blue); }
.comp { border-top: 1px solid var(--line); padding: 10px 0 2px; }
input.comp-name { border-color: transparent; border-bottom-color: var(--line); border-radius: 0; padding-left: 0; font-weight: 600; min-height: 36px; }
input.comp-name:focus { padding-left: 10px; border-color: var(--blue); border-radius: 8px; }
.geb { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; font-size: 14px; color: var(--muted); }
.geb input, .geb select { color: var(--ink); min-height: 38px; font-size: 15px; }
.geb select { width: 92px; padding: 4px; }
.geb .num-s { width: 52px; }

/* ---------- Kinder ---------- */
.kid-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }

/* ---------- Ergebnis ---------- */
.seg { display: flex; background: var(--soft); border-radius: var(--r); padding: 3px; margin-bottom: 14px; }
.seg button {
  flex: 1; border: 0; background: transparent; min-height: 38px; border-radius: 8px; font-weight: 700; color: var(--muted); font-size: 15px; cursor: pointer;
}
.seg button.on { background: #fff; color: var(--blue); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

.gcard { border-left: 4px solid var(--blue); }
.gcard .head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.gcard .head .gname { font-size: 18px; }
.mblock { margin-top: 8px; }
.mname { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.line { padding: 6px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line .what { font-size: 15px; }
.line .parts { margin-top: 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; margin: 3px 4px 0 0; padding: 2px 8px; border-radius: 6px;
  font-size: 14px; font-weight: 600; background: var(--soft);
}
.chip.whole { background: var(--green-t); color: #00743a; }
.chip.part { background: var(--orange-t); color: #8a3a12; }
.chip .x { font-weight: 400; opacity: .8; }
.tno {
  display: inline-block; min-width: 20px; height: 20px; line-height: 20px; border-radius: 10px;
  background: var(--blue); color: #fff; text-align: center; font-size: 12px; font-weight: 700; padding: 0 5px;
}
.warn-line { font-size: 13px; color: #b4501c; margin-top: 2px; }

.tassen { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 6px; margin-top: 6px; }
.tasse { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 13px; }
.tasse.split { border-color: var(--orange); background: #fffaf7; grid-column: 1 / -1; font-size: 14px; }
.tasse .bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--line); margin: 5px 0; }
.tasse .bar span { display: block; height: 100%; }
.tasse .who { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.tasse .who .n { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.weigh { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 2px; font-size: 14px; color: var(--muted); }
.weigh input { width: 96px; min-height: 36px; font-size: 15px; color: var(--ink); }

/* ---------- Untere Leiste ---------- */
.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: rgba(255,255,255,.96); border-top: 1px solid var(--line);
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
}
.bottom .inner { max-width: 640px; margin: 0 auto; display: flex; gap: 8px; }
.bottom .btn { flex: 1; }
.bottom .btn.back { flex: 0 0 auto; }

/* ---------- Ladeanzeige ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 50; display: flex; align-items: center; justify-content: center; }
.overlay[hidden] { display: none; }
.busy-box { background: #fff; border-radius: 14px; padding: 20px 24px; text-align: center; max-width: 280px; margin: 16px; }
.spinner { width: 36px; height: 36px; border: 4px solid var(--blue-t); border-top-color: var(--blue); border-radius: 50%; margin: 0 auto 10px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

@media (max-width: 360px) {
  main { padding: 12px; }
  .stepper button { width: 36px; height: 36px; }
  .stepper input { width: 46px; }
  .logo { height: 32px; }
}

@media print {
  .top, .bottom, .seg, .noprint { display: none !important; }
  body { padding: 0; font-size: 12px; }
  .card { break-inside: avoid; }
}
