/* pos.css — Algarve till. Dark kitchen lighting. NEVER white/near-white text. */
:root {
  --bg: #0c1017;
  --panel: #141a24;
  --panel2: #1a2230;
  --line: #2a3548;
  --ink: #d2b48c;          /* warm tan — body */
  --ink-dim: #9a7b55;      /* labels */
  --ink-hot: #e0a045;      /* totals / emphasis — amber, not white */
  --accent: #25e6f0;
  --accent2: #8a4bff;
  --accent3: #ff3ec8;
  --ok: #3dba7a;
  --warn: #d4a017;
  --bad: #e05a4a;
  --btn: #243044;
  --btn-hot: #2e4a3a;
  --touch: 48px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea {
  font: inherit; color: inherit;
}
button {
  min-height: var(--touch);
  min-width: var(--touch);
  border: 1px solid var(--line);
  background: var(--btn);
  color: var(--ink);
  border-radius: 10px;
  cursor: pointer;
  padding: 0.55rem 0.85rem;
}
button:hover { border-color: var(--accent); }
button:active { transform: translateY(1px); }
button.primary { background: var(--btn-hot); border-color: var(--ok); color: var(--ink-hot); font-weight: 700; }
button.danger { border-color: var(--bad); color: #e08a7a; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
input, select {
  min-height: var(--touch);
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.4rem 0.7rem;
  color: var(--ink);
}

.app {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  height: 100dvh;
  max-height: 100vh;
}

.preview-note {
  background: #2a1a10;
  color: #c9894a;
  border-bottom: 1px solid #5a3a1a;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  line-height: 1.35;
}
.preview-note strong { color: #e0a045; }

.topbar {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
  padding: 0.45rem 0.65rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; letter-spacing: 0.02em; color: var(--ink-hot); margin-right: 0.5rem; }
.mode-rail { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.mode-rail button[aria-pressed="true"] {
  background: #1e3a4a; border-color: var(--accent); color: var(--accent);
}
.pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.25rem 0.65rem; border-radius: 999px;
  border: 1px solid var(--line); font-size: 0.85rem; min-height: 36px;
}
.pill.online { border-color: var(--ok); color: var(--ok); }
.pill.offline { border-color: var(--bad); color: #e08a7a; }
.topbar .spacer { flex: 1; }
.table-input { width: 5.5rem; }

.main {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
  min-height: 0;
  overflow: hidden;
}
@media (max-width: 900px) {
  .main { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
}

.menu-pane {
  display: grid;
  grid-template-columns: 132px 1fr;
  min-height: 0; border-right: 1px solid var(--line);
}
.cat-rail {
  overflow: auto; background: var(--panel);
  display: flex; flex-direction: column; gap: 0.3rem; padding: 0.45rem;
}
.cat-rail button {
  width: 100%; text-align: left; font-size: 0.9rem; line-height: 1.2;
  padding: 0.65rem 0.55rem;
}
.cat-rail button[aria-pressed="true"] {
  background: #1e3a4a; border-color: var(--accent); color: var(--accent);
}
.dish-grid {
  overflow: auto; padding: 0.55rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.45rem; align-content: start;
}
.dish {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 0.7rem;
  text-align: left;
  min-height: 88px;
  display: flex; flex-direction: column; gap: 0.25rem;
}
.dish .name { font-weight: 700; color: var(--ink-hot); font-size: 0.98rem; }
.dish .price { color: var(--accent); font-family: var(--mono); font-size: 0.95rem; }
.dish .note { color: var(--ink-dim); font-size: 0.78rem; }
.dish.unpriced { border-style: dashed; border-color: var(--warn); }

.check-pane {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--panel);
}
.check-head {
  padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem;
}
.check-head h2 { margin: 0; font-size: 1.05rem; color: var(--ink-hot); }
.check-lines {
  flex: 1; overflow: auto; padding: 0.45rem 0.55rem;
}
.line {
  display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 0.5rem;
  padding: 0.45rem 0.35rem; border-bottom: 1px solid #1e2736;
}
.line .meta { color: var(--ink-dim); font-size: 0.8rem; grid-column: 1 / -1; }
.line .amt { font-family: var(--mono); color: var(--accent); }
.line.voided .name { text-decoration: line-through; color: var(--ink-dim); }
.qty-row { display: flex; gap: 0.3rem; align-items: center; }
.qty-row button { min-width: 44px; padding: 0.35rem; }

.check-totals {
  border-top: 1px solid var(--line);
  padding: 0.55rem 0.7rem;
  display: grid; gap: 0.25rem;
  font-family: var(--mono);
}
.check-totals .row { display: flex; justify-content: space-between; color: var(--ink-dim); }
.check-totals .row.grand { color: var(--ink-hot); font-size: 1.35rem; font-weight: 800; }

.check-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem;
  padding: 0.5rem 0.55rem 0.65rem;
}
.check-actions button { font-weight: 650; }

.footer {
  border-top: 1px solid var(--line);
  background: #0a0e14;
  padding: 0.35rem 0.75rem 0.45rem;
  font-size: 0.8rem;
  color: var(--ink-dim);
  line-height: 1.35;
}
.footer .l1 { color: #b8895a; }
.footer .l2 { color: #7a6a55; }

.view { display: none; height: 100%; min-height: 0; }
.view.active { display: contents; }
/* when board/eod active, hide main menu layout */
body[data-view="board"] .view-till,
body[data-view="eod"] .view-till,
body[data-view="clock"] .view-till { display: none; }
body[data-view="board"] .view-board,
body[data-view="eod"] .view-eod,
body[data-view="clock"] .view-clock { display: block; overflow: auto; padding: 0.75rem; grid-column: 1 / -1; }

.board-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.55rem;
}
.ticket {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 0.7rem;
}
.ticket h3 { margin: 0 0 0.35rem; color: var(--ink-hot); }
.ticket .st { color: var(--accent); font-size: 0.85rem; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4,6,10,0.72);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: 1rem;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  width: min(480px, 100%); max-height: 90vh; overflow: auto; padding: 1rem;
}
.modal h3 { margin: 0 0 0.75rem; color: var(--ink-hot); }
.modal .actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.85rem; }
.change-huge {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 900; color: var(--ok);
  font-family: var(--mono); text-align: center; padding: 0.5rem 0;
}
.tip-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; }
.mod-list { display: flex; flex-direction: column; gap: 0.4rem; }
.toast {
  position: fixed; bottom: 3.2rem; left: 50%; transform: translateX(-50%);
  background: #1e2a20; color: var(--ok); border: 1px solid var(--ok);
  padding: 0.55rem 1rem; border-radius: 999px; z-index: 60; display: none;
}
.toast.show { display: block; }

/* Kitchen print — only ticket */
@media print {
  body * { visibility: hidden; }
  #print-ticket, #print-ticket * { visibility: visible; }
  #print-ticket {
    position: absolute; left: 0; top: 0; width: 80mm;
    color: #111; background: #fff; /* print ink — not screen UI text */
    font-family: var(--mono); font-size: 12px;
  }
}
#print-ticket { display: none; }
@media print { #print-ticket { display: block; } }

.pin-pad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; max-width: 240px; margin: 0.5rem auto;
}
.pin-pad button { font-size: 1.25rem; font-weight: 700; }
