* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
:root {
  --bg: #f6f1e7;
  --card: #ffffff;
  --ink: #2b2b2b;
  --muted: #8a8378;
  --brand: #c0392b;
  --brand-dark: #96281b;
  --green: #27ae60;
  --amber: #e67e22;
  --line: #e7dfd0;
  --radius: 14px;
}
html,
body {
  height: 100%;
}
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}
.hidden {
  display: none !important;
}

/* ---------- buttons / forms ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  background: #eee7da;
  color: var(--ink);
  transition:
    transform 0.05s ease,
    background 0.15s ease;
  user-select: none;
}
.btn:active {
  transform: scale(0.97);
}
.btn.primary {
  background: var(--brand);
  color: #fff;
}
.btn.primary:active {
  background: var(--brand-dark);
}
.btn.green {
  background: var(--green);
  color: #fff;
}
.btn.ghost {
  background: transparent;
  border-color: var(--line);
}
.btn.danger {
  background: #e74c3c;
  color: #fff;
}
.btn.block {
  width: 100%;
}
.btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}
.btn.small {
  min-height: 40px;
  padding: 6px 12px;
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--brand);
  border-color: transparent;
}
label.field {
  display: block;
  margin-bottom: 10px;
}
label.field > span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}
textarea {
  min-height: 64px;
  resize: vertical;
}

/* ---------- layout ---------- */
#topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--brand);
  color: #fff;
  padding: 10px 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
#topbar .brand {
  font-weight: 800;
  font-size: 17px;
  flex: 1;
}
#topbar .who {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 12px;
  line-height: 1.2;
}
#topbar .who #who-station {
  opacity: 0.85;
}
#topbar .btn.ghost {
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
  min-height: 38px;
  padding: 6px 12px;
  font-size: 14px;
}

#content {
  padding: 12px;
  padding-bottom: 84px;
  max-width: 760px;
  margin: 0 auto;
}

#tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabs button {
  flex: 1;
  min-height: 60px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-top: 3px solid transparent;
}
#tabs button.active {
  color: var(--brand);
  border-top-color: var(--brand);
}

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.card h2 {
  font-size: 17px;
  margin-bottom: 10px;
}
.card h3 {
  font-size: 15px;
  margin-bottom: 8px;
}
.muted {
  color: var(--muted);
  font-size: 13px;
}
.error {
  color: #c0392b;
  font-size: 14px;
  min-height: 18px;
  margin-top: 8px;
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
}

/* ---------- login ---------- */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.login-card h1 {
  font-size: 24px;
  line-height: 1.25;
  margin-bottom: 4px;
}
.login-card .sub {
  color: var(--muted);
  margin-bottom: 20px;
}
.login-card input {
  margin-bottom: 10px;
  text-align: center;
}

/* ---------- badges ---------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge.offen {
  background: #fdebd0;
  color: #a04000;
}
.badge.fertig {
  background: #d5f5e3;
  color: #1e8449;
}
.badge.erledigt {
  background: #d6eaf8;
  color: #1a5276;
}
.badge.storniert {
  background: #f2f3f4;
  color: #717d7e;
}

/* ---------- menu grid ---------- */
.station-head {
  font-weight: 800;
  margin: 16px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.menu-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 72px;
}
.menu-item:active {
  background: #faf6ee;
}
.menu-item.unavailable,
.menu-item.unavailable:active {
  cursor: not-allowed;
  opacity: 0.48;
  filter: grayscale(0.8);
  background: #eeeae3;
}
.menu-item .name {
  font-weight: 700;
  font-size: 15px;
}
.menu-item .price {
  color: var(--brand);
  font-weight: 700;
  font-size: 15px;
}
.menu-item .hint {
  color: var(--muted);
  font-size: 11px;
}
.menu-item .sold-out,
.sold-out {
  color: #9a4d43;
  font-weight: 700;
}
.row.unavailable-row {
  opacity: 0.62;
}
.operations-card {
  border: 2px solid var(--brand);
}
.settings-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-weight: 700;
  cursor: pointer;
}
.settings-toggle input {
  width: 24px;
  height: 24px;
  min-height: 0;
  accent-color: var(--brand);
}
.customer-unavailable {
  max-width: 560px;
  margin: 48px auto;
  text-align: center;
  border: 2px solid var(--amber);
}
.customer-unavailable h1 {
  margin: 10px 0 8px;
  font-size: 24px;
}
.customer-unavailable-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fdebd0;
  color: #a04000;
  font-size: 30px;
}

/* ---------- cart ---------- */
.cart-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.cart-line .info {
  flex: 1;
}
.cart-line .info .nm {
  font-weight: 600;
}
.cart-line .info .opt {
  color: var(--muted);
  font-size: 12px;
}
.cart-line .stepper {
  display: flex;
  align-items: center;
  gap: 2px;
}
.cart-line .stepper button {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 18px;
  cursor: pointer;
}
.cart-line .stepper .q {
  min-width: 26px;
  text-align: center;
  font-weight: 700;
}
.cart-total {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-size: 18px;
  margin: 10px 0;
}

/* ---------- order cards ---------- */
.order {
  border-left: 4px solid var(--line);
}
.order.offen {
  border-left-color: var(--amber);
}
.order.fertig {
  border-left-color: var(--green);
}
.order.erledigt {
  border-left-color: #85c1e9;
}
.order-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.order-head .num {
  font-weight: 800;
  font-size: 17px;
}
.order-head .time {
  color: var(--muted);
  font-size: 13px;
  flex: 1;
}
.order .note {
  background: #fff7e6;
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 8px;
  font-size: 14px;
}
.line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.line .li {
  flex: 1;
}
.line .li .nm {
  font-weight: 600;
}
.line .li .sub {
  color: var(--muted);
  font-size: 12px;
}
.line .qty-badge {
  background: var(--brand);
  color: #fff;
  border-radius: 8px;
  min-width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  margin-right: 6px;
}
.order-total {
  text-align: right;
  font-weight: 800;
  margin-top: 8px;
}

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal {
  background: #fff;
  width: 100%;
  max-width: 560px;
  border-radius: 18px 18px 0 0;
  padding: 18px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideup 0.18s ease;
}
@keyframes slideup {
  from {
    transform: translateY(30px);
    opacity: 0.6;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.modal h3 {
  font-size: 18px;
  margin-bottom: 14px;
}
.stepper {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.stepper button {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 22px;
  cursor: pointer;
}
.stepper .qty {
  font-size: 24px;
  font-weight: 800;
  min-width: 40px;
  text-align: center;
}
.opts {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}
.opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.opt input {
  width: 22px;
  height: 22px;
  min-height: 0;
  accent-color: var(--brand);
}
.opt span {
  flex: 1;
  font-weight: 600;
}
.opt em {
  color: var(--muted);
  font-style: normal;
  font-size: 14px;
}
.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.modal-actions .btn {
  flex: 1;
}

/* ---------- admin tables ---------- */
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.row:last-child {
  border-bottom: none;
}
.row .grow {
  flex: 1;
  min-width: 0;
}
.row .grow .nm {
  font-weight: 600;
}
.row .grow .sub {
  color: var(--muted);
  font-size: 12px;
}
.row .actions {
  display: flex;
  gap: 6px;
}

/* ---------- toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%);
  background: #2b2b2b;
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 15px;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  max-width: 90vw;
  text-align: center;
}
#toast.show {
  opacity: 1;
}

/* ---------- public customer ordering ---------- */
.customer-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--brand);
  color: #fff;
  padding: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.customer-top .brand {
  flex: 1;
  font-weight: 800;
}
.customer-top > span {
  font-size: 13px;
  opacity: 0.9;
}
.customer-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 12px 32px;
}
.customer-intro {
  margin: 6px 0 14px;
}
.customer-intro h1 {
  font-size: 24px;
  margin-bottom: 4px;
}
.customer-intro p {
  color: var(--muted);
}
.customer-cart {
  border: 2px solid var(--brand);
}
.customer-status {
  text-align: center;
  max-width: 520px;
  margin: 40px auto;
}
.customer-status h1 {
  margin: 8px 0;
  font-size: 24px;
}
.customer-success {
  width: 58px;
  height: 58px;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--green);
  color: #fff;
  font-size: 34px;
  font-weight: 800;
}
.customer-code {
  margin: 14px auto;
  padding: 12px 22px;
  width: fit-content;
  border: 2px dashed var(--brand);
  border-radius: 12px;
  color: var(--brand);
  font:
    800 28px / 1 ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
  letter-spacing: 3px;
}
.customer-status .badge {
  margin: 4px 0 12px;
}
