/* ───────────── Tokens ───────────── */
:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 14px;
  --radius-sm: 9px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
[data-theme="dark"] {
  --bg: #08090c;
  --bg-2: #0e1015;
  --card: #111318;
  --card-hi: #161921;
  --line: #1f232d;
  --line-hi: #2c3240;
  --text: #e8eaf0;
  --muted: #8a91a3;
  --faint: #5b6273;
  --chip: #151820;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px -12px rgba(0,0,0,.6);
  --grid-dot: rgba(255,255,255,.045);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f6f7f9;
  --bg-2: #eef0f4;
  --card: #ffffff;
  --card-hi: #ffffff;
  --line: #e3e6ec;
  --line-hi: #cfd4de;
  --text: #11131a;
  --muted: #5d6474;
  --faint: #8c93a3;
  --chip: #ffffff;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px -12px rgba(16,24,40,.12);
  --grid-dot: rgba(0,0,0,.05);
  color-scheme: light;
}

/* ───────────── Base ───────────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background .25s var(--ease), color .25s var(--ease);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
code, kbd { font-family: var(--mono); font-size: .8em; }
kbd {
  padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--line-hi); background: var(--bg-2); color: var(--muted);
}
:focus-visible { outline: 2px solid #8b5cf6; outline-offset: 2px; border-radius: 6px; }

.wrap { width: min(1200px, 100% - 40px); margin-inline: auto; }

.bg-grid {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
}
.bg-grid::after {
  content: ""; position: absolute; inset: -20% 10% auto; height: 520px;
  background: radial-gradient(closest-side, rgba(139,92,246,.18), transparent),
              radial-gradient(closest-side at 70% 40%, rgba(34,197,94,.10), transparent);
  filter: blur(40px);
}

/* ───────────── Top bar ───────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; }
.brand-mark { display: grid; grid-template-columns: repeat(2, 9px); gap: 3px; }
.brand-mark i { width: 9px; height: 9px; border-radius: 3px; background: #8b5cf6; }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(3) { opacity: .55; }
.top-links { display: flex; align-items: center; gap: 6px; }
.top-links a { padding: 6px 10px; border-radius: 8px; color: var(--muted); font-size: 14px; font-weight: 500; transition: color .15s, background .15s; }
.top-links a:hover { color: var(--text); background: var(--bg-2); }
.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: 9px; border: 1px solid var(--line); background: var(--card);
  transition: border-color .15s, transform .15s;
}
.icon-btn:hover { border-color: var(--line-hi); }
.icon-btn:active { transform: scale(.95); }
[data-theme="dark"] .i-sun, [data-theme="light"] .i-moon { display: none; }

/* ───────────── Hero ───────────── */
.hero { padding: 64px 0 28px; }
.eyebrow { margin: 0 0 14px; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
h1 { margin: 0; font-size: clamp(34px, 5.4vw, 60px); line-height: 1.04; letter-spacing: -.035em; font-weight: 700; }
.grad {
  background: linear-gradient(90deg, #a78bfa, #22c55e 55%, #06b6d4);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { max-width: 600px; margin: 18px 0 0; color: var(--muted); font-size: 17px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 34px; max-width: 760px; }
.stat {
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.stat b { display: block; font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12.5px; color: var(--muted); }

/* ───────────── Controls ───────────── */
.controls {
  position: sticky; top: 60px; z-index: 10;
  display: grid; gap: 12px; padding: 14px 0 16px; margin-bottom: 8px;
  background: linear-gradient(var(--bg) 78%, transparent);
}
.search {
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow);
  color: var(--muted); transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: #8b5cf6; box-shadow: 0 0 0 4px rgba(139,92,246,.15); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 15px; }
.search input::-webkit-search-cancel-button { display: none; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row-split { justify-content: space-between; }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  height: 34px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--chip); color: var(--muted);
  font-size: 13.5px; font-weight: 500; transition: all .15s var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--line-hi); }
.chip.on { color: var(--text); border-color: var(--accent, #8b5cf6); background: color-mix(in srgb, var(--accent, #8b5cf6) 14%, var(--chip)); }
.chip .n { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.chip.on .n { color: var(--muted); }

.seg { display: inline-flex; padding: 3px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); }
.seg button {
  height: 30px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent;
  color: var(--muted); font-size: 13px; font-weight: 500; transition: all .15s;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--bg-2); color: var(--text); box-shadow: 0 0 0 1px var(--line-hi) inset; }
.seg-icons button { padding: 0 9px; display: grid; place-items: center; }

.tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.select {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 6px 0 12px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: 13px; color: var(--muted);
}
.select select { border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 500; outline: 0; padding: 4px; cursor: pointer; }
.select select option { background: var(--card); color: var(--text); }

.btn {
  display: inline-flex; align-items: center; gap: 9px; height: 38px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--card);
  font-size: 13px; font-weight: 600; transition: border-color .15s, transform .1s;
}
.btn:hover { border-color: var(--line-hi); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .65; cursor: progress; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.6); }
.btn.busy .pulse { animation: pulse 1.2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

/* ───────────── Sections & grid ───────────── */
.section { margin: 26px 0 40px; animation: rise .4s var(--ease) both; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
.section-head .ico {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; font-size: 16px;
  background: color-mix(in srgb, var(--accent) 16%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.section-head .count { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.section-head .rule { flex: 1; height: 1px; background: var(--line); transform: translateY(-4px); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }

.card {
  --accent: #8b5cf6;
  position: relative; display: flex; flex-direction: column; gap: 12px;
  padding: 18px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: transform .22s var(--ease), border-color .22s, background .22s;
  animation: rise .45s var(--ease) both;
  isolation: isolate; overflow: hidden;
}
.card::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity .3s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--accent) 14%, transparent), transparent 45%);
}
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--card-hi); }
.card:hover::before { opacity: 1; }
.card.dim { opacity: .72; }
.card.dim:hover { opacity: 1; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card-top { display: flex; align-items: flex-start; gap: 12px; }
.avatar {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px;
  font-weight: 700; font-size: 15px; letter-spacing: -.02em; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
}
.title-wrap { flex: 1; min-width: 0; }
.card h3 { margin: 1px 0 3px; font-size: 15.5px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.up { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
.dot.down { background: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,.18); }
.dot.checking { background: #f59e0b; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .01em; border: 1px solid var(--line); color: var(--muted); background: var(--bg-2);
}
.badge.live { color: #22c55e; border-color: rgba(34,197,94,.3); background: rgba(34,197,94,.08); }
.badge.repo { color: #60a5fa; border-color: rgba(96,165,250,.3); background: rgba(96,165,250,.08); }
.badge.wip  { color: #f59e0b; border-color: rgba(245,158,11,.3); background: rgba(245,158,11,.08); }

.pin {
  flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px;
  border: 1px solid transparent; background: transparent; color: var(--faint); transition: all .15s;
}
.pin:hover { color: var(--text); border-color: var(--line); }
.pin.on { color: #f59e0b; }
.pin.on svg { fill: currentColor; }

.desc { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.55; flex: 1; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-family: var(--mono); font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--bg-2); border: 1px solid var(--line); color: var(--muted); }
.note { font-size: 11.5px; color: var(--faint); margin-top: -4px; }

.actions { display: flex; gap: 8px; padding-top: 12px; border-top: 1px dashed var(--line); }
.act {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; border-radius: 9px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text);
  transition: all .15s var(--ease);
}
.act:hover { border-color: var(--line-hi); transform: translateY(-1px); }
.act.primary { background: var(--accent); border-color: transparent; color: #fff; }
.act.primary:hover { filter: brightness(1.08); }
.act.disabled { pointer-events: none; color: var(--faint); background: transparent; border-style: dashed; }
.act.icon-only { flex: none; width: 36px; padding: 0; }
.act svg { flex: none; }

/* ───────────── List view ───────────── */
.list .grid { grid-template-columns: 1fr; gap: 8px; }
.list .card { flex-direction: row; align-items: center; gap: 16px; padding: 12px 14px; }
.list .card:hover { transform: translateX(2px); }
.list .card-top { flex: 0 0 290px; align-items: center; }
.list .desc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .tags, .list .note { display: none; }
.list .actions { border: 0; padding: 0; flex: none; }
.list .act { flex: none; padding: 0 12px; }
.list .act .lbl { display: none; }
.list .act { width: 36px; padding: 0; }

/* ───────────── Empty / footer / toast ───────────── */
.empty { text-align: center; padding: 80px 0; color: var(--muted); }
.empty-title { color: var(--text); font-size: 18px; font-weight: 600; margin: 0 0 6px; }
.link { border: 0; background: none; color: #a78bfa; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

.footer {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 28px 0 40px; margin-top: 20px; border-top: 1px solid var(--line);
  color: var(--faint); font-size: 13px;
}

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  padding: 10px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 500;
  background: var(--text); color: var(--bg); box-shadow: 0 10px 30px rgba(0,0,0,.35);
  transition: all .25s var(--ease); pointer-events: none; z-index: 50;
  white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ───────────── Responsive ───────────── */
@media (max-width: 820px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .list .card-top { flex-basis: auto; flex: 1; }
  .list .desc { display: none; }
}
@media (max-width: 560px) {
  .wrap { width: calc(100% - 28px); }
  .hero { padding-top: 40px; }
  .top-links a { display: none; }
  .row-split { flex-direction: column; align-items: stretch; }
  .seg { overflow-x: auto; }
  .tools { justify-content: space-between; }
  .kbd-help { display: none; }
  .controls { position: static; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
