:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #1d2330; --muted: #667085; --line: #e3e6eb;
  --accent: #2756d8; --accent-ink: #ffffff; --ok: #137a3f; --ok-bg: #e7f6ec; --warn: #9a5b00; --warn-bg: #fff4e0;
  --bad: #b42318; --bad-bg: #fdecea; --info: #34548c; --info-bg: #eaf0fb; --shadow-bg: #efeaf9; --shadow: #5b3fa0;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
pre { background: #f2f4f7; border: 1px solid var(--line); border-radius: 6px; padding: 10px; overflow: auto; max-height: 420px; white-space: pre-wrap; word-break: break-all; }

header.top { background: #111827; color: #e5e7eb; display: flex; align-items: center; gap: 18px; padding: 0 18px; height: 48px; position: sticky; top: 0; z-index: 10; }
header.top .brand { font-weight: 700; color: #fff; letter-spacing: .3px; }
header.top nav { display: flex; gap: 2px; flex: 1; }
header.top nav > .item { position: relative; }
header.top nav a, header.top nav .lbl { color: #cbd5e1; padding: 14px 10px; display: block; cursor: pointer; }
header.top nav a.on, header.top nav .lbl.on { color: #fff; box-shadow: inset 0 -2px #60a5fa; }
header.top nav .menu { display: none; position: absolute; top: 48px; left: 0; background: #fff; border: 1px solid var(--line); border-radius: 0 0 8px 8px; min-width: 190px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
header.top nav .item:hover .menu, header.top nav .item:focus-within .menu { display: block; }
header.top nav .menu a { color: var(--ink); padding: 8px 14px; }
header.top nav .menu a:hover { background: var(--bg); text-decoration: none; }
header.top .me { color: #9ca3af; display: flex; gap: 10px; align-items: center; }
header.top .me button { background: none; border: 1px solid #374151; color: #cbd5e1; border-radius: 6px; padding: 3px 8px; cursor: pointer; }

main { padding: 18px; max-width: 1400px; margin: 0 auto; }
h1 { font-size: 20px; margin: 4px 0 14px; } h2 { font-size: 16px; margin: 22px 0 10px; } h3 { font-size: 14px; margin: 16px 0 8px; }
.sub { color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; } .row > .grow { flex: 1; min-width: 260px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }

table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); font-weight: 600; background: #fafbfc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: #f8fafc; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.tablewrap table { border: 0; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #eef0f3; color: #475467; }
.b-ok, .b-sent, .b-accepted, .b-browser_fired, .b-live { background: var(--ok-bg); color: var(--ok); }
.b-warn, .b-retrying, .b-uncertain, .b-queued, .b-sending, .b-browser_unconfirmed { background: var(--warn-bg); color: var(--warn); }
.b-bad, .b-failed, .b-rejected, .b-error { background: var(--bad-bg); color: var(--bad); }
.b-shadow { background: var(--shadow-bg); color: var(--shadow); } .b-skipped, .b-info { background: var(--info-bg); color: var(--info); }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: #b7e3c6; } .flash.err { background: var(--bad-bg); color: var(--bad); border-color: #f5c2bd; }
.banner { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; background: var(--bad); color: #fff; font-weight: 600; }
.note { background: var(--info-bg); color: var(--info); padding: 10px 14px; border-radius: 8px; margin: 10px 0; }
.warnbox { background: var(--warn-bg); color: var(--warn); padding: 10px 14px; border-radius: 8px; margin: 10px 0; }

form.stack label, .field { display: block; margin-bottom: 12px; }
form.stack label > span, .field > span { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 4px; }
form.stack small, .field small { display: block; color: var(--muted); margin-top: 3px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date], select, textarea {
  width: 100%; max-width: 520px; padding: 7px 9px; border: 1px solid #cfd4dc; border-radius: 6px; font: inherit; background: #fff; }
textarea { min-height: 80px; } input.inline, select.inline { width: auto; display: inline-block; }
button, .btn { display: inline-block; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer; }
button.secondary, .btn.secondary { background: #fff; color: var(--accent); }
button.danger { background: var(--bad); border-color: var(--bad); }
button.small, .btn.small { padding: 3px 9px; font-size: 12.5px; }
button:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.filters label { font-size: 12px; color: var(--muted); } .filters input, .filters select { width: auto; min-width: 120px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs a { padding: 8px 14px; border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; color: var(--muted); }
.tabs a.on { background: var(--panel); border-color: var(--line); color: var(--ink); margin-bottom: -1px; font-weight: 600; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.kpi .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; } .kpi .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .3px; }
.secretbox { background: #111827; color: #f9fafb; padding: 12px; border-radius: 8px; font-family: var(--mono); word-break: break-all; }
details > summary { cursor: pointer; } .muted { color: var(--muted); } .nowrap { white-space: nowrap; } .right { text-align: right; }
.timeline { border-left: 2px solid var(--line); margin-left: 8px; padding-left: 16px; }
.timeline .t { position: relative; margin-bottom: 12px; }
.timeline .t::before { content: ""; position: absolute; left: -22px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.timeline .t.click::before { background: #f59e0b; } .timeline .t.order::before { background: var(--ok); } .timeline .t.decision::before { background: var(--shadow); } .timeline .t.delivery::before { background: #0ea5e9; }
.login { max-width: 360px; margin: 10vh auto; }
@media (max-width: 760px) { header.top { flex-wrap: wrap; height: auto; } header.top nav { flex-wrap: wrap; } main { padding: 12px; } }
