:root {
  --bg: #f6f6f3; --surface: #ffffff; --surface-2: #f0f0ec; --fg: #19191d; --muted: #61616b; --line: #e2e2dc;
  --accent: #2f56c9; --accent-fg: #ffffff; --ok: #1f7a4a; --ok-bg: #e3f3ea; --warn: #8a5a00; --warn-bg: #fdf1d8;
  --bad: #b3261e; --bad-bg: #fbe5e3; --idle: #5c5f6b; --idle-bg: #ececf0; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121215; --surface: #1b1b20; --surface-2: #23232a; --fg: #ececf1; --muted: #a2a2ad; --line: #2e2e36;
    --accent: #7f9dff; --accent-fg: #0f1222; --ok: #6fd39c; --ok-bg: #173325; --warn: #f2c260; --warn-bg: #362a10;
    --bad: #ff8a80; --bad-bg: #3a1a18; --idle: #b3b5c0; --idle-bg: #2a2a31; --shadow: none; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted, .sub, .hint { color: var(--muted); }
.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px max(16px, calc((100vw - 1180px) / 2)); border-bottom: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; gap: 12px; align-items: center; }
.brand h1 { font-size: 1.25rem; }
.sub { margin: 2px 0 0; font-size: .875rem; }
.mark { width: 34px; height: 34px; border-radius: 9px; background: conic-gradient(from 210deg, var(--accent), #8b5cf6, #14b8a6, var(--accent)); flex: none; }
main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 48px; }
.btn { font: inherit; font-weight: 600; border-radius: 8px; padding: 7px 14px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: .8125rem; }
.btn.danger { color: var(--bad); }
.btn[disabled] { opacity: .5; cursor: progress; }
.overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); }
.stat .label { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.panel.warn { border-color: var(--warn); }
.panel h2 { font-size: 1rem; margin-bottom: 8px; }
.panel ul { margin: 0; padding: 0; list-style: none; }
.panel li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.panel li:first-child { border-top: 0; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 4px 0 16px; }
.search input { width: min(320px, 100%); padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); font: inherit; }
.search { flex: 0 1 320px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: inherit; font-size: .8125rem; font-weight: 600; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.chip .n { opacity: .7; margin-left: 4px; font-variant-numeric: tabular-nums; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); min-width: 0; }
.card .head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card h3 { font-size: 1.0625rem; overflow-wrap: anywhere; }
.card .cat { font-size: .75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.card .desc { margin: 0; color: var(--muted); font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card a.url { color: var(--accent); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; font-size: .9rem; }
.card a.url:hover { text-decoration: underline; }
.pill { font-size: .75rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; text-transform: capitalize; }
.pill.running { color: var(--ok); background: var(--ok-bg); }
.pill.degraded, .pill.deploying, .pill.created { color: var(--warn); background: var(--warn-bg); }
.pill.failed { color: var(--bad); background: var(--bad-bg); }
.pill.archived, .pill.stopped { color: var(--idle); background: var(--idle-bg); }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: .8125rem; margin: 0; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .8125rem; }
th, td { text-align: left; padding: 6px 8px; border-top: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; border-top: 0; }
td.err { color: var(--bad); white-space: normal; min-width: 200px; }
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--fg); padding: 20px; width: min(420px, calc(100vw - 32px)); }
dialog.wide { width: min(880px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog::backdrop { background: rgba(10, 10, 14, .45); }
dialog h2 { font-size: 1.125rem; margin-bottom: 8px; }
dialog label { display: block; font-weight: 600; margin: 12px 0 6px; }
dialog input { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); font: inherit; }
.row { display: flex; gap: 8px; }
.row.end { justify-content: flex-end; margin-top: 16px; }
.dhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.error { color: var(--bad); min-height: 1.25em; margin: 8px 0 0; }
pre.logs { background: #0f0f12; color: #d7d7de; padding: 12px; border-radius: 8px; overflow: auto; max-height: 55vh; font-size: .75rem; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; max-width: calc(100vw - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; margin: 8px 0 16px; font-size: .875rem; }
.kv div span { display: block; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
@media (max-width: 760px) {
  .overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: 1fr; }
  .top { padding: 14px 16px; }
  .sub { display: none; }
}
