:root {
  --red: #b3261e;
  --red-dark: #8c1d17;
  --green: #1e7d45;
  --amber: #b26a00;
  --bg: #f6f4f1;
  --card: #ffffff;
  --text: #1f1d1b;
  --muted: #6b6560;
  --border: #e3ded8;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
h1, h2, h3 { margin: 0 0 .6em; line-height: 1.2; }
a { color: var(--red); }

.topbar {
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  padding: .75rem 1.25rem; background: var(--red); color: #fff;
}
.topbar .brand { font-weight: 700; font-size: 1.2rem; color: #fff; text-decoration: none; }
.topbar nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.topbar nav a { color: #fff; text-decoration: none; padding: .35rem .7rem; border-radius: 8px; opacity: .85; }
.topbar nav a.active, .topbar nav a:hover { background: rgba(255,255,255,.18); opacity: 1; }

main { padding: 1.25rem; max-width: 1200px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
.muted { color: var(--muted); }
.grid { display: grid; gap: 1rem; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: end; }
.row > label { flex: 1 1 180px; }

label { display: block; font-weight: 600; font-size: .9rem; }
input, select {
  display: block; width: 100%; margin-top: .3rem; padding: .6rem .7rem; font: inherit;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
input:focus, select:focus { outline: 2px solid var(--red); outline-offset: 1px; }

button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 8px;
  padding: .6rem 1rem; background: var(--red); color: #fff; text-decoration: none; display: inline-block;
}
button:hover { background: var(--red-dark); }
button.secondary { background: #ece7e1; color: var(--text); }
button.secondary:hover { background: #ddd6ce; }
button.danger { background: transparent; color: var(--red); border: 1px solid var(--red); }
button.danger:hover { background: #fbeaea; }
button.small { padding: .3rem .6rem; font-size: .85rem; }
button:disabled { opacity: .5; cursor: default; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
td.actions { white-space: nowrap; text-align: right; }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: #ece7e1; }
.badge.PLANNED { background: #ece7e1; }
.badge.IN_PROGRESS { background: #fff1d6; color: var(--amber); }
.badge.READY { background: #dcf2e4; color: var(--green); }
.badge.CANCELED { background: #f3e1e0; color: var(--red); }
.box-chip { display: inline-block; padding: .05rem .45rem; margin: 0 .2rem .2rem 0; border: 1px solid var(--border); border-radius: 6px; font-weight: 600; }

.msg { padding: .9rem 1rem; border-radius: 10px; margin: 1rem 0; font-weight: 600; }
.msg.ok { background: #dcf2e4; color: var(--green); }
.msg.warn { background: #fff1d6; color: #7a4a00; }
.msg.error { background: #f9dedc; color: var(--red-dark); }
.hidden { display: none !important; }
.api-problem { position: sticky; top: 0; z-index: 10; padding: .7rem 1.25rem; background: #f9dedc; color: var(--red-dark); font-weight: 600; }
.api-problem a { margin-left: .5rem; }

.tabs { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tabs button { background: #ece7e1; color: var(--text); }
.tabs button.active { background: var(--text); color: #fff; }

.zone-title { margin-top: 1.25rem; padding: .4rem .7rem; background: #ece7e1; border-radius: 8px; }

/* Landing */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.tile { display: block; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; text-decoration: none; color: var(--text); }
.tile:hover { border-color: var(--red); }
.tile strong { display: block; font-size: 1.2rem; color: var(--red); margin-bottom: .3rem; }

/* /laden */
.laden { display: grid; grid-template-columns: minmax(300px, 460px) 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 860px) { .laden { grid-template-columns: 1fr; } }
.big-input { font-size: 3rem; text-align: center; padding: .6rem; font-weight: 700; letter-spacing: .05em; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-top: 1rem; }
.keypad button { font-size: 2rem; padding: 1rem 0; background: #ece7e1; color: var(--text); }
.keypad button:hover { background: #ddd6ce; }
.keypad button.submit { grid-column: span 3; background: var(--red); color: #fff; font-size: 1.6rem; }
.decision { text-align: center; }
.decision .dismiss { display: block; width: 100%; font-size: 1.8rem; padding: 1.2rem; border-radius: 12px; }
.decision .force-link { margin-top: .9rem; background: none; color: var(--muted); font-size: .8rem; font-weight: 400; padding: .2rem; text-decoration: underline; }
.decision .force-link:hover { background: none; color: var(--text); }
.queue-list { list-style: none; padding: 0; margin: 0; }
.queue-list li { display: flex; align-items: center; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--border); }
.queue-list .num { font-size: 1.6rem; font-weight: 700; min-width: 4ch; }
.queue-list .info { flex: 1; }
.queue-list button { font-size: 1rem; padding: .6rem 1rem; }

/* /lager */
body.lager { background: #161412; color: #f6f4f1; }
body.lager main { max-width: none; }
.lager-wrap { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; min-height: calc(100vh - 100px); }
@media (max-width: 900px) { .lager-wrap { grid-template-columns: 1fr; } }
.current { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: #24211e; border-radius: 20px; padding: 2rem; }
.current .label { text-transform: uppercase; letter-spacing: .15em; color: #a59d95; font-size: 1.1rem; }
.current .order-number { font-size: clamp(6rem, 18vw, 14rem); font-weight: 800; line-height: 1; margin: .2rem 0 1.5rem; }
.current .boxes { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; margin-bottom: 1rem; }
.current .box { background: #f6f4f1; color: #161412; border-radius: 14px; padding: .6rem 1.4rem; min-width: 8rem; }
.current .box .n { font-size: clamp(3rem, 7vw, 5.5rem); font-weight: 800; line-height: 1.1; }
.current .box .z { font-size: 1rem; color: #6b6560; font-weight: 600; }
.current .multi { background: #f4b400; color: #161412; font-weight: 800; padding: .4rem 1rem; border-radius: 999px; font-size: 1.3rem; margin-bottom: 1rem; }
.done-btn { font-size: 2.4rem; padding: 1.2rem 4rem; border-radius: 16px; background: var(--green); margin-top: 1rem; }
.done-btn:hover { background: #17633a; }
.preview { background: #24211e; border-radius: 20px; padding: 1.25rem; }
.preview h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: .1em; color: #a59d95; }
.preview ol { padding-left: 1.4rem; margin: 0; }
.preview li { padding: .4rem 0; border-bottom: 1px solid #36322e; color: #d6cfc8; }
.preview li b { color: #fff; font-size: 1.2rem; }
.countdown { position: relative; width: 220px; height: 220px; margin: 0 auto; }
.countdown svg { transform: rotate(-90deg); }
.countdown circle { fill: none; stroke-width: 12; }
.countdown .track { stroke: #36322e; }
.countdown .ring { stroke: var(--green); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.countdown .sec { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 5rem; font-weight: 800; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }

/* /anzeige */
body.anzeige { background: #161412; color: #fff; }
.anzeige-wrap { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.anzeige-col { padding: 2rem 2.5rem; }
.anzeige-col h1 { font-size: clamp(2rem, 4vw, 3.5rem); padding-bottom: .5rem; border-bottom: 4px solid currentColor; }
.anzeige-col.progress { color: #f4b400; }
.anzeige-col.ready { color: #4cd17f; background: #1c2a20; }
.numbers { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; margin-top: 1.5rem; }
.numbers span { font-size: clamp(3rem, 6vw, 6rem); font-weight: 800; color: #fff; }
.anzeige-col.ready .numbers span { color: #4cd17f; }

/* /auswertung */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi .value { font-size: 2.4rem; font-weight: 800; }
.kpi .sub { color: var(--muted); }
.progressbar { height: 10px; background: #ece7e1; border-radius: 999px; overflow: hidden; margin-top: .6rem; }
.progressbar > div { height: 100%; background: var(--green); }
.bars { display: flex; gap: 4px; align-items: center; }
.bar { height: 14px; border-radius: 3px; }
.bar.planned { background: #c9c1b8; }
.bar.actual { background: var(--red); }
.legend span { display: inline-flex; align-items: center; gap: .3rem; margin-right: 1rem; font-size: .9rem; }
.legend i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }

.print-only { display: none; }
@media print {
  body { background: #fff; }
  .topbar, .no-print, .tabs { display: none !important; }
  .print-only { display: block; }
  .card { border: 0; padding: 0; }
  main { padding: 0; max-width: none; }
  th, td { padding: .25rem .4rem; }
  tr, .zone-block { break-inside: avoid; }
}
