/* Rangoê Manager 2.0 — shell e componentes de gestão sobre o Design System (ds/tokens.css, ds/components.css).
   Tema claro por padrão, escuro opcional (data-theme). Também mapeia as variáveis/classes antigas usadas por
   bi.js, payments.js e floor.js, para os módulos seguirem funcionando sem reescrita. */
:root {
  --muted: var(--text-2); --panel: var(--surface); --panel2: var(--surface-2); --brand2: var(--info); --warn: var(--warning);
  --side-w: 248px; --top-h: 60px;
}
html, body { min-height: 100%; }
body { background: var(--bg); }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---- login (auth.js) */
.auth-pending > .app-shell, .auth-pending .top, .auth-pending .layout { display: none; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; background: var(--bg); }
.login-intro { padding: 7vw; display: flex; flex-direction: column; justify-content: space-between; gap: var(--s-6);
  background: linear-gradient(160deg, var(--brand) 0%, var(--brand-strong) 100%); color: var(--brand-ink); }
.login-intro .muted { color: color-mix(in srgb, var(--brand-ink) 82%, transparent); }
.login-intro h1 { font: 800 clamp(40px, 5.5vw, 72px)/.98 var(--font); margin: 16px 0; letter-spacing: -.02em; }
.login-eyebrow { font-weight: 800; text-transform: uppercase; letter-spacing: .1em; font-size: 13px; }
.login-intro .brand .mark { background: var(--brand-ink); color: var(--brand); }
.login-panel { align-self: center; justify-self: center; width: min(420px, 92%); padding: var(--s-6); box-shadow: var(--e-3); }
.login-panel h2 { font: var(--t-page); margin: 0 0 var(--s-2); }
.login-panel label { display: block; margin: var(--s-4) 0 6px; font-weight: 600; font-size: 14px; }
.login-panel .input { width: 100%; }
.login-panel .btn { width: 100%; margin-top: var(--s-4); }
.login-contact { margin-top: var(--s-5); font-size: 13px; }
#login-error { color: var(--danger); min-height: 20px; margin: var(--s-3) 0 0; font-weight: 600; }

/* ---- shell */
.top { height: var(--top-h); display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: 0 var(--s-4);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 800; }
.mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); font-weight: 900; }
.top-actions { display: flex; gap: var(--s-2); align-items: center; }
.top .badge { padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r-pill); color: var(--text-2); font-size: 12.5px; background: var(--surface); }
.statusdot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); display: inline-block; margin-right: 6px; }
.icon-btn { width: 44px; padding: 0; }
.menu-btn { display: none; width: 44px; padding: 0; }
.layout { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: calc(100vh - var(--top-h)); }
.side { border-right: 1px solid var(--line); padding: var(--s-3); position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); overflow: auto; background: var(--surface); }
.nav-group { margin: var(--s-2) 0 var(--s-3); }
.nav-title { padding: 4px 12px; color: var(--text-3); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.nav button { width: 100%; display: flex; gap: 12px; align-items: center; border: 0; background: transparent; color: var(--text-2); text-align: left;
  padding: 9px 12px; border-radius: var(--r-button); cursor: pointer; font-weight: 600; min-height: 40px; }
.nav button:hover { background: var(--surface-2); color: var(--text); }
.nav button.active { background: var(--brand-soft); color: var(--brand-strong); }
.main { padding: var(--s-5) clamp(16px, 2.5vw, 32px) var(--s-7); max-width: 1600px; width: 100%; margin: 0 auto; outline: none; }
.screen { display: none; } .screen.active { display: block; animation: ds-in var(--d-base) var(--ease); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s-4); margin-bottom: var(--s-5); flex-wrap: wrap; }
.page-head h1 { font: var(--t-page); margin: 2px 0 4px; }
.eyebrow { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--brand-strong); font-weight: 800; }
.nav-backdrop { display: none; }

/* ---- building blocks (also the legacy names used by bi/payments/floor modules) */
.grid { display: grid; gap: var(--s-4); }
.kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card.pad, .grid > .card, .kpi { padding: var(--s-4); }
.card { box-shadow: var(--e-1); }
.kpi .label { color: var(--text-2); font-size: 13px; font-weight: 600; }
.kpi .num { font: var(--t-kpi); margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .trend { font-size: 12.5px; color: var(--text-3); margin-top: 6px; }
.kpi .trend.up { color: var(--success); } .kpi .trend.down { color: var(--danger); }
.section-title { font: var(--t-card); font-weight: 700; margin: 0 0 var(--s-3); }
.list { display: flex; flex-direction: column; gap: var(--s-2); }
.item { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r-button); background: var(--surface); }
.item-title { font-weight: 700; }
.row { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.empty { padding: var(--s-6) var(--s-4); text-align: center; color: var(--text-2); border: 1px dashed var(--line); border-radius: var(--r-card); }
.pill { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: var(--r-pill); font-size: 12px; font-weight: 700; background: var(--success-soft); color: var(--success); white-space: nowrap; }
.pill.warn { background: var(--warning-soft); color: var(--warning); } .pill.red { background: var(--danger-soft); color: var(--danger); }
.pill.blue { background: var(--info-soft); color: var(--info); } .pill.purple { background: var(--brand-soft); color: var(--brand-strong); }
.pill.gray { background: var(--neutral-soft); color: var(--neutral); }
.btn { border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 0 var(--s-4); border-radius: var(--r-button);
  cursor: pointer; font-weight: 600; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:hover:not([disabled]) { background: var(--surface-2); }
.btn.primary, .btn.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover:not([disabled]) { background: var(--brand-strong); }
.btn.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn.ghost, .btn.btn-ghost { background: transparent; border-color: transparent; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.input, select.input, textarea.input { background: var(--surface); border: 1px solid var(--line); color: var(--text); border-radius: var(--r-input); padding: 9px 11px; min-height: 40px; }
.input:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.table-wrap { overflow: auto; border-radius: var(--r-card); }
.data-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.data-table th, .data-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table th { font-size: 11.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; background: var(--surface-2); position: sticky; top: 0; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.health { display: inline-flex; gap: 8px; align-items: center; }
.health-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); } .health-dot.warn { background: var(--warning); } .health-dot.off { background: var(--danger); }
.tabs { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--line); margin-bottom: var(--s-4); overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 10px 14px; font-weight: 700; color: var(--text-2); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--brand); }
.toolbar { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; margin-bottom: var(--s-3); }
.toolbar .sp { flex: 1; }
.alert-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--warning-soft); color: var(--warning); font-weight: 800; }
.alert-ic.red { background: var(--danger-soft); color: var(--danger); } .alert-ic.blue { background: var(--info-soft); color: var(--info); }
.item .grow { flex: 1; min-width: 0; }
.kanban { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }

/* BI on the light theme: the module's palette was tuned for dark, lift the low end */
:root:not([data-theme="dark"]) .bi { --grid: var(--line); --prev: #8b857e; --seq-0: #eef3fb; --seq-1: #cfe0f7; --seq-2: #9cc1ef; --seq-3: #5e98e3; --seq-4: #2f74d0; --seq-5: #1c56a8; }

@media (max-width: 1100px) { .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .menu-btn { display: inline-flex; }
  .side { position: fixed; top: var(--top-h); left: 0; bottom: 0; height: auto; width: min(300px, 86vw); z-index: 45; translate: -105% 0; transition: translate var(--d-base) var(--ease); box-shadow: var(--e-3); }
  .nav-open .side { translate: 0 0; }
  .nav-open .nav-backdrop { display: block; position: fixed; inset: var(--top-h) 0 0 0; background: var(--overlay); z-index: 44; }
  .cols-2, .cols-3, .kanban { grid-template-columns: 1fr; }
  .top .badge.optional, .brand-name { display: none; }
  .login-shell { grid-template-columns: 1fr; } .login-intro { display: none; } .login-panel { margin: auto; }
}
@media (max-width: 480px) { .kpis { grid-template-columns: 1fr 1fr; } .top-actions #session-label { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } }

/* ---- editor de cardápio (menu-editor.js) */
.me-grid { display: grid; grid-template-columns: 240px minmax(0, 1.2fr) minmax(320px, 1fr); gap: var(--s-4); align-items: start; }
.me-cats, .me-list, .me-edit { padding: var(--s-3); }
.me-edit { position: sticky; top: calc(var(--top-h) + 16px); max-height: calc(100vh - var(--top-h) - 32px); overflow: auto; }
.me-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s-2); margin-bottom: var(--s-3); }
.me-head .input { flex: 1; }
.me-cat { display: flex; align-items: center; gap: 4px; width: 100%; border-radius: var(--r-button); }
.me-cat > button, button.me-cat { flex: 1; display: flex; justify-content: space-between; gap: 8px; border: 0; background: transparent; padding: 9px 10px; border-radius: var(--r-button); cursor: pointer; font-weight: 600; color: var(--text); text-align: left; }
.me-cat.on, .me-cat.on > button { background: var(--brand-soft); color: var(--brand-strong); }
.me-cat.off { opacity: .55; }
.me-ord { display: inline-flex; gap: 2px; } .me-ord button { width: 28px; height: 28px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; cursor: pointer; }
.me-ord button[disabled] { opacity: .3; cursor: default; }
.me-row { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2); border-radius: var(--r-button); cursor: pointer; border: 1px solid transparent; }
.me-row:hover { background: var(--surface-2); } .me-row.on { border-color: var(--brand); background: var(--brand-soft); } .me-row.off { opacity: .6; }
.me-row img, .me-ph { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; flex: none; }
.me-ph { display: grid; place-items: center; background: var(--surface-2); color: var(--text-3); font-weight: 800; font-size: 18px; } .me-ph.lg { width: 72px; height: 72px; font-size: 26px; }
.me-row .grow { display: grid; gap: 2px; } .me-row .grow .muted { font-size: 12.5px; }
.me-price { font-weight: 800; font-variant-numeric: tabular-nums; display: grid; text-align: right; } .me-price .muted { font-size: 11px; font-weight: 600; }
.me-so { border: 1px solid var(--line); background: var(--success-soft); color: var(--success); font-weight: 700; font-size: 12px; padding: 5px 9px; border-radius: var(--r-pill); cursor: pointer; white-space: nowrap; }
.me-so.on { background: var(--danger-soft); color: var(--danger); }
.me-preview { display: flex; gap: var(--s-3); padding: var(--s-3); border-radius: var(--r-card); background: var(--surface-2); align-items: center; }
.me-preview img { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; } .me-preview > div { display: grid; gap: 2px; }
.me-fs { border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--s-3); margin: 0; display: grid; gap: 8px; } .me-fs legend { font-weight: 700; padding: 0 6px; }
.me-off { opacity: .6; }
@media (max-width: 1280px) { .me-grid { grid-template-columns: 200px minmax(0, 1fr); } .me-edit { grid-column: 1 / -1; position: static; max-height: none; } }
@media (max-width: 760px) { .me-grid { grid-template-columns: 1fr; } }

/* ---- fixes: specificity of the menu button, no horizontal overflow on phones */
.top .menu-btn { display: none; }
@media (max-width: 860px) { .top .menu-btn { display: inline-flex; } }
.layout > .main, .grid > *, .kpi { min-width: 0; }
.kpi .num { font-size: clamp(22px, 2.2vw + 8px, 30px); overflow-wrap: anywhere; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.nav button { font-size: 14.5px; }
.me-head .row { flex-wrap: nowrap; }
@media (max-width: 480px) { .main { padding: var(--s-4) var(--s-4) var(--s-7); } .page-head .row .btn { flex: 1; } }
@media (max-width: 480px) { .kpi .num { white-space: nowrap; overflow-wrap: normal; font-size: clamp(18px, 5.2vw, 26px); } }

/* linha do tempo do pedido */
.tl { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 60vh; overflow: auto; }
.tl li { display: flex; gap: 10px; align-items: baseline; padding: 8px 10px; border-left: 3px solid var(--line); background: var(--surface-2); border-radius: 0 10px 10px 0; }
.tl li.bad { border-left-color: var(--danger); background: var(--danger-soft); }
.tl-t { font-variant-numeric: tabular-nums; color: var(--text-3); font-size: 12.5px; min-width: 64px; }

.me-al { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.me-al-i { display: grid; gap: 2px; font-size: 12.5px; color: var(--text-2); } .me-al-i .input { min-height: 34px; padding: 4px 8px; }
