:root {
  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #f0efea;
  --text: #1d1d1b;
  --muted: #6b6a65;
  --line: #e2e0d8;
  --accent: #2b59c3;
  --accent-text: #ffffff;
  --ok: #1f7a4d;
  --ok-bg: #e3f3ea;
  --warn: #8a5a00;
  --warn-bg: #fbf0d9;
  --bad: #b3261e;
  --bad-bg: #fbe4e2;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151514;
    --surface: #1f1f1d;
    --surface-2: #292926;
    --text: #ecebe6;
    --muted: #a3a199;
    --line: #34332f;
    --accent: #7aa2ff;
    --accent-text: #0d1426;
    --ok: #6fd3a0;
    --ok-bg: #173527;
    --warn: #f0c36b;
    --warn-bg: #3a2d12;
    --bad: #ff8a80;
    --bad-bg: #3d1a18;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 28px 0 10px; }
h3 { font-size: 15px; margin: 0 0 6px; }
p { margin: 0 0 10px; }
code, .mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* layout */
header.top {
  position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--line);
}
.top-inner { max-width: 1180px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 16px; }
.brand { font-weight: 700; white-space: nowrap; padding: 12px 0; color: var(--text); }
nav.main { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
nav.main::-webkit-scrollbar { display: none; }
nav.main a {
  padding: 14px 10px; color: var(--muted); white-space: nowrap; border-bottom: 2px solid transparent;
}
nav.main a.on { color: var(--text); border-bottom-color: var(--accent); }
nav.main a:hover { text-decoration: none; color: var(--text); }
.badge-count {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 12px; line-height: 18px; text-align: center;
}
main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 14px; }
.grid .card + .card { margin-top: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 8px; }

/* status */
.hero { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.state { display: flex; align-items: center; gap: 12px; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.running, .dot.idle { background: var(--ok); }
.dot.autopause { background: var(--warn); }
.dot.paused { background: var(--bad); }
.state-title { font-size: 20px; font-weight: 700; }
.big-num { font-size: 26px; font-weight: 700; line-height: 1.1; }
progress.meter {
  display: block; width: 100%; height: 8px; margin-top: 8px; border: 0; border-radius: 4px; overflow: hidden;
  appearance: none; -webkit-appearance: none; background: var(--surface-2); accent-color: var(--accent);
}
progress.meter::-webkit-progress-bar { background: var(--surface-2); }
progress.meter::-webkit-progress-value { background: var(--accent); }
progress.meter::-moz-progress-bar { background: var(--accent); }
progress.meter.bad::-webkit-progress-value { background: var(--bad); }
progress.meter.bad::-moz-progress-bar { background: var(--bad); }
.chip {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; line-height: 20px;
  background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.flash {
  background: var(--warn-bg); color: var(--warn); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px;
  overflow-wrap: anywhere;
}

/* forms */
button, .btn {
  font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 8px; padding: 7px 14px; display: inline-block;
}
button:hover, .btn:hover { border-color: var(--muted); text-decoration: none; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { color: var(--bad); }
button.big { padding: 12px 22px; font-size: 16px; font-weight: 600; }
button.small { padding: 3px 10px; font-size: 13px; }
input[type=text], input[type=password], input[type=number], input[type=url], select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; width: 100%; max-width: 100%;
}
textarea { font-family: var(--mono); font-size: 13px; min-height: 110px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { display: flex; gap: 4px; align-items: center; color: var(--text); font-size: 14px; margin: 0;
  border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; }
.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 14px; }
form.inline { display: inline; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.off td { color: var(--muted); }
.clip { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrap-any { overflow-wrap: anywhere; }

/* posts */
.post { display: grid; gap: 16px; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); }
.post img { width: 100%; border-radius: 8px; display: block; background: var(--surface-2); }
.post-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.post-text b { display: block; margin-bottom: 4px; }
details summary { cursor: pointer; color: var(--accent); }
details[open] summary { margin-bottom: 8px; }
pre {
  background: var(--surface-2); border-radius: 8px; padding: 10px; overflow-x: auto; font-size: 12px;
  white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0;
}
.step { border-left: 3px solid var(--line); padding: 4px 0 4px 12px; margin: 10px 0; }
.step.bad { border-left-color: var(--bad); }
.step.ok { border-left-color: var(--ok); }

.steps { list-style: none; padding: 0; margin: 14px 0 0; counter-reset: step; }
.steps li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 7px 0 7px 30px; position: relative;
  border-bottom: 1px solid var(--line); color: var(--muted); }
.steps li:last-child { border-bottom: 0; }
.steps li::before { content: ""; position: absolute; left: 4px; top: 11px; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--line); }
.steps li.done { color: var(--text); }
.steps li.done::before { background: var(--ok); border-color: var(--ok); }
.steps li.current { color: var(--text); font-weight: 600; }
.steps li.current::before { border-color: var(--accent); border-top-color: transparent; animation: spin 0.9s linear infinite; }
.step-label { min-width: 210px; }
.progress-state { margin-top: 12px; overflow-wrap: anywhere; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--accent); border-top-color: transparent;
  border-radius: 50%; animation: spin 0.9s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner, .steps li.current::before { animation: none; } }
ul.models { list-style: none; padding: 0; margin: 0; }
ul.models li { padding: 4px 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; overflow-wrap: anywhere; }
button[disabled] { opacity: 0.55; cursor: progress; }
.login { max-width: 360px; margin: 12vh auto; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filters a { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 14px; }
.filters a.on { color: var(--text); border-color: var(--accent); }

@media (max-width: 720px) {
  .post { grid-template-columns: 1fr; }
  .brand { display: none; }
  h1 { font-size: 20px; }
  .clip { max-width: 220px; }
}
