/* Fixer dashboard, following the approved mockups (docs/ui/mockups.html). Light and dark mode. */
:root {
  color-scheme: light;
  --bg: #f3f4f7; --surface: #ffffff; --surface-2: #f6f7f9; --border: #e3e6eb; --border-strong: #cdd2da;
  --text: #1a1d22; --text-2: #535c68; --text-3: #858e99;
  --accent: #3b5bdb; --accent-soft: #e8edfd; --on-accent: #ffffff;
  --ok: #2f855a; --ok-soft: #e4f3e9; --warn: #b45309; --warn-soft: #fdf0e1;
  --danger: #c53030; --danger-soft: #fbeaea; --wait: #6b46c1; --wait-soft: #efe9fb; --neutral-soft: #eceef2;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0e1116; --surface: #161a20; --surface-2: #1b2028; --border: #272d36; --border-strong: #363d48;
    --text: #e7eaef; --text-2: #a7b0bc; --text-3: #737d8a;
    --accent: #8299ff; --accent-soft: #1f2747; --on-accent: #0e1116;
    --ok: #5fd08a; --ok-soft: #15301f; --warn: #f2a54a; --warn-soft: #36260f;
    --danger: #ff8282; --danger-soft: #3a1b1b; --wait: #b49cff; --wait-soft: #271f45; --neutral-soft: #232932;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* layout */
.app { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: 100vh; }
.side { border-right: 1px solid var(--border); padding: 16px 10px; display: flex; flex-direction: column; gap: 2px; background: var(--surface-2); position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 700; padding: 2px 10px 14px; display: flex; align-items: center; gap: 8px; color: var(--text); }
.brand:hover { text-decoration: none; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: inline-grid; place-items: center; font-size: 13px; font-weight: 700; }
.nav { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: 8px; color: var(--text-2); }
.nav:hover { background: var(--neutral-soft); text-decoration: none; }
.nav.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.spacer { flex: 1; min-height: 16px; }
.spend { padding: 10px; font-size: 13px; }
.main { padding: 26px 30px 48px; min-width: 0; max-width: 1200px; }
.banner { background: var(--danger-soft); color: var(--danger); border-radius: 10px; padding: 10px 14px; margin-bottom: 18px; font-weight: 600; }

/* text */
h1 { font-size: 24px; margin: 0; letter-spacing: -0.01em; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.sub { color: var(--text-2); font-size: 13px; }
.blk { font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin: 26px 0 10px; display: flex; gap: 8px; align-items: center; }
.empty { color: var(--text-3); font-size: 14px; padding: 6px 0; }
.blk a { text-transform: none; letter-spacing: 0; font-weight: 500; }
.title-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; justify-content: space-between; }

/* building blocks */
.card { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--surface); min-width: 0; }
.card + .card { margin-top: 16px; }
.card h3 { margin: 0 0 8px; font-size: 14.5px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn, .stop { display: inline-block; padding: 6px 12px; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 600; border: 1px solid var(--border-strong); color: var(--text); background: var(--surface); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.danger, .stop { color: var(--danger); border-color: var(--danger); background: transparent; }
.stop { width: 100%; margin-top: 6px; }
.side .btn.primary { width: 100%; margin-top: 6px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-run { background: var(--accent-soft); color: var(--accent); }
.b-wait { background: var(--wait-soft); color: var(--wait); }
.b-you { background: var(--warn-soft); color: var(--warn); }
.b-done { background: var(--ok-soft); color: var(--ok); }
.b-fail { background: var(--danger-soft); color: var(--danger); }
.b-idle { background: var(--neutral-soft); color: var(--text-2); }
.count { font-style: normal; font-size: 11px; font-weight: 700; background: var(--neutral-soft); color: var(--text-2); padding: 0 7px; border-radius: 999px; line-height: 18px; }
.count.warn { background: var(--warn-soft); color: var(--warn); }
.meter { height: 6px; background: var(--neutral-soft); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.meter b { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.meter.over b { background: var(--warn); }
.meters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.meters .card { padding: 10px 14px; margin: 0; }
.meters .row { display: flex; justify-content: space-between; font-size: 13px; }
.meters .row span { color: var(--text-2); }
.needs { display: grid; gap: 10px; }
.need { display: flex; gap: 12px 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; border: 1px solid var(--border); border-left: 3px solid var(--warn); border-radius: 10px; padding: 12px 14px; background: var(--surface); }
.need > div:first-child { min-width: 0; flex: 1 1 320px; }
.kicker { font-size: 12px; font-weight: 700; color: var(--warn); margin-bottom: 2px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 18px 0 16px; overflow-x: auto; }
.tabs a { padding: 8px 12px; font-size: 13.5px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--text); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-weight: 600; color: var(--text-3); font-size: 12px; padding: 7px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.bar { display: inline-block; height: 8px; background: var(--accent); border-radius: 3px; vertical-align: middle; min-width: 2px; }

/* task progress and timeline */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; padding: 6px 0; font-size: 13.5px; }
.ic { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; margin-top: 1px; }
.ic.done { background: var(--ok); color: var(--surface); }
.ic.now { border: 2px solid var(--accent); }
.ic.now::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.ic.todo { border: 2px solid var(--border-strong); }
.timeline { list-style: none; margin: 0; padding: 0; max-height: 640px; overflow-y: auto; }
.timeline li { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.timeline li:last-child { border-bottom: none; }
.timeline .t { color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 12px; padding-top: 1px; }
.timeline .k { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; margin-right: 6px; }
.timeline li.error { background: var(--danger-soft); border-radius: 8px; padding: 7px; }
.cost { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
dl.settings { display: grid; grid-template-columns: minmax(160px, auto) minmax(0, 1fr); gap: 8px 18px; margin: 0; font-size: 14px; }
dl.settings dt { color: var(--text-2); }
dl.settings dd { margin: 0; overflow-wrap: anywhere; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; background: var(--neutral-soft); padding: 1px 5px; border-radius: 5px; }

/* reports */
.prose { font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.prose h1 { font-size: 22px; margin: 0 0 12px; }
.prose h2 { font-size: 17px; margin: 26px 0 8px; }
.prose h3 { font-size: 15px; margin: 18px 0 6px; }
.prose table { margin: 10px 0; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); }
.prose blockquote { margin: 12px 0; padding: 8px 14px; border-left: 3px solid var(--warn); background: var(--warn-soft); border-radius: 6px; }
.prose ul, .prose ol { padding-left: 22px; }

/* login */
.login { max-width: 420px; margin: 12vh auto 0; padding: 16px; }
.login .brand { justify-content: center; font-size: 18px; }
.login h1 { font-size: 20px; margin-bottom: 6px; }
.notice { padding: 10px 12px; border-radius: 8px; background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.notice.bad { background: var(--warn-soft); color: var(--warn); }
.logout { margin-top: 8px; background: none; border: none; color: var(--text-3); font: inherit; font-size: 13px; cursor: pointer; }
.logout:hover { color: var(--text); }

@media (max-width: 880px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 1px solid var(--border); gap: 4px; padding: 10px; }
  .side nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .brand { width: 100%; padding-bottom: 6px; }
  .spacer, .spend { display: none; }
  .stop, .side .btn.primary { width: auto; margin: 0 0 0 auto; }
  .grid-2, .meters { grid-template-columns: minmax(0, 1fr); }
  .main { padding: 16px; }
  .timeline li { grid-template-columns: 76px minmax(0, 1fr); }
}
