/* Painel do restaurante. Sem etapa de build: o navegador carrega este arquivo e js/main.js direto. */
:root {
  --red: #de1d22; --red-press: #b9151a; --red-soft: #fde6e6; --red-ink: #b3151a;
  --green: #0f7f3f; --green-ink: #0b6e36; --green-soft: #e3f2e8;
  --amber: #b45309; --amber-soft: #fff1dc;
  --page: #f4f2ec; --bg: #fbfaf7; --card: #fff; --surface: #f0eee8; --fg: #3b3832; --title: #171614; --muted: #66625a; --line: #e3e0d8; --line-strong: #8c877c;
  --shadow: 0 1px 2px rgba(23, 22, 20, .05), 0 8px 24px rgba(23, 22, 20, .06);
  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bar: 64px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --red-soft: #3a1518; --red-ink: #ff8a8d; --green: #34a465; --green-ink: #81c995; --green-soft: #1e3a28; --amber: #f6b25b; --amber-soft: #3a2a10;
    --page: #121211; --bg: #1a1a18; --card: #222220; --surface: #2b2b28; --fg: #d8d6d0; --title: #f5f4f0; --muted: #a3a097; --line: #34332f; --line-strong: #77746b;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { font: 500 15px/1.45 var(--font); letter-spacing: -.01em; background: var(--page); color: var(--fg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.2; color: var(--title); }
h2 { font-size: 20px; color: var(--title); }
a { color: var(--red-ink); }
.muted { color: var(--muted); font-size: 13px; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* botões */
button, .btn-link { font: inherit; font-weight: 600; letter-spacing: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border: 1px solid transparent; border-radius: 12px; cursor: pointer; text-decoration: none; transition: background-color .15s, transform .1s; }
button:active, .btn-link:active { transform: scale(.98); }
button:disabled { opacity: .5; pointer-events: none; }
.primary { background: var(--red); color: #fff; }
.primary:hover { background: var(--red-press); }
.outline { background: transparent; color: var(--title); border-color: var(--line-strong); }
.outline:hover { background: var(--surface); }
.ghost { background: transparent; color: var(--title); }
.ghost:hover { background: var(--surface); }
.ghost.icon { padding: 0; width: 44px; }
.danger { background: transparent; color: var(--red-ink); border-color: var(--line-strong); }
.danger:hover { background: var(--red-soft); }
.block { width: 100%; }
.grow { flex: 1; }
.btn-link.primary { color: #fff; }

/* campos */
label { display: grid; gap: 6px; font-weight: 600; font-size: 13px; color: var(--muted); }
label small { font-weight: 500; color: var(--muted); }
input { font: inherit; letter-spacing: inherit; font-weight: 500; height: 48px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--card); color: var(--title); width: 100%; }
input:focus-visible { outline: 2px solid var(--red); outline-offset: 0; border-color: var(--red); }
input[readonly] { background: var(--surface); }
.form { display: grid; gap: 14px; margin-top: 18px; }
.form-msg { padding: 10px 14px; border-radius: 10px; background: var(--red-soft); color: var(--red-ink); font-size: 14px; }

/* abas e seleção */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 22px; padding: 4px; border-radius: 12px; background: var(--surface); }
.tabs button, .seg button { background: transparent; color: var(--muted); min-height: 40px; padding: 0 14px; font-weight: 600; border-radius: 9px; }
.tabs button[aria-selected="true"], .seg button[aria-checked="true"] { background: var(--card); color: var(--title); border-color: var(--line-strong); }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface); }
.seg button { flex: 1; white-space: nowrap; padding: 0 8px; }

/* entrar */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(440px, 100%); padding: 28px; border-radius: 20px; background: var(--bg); border: 1px solid var(--line); box-shadow: var(--shadow); }
.auth-card img { display: block; width: 56px; height: 56px; border-radius: 14px; margin-bottom: 16px; }
.auth-card .muted { margin-top: 6px; font-size: 15px; }

/* barra de cima */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; min-height: var(--bar); padding: 8px 20px; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.brand div { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand strong { color: var(--title); font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav button { background: transparent; color: var(--muted); min-height: 40px; }
.nav button[aria-current="page"] { background: var(--surface); color: var(--title); }
.bar-actions { margin-left: auto; display: flex; gap: 8px; }

/* agora */
.now { flex: 1; display: flex; flex-direction: column; padding: 16px 20px 20px; gap: 14px; min-height: 0; }
.banner { padding: 10px 14px; border-radius: 10px; background: var(--amber-soft); color: var(--amber); font-size: 14px; }
.chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip { display: flex; align-items: baseline; gap: 8px; padding: 8px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.chip b { font-size: 22px; color: var(--title); line-height: 1; }
.chip span { font-size: 13px; color: var(--muted); }
.split { flex: 1; display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 16px; min-height: 0; }
.list-wrap { order: 0; display: flex; flex-direction: column; min-height: 0; overflow: auto; max-height: calc(100dvh - var(--bar) - 150px); }
.map { order: 1; position: relative; border-radius: 16px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); min-height: 420px; }
.map .gmap { position: absolute; inset: 0; }
.map-note { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.updated { margin-top: 12px; }

/* cartão do entregador */
.cr { padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); cursor: pointer; }
.cr[aria-current="true"] { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.cr-head { display: flex; align-items: center; gap: 12px; }
.avatar { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface); color: var(--title); font-weight: 700; border: 3px solid var(--line-strong); }
.cr.live .avatar, .pin.live { border-color: var(--green); }
.cr.stale .avatar, .pin.stale { border-color: #e0a233; }
.cr-main { min-width: 0; flex: 1; }
.cr-name { color: var(--title); font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; gap: 6px; margin-top: 2px; padding: 1px 10px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 600; }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.live { background: var(--green-soft); color: var(--green-ink); }
.badge.stale { background: var(--amber-soft); color: var(--amber); }
.cr-detail { margin-top: 8px; font-size: 13px; color: var(--muted); }
.orders { list-style: none; margin: 10px 0 0; padding: 0; border-top: 1px solid var(--line); }
.orders li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.orders li:last-child { border-bottom: 0; }
.code { flex: none; padding: 2px 8px; border: 1.5px dashed var(--line-strong); border-radius: 8px; font-weight: 700; color: var(--title); font-variant-numeric: tabular-nums; }
.orders .what { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.orders .when { font-size: 12px; color: var(--muted); white-space: nowrap; }
.st { flex: none; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; background: var(--surface); color: var(--muted); }
.st.delivering { background: var(--red-soft); color: var(--red-ink); }
.st.done { background: var(--green-soft); color: var(--green-ink); }
.cr-actions { margin-top: 10px; display: flex; justify-content: flex-end; }
.cr-actions button { min-height: 36px; padding: 0 12px; font-size: 13px; }
.empty { padding: 28px 16px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 16px; color: var(--muted); }
.empty b { display: block; margin-bottom: 4px; color: var(--title); font-size: 16px; }

/* marcador no mapa */
.pin { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--card); color: var(--title); font: 700 13px var(--font); border: 3px solid var(--line-strong); box-shadow: 0 2px 8px rgba(0, 0, 0, .3); cursor: pointer; }
.pin.sel { transform: scale(1.2); }

/* histórico */
.history { flex: 1; padding: 20px; max-width: 1100px; width: 100%; margin: 0 auto; }
.history-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.history .seg { width: auto; }
.table-wrap { overflow: auto; border-radius: 16px; border: 1px solid var(--line); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 14px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
th { position: sticky; top: 0; background: var(--card); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }

/* janelas */
.dlg { width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--bg); color: var(--fg); box-shadow: 0 24px 64px rgba(0, 0, 0, .35); overflow: auto; }
.dlg::backdrop { background: rgba(23, 22, 20, .5); }
.dlg.small { width: min(420px, calc(100vw - 24px)); }
.dlg h2 { font-size: 22px; }
.dlg-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.dlg-head > div { flex: 1; }
.dlg-head .muted { margin-top: 6px; font-size: 14px; line-height: 1.45; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.opt-title { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.inv-result { margin-top: 16px; display: grid; gap: 8px; }
.inv-result input { font-weight: 600; font-size: 14px; }
.row { display: flex; gap: 8px; }
.row.end { justify-content: flex-end; margin-top: 18px; }
.sub-title { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 16px; color: var(--title); }
.inv-list { list-style: none; margin: 8px 0 0; padding: 0; }
.inv-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.inv-list li:last-child { border-bottom: 0; }
.inv-list .what { flex: 1; font-weight: 600; font-size: 14px; }
.inv-list .what small { display: block; font-weight: 500; color: var(--muted); font-size: 13px; }
.inv-list button { min-height: 36px; padding: 0 12px; font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 12px; background: var(--title); color: var(--bg); font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }

/* celular e tablet pequeno: mapa em cima, lista embaixo */
@media (max-width: 860px) {
  .bar { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .nav { order: 3; width: 100%; margin: 0; }
  .nav button { flex: 1; }
  .bar-actions button span { display: none; }
  #btn-invite span { display: inline; }
  .now { padding: 12px; }
  .split { grid-template-columns: 1fr; }
  .map { order: 0; min-height: 300px; height: 38dvh; }
  .list-wrap { order: 1; max-height: none; overflow: visible; }
  .opts { grid-template-columns: 1fr; }
  .history { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
