:root {
  --bg: #05070a;
  --bg-soft: #0a0e14;
  --panel: #0d131c;
  --panel-2: #111927;
  --line: #1b2535;
  --line-bright: #27374e;
  --text: #e3ebf5;
  --text-dim: #93a4bd;
  --text-faint: #5a6b80;
  --accent: #3ddc97;
  --accent-cyan: #34e2e2;
  --accent-glow: rgba(61, 220, 151, 0.25);
  --red: #ff5e7a;
  --amber: #ffb454;
  --violet: #9d7bff;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ambient layers */
.grid-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 0%, black, transparent 75%);
  opacity: 0.35;
}
.scanlines {
  position: fixed; inset: 0; z-index: 999; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0, rgba(0,0,0,0) 2px, rgba(0,0,0,0.18) 3px, rgba(0,0,0,0) 4px);
  mix-blend-mode: multiply; opacity: 0.5;
}
main { position: relative; z-index: 1; }

/* ---------- shared ---------- */
.mono-dim { color: var(--text-dim); }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px; border: 1px solid var(--line-bright); border-radius: 4px;
  font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.dot.warn { background: var(--amber); box-shadow: 0 0 8px rgba(255,180,84,0.4); }
.status-bubbles { display: flex; gap: 4px; align-items: center; }
.bubble { display: inline-block; width: 9px; height: 9px; border-radius: 50%; opacity: 0.9; }
button { font-family: var(--mono); cursor: pointer; }
.btn {
  background: var(--accent); color: #04140d; border: none; border-radius: 6px;
  padding: 11px 18px; font-weight: 700; letter-spacing: 0.03em;
  transition: transform .08s ease, box-shadow .2s ease;
  box-shadow: 0 0 0 1px rgba(61,220,151,.4), 0 8px 30px -10px var(--accent-glow);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px var(--accent), 0 10px 34px -8px var(--accent-glow); }
.btn:active { transform: translateY(0); }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--line-bright); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent); }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 420px; background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line-bright); border-radius: 14px; padding: 34px 30px;
  box-shadow: 0 40px 120px -40px #000, inset 0 1px 0 rgba(255,255,255,.03);
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 25%, #142a20, #061009);
  border: 1px solid var(--accent); color: var(--accent); font-weight: 600; box-shadow: 0 0 22px -6px var(--accent-glow);
}
.brand h1 { font-size: 15px; margin: 0; letter-spacing: 0.04em; }
.brand small { color: var(--text-dim); display: block; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; }
.auth-card h2 { font-size: 13px; color: var(--text-dim); font-weight: 500; margin: 26px 0 16px; letter-spacing: .04em; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .12em; margin-bottom: 6px; }
.field input {
  width: 100%; background: #070b11; border: 1px solid var(--line-bright); border-radius: 7px;
  padding: 11px 13px; color: var(--text); font-family: var(--mono); font-size: 14px; outline: none;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.auth-actions { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.steps { display: flex; gap: 8px; margin: 18px 0 4px; }
.step { flex: 1; height: 3px; border-radius: 2px; background: var(--line); }
.step.on { background: var(--accent); box-shadow: 0 0 10px var(--accent-glow); }
.msg { font-size: 12px; margin-top: 14px; min-height: 16px; }
.msg.err { color: var(--red); }
.msg.ok { color: var(--accent); }
.bio { display:flex; align-items:center; gap:12px; padding:14px; border:1px dashed var(--line-bright); border-radius:10px; margin-top:6px; }
.bio svg { flex:none; }
.bio p { margin:0; font-size:12px; color: var(--text-dim); }
.blink::after { content:'_'; color: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- app shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 18px;
  padding: 14px 26px; border-bottom: 1px solid var(--line); background: rgba(5,7,10,.82); backdrop-filter: blur(10px);
}
.topbar .brand h1 { font-size: 14px; }
.topbar .spacer { flex: 1; }
.stat-pill { display:flex; flex-direction:column; align-items:flex-start; padding: 0 16px; border-left: 1px solid var(--line); }
.stat-pill b { font-size: 16px; color: var(--text); font-weight: 700; }
.stat-pill span { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .14em; }
/* live indicator */
.live { display:flex; align-items:center; gap:7px; padding: 0 14px; margin: 0 4px 0 12px; border-left:1px solid var(--line); }
.live .ld { width:8px; height:8px; border-radius:50%; background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); animation: breathe 2.4s ease-in-out infinite; }
.live .lbl { font-size:10px; text-transform:uppercase; letter-spacing:.16em; color: var(--text-faint); }
.live.pulse .ld { animation: none; background: var(--accent-cyan); box-shadow: 0 0 14px var(--accent-cyan); }
.live.pulse .lbl { color: var(--accent-cyan); }
@keyframes breathe { 0%,100%{ opacity:.4 } 50%{ opacity:1 } }
.tag.behind { border-color: var(--amber); color: var(--amber); }
.tag.ahead { border-color: var(--accent-cyan); color: var(--accent-cyan); }

.layout { display: grid; grid-template-columns: 280px 1fr; gap: 0; min-height: calc(100vh - 57px); }
.sidebar { border-right: 1px solid var(--line); padding: 22px 18px; position: sticky; top: 57px; align-self: start; max-height: calc(100vh - 57px); overflow:auto; }
.sidebar h3 { font-size: 11px; color: var(--text-faint); letter-spacing: .16em; text-transform: uppercase; margin: 0 0 12px; }
.svc-row { display:flex; align-items:center; justify-content:space-between; gap:8px; padding: 7px 9px; border-radius: 7px; cursor:pointer; border:1px solid transparent; }
.svc-row:hover { background: var(--panel); border-color: var(--line); }
.svc-row.active { background: var(--panel-2); border-color: var(--accent); }
.svc-row .name { font-size: 12.5px; }
.svc-row .count { font-size: 11px; color: var(--accent); background: #0c1b14; border:1px solid #163325; padding: 1px 7px; border-radius: 20px; }
.content { padding: 24px 30px 80px; }

/* product group + cards */
.group-head { display:flex; align-items:center; gap:12px; margin: 26px 0 14px; }
.group-head:first-child { margin-top: 6px; }
.group-head h2 { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; margin:0; color: var(--text); }
.group-head .rule { flex:1; height:1px; background: var(--line); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card {
  position: relative; background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line); border-radius: 12px; padding: 16px 16px 14px; cursor: pointer; overflow: hidden;
  transition: border-color .15s ease, transform .1s ease;
}
.card::before { content:''; position:absolute; left:0; top:0; bottom:0; width:3px; background: var(--card-accent, var(--accent)); opacity:.8; }
.card:hover { border-color: var(--line-bright); transform: translateY(-2px); }
.card:hover::before { box-shadow: 0 0 18px var(--card-accent, var(--accent)); }
.card .ttl { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.card .ttl h4 { margin:0; font-size: 14.5px; font-weight: 700; }
.card .meta { display:flex; flex-wrap:wrap; gap: 6px; margin: 10px 0 12px; }
.card .meta .tag { font-size: 10px; padding: 1px 7px; }
.card .nums { display:flex; gap: 18px; margin-top: 10px; }
.card .nums div { display:flex; flex-direction:column; }
.card .nums b { font-size: 15px; }
.card .nums span { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .1em; }
.svc-chips { display:flex; flex-wrap:wrap; gap:5px; margin-top: 12px; }
.chip { font-size: 10.5px; padding: 2px 8px; border-radius: 5px; border:1px solid var(--line-bright); color: var(--text-dim); white-space:nowrap; }
.chip.hot { border-color: var(--accent); color: var(--accent); }
.spark { display:flex; align-items:flex-end; gap:2px; height:26px; margin-top: 12px; }
.spark i { flex:1; background: var(--card-accent, var(--accent)); opacity:.5; border-radius:1px; min-height:1px; }

/* ---------- detail ---------- */
.detail-head { display:flex; align-items:flex-start; gap:16px; margin-bottom: 8px; }
.back { color: var(--text-dim); font-size: 12px; background:none; border:none; padding:0; margin-bottom: 16px; display:flex; gap:6px; align-items:center; }
.back:hover { color: var(--accent); }
.detail-head h1 { margin: 0; font-size: 24px; letter-spacing: .01em; }
.detail-head .sub { color: var(--text-dim); font-size: 12.5px; margin-top: 4px; }
.kpis { display:grid; grid-template-columns: repeat(auto-fit, minmax(130px,1fr)); gap: 12px; margin: 20px 0 24px; }
.kpi { background: var(--panel); border:1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.kpi b { display:block; font-size: 22px; font-weight: 600; color: var(--text); }
.kpi b.green { color: var(--accent); } .kpi b.red { color: var(--red); }
.kpi span { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .12em; }
.panel { background: var(--panel); border:1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 18px; }
.panel h3 { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-dim); margin: 0 0 14px; }
.cols { display:grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 880px){ .cols { grid-template-columns: 1fr; } .layout { grid-template-columns: 1fr; } .sidebar { display:none; } }
.lang-row { display:flex; align-items:center; gap:10px; margin-bottom:8px; font-size:12px; }
.lang-row .bar { flex:1; height:7px; background: var(--line); border-radius:4px; overflow:hidden; }
.lang-row .bar i { display:block; height:100%; background: linear-gradient(90deg, var(--accent), var(--accent-cyan)); }
.lang-row .ext { width:54px; color: var(--text); } .lang-row .c { width:42px; text-align:right; color: var(--text-faint); }
.svc-grid { display:flex; flex-wrap:wrap; gap:8px; }
.svc-card { border:1px solid var(--line-bright); border-radius:8px; padding:8px 11px; min-width: 130px; }
.svc-card .n { font-size:13px; font-weight:600; color: var(--text); }
.svc-card .c { font-size:10px; color: var(--text-faint); text-transform:uppercase; letter-spacing:.1em; }
.svc-card .e { font-size:10px; color: var(--accent); margin-top:3px; }

/* commit log */
.commits { display:flex; flex-direction:column; gap:6px; }
.commit { background: var(--bg-soft); border:1px solid var(--line); border-radius: 9px; overflow:hidden; }
.commit > summary { list-style:none; cursor:pointer; padding: 11px 14px; display:flex; align-items:center; gap:12px; }
.commit > summary::-webkit-details-marker { display:none; }
.commit .hash { font-size: 11.5px; color: var(--accent-cyan); background:#08171c; border:1px solid #103038; padding:2px 7px; border-radius:5px; flex:none; }
.commit .subj { flex:1; font-size: 13px; color: var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.commit .delta { font-size: 11px; flex:none; }
.commit .delta .a { color: var(--accent); } .commit .delta .d { color: var(--red); }
.commit .who { font-size: 11px; color: var(--text-faint); flex:none; }
.commit[open] { border-color: var(--line-bright); }
.commit .body { padding: 4px 14px 14px; }
.commit .body pre { white-space: pre-wrap; word-break: break-word; color: var(--text-dim); font-size: 12px; margin: 6px 0 12px; padding-left: 12px; border-left: 2px solid var(--line-bright); }
.filelist { display:flex; flex-direction:column; gap:3px; }
.filelist .f { display:flex; align-items:center; gap:10px; font-size: 11.5px; }
.filelist .f .p { flex:1; color: var(--text-dim); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.filelist .f .a { color: var(--accent); width:46px; text-align:right; } .filelist .f .d { color: var(--red); width:46px; }
.loading { color: var(--text-dim); padding: 40px; text-align:center; }
.center { display:grid; place-items:center; min-height: 60vh; }

/* topbar nav */
.nav { display:flex; gap:4px; margin-left:18px; }
.navbtn { background:transparent; border:1px solid transparent; color:var(--text-dim); font-size:12px; padding:6px 12px; border-radius:7px; letter-spacing:.04em; }
.navbtn:hover { color:var(--text); background:var(--panel); }
.navbtn.on { color:var(--accent); border-color:var(--line-bright); background:var(--panel-2); }
.nbadge:empty { display:none; }
.nbadge { display:inline-block; min-width:16px; padding:0 5px; margin-left:4px; border-radius:9px; font-size:10px; line-height:16px; text-align:center; background:var(--amber); color:#1a1206; font-weight:600; }
.nbadge.crit { background:var(--red); color:#fff; }
.alertrow { display:grid; grid-template-columns:64px 160px 1fr auto; gap:12px; align-items:center; padding:11px 14px; background:var(--panel); border:1px solid var(--line); border-left-width:3px; border-radius:9px; margin-bottom:7px; cursor:pointer; }
.alertrow:hover { border-color:var(--line-bright); }
.alertrow.critical { border-left-color:var(--red); }
.alertrow.warn { border-left-color:var(--amber); }
.alertrow.info { border-left-color:var(--text-faint); }
.alertrow .sev { font-size:9.5px; text-transform:uppercase; letter-spacing:.1em; text-align:center; padding:2px 0; border-radius:4px; }
.alertrow.critical .sev { color:var(--red); background:#220b11; }
.alertrow.warn .sev { color:var(--amber); background:#1f1707; }
.alertrow.info .sev { color:var(--text-dim); background:var(--panel-2); }
.alertrow .aapp { color:var(--text); font-size:13px; font-weight:500; }
.alertrow .amsg { color:var(--text-dim); font-size:12.5px; }
.alertrow .acode { color:var(--text-faint); font-size:10.5px; }
@media (max-width:720px){ .alertrow { grid-template-columns:60px 1fr; } .alertrow .amsg,.alertrow .acode { grid-column:2; } }

/* editor launch bar */
.editbar { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin: 4px 0 18px; }
.ed { display:inline-flex; align-items:center; gap:7px; text-decoration:none; font-size:12.5px; font-weight:500; padding:8px 14px; border-radius:7px; border:1px solid var(--line-bright); color:var(--text); background:var(--panel); cursor:pointer; }
.ed:hover { border-color:var(--accent); color:var(--accent); }
.ed.xcode:hover { border-color:var(--accent-cyan); color:var(--accent-cyan); }
.ed.android:hover { border-color:var(--violet); color:var(--violet); }
.ed.live { color:var(--accent); border-color:#1d4030; background:#0b1812; }
.ed.live:hover { border-color:var(--accent); box-shadow:0 0 0 1px var(--accent-glow); }
.edhint { font-size:10.5px; color:var(--text-faint); margin-left:4px; }

/* findings / health */
.score { font-size:12px; padding:2px 9px; border-radius:20px; font-weight:600; margin-left:8px; }
.score.good { color:var(--accent); background:#0c1b14; border:1px solid #1d4030; }
.score.mid { color:var(--amber); background:#1f1707; border:1px solid #3d2f10; }
.score.bad { color:var(--red); background:#220b11; border:1px solid #45151f; }
.finding { display:flex; align-items:center; gap:10px; padding:7px 2px; border-bottom:1px solid var(--line); font-size:12.5px; }
.finding:last-child { border-bottom:none; }
.finding .sev { font-size:9.5px; text-transform:uppercase; letter-spacing:.1em; padding:2px 7px; border-radius:4px; flex:none; width:58px; text-align:center; }
.finding.critical .sev { color:var(--red); background:#220b11; border:1px solid #45151f; }
.finding.warn .sev { color:var(--amber); background:#1f1707; border:1px solid #3d2f10; }
.finding.info .sev { color:var(--text-dim); background:var(--panel-2); border:1px solid var(--line-bright); }
.deepwrap { margin-top:14px; }
.deep { margin-top:10px; }
.deep b { font-size:12px; color:var(--text); } .deep.ok b { color:var(--accent); } .deep.fail b { color:var(--red); }
.deep pre { white-space:pre-wrap; word-break:break-word; font-size:11px; color:var(--text-dim); background:var(--bg-soft); border:1px solid var(--line); border-radius:6px; padding:10px; margin-top:6px; max-height:280px; overflow:auto; }
.hcard { background:linear-gradient(180deg,var(--panel),var(--bg-soft)); border:1px solid var(--line); border-radius:12px; padding:14px 16px; margin-bottom:12px; position:relative; }
.hcard::before { content:''; position:absolute; left:0; top:0; bottom:0; width:3px; background:var(--card-accent); }
.hhead { display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; } .hhead b { font-size:14px; }
.sweep { display:flex; align-items:center; justify-content:space-between; gap:16px; }

/* notes */
.noteadd { display:flex; gap:8px; margin-bottom:12px; }
.noteadd input { flex:1; background:#070b11; border:1px solid var(--line-bright); border-radius:7px; padding:9px 11px; color:var(--text); font-family:var(--mono); font-size:13px; outline:none; }
.noteadd input:focus { border-color:var(--accent); }
.note { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; padding:9px 11px; background:var(--bg-soft); border:1px solid var(--line); border-radius:7px; margin-bottom:6px; font-size:12.5px; }
.note .ndel { background:none; border:none; color:var(--text-faint); font-size:12px; } .note .ndel:hover { color:var(--red); }

/* chat */
.chatpanel { display:flex; flex-direction:column; }
.chatlog { flex:1; min-height:200px; max-height:380px; overflow:auto; display:flex; flex-direction:column; gap:8px; padding:4px 2px 10px; }
.bubble { max-width:88%; padding:9px 12px; border-radius:10px; font-size:12.5px; line-height:1.5; white-space:pre-wrap; word-break:break-word; }
.bubble.user { align-self:flex-end; background:#10261c; border:1px solid #1d4030; color:var(--text); }
.bubble.assistant { align-self:flex-start; background:var(--panel-2); border:1px solid var(--line-bright); color:var(--text); }
.chatbox { display:flex; gap:8px; align-items:flex-end; border-top:1px solid var(--line); padding-top:12px; }
.chatbox textarea { flex:1; resize:vertical; background:#070b11; border:1px solid var(--line-bright); border-radius:8px; padding:10px 12px; color:var(--text); font-family:var(--mono); font-size:13px; outline:none; }
.chatbox textarea:focus { border-color:var(--accent); }

/* costs */
.costrow { display:grid; grid-template-columns:1fr auto; gap:6px 14px; padding:8px 2px; border-bottom:1px solid var(--line); font-size:12.5px; align-items:baseline; }
.costrow .cv { color:var(--accent); font-weight:600; text-align:right; }
.costrow .cl { grid-column:1/-1; font-size:10.5px; color:var(--text-dim); }
.costnote { color:#c4d0e0; font-size:12px; line-height:1.6; } .costnote b { color:var(--text); }
.costnote code, .panel code { background:var(--bg-soft); border:1px solid var(--line); border-radius:4px; padding:1px 5px; font-size:11px; color:var(--text); }

/* command box (macbook setup) — click to copy */
.cmdbox { white-space:pre-wrap; word-break:break-word; font-size:11.5px; line-height:1.55; color:var(--text-dim);
  background:var(--bg-soft); border:1px solid var(--line); border-radius:6px; padding:12px 14px; margin:14px 0 0; cursor:pointer; }
.cmdbox:hover { border-color:var(--accent); }

/* live ops metrics */
.metrics3 { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
@media (max-width:720px){ .metrics3 { grid-template-columns:1fr; } }
.mcard { background:var(--bg-soft); border:1px solid var(--line); border-radius:9px; padding:13px 14px; }
.mh { font-size:10px; text-transform:uppercase; letter-spacing:.12em; color:var(--text-faint); margin-bottom:8px; }
.mbig { font-size:20px; font-weight:600; color:var(--text); display:flex; align-items:center; gap:8px; }
.mbig.warn { color:var(--amber); }
.mbig .munit, .munit { font-size:11px; color:var(--text-dim); font-weight:400; letter-spacing:.04em; margin-left:6px; }
.ddot { width:9px; height:9px; border-radius:50%; display:inline-block; }
.msub { font-size:11px; color:var(--text-dim); margin-top:5px; }
.mlink { display:inline-block; margin-top:7px; font-size:11px; color:var(--accent-cyan); text-decoration:none; }
.mlink:hover { text-decoration:underline; }
.mhint { font-size:11.5px; color:var(--text-faint); }
.merr { font-size:11.5px; color:var(--red); }
.opsstrip { display:flex; align-items:center; gap:26px; background:linear-gradient(180deg,var(--panel),var(--bg-soft)); border:1px solid var(--line); border-radius:10px; padding:12px 18px; margin-bottom:18px; }
.opsstrip .ops { display:flex; flex-direction:column; }
.opsstrip .ops b { font-size:18px; } .opsstrip .ops span { font-size:10px; text-transform:uppercase; letter-spacing:.12em; color:var(--text-faint); }

/* toast */
#toast { position:fixed; bottom:24px; left:50%; transform:translateX(-50%) translateY(20px); z-index:1000; background:var(--panel-2); border:1px solid var(--accent); color:var(--text); padding:11px 18px; border-radius:9px; font-size:12.5px; opacity:0; pointer-events:none; transition:all .25s ease; box-shadow:0 12px 40px -12px #000; }
#toast.show { opacity:1; transform:translateX(-50%) translateY(0); }
