/* =========================================================================
   style.css – the look of the app (dark board with orange and white,
   like the printed menu). Change the colours in :root below.
   ========================================================================= */
:root {
  --bg: #161616;
  --bg2: #1f1f1f;
  --panel: #242424;
  --line: #3a3a3a;
  --text: #f5f5f5;
  --muted: #a9a9a9;
  --orange: #ff8a3d;
  --orange-dark: #e9701f;
  --orange-soft: #ffb37f;
  --card: #ffffff;
  --card-text: #1b1b1b;
  --green: #2fbf71;
  --red: #ff5a5a;
  --yellow: #ffcc4d;
  --radius: 14px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.035) 0, transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(255,255,255,.03) 0, transparent 45%);
}
button, input, select { font-family: inherit; font-size: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.grow { flex: 1; }
code { background: #333; padding: 1px 5px; border-radius: 4px; }

#app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 16px; background: #0f0f0f; border-bottom: 3px solid var(--orange);
  z-index: 20; flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.brand-logo { font-size: 30px; }
#brand-name { font-weight: 900; font-size: 19px; letter-spacing: .5px; text-transform: uppercase; }
.brand-sub { color: var(--orange); font-size: 12px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }
.tabs { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.tabs button {
  background: transparent; color: var(--text); border: 2px solid transparent; border-radius: 999px;
  padding: 8px 14px; font-weight: 700; cursor: pointer; font-size: 15px;
}
.tabs button:hover { border-color: var(--line); }
.tabs button.active { background: var(--orange); color: #111; }
.top-right { display: flex; align-items: center; gap: 14px; }
.help-link { color: var(--orange-soft); text-decoration: none; font-weight: 700; }
.clock { text-align: right; font-weight: 800; font-size: 17px; line-height: 1.1; }
.clock small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }

.banner {
  background: #3d2a10; color: #ffe2c4; border-bottom: 1px solid var(--orange-dark);
  padding: 8px 16px; display: flex; align-items: center; gap: 12px; font-weight: 600; flex-shrink: 0;
}

main { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.page { display: none; padding: 16px 20px 40px; }
.page.active { display: block; }
#page-billing.active { display: flex; flex: 1; padding: 0; min-height: 0; }
.page-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.page-head h1 { margin: 0; font-size: 26px; }
.page-head p { margin: 0; }

/* ---------- buttons ---------- */
.btn {
  border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; line-height: 1.15;
  transition: transform .05s, filter .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--orange); color: #111; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.secondary { background: #3a3a3a; color: var(--text); }
.btn.secondary:hover:not(:disabled) { background: #474747; }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger-outline { background: transparent; color: var(--red); border: 1.5px solid var(--red); }
.btn.small { padding: 7px 12px; font-size: 14px; }
.btn.tiny { padding: 2px 8px; font-size: 12px; border-radius: 6px; }
.btn.big { padding: 14px 22px; font-size: 18px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- billing layout ---------- */
.billing {
  display: grid; grid-template-columns: 200px 1fr 390px; grid-template-rows: minmax(0, 1fr);
  gap: 0; width: 100%; flex: 1; min-height: 430px;
}
.cat-list {
  background: var(--bg2); border-right: 1px solid var(--line); padding: 10px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
}
.cat-btn {
  background: #0d0d0d; color: #fff; border: 2px solid #333; border-radius: 12px;
  padding: 14px 12px; font-weight: 800; font-size: 15px; text-align: left; cursor: pointer; text-transform: uppercase; letter-spacing: .3px;
}
.cat-btn:hover { border-color: var(--orange); }
.cat-btn.active { background: var(--orange); color: #111; border-color: var(--orange); }

.items-panel { padding: 12px 16px; overflow-y: auto; }
.items-toolbar { display: flex; gap: 10px; align-items: center; }
.items-toolbar input { flex: 1; }
#btn-pending-count.has-pending { background: var(--yellow); color: #111; }
.items-title { margin: 12px 0 10px; font-size: 20px; text-transform: uppercase; letter-spacing: .5px; color: var(--orange); }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; }
.item-btn {
  background: var(--card); color: var(--card-text); border: 0; border-radius: var(--radius);
  min-height: 104px; padding: 12px; cursor: pointer; text-align: left; position: relative;
  display: flex; flex-direction: column; gap: 4px; box-shadow: 0 3px 0 #000;
}
.item-btn:hover { outline: 3px solid var(--orange); }
.item-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #000; }
.item-name { font-weight: 800; font-size: 16px; line-height: 1.2; }
.item-sizes { font-size: 12px; color: #666; }
.item-price { margin-top: auto; font-weight: 900; font-size: 18px; color: var(--orange-dark); }
.item-btn.combo { background: #fff3e8; }
.item-btn.disabled { opacity: .45; cursor: not-allowed; outline: none; }
.unavail { position: absolute; top: 8px; right: 8px; background: #333; color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 6px; }
.empty { color: var(--muted); padding: 20px; text-align: center; }

/* ---------- cart ---------- */
.cart { background: #fafafa; color: var(--card-text); display: flex; flex-direction: column; min-height: 0; border-left: 4px solid var(--orange); }
.cart-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #111; color: #fff; }
.cart-head h2 { margin: 0; font-size: 19px; text-transform: uppercase; }
.cart-count { color: var(--orange); font-weight: 700; flex: 1; }
.edit-banner { background: #fff1c2; padding: 8px 12px; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cart-lines { flex: 1; overflow-y: auto; padding: 6px 10px; min-height: 80px; }
.cart-empty { text-align: center; color: #888; padding: 40px 10px; font-size: 16px; line-height: 2; }
.line { display: grid; grid-template-columns: 1fr auto 68px 26px; align-items: center; gap: 6px; padding: 8px 2px; border-bottom: 1px dashed #ddd; }
.line-name { font-weight: 800; font-size: 15px; }
.line-size { font-weight: 600; color: #555; }
.line-extra { font-size: 12px; color: #a24d0b; }
.line-unit { font-size: 12px; color: #777; }
.line-total { font-weight: 800; text-align: right; }
.line-del { background: none; border: 0; color: #c33; font-size: 18px; cursor: pointer; padding: 0; }
.qty { display: flex; align-items: center; background: #eee; border-radius: 999px; }
.qty button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: #111; color: #fff; font-size: 20px; font-weight: 800; cursor: pointer; line-height: 1; }
.qty span { min-width: 32px; text-align: center; font-weight: 900; font-size: 17px; cursor: pointer; }
.qty.big button { width: 48px; height: 48px; font-size: 26px; background: var(--orange); color: #111; }
.qty.big span { min-width: 50px; font-size: 22px; color: var(--text); }
.qty.big { background: #333; }

.cart-summary { padding: 10px 14px 14px; border-top: 2px solid #e5e5e5; background: #fff; }
.sum-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 0; font-size: 15px; }
.sum-row.total { font-size: 26px; font-weight: 900; border-top: 2px solid #111; margin-top: 4px; padding-top: 6px; }
.sum-row.total span:last-child { color: var(--orange-dark); }
.discount-input { display: flex; align-items: center; gap: 4px; }
.discount-input input { width: 80px; padding: 6px 8px; border: 1.5px solid #ccc; border-radius: 8px; background: #fff; color: #111; }
.seg { display: flex; border: 1.5px solid #ccc; border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 6px 10px; font-weight: 800; cursor: pointer; }
.seg button.active { background: #111; color: #fff; }
.discount-warn { color: #c33; font-size: 12px; min-height: 0; }
.pay-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0 4px; }
.pay-methods button { padding: 10px 4px; border-radius: 10px; border: 2px solid #ddd; background: #fff; font-weight: 800; cursor: pointer; font-size: 15px; }
.pay-methods button.active { border-color: #111; background: #111; color: #fff; }
.pay-note { font-size: 12px; color: #a24d0b; min-height: 0; margin-bottom: 4px; }
.cart-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.cart-actions .wide { grid-column: span 2; padding: 15px; font-size: 19px; }
.cart-actions .btn.secondary { background: #e6e6e6; color: #111; }

/* ---------- forms ---------- */
input[type=text], input[type=number], input[type=search], input[type=date], select {
  background: #111; color: var(--text); border: 1.5px solid #444; border-radius: 9px; padding: 9px 11px; min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--orange); border-color: var(--orange); }
input[type=date] { color-scheme: dark; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; flex: 1; }
.field > span { font-weight: 700; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.check-row { display: flex; gap: 22px; margin: 12px 0; flex-wrap: wrap; }
.check-row input { width: 18px; height: 18px; vertical-align: middle; margin-right: 6px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.toolbar label { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.toolbar input[type=search] { min-width: 230px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 12px; overflow: hidden; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { background: #111; color: var(--orange); font-size: 13px; text-transform: uppercase; letter-spacing: .4px; }
.table.compact th, .table.compact td { padding: 7px 10px; }
.table .num { text-align: right; white-space: nowrap; }
.table tr.off td { opacity: .5; }
.table tfoot td { font-weight: 700; }
.table tfoot .grand td { font-size: 18px; color: var(--orange); }
.table td.actions { white-space: nowrap; text-align: right; }
.table td.actions .btn { margin-left: 4px; }
.items-cell { max-width: 380px; font-size: 14px; }
.table input { width: 100%; }
.edit-sizes input { padding: 7px 9px; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; }
.badge.completed { background: #164d31; color: #7ff0b1; }
.badge.pending { background: #5a4410; color: var(--yellow); }
.chip { display: inline-block; background: #333; border-radius: 8px; padding: 3px 8px; margin: 2px 2px 2px 0; font-size: 13px; }
.nocost { color: var(--yellow); }
.summary-line { margin: 4px 0 10px; color: var(--muted); }
.summary-line b { color: var(--text); }
.bar { height: 5px; background: #333; border-radius: 3px; margin-top: 4px; }
.bar span { display: block; height: 100%; background: var(--orange); border-radius: 3px; }

/* ---------- dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 12px 0; }
.stat { background: var(--panel); border-radius: var(--radius); padding: 14px 16px; border: 1px solid var(--line); }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.stat-value { font-size: 28px; font-weight: 900; margin: 4px 0; }
.stat-sub { font-size: 12px; color: var(--muted); }
.stat.orange { background: var(--orange); border-color: var(--orange); color: #111; }
.stat.orange .stat-label, .stat.orange .stat-sub { color: #3a1d06; }
.stat.alert { border-color: var(--yellow); }
.stat.alert .stat-value { color: var(--yellow); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.panel { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 16px; }
.panel h2 { margin: 4px 0 12px; font-size: 18px; color: var(--orange); }
.panel h3 { margin: 18px 0 8px; font-size: 16px; }
.note { background: #20262e; border-left: 4px solid #5aa9ff; padding: 10px 14px; border-radius: 8px; margin: 10px 0; font-size: 14px; line-height: 1.5; }
.note.warn { border-left-color: var(--yellow); background: #2e2814; }
.note.good { border-left-color: var(--green); background: #14281d; }
.warn-list li { margin-bottom: 5px; }

/* ---------- sub tabs ---------- */
.subtabs { display: flex; gap: 6px; border-bottom: 2px solid var(--line); margin: 8px 0 10px; flex-wrap: wrap; }
.subtab { background: none; color: var(--muted); border: 0; padding: 10px 16px; font-weight: 800; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; font-size: 15px; }
.subtab.active { color: var(--orange); border-bottom-color: var(--orange); }

/* ---------- switch ---------- */
.switch { position: relative; display: inline-block; width: 48px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #555; border-radius: 26px; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(22px); }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: var(--bg2); border: 1px solid var(--line); border-radius: 18px; width: 100%; max-width: 480px; max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.modal.wide { max-width: 820px; }
.modal.picker { max-width: 640px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal-x { background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-msg { font-size: 16px; line-height: 1.5; }
.pick-label { font-weight: 800; margin: 14px 0 8px; color: var(--orange-soft); }
.pick-label small { color: var(--muted); font-weight: 600; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.pick-grid.sizes { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.pick-btn { background: #fff; color: #111; border: 3px solid transparent; border-radius: 12px; padding: 14px 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 16px; }
.pick-btn.small { padding: 10px 6px; font-size: 14px; }
.pick-btn span { color: var(--orange-dark); font-weight: 800; }
.pick-btn.active { border-color: var(--orange); background: #ffe6d3; box-shadow: 0 0 0 2px #111 inset; }
.pick-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; gap: 12px; flex-wrap: wrap; }
.pick-total { font-size: 22px; font-weight: 900; color: var(--orange); }
.seg-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.detail-grid div { background: #111; border-radius: 10px; padding: 8px 10px; }
.detail-grid > div > span { display: block; font-size: 12px; color: var(--muted); }

/* ---------- toast ---------- */
#toast-root { position: fixed; top: 74px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #111; color: #fff; border-left: 5px solid var(--green); padding: 12px 18px; border-radius: 10px; font-weight: 700; box-shadow: 0 8px 30px rgba(0,0,0,.5); transition: opacity .3s; max-width: 90vw; }
.toast.err { border-left-color: var(--red); }
.toast.hide { opacity: 0; }

.fatal { max-width: 640px; margin: 80px auto; background: var(--bg2); padding: 30px; border-radius: 16px; border: 2px solid var(--red); line-height: 1.6; }

/* ---------- smaller laptop screens ---------- */
@media (max-width: 1280px) {
  .billing { grid-template-columns: 170px 1fr 350px; }
  .item-grid { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); }
  .tabs button { padding: 7px 10px; font-size: 14px; }
  .brand { min-width: 0; }
  .brand-sub { display: none; }
}
@media (max-width: 1050px) {
  .two-col { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
}

/* short screens (most laptops with the browser bar showing) */
@media (max-height: 720px) {
  .cart-head { padding: 6px 12px; }
  .cart-summary { padding: 6px 12px 10px; }
  .sum-row { padding: 1px 0; font-size: 14px; }
  .sum-row.total { font-size: 22px; padding-top: 3px; }
  .pay-methods { margin: 5px 0 2px; }
  .pay-methods button { padding: 7px 4px; }
  .cart-actions { gap: 6px; margin-top: 4px; }
  .cart-actions .btn { padding: 8px 10px; }
  .cart-actions .wide { padding: 11px; font-size: 17px; }
  .cat-btn { padding: 10px 10px; }
  .item-btn { min-height: 92px; }
}

/* ======================= Version 2 additions ======================= */
.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.login-box { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--orange);
  border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.login-box .brand.big { gap: 12px; }
.login-box .brand-logo { font-size: 40px; }
.login-shop { font-weight: 900; font-size: 24px; letter-spacing: .5px; text-transform: uppercase; }
.login-box .btn.wide { width: 100%; }
.conn { font-weight: 800; font-size: 13px; padding: 5px 10px; border-radius: 999px; white-space: nowrap; cursor: help; }
.conn.ok { background: rgba(47,191,113,.15); color: var(--green); border: 1px solid var(--green); }
.conn.warn { background: rgba(255,204,77,.12); color: var(--yellow); border: 1px solid var(--yellow); }
.conn.bad { background: var(--red); color: #fff; border: 1px solid var(--red); animation: conn-blink 1.2s infinite; }
@keyframes conn-blink { 50% { opacity: .65; } }
.user-box { display: flex; flex-direction: column; line-height: 1.1; text-align: right; max-width: 190px; }
.user-box b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-box small { color: var(--orange-soft); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.banner.bad { background: #5a1414; color: #fff; border-bottom-color: var(--red); }
.save-state { margin-top: 8px; padding: 8px 10px; border-radius: 10px; font-size: 13px; line-height: 1.35; }
.save-state.ok { background: rgba(47,191,113,.12); border: 1px solid var(--green); color: #c9f5dc; }
.save-state.warn { background: rgba(255,204,77,.12); border: 1px solid var(--yellow); color: #ffe9a8; }
.save-state.bad { background: #4a1212; border: 2px solid var(--red); color: #fff; }
.save-state .seg-row { margin-top: 8px; }
.offline-warn { background: #4a1212; border: 1px solid var(--red); color: #fff; border-radius: 10px; padding: 6px 10px; font-size: 13px; font-weight: 700; margin: 6px 0; }
.badge.cancelled, .badge.refunded { background: #555; color: #eee; }
.toast.warn { border-left-color: var(--yellow); }
/* Keep the top bar on one line on 1366-pixel laptop screens. */
@media (max-width: 1500px) {
  .topbar { gap: 10px; padding: 6px 12px; }
  .brand { min-width: 0; }
  #brand-name { font-size: 16px; }
  .brand-logo { font-size: 26px; }
  .tabs { gap: 2px; flex-wrap: nowrap; }
  .tabs button { padding: 7px 9px; font-size: 13.5px; white-space: nowrap; }
  .top-right { gap: 8px; }
  .user-box b { display: none; }
  .help-link .help-word { display: none; }
  .clock { font-size: 15px; }
}
