/* CLARITY.STATUS — synaptic dashboard.
   Black & grey surface. Purple is the ONLY bar/progress color. */
:root {
  --bg: #000000;
  --bg2: #0b0b0d;
  --panel: rgba(18, 18, 20, 0.82);
  --panel-solid: #121214;
  --grey-1: #141416;
  --grey-2: #1c1c20;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #ededf0;
  --muted: #8a8a92;
  --purple: #8b5cf6;
  --purple-2: #a855f7;
  --purple-glow: rgba(139, 92, 246, 0.55);
  /* semantic accents kept minimal, for state meaning only */
  --amber: #f5b544;
  --red: #f87171;
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  background: radial-gradient(1200px 700px at 15% -10%, #161618 0%, var(--bg) 55%) fixed, var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Synaptic animated background — greyscale nodes so the surface stays black & grey */
.synapse-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.35;
  background:
    radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,0.12), transparent),
    radial-gradient(2px 2px at 70% 60%, rgba(255,255,255,0.08), transparent),
    radial-gradient(1.5px 1.5px at 40% 80%, rgba(255,255,255,0.07), transparent),
    radial-gradient(1.5px 1.5px at 85% 20%, rgba(255,255,255,0.10), transparent),
    radial-gradient(1px 1px at 55% 15%, rgba(255,255,255,0.06), transparent);
  background-size: 500px 500px, 420px 420px, 380px 380px, 460px 460px, 300px 300px;
  animation: drift 60s linear infinite;
}
@keyframes drift { to { background-position: 500px 500px, -420px 420px, 380px -380px, -460px -460px, 300px 300px; } }

main, .topbar, .honesty-strip, footer { position: relative; z-index: 1; }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo-img {
  width: 40px; height: 40px; object-fit: contain; display: block;
  border-radius: 8px;
  filter: drop-shadow(0 0 12px var(--purple-glow));
}
.brand-txt h1 { margin: 0; font-size: 20px; letter-spacing: 1.5px; font-weight: 800; }
.brand-txt h1 .dot { color: var(--purple-2); }
.brand-txt .sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.brand-txt code, footer code, .sub code { font-family: var(--mono); color: var(--purple-2); font-size: 0.92em; }

.tabs { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.tab {
  background: transparent; color: var(--muted); border: 1px solid transparent;
  padding: 8px 16px; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 600;
  transition: all 0.15s;
}
.tab:hover { color: var(--text); background: var(--grey-2); }
.tab.active { color: #fff; background: linear-gradient(135deg, var(--purple), var(--purple-2)); box-shadow: 0 4px 16px var(--purple-glow); }

.source { display: flex; align-items: center; gap: 10px; }
.badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px;
  padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--grey-2); color: var(--muted);
}
.badge.sample { background: var(--grey-2); color: var(--muted); border-color: var(--border-strong); }
.badge.live { background: rgba(139,92,246,0.18); color: var(--purple-2); border-color: var(--border-strong); }
.badge.partial { background: rgba(139,92,246,0.10); color: #c9b8f5; border-color: var(--border-strong); }
button.ghost { background: transparent; border: 1px solid var(--border-strong); color: var(--muted); padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 12px; }
button.ghost:hover { color: var(--text); border-color: var(--purple); }

/* Purple loading bar */
.loadbar { height: 3px; background: transparent; overflow: hidden; position: relative; z-index: 2; }
.loadbar.active span {
  display: block; height: 100%; width: 40%;
  background: linear-gradient(90deg, transparent, var(--purple), var(--purple-2), transparent);
  animation: slide 1.1s ease-in-out infinite;
  box-shadow: 0 0 12px var(--purple-glow);
}
.loadbar span { display: none; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }

.honesty-strip {
  padding: 10px 24px; font-size: 12.5px; color: var(--muted);
  background: var(--grey-1); border-bottom: 1px solid var(--border);
}
.honesty-strip strong { color: #c9b8f5; }
.honesty-strip b { color: var(--text); }

main { max-width: 1180px; margin: 0 auto; padding: 24px; }
.view { display: none; animation: fade 0.25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.sec-title { font-size: 15px; letter-spacing: 0.5px; margin: 28px 0 6px; text-transform: uppercase; color: #dcdce0; }
.muted { color: var(--muted); font-size: 13px; margin: 4px 0 14px; }
.muted b { color: var(--text); }

/* Overview banner */
.overview {
  display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: center;
  padding: 22px 24px; border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: linear-gradient(135deg, var(--grey-2), var(--grey-1));
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.ov-badge { display: flex; align-items: center; gap: 12px; font-size: 24px; font-weight: 800; letter-spacing: 0.5px; }
.ov-badge .pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 0 currentColor; }
.ov-badge.ok { color: var(--purple-2); }
.ov-badge.degraded { color: var(--amber); }
.ov-badge.down { color: var(--red); }
.ov-badge.prelaunch { color: var(--purple-2); }
.ov-badge .pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 currentColor; opacity: 1; } 70% { box-shadow: 0 0 0 10px transparent; opacity: 0.7; } 100% { box-shadow: 0 0 0 0 transparent; opacity: 1; } }
.ov-desc { margin: 8px 0 0; color: var(--muted); font-size: 13px; max-width: 460px; }
.ov-stats { display: flex; gap: 14px; flex-wrap: wrap; }
.ov-stat { min-width: 120px; padding: 10px 14px; border-radius: 10px; background: var(--grey-1); border: 1px solid var(--border); }
.ov-stat .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.ov-stat .v { font-size: 22px; font-weight: 800; margin-top: 2px; }
.ov-stat .tag { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; color: var(--muted); }
.ov-stat .tag.live { color: var(--purple-2); }

/* Components */
.components { display: grid; grid-template-columns: 1fr; gap: 10px; }
.comp {
  padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--panel); backdrop-filter: blur(6px);
}
.comp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.comp-name { font-weight: 700; font-size: 14px; }
.comp-detail { font-size: 12px; color: var(--muted); margin-top: 1px; }
.comp-right { display: flex; align-items: center; gap: 12px; }
.comp-uptime { font-family: var(--mono); font-size: 13px; color: #dcdce0; }
.pill { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.4px; }
.pill.operational { background: rgba(139,92,246,0.18); color: var(--purple-2); }
.pill.degraded { background: rgba(245,181,68,0.16); color: var(--amber); }
.pill.down { background: rgba(248,113,113,0.16); color: var(--red); }
.pill.prelaunch { background: rgba(168,85,247,0.16); color: var(--purple-2); }
.pill.unknown { background: var(--grey-2); color: var(--muted); }
.pill .live-dot { display:inline-block; width:6px; height:6px; border-radius:50%; background: currentColor; margin-right:5px; vertical-align: middle; }

/* Purple uptime bar (the only progress bar color) */
.uptime-bar { margin-top: 12px; height: 10px; border-radius: 6px; background: rgba(139,92,246,0.12); overflow: hidden; position: relative; }
.uptime-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--purple), var(--purple-2)); box-shadow: 0 0 10px var(--purple-glow); border-radius: 6px; transition: width 0.8s cubic-bezier(.2,.8,.2,1); }

/* 30-day daily grid — operational cells are purple */
.grid30 { display: flex; gap: 3px; margin-top: 10px; }
.grid30 .day { flex: 1; height: 26px; border-radius: 3px; background: var(--purple); opacity: 0.85; transition: opacity 0.15s; }
.grid30 .day:hover { opacity: 1; }
.grid30 .day.operational { background: var(--purple); }
.grid30 .day.degraded { background: var(--amber); }
.grid30 .day.down { background: var(--red); }
.grid30 .day.prelaunch { background: var(--purple); opacity: 0.5; }
.grid30 .day.na { background: var(--grey-2); }
.grid-legend { display: flex; gap: 16px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.grid-legend span::before { content: "■ "; }
.grid-legend .op::before { color: var(--purple-2); }
.grid-legend .dg::before { color: var(--amber); }
.grid-legend .dn::before { color: var(--red); }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--panel); }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); font-weight: 600; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--grey-2); }
td .st { font-weight: 700; }
td.mono, .mono td, table.mini td:first-child { font-family: var(--mono); font-size: 12px; }
.dot-state { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:6px; vertical-align: middle; }
.dot-state.operational { background: var(--purple-2); }
.dot-state.degraded { background: var(--amber); }
.dot-state.down { background: var(--red); }
.dot-state.prelaunch { background: var(--purple-2); }
.dot-state.unknown { background: var(--muted); }

/* Incidents */
.incidents { display: flex; flex-direction: column; gap: 16px; }
.inc-month { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.inc-month h4 { margin: 0; padding: 12px 16px; background: var(--grey-1); font-size: 13px; letter-spacing: 0.5px; }
.inc-month .none { padding: 14px 16px; color: var(--muted); font-size: 13px; }
.inc { padding: 14px 16px; border-top: 1px solid var(--border); }
.inc .inc-top { display: flex; align-items: center; gap: 10px; }
.inc .date { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.inc .title { font-weight: 700; font-size: 13.5px; }
.inc .summary { color: var(--muted); font-size: 13px; margin-top: 6px; }
.inc .resolved { font-size: 11px; color: var(--purple-2); text-transform: uppercase; letter-spacing: 0.5px; }

/* Explorer / browser */
.explorer-head { margin-bottom: 18px; }
.portal-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.portal-row label { font-size: 12px; color: var(--muted); }
.portal-row select, .portal-row input {
  background: var(--panel-solid); color: var(--text); border: 1px solid var(--border-strong);
  padding: 9px 12px; border-radius: 9px; font-size: 13px;
}
.portal-row input { flex: 1; min-width: 220px; }
.portal-row input:focus, .portal-row select:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(139,92,246,0.2); }
button.primary { background: linear-gradient(135deg, var(--purple), var(--purple-2)); color: #fff; border: none; padding: 10px 20px; border-radius: 9px; font-weight: 700; cursor: pointer; box-shadow: 0 4px 16px var(--purple-glow); }
button.primary:hover { filter: brightness(1.1); }

.ex-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-bottom: 14px; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; backdrop-filter: blur(6px); }
.panel.span2 { grid-column: span 2; }
@media (max-width: 720px) { .panel.span2 { grid-column: auto; } }
.panel h3 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; color: #dcdce0; }
.kv { display: flex; flex-direction: column; gap: 8px; }
.kv .row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; border-bottom: 1px dashed var(--border); padding-bottom: 6px; }
.kv .row .k { color: var(--muted); }
.kv .row .v { font-family: var(--mono); font-size: 12px; text-align: right; }
.result { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; color: #dcdce0; max-height: 300px; overflow: auto; }

.uptime-list { display: flex; flex-direction: column; gap: 12px; }

footer { max-width: 1180px; margin: 40px auto 30px; padding: 20px 24px; border-top: 1px solid var(--border); font-size: 12.5px; color: #b9b9c0; }
footer a { color: var(--purple-2); text-decoration: none; }
footer a:hover { text-decoration: underline; }
footer .muted { margin-top: 8px; }

@media (max-width: 640px) {
  .topbar { gap: 12px; }
  .tabs { margin-left: 0; order: 3; width: 100%; }
  .overview { flex-direction: column; align-items: flex-start; }
}
