:root {
  /* Farben aus dem Branding von Das Wasserwerk: Grün #7ea331, Dunkelgrau #535251, Hellgrau #d2cfc7 (wie im Dashboard Event Management) */
  --ink: #535251; --head: #343532; --muted: #77736e; --line: #e5e2dc; --edge: #b9b5ad; --bg: #f7f6f2; --card: #fff;
  --accent: #7ea331; --brand: #678b24; --soft: #f1f6e7; --stone: #d2cfc7;
  --warn-bg: #f8edd4; --warn: #b7791f; --ok-bg: #e9f3dc; --ok: #4a7a31; --bad-bg: #f7e1d6; --bad: #a3352b;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { font: 16px/1.4 Inter, system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif; color: var(--ink); background: var(--bg); padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; cursor: pointer; }
h1 { font-size: 20px; margin: 0; color: var(--head); letter-spacing: -.02em; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 20px 0 8px; }
main { max-width: 640px; margin: 0 auto; padding: 12px 14px 24px; }
body.wide main { max-width: 1200px; }

.top { display: flex; align-items: center; gap: 12px; background: #fff; color: var(--ink); border-bottom: 3px solid var(--accent); margin: -12px -14px 14px; padding: 10px 14px; position: sticky; top: 0; z-index: 5; }
.top .toplogo { height: 42px; width: auto; flex: none; display: block; }
.top .toptext { flex: 1; min-width: 0; }
.top .sub { font-size: 13px; color: var(--muted); }
.top button { white-space: nowrap; background: #fff; border: 1px solid var(--edge); color: var(--ink); border-radius: 10px; padding: 8px 12px; font-size: 14px; font-weight: 600; }
@media (max-width: 380px) { .top .toplogo { height: 34px; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; display: block; width: 100%; text-align: left; }
button.card:active { background: #f1efea; }
.card.open { border-color: var(--warn); background: var(--warn-bg); }
.card.ready { border-color: var(--ok); background: var(--ok-bg); }
.card .title { font-weight: 700; display: flex; justify-content: space-between; gap: 8px; }
.card .meta { color: var(--muted); font-size: 14px; margin-top: 2px; }

.tag { display: inline-block; font-size: 12px; border-radius: 6px; padding: 1px 7px; background: #efede8; color: var(--ink); white-space: nowrap; }
.tag.ok { background: #dcebc6; } .tag.warn { background: #f6d9a8; } .tag.bad { background: #f3c9c4; }

.row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: none; }
.row .muted, .muted { color: var(--muted); font-size: 14px; }
.sum { display: flex; justify-content: space-between; font-weight: 700; font-size: 18px; padding: 12px 0 4px; border-top: 2px solid var(--ink); margin-top: 6px; }

.btn { display: block; width: 100%; background: var(--brand); color: #fff; border: none; border-radius: 12px; padding: 14px; font-weight: 700; font-size: 16px; margin-top: 10px; }
.btn:disabled { opacity: .45; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--edge); }
.btn.small { display: inline-block; width: auto; padding: 8px 14px; font-size: 14px; margin: 0; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chipwrap { position: relative; }
.chipnav { position: absolute; top: 0; bottom: 10px; width: 52px; border: none; padding: 0; display: flex; align-items: center; z-index: 2; color: var(--ink); }
.chipnav[hidden] { display: none; }
.chipnav.l { left: 0; justify-content: flex-start; background: linear-gradient(90deg, var(--bg) 60%, rgba(247,246,242,0)); }
.chipnav.r { right: 0; justify-content: flex-end; background: linear-gradient(270deg, var(--bg) 60%, rgba(247,246,242,0)); }
.chipnav span { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--edge); background: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; line-height: 1; padding-bottom: 3px; }
@media print { .chipnav { display: none; } }
.chip { flex: none; border: 1px solid var(--edge); background: #fff; border-radius: 999px; padding: 8px 14px; font-size: 15px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { background: #fff; border: 1px solid var(--edge); border-radius: 12px; padding: 12px; text-align: left; min-height: 68px; position: relative; }
.tile:active { background: #f1efea; }
.tile b { display: block; }
.tile span { color: var(--muted); font-size: 14px; }
.tile.sel { border: 2px solid var(--accent); padding: 11px; background: var(--soft); }
.tile.off { color: #a8a39b; background: #f4f2ee; }
.tile.off b { text-decoration: line-through; }
.tile .count { position: absolute; top: 8px; right: 8px; background: var(--brand); color: #fff; border-radius: 999px; min-width: 26px; height: 26px; line-height: 26px; text-align: center; font-weight: 700; font-size: 14px; }

.qty { display: inline-flex; align-items: center; gap: 12px; }
.qty button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--edge); background: #fff; font-size: 20px; line-height: 1; }
textarea, input[type=text] { width: 100%; font: inherit; border: 1px solid var(--edge); border-radius: 10px; padding: 10px 12px; }

.cartbar { position: fixed; left: 0; right: 0; bottom: calc(60px + env(safe-area-inset-bottom)); padding: 10px 14px; background: linear-gradient(transparent, var(--bg) 30%); z-index: 6; }
.cartbar .btn { max-width: 612px; margin: 0 auto; box-shadow: 0 4px 14px rgba(57,51,39,.18); }

nav#nav[hidden] { display: none; }
nav#nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 7; }
nav#nav button { flex: 1; background: none; border: none; padding: 12px 6px; font-size: 14px; color: var(--muted); position: relative; }
nav#nav button.on { color: var(--brand); font-weight: 700; }
nav#nav .dot { display: inline-block; margin-left: 6px; padding: 0 5px; background: var(--ok); color: #fff; border-radius: 999px; font-size: 12px; font-weight: 700; min-width: 20px; height: 20px; line-height: 20px; vertical-align: 1px; }

#banner { background: #f6d9a8; padding: 10px 14px; font-size: 14px; position: sticky; top: 0; z-index: 9; }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 150px; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 15px; z-index: 20; max-width: 90vw; }

/* Anmeldung */
.login { text-align: center; padding-top: 6vh; }
.login h1 { font-size: 26px; }
.login .logo { display: block; width: 230px; max-width: 70%; height: auto; margin: 0 auto 14px; }
.login .appname { font-size: 13px; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; color: var(--brand); margin-bottom: 18px; }
.receipt .logo { display: block; width: 120px; height: auto; margin: 0 auto 8px; }
.printhead .logo { width: 150px; height: auto; margin-bottom: 10px; }
.pinfield { font-size: 30px; letter-spacing: 12px; height: 54px; margin: 6px 0; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 320px; margin: 0 auto; }
.pad button { height: 60px; font-size: 24px; font-weight: 700; border: 1px solid var(--edge); border-radius: 14px; background: #fff; }
.pad button:active { background: #ebe8e2; }
.error { color: var(--bad); min-height: 22px; font-size: 15px; }

/* Bar-Tablet */
.barwrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; align-items: start; }
.ticket { background: #fff; border: 2px solid var(--edge); border-radius: 14px; padding: 14px; font-size: 18px; }
.ticket.in_arbeit { border-color: var(--warn); background: var(--warn-bg); }
.ticket.bereit { border-color: var(--ok); background: var(--ok-bg); }
.ticket.late { border-color: var(--bad); }
.ticket .head { display: flex; justify-content: space-between; font-weight: 700; font-size: 20px; }
.ticket .line { padding: 4px 0; }
.ticket .line b { display: inline-block; min-width: 2.2em; }
.ticket .note { font-style: italic; background: #fff6d6; border-radius: 6px; padding: 4px 8px; margin-top: 6px; }
table.sammel { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; font-size: 18px; }
table.sammel td, table.sammel th { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
table.sammel td.n { font-weight: 700; font-size: 22px; width: 80px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* Zahlgruppen */
.st { display: inline-block; width: 26px; height: 26px; line-height: 24px; border-radius: 50%; border: 1px solid var(--ink); text-align: center; font-weight: 700; font-size: 13px; background: #fff; vertical-align: middle; }
.st.big { width: 52px; height: 52px; line-height: 50px; font-size: 20px; }
.gnone { background: #fff; border-style: dashed; color: var(--muted); }
.gA { background: #cfe3f6; } .gB { background: #f6d9a8; } .gC { background: #dcebc6; } .gD { background: #e5d4f3; }
.gE { background: #f9cfd6; } .gF { background: #d6f0ee; } .gG { background: #ece6c9; } .gH { background: #d9dcf7; }
.gI { background: #f3dcc6; } .gJ { background: #dcefc8; }
.chip.gA.on, .chip.gB.on, .chip.gC.on, .chip.gD.on, .chip.gE.on, .chip.gF.on, .chip.gG.on, .chip.gH.on, .chip.gI.on, .chip.gJ.on { color: var(--ink); border: 2px solid var(--ink); padding: 7px 13px; }
.seatrow { display: flex; justify-content: space-around; padding: 6px 0; }
.tblbox { border: 2px solid var(--ink); border-radius: 10px; text-align: center; padding: 16px 0; margin: 4px 12px; font-weight: 700; background: var(--bg); }

/* Hauptgang */
.mealrow { padding: 8px 0 12px; border-bottom: 1px solid var(--line); }
.mealrow:last-child { border-bottom: none; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg button { border: 1px solid var(--edge); background: #fff; border-radius: 10px; padding: 12px 4px; font-size: 15px; }
.seg button.on { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 700; }
.mealrow input { margin-top: 8px; }
.courserow { margin-bottom: 4px; }
.sortlist { display: grid; gap: 6px; }
.sortrow { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.sortrow b { flex: 1; }
.sortrow .grip { font-size: 24px; line-height: 1; padding: 6px 10px; cursor: grab; touch-action: none; user-select: none; color: var(--muted); border-radius: 8px; background: var(--bg); }
.sortrow { transition: transform .12s; }
.sortrow.dragging { border-color: var(--accent); background: var(--soft); box-shadow: 0 6px 18px rgba(25,35,23,.14); position: relative; z-index: 3; transition: none; }
.sortrow.dragging .grip { cursor: grabbing; }
.rowbtns { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.btn.ghost.danger { color: var(--bad); border-color: #e3b9b2; }
.courserow .row { align-items: center; }
.linkbtn { background: none; border: none; color: var(--brand); font-size: 14px; padding: 0; }
.ticket .changed { background: #f6d9a8; border-radius: 8px; padding: 8px 10px; margin-top: 8px; font-size: 16px; }
.chip.gA.on { background: #cfe3f6; }
.chip.gB.on { background: #f6d9a8; }
.chip.gC.on { background: #dcebc6; }
.chip.gD.on { background: #e5d4f3; }
.chip.gE.on { background: #f9cfd6; }
.chip.gF.on { background: #d6f0ee; }
.chip.gG.on { background: #ece6c9; }
.chip.gH.on { background: #d9dcf7; }
.chip.gI.on { background: #f3dcc6; }
.chip.gJ.on { background: #dcefc8; }

/* Rechnung und Zahlung */
button.itemrow { width: 100%; background: none; border: none; border-bottom: 1px solid var(--line); text-align: left; font: inherit; color: inherit; }
button.itemrow:last-child { border-bottom: none; }
button.itemrow.muted { color: var(--muted); font-size: 14px; }
.row.paid { text-decoration: line-through; opacity: .6; }
.box { display: inline-block; width: 20px; height: 20px; border: 1.5px solid var(--ink); border-radius: 5px; vertical-align: -4px; margin-right: 6px; }
.box.x { background: var(--brand); border-color: var(--brand); }
.banner-info { background: #f6d9a8; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 8px 0; }
.check { display: flex; align-items: center; gap: 8px; margin: 16px 0 8px; font-size: 15px; }
.check input { width: 22px; height: 22px; }
.center { text-align: center; }
input[type=password] { width: 100%; font: inherit; border: 1px solid var(--edge); border-radius: 10px; padding: 10px 12px; margin-top: 8px; }
.row > span:last-child, .title > span:last-child, .sum > span:last-child { white-space: nowrap; }

/* Bereich der Leitung */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 12px 0; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.kpi span { display: block; color: var(--muted); font-size: 14px; }
.kpi b { font-size: 22px; }
.two { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 800px) { .two { grid-template-columns: 1fr; } }
table.sammel.small { font-size: 15px; }
table.sammel.small td, table.sammel.small th { padding: 8px 10px; }
table.sammel td.r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.sammel tr.inactive td { color: #a8a39b; }
.field { display: block; margin-top: 10px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 3px; }
select { width: 100%; font: inherit; border: 1px solid var(--edge); border-radius: 10px; padding: 10px 12px; background: #fff; }
.inline { display: flex; gap: 8px; align-items: center; }
.seatedit { display: grid; grid-template-columns: 34px 1fr 1fr; gap: 6px; align-items: center; margin-bottom: 8px; }
.seatedit input { grid-column: 2 / 4; }
a.btn { text-decoration: none; text-align: center; }
.printhead { display: none; }
@media print {
  body { background: #fff; padding: 0; }
  .top, nav#nav, .noprint, #banner, #toast { display: none !important; }
  .printhead { display: block; margin-bottom: 10px; }
  main { max-width: none; padding: 0; }
  table.sammel { border: 1px solid #999; }
}
table.sammel th.r { text-align: right; }

/* Tischplan */
svg.plan { width: 100%; display: block; touch-action: none; user-select: none; }
svg.plan .click { cursor: pointer; }
.planbox { padding: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 700px) { .grid3 { grid-template-columns: 1fr; } }

/* Tabellen am Handy: kleinere Schrift und engere Zellen, damit nichts rechts abgeschnitten wird */
@media (max-width: 640px) {
  table.sammel { font-size: 15px; }
  table.sammel td, table.sammel th { padding: 8px; }
  table.sammel td.n { font-size: 18px; width: auto; }
  table.sammel.small { font-size: 13px; }
  table.sammel.small td, table.sammel.small th { padding: 7px 5px; }
  table.sammel.small th { font-size: 11.5px; }
  table.sammel .tag { white-space: normal; font-size: 11px; padding: 1px 5px; }
  table.sammel .btn.small { padding: 6px 8px; font-size: 12px; }
  .rowbtns { flex-direction: column; align-items: stretch; }
  table.sammel td { hyphens: auto; overflow-wrap: break-word; }
  table.sammel th, table.sammel .btn { white-space: nowrap; }
  .chips:has(.btn) { flex-wrap: wrap; }
  .chips .btn { flex: none; max-width: 100%; }
  /* Spalten, die am Handy entfallen: Service in der Live-Übersicht, Uhrzeit bei den Zahlungen, Einzelpreis beim Umsatz */
  table.live th:nth-child(2), table.live td:nth-child(2),
  table.belege th:nth-child(2), table.belege td:nth-child(2),
  table.umsatz th:nth-child(3), table.umsatz td:nth-child(3) { display: none; }
}
