/* TopReach Desk: the Topreach POS look (owner 26 Nov: white mode, like our POS, nice large buttons).
   Warm light background, soft white rounded cards, pastel tiles with the chosen one dark, big clear rounded buttons. Light only. */
:root {
  --bg: #f4f3f0; --card: #ffffff; --edge: #e8e5df; --ink: #1d1b18; --muted: #6a645b; --soft: #f8f7f4;
  --brand: #1d5fbf; --brand-ink: #ffffff; --brand-soft: #e6eefa;
  --p1: #f9e1d3; --p2: #dde8f6; --p3: #e3eed2; --p4: #ebe2f4; --p5: #f6ecc8; --p6: #dcebed; --p7: #ece7e1;
  --warn: #8a5200; --warn-soft: #fdf0d8; --bad: #b42318; --bad-soft: #fde7e4; --ok: #1b7a43;
  --shadow: 0 1px 2px rgba(20, 18, 15, .06), 0 2px 8px rgba(20, 18, 15, .04);
  --shadow-up: 0 2px 10px rgba(20, 18, 15, .16);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
[hidden] { display: none !important; }

/* cards and buttons */
.card { background: var(--card); border: 1px solid var(--edge); border-radius: 20px; box-shadow: var(--shadow); }
.btn { min-height: 56px; padding: 12px 22px; border-radius: 16px; border: 1px solid var(--edge); background: var(--card); box-shadow: var(--shadow);
  font-weight: 700; font-size: 17px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: var(--ink); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { color: var(--bad); border-color: #f1c4be; background: var(--bad-soft); }
.btn.big { min-height: 68px; border-radius: 18px; font-size: 19px; width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
input[type=text], input[type=email], input[type=password], input[type=search], textarea {
  width: 100%; min-height: 56px; padding: 12px 16px; border: 1px solid var(--edge); border-radius: 16px; background: var(--card); box-shadow: var(--shadow); font-size: 17px; }
textarea { min-height: 90px; resize: vertical; }
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
label, .label { display: block; font-weight: 700; font-size: 14px; margin: 0 0 8px; color: var(--muted); }
.error { color: var(--bad); background: var(--bad-soft); padding: 12px 16px; border-radius: 14px; margin-top: 14px; font-weight: 600; }

/* sign in */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.signin .card { width: 100%; max-width: 420px; padding: 32px; }
.signin label { margin-top: 18px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 20px; letter-spacing: -.01em; }
.brand img { width: 36px; height: 36px; border-radius: 10px; }

/* top bar */
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); display: flex; align-items: center; gap: 12px; padding: 14px 20px; }
.top .grow { flex: 1; }
.top nav { display: flex; gap: 8px; background: var(--card); border: 1px solid var(--edge); border-radius: 18px; padding: 6px; box-shadow: var(--shadow); }
.tab { min-height: 48px; padding: 8px 20px; border-radius: 14px; border: 0; background: transparent; font-weight: 700; font-size: 16px; color: var(--muted); }
.tab[aria-current="page"] { background: var(--ink); color: #fff; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--edge); font-size: 14px; font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--ok); }
.dot.bad { background: var(--bad); }

/* tiles (callers, restaurants) and chips */
.tiles { display: flex; gap: 10px; flex-wrap: wrap; }
.tile { min-height: 60px; min-width: 150px; padding: 10px 18px; border: 0; border-radius: 14px; box-shadow: var(--shadow); font-weight: 700; font-size: 16px; text-align: left; color: var(--ink); display: flex; flex-direction: column; justify-content: center; }
.tile small { font-weight: 500; font-size: 13px; color: var(--muted); }
.tile.p1 { background: var(--p1); } .tile.p2 { background: var(--p2); } .tile.p3 { background: var(--p3); } .tile.p4 { background: var(--p4); }
.tile.p5 { background: var(--p5); } .tile.p6 { background: var(--p6); } .tile.p0 { background: var(--p7); }
.tile[aria-pressed="true"] { background: var(--ink); color: #fff; box-shadow: var(--shadow-up); }
.tile[aria-pressed="true"] small { color: #d6d2cb; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { min-height: 48px; padding: 8px 18px; border-radius: 14px; border: 1px solid var(--edge); background: var(--card); box-shadow: var(--shadow); font-weight: 700; font-size: 15px; color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* call-center desk: queue | who's calling | open order */
.desk { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; padding: 0 16px 16px; height: calc(100vh - 80px); }
.desk.open { grid-template-columns: 340px minmax(0, 1fr) minmax(400px, 520px); }
.col { overflow-y: auto; overflow-x: hidden; min-height: 0; padding: 2px 4px 24px; }
.col h2 { margin: 6px 0 12px; font-size: 22px; letter-spacing: -.01em; }
.page { padding: 4px 20px 40px; max-width: 1400px; margin: 0 auto; }
.segs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; background: var(--card); border: 1px solid var(--edge); border-radius: 18px; padding: 6px; box-shadow: var(--shadow); }
.seg { min-height: 64px; border: 0; border-radius: 14px; background: transparent; font-weight: 700; font-size: 14px; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.seg b { font-size: 22px; color: var(--ink); }
.seg.hot b { color: var(--bad); }
.seg[aria-pressed="true"] { background: var(--ink); color: #d6d2cb; }
.seg[aria-pressed="true"] b { color: #fff; }
.qlist, .results { display: grid; gap: 10px; margin-top: 12px; }
.calm { padding: 28px 16px; text-align: center; color: var(--muted); font-weight: 600; background: var(--card); border: 1px dashed var(--edge); border-radius: 18px; }
.callers { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.desk.open .callers { grid-template-columns: 1fr 1fr; }
.callers .tile { min-height: 72px; font-size: 18px; justify-content: center; align-items: center; text-align: center; }
.findby { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 10px; }
.lookup-row { display: flex; gap: 10px; margin-bottom: 10px; }
input.lookup { min-height: 72px; font-size: 24px; font-weight: 600; border-radius: 18px; padding: 12px 20px; border-width: 2px; }
input.lookup:focus { border-color: var(--brand); }
.chip.on-dark { background: var(--brand); border-color: var(--brand); color: #fff; }
.tiles { margin-top: 10px; }
.count { font-weight: 700; color: var(--muted); }

/* order cards (queue and results) */
.ocard { display: block; width: 100%; text-align: left; padding: 14px 16px; background: var(--card); color: var(--ink); border: 1px solid var(--edge); border-radius: 18px; box-shadow: var(--shadow); min-height: 64px; }
.ocard:hover { border-color: #cfc9bf; }
.ocard.sel { outline: 3px solid var(--ink); outline-offset: -1px; }
.ocard.problem { border-left: 6px solid var(--bad); }
.ocard-top { display: flex; justify-content: space-between; align-items: baseline; }
.ocard .num { font-weight: 800; font-size: 18px; }
.ocard .total { font-weight: 800; font-size: 17px; }
.ocard .who { font-weight: 700; font-size: 17px; margin-top: 2px; }
.ocard .sub { font-size: 14px; color: var(--muted); }
.ocard-tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.status { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--p7); }
.status.s-ready, .status.s-completed, .status.s-delivered { background: var(--p3); }
.status.s-pending, .status.s-confirmed, .status.s-preparing { background: var(--p5); }
.status.s-out_for_delivery, .status.s-drv { background: var(--p2); }
.status.s-cancelled { background: var(--bad-soft); color: var(--bad); }
.flag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; background: var(--warn-soft); color: var(--warn); }
.flag.bad { background: var(--bad-soft); color: var(--bad); }
.empty { padding: 48px 16px; text-align: center; color: var(--muted); font-weight: 600; }

/* the open order */
.work .card { margin: 0 0 12px; padding: 16px 18px; }
.work .card.alert { border: 2px solid #f1c4be; }
.workhead { position: sticky; top: 0; z-index: 1; background: var(--bg); display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0 12px; }
.workhead h2 { margin: 0; font-size: 26px; }
.bigname { font-size: 20px; font-weight: 800; }
.callcard { margin-top: 14px; padding: 16px 18px; }
.callcard h3 { margin: 0 0 4px; font-size: 18px; }
.callcard textarea { margin-top: 12px; }
tr.link { cursor: pointer; }
tr.link:hover { background: var(--soft); }

/* order panel */
.shade { position: fixed; inset: 0; background: rgba(29, 27, 24, .18); z-index: 9; }
.panel { position: fixed; top: 12px; right: 12px; bottom: 12px; width: min(560px, calc(100% - 24px)); background: var(--bg); border-radius: 24px; box-shadow: 0 8px 40px rgba(20, 18, 15, .22); z-index: 10; overflow-y: auto; }
.panel header { position: sticky; top: 0; z-index: 1; background: var(--bg); padding: 16px 18px; display: flex; align-items: center; gap: 10px; }
.panel header h2 { margin: 0; font-size: 22px; flex: 1; letter-spacing: -.01em; }
.panel .card { margin: 0 14px 12px; padding: 16px 18px; }
.panel h3 { margin: 0 0 10px; font-size: 14px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.stack { display: grid; gap: 10px; margin-top: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.driver { display: flex; gap: 14px; align-items: center; }
.driver img { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; background: var(--soft); }
.driver strong { font-size: 18px; }
.reasons { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--bad-soft); color: var(--bad); font-weight: 700; }
.reasons p { margin: 2px 0; }
.lines { list-style: none; padding: 0; margin: 12px 0; }
.lines li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--edge); }
.grand { display: flex; justify-content: space-between; font-size: 20px; font-weight: 800; }
.note { padding: 10px 0; border-bottom: 1px dashed var(--edge); }
.note:last-of-type { border-bottom: 0; }
.off { padding: 12px 14px; border-radius: 14px; background: var(--soft); color: var(--muted); font-weight: 600; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 14px 20px; border-radius: 16px; z-index: 20; font-weight: 700; max-width: calc(100% - 32px); }
.list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); margin-top: 8px; }
.list .card { padding: 18px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--edge); }
th { font-size: 13px; color: var(--muted); text-transform: uppercase; }

@media (max-width: 1250px) {
  .desk.open { grid-template-columns: 300px minmax(0, 1fr); }
  .desk.open .work { position: fixed; top: 12px; right: 12px; bottom: 12px; width: min(540px, calc(100% - 24px)); background: var(--bg); border-radius: 24px; box-shadow: 0 8px 40px rgba(20, 18, 15, .22); z-index: 10; padding: 0 16px 24px; }
}
@media (max-width: 860px) {
  .desk, .desk.open { grid-template-columns: 1fr; height: auto; }
  .col { overflow: visible; }
  .queue { order: 2; }
  .callers { grid-template-columns: 1fr 1fr; }
  .top { flex-wrap: wrap; }
  .hide-sm { display: none; }
}
