:root {
  --bg: #0b0e14;
  --surface: #131824;
  --surface-2: #1a2030;
  --border: #252d3f;
  --text: #e6e9ef;
  --text-2: #aab2c5;
  --muted: #7f889c;
  --accent: #5b9dff;
  --accent-ink: #08111f;
  --good: #3fb950;
  --warn: #d6a021;
  --crit: #f0605a;
  --neutral: #6e7890;
  --radius: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px 40px; }

header.top {
  position: sticky; top: 0; z-index: 5;
  background: rgba(11, 14, 20, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
header.top .wrap { display: flex; align-items: center; gap: 10px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
h1 { font-size: 18px; margin: 0; font-weight: 650; letter-spacing: .2px; }
.sub { color: var(--muted); font-size: 12.5px; }
.spacer { flex: 1; }

button, .btn {
  font: inherit; font-size: 14px; font-weight: 550;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 13px; min-height: 38px; cursor: pointer;
}
button:hover:not(:disabled) { border-color: #3a4560; background: #20283b; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover:not(:disabled) { background: #7bb0ff; border-color: #7bb0ff; }
button.danger { color: #ffb4b0; }
button.ghost { background: transparent; }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

select, input[type=text], input[type=password], input[type=number] {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; min-height: 38px; width: 100%;
}

h2.section { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 26px 0 10px; font-weight: 600; }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
@media (max-width: 400px) { .grid { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card-head { display: flex; align-items: flex-start; gap: 10px; }
.card-head .title { min-width: 0; flex: 1; }
.card-head h3 { margin: 0; font-size: 17px; font-weight: 650; overflow-wrap: anywhere; }
.card-head .path { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); white-space: nowrap; }
.pill svg { width: 12px; height: 12px; flex: none; }
.pill.good svg { color: var(--good); }
.pill.warn svg { color: var(--warn); }
.pill.crit svg { color: var(--crit); }
.pill.neutral svg { color: var(--neutral); }
.pill.info svg { color: var(--accent); }
.pill.good { border-color: rgba(63, 185, 80, .4); }
.pill.warn { border-color: rgba(214, 160, 33, .45); }
.pill.crit { border-color: rgba(240, 96, 90, .5); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { background: var(--surface-2); border-radius: 8px; padding: 7px 9px; min-width: 0; }
.stat .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; }
.stat .v { font-size: 14.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.git { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.git-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.git-row label { color: var(--muted); font-size: 12px; }
.git-row select { width: auto; flex: 1; min-width: 140px; max-width: 100%; }
.commit { color: var(--text-2); font-size: 13px; overflow-wrap: anywhere; }
.commit .mono { color: var(--muted); }
.note { color: var(--muted); font-size: 12.5px; }
.note.err { color: #ffb4b0; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.actions button { flex: 1 1 auto; }

pre.log {
  margin: 0; background: #070a0f; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px; font-size: 12px; line-height: 1.4; color: var(--text-2);
  max-height: 260px; overflow: auto; white-space: pre; -webkit-overflow-scrolling: touch;
}

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.panel-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.panel-head h3 { margin: 0; font-size: 16px; }

.sites { display: grid; gap: 6px 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); font-size: 13.5px; }
.site { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--border); padding: 4px 0; min-width: 0; }
.site a { overflow-wrap: anywhere; }
.site .up { color: var(--muted); white-space: nowrap; }

.meters { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.meter .row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.meter .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.meter .v { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.meter .d { color: var(--muted); font-size: 12.5px; }
.bar { height: 6px; border-radius: 3px; background: var(--surface-2); margin: 6px 0 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .5s; }
.bar.warn > i { background: var(--warn); }
.bar.crit > i { background: var(--crit); }

.banner { border: 1px solid rgba(240, 96, 90, .5); background: rgba(240, 96, 90, .08); border-radius: 8px; padding: 10px 12px; margin-top: 14px; font-size: 13.5px; }

dialog { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
.dlg { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.dlg.flush { padding: 0; }
.dlg h3 { margin: 0; font-size: 17px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { color: var(--muted); font-size: 12.5px; }
.inline { display: flex; gap: 8px; }
.inline > :first-child { flex: 1; min-width: 0; }
.two { display: grid; grid-template-columns: 1fr 120px; gap: 10px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.check input { margin-top: 3px; width: 17px; height: 17px; }
.browser { border: 1px solid var(--border); border-radius: 8px; max-height: 220px; overflow: auto; background: var(--bg); }
.browser button { display: block; width: 100%; text-align: left; border: 0; border-radius: 0; background: transparent; border-bottom: 1px solid var(--border); font-weight: 400; min-height: 36px; padding: 6px 10px; }
.browser button:last-child { border-bottom: 0; }
.dlg-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(360px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.login h1 { font-size: 20px; }

[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { .bar > i { transition: none; } }
