:root {
  --bg: #f4f6f5;
  --card: #ffffff;
  --text: #1c2421;
  --muted: #66736e;
  --border: #dde3e0;
  --accent: #128c7e;
  --accent-dark: #0b6e63;
  --ok-bg: #e3f6ec; --ok: #1e7a46;
  --err-bg: #fdecea; --err: #b3261e;
  --warn-bg: #fff4dc; --warn: #8a5a00;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111715; --card: #1a2220; --text: #e6ece9; --muted: #93a19b; --border: #2c3733;
    --ok-bg: #173826; --ok: #7ad3a0; --err-bg: #3d1a18; --err: #f2a49d; --warn-bg: #3a2e12; --warn: #f0c770;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: .5rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .25rem; }
code { font-size: .85em; word-break: break-all; }
pre { white-space: pre-wrap; word-break: break-word; background: var(--bg); padding: .75rem; border-radius: 8px; margin: 0; font: .9rem/1.5 ui-monospace, monospace; }

.container { max-width: 760px; margin: 0 auto; padding: 0 16px 48px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 16px; background: var(--accent); color: #fff; }
.topbar .brand { color: #fff; font-weight: 600; text-decoration: none; }
.logout { display: flex; align-items: center; gap: 8px; margin: 0; }
.who { font-size: .8rem; opacity: .85; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .btn-link { color: #fff; }

.tabs, .filters { display: flex; gap: 4px; overflow-x: auto; padding: 8px 16px; background: var(--card); border-bottom: 1px solid var(--border); scrollbar-width: none; }
.filters { background: none; border: 0; padding: 0 0 12px; }
.tabs a, .filters a { padding: 6px 12px; border-radius: 999px; text-decoration: none; color: var(--muted); white-space: nowrap; }
.tabs a.active, .filters a.active { background: var(--accent); color: #fff; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.login { max-width: 420px; margin: 15vh auto 0; text-align: center; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; }
.row.wrap { flex-wrap: wrap; justify-content: flex-start; }
.inline { display: flex; gap: 8px; flex: 1; min-width: 220px; }
.grow { flex: 1; min-width: 0; }

.list-item { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .full { flex-basis: 100%; }
.actions { display: flex; align-items: center; gap: 8px; }

label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: .95rem; }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; }
label.check.big { font-weight: 600; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; width: 100%;
}
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; padding: 0; }
textarea { resize: vertical; font-family: ui-monospace, monospace; font-size: .85rem; }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
legend { padding: 0 6px; color: var(--muted); font-size: .9rem; }
.help { margin: -6px 0 0; color: var(--muted); font-size: .85rem; }

.btn { display: inline-block; font: inherit; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer; text-decoration: none; text-align: center; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-danger { color: var(--err); border-color: var(--err); background: none; }
.btn-small { padding: 4px 10px; font-size: .85rem; }
.btn-block { display: block; width: 100%; }
.btn-link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }

.switch { width: 46px; height: 26px; border-radius: 999px; border: 0; background: var(--border); position: relative; cursor: pointer; flex: none; }
.switch span { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch.on { background: var(--accent); }
.switch.on span { left: 23px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; text-transform: capitalize; }
.badge-done { background: var(--ok-bg); color: var(--ok); }
.badge-failed { background: var(--err-bg); color: var(--err); }
.badge-pending, .badge-processing { background: var(--warn-bg); color: var(--warn); }
.badge-ignored { background: var(--bg); color: var(--muted); }
.chips { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.chip { font-size: .75rem; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.sep { color: var(--muted); font-size: .8rem; }

.flash { padding: 8px 12px; border-radius: 8px; margin: 0; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--err-bg); color: var(--err); }
.error-text { color: var(--err); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 600px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; text-decoration: none; color: var(--text); display: flex; flex-direction: column; }
.stat .num { font-size: 1.6rem; font-weight: 700; }
.stat .label { color: var(--muted); font-size: .8rem; }
.checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.checklist li.done a { color: var(--muted); }
.job-detail { margin-top: 8px; }
.danger-zone { border-color: var(--err-bg); }

.help-box { background: var(--bg); border-radius: 8px; padding: 10px 12px; font-size: .9rem; }
.help-box summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.help-box ol { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.help-box code { background: var(--card); padding: 1px 4px; border-radius: 4px; }

.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }
