:root {
  --bg: #f5f5f7; --surface: #fff; --text: #1d1d1f; --muted: #6e6e73; --line: #d8d8de;
  --accent: #0a64d6; --accent-text: #fff; --ok: #1a7f37; --warn: #9a6700; --bad: #c62828;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.05);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111114; --surface: #1c1c21; --text: #f2f2f4; --muted: #9a9aa3; --line: #34343c;
    --accent: #4c9aff; --accent-text: #06121f; --ok: #4cc26a; --warn: #e3b341; --bad: #ff7b72;
    --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111114; --surface: #1c1c21; --text: #f2f2f4; --muted: #9a9aa3; --line: #34343c;
  --accent: #4c9aff; --accent-text: #06121f; --ok: #4cc26a; --warn: #e3b341; --bad: #ff7b72;
  --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
h1 { font-size: 1.7rem; margin: 0 0 .25rem; letter-spacing: -.02em; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .25rem; }
p { margin: .4rem 0 .8rem; }
a { color: var(--accent); }
code, pre { font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }
code { background: color-mix(in srgb, var(--muted) 18%, transparent); padding: .1em .35em; border-radius: 5px; }
pre { background: color-mix(in srgb, var(--muted) 14%, transparent); padding: .75rem; border-radius: 10px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.muted { color: var(--muted); }

.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 1rem;
  padding: calc(.6rem + env(safe-area-inset-top)) calc(1rem + env(safe-area-inset-right)) .6rem calc(1rem + env(safe-area-inset-left));
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 650; color: var(--text); text-decoration: none; }
.brand.big { font-size: 1.5rem; justify-content: center; margin-bottom: 1.2rem; }
.logo { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, #3aa0ff, #0a4fd6); position: relative; }
.logo::after { content: ""; position: absolute; inset: 7px; border: 2px solid #fff; border-radius: 4px; }
.nav { margin-left: auto; display: flex; gap: .25rem; flex-wrap: wrap; }
.nav a, .nav button {
  background: none; border: 0; padding: .4rem .7rem; border-radius: 8px; color: var(--muted);
  font: inherit; text-decoration: none; cursor: pointer;
}
.nav a:hover, .nav button:hover { color: var(--text); }
.nav a.active { color: var(--text); background: color-mix(in srgb, var(--muted) 16%, transparent); }

main { max-width: 1040px; margin: 0 auto; padding: 1.25rem calc(1rem + env(safe-area-inset-right)) 4rem calc(1rem + env(safe-area-inset-left)); }
.view.narrow { max-width: 420px; margin: 8vh auto 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.auth { padding: 1.75rem; }
.stack { display: grid; gap: .9rem; }
label { display: grid; gap: .3rem; font-size: .9rem; color: var(--muted); }
input, select {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 9px; padding: .6rem .7rem; width: 100%; min-width: 0;
}
input:focus-visible, button:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=checkbox] { width: auto; }
button {
  font: inherit; border-radius: 9px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); padding: .55rem .9rem; cursor: pointer;
}
button:hover { border-color: var(--muted); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; font-weight: 600; }
button.danger { color: var(--bad); }
button.link { border: 0; background: none; color: var(--accent); padding: .2rem; }
button.small { padding: .3rem .6rem; font-size: .85rem; }
.error { color: var(--bad); margin: .75rem 0 0; }

.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); margin-top: 1rem; }
.app { display: grid; gap: .6rem; align-content: start; }
.app h2 { margin: 0; font-size: 1.2rem; }
.app .meta { display: flex; flex-wrap: wrap; gap: .25rem .9rem; color: var(--muted); font-size: .85rem; }
.app .msg { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.pill { display: inline-block; padding: .05rem .55rem; border-radius: 99px; font-size: .78rem; border: 1px solid var(--line); color: var(--muted); }
.pill.done, .pill.online { color: var(--ok); border-color: var(--ok); }
.pill.failed { color: var(--bad); border-color: var(--bad); }
.pill.running, .pill.pending { color: var(--warn); border-color: var(--warn); }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin: 1rem 0; overflow-x: auto; }
.tabs a { padding: .55rem .9rem; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--text); border-color: var(--accent); }
.stats { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.stat b { display: block; font-size: 1.8rem; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: .85rem; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: .8rem; white-space: nowrap; }
.form-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); align-items: end; }
details { margin: .5rem 0; }
summary { cursor: pointer; color: var(--accent); }
.copy { display: flex; gap: .5rem; align-items: center; }
.copy code { flex: 1; overflow-wrap: anywhere; padding: .4rem .55rem; }
.handbook h2 { margin-top: 1.6rem; }
mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: inherit; border-radius: 3px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 20;
  bottom: calc(1rem + env(safe-area-inset-bottom)); background: var(--text); color: var(--bg);
  padding: .6rem 1rem; border-radius: 10px; max-width: 90vw; box-shadow: var(--shadow);
}
@media (max-width: 560px) {
  .nav { margin-left: 0; width: 100%; }
  .topbar { flex-wrap: wrap; }
}

.dropzone { display: grid; gap: .25rem; place-items: center; text-align: center; padding: 2.5rem 1rem; border: 2px dashed var(--line); cursor: pointer; }
.dropzone.over, .dropzone:focus-visible { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.ver { display: flex; justify-content: space-between; gap: .75rem; align-items: center; padding: .5rem 0; border-top: 1px solid var(--line); font-size: .9rem; }
.versions { margin-top: .4rem; }
.app .head { display: flex; gap: .85rem; align-items: center; }
.app .head h2 { line-height: 1.2; }
.icon { width: 56px; height: 56px; border-radius: 13px; flex: none; box-shadow: 0 1px 3px rgba(0,0,0,.25); background: var(--bg); }
.icon.fallback { display: grid; place-items: center; font-weight: 700; font-size: 1.5rem; color: #fff; background: linear-gradient(135deg, #3aa0ff, #0a4fd6); }
