:root {
  --bg: #f4f5f7; --card: #ffffff; --text: #16181d; --muted: #5d6470; --line: #e2e5ea;
  --ok: #17803d; --ok-bg: #e4f5ea; --warn: #9a5b00; --warn-bg: #fdf1d8;
  --bad: #b3261e; --bad-bg: #fde7e5; --run: #1857c4; --run-bg: #e3edfd;
  --idle: #5d6470; --idle-bg: #eceef1; --accent: #1857c4;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101216; --card: #1a1d23; --text: #e9ebef; --muted: #9aa2af; --line: #2b3038;
    --ok: #5fd08a; --ok-bg: #143321; --warn: #f0b955; --warn-bg: #3a2c0d;
    --bad: #ff8a80; --bad-bg: #41191a; --run: #86b2ff; --run-bg: #162a4d;
    --idle: #9aa2af; --idle-bg: #262a31; --accent: #86b2ff;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main, .top, .tabs, .autos { max-width: 780px; margin: 0 auto; padding: 0 14px; }
.top { display: flex; align-items: center; gap: 10px; padding-top: 14px; padding-bottom: 8px; flex-wrap: wrap; }
.top h1 { font-size: 19px; margin: 0; flex: 1 1 auto; }
.top form { margin: 0; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 16px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.ok { color: var(--ok); background: var(--ok-bg); }
.warn { color: var(--warn); background: var(--warn-bg); }
.bad { color: var(--bad); background: var(--bad-bg); }
.run { color: var(--run); background: var(--run-bg); }
.idle { color: var(--idle); background: var(--idle-bg); }

.tabs, .autos { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 8px; }
.tabs button, .autos button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600;
  padding: 8px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.tabs button.on, .autos button.on { background: var(--card); color: var(--text); box-shadow: 0 0 0 1px var(--line); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.banner { border-radius: 10px; padding: 10px 14px; margin: 0 0 12px; font-weight: 600; }

.hero { display: flex; gap: 14px; align-items: flex-start; }
.hero-icon { flex: 0 0 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; font-weight: 700; }
.hero-title { font-size: 20px; font-weight: 700; margin: 2px 0 2px; line-height: 1.25; }
.sub { color: var(--muted); font-size: 14px; margin: 0; }
.note { margin: 8px 0 0; font-size: 14px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 8px; margin-top: 14px; }
.stat { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.stat b { display: block; font-size: 24px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; }

.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.steps li:first-child { border-top: 0; padding-top: 0; }
.dot { flex: 0 0 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 700; }
.step-main { flex: 1 1 auto; min-width: 0; }
.step-name { font-weight: 600; }
.step-state { font-weight: 600; font-size: 14px; white-space: nowrap; }
.t-ok { color: var(--ok); } .t-warn { color: var(--warn); } .t-bad { color: var(--bad); } .t-run { color: var(--run); } .t-idle { color: var(--idle); }

.strip { display: grid; grid-template-columns: repeat(15, 1fr); gap: 5px; margin-bottom: 4px; }
.strip button { border: 0; height: 26px; border-radius: 5px; cursor: pointer; font-size: 11px; font-weight: 700; padding: 0; }
.strip button.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.row-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 2px; background: transparent;
  border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.row-btn .grow { flex: 1 1 auto; min-width: 0; }
.row-btn .small { color: var(--muted); font-size: 13px; }

.log { margin: 8px 0 0; padding: 0; list-style: none; font: 13px/1.5 ui-monospace, Consolas, monospace; max-height: 420px; overflow: auto; }
.log li { padding: 2px 0; display: flex; gap: 8px; overflow-wrap: anywhere; }
.log time { color: var(--muted); flex: 0 0 auto; }
.log .lv-error { color: var(--bad); font-weight: 600; }
.log .lv-warn { color: var(--warn); }
details > summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.daygroup { margin-top: 12px; }
.daygroup:first-child { margin-top: 0; }

label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 12px 0 4px; }
select, input[type=number], input[type=password], textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px;
}
textarea { min-height: 70px; resize: vertical; }
.slot { border-top: 1px solid var(--line); padding-top: 4px; margin-top: 12px; }
.slot:first-of-type { border-top: 0; margin-top: 0; }
.pair { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.pair input { width: 86px; flex: 0 0 auto; }
.pair span { color: var(--muted); font-size: 14px; }
.checks { display: flex; flex-direction: column; gap: 6px; }
.checks label { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; color: var(--text); font-size: 15px; overflow-wrap: anywhere; }
.preview { background: var(--bg); border-radius: 10px; padding: 10px 12px; margin-top: 14px; font-size: 14px; white-space: pre-line; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.btn {
  font: inherit; font-weight: 600; border-radius: 9px; padding: 10px 16px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #0c1220; } }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 4px; text-decoration: underline; }
.foot { color: var(--muted); font-size: 12px; text-align: center; margin: 16px 0 28px; }
.err { color: var(--bad); font-weight: 600; margin: 10px 0 0; }

.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: grid; place-items: center; padding: 16px; z-index: 10; }
.modal-box { background: var(--card); border-radius: 14px; padding: 18px; max-width: 460px; width: 100%; max-height: 90vh; overflow: auto; }
.modal-box p { margin: 0 0 8px; white-space: pre-line; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

body.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card { width: 100%; max-width: 340px; }
.login-card h1 { font-size: 20px; margin: 0 0 6px; }
.login-card .btn { width: 100%; margin-top: 14px; }
.login-msg { color: var(--bad); font-weight: 600; margin: 8px 0 0; }
