:root {
  --bg: #f6f7f9; --fg: #1d2330; --muted: #667085; --card: #fff; --line: #e3e6eb;
  --accent: #1f5fd1; --ok: #127a3b; --warn: #a15c00; --bad: #b42318; --info: #3a5ba0;
  --radius: 8px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
       background: var(--bg); color: var(--fg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.4rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.4rem 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.container { max-width: 1180px; margin: 0 auto; padding: 16px; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 10px 16px;
          background: #12213d; color: #dfe6f3; }
.topbar a { color: #dfe6f3; }
.topbar .brand { font-weight: 700; color: #fff; font-size: 1.05rem; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 4px 14px; flex: 1; }
.topbar .logout { display: flex; align-items: center; gap: 8px; margin: 0; }
.topbar .logout .muted { color: #9fb0cc; }
.btn { display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--fg);
       padding: 7px 14px; border-radius: 6px; font: inherit; cursor: pointer; }
.btn:hover { background: #f0f2f5; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #184ea9; }
.btn-danger { color: var(--bad); border-color: #f1c4bf; }
.btn-link { background: none; border: 0; color: inherit; padding: 0; text-decoration: underline; }
.btn-lg { padding: 10px 20px; font-size: 1.05rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
        padding: 14px 16px; margin-bottom: 14px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.spacer { flex: 1; }
table { border-collapse: collapse; width: 100%; background: var(--card); }
th, td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .82rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600;
         background: #eef1f5; color: var(--muted); white-space: nowrap; }
.badge-warn { background: #fff1d6; color: var(--warn); }
.status-queued { background: #eef1f5; color: var(--muted); }
.status-running { background: #e3ecfb; color: var(--info); }
.status-awaiting_human { background: #fff1d6; color: var(--warn); }
.status-completed { background: #dcf3e4; color: var(--ok); }
.status-failed { background: #fde4e1; color: var(--bad); }
.alert-banner { background: #fff1d6; color: #5c3900; border-bottom: 1px solid #f3d39b; padding: 9px 16px;
                display: flex; flex-wrap: wrap; gap: 8px; }
.flash { padding: 9px 12px; border-radius: 6px; margin-bottom: 12px; }
.flash-error { background: #fde4e1; color: var(--bad); }
.flash-ok { background: #dcf3e4; color: var(--ok); }
.errors { background: #fde4e1; color: var(--bad); border-radius: 6px; padding: 8px 12px 8px 28px; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 3px; }
input, select, textarea { font: inherit; width: 100%; padding: 7px 9px; border: 1px solid #cfd4dc;
                          border-radius: 6px; background: #fff; color: var(--fg); }
input[type=checkbox], input[type=radio] { width: auto; }
.field { margin-bottom: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 12px; }
.check { display: flex; gap: 8px; align-items: center; color: var(--fg); font-size: .95rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 14px;
           background: var(--card); }
legend { font-weight: 600; padding: 0 6px; }
.login-box { max-width: 380px; margin: 8vh auto; }
.btn-google { display: block; width: 100%; text-align: center; padding: 9px 12px; font-weight: 600; }
.or { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--muted); font-size: .85rem; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.compare .card { margin: 0; }
.compare .best { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok) inset; }
.premium { font-size: 1.6rem; font-weight: 700; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .85rem; }
dl.kv dd { margin: 0; }
pre { background: #0f172a; color: #e2e8f0; padding: 10px; border-radius: 6px; overflow-x: auto; font-size: .82rem; }
@media (max-width: 640px) {
  body { font-size: 15px; }
  .topbar .logout .muted { display: none; }
  th, td { padding: 6px; }
  .premium { font-size: 1.35rem; }
}
.cmp-table thead th { text-transform: none; font-size: .95rem; letter-spacing: 0; color: var(--fg); }
.cmp-table tbody th { width: 130px; }
.cmp-table tbody th, .cmp-table thead th:first-child { position: sticky; left: 0; background: var(--card); z-index: 1; }
@media (max-width: 640px) { .cmp-table tbody th { width: 92px; min-width: 92px; } .cmp-table td { min-width: 200px; } }

/* learning loop: paths, playbook versions, autopilot questions */
.path-badge[data-path="autopilot->learned"], .path-badge[data-path="autopilot"] { background: #e3ebfb; color: var(--info); }
.path-badge[data-path="playbook+repair"], .path-badge[data-path="playbook+agent"] { background: #fff1d6; color: var(--warn); }
.badge-degraded { background: #fde4e1; color: var(--bad); font-weight: 600; }
.badge-active { background: #dcf3e4; color: var(--ok); font-weight: 600; }
.stop-purchase { background: #fde4e1; color: var(--bad); border-radius: 6px; padding: 6px 10px; margin: 4px 0; font-weight: 600; }
tr.degraded td { background: #fff5f4; }
.versions td, .versions th { white-space: nowrap; }
.versions form { display: inline; margin: 0; }
.btn-sm { padding: 3px 9px; font-size: 13px; }
.question { border-top: 1px solid #e4e8ef; padding: 12px 0; }
.question:first-of-type { border-top: 0; }
.question .q-text { font-weight: 600; margin-bottom: 6px; }
.question .q-meta { margin-bottom: 6px; }
.question label.opt { display: flex; gap: 8px; align-items: flex-start; padding: 3px 0; font-weight: normal; }
.question label.opt input { margin-top: 3px; width: auto; }
.answer-card { border-left: 4px solid #f5b84d; }
.policy-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }

/* Logical defaults: the "we'll assume it" note and the assumptions panels. */
.req { color: var(--bad); font-weight: 700; }
.assume-note { background: #eef4ff; border: 1px solid #c9daf8; border-radius: 6px; padding: 9px 12px; }
.assumptions { border-left: 4px solid #f5b84d; }
.assumptions details { margin-top: 8px; }
.assumption-table td { vertical-align: top; }
.correct-grid .field .reason { font-size: .78rem; color: var(--muted); margin-top: 2px; }
