:root {
  --navy: #13233f;
  --navy-2: #1d3157;
  --bg: #eef2f7;
  --card: #ffffff;
  --line: #d9e0ea;
  --text: #17202e;
  --muted: #5a6577;
  --teal: #00806a;
  --teal-hover: #006b59;
  --good: #1f7a3d;  --good-bg: #e3f4e8;
  --warn: #8a5a00;  --warn-bg: #fdf1d9;
  --bad: #a3212c;   --bad-bg: #fbe4e6;
  --unk: #4b5565;   --unk-bg: #eceff4;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); font-size: 14px; line-height: 1.45; }
h2 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.topbar {
  background: var(--navy); color: #fff; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; padding: 12px 24px; flex-wrap: wrap;
}
.brand { font-weight: 650; font-size: 16px; letter-spacing: .2px; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; max-width: 100%; }
.who { font-size: 12px; color: #c9d3e3; }

.pill {
  border: 1px solid rgba(255,255,255,.25); background: var(--navy-2); color: #fff;
  border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12px; cursor: pointer;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pill::before { content: "●"; margin-right: 6px; color: #9aa6b8; }
.pill.ready::before { color: #5ed39b; }
.pill.blocked::before { color: #ff8a8a; }

main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 48px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.card-head h2 { margin-bottom: 2px; }

.setup { border-left: 4px solid var(--bad); }
.checklist { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.checklist li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; }
.checklist .mark { font-weight: 700; }
.checklist .ok .mark { color: var(--good); }
.checklist .fail .mark { color: var(--bad); }
.checklist .unsure .mark { color: var(--warn); }
.checklist .label { font-weight: 600; }
.checklist .optional { font-weight: 400; color: var(--muted); font-size: 12px; }

.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; }
.row label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.row label.check { display: flex; align-items: center; gap: 6px; padding-bottom: 8px; }
.grow { flex: 1 1 240px; }

input[type=text], input[type=search], input[type=password], select, textarea {
  font: inherit; color: var(--text); background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; min-width: 0; width: 100%;
}
select { width: auto; min-width: 180px; }
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, .pill:focus-visible, .tabs button:focus-visible {
  outline: 2px solid var(--teal); outline-offset: 2px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 13px; padding: 7px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--text); text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #f4f6fa; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-hover); }
.btn.danger { color: var(--bad); }
.btn[disabled], .btn[aria-disabled=true] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
.btn.ghost:hover { background: var(--navy-2); }

main.narrow { max-width: 420px; padding-top: 48px; }
.stack { display: grid; gap: 12px; margin-bottom: 16px; }
.stack label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button {
  font: inherit; background: none; border: 0; padding: 8px 12px; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button[aria-selected=true] { color: var(--text); border-bottom-color: var(--teal); font-weight: 600; }

.file { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.file input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.file input:focus-visible + .btn { outline: 2px solid var(--teal); outline-offset: 2px; }

.error { color: var(--bad); margin: 10px 0 0; }
.note { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 8px 12px; margin: 10px 0 0; }

.table-wrap { overflow-x: auto; margin-top: 8px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
tbody tr.selected { background: #f1f8f6; }
td.detail { color: var(--muted); max-width: 420px; overflow-wrap: anywhere; }
td.addr { overflow-wrap: anywhere; }
td.actions, .actions { display: flex; gap: 6px; flex-wrap: wrap; }

.badge { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.deliverable { background: var(--good-bg); color: var(--good); }
.risky { background: var(--warn-bg); color: var(--warn); }
.undeliverable { background: var(--bad-bg); color: var(--bad); }
.unknown, .queued, .cancelled { background: var(--unk-bg); color: var(--unk); }
.running { background: #e0f1ee; color: var(--teal); }
.done { background: var(--good-bg); color: var(--good); }
.failed { background: var(--bad-bg); color: var(--bad); }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.tile {
  border-radius: var(--radius); padding: 12px 14px; border: 1px solid transparent; cursor: pointer;
  text-align: left; font: inherit; display: grid; gap: 2px;
}
.tile .n { font-size: 22px; font-weight: 700; }
.tile .label { font-size: 12px; }
.tile[aria-pressed=true] { border-color: currentColor; }

.progress { height: 6px; background: var(--unk-bg); border-radius: 999px; overflow: hidden; margin-top: 12px; }
.progress > div { height: 100%; width: 0; background: var(--teal); transition: width .4s; }
.mini { width: 120px; margin-top: 4px; }

.downloads { align-items: center; }
.pager { justify-content: space-between; align-items: center; }

@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .card { padding: 14px; }
  select { min-width: 0; width: 100%; }
}
