/* ============================================================
   DirectDash V2 — Shared Design System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* === TOKENS === */
:root {
  --green:      #16a34a;
  --green-h:    #15803d;
  --green-l:    #22c55e;
  --green-dim:  rgba(22,163,74,.14);
  --blue:       #3b82f6;
  --blue-dim:   rgba(59,130,246,.14);
  --red:        #ef4444;
  --red-dim:    rgba(239,68,68,.14);
  --amber:      #f59e0b;
  --amber-dim:  rgba(245,158,11,.14);

  /* Dark (default) */
  --bg:      #0d0d0d;
  --surface: #171717;
  --card:    #1d1d1d;
  --border:  #2b2b2b;
  --border2: #3a3a3a;
  --txt:     #f0f0f0;
  --txt2:    #888;
  --txt3:    #444;

  --r1: 6px;
  --r2: 10px;
  --r3: 14px;
  --r4: 18px;
  --rf: 999px;

  --sh:  0 2px 8px rgba(0,0,0,.5);
  --sh2: 0 8px 24px rgba(0,0,0,.6);
}

body.light {
  --bg:      #f0f0f0;
  --surface: #e6e6e6;
  --card:    #ffffff;
  --border:  #dedede;
  --border2: #c8c8c8;
  --txt:     #111;
  --txt2:    #666;
  --txt3:    #bbb;
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--txt);
  margin: 0; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background .2s, color .2s;
}
a { color: inherit; }
button, input, select, textarea { font-family: inherit; }

/* === TOPBAR === */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 54px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 14px; gap: 10px; z-index: 500;
}
.topbar-title {
  flex: 1; text-align: center;
  font-size: 15px; font-weight: 700;
}
.icon-btn {
  width: 38px; height: 38px; border-radius: var(--r1);
  border: 1px solid var(--border); background: var(--card);
  color: var(--txt); display: flex; align-items: center; justify-content: center;
  cursor: pointer; text-decoration: none; font-size: 17px; flex-shrink: 0;
  transition: background .15s;
}
.icon-btn:hover { background: var(--border); }

/* === LAYOUT === */
.content { padding-top: 54px; }
.wrap { max-width: 700px; margin: 0 auto; padding: 16px; }

/* === CARDS === */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r3); padding: 14px;
}

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 44px; padding: 0 18px; border-radius: var(--r2);
  border: none; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: opacity .15s, transform .08s; text-decoration: none;
  white-space: nowrap; line-height: 1;
}
.btn:active:not(:disabled) { transform: scale(.96); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--green-h); }
.btn-danger  { background: var(--red);  color: #fff; }
.btn-blue    { background: var(--blue); color: #fff; }
.btn-ghost   { background: var(--card); border: 1px solid var(--border); color: var(--txt); }
.btn-ghost:hover { background: var(--border); }
.btn-full    { width: 100%; }
.btn-lg      { height: 52px; font-size: 16px; border-radius: var(--r3); }
.btn-sm      { height: 32px; font-size: 12px; padding: 0 10px; border-radius: var(--r1); }

/* === INPUTS === */
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  color: var(--txt2); margin-bottom: 6px;
}
.input {
  width: 100%; height: 46px; padding: 0 14px;
  border-radius: var(--r2); border: 1px solid var(--border);
  background: var(--surface); color: var(--txt);
  font-size: 15px; outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--green); }
.input::placeholder { color: var(--txt3); }
.input-tap {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; height: 46px; padding: 0 14px;
  border-radius: var(--r2); border: 1px solid var(--border);
  background: var(--surface); color: var(--txt);
  font-size: 15px; cursor: pointer;
}
.input-tap .val { font-weight: 700; color: var(--green); font-size: 18px; }
.input-tap .placeholder { color: var(--txt3); }

/* === TOAST === */
#toasts {
  position: fixed; bottom: 76px; left: 50%; transform: translateX(-50%);
  z-index: 9000; display: flex; flex-direction: column; gap: 8px;
  align-items: center; pointer-events: none;
}
.toast {
  padding: 10px 18px; border-radius: var(--r2);
  font-size: 13px; font-weight: 600; color: #fff;
  box-shadow: var(--sh2); animation: tin .25s ease;
  white-space: nowrap; max-width: 90vw;
}
.t-ok  { background: var(--green); }
.t-err { background: var(--red); }
.t-inf { background: var(--blue); }
@keyframes tin {
  from { opacity: 0; transform: translateY(10px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* === MODAL === */
.modal {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.8); z-index: 2000;
  align-items: flex-end; justify-content: center;
}
.modal.open { display: flex; }
.modal-box {
  background: var(--surface);
  border-radius: var(--r4) var(--r4) 0 0;
  width: 100%; max-width: 480px;
  padding: 14px 16px 32px;
  max-height: 88vh; overflow-y: auto;
}
.modal-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--border2); margin: 0 auto 14px;
}
.modal-title { font-size: 17px; font-weight: 700; text-align: center; margin-bottom: 14px; }
.modal-close {
  position: absolute; top: 14px; right: 16px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r1); width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; color: var(--txt2);
}

/* === NUMPAD === */
.numpad-screen {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r2); height: 64px;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 700; color: var(--green);
  letter-spacing: 6px; margin-bottom: 14px;
}
.numpad-screen.empty { color: var(--txt3); font-size: 20px; letter-spacing: 0; }
.numpad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px;
}
.numpad-btn {
  height: 64px; border-radius: var(--r2);
  border: 1px solid var(--border); background: var(--card);
  color: var(--txt); font-size: 22px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .1s; user-select: none;
}
.numpad-btn:active { transform: scale(.92); background: var(--green-dim); }
.numpad-btn.del { background: var(--surface); color: var(--red); }
.numpad-btn.go  { background: var(--green); color: #fff; border-color: var(--green); }
.numpad-btn.go:active { background: var(--green-h); }

/* === ORDER GRID === */
.order-grid {
  display: grid; grid-template-columns: repeat(2,1fr);
  gap: 12px; align-items: start;
}
@media (min-width: 900px) { .order-grid { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 480px)  { .order-grid { grid-template-columns: 1fr; } }

/* === ORDER CARD === */
.order-card {
  background: var(--card); border: 1px solid var(--border);
  border-left: 4px solid var(--green);
  border-radius: var(--r3); padding: 12px; position: relative;
}
.order-card-head {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 4px;
}
.order-table { font-weight: 700; font-size: 15px; color: var(--green); }
.order-time  { font-size: 11px; color: var(--txt2); font-weight: 600; }
.order-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.order-item:last-child { border-bottom: none; }

/* === TIMER BAR === */
.timer-bar {
  height: 3px; background: var(--border);
  border-radius: 2px; overflow: hidden; margin: 8px 0;
}
.timer-fill { height: 100%; border-radius: 2px; transition: width 1s linear, background .5s; }
.timer-fill.g { background: var(--green-l); }
.timer-fill.o { background: var(--amber); }
.timer-fill.r { background: var(--red); }

/* === NOTE BOX === */
.note-box {
  background: var(--amber-dim); border: 1px solid rgba(245,158,11,.3);
  border-radius: var(--r1); padding: 7px 10px;
  font-size: 12px; font-weight: 600; color: var(--amber); margin: 8px 0;
}

/* === PRODUCT ITEM (Bedienung) === */
.product-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 11px 14px;
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.product-name  { font-weight: 600; font-size: 14px; }
.product-price { font-size: 12px; color: var(--txt2); margin-top: 2px; }
.qty-control   { display: flex; align-items: center; gap: 14px; }
.qty-btn {
  width: 36px; height: 36px; border-radius: var(--rf);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--txt); font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.qty-btn:active { background: var(--green-dim); }
.qty-val { font-size: 16px; font-weight: 700; min-width: 20px; text-align: center; }
.cat-header {
  font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--txt2); padding: 14px 0 8px;
}

/* === STICKY FOOTER === */
.sticky-footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 12px 16px; z-index: 400;
}
.total-row {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 10px;
}
.total-label  { font-size: 12px; color: var(--txt2); font-weight: 600; }
.total-amount { font-size: 24px; font-weight: 700; color: var(--green); }

/* === RECEIPT (Split-Abrechnung) === */
.receipt-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border-radius: var(--r1);
  background: var(--card); margin-bottom: 6px;
  cursor: pointer; border: 1px solid var(--border);
  transition: background .1s, border-color .1s;
}
.receipt-item.selected { background: var(--blue-dim); border-color: var(--blue); }
.receipt-item.paid { opacity: .3; pointer-events: none; text-decoration: line-through; }
.split-summary {
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* === HISTORY CARD === */
.hist-card {
  background: var(--card); border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: var(--r2); padding: 12px; margin-bottom: 10px;
}
.hist-card.cancelled { border-left-color: var(--red); opacity: .6; }
.hist-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.hist-table { font-weight: 700; font-size: 14px; color: var(--blue); }
.hist-meta  { font-size: 11px; color: var(--txt2); }
.hist-item  {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.hist-item:last-of-type { border-bottom: none; }
.hist-total { text-align: right; font-weight: 700; font-size: 13px; color: var(--green); margin-top: 6px; }

/* === STATS === */
.stats-table { width: 100%; border-collapse: collapse; }
.stats-table th {
  text-align: left; padding: 10px 12px; font-size: 11px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--txt2); border-bottom: 1px solid var(--border);
}
.stats-table td { padding: 10px 12px; font-size: 14px; border-bottom: 1px solid var(--border); }
.stats-table tr:last-child td { border-bottom: none; }
.stats-table .total-row td { font-weight: 700; color: var(--green); background: var(--green-dim); }
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.bar-label-s { font-size: 12px; color: var(--txt2); width: 30px; text-align: right; flex-shrink: 0; }
.bar-track { flex: 1; height: 18px; background: var(--border); border-radius: 4px; overflow: hidden; }
.bar-fill-s { height: 100%; background: var(--green); border-radius: 4px; transition: width .5s ease; }
.bar-val { font-size: 12px; font-weight: 600; color: var(--green); width: 60px; flex-shrink: 0; }

/* === FASS MONITOR === */
.fass-monitor {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--rf); padding: 6px 20px;
  display: flex; align-items: center; gap: 10px;
  width: fit-content; margin: 0 auto 14px;
}
.fass-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--txt2); }
.fass-val   { font-size: 24px; font-weight: 700; color: var(--green); }
.fass-unit  { font-size: 12px; font-weight: 700; color: var(--green); }

/* === SOUND BTN === */
.sound-btn {
  display: flex; align-items: center; gap: 6px; cursor: pointer;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r1); padding: 6px 12px;
  font-size: 13px; color: var(--txt2);
}
.sound-btn.on { border-color: var(--green); color: var(--green); }

/* === ADMIN === */
.product-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--r1); padding: 8px 10px; margin-bottom: 6px;
}
.handle { color: var(--txt3); cursor: grab; font-size: 18px; flex-shrink: 0; touch-action: none; }
.edit-name {
  flex: 1; background: transparent; border: none;
  border-bottom: 1px solid transparent; color: var(--txt);
  font-size: 14px; font-weight: 600; padding: 3px 0; outline: none;
}
.edit-name:focus  { border-bottom-color: var(--green); }
.edit-price {
  width: 68px; background: transparent; border: none;
  border-bottom: 1px solid transparent; color: var(--txt);
  font-size: 14px; text-align: right; padding: 3px 0; outline: none;
}
.edit-price:focus { border-bottom-color: var(--green); }
.save-indicator { display: none; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); flex-shrink: 0; }
.save-indicator.visible { display: block; }
.toggle-badge {
  font-size: 11px; font-weight: 700; padding: 3px 8px;
  border-radius: var(--r1); border: 1px solid; background: none; cursor: pointer;
}
.toggle-badge.on  { border-color: var(--green); color: var(--green); }
.toggle-badge.off { border-color: var(--red);   color: var(--red); }
.del-btn { background: none; border: none; color: var(--txt3); font-size: 20px; cursor: pointer; padding: 0 2px; line-height: 1; }
.del-btn:hover { color: var(--red); }

.accordion-btn {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 14px 16px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 15px; font-weight: 700; color: var(--txt);
  cursor: pointer; margin-bottom: 6px; transition: background .15s;
}
.accordion-btn:hover { background: var(--border); }
.accordion-panel { display: none; margin-bottom: 16px; }

.event-banner {
  background: var(--blue-dim); border: 1px solid rgba(59,130,246,.25);
  border-radius: var(--r2); padding: 10px 16px;
  text-align: center; font-weight: 700; font-size: 14px;
  color: var(--blue); margin-bottom: 14px;
}

/* === LOGIN === */
.login-page {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 100vh; padding: 24px;
}
.login-logo { max-height: 90px; width: auto; margin: 0 auto 20px; display: block; }
.login-title { font-size: 22px; font-weight: 700; margin: 0 0 4px; text-align: center; }
.login-sub   { font-size: 13px; color: var(--txt2); margin: 0 0 28px; text-align: center; }

/* === HOME PAGE === */
.home-page {
  display: flex; flex-direction: column; align-items: center;
  min-height: 100vh; padding: 80px 20px 40px;
}
.home-logo { max-height: 80px; margin-bottom: 6px; }
.home-title { font-size: 13px; color: var(--txt2); font-weight: 500; margin: 0 0 28px; }
.home-nav  { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 10px; }
.home-btn  {
  display: flex; align-items: center; padding: 16px 18px;
  border-radius: var(--r3); background: var(--card);
  border: 1px solid var(--border); color: var(--txt);
  text-decoration: none; font-size: 16px; font-weight: 600;
  transition: background .15s;
}
.home-btn:hover { background: var(--border2); }
.home-btn .icon-left  { font-size: 22px; margin-right: 12px; }
.home-btn .label      { flex: 1; }
.home-btn .badge      { background: var(--red); color: #fff; border-radius: var(--rf); padding: 2px 8px; font-size: 12px; font-weight: 700; }
.home-btn .chevron    { color: var(--txt3); margin-left: 8px; }
.home-btn.primary     { background: var(--green); border-color: var(--green); color: #fff; }
.home-btn.primary:hover { background: var(--green-h); }
.home-btn.primary .chevron { color: rgba(255,255,255,.6); }
.home-btn.muted       { opacity: .7; }

/* === MISC === */
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.statusbar { text-align: center; font-size: 11px; color: var(--txt3); padding: 6px 0; }
.empty { text-align: center; padding: 40px 20px; color: var(--txt2); grid-column: 1/-1; }
.empty .eicon { font-size: 36px; margin-bottom: 8px; }
.pb-footer { padding-bottom: 110px; }
.text-green { color: var(--green); }
.text-red   { color: var(--red); }
.text-muted { color: var(--txt2); }
.fw7 { font-weight: 700; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
