:root {
  --bg: #f5f6f4; --surface: #ffffff; --ink: #1b1f1d; --muted: #5d6763; --line: #dce1de;
  --accent: #1f6f5c; --accent-ink: #ffffff;
  --attn: #b3261e; --attn-bg: #fbe9e7;
  --notice: #875800; --notice-bg: #fcf0d4;
  --ok: #1f6f5c; --ok-bg: #e2f0eb;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111413; --surface: #191d1b; --ink: #e6ebe8; --muted: #98a39e; --line: #2a312e;
    --accent: #5cc2a7; --accent-ink: #0d1614;
    --attn: #ff8f85; --attn-bg: #3a1b19;
    --notice: #f1c166; --notice-bg: #35280e;
    --ok: #6fd0b5; --ok-bg: #15302a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1 { font-size: 17px; margin: 0; letter-spacing: 0.01em; }
h2 { font-size: 13px; margin: 18px 0 8px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
h2:first-child { margin-top: 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pad { padding: 18px 4px; }
.mono { font-family: var(--mono); font-size: 12.5px; }

button, input {
  font: inherit; color: inherit; border-radius: 6px; border: 1px solid var(--line);
  background: var(--surface); padding: 6px 10px; min-height: 32px;
}
button { cursor: pointer; }
button:hover { border-color: var(--muted); }
button[type=submit], button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.quiet, form.quiet button { background: transparent; }
button.danger { color: var(--attn); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.top {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 8px; }
.summary { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-actions form { margin: 0; }
.top-actions button.quiet { background: transparent; color: var(--ink); border-color: var(--line); font-weight: 400; }

main { max-width: 1400px; margin: 0 auto; padding: 16px 20px 60px; }
section { margin-bottom: 18px; }

.banner { background: var(--attn-bg); color: var(--attn); border-radius: 6px; padding: 8px 12px; margin: 0 0 14px; }

.pill, .chip {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 600;
}
.pill { padding: 3px 11px; font-size: 13px; }
.lvl-attention.pill, .chip.attention { background: var(--attn-bg); color: var(--attn); }
.lvl-notice.pill, .chip.notice { background: var(--notice-bg); color: var(--notice); }
.lvl-ok.pill, .chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.plain { background: transparent; color: var(--muted); border: 1px solid var(--line); font-weight: 500; }

.machines { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.machine {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
}
.machine .name { font-weight: 650; display: flex; align-items: center; gap: 7px; }
.machine .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); flex: none; }
.dot.quiet { background: var(--notice); }
.dot.never { background: transparent; border: 2px solid var(--muted); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.filters { display: inline-flex; }
.filters button { border-radius: 0; margin-left: -1px; }
.filters button:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.filters button:last-child { border-radius: 0 6px 6px 0; }
.filters button[aria-pressed=true] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
#search { flex: 1; min-width: 200px; max-width: 380px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; min-width: 640px; }
th, td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--line); }
thead th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; background: var(--surface); }
tbody tr:last-child > * { border-bottom: 0; }
tr.g > th { font-weight: 400; width: 30%; min-width: 230px; border-left: 3px solid transparent; }
tr.g.lvl-attention > th { border-left-color: var(--attn); }
tr.g.lvl-notice > th { border-left-color: var(--notice); }
tr.g:hover { background: color-mix(in srgb, var(--ink) 3%, transparent); }
.repo-btn {
  all: unset; cursor: pointer; font-weight: 650; font-size: 14.5px; display: inline-flex; gap: 6px; align-items: baseline;
}
.repo-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.repo-btn .caret { color: var(--muted); font-size: 11px; width: 10px; display: inline-block; }
.sub { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.gflag { font-size: 12.5px; margin-top: 4px; overflow-wrap: anywhere; }
.gflag.attention { color: var(--attn); }
.gflag.notice { color: var(--notice); }
td.none { color: var(--muted); }
td.quiet-machine { opacity: 0.72; }
.branch { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; margin-bottom: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.more { font-size: 12px; color: var(--muted); margin-top: 4px; }

tr.detail > td { background: var(--bg); padding: 12px 16px 16px; }
.dgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.dm h3 { font-size: 13px; margin: 0 0 6px; }
.dm h3 span { font-weight: 400; color: var(--muted); }
.co { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin-bottom: 6px; }
.co .path { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.co .line { font-size: 12.5px; margin-top: 3px; overflow-wrap: anywhere; }
.co ul { margin: 5px 0 0; padding-left: 18px; font-size: 12.5px; }
.co li.attention { color: var(--attn); }
.co li.notice { color: var(--notice); }
.co li.ok { color: var(--ok); list-style: none; margin-left: -18px; }

details.fold { margin-top: 6px; }
details.fold > summary { font-weight: 400; font-size: 12.5px; color: var(--muted); padding: 2px 0 6px; }
details { margin-top: 18px; }
details > summary { cursor: pointer; font-weight: 650; padding: 6px 0; }
.manage { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin-top: 8px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
form.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
form.inline input { flex: 1; min-width: 140px; }
form.stack { display: grid; gap: 6px; }
form.stack p { margin: 0 0 8px; }
.machine-list { list-style: none; margin: 0; padding: 0; }
.machine-list li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.machine-list li:first-child { border-top: 0; }
.machine-list .grow { flex: 1; min-width: 140px; }
.token-box { margin: 12px 0; padding: 10px 12px; border: 1px solid var(--accent); border-radius: 6px; }
.token-box p { margin: 0 0 6px; }
.token-box pre {
  margin: 4px 0 10px; padding: 8px 10px; background: var(--bg); border-radius: 5px;
  font-family: var(--mono); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; user-select: all;
}

.login-page { display: grid; place-items: center; min-height: 100vh; }
.login { width: min(340px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 24px; margin: 0; }
.login .brand { margin-bottom: 18px; }
.login h1 { font-size: 20px; }

@media (max-width: 640px) {
  .top { padding: 10px 16px; }
  main { padding: 14px 16px 50px; }
  #updated { display: none; }
}
