:root {
  --brand: #0b3a8c;
  --brand-dark: #072a66;
  --accent: #ff7a00;
  --accent-dark: #e06a00;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
a { color: var(--brand); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- marca ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 22px; letter-spacing: .5px; color: var(--brand); text-decoration: none; }
.logo .ja { color: var(--accent); }
.logo svg { width: 34px; height: 34px; }
.logo.light { color: #fff; }

/* ---------- layout ---------- */
.topbar { background: var(--brand); color: #fff; }
.topbar .inner { max-width: 1200px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 16px; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 14px; opacity: .9; }
.topbar .btn.ghost { color: #fff; border-color: rgba(255,255,255,.35); }
.topbar .btn.ghost:hover { background: rgba(255,255,255,.1); }

.container { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }

/* ---------- botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 14px; text-decoration: none; color: var(--text); white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: #f1f5f9; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.blue { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.blue:hover { background: var(--brand-dark); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--danger); border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ---------- formulários ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 13px; font-weight: 600; color: #334155; }
.field label .opt { font-weight: 400; color: var(--muted); }
.input, .field input, .field select, .field textarea { width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11, 58, 140, .12); }
.grid { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
fieldset { border: 0; padding: 0; margin: 0 0 22px; }
legend { font-weight: 700; font-size: 15px; margin-bottom: 12px; color: var(--brand); padding: 0; }
.form-msg { padding: 10px 12px; border-radius: 8px; font-size: 14px; margin-bottom: 14px; display: none; }
.form-msg.show { display: block; }
.form-msg.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.form-msg.success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: linear-gradient(150deg, var(--brand) 0%, var(--brand-dark) 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h2 { font-size: 32px; margin: 24px 0 12px; }
.auth-side p { opacity: .85; max-width: 420px; }
.auth-side ul { padding: 0; list-style: none; margin: 24px 0 0; display: grid; gap: 10px; }
.auth-side li::before { content: "✓"; color: var(--accent); font-weight: 800; margin-right: 10px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-box { width: 100%; max-width: 440px; }
.auth-box h1 { font-size: 26px; margin-bottom: 6px; }
.auth-box .sub { color: var(--muted); margin: 0 0 24px; }
.auth-box .alt { text-align: center; margin-top: 18px; color: var(--muted); font-size: 14px; }

/* ---------- estatísticas ---------- */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { padding: 16px 18px; cursor: pointer; transition: border-color .15s; }
.stat:hover, .stat.active { border-color: var(--brand); }
.stat .n { font-size: 26px; font-weight: 800; }
.stat .l { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .l i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* ---------- tabelas ---------- */
.toolbar { display: flex; gap: 10px; padding: 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar .input { max-width: 340px; }
.toolbar select.input { max-width: 220px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: #f8fafc; font-weight: 700; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: 0; }
td .sub { color: var(--muted); font-size: 12px; }
.code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-weight: 700; letter-spacing: .3px; }
.empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- status ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-processado { background: #eef2ff; color: #4338ca; }
.st-a_caminho { background: #e0f2fe; color: #0369a1; }
.st-tentativa_1 { background: #fff7ed; color: #c2410c; }
.st-tentativa_2 { background: #fef3c7; color: #a16207; }
.st-entregue { background: #dcfce7; color: #15803d; }
.st-pending { background: #fef3c7; color: #a16207; }
.st-approved { background: #dcfce7; color: #15803d; }
.st-rejected { background: #fee2e2; color: #b91c1c; }
.st-suspended { background: #f1f5f9; color: #475569; }

/* ---------- abas ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab { padding: 10px 16px; border: 0; background: none; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 8px; align-items: center; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab .count { background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; }

/* ---------- dialogs ---------- */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(15, 23, 42, .3); }
dialog.sm { width: min(460px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(15, 23, 42, .5); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #fff; z-index: 1; }
.dlg-head h2 { font-size: 18px; }
.dlg-body { padding: 22px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: #fff; }
.x { border: 0; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; }

/* ---------- itens do pedido ---------- */
.items-head, .item-row { display: grid; grid-template-columns: 1fr 90px 130px 36px; gap: 8px; align-items: center; }
.items-head { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.item-row { margin-bottom: 8px; }
.item-row .rm { border: 0; background: none; color: var(--danger); font-size: 20px; cursor: pointer; }

/* ---------- detalhes ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.detail-grid h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 6px; }
.detail-grid p { margin: 0; }
.share-box { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 10px; padding: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.share-box .link { flex: 1; min-width: 200px; word-break: break-all; font-size: 14px; }
.big-code { font-size: 28px; text-align: center; padding: 14px; background: #f8fafc; border-radius: 10px; margin: 8px 0 16px; color: var(--brand); }
.mini-table th, .mini-table td { padding: 8px 10px; }
.mini-table tbody tr { cursor: default; }

/* ---------- linha do tempo ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 24px 1fr; gap: 14px; position: relative; padding-bottom: 22px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: 11px; top: 22px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .dot { width: 24px; height: 24px; border-radius: 50%; background: #e2e8f0; border: 5px solid #fff; box-shadow: 0 0 0 1px var(--border); margin-top: 1px; }
.timeline li.current .dot { background: var(--accent); box-shadow: 0 0 0 4px rgba(255, 122, 0, .2); }
.timeline li.current.done .dot { background: var(--ok); box-shadow: 0 0 0 4px rgba(22, 163, 74, .2); }
.timeline strong { display: block; }
.timeline p { margin: 2px 0; color: #475569; font-size: 14px; }
.timeline time { color: var(--muted); font-size: 13px; }

/* ---------- barra de progresso ---------- */
.stepper { display: grid; grid-template-columns: repeat(4, 1fr); margin: 8px 0 28px; }
.step { text-align: center; position: relative; font-size: 13px; color: var(--muted); font-weight: 600; }
.step .ball { width: 38px; height: 38px; border-radius: 50%; background: #e2e8f0; color: #94a3b8; display: grid; place-items: center; margin: 0 auto 8px; position: relative; z-index: 1; }
.step .ball svg { width: 20px; height: 20px; }
.step::after { content: ""; position: absolute; top: 19px; left: 50%; width: 100%; height: 4px; margin-top: -2px; background: #e2e8f0; }
.step:last-child::after { display: none; }
.step.done { color: var(--text); }
.step.done .ball { background: var(--brand); color: #fff; }
.step.done::after { background: var(--brand); }
.step.current .ball { background: var(--accent); color: #fff; box-shadow: 0 0 0 6px rgba(255, 122, 0, .18); }
.step.current.final .ball { background: var(--ok); box-shadow: 0 0 0 6px rgba(22, 163, 74, .18); }

/* ---------- página de rastreio / home ---------- */
.hero { background: linear-gradient(150deg, var(--brand) 0%, var(--brand-dark) 100%); color: #fff; padding: 20px 16px 120px; }
.hero .nav { max-width: 980px; margin: 0 auto; display: flex; align-items: center; gap: 10px; }
.hero .nav .spacer { flex: 1; }
.hero .nav .btn.ghost { color: #fff; border-color: rgba(255,255,255,.35); }
.hero .nav .btn.ghost:hover { background: rgba(255,255,255,.1); }
.hero .copy { max-width: 760px; margin: 56px auto 0; text-align: center; }
.hero h1 { font-size: 40px; margin-bottom: 12px; }
.hero p { opacity: .85; font-size: 17px; margin: 0; }
.search-card { max-width: 760px; margin: -72px auto 0; padding: 22px; position: relative; }
.search-row { display: flex; gap: 10px; }
.search-row .input { font-size: 18px; padding: 14px 16px; text-transform: uppercase; letter-spacing: 1px; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
.search-row .btn { padding: 0 26px; font-size: 16px; }
.result { max-width: 760px; margin: 20px auto 0; }
.result-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.result-head .status-big { font-size: 24px; font-weight: 800; margin-top: 4px; }
.result-head .meta { color: var(--muted); font-size: 14px; }
.eta { background: #fff7ed; border: 1px solid #fed7aa; border-radius: 10px; padding: 12px 16px; margin-bottom: 24px; font-size: 14px; }
.eta.done { background: #f0fdf4; border-color: #bbf7d0; }
.features { max-width: 980px; margin: 48px auto; padding: 0 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.features .card h3 { font-size: 16px; margin: 10px 0 6px; }
.features .card p { color: var(--muted); margin: 0; font-size: 14px; }
.features .ico { width: 40px; height: 40px; border-radius: 10px; background: #fff7ed; color: var(--accent); display: grid; place-items: center; }
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 32px 16px; }

/* ---------- toast ---------- */
#toasts { position: fixed; bottom: 20px; right: 20px; display: grid; gap: 8px; z-index: 1000; }
.toast { background: #0f172a; color: #fff; padding: 12px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); animation: up .2s ease-out; }
.toast.error { background: var(--danger); }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

.muted { color: var(--muted); }
.hide { display: none !important; }

/* ---------- responsivo ---------- */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .features { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .cols-2, .cols-3, .cols-4, .detail-grid { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: auto; }
  .hero h1 { font-size: 28px; }
  .search-row { flex-direction: column; }
  .search-row .btn { padding: 12px; }
  .topbar .who { display: none; }
  .step { font-size: 11px; }
  .items-head { display: none; }
  .item-row { grid-template-columns: 1fr 70px 36px; }
  .item-row .val { grid-column: 1 / 3; }
}
