/* Mittag – Gestaltung
   Idee: Pausenraum. Grüne Kantinenfliesen als ruhiger Grund, ein eigelbes Band als Aushang
   mit dem Stand des Tages. Nur das Band ist laut, alles andere ruhig. */

@font-face {
  font-family: "Bricolage";
  src: url("/fonts/bricolage.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bricolage";
  src: url("/fonts/bricolage-ext.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0;
}

:root {
  --tile: #e4ece7;
  --tile-line: #d5e0d9;
  --paper: #ffffff;
  --ink: #1d2b26;
  --ink-soft: #4d5e57;
  --line: #c6d4cc;
  --yolk: #f2b705;
  --yolk-deep: #d99e00;
  --tomato: #b8341c;
  --leaf: #2c7149;
  --focus: #1a5fd0;

  --r-band: 22px;
  --r-panel: 14px;
  --r-ctl: 9px;

  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 36px;

  --t-small: 0.875rem;
  --t-body: 1rem;
  --t-h3: 1.0625rem;
  --t-h2: 1.3125rem;
  --t-h1: 1.75rem;
  --t-display: clamp(1.75rem, 4.5vw, 2.6rem);
  --t-huge: clamp(2.6rem, 9vw, 5.2rem);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --tile: #17201c;
    --tile-line: #1d2823;
    --paper: #212c27;
    --ink: #e9f0ec;
    --ink-soft: #a9bab2;
    --line: #36463f;
    --tomato: #ff8c73;
    --leaf: #7fd3a1;
    --focus: #8fb6ff;
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  font-family: "Bricolage", system-ui, sans-serif;
  font-size: var(--t-body);
  line-height: 1.45;
  color: var(--ink);
  background-color: var(--tile);
  /* Fliesenfugen, sehr dezent */
  background-image: linear-gradient(var(--tile-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--tile-line) 1px, transparent 1px);
  background-size: 56px 56px;
  font-variant-numeric: tabular-nums;
  min-height: 100vh;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
  font-weight: 700;
}
h2 {
  font-size: var(--t-h2);
}
h3 {
  font-size: var(--t-h3);
  font-weight: 650;
}
p {
  margin: 0;
}
a {
  color: inherit;
  text-underline-offset: 3px;
}
small {
  font-size: var(--t-small);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--paper);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-ctl);
  z-index: 10;
}
.skip:focus {
  left: 8px;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.boot {
  padding: var(--s6);
  text-align: center;
  color: var(--ink-soft);
}

/* ---------- Kopfzeile ---------- */
.top {
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: var(--s3) max(var(--s4), env(safe-area-inset-left));
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-weight: 800;
  font-size: 1.25rem;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.nav {
  display: flex;
  gap: var(--s1);
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-link {
  padding: var(--s2) var(--s3);
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink-soft);
  white-space: nowrap;
  font-weight: 550;
}
.nav-link:hover {
  color: var(--ink);
  background: var(--tile);
}
.nav-link.active {
  color: var(--ink);
  background: var(--yolk);
}
.who {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-left: auto;
}
.who-name {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-align: right;
  font-weight: 600;
}
.who-name small {
  color: var(--ink-soft);
  font-weight: 450;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--s5) var(--s4) 120px;
  outline: none;
}

/* ---------- Bedienelemente ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 44px;
  padding: 0 var(--s5);
  border: 2px solid var(--ink);
  border-radius: var(--r-ctl);
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover {
  filter: brightness(1.15);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
}
.btn.ghost {
  background: transparent;
  color: var(--ink);
}
.btn.ghost:hover {
  background: var(--tile);
  filter: none;
}
.btn.danger {
  background: transparent;
  color: var(--tomato);
  border-color: var(--tomato);
}
.btn.small {
  min-height: 36px;
  padding: 0 var(--s3);
  font-size: var(--t-small);
}
.btn.icon {
  width: 44px;
  padding: 0;
  font-size: 1.5rem;
  line-height: 1;
}

input,
select,
textarea {
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--r-ctl);
  padding: 0 var(--s3);
  min-height: 44px;
  width: 100%;
}
textarea {
  padding: var(--s3);
  min-height: 120px;
  resize: vertical;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--ink);
}
input[type="checkbox"] {
  width: 22px;
  height: 22px;
  min-height: 0;
  accent-color: var(--ink);
}
input.money {
  text-align: right;
  max-width: 8.5em;
}
input.money.small {
  max-width: 6.5em;
  min-height: 36px;
}
label {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  font-size: var(--t-small);
  font-weight: 600;
  color: var(--ink-soft);
}
label.check {
  flex-direction: row;
  align-items: center;
  gap: var(--s2);
  color: var(--ink);
  font-weight: 500;
}

.muted {
  color: var(--ink-soft);
}
.fine {
  font-size: var(--t-small);
  color: var(--ink-soft);
}
.form-error {
  color: var(--tomato);
  font-weight: 600;
}
.warn {
  color: var(--tomato);
}
.block {
  display: block;
  color: var(--ink-soft);
}

/* ---------- Flächen ---------- */
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  padding: var(--s5);
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
}
.count {
  color: var(--ink-soft);
  font-size: var(--t-small);
}
.page-title {
  font-size: var(--t-h1);
}
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

/* ---------- Das Band: der Aushang des Tages ---------- */
.band {
  background: var(--yolk);
  color: #1d2b26;
  border-radius: var(--r-band);
  padding: var(--s6) var(--s5);
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  position: relative;
  overflow: hidden;
}
.band a {
  color: #1d2b26;
}
.band .display {
  font-size: var(--t-display);
  font-weight: 750;
  letter-spacing: -0.02em;
  max-width: 22ch;
}
.band .display.huge {
  font-size: var(--t-huge);
  font-stretch: 82%;
  font-weight: 800;
  line-height: 0.95;
  max-width: none;
  overflow-wrap: anywhere;
}
.band-kicker {
  font-weight: 650;
  font-size: var(--t-h3);
}
.band-meta {
  font-size: 1.125rem;
  font-weight: 550;
}
.band-contact {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s4);
  font-weight: 600;
}
.band-note {
  background: rgba(255, 255, 255, 0.55);
  border-radius: var(--r-ctl);
  padding: var(--s2) var(--s3);
  align-self: flex-start;
  font-weight: 550;
}
.band-late {
  background: #f6d36b;
}
.band-bestellt {
  background: var(--yolk);
}
.band-geliefert {
  background: #9fd6b2;
}
.band-choose {
  background: var(--paper);
  color: var(--ink);
  border: 3px dashed var(--yolk-deep);
}
.band-choose a {
  color: var(--ink);
}
.eta-label {
  display: block;
  font-size: var(--t-display);
  font-stretch: 100%;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-bottom: var(--s2);
}
.eta {
  display: block;
  font-size: clamp(4.5rem, 18vw, 9rem);
  letter-spacing: -0.03em;
}

.choose {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--s3);
  margin-top: var(--s2);
}
.choose-card {
  font: inherit;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  padding: var(--s4);
  border-radius: var(--r-panel);
  border: 2px solid var(--ink);
  background: var(--yolk);
  color: #1d2b26;
  cursor: pointer;
  min-height: 84px;
}
.choose-card strong {
  font-size: 1.25rem;
  font-weight: 750;
}
.choose-card:hover {
  background: var(--yolk-deep);
}

/* ---------- Tagesansicht ---------- */
.day {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}
.date-nav {
  display: flex;
  align-items: center;
  gap: var(--s3);
}
.date-title {
  font-size: var(--t-h1);
  display: flex;
  align-items: baseline;
  gap: var(--s3);
  flex-wrap: wrap;
}
.date-title span {
  font-size: var(--t-body);
  font-weight: 500;
  color: var(--ink-soft);
}
.day-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: var(--s4);
  align-items: start;
}
.col-main,
.col-side {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}
.col-main:empty {
  display: none;
}

/* Speisekarte zum Bestellen */
.filter {
  min-height: 40px;
}
.menu-group h3 {
  padding: var(--s3) 0 var(--s1);
  color: var(--ink-soft);
}
.menu-group ul,
.lines,
.people,
.menu-index-list,
.audit {
  list-style: none;
  margin: 0;
  padding: 0;
}
.item {
  border-top: 1px solid var(--line);
  padding: var(--s3) 0;
}
.item.picked {
  background: linear-gradient(90deg, rgba(242, 183, 5, 0.22), transparent 85%);
  margin: 0 calc(-1 * var(--s5));
  padding-left: var(--s5);
  padding-right: var(--s5);
}
.item-main {
  display: grid;
  grid-template-columns: 2.6em minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--s3);
}
.item-no {
  color: var(--ink-soft);
  font-weight: 600;
}
.item-text {
  display: flex;
  flex-direction: column;
}
.item-name {
  font-weight: 600;
}
.item-desc {
  font-size: var(--t-small);
  color: var(--ink-soft);
}
.item-price {
  font-weight: 600;
  white-space: nowrap;
}
.stepper {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
}
.step {
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 999px;
}
.step.plus {
  background: var(--ink);
  color: var(--paper);
}
.step:disabled {
  color: var(--line);
  cursor: default;
}
.qty {
  min-width: 1.8em;
  text-align: center;
  font-weight: 700;
}
.note {
  margin: var(--s2) 0 0 calc(2.6em + var(--s3));
  width: calc(100% - 2.6em - var(--s3));
  min-height: 38px;
  font-size: var(--t-small);
}

.order-bar {
  position: sticky;
  bottom: max(var(--s3), env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: var(--s3);
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-panel);
  padding: var(--s3) var(--s3) var(--s3) var(--s4);
  margin: 0 calc(-1 * var(--s2));
}
.order-bar > span {
  flex: 1;
}
.order-bar .sum {
  font-size: 1.35rem;
  margin-left: var(--s1);
}
.order-bar .btn {
  background: var(--yolk);
  color: #1d2b26;
  border-color: var(--yolk);
}
.order-bar .btn.ghost {
  background: transparent;
  color: var(--paper);
  border-color: rgba(255, 255, 255, 0.5);
}
@media (prefers-color-scheme: dark) {
  .order-bar {
    background: #0d1411;
    border: 1px solid var(--line);
  }
}

/* Positionen einer Bestellung */
.lines li {
  display: grid;
  grid-template-columns: 2.4em minmax(0, 1fr) auto;
  gap: var(--s2);
  padding: 3px 0;
}
.l-qty {
  color: var(--ink-soft);
}
.l-name em {
  display: block;
  font-size: var(--t-small);
  color: var(--ink-soft);
}
.l-price {
  text-align: right;
}
.l-total {
  border-top: 1px solid var(--line);
  margin-top: var(--s1);
  padding-top: var(--s2) !important;
  font-weight: 700;
}

/* Geld */
.pay.is-paid {
  border-color: var(--leaf);
  border-width: 2px;
}
.pay-state strong {
  color: var(--leaf);
}
.pay-state strong.warn {
  color: var(--tomato);
}
.pay-row {
  display: flex;
  gap: var(--s2);
  align-items: center;
  flex-wrap: wrap;
}

/* Übersicht */
.person {
  border-top: 1px solid var(--line);
  padding: var(--s3) 0;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}
.person.me .person-head strong::after {
  content: " (du)";
  font-weight: 450;
  color: var(--ink-soft);
}
.person-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--s2) var(--s3);
}
.person-head strong {
  flex: 1;
}
.person-sum {
  font-weight: 650;
}
.chip {
  font-size: 0.8125rem;
  font-weight: 650;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1.5px solid currentColor;
}
.chip.paid {
  color: var(--leaf);
}
.chip.part,
.chip.open {
  color: var(--tomato);
}
.person-tools {
  display: flex;
  gap: var(--s2);
  align-items: center;
  flex-wrap: wrap;
}
.totals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s2);
  margin: 0;
  border-top: 2px solid var(--ink);
  padding-top: var(--s3);
}
.totals dt {
  font-size: var(--t-small);
  color: var(--ink-soft);
}
.totals dd {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}
.totals .warn dd {
  color: var(--tomato);
}

/* Bürocrew */
.office {
  border: 2px solid var(--ink);
}
.office-block {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  padding-top: var(--s3);
  border-top: 1px solid var(--line);
}
.summary {
  font: inherit;
  white-space: pre-wrap;
  background: var(--tile);
  border-radius: var(--r-ctl);
  padding: var(--s3);
  margin: 0;
  line-height: 1.5;
}
.field-row {
  display: flex;
  gap: var(--s2);
  align-items: flex-end;
  flex-wrap: wrap;
}
.field-row > label {
  min-width: 8em;
}
.field-row .grow {
  flex: 1;
  min-width: 12em;
}
.field-row > select {
  flex: 1;
  min-width: 10em;
}
.field-row input[type="time"] {
  width: auto;
}
.btn-row {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
}

/* ---------- Speisekarten bearbeiten ---------- */
.menus-page {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: var(--s4);
  align-items: start;
}
.menu-index-list a {
  display: flex;
  justify-content: space-between;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-ctl);
  text-decoration: none;
  font-weight: 600;
}
.menu-index-list a small {
  white-space: nowrap;
  color: var(--ink-soft);
  font-weight: 450;
}
.menu-index-list a:hover {
  background: var(--tile);
}
.menu-index-list a.active {
  background: var(--yolk);
  color: #1d2b26;
}
.menu-index-list a.active small {
  color: #1d2b26;
}
.menu-index-list .inactive a {
  opacity: 0.6;
}
.inline-form {
  display: flex;
  gap: var(--s2);
}
.menu-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s3);
  align-items: end;
}
.menu-form .full {
  grid-column: 1 / -1;
}
.menu-form .btn {
  justify-self: end;
}

.table-wrap {
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  text-align: left;
  font-size: var(--t-small);
  color: var(--ink-soft);
  font-weight: 600;
  padding: var(--s2);
  border-bottom: 2px solid var(--ink);
}
.table td {
  padding: var(--s2);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table .num {
  text-align: right;
}
.table tr.inactive td {
  opacity: 0.55;
}
.items input {
  min-height: 38px;
}
.items .c-no {
  width: 4.5em;
}
.items .c-name {
  min-width: 12em;
  font-weight: 600;
}
.items .c-desc {
  margin-top: var(--s1);
  font-size: var(--t-small);
}
.items .c-cat {
  min-width: 7em;
}
.items .c-price {
  width: 6em;
}
.items .c-act {
  text-align: center;
  vertical-align: middle;
}
.items .c-btns {
  white-space: nowrap;
}
.items .c-btns .btn + .btn {
  margin-left: var(--s1);
}
.import {
  border-top: 1px solid var(--line);
  padding-top: var(--s3);
}
.import summary {
  cursor: pointer;
  font-weight: 650;
}
.import[open] {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

/* Protokoll */
.audit li {
  display: grid;
  grid-template-columns: 7.5em minmax(0, 1fr);
  gap: var(--s3);
  padding: var(--s2) 0;
  border-top: 1px solid var(--line);
}
.audit time {
  color: var(--ink-soft);
}

/* ---------- Anmeldung ---------- */
.login {
  max-width: 880px;
  display: flex;
  flex-direction: column;
  gap: var(--s5);
}
.login-band .display {
  font-size: var(--t-huge);
  font-stretch: 82%;
  font-weight: 800;
  line-height: 0.95;
  max-width: 12ch;
}
.lead {
  font-size: 1.2rem;
  max-width: 36ch;
  font-weight: 500;
}
.login-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s4);
}
.login-options > div,
.login-form.dev {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  padding: var(--s5);
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  align-items: flex-start;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  width: 100%;
}
.login-form label {
  width: 100%;
}

/* ---------- Meldungen ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: var(--paper);
  padding: var(--s3) var(--s4);
  border-radius: var(--r-ctl);
  font-weight: 600;
  max-width: min(92vw, 520px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 20;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
#toast.err {
  background: var(--tomato);
  color: #fff;
}

/* ---------- Schmal ---------- */
@media (max-width: 900px) {
  .day-grid,
  .menus-page,
  .login-options {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  main {
    padding: var(--s4) var(--s3) 120px;
  }
  .top {
    gap: var(--s2);
  }
  .nav {
    order: 3;
    flex-basis: 100%;
  }
  .who-name {
    display: none;
  }
  .panel {
    padding: var(--s4);
  }
  .item.picked {
    margin: 0 calc(-1 * var(--s4));
    padding-left: var(--s4);
    padding-right: var(--s4);
  }
  .band {
    padding: var(--s5) var(--s4);
    border-radius: var(--r-panel);
  }
  .item-main {
    grid-template-columns: 2em minmax(0, 1fr) auto;
    grid-template-areas: "no text text" "no price step";
  }
  .item-no {
    grid-area: no;
    align-self: start;
  }
  .item-text {
    grid-area: text;
  }
  .item-price {
    grid-area: price;
  }
  .stepper {
    grid-area: step;
  }
  .note {
    margin-left: calc(2em + var(--s3));
    width: calc(100% - 2em - var(--s3));
  }
  .menu-form {
    grid-template-columns: 1fr;
  }
  .order-bar {
    flex-wrap: wrap;
  }
  .audit li {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

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