:root {
  --bg: #090b0f;
  --bg-2: #0d1016;
  --surface: #11151c;
  --surface-2: #161b24;
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .13);
  --text: #e9ecf2;
  --muted: #8b93a7;
  --faint: #5d6579;
  --sky: #5bb6ff;
  --sky-2: #2f8fe0;
  --sky-soft: rgba(91, 182, 255, .12);
  --ok: #3ddc97;
  --warn: #f2b84b;
  --down: #ff6b6b;
  --ok-soft: rgba(61, 220, 151, .12);
  --warn-soft: rgba(242, 184, 75, .12);
  --down-soft: rgba(255, 107, 107, .12);
  --radius: 14px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 32px rgba(0, 0, 0, .35);
  font-family: 'Heebo', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); overflow-x: hidden; -webkit-text-size-adjust: 100%; }
body { font-size: 15px; line-height: 1.55; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
.ic { flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.muted-p { color: var(--muted); margin: 0 0 14px; }
.ltr { direction: ltr; unicode-bidi: embed; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; direction: ltr; unicode-bidi: embed; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--bg-2); border-inline-end: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(145deg, #1b2a3d, #0e1620); border: 1px solid var(--line-2); display: grid; place-items: center; color: var(--sky); }
.brand b { font-size: 16px; display: block; line-height: 1.1; }
.brand small { color: var(--muted); font-size: 12px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; transition: background .15s, color .15s; }
.nav a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--sky-soft); color: var(--sky); }
.nav .count { margin-inline-start: auto; font-size: 12px; background: var(--surface-2); border-radius: 99px; padding: 1px 8px; color: var(--muted); }
.nav .count.bad { background: var(--down-soft); color: var(--down); }
.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 8px; font-size: 13px; }
.who { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 600; color: var(--sky); border: 1px solid var(--line-2); }
.main { min-width: 0; padding: 26px 34px 80px; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.topbar h1 { font-size: 24px; }
.topbar .grow { flex: 1; }
.menu-btn { display: none; }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 0 12px; min-width: 240px; }
.search input { background: none; border: 0; outline: 0; padding: 9px 0; width: 100%; }
.search:focus-within { border-color: var(--sky-2); }

/* ---------- primitives ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card h2 { font-size: 15px; color: var(--muted); font-weight: 500; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack { display: grid; gap: 14px; }
.btn { display: inline-flex; align-items: center; gap: 7px; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text); border-radius: 10px; padding: 8px 14px; cursor: pointer; transition: border-color .15s, background .15s; white-space: nowrap; }
.btn:hover { border-color: var(--sky-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--sky); border-color: var(--sky); color: #04101c; font-weight: 600; }
.btn.primary:hover { background: #7cc6ff; }
.btn.danger { background: var(--down-soft); border-color: rgba(255, 107, 107, .4); color: var(--down); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.ghost { background: transparent; }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.live, .badge.active, .badge.ok { background: var(--ok-soft); color: var(--ok); border-color: rgba(61, 220, 151, .25); }
.badge.beta, .badge.paused, .badge.warn, .badge.pending { background: var(--warn-soft); color: var(--warn); border-color: rgba(242, 184, 75, .25); }
.badge.dev, .badge.sky { background: var(--sky-soft); color: var(--sky); border-color: rgba(91, 182, 255, .25); }
.badge.down, .badge.off { background: var(--down-soft); color: var(--down); border-color: rgba(255, 107, 107, .25); }
.badge.planned, .badge.prospect { background: transparent; border-style: dashed; border-color: var(--line-2); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.dot.down { background: var(--down); box-shadow: 0 0 0 3px var(--down-soft); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px transparent; } }

table { width: 100%; border-collapse: collapse; }
th { text-align: start; font-weight: 500; color: var(--muted); font-size: 13px; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: rgba(255, 255, 255, .025); }
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; color: var(--muted); }
input, select, textarea { background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 12px; width: 100%; outline: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--sky-2); box-shadow: 0 0 0 3px var(--sky-soft); }
textarea { min-height: 84px; resize: vertical; }
input[type=checkbox] { width: auto; accent-color: var(--sky); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(14px) 55%, calc(9px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-inline-start: 28px; }
.chk { display: flex; align-items: center; gap: 8px; padding: 4px 0; }

.kpi { display: grid; gap: 4px; }
.kpi b { font-size: 30px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi.ok b { color: var(--ok); } .kpi.warn b { color: var(--warn); } .kpi.down b { color: var(--down); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; color: var(--muted); padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--sky); border-bottom-color: var(--sky); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 5px 13px; cursor: pointer; color: var(--muted); font-size: 13px; }
.chip.on { background: var(--sky-soft); border-color: rgba(91, 182, 255, .4); color: var(--sky); }
.bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--sky); border-radius: 99px; }
.bar.warn > i { background: var(--warn); } .bar.down > i { background: var(--down); }
.spark { width: 100%; height: 40px; display: block; }
.empty { text-align: center; color: var(--muted); padding: 38px 10px; }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.logbox { background: #05070a; border: 1px solid var(--line); border-radius: 10px; padding: 12px; max-height: 420px; overflow: auto; font: 12px/1.65 ui-monospace, Menlo, Consolas, monospace; direction: ltr; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; color: #b6bfd0; }

/* ---------- tool cards ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; cursor: pointer; display: grid; gap: 10px; transition: border-color .15s, transform .15s; }
.tool:hover { border-color: var(--line-2); transform: translateY(-1px); }
.tool.is-down { border-color: rgba(255, 107, 107, .45); }
.tool.is-warn { border-color: rgba(242, 184, 75, .4); }
.tool h3 { font-size: 15px; display: flex; align-items: center; gap: 9px; }
.tool p { margin: 0; color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tool .meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--faint); gap: 8px; }
.blocker { font-size: 12.5px; color: var(--warn); background: var(--warn-soft); border-radius: 8px; padding: 6px 10px; display: flex; gap: 7px; align-items: flex-start; }

/* ---------- matrix ---------- */
.matrix { border-collapse: separate; border-spacing: 0; }
.matrix th, .matrix td { padding: 6px; text-align: center; border-bottom: 1px solid var(--line); border-inline-start: 1px solid var(--line); }
.matrix thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; vertical-align: bottom; height: 150px; }
.matrix thead th span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; font-size: 12.5px; max-height: 140px; overflow: hidden; text-overflow: ellipsis; display: inline-block; }
.matrix tbody th { position: sticky; inset-inline-start: 0; background: var(--surface); text-align: start; min-width: 190px; z-index: 1; }
.cell { width: 26px; height: 26px; border-radius: 8px; display: inline-grid; place-items: center; border: 1px solid transparent; cursor: pointer; background: transparent; color: var(--faint); }
.cell.active { background: var(--ok-soft); color: var(--ok); border-color: rgba(61, 220, 151, .3); }
.cell.paused { background: var(--warn-soft); color: var(--warn); border-color: rgba(242, 184, 75, .3); }
.cell.pending { background: var(--sky-soft); color: var(--sky); border-color: rgba(91, 182, 255, .3); }
.cell.gap { border: 1px dashed rgba(255, 107, 107, .5); color: var(--down); }
.cell.none:hover { border: 1px dashed var(--line-2); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 14px; align-items: center; }

/* ---------- roadmap ---------- */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.col h2 { margin-bottom: 10px; }
.item { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 8px; cursor: pointer; margin-bottom: 10px; }
.item:hover { border-color: var(--line-2); }
.item h3 { font-size: 14.5px; }
.item p { margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- feed ---------- */
.feed { display: grid; }
.feed-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line); align-items: start; }
.feed-row:last-child { border-bottom: 0; }
.feed-row .t { overflow-wrap: anywhere; }
.feed-row .m { font-size: 12.5px; color: var(--muted); }
.feed-row time { font-size: 12px; color: var(--faint); white-space: nowrap; }

/* ---------- ent cards ---------- */
.ent { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 10px; }
.ent.is-paused { border-color: rgba(242, 184, 75, .35); }
.ent h3 { font-size: 14.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.usage { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.usage b { color: var(--text); font-weight: 500; }

/* ---------- modal / toast ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(3, 5, 8, .72); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; width: min(480px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.modal.wide { width: min(760px, 100%); }
.modal header, .modal footer { padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal header { border-bottom: 1px solid var(--line); }
.modal header h3 { font-size: 17px; }
.modal footer { border-top: 1px solid var(--line); justify-content: flex-end; }
.modal-body { padding: 20px; overflow-y: auto; }
#toasts { position: fixed; bottom: 18px; inset-inline-start: 18px; display: grid; gap: 8px; z-index: 80; }
.toast { background: var(--surface-2); border: 1px solid var(--line-2); border-inline-start: 3px solid var(--ok); border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); max-width: 360px; animation: in .2s ease; }
.toast.err { border-inline-start-color: var(--down); }
.toast.out { opacity: 0; transition: opacity .5s; }
@keyframes in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(900px 500px at 50% -10%, rgba(91, 182, 255, .12), transparent 60%), var(--bg); }
.login { width: min(420px, 100%); display: grid; gap: 18px; }
.login .brand { justify-content: center; padding: 0; }
.err-box { background: var(--down-soft); color: var(--down); border-radius: 10px; padding: 9px 12px; font-size: 14px; }
.secret { font: 600 17px ui-monospace, Menlo, monospace; letter-spacing: .12em; direction: ltr; text-align: center; background: var(--bg-2); border: 1px dashed var(--line-2); border-radius: 10px; padding: 12px; user-select: all; overflow-wrap: anywhere; }

@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 280px; z-index: 40; transform: translateX(100%); transition: transform .2s; box-shadow: 0 0 60px rgba(0, 0, 0, .6); }
  .side.open { transform: none; }
  .menu-btn { display: inline-grid; }
  .main { padding: 18px 14px 80px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .search { min-width: 0; flex: 1; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { margin-top: 6px; }
  .topbar h1 { font-size: 20px; }
}

.btn.block { width: 100%; justify-content: center; }
.small-link { font-size: 12px; text-align: center; display: block; }
.hidden { display: none !important; }
.headline { font-size: 18px; font-weight: 600; }
h2.big { font-size: 20px; color: var(--text); font-weight: 600; margin: 0; display: block; }
.mt { margin-top: 12px; }
.small { font-size: 12.5px; }
.kpi b.sm { font-size: 22px; }
.blocker.next { background: var(--sky-soft); color: var(--sky); margin-top: 8px; }
.card.flush { padding: 0; }
.warn-t { color: var(--warn); }
.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
h4.sub { margin: 0 0 10px; font-size: 14px; color: var(--muted); font-weight: 500; }
.row.inline { display: inline-flex; }
ul.plain { margin: 0; padding-inline-start: 18px; color: var(--muted); display: grid; gap: 6px; }
.scope { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 14px; max-height: 190px; overflow: auto; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); }
.stack > *, .grid > * { min-width: 0; }
.kv dd .ltr { display: inline-block; }
.server.is-down { border-color: rgba(255, 107, 107, .45); }
.server.is-warn { border-color: rgba(242, 184, 75, .4); }
.meter { display: grid; gap: 6px; }
.spark.thin { height: 30px; }
