:root {
  --bg: #F4F3EF; --card: #FFFFFF; --line: #E3E1DA; --line-2: #D9D7CF; --chip: #ECEAE3;
  --ink: #17181C; --ink-2: #3B3D44; --muted: #5E6068;
  --ok: #1F6B44; --ok-bg: #E3F3EA; --ok-dot: #2E9A62;
  --bad: #9A2E16; --bad-bg: #FBE6E0; --bad-dot: #C9442A; --bad-line: #EBB5A6; --bad-text: #8E2A14;
  --quiet: #55575E; --quiet-bg: #ECEAE3;
  --link: #2F5BD3; --link-hover: #1E3F9A;
  --code-bg: #1B1C20; --code-ink: #E9E7E0;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131417; --card: #1C1D21; --line: #2C2E33; --line-2: #393B41; --chip: #2A2C31;
    --ink: #ECEBE6; --ink-2: #C9C8C2; --muted: #9B9DA4;
    --ok: #7FD3A6; --ok-bg: #173325; --ok-dot: #3DB277;
    --bad: #FFB4A1; --bad-bg: #3A1D16; --bad-dot: #E0593C; --bad-line: #6A3326; --bad-text: #FF9F87;
    --quiet: #A9ABB2; --quiet-bg: #2A2C31;
    --link: #8AA8FF; --link-hover: #B5C7FF;
    --code-bg: #0C0D0F;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 Inter, system-ui, -apple-system, sans-serif; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 28px 20px 64px; display: flex; flex-direction: column; gap: 24px; }

header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.5px; }
.sub, .muted { color: var(--muted); }
.head-right { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.btn { height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--card); font-weight: 500; }
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.small { height: 36px; padding: 0 12px; font-size: 13px; }

.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile.bad { border-color: var(--bad-line); }
.tile .k { color: var(--muted); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .6px; }
.tile .v { font-size: 28px; font-weight: 700; }
.tile .v small { font-size: 15px; font-weight: 600; }
.tile .v small.muted { font-weight: 500; }
.tile .alert { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.good { color: var(--ok); } .badc { color: var(--bad); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { height: 36px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 500; border: 1px solid var(--line-2); background: var(--card); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.sep { width: 1px; height: 24px; background: var(--line-2); margin: 0 4px; }
.search { margin-left: auto; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--card); min-width: 220px; }
.search input { border: 0; outline: none; font: inherit; flex: 1; background: transparent; color: var(--ink); min-width: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

section.group { display: flex; flex-direction: column; gap: 12px; }
section.group h2 { margin: 0; font-size: 18px; font-weight: 600; display: flex; align-items: baseline; gap: 10px; }
section.group h2 span { color: var(--muted); font-size: 13px; font-weight: 400; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; scroll-margin-top: 16px; }
.card.fail, .card.down { border-color: var(--bad-line); }
.card:target { outline: 2px solid var(--link); outline-offset: 2px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card h3 .grp { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 4px; }
.meta { color: var(--muted); font-size: 12px; font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desc { margin: 0; color: var(--ink-2); }
.pill { flex-shrink: 0; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--quiet-bg); color: var(--quiet); white-space: nowrap; }
.pill.up, .pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.down, .pill.fail { background: var(--bad-bg); color: var(--bad); }

.job { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; background: var(--bg); border-radius: 8px; }
.job-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dots { display: flex; gap: 3px; min-height: 16px; }
.dot { width: 8px; height: 16px; border-radius: 2px; background: var(--ok-dot); }
.dot.x { background: var(--bad-dot); }
.small { font-size: 12px; color: var(--ink-2); }
.err { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--bad-text); white-space: pre-wrap; word-break: break-all; }
.job-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--link); font-size: 13px; font-weight: 500; min-height: 28px; }
.linkbtn:hover { color: var(--link-hover); text-decoration: underline; }
pre.log { margin: 0; padding: 10px; background: var(--code-bg); color: var(--code-ink); border-radius: 8px; font: 10.5px/1.5 var(--mono); white-space: pre-wrap; word-break: break-all; max-height: 360px; overflow: auto; }
.runhead { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.runhead b { font-weight: 600; }

.foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--chip); color: var(--ink-2); }
.foot .spacer { flex: 1; }
.foot a { font-size: 13px; font-weight: 500; }
.empty { color: var(--muted); padding: 24px 0; }
.banner { padding: 10px 14px; border-radius: 8px; background: var(--bad-bg); color: var(--bad); }

@media (max-width: 600px) {
  .wrap { padding: 20px 16px 48px; gap: 16px; }
  h1 { font-size: 22px; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 12px; }
  .tile .v { font-size: 22px; }
  .tile .v small { font-size: 13px; }
  .filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .chip { flex-shrink: 0; }
  .sep { flex-shrink: 0; }
  .search { margin-left: 0; min-width: 0; width: 100%; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .head-right .when { display: none; }
}

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login form { width: 100%; max-width: 360px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.login label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; }
.login input { height: 44px; border-radius: 8px; border: 1px solid var(--line-2); padding: 0 12px; font: inherit; background: var(--bg); color: var(--ink); }
.login .primary { height: 44px; border-radius: 8px; border: 0; background: var(--ink); color: var(--bg); font-weight: 600; }
.login .msg { color: var(--bad); min-height: 20px; margin: 0; }
