/* Keep Your Website Working — application + auth + pricing styles.
   Same palette, typography and terminal chrome as the cinematic marketing page. */
:root {
  --brain-void: #01040e;
  --brain-deep: #04122e;
  --brain-azure: #1f6ae0;
  --brain-sky: #8ecbff;
  --ink: #ededed;
  --muted: #8a9bb8;
  --dim: #7d90b2; /* >= 4.5:1 on --brain-void for small text */
  --line: rgba(142, 203, 255, 0.16);
  --line-strong: rgba(142, 203, 255, 0.38);
  --panel: rgba(4, 18, 46, 0.62);
  --ok: #5fe3a1;
  --warn: #ffc864;
  --bad: #ff6b81;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
html { font-size: 16px; }
body {
  background: var(--brain-void);
  color: var(--ink);
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  font-family: 'General Sans', ui-sans-serif, system-ui, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(60rem 40rem at 0% 0%, rgba(15, 95, 207, 0.22), transparent 60%),
    radial-gradient(50rem 40rem at 100% 100%, rgba(31, 106, 224, 0.12), transparent 60%);
  z-index: 0;
}
a { color: var(--brain-sky); text-decoration: none; }
:focus-visible { outline: 2px solid var(--brain-sky); outline-offset: 2px; border-radius: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 1rem; top: -3rem; z-index: 100; background: var(--brain-sky); color: #021028; padding: 0.6rem 1rem; font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.14em; }
.skip:focus { top: 1rem; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; margin: 0 0 0.5em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 1em; color: #c6d3e8; }
code, .mono { font-family: var(--mono); }
.wrap { position: relative; z-index: 1; }

/* ── Terminal chrome ───────────────────────────────────────── */
.eyebrow {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  color: var(--brain-sky);
  text-transform: uppercase;
}
.eyebrow::before { content: '> '; opacity: 0.6; }
.cursor::after { content: '_'; animation: blink 1.1s steps(1) infinite; color: var(--brain-sky); }
@keyframes blink { 50% { opacity: 0; } }
.kv { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.16em; color: var(--muted); text-transform: uppercase; }
.kv b { color: var(--ink); font-weight: 500; margin-left: 0.6em; }
.kv::before { content: '▸ '; color: var(--brain-sky); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--brain-sky); background: transparent; border: 1px solid var(--line-strong);
  padding: 0.8em 1.2em; cursor: pointer; border-radius: 2px; transition: all 0.2s ease; text-decoration: none;
}
.btn::before { content: '[ '; opacity: 0.7; }
.btn::after { content: ' ]'; opacity: 0.7; }
.btn:hover { background: rgba(142, 203, 255, 0.08); border-color: var(--brain-sky); box-shadow: 0 0 24px rgba(142, 203, 255, 0.18); text-decoration: none; }
.btn.primary { background: var(--brain-sky); color: #021028; border-color: var(--brain-sky); font-weight: 600; }
.btn.primary:hover { background: #b5ddff; box-shadow: 0 0 32px rgba(142, 203, 255, 0.35); }
.btn.danger { color: var(--bad); border-color: rgba(255, 107, 129, 0.45); }
.btn.small { font-size: 0.64rem; padding: 0.55em 0.8em; }
.btn.plain::before, .btn.plain::after { content: ''; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.linkbtn { background: none; border: 0; color: var(--brain-sky); font: inherit; cursor: pointer; padding: 0; }

/* ── Forms ─────────────────────────────────────────────────── */
label { display: block; font-size: 0.8rem; color: var(--muted); margin: 0 0 0.35em; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=tel], input[type=number], select, textarea {
  width: 100%; background: rgba(1, 4, 14, 0.7); border: 1px solid var(--line); color: var(--ink);
  font: inherit; font-size: 0.95rem; padding: 0.7em 0.85em; border-radius: 3px; outline: none; transition: border 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brain-sky); box-shadow: 0 0 0 3px rgba(142, 203, 255, 0.12); }
.field { margin-bottom: 1rem; }
.hint { font-size: 0.78rem; color: var(--dim); margin-top: 0.35em; }
.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.check { display: flex; gap: 0.6em; align-items: flex-start; color: var(--ink); font-size: 0.92rem; cursor: pointer; }
.check input { margin-top: 0.3em; accent-color: var(--brain-sky); }

.flash { border: 1px solid var(--line-strong); background: rgba(142, 203, 255, 0.06); padding: 0.85rem 1rem; border-radius: 3px; margin-bottom: 1.25rem; font-size: 0.92rem; }
.flash.error { border-color: rgba(255, 107, 129, 0.5); background: rgba(255, 107, 129, 0.07); }
.flash.ok { border-color: rgba(95, 227, 161, 0.45); background: rgba(95, 227, 161, 0.06); }

/* ── Auth + public pages ───────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 0.7rem 1.25rem; border-bottom: 1px solid var(--line); background: rgba(1, 4, 14, 0.82); backdrop-filter: blur(10px);
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted);
}
.topbar a { color: var(--muted); }
.topbar a:hover { color: var(--brain-sky); text-decoration: none; }
.brand { color: var(--brain-sky) !important; white-space: nowrap; }
.brand .dot { display: inline-block; width: 0.5em; height: 0.5em; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); margin-right: 0.6em; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }
.topbar nav { display: flex; gap: 1.25rem; align-items: center; }
.auth-shell { min-height: calc(100vh - 3rem); display: grid; place-items: center; padding: 2.5rem 1rem; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 1.5rem;
  backdrop-filter: blur(8px); position: relative;
}
.card.term::before {
  content: attr(data-title); position: absolute; top: -0.7em; left: 1rem; padding: 0 0.5em; background: var(--brain-void);
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.22em; color: var(--brain-sky);
}
.auth-card { width: 100%; max-width: 27rem; }
.auth-card h1 { font-size: 1.6rem; margin-top: 0.4rem; }
.plan-chip { display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--line-strong); padding: 0.75rem 0.9rem; border-radius: 3px; margin-bottom: 1.25rem; font-size: 0.9rem; background: rgba(142, 203, 255, 0.05); }
.plan-chip b { color: var(--brain-sky); }

/* ── Pricing ───────────────────────────────────────────────── */
.pricing { max-width: 72rem; margin: 0 auto; padding: 4rem 1.25rem 5rem; text-align: center; }
.pricing h1 { font-size: 2.6rem; margin-top: 0.6rem; }
.pricing .lede { max-width: 40rem; margin: 0 auto 2rem; color: #b9c9e2; }
.toggle { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 2px; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.2em; margin-bottom: 0.6rem; }
.toggle button { background: none; border: 0; color: var(--muted); padding: 0.7em 1.3em; cursor: pointer; font: inherit; letter-spacing: inherit; }
.toggle button.on, .toggle a.on { background: var(--brain-sky); color: #021028; font-weight: 600; }
.toggle a { color: var(--muted); padding: 0.7em 1.3em; text-decoration: none; }
.badge-free { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.2em; color: var(--ok); min-height: 1.2em; margin-bottom: 2rem; }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; text-align: left; align-items: stretch; }
.plan { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 1.75rem 1.5rem; display: flex; flex-direction: column; position: relative; }
.plan.popular { border-color: var(--brain-sky); box-shadow: 0 0 0 1px rgba(142, 203, 255, 0.35), 0 20px 60px -20px rgba(31, 106, 224, 0.55); background: linear-gradient(180deg, rgba(31, 106, 224, 0.18), rgba(4, 18, 46, 0.7)); transform: translateY(-0.5rem); }
.plan .ribbon { position: absolute; top: -0.7em; left: 1.5rem; background: var(--brain-sky); color: #021028; font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.22em; padding: 0.3em 0.7em; font-weight: 600; }
.plan .name { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.24em; color: var(--brain-sky); }
.plan .price { font-size: 2.6rem; font-weight: 600; margin: 0.6rem 0 0; letter-spacing: -0.02em; }
.plan .price small { font-size: 0.9rem; color: var(--muted); font-weight: 400; margin-left: 0.3em; }
.plan .equiv { font-size: 0.8rem; color: var(--muted); min-height: 1.3em; margin-bottom: 0.6rem; }
.plan .desc { font-size: 0.86rem; color: var(--muted); min-height: 2.8em; }
.plan ul { list-style: none; padding: 0; margin: 0.75rem 0 1.5rem; flex: 1; }
.plan li { font-size: 0.9rem; padding: 0.42em 0; border-bottom: 1px dashed rgba(142, 203, 255, 0.1); }
.plan li::before { content: '▸ '; color: var(--brain-sky); font-size: 0.8em; }
.plan .btn { width: 100%; }
.trialnote { margin-top: 1.5rem; font-size: 0.85rem; color: var(--muted); }
.enterprise { margin-top: 2.5rem; font-size: 0.9rem; color: var(--muted); }

/* ── App shell ─────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 15rem 1fr; min-height: 100vh; position: relative; z-index: 1; }
.side { border-right: 1px solid var(--line); padding: 1.1rem 0.9rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; background: rgba(1, 4, 14, 0.6); display: flex; flex-direction: column; }
.side .brand { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.16em; display: block; margin: 0.2rem 0.4rem 1.6rem; line-height: 1.6; }
.side nav a { display: flex; justify-content: space-between; padding: 0.55rem 0.7rem; border-radius: 3px; color: #b5c3da; font-size: 0.92rem; margin-bottom: 2px; }
.side nav a:hover { background: rgba(142, 203, 255, 0.06); text-decoration: none; color: #fff; }
.side nav a.on { background: rgba(142, 203, 255, 0.1); color: #fff; box-shadow: inset 2px 0 0 var(--brain-sky); }
.side nav a .count { font-family: var(--mono); font-size: 0.7rem; color: var(--bad); }
.side .foot { margin-top: auto; font-size: 0.8rem; color: var(--dim); padding: 0.6rem; border-top: 1px solid var(--line); }
.main { min-width: 0; }
.telemetry { display: flex; gap: 1.6rem; flex-wrap: wrap; padding: 0.65rem 1.5rem; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.18em; color: var(--muted); text-transform: uppercase; background: rgba(1, 4, 14, 0.6); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(8px); }
.telemetry b { color: var(--ink); font-weight: 500; margin-left: 0.5em; }
.telemetry .live { color: var(--brain-sky); }
.content { padding: 1.75rem 1.5rem 4rem; max-width: 80rem; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.pagehead h1 { margin: 0.3rem 0 0; }
.grid { display: grid; gap: 1rem; }
.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)); }
.stat .label { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.2em; color: var(--muted); text-transform: uppercase; }
.stat .value { font-size: 1.8rem; font-weight: 600; margin-top: 0.2rem; letter-spacing: -0.01em; }
.stat .sub { font-size: 0.8rem; color: var(--dim); }
.section { margin-top: 1.75rem; }
.meter { margin-bottom: 0.9rem; }
.meter .top { display: flex; justify-content: space-between; font-size: 0.86rem; margin-bottom: 0.35rem; }
.meter .top b { font-family: var(--mono); font-weight: 500; }
.meter .bar { height: 6px; background: rgba(142, 203, 255, 0.1); border-radius: 3px; overflow: hidden; }
.meter .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brain-azure), var(--brain-sky)); border-radius: 3px; }
.meter.full .bar i { background: linear-gradient(90deg, #d9862e, var(--warn)); }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { text-align: left; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.18em; color: var(--muted); text-transform: uppercase; font-weight: 500; padding: 0.6rem 0.6rem; border-bottom: 1px solid var(--line); }
td { padding: 0.7rem 0.6rem; border-bottom: 1px solid rgba(142, 203, 255, 0.07); vertical-align: middle; }
tr:hover td { background: rgba(142, 203, 255, 0.025); }
.tablewrap { overflow-x: auto; }
.muted { color: var(--muted); }
.dim { color: var(--dim); font-size: 0.82rem; }
.pill { display: inline-flex; align-items: center; gap: 0.45em; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; padding: 0.3em 0.65em; border-radius: 2px; border: 1px solid currentColor; white-space: nowrap; }
.pill::before { content: ''; width: 0.5em; height: 0.5em; border-radius: 50%; background: currentColor; }
.pill.up, .pill.healthy, .pill.resolved, .pill.active, .pill.trialing { color: var(--ok); }
.pill.down, .pill.critical, .pill.open, .pill.unpaid, .pill.canceled { color: var(--bad); }
.pill.degraded, .pill.major, .pill.minor, .pill.warning, .pill.past_due { color: var(--warn); }
.pill.pending, .pill.unknown, .pill.paused { color: var(--dim); }
.upgrade { border: 1px solid rgba(255, 200, 100, 0.45); background: rgba(255, 200, 100, 0.06); border-radius: 4px; padding: 1.1rem 1.2rem; margin: 1rem 0; }
.upgrade p { color: #f2dfb8; margin-bottom: 0.8rem; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.2rem; border-left: 1px solid var(--line-strong); }
.timeline li { position: relative; padding: 0 0 1.1rem 0.6rem; }
.timeline li::before { content: ''; position: absolute; left: -1.55rem; top: 0.45em; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--brain-sky); box-shadow: 0 0 10px var(--brain-sky); }
.timeline li.resolved::before { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.timeline li.first_failure::before, .timeline li.confirmed::before { background: var(--bad); box-shadow: 0 0 10px var(--bad); }
.timeline time { font-family: var(--mono); font-size: 0.68rem; color: var(--muted); letter-spacing: 0.1em; }
.chart { width: 100%; height: 9rem; display: block; }
.chart .grid line { stroke: rgba(142, 203, 255, 0.08); }
.uptimebar { display: flex; gap: 2px; height: 1.9rem; align-items: stretch; }
.uptimebar i { flex: 1; border-radius: 1px; background: rgba(142, 203, 255, 0.12); }
.uptimebar i.ok { background: rgba(95, 227, 161, 0.75); }
.uptimebar i.part { background: var(--warn); }
.uptimebar i.bad { background: var(--bad); }
details summary { cursor: pointer; color: var(--brain-sky); font-size: 0.88rem; }
pre { background: rgba(1, 4, 14, 0.8); border: 1px solid var(--line); padding: 0.8rem; overflow-x: auto; font-size: 0.78rem; border-radius: 3px; color: #b9c9e2; }
.steps { display: flex; gap: 0.5rem; margin-bottom: 1.75rem; flex-wrap: wrap; }
.steps span { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.18em; padding: 0.45em 0.8em; border: 1px solid var(--line); color: var(--dim); text-transform: uppercase; }
.steps span.on { border-color: var(--brain-sky); color: var(--brain-sky); }
.steps span.done { color: var(--ok); border-color: rgba(95, 227, 161, 0.4); }
.suggest { display: grid; grid-template-columns: auto 1fr auto; gap: 0.9rem; align-items: start; padding: 0.9rem 0; border-bottom: 1px dashed var(--line); }
.suggest .t { font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.18em; color: var(--brain-sky); text-transform: uppercase; }
.spinner { width: 2.4rem; height: 2.4rem; border: 2px solid var(--line); border-top-color: var(--brain-sky); border-radius: 50%; animation: spin 0.9s linear infinite; margin: 0 auto 1.25rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.footer { text-align: center; padding: 2rem 1rem; font-size: 0.8rem; color: var(--dim); border-top: 1px solid var(--line); position: relative; z-index: 1; }
.footer a { color: var(--muted); margin: 0 0.75rem; }

@media (max-width: 1024px) {
  .plans { grid-template-columns: 1fr; max-width: 28rem; margin: 0 auto; }
  .plan.popular { transform: none; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topbar { padding: 0.6rem 1rem; gap: 0.6rem; font-size: 0.6rem; letter-spacing: 0.12em; }
  .topbar .brand { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .topbar nav { gap: 0.8rem; flex-shrink: 0; }
  .topbar nav a.nav-pricing { display: none; }
}
@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .side nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }
  .side .foot { display: none; }
  .g2 { grid-template-columns: 1fr; }
  .content { padding: 1.25rem 1rem 3rem; }
  .telemetry { padding: 0.6rem 1rem; gap: 1rem; }
  .pricing h1 { font-size: 2rem; }
  .topbar nav { gap: 0.8rem; }
  .suggest { grid-template-columns: auto 1fr; }
  .suggest > :last-child { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
