:root {
  --bg: #f4f4f1; --panel: #ffffff; --line: #e2e2dd; --ink: #1c1c1a; --muted: #6b6b66; --faint: #a3a39d;
  --accent: #2a5bd7; --ok: #1f7a3d; --bad: #b3261e; --warn: #9a6700; --run: #2a5bd7; --love: #c2185b;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--sans); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.grow { flex: 1; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.err { color: var(--bad); }
.ok { color: var(--ok); }
.bad { color: var(--bad); }

.top { display: flex; align-items: center; gap: 22px; height: 44px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 650; color: var(--ink); letter-spacing: -0.01em; }
.nav { display: flex; gap: 16px; }
.nav a { color: var(--muted); padding: 12px 0; border-bottom: 2px solid transparent; }
.nav a.current { color: var(--ink); border-bottom-color: var(--ink); }
.nav a:hover { text-decoration: none; color: var(--ink); }
button.link { background: none; border: 0; color: var(--accent); padding: 0; }
button.link:hover { text-decoration: underline; }
button.link.danger { color: var(--bad); }

.main { max-width: 1280px; margin: 0 auto; padding: 20px 24px 80px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); white-space: nowrap; font-size: 14px; line-height: 20px; min-height: 34px; }
.btn:hover { border-color: #c9c9c2; text-decoration: none; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #333; }
.btn.danger { color: var(--bad); }
.btn.active { background: #eef2fc; border-color: #b9c8ef; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.small { padding: 3px 8px; font-size: 12.5px; line-height: 18px; min-height: 26px; }
.btn input[type=file] { display: none; }

.page-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.crumb { color: var(--muted); }
.crumb a { color: var(--muted); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.login { max-width: 360px; margin: 80px auto; padding: 24px; }
.login h1 { margin: 0 0 12px; font-size: 18px; }
.login input { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; margin: 8px 0 12px; }
.btn.block { width: 100%; justify-content: center; }

.drop { border: 1.5px dashed #c9c9c2; border-radius: 8px; padding: 14px 16px; text-align: center; color: var(--muted); margin-bottom: 18px; }
.drop.over { border-color: var(--accent); background: #f3f6fd; }
.progress { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { display: block; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; transition: border-color .15s; }
.card:hover { border-color: #b8b8b1; text-decoration: none; }
.card .logo { height: 48px; display: flex; align-items: center; margin-bottom: 10px; }
.card .logo img { max-height: 48px; max-width: 160px; object-fit: contain; }
.card .logo .none { color: var(--faint); font-size: 12px; }
.card .name { font-weight: 600; font-size: 15px; }
.card .tag { color: var(--muted); font-size: 12.5px; margin: 2px 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .counts { color: var(--muted); font-size: 12px; margin-top: 8px; }
.swatches { display: flex; gap: 4px; }
.swatch { width: 18px; height: 18px; border-radius: 4px; border: 1px solid rgba(0,0,0,.08); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tab { padding: 8px 12px; border: 0; background: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.tab:hover { color: var(--ink); }
.tab small { color: var(--faint); margin-left: 4px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.box.wide { grid-column: 1 / -1; }
.box h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.box h3 .grow { text-align: right; text-transform: none; letter-spacing: 0; font-weight: 400; }
.box .value { font-size: 15px; }
.box .value.big { font-size: 18px; font-weight: 600; }
.edit-row { display: flex; gap: 8px; align-items: center; }
.edit-row input, .edit-row textarea, .edit-row select { flex: 1; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); min-width: 0; }
.edit-row textarea { min-height: 60px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); flex: 1; }
.field input, .field textarea, .field select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); font-size: 14px; }
.field textarea { min-height: 70px; resize: vertical; }
.form-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-top: 8px; }
.form-row .field.narrow { flex: 0 0 120px; }

.list { margin: 0; padding: 0; list-style: none; }
.list li { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-top: 1px solid #f0f0ec; }
.list li:first-child { border-top: 0; }
.list .id { font-family: var(--mono); font-size: 11.5px; color: var(--faint); flex: 0 0 48px; }
.list .body { flex: 1; min-width: 0; }
.list .body b { font-weight: 600; }
.list .body .desc { color: var(--muted); }
.list .body .price { color: var(--ink); font-weight: 500; }
.list .ops { display: flex; gap: 8px; flex: none; opacity: .55; }
.list li:hover .ops { opacity: 1; }
.list .quote { color: var(--ink); }
.list .who { color: var(--muted); font-size: 12.5px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; background: #fafaf8; }
.chip .aa { font-size: 16px; }
.chip .x { color: var(--faint); border: 0; background: none; padding: 0 2px; }
.chip .x:hover { color: var(--bad); }
.colour { display: inline-flex; gap: 8px; align-items: center; }
.colour .swatch { width: 22px; height: 22px; }
.colour .hex { font-family: var(--mono); font-size: 12px; }
.logo-box img { max-height: 90px; max-width: 100%; object-fit: contain; background: repeating-conic-gradient(#f2f2ee 0 25%, #fff 0 50%) 0 0 / 16px 16px; border-radius: 4px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px; position: relative; }
.tile img { width: 100%; height: auto; display: block; border-radius: 4px; background: repeating-conic-gradient(#f2f2ee 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.tile .meta { font-size: 11.5px; color: var(--muted); margin-top: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tile .meta select { font-size: 11.5px; padding: 1px 4px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); }
.tile .rm { position: absolute; top: 6px; right: 6px; background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: 50%; width: 22px; height: 22px; line-height: 20px; text-align: center; padding: 0; color: var(--bad); opacity: 0; }
.tile:hover .rm { opacity: 1; }
.tile.missing img { opacity: .3; }

.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filters select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.run-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.run-card { display: block; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.run-card:hover { border-color: #b8b8b1; text-decoration: none; }
.run-card .shot { height: 140px; background: #ececе8; background: #ecece8; overflow: hidden; position: relative; }
.run-card .shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.run-card .shot .prog { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 12.5px; padding: 12px; text-align: center; }
.bar { width: 80%; height: 6px; background: #ddd; border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--run); }
.run-card .info { padding: 10px 12px; }
.run-card .info .name { font-weight: 600; display: flex; gap: 6px; align-items: center; }
.run-card .info .row { color: var(--muted); font-size: 12.5px; display: flex; gap: 8px; }
.run-card .info .row b { color: var(--ink); font-weight: 500; }
.heart { color: var(--love); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; }
.dot.running, .dot.queued { background: var(--run); animation: pulse 1.2s infinite ease-in-out; }
.dot.done { background: var(--ok); }
.dot.failed, .dot.cancelled { background: var(--bad); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 550; border: 1px solid var(--line); color: var(--muted); }
.pill.running, .pill.queued { color: var(--run); border-color: #b9c8ef; background: #eef2fc; }
.pill.done { color: var(--ok); border-color: #b7dcc3; background: #edf7f0; }
.pill.failed, .pill.cancelled { color: var(--bad); border-color: #e9b8b4; background: #fbeeed; }
.pill.skipped { border-style: dashed; }
.run-meta { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 14px; align-items: center; }
.run-meta b { color: var(--ink); font-weight: 500; }
.budget { font-family: var(--mono); font-size: 12.5px; }
.budget.PASS { color: var(--ok); } .budget.FAIL { color: var(--bad); }
.verdict { display: inline-flex; gap: 4px; margin-left: 6px; }
.verdict .btn.love.active { background: #fbe4ee; border-color: #f0b8cf; color: var(--love); }

.run-body { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; align-items: start; }
.steps { padding: 6px 0; }
.group { padding: 8px 12px 2px; font-size: 11.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; display: flex; }
.step { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: center; padding: 6px 12px; cursor: pointer; border-left: 3px solid transparent; }
.step:hover { background: #f7f7f4; }
.step.selected { background: #eef2fc; border-left-color: var(--accent); }
.step .name { font-weight: 550; }
.step .name small { font-weight: 400; color: var(--muted); margin-left: 6px; }
.step .stats { font-family: var(--mono); font-size: 11.5px; color: var(--muted); text-align: right; white-space: nowrap; }
.step .stats b { color: var(--ink); font-weight: 500; }
.step.pending { opacity: .5; }
.step .err { font-family: var(--sans); font-size: 12px; grid-column: 2 / -1; white-space: normal; }
.ico { width: 14px; height: 14px; border-radius: 50%; display: inline-block; border: 1.5px solid var(--faint); }
.ico.running { border-color: var(--run); border-top-color: transparent; animation: spin .9s linear infinite; }
.ico.done { background: var(--ok); border-color: var(--ok); }
.ico.failed { background: var(--bad); border-color: var(--bad); }
.ico.skipped { border-style: dashed; }
.ico.warn { background: var(--warn); border-color: var(--warn); }
@keyframes spin { to { transform: rotate(360deg); } }

.detail { min-height: 400px; }
.detail-head { display: flex; align-items: baseline; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.detail-head h2 { margin: 0; font-size: 16px; }
.detail .tabs { padding: 8px 12px 0; margin: 0; }
.body { padding: 14px 16px; }
pre.doc { margin: 0; white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; max-height: 75vh; overflow: auto; }
pre.doc .k { color: #7a3e9d; } pre.doc .s { color: #1f6f3d; } pre.doc .n { color: #1a56b8; } pre.doc .b { color: #b35c00; }
.frame { width: 100%; height: 75vh; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.frame.phone { width: 390px; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.empty { color: var(--muted); padding: 40px; text-align: center; }
ul.fails { margin: 8px 0 0; padding-left: 18px; }
ul.fails li { margin: 3px 0; }
.status-line { font-family: var(--mono); font-size: 12.5px; margin-bottom: 10px; }
.status-line.PASS { color: var(--ok); } .status-line.FAIL { color: var(--bad); }
.notice { background: #fff8e1; border: 1px solid #f1e2a6; border-radius: 6px; padding: 8px 12px; color: #6b5200; margin-bottom: 14px; }

table.plain { border-collapse: collapse; width: 100%; }
table.plain th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
table.plain td { padding: 8px 10px; border-bottom: 1px solid #f0f0ec; vertical-align: top; }
table.plain tr.clickable { cursor: pointer; }
table.plain tr.clickable:hover td { background: #f7f7f4; }

.modal-back { position: fixed; inset: 0; background: rgba(20,20,18,.35); display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; z-index: 20; overflow: auto; }
.modal { background: var(--panel); border-radius: 10px; padding: 20px 22px; width: 100%; max-width: 560px; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.modal.wide { max-width: 860px; }
.modal h2 { margin: 0 0 14px; font-size: 17px; }
.modal .foot { display: flex; gap: 10px; align-items: center; margin-top: 16px; }
.modal .foot .grow { text-align: right; }

@media (max-width: 960px) {
  .run-body, .grid2 { grid-template-columns: 1fr; }
}
