:root {
  --bg: #f4f7fa; --panel: #ffffff; --text: #0f172a; --muted: #64748b; --line: rgba(15,23,42,.08);
  --b1: #ef4444; --b2: #f97316; --b3: #0b3b4f;
  --ok: #16a34a; --warn: #d97706; --err: #dc2626;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #08161d; --panel: #0f2732; --text: #e2e8f0; --muted: #94a3b8; --line: rgba(255,255,255,.08); }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 -apple-system, BlinkMacSystemFont, Inter, "Segoe UI", sans-serif; }
code { font: 12.5px ui-monospace, "SF Mono", Menlo, monospace; background: rgba(11,59,79,.08); padding: 1px 6px; border-radius: 5px; word-break: break-all; }
a { color: var(--b3); text-decoration: none; }
@media (prefers-color-scheme: dark) { a { color: var(--b1); } }
h1 { font-size: 24px; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 15px; margin: 0 0 6px; }
.muted { color: var(--muted); }
.error { color: var(--err); margin: 0; }
[hidden] { display: none !important; }

.btn { border: 0; border-radius: 10px; padding: 9px 16px; font: 600 14px inherit; cursor: pointer; background: var(--line); color: var(--text); }
.btn.primary { color: #fff; background: linear-gradient(90deg, var(--b1), var(--b2)); }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn.danger { color: var(--err); background: rgba(220,38,38,.1); }
.btn:disabled { opacity: .45; cursor: default; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(600px 300px at 30% 20%, rgba(239,68,68,.14), transparent), radial-gradient(500px 300px at 70% 80%, rgba(11,59,79,.18), transparent); }
.login-card { width: 340px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 32px; display: grid; gap: 12px; text-align: center; box-shadow: 0 20px 60px -20px rgba(11,59,79,.45); }
.login-card img { margin: 0 auto; border-radius: 14px; }
.login-card h1 { font-size: 20px; }
.login-card p { margin: 0; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(239,68,68,.35); border-color: transparent; }

/* Shell */
.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; padding: 0 8px; }
.brand img { border-radius: 7px; }
.brand span { font-weight: 600; color: var(--muted); }
nav { display: grid; gap: 2px; }
nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--text); font-weight: 500; }
nav a:hover { background: var(--line); }
nav a.active { background: rgba(239,68,68,.12); color: var(--b3); font-weight: 600; }
@media (prefers-color-scheme: dark) { nav a.active { color: var(--b1); } }
nav .i { width: 18px; text-align: center; opacity: .8; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-left: auto; box-shadow: 0 0 0 3px rgba(22,163,74,.2); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.sidebar-foot { margin-top: auto; display: grid; gap: 8px; padding: 0 8px; font-size: 13px; }

.main { padding: 28px 32px 60px; max-width: 1200px; width: 100%; }
.view { display: grid; gap: 18px; }
.view-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }

/* Stat cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; position: relative; overflow: hidden; }
.card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent, var(--b1)); }
.card b { display: block; font-size: 24px; letter-spacing: -.02em; }
.card span { color: var(--muted); font-size: 12.5px; }

/* Chart */
.chart { height: 190px; }
.chart svg { width: 100%; height: 100%; }
.legend { color: var(--muted); font-size: 12px; display: flex; gap: 8px; align-items: center; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw.a { background: var(--b2); } .sw.b { background: var(--b1); opacity: .45; }

.hbar { display: grid; grid-template-columns: 90px 1fr 44px; gap: 10px; align-items: center; margin: 8px 0; font-size: 13px; }
.hbar .track { height: 9px; border-radius: 9px; background: var(--line); overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: linear-gradient(90deg, var(--b1), var(--b2)); border-radius: 9px; }
.hbar b { text-align: right; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table td.actions { text-align: right; white-space: nowrap; }
.table td.actions .btn { margin-left: 6px; }
.logs td { font-size: 13px; }
.logs td:first-child { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.logs tr { cursor: pointer; }
.logs tr.new { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: rgba(239,68,68,.14); } }
.logs pre { margin: 8px 0 0; font: 12px ui-monospace, Menlo, monospace; background: var(--bg); padding: 10px; border-radius: 8px; white-space: pre-wrap; word-break: break-all; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--line); }
.badge.info { color: var(--b3); background: rgba(239,68,68,.1); }
.badge.warn { color: var(--warn); background: rgba(217,119,6,.13); }
.badge.error { color: var(--err); background: rgba(220,38,38,.12); }
.badge.stable { color: var(--ok); background: rgba(22,163,74,.12); }
.badge.beta { color: #7c3aed; background: rgba(124,58,237,.12); }
.badge.off { color: var(--muted); }
.badge.type { background: transparent; border: 1px solid var(--line); color: var(--muted); font-weight: 500; }

/* Filters */
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filters select { width: auto; }
.filters input { width: 280px; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; }

/* Release form */
.drop { display: grid; justify-items: center; gap: 4px; padding: 26px; border: 2px dashed var(--line); border-radius: 14px; cursor: pointer; text-align: center; margin-bottom: 14px; }
.drop.over, .drop:hover { border-color: var(--b1); background: rgba(239,68,68,.05); }
.drop.ready { border-style: solid; border-color: var(--b2); background: rgba(11,59,79,.06); }
.drop-title { font-weight: 700; font-size: 15px; }
.progress { width: 60%; height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--b1), var(--b2)); transition: width .2s; }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
label { display: grid; gap: 5px; font-weight: 600; font-size: 13px; }
label.check { display: flex; font-weight: 500; margin: 10px 0; }
.form-foot { display: flex; justify-content: flex-end; align-items: center; gap: 14px; }
.form-foot .error { margin-right: auto; }

.copy { display: flex; gap: 10px; align-items: center; margin: 8px 0 16px; }
.steps { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 8px; }

.latest b { font-size: 22px; }
.notes ul { margin: 6px 0; padding-left: 18px; }
.empty { color: var(--muted); padding: 18px 0; text-align: center; }

.toast { position: fixed; bottom: 24px; right: 24px; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.25); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  nav { display: flex; flex-wrap: wrap; }
  .sidebar-foot { margin: 0 0 0 auto; display: flex; }
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .main { padding: 20px 16px; }
}

.notice { background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.25); border-radius: 12px; padding: 12px 14px; }
.steps code { white-space: nowrap; }
