/* Central de Entregas — design system (sem build). Mobile-first, 320px → 1440px. */
:root {
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #f0f2f5; --border: #e2e5ea;
  --text: #16191f; --muted: #5d6573; --brand: #0f6b5c; --brand-ink: #ffffff; --brand-soft: #e3f3ef;
  --success: #1f7a3d; --success-soft: #e4f4e9; --danger: #b42318; --danger-soft: #fdecea;
  --warning: #b54708; --warning-soft: #fef0e1; --info: #1d4ed8; --info-soft: #e8efff;
  --pending: #8a5a00; --pending-soft: #fff6db;
  --radius: 14px; --radius-sm: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --focus: 0 0 0 3px rgba(15,107,92,.35);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216; --surface: #171b21; --surface-2: #1e232b; --border: #2a313b; --text: #eef1f5; --muted: #9aa4b2;
    --brand: #3fb59f; --brand-ink: #06231d; --brand-soft: #12302a; --success: #4cc27a; --success-soft: #12301f;
    --danger: #ff7b6e; --danger-soft: #3a1714; --warning: #f5a35c; --warning-soft: #3a2511; --info: #7aa2ff; --info-soft: #172341;
    --pending: #f2c94c; --pending-soft: #33290d; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1216; --surface: #171b21; --surface-2: #1e232b; --border: #2a313b; --text: #eef1f5; --muted: #9aa4b2;
  --brand: #3fb59f; --brand-ink: #06231d; --brand-soft: #12302a; --success: #4cc27a; --success-soft: #12301f;
  --danger: #ff7b6e; --danger-soft: #3a1714; --warning: #f5a35c; --warning-soft: #3a2511; --info: #7aa2ff; --info-soft: #172341;
  --pending: #f2c94c; --pending-soft: #33290d; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 var(--font); background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: var(--brand); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: .875rem; } .mono { font-family: ui-monospace, Consolas, monospace; }
.right { text-align: right; } .center { text-align: center; } .nowrap { white-space: nowrap; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; padding: 16px 16px 96px; }
.container { max-width: 1120px; margin: 0 auto; }
.narrow { max-width: 560px; margin: 0 auto; }
.topbar { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 16px; }
.topbar .title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.topbar .title h1 { overflow-wrap: anywhere; }
.topbar > .row { flex-wrap: nowrap; flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 800; }
.grid { display: grid; gap: 16px; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* Sidebar (admin) e navegação inferior (comércio/motoboy) */
.sidebar { display: none; width: 248px; background: var(--surface); border-right: 1px solid var(--border); padding: 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 500; }
.sidebar nav a:hover { background: var(--surface-2); }
.sidebar nav a.active { background: var(--brand-soft); color: var(--brand); }
.sidebar .group { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 12px 6px; }
@media (min-width: 1024px) { .sidebar { display: block; } .main { padding: 24px 32px 48px; } .has-bottomnav .main { padding-bottom: 48px; } }
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); display: grid; grid-template-columns: repeat(5, 1fr); z-index: 40; padding-bottom: env(safe-area-inset-bottom); }
.bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 10px; font-size: .72rem; color: var(--muted); text-decoration: none; min-height: 56px; justify-content: center; }
.bottomnav a.active { color: var(--brand); font-weight: 600; }
.bottomnav svg, .sidebar svg { width: 22px; height: 22px; flex-shrink: 0; }
.admin-mobile-nav { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px; }
.admin-mobile-nav a { flex-shrink: 0; padding: 8px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: .875rem; }
.admin-mobile-nav a.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
@media (min-width: 1024px) { .admin-mobile-nav { display: none; } .bottomnav.desktop-hide { display: none; } }

/* Cartões */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.card.tight { padding: 12px; }
.card-link { text-decoration: none; color: inherit; display: block; }
.card-link:hover { border-color: var(--brand); }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; }
.stat .hint { font-size: .8rem; color: var(--muted); }
.hero-amount { font-size: 2rem; font-weight: 800; }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; border-radius: 12px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; background: var(--surface-2); color: var(--text); }
.btn:hover { filter: brightness(.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-outline { background: transparent; border-color: var(--border); }
.btn-ghost { background: transparent; }
.btn-lg { min-height: 56px; font-size: 1.05rem; border-radius: 14px; padding: 14px 20px; }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .875rem; border-radius: 10px; }

/* Formulários */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: .9rem; }
.field .hint { color: var(--muted); font-size: .8rem; }
.input, select.input, textarea.input { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; }
textarea.input { min-height: 88px; resize: vertical; }
.input:focus { border-color: var(--brand); box-shadow: var(--focus); outline: none; }
.input.is-invalid { border-color: var(--danger); }
.error-text { color: var(--danger); font-size: .82rem; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { width: 20px; height: 20px; margin-top: 2px; }
.pin-input { font-size: 2rem; letter-spacing: .5em; text-align: center; font-weight: 700; }
fieldset { border: 0; padding: 0; margin: 0; }
.choice { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.choice label { border: 1px solid var(--border); border-radius: 12px; padding: 12px; cursor: pointer; display: flex; gap: 8px; align-items: flex-start; background: var(--surface); }
.choice input:checked + span { font-weight: 700; color: var(--brand); }

/* Status, alertas, tabelas */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-success { background: var(--success-soft); color: var(--success); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip-warning { background: var(--warning-soft); color: var(--warning); }
.chip-pending { background: var(--pending-soft); color: var(--pending); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-neutral { background: var(--surface-2); color: var(--muted); }
.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; border: 1px solid transparent; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-info { background: var(--info-soft); color: var(--info); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
dl.kv { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* Linha do tempo */
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 14px 12px; }
.timeline li::before { content: ""; position: absolute; left: -25px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.timeline li.done::before { background: var(--brand); }
.timeline li.bad::before { border-color: var(--danger); background: var(--danger); }
.timeline time { color: var(--muted); font-size: .8rem; display: block; }
.progress-steps { display: flex; gap: 4px; margin: 8px 0 4px; }
.progress-steps span { flex: 1; height: 6px; border-radius: 4px; background: var(--surface-2); }
.progress-steps span.on { background: var(--brand); }

/* Estados vazios, skeleton, toast, modal */
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.empty .icon { font-size: 2rem; margin-bottom: 8px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; min-height: 16px; }
@keyframes sk { to { background-position: -200% 0; } }
.toast-host { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); }
.toast { background: var(--text); color: var(--bg); padding: 12px 14px; border-radius: 12px; box-shadow: var(--shadow); }
.offline-bar { display: none; background: var(--warning); color: #fff; text-align: center; padding: 6px; font-size: .85rem; position: sticky; top: 0; z-index: 50; }
body.is-offline .offline-bar { display: block; }
dialog { border: 0; border-radius: var(--radius); padding: 20px; max-width: min(92vw, 480px); background: var(--surface); color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.45); }
.badge-dot { display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center; }
.map { height: 280px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); z-index: 0; }
.map.tall { height: 420px; }
.offer-card { border: 2px solid var(--brand); }
.offer-amount { font-size: 2.2rem; font-weight: 800; color: var(--success); }
.countdown { font-variant-numeric: tabular-nums; font-weight: 700; }
.online-toggle { font-size: 1.2rem; min-height: 64px; }
.dot-online { width: 12px; height: 12px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot-online.on { background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.steps { display: flex; gap: 8px; margin-bottom: 16px; }
.steps .step { flex: 1; text-align: center; font-size: .8rem; color: var(--muted); padding-top: 8px; border-top: 4px solid var(--border); }
.steps .step.current { color: var(--brand); border-color: var(--brand); font-weight: 700; }
.steps .step.done { border-color: var(--brand); }
.price-lines { list-style: none; padding: 0; margin: 0; }
.price-lines li { display: flex; justify-content: space-between; padding: 4px 0; }
.price-lines li.total { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; font-weight: 700; font-size: 1.1rem; }
.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); text-decoration: none; color: var(--text); }
.pagination .active span { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 440px; }
.landing-hero { padding: 48px 16px 32px; text-align: center; }
.landing-hero h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); }
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.hide-mobile { display: none; } @media (min-width: 720px) { .hide-mobile { display: initial; } }
@media print { .sidebar, .bottomnav, .btn { display: none !important; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
