:root {
  --bg: #f3f4f1; --card: #ffffff; --text: #1b1f1d; --muted: #66706b; --line: #dde1dc;
  --accent: #1d4d3a; --accent-2: #2f7d5d; --good: #1f7a4d; --bad: #b3261e; --warn: #9a6400;
  --pause: #b77900; --chip: #e8ebe6; --radius: 14px;
  --tap: 48px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111513; --card: #1b201d; --text: #e9ece9; --muted: #9aa49f; --line: #2c332f;
    --accent: #6fc39a; --accent-2: #4fa57d; --good: #6fc39a; --bad: #ff8a80; --warn: #f0b04c;
    --pause: #f0b04c; --chip: #262c29;
  }
}
:root[data-theme="dark"] {
  --bg: #111513; --card: #1b201d; --text: #e9ece9; --muted: #9aa49f; --line: #2c332f;
  --accent: #6fc39a; --accent-2: #4fa57d; --good: #6fc39a; --bad: #ff8a80; --warn: #f0b04c;
  --pause: #f0b04c; --chip: #262c29;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
a { color: var(--accent-2); }
.top {
  position: sticky; top: 0; z-index: 5; background: var(--accent); color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; font-weight: 600;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .top { background: #16261e; } }
main { max-width: 720px; margin: 0 auto; padding: 12px 16px; }
h1 { font-size: 1.3rem; margin: 0 0 8px; overflow-wrap: anywhere; }
h2 { font-size: 1.05rem; margin: 0 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 12px; }
.card.narrow { max-width: 420px; margin: 40px auto; }
.muted, small { color: var(--muted); }
.good { color: var(--good); } .badtext { color: var(--bad); } .warn { color: var(--warn); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.right { text-align: right; }
.stack { display: flex; flex-direction: column; gap: 10px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .92rem; color: var(--muted); }
label.check, label.radio { flex-direction: row; align-items: center; gap: 10px; color: var(--text); min-height: 40px; }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
}
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; accent-color: var(--accent-2); }
input.short { width: 90px; }
textarea { resize: vertical; }
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--chip); color: var(--text);
  font: inherit; font-weight: 600; border-radius: 12px; min-height: var(--tap); padding: 0 16px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.btn.small { min-height: 36px; font-size: .9rem; padding: 0 12px; }
.btn.wide { width: 100%; }
.btn.primary { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn.danger { color: var(--bad); }
.btn:active { transform: scale(.98); }
.controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.controls form, .controls .btn { width: 100%; }
.controls .btn { min-height: 60px; font-size: 1.1rem; }
.btn.go { background: var(--good); border-color: var(--good); color: #fff; }
.btn.pause { background: var(--pause); border-color: var(--pause); color: #fff; }
.btn.stop { background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 800; }
.state .big { font-size: 1.6rem; font-weight: 700; }
.state-running .big { color: var(--good); } .state-paused .big { color: var(--pause); } .state-stopped .big { color: var(--bad); }
.label { color: var(--muted); font-size: .85rem; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
  color: var(--text); text-decoration: none; display: flex; flex-direction: column; gap: 2px; font-size: .9rem;
}
.stat.wide { grid-column: 1 / -1; }
.stat .n { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat.hot { border-color: var(--bad); }
.alert { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; border: 1px solid var(--line); background: var(--card); }
.alert.error { border-color: var(--bad); } .alert.warning { border-color: var(--warn); }
.alert .x { background: none; border: 0; font-size: 1.4rem; color: var(--muted); min-width: 36px; min-height: 36px; }
.flash { border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.flash.ok { background: color-mix(in srgb, var(--good) 15%, var(--card)); }
.flash.bad { background: color-mix(in srgb, var(--bad) 15%, var(--card)); }
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs a { text-align: center; padding: 14px 2px; color: var(--muted); text-decoration: none; font-size: .85rem; font-weight: 600; }
.tabs a.on { color: var(--accent-2); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 4px; -webkit-overflow-scrolling: touch; }
.chips a { white-space: nowrap; background: var(--chip); border-radius: 999px; padding: 8px 12px; text-decoration: none; color: var(--text); font-size: .88rem; }
.chips a.on { background: var(--accent-2); color: #fff; }
.list { list-style: none; margin: 0 0 12px; padding: 0; }
.list li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; padding: 12px; overflow-wrap: anywhere; }
.list li > a { display: block; color: var(--text); text-decoration: none; margin: -12px; padding: 12px; }
.list li.unseen { border-left: 4px solid var(--accent-2); }
.list li.empty { color: var(--muted); text-align: center; }
.menu li > a b { font-size: 1.05rem; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tag { font-size: .78rem; background: var(--chip); border-radius: 6px; padding: 2px 8px; color: var(--muted); }
.tag.good { color: var(--good); } .tag.bad { color: var(--bad); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 0; font-size: .92rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 420px) { .kv { grid-template-columns: 1fr; } .kv dd { margin-bottom: 6px; } }
pre { white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; margin: 6px 0; }
pre.small { font-size: .82rem; color: var(--muted); }
.letter { background: var(--bg); border-radius: 10px; padding: 12px; }
.subject { font-weight: 700; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.job { padding: 8px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.job:last-child { border-bottom: 0; }
.backlink { display: inline-block; margin-bottom: 8px; text-decoration: none; }
.pager { display: flex; justify-content: space-between; padding: 8px 0; }
.log { width: 100%; border-collapse: collapse; font-size: .85rem; }
.log td { border-bottom: 1px solid var(--line); padding: 6px 4px; vertical-align: top; overflow-wrap: anywhere; }
.log td:first-child { white-space: nowrap; color: var(--muted); }
.days { display: flex; flex-wrap: wrap; gap: 4px 12px; }
details summary { cursor: pointer; font-weight: 600; min-height: 36px; display: flex; align-items: center; }
code { font-size: .85rem; overflow-wrap: anywhere; }
form.inline { margin-bottom: 8px; }
[hidden] { display: none !important; }
