:root {
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --navy: #0f2537;
  --brand: #0d9488;
  --ok: #059669;
  --warn: #d97706;
  --bad: #dc2626;
  --info: #2563eb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[hidden] { display: none !important; }

h1, h2, h3 { margin: 0 0 12px; }
h1 { font-size: 20px; }
h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--navy); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.spacer { flex: 1; }

/* ---------------------------------------------------------------- login */

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #0f2537 0%, #123a52 100%);
  padding: 20px;
}

.login-card {
  background: #fff;
  width: 100%;
  max-width: 380px;
  padding: 32px;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
  text-align: center;
}

.brandmark {
  width: 48px; height: 48px;
  margin: 0 auto 14px;
  display: grid; place-items: center;
  background: var(--navy);
  color: #fff;
  font-weight: 800;
  border-radius: 12px;
  letter-spacing: .02em;
}
.brandmark.sm { width: 32px; height: 32px; font-size: 13px; margin: 0; border-radius: 8px; }

.login-card .sub { color: var(--muted); margin: 0 0 22px; font-size: 13px; }
.login-card label { display: block; text-align: left; }

label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 14px;
}
label.check { text-transform: none; font-size: 13px; color: var(--ink); display: flex; gap: 6px; align-items: center; }
label.check input { width: auto; }

input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  margin-top: 4px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid #0d9488;
  outline-offset: -1px;
  border-color: var(--brand);
}

button {
  padding: 10px 16px;
  border: 1px solid var(--navy);
  background: var(--navy);
  color: #fff;
  border-radius: 7px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button:hover { background: #1e3a8a; }
button.ghost { background: transparent; color: var(--navy); }
button.ghost:hover { background: #eef2f7; }
button.primary { background: var(--ok); border-color: var(--ok); }
button.primary:hover { background: #047857; }
button.danger { background: var(--bad); border-color: var(--bad); }
button.sm { padding: 5px 10px; font-size: 12px; }

.error {
  background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5;
  padding: 9px 12px; border-radius: 7px; margin: 12px 0 0; font-size: 13px;
}
.msg { margin: 10px 0 0; font-size: 13px; padding: 9px 12px; border-radius: 7px; }
.msg.ok { background: #ecfdf5; color: #064e3b; }
.msg.bad { background: #fef2f2; color: #991b1b; }
.fineprint { color: var(--muted); font-size: 11px; margin-top: 16px; }

/* ---------------------------------------------------------------- chrome */

.topbar {
  display: flex; align-items: center; gap: 20px;
  background: var(--navy); color: #fff;
  padding: 0 22px; height: 58px;
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand strong { font-size: 15px; }
.brand .badge { margin-left: 8px; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 11px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  background: #fef3c7; color: #92400e;
}
.badge.live { background: #fee2e2; color: #991b1b; }

.tabs { display: flex; gap: 4px; flex: 1; }
.tabs button {
  background: transparent; border: none; color: #cbd5e1;
  padding: 8px 13px; font-size: 13px; border-radius: 7px;
}
.tabs button:hover { background: rgba(255,255,255,.1); color: #fff; }
.tabs button.active { background: rgba(255,255,255,.16); color: #fff; }

.who { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.who .ghost { color: #fff; border-color: #64748b; }
.who .ghost:hover { background: rgba(255,255,255,.12); }

main { padding: 22px; max-width: 1600px; margin: 0 auto; }

.card {
  background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 20px; margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 1000px) { .two-col { grid-template-columns: 1fr; } }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 20px; }
.tile {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.tile .n { font-size: 27px; font-weight: 700; line-height: 1.1; }
.tile .l { color: var(--muted); font-size: 12px; margin-top: 5px; text-transform: uppercase; letter-spacing: .04em; }
.tile.alert .n { color: var(--warn); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input, .toolbar select { width: auto; min-width: 140px; margin-top: 0; }
.stack label { margin-bottom: 12px; }
.stack button { width: 100%; }

/* ----------------------------------------------------------------- table */

.table-wrap { overflow: auto; max-height: 68vh; border: 1px solid var(--line); border-radius: 9px; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th {
  position: sticky; top: 0; z-index: 1;
  background: #f1f5f9; text-align: left; padding: 9px 11px;
  font-size: 11px; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.grid td { padding: 9px 11px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
table.grid tr:hover td { background: #f8fafc; }
table.grid td.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; }

.pill { padding: 2px 9px; border-radius: 11px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.pill.VERIFIED { background: #ecfdf5; color: #065f46; }
.pill.REVIEW { background: #fffbeb; color: #92400e; }
.pill.REJECTED, .pill.NOT_FOUND { background: #fef2f2; color: #991b1b; }
.pill.INDETERMINATE { background: #eef2ff; color: #3730a3; }

/* ---------------------------------------------------------------- charts */

.chart { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-top: 10px; }
.chart .bar { flex: 1; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.chart .bar:hover { background: var(--navy); }
.chart-x { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 6px; }

.outcome-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.outcome-row .name { width: 118px; font-size: 12px; font-weight: 600; }
.outcome-row .track { flex: 1; height: 17px; background: #f1f5f9; border-radius: 5px; overflow: hidden; }
.outcome-row .fill { height: 100%; }
.outcome-row .cnt { width: 52px; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }

/* ---------------------------------------------------------- toast/modal */

.toast {
  position: fixed; bottom: 22px; right: 22px; z-index: 60;
  background: var(--navy); color: #fff; padding: 12px 18px;
  border-radius: 9px; box-shadow: 0 8px 24px rgba(0,0,0,.3);
  max-width: 380px; font-size: 13px;
}
.toast.bad { background: var(--bad); }

.modal { position: fixed; inset: 0; background: rgba(15,37,55,.55); display: grid; place-items: center; z-index: 70; padding: 20px; }
.modal-card { background: #fff; border-radius: 12px; padding: 24px; width: 100%; max-width: 440px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.mono-out { font-family: ui-monospace, Menlo, Consolas, monospace; background: #f1f5f9; padding: 10px; border-radius: 7px; font-size: 15px; letter-spacing: .06em; }
