:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #667085;
  --line: #e4e7ec;
  --accent: #0e9f8f;
  --accent-ink: #ffffff;
  --hi: #12b76a;
  --mid: #f79009;
  --lo: #98a2b3;
  --danger: #d92d20;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a21;
    --text: #e6e8ec;
    --muted: #98a2b3;
    --line: #2a2f3a;
    --accent: #2ec4b2;
    --accent-ink: #06201d;
    --lo: #5d6677;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 1.4rem; margin: 0 0 12px; }
h2 { font-size: 1.05rem; margin: 20px 0 8px; }
code { background: var(--line); padding: 1px 5px; border-radius: 4px; font-size: .9em; }

.topbar {
  display: flex; align-items: center; gap: 20px; padding: 10px 20px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; color: var(--text); }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a { padding: 6px 10px; border-radius: 6px; color: var(--muted); }
.topbar nav a.on { color: var(--text); background: var(--bg); }

button, .btn {
  font: inherit; cursor: pointer; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  padding: 7px 14px; border-radius: 8px; display: inline-block; white-space: nowrap;
}
button:disabled { opacity: .6; cursor: default; }
button.ghost, .btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
button.ghost:hover, .btn.ghost:hover { border-color: var(--accent); text-decoration: none; }
button.danger { color: var(--danger); }
input, select {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; min-width: 0;
}

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.login { max-width: 360px; margin: 12vh auto; display: grid; gap: 12px; }
.login label { display: grid; gap: 4px; color: var(--muted); }
.error { color: var(--danger); }
.ok { color: var(--hi); }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 30px 0; text-align: center; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.status-line { font-size: .88rem; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; margin-bottom: 12px; }
.tabs a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--text); border-color: var(--accent); }
.count { font-size: .78rem; background: var(--line); border-radius: 10px; padding: 0 7px; margin-left: 2px; }
.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filters input { flex: 1 1 220px; }

.jobs { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.job {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
}
.job-title { font-weight: 600; font-size: 1.02rem; color: var(--text); }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: .86rem; margin-top: 2px; }
.src { text-transform: capitalize; }
.summary { margin: 6px 0 0; font-size: .92rem; }
.job-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

.score {
  display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  font-weight: 700; font-variant-numeric: tabular-nums; border: 3px solid var(--lo); flex: none;
}
.score.hi { border-color: var(--hi); }
.score.mid { border-color: var(--mid); }
.score.none { color: var(--muted); }

.pill { font-size: .75rem; padding: 2px 9px; border-radius: 10px; background: var(--line); white-space: nowrap; }
.st-applied, .st-submitted { background: color-mix(in srgb, var(--hi) 22%, transparent); }
.st-apply_failed, .st-failed, .st-needs_manual { background: color-mix(in srgb, var(--danger) 20%, transparent); }
.st-applying, .st-queued, .st-running, .st-dry_run { background: color-mix(in srgb, var(--mid) 22%, transparent); }

.back { display: inline-block; margin-bottom: 10px; }
.job-head { display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: start; }
.job-head h1 { margin-bottom: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 10px 0; }
.checks div { background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.checks dt { font-size: .78rem; color: var(--muted); }
.checks dd { margin: 0; font-weight: 600; }
.v-si { color: var(--hi); } .v-no { color: var(--danger); } .v-incierto { color: var(--mid); }
.description { white-space: pre-wrap; font-size: .93rem; }
.app { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.app summary { cursor: pointer; }
.app pre { white-space: pre-wrap; background: var(--bg); padding: 10px; border-radius: 6px; font-size: .82rem; overflow-x: auto; }
.shot { max-width: 100%; border: 1px solid var(--line); border-radius: 6px; margin-top: 8px; }
.answers { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: .88rem; }
.answers th, .answers td, .grid th, .grid td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.answers tr.uncertain td { background: color-mix(in srgb, var(--mid) 12%, transparent); }
.grid { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tag { display: inline-block; font-size: .78rem; background: var(--bg); border-radius: 6px; padding: 1px 7px; margin: 1px 3px 1px 0; }
.row { display: flex; gap: 8px; margin: 10px 0; }
.row input { flex: 1; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }

@media (max-width: 640px) {
  .topbar { gap: 10px; padding: 10px 12px; }
  .brand { display: none; }
  .topbar nav a { padding: 6px 8px; }
  .job, .job-head { grid-template-columns: 46px 1fr; }
  .job-actions { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; }
  .grid { display: block; overflow-x: auto; }
}
