:root {
  --bg: #0b0f0d;
  --bg-2: #111714;
  --card: #141b17;
  --card-2: #18211c;
  --line: #233029;
  --line-2: #2e3d35;
  --text: #e8efe9;
  --muted: #93a39a;
  --faint: #66756c;
  --accent: #2fd27a;
  --accent-2: #25b468;
  --accent-ink: #04170c;
  --accent-soft: rgba(47, 210, 122, 0.12);
  --warn: #f2b84b;
  --warn-soft: rgba(242, 184, 75, 0.12);
  --bad: #f26d5b;
  --bad-soft: rgba(242, 109, 91, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: Manrope, Inter, system-ui, sans-serif; font-weight: 800; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 28px; line-height: 1.2; }
h2 { font-size: 19px; line-height: 1.3; }
h3 { font-size: 16px; }
p { margin: 0; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

/* Shell */
.top {
  position: sticky; top: 0; z-index: 10;
  background: rgba(11, 15, 13, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-in { max-width: 1240px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-family: Manrope, sans-serif; font-weight: 800; font-size: 17px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; }
.brand-mark span { width: 5px; height: 9px; border-radius: 3px; background: var(--accent-ink); display: inline-block; margin: 0 2px; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--muted); padding: 7px 12px; border-radius: 999px; white-space: nowrap; font-weight: 500; font-size: 14px; }
.nav a:hover { color: var(--text); background: var(--bg-2); text-decoration: none; }
.nav a.on { color: var(--text); background: var(--card-2); }
.top-out { margin: 0; }
.main { max-width: 1240px; margin: 0 auto; padding: 32px 24px 80px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.head p { color: var(--muted); margin-top: 6px; }
.section { margin-top: 36px; }
.section > h2 { margin-bottom: 14px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }

/* Cards and grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat b { display: block; font-family: Manrope, sans-serif; font-weight: 800; font-size: 26px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; }
.inst-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.inst-head h3 { font-size: 17px; }
.inst-sub { color: var(--muted); font-size: 13px; margin-top: 2px; word-break: break-all; }
.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 10px; margin-top: 16px; }
.kv div span { display: block; color: var(--faint); font-size: 12px; }
.kv div b { font-weight: 600; font-size: 15px; }
.meters { margin-top: 16px; display: grid; gap: 8px; }
.meter { display: grid; grid-template-columns: 64px 1fr 92px; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.meter i { display: block; height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.meter i em { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.meter i em.hot { background: var(--warn); }
.meter i em.full { background: var(--bad); }
.meter b { text-align: right; font-weight: 500; color: var(--text); }
.card-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); align-items: center; }
.note { color: var(--muted); font-size: 13px; }
.note-warn { color: var(--warn); font-size: 13px; }
.empty { color: var(--muted); padding: 28px; text-align: center; border: 1px dashed var(--line-2); border-radius: var(--radius); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--card-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--faint); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; background: var(--bg-2); }
tr:last-child td { border-bottom: none; }
td .sub { color: var(--muted); font-size: 12px; display: block; overflow-wrap: anywhere; }
td .sub.mail { white-space: nowrap; overflow-wrap: normal; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.link-row { cursor: pointer; }
tr.link-row:hover td { background: var(--card-2); }

/* Forms */
form.stack { display: grid; gap: 16px; }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 500; }
label .hint { color: var(--muted); font-weight: 400; font-size: 12px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="url"], input[type="search"], select, textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text);
  border-radius: var(--radius-sm); padding: 11px 13px; font: inherit; outline: none;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.choice { display: flex; gap: 10px; flex-wrap: wrap; }
.choice label { display: flex; align-items: center; gap: 10px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 11px 14px; cursor: pointer; font-weight: 500; }
.choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 4px; accent-color: var(--accent); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0; display: grid; gap: 14px; }
legend { padding: 0 6px; color: var(--muted); font-size: 13px; }
.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline input, .inline select { width: auto; flex: 1; min-width: 160px; }
.err { color: var(--bad); font-size: 13px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 999px; padding: 10px 18px; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; background: var(--accent); color: var(--accent-ink); white-space: nowrap; }
.btn:hover { background: var(--accent-2); text-decoration: none; }
.btn.ghost { background: transparent; border-color: var(--line-2); color: var(--text); }
.btn.ghost:hover { background: var(--card-2); }
.btn.danger { background: transparent; border-color: rgba(242, 109, 91, 0.4); color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn[disabled] { opacity: 0.5; cursor: default; }
form.inline-form { display: inline; margin: 0; }

/* Flash */
.flash { border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 20px; font-size: 14px; background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(47, 210, 122, 0.25); }
.flash.bad { background: var(--bad-soft); color: var(--bad); border-color: rgba(242, 109, 91, 0.3); }

/* Job */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.steps li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg-2); }
.steps li .ic { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.steps li.done .ic { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.steps li.running .ic { border-color: var(--accent); border-top-color: transparent; animation: spin 0.9s linear infinite; }
.steps li.failed .ic { background: var(--bad); border-color: var(--bad); color: #fff; }
.steps li.skipped { opacity: 0.55; }
.steps li .err { margin-top: 4px; word-break: break-word; }
@keyframes spin { to { transform: rotate(360deg); } }
.log { background: #070a09; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; height: 420px; overflow: auto; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; color: #cfe0d5; }
.log .t { color: var(--faint); }

/* Copy blocks */
.copy-box { position: relative; }
.copy-box pre, .copy-box .value { margin: 0; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 14px; white-space: pre-wrap; word-break: break-word; font-size: 14px; font-family: inherit; }
.copy-box .value { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; padding-right: 96px; }
.copy-box .btn { position: absolute; top: 8px; right: 8px; }

.login { max-width: 400px; margin: 12vh auto 0; padding: 0 16px; }
.login .brand { justify-content: center; margin-bottom: 24px; font-size: 22px; }
.split { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.list-plain { margin: 0; padding-left: 18px; color: var(--muted); }
.list-plain li { margin: 4px 0; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; }
.mt-s { margin-top: 8px; }

@media (max-width: 860px) {
  .split, .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .top-in { padding: 12px 16px; gap: 12px; flex-wrap: wrap; }
  .nav { order: 3; flex-basis: 100%; margin: 0 -16px; padding: 0 16px; }
  .top-out { margin-left: auto; }
  .main { padding: 22px 16px 64px; }
  h1 { font-size: 24px; }
  .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 16px; }
  .log { height: 340px; }
  th, td { padding: 10px 12px; }
  .hide-sm { display: none; }
}
:where(.split, .grid, .grid-2) > .card + .card { margin-top: 0; }
.settings { display: grid; gap: 0; margin-top: 12px; }
.settings div { display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr); gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.settings div:last-child { border-bottom: none; }
.settings dt { color: var(--muted); font-size: 14px; }
.settings dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.settings dd.on::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 8px; }
.settings dd.off { color: var(--faint); }
@media (max-width: 640px) { .settings div { grid-template-columns: 1fr; gap: 2px; } }
