/* ============================================================================
   Agency Root — Platform Console
   A dark operations surface: near-black glass, a teal signal, a pink edge.
   No framework, no build step.
   ========================================================================== */

:root {
  --ink-0: #060E0D;
  --ink-1: #0A1614;
  --ink-2: #0F1F1C;
  --ink-3: #142B27;
  --line: rgba(146, 226, 208, 0.12);
  --line-strong: rgba(146, 226, 208, 0.22);
  --text: #E8F5F1;
  --text-dim: #9DBBB4;
  --text-faint: #6C8C85;
  --teal: #17806E;
  --teal-bright: #35C6A5;
  --mint: #7CF0D0;
  --pink: #D9738F;
  --amber: #E5B45F;
  --red: #E4707A;
  --violet: #9C8CF0;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.9);
  --sans: 'IBM Plex Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink-0);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body::before {
  /* the room's ambient light */
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(1100px 620px at 88% -10%, rgba(23, 128, 110, 0.22), transparent 60%),
    radial-gradient(900px 560px at -8% 100%, rgba(217, 115, 143, 0.14), transparent 62%),
    radial-gradient(700px 400px at 50% 40%, rgba(53, 198, 165, 0.05), transparent 70%);
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.hidden, [hidden] { display: none !important; }

/* ---------------------------------------------------------------- gate */

.gate {
  position: relative;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  align-items: center;
  overflow: hidden;
  z-index: 1;
}

.gate__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(146, 226, 208, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(146, 226, 208, 0.05) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(900px 700px at 30% 40%, #000 20%, transparent 78%);
  opacity: 0.7;
}

.gate__aurora {
  position: absolute;
  width: 780px;
  height: 780px;
  left: -180px;
  top: 50%;
  translate: 0 -50%;
  background: conic-gradient(from 120deg, rgba(23, 128, 110, 0.55), rgba(217, 115, 143, 0.35), rgba(53, 198, 165, 0.5), rgba(23, 128, 110, 0.55));
  filter: blur(90px) saturate(1.2);
  opacity: 0.42;
  animation: spin 46s linear infinite;
}

@keyframes spin { to { rotate: 360deg; } }

.gate__mark {
  position: relative;
  display: grid;
  place-items: center;
  padding: 40px;
}

.gate__orbit { width: min(460px, 92%); overflow: visible; }
.gate__orbit circle { fill: none; stroke: rgba(124, 240, 208, 0.28); stroke-width: 1; }
.gate__orbit .o2 { stroke: rgba(217, 115, 143, 0.24); stroke-dasharray: 2 7; }
.gate__orbit .o3 { stroke: rgba(124, 240, 208, 0.5); stroke-width: 1.5; }
.gate__orbit .dot { fill: var(--mint); animation: blink 4.4s ease-in-out infinite; }
.gate__orbit .d2 { fill: var(--pink); animation-delay: -1.1s; }
.gate__orbit .d3 { fill: var(--teal-bright); animation-delay: -2.2s; }
.gate__orbit .d4 { fill: var(--amber); animation-delay: -3.1s; }
@keyframes blink { 0%, 100% { opacity: 0.25; } 45% { opacity: 1; } }

.gate__panel {
  position: relative;
  z-index: 2;
  max-width: 460px;
  width: 100%;
  margin: 0 auto;
  padding: 44px 40px 30px;
  border-radius: 26px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(16, 34, 31, 0.86), rgba(8, 19, 17, 0.92));
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.brand__glyph {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 13px;
  background: linear-gradient(150deg, var(--teal-bright), var(--teal) 60%, #0C5F55);
  color: #04100E;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.03em;
  box-shadow: 0 10px 26px -12px rgba(53, 198, 165, 0.7);
}
.brand__glyph--sm { width: 34px; height: 34px; border-radius: 10px; font-size: 13px; }
.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__text b { font-size: 15px; letter-spacing: -0.01em; }
.brand__text i { font-style: normal; font-size: 11.5px; color: var(--text-faint); letter-spacing: 0.14em; text-transform: uppercase; }

.gate h1 {
  font-size: 34px;
  line-height: 1.13;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}
.gate h1 em { font-style: normal; color: var(--mint); }
.gate__sub { color: var(--text-dim); font-size: 14px; line-height: 1.6; margin-bottom: 26px; }

.gate__form { display: grid; gap: 14px; }
.gate__form label { display: grid; gap: 7px; }
.gate__form label span {
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.gate__form input {
  height: 46px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(4, 12, 11, 0.7);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.gate__form input:focus {
  border-color: rgba(53, 198, 165, 0.55);
  box-shadow: 0 0 0 3px rgba(53, 198, 165, 0.12);
  background: rgba(6, 16, 14, 0.9);
}
.gate__error { color: var(--red); font-size: 13px; }

.gate__meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  text-transform: uppercase;
}
.gate__meta span { display: inline-flex; align-items: center; gap: 7px; }

.pulse {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--teal-bright);
  box-shadow: 0 0 0 0 rgba(53, 198, 165, 0.6);
  animation: pulse 2.4s ease-out infinite;
  display: inline-block;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(53, 198, 165, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(53, 198, 165, 0); }
  100% { box-shadow: 0 0 0 0 rgba(53, 198, 165, 0); }
}

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 42px;
  padding: 0 18px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: rgba(20, 43, 39, 0.6);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  transition: transform 0.14s, border-color 0.18s, background 0.18s, box-shadow 0.18s;
}
.btn:hover { border-color: rgba(53, 198, 165, 0.45); background: rgba(23, 51, 46, 0.75); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn--primary {
  background: linear-gradient(160deg, var(--teal-bright), var(--teal) 70%);
  border-color: transparent;
  color: #04120F;
  font-weight: 600;
  box-shadow: 0 16px 40px -22px rgba(53, 198, 165, 0.9);
}
.btn--primary:hover { background: linear-gradient(160deg, #4BDDBB, var(--teal)); }
.btn--wide { width: 100%; height: 48px; margin-top: 4px; }
.btn--ghost { background: transparent; }
.btn--sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn--danger { border-color: rgba(228, 112, 122, 0.4); color: #F3B7BC; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

.iconbtn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
}
.iconbtn:hover { color: var(--text); border-color: var(--line-strong); }

/* ----------------------------------------------------------------- shell */

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100dvh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 16px 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(10, 22, 20, 0.9), rgba(6, 14, 13, 0.96));
  backdrop-filter: blur(14px);
}

.rail__brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 0; }
.rail__brandtxt {
  display: flex; flex-direction: column;
  font-size: 13px; line-height: 1.25; letter-spacing: -0.01em;
}
.rail__brandtxt em { font-style: normal; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-faint); }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav__item {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 13.5px;
  border: 1px solid transparent;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.nav__item svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
  opacity: 0.85;
}
.nav__item:hover { background: rgba(23, 51, 46, 0.55); color: var(--text); }
.nav__item.is-on {
  background: linear-gradient(100deg, rgba(23, 128, 110, 0.32), rgba(23, 128, 110, 0.06));
  border-color: rgba(53, 198, 165, 0.28);
  color: #EAFBF5;
}
.nav__item.is-on svg { stroke: var(--mint); opacity: 1; }
.nav__item--ai { margin-top: 8px; }
.nav__item--ai.is-on { background: linear-gradient(100deg, rgba(156, 140, 240, 0.24), rgba(217, 115, 143, 0.08)); border-color: rgba(156, 140, 240, 0.35); }
.nav__item--ai.is-on svg { stroke: #BFB4FF; }

.rail__foot { margin-top: auto; display: grid; gap: 10px; }
.rail__live {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  text-transform: uppercase;
}
.rail__out {
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-faint);
  font-size: 12px;
}
.rail__out:hover { color: var(--pink); border-color: rgba(217, 115, 143, 0.4); }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 28px 16px;
  background: linear-gradient(180deg, rgba(6, 14, 13, 0.94), rgba(6, 14, 13, 0.72));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar__title h2 { font-size: 22px; letter-spacing: -0.02em; }
.topbar__title p { font-size: 12.5px; color: var(--text-faint); margin-top: 2px; }
.topbar__tools { display: flex; align-items: center; gap: 12px; }

.search {
  display: flex; align-items: center; gap: 8px;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(10, 22, 20, 0.8);
  min-width: 260px;
}
.search svg { width: 15px; height: 15px; fill: none; stroke: var(--text-faint); stroke-width: 1.8; }
.search input { border: 0; background: transparent; outline: none; width: 100%; font-size: 13px; }
.search input::placeholder { color: var(--text-faint); }

.range {
  display: flex;
  padding: 3px;
  gap: 2px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(10, 22, 20, 0.8);
}
.range button {
  height: 30px;
  padding: 0 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
}
.range button.on { background: rgba(53, 198, 165, 0.16); color: var(--mint); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  white-space: nowrap;
}
.chip--admin { border-color: rgba(53, 198, 165, 0.3); color: var(--mint); }
.chip--plan { text-transform: uppercase; letter-spacing: 0.08em; font-size: 10px; }
.chip--core { border-color: rgba(157, 187, 180, 0.3); color: #C3D8D3; }
.chip--growth { border-color: rgba(53, 198, 165, 0.4); color: var(--mint); }
.chip--scale { border-color: rgba(156, 140, 240, 0.5); color: #CFC6FF; background: rgba(156, 140, 240, 0.1); }
.chip--trial { border-color: rgba(229, 180, 95, 0.45); color: var(--amber); }
.chip--active { border-color: rgba(53, 198, 165, 0.45); color: var(--mint); }
.chip--suspended, .chip--archived { border-color: rgba(228, 112, 122, 0.45); color: var(--red); }
.chip--invited { border-color: rgba(157, 187, 180, 0.3); color: var(--text-dim); }

/* ------------------------------------------------------------------ view */

.view { padding: 24px 28px 60px; display: grid; gap: 18px; align-content: start; }
.view > * { animation: rise 0.42s cubic-bezier(0.22, 1, 0.36, 1) both; }
.view > *:nth-child(2) { animation-delay: 0.04s; }
.view > *:nth-child(3) { animation-delay: 0.08s; }
.view > *:nth-child(4) { animation-delay: 0.12s; }
.view > *:nth-child(5) { animation-delay: 0.16s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.loading {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-faint); font-size: 13px; padding: 40px 4px;
}
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(124, 240, 208, 0.25);
  border-top-color: var(--mint);
  animation: spin 0.8s linear infinite;
}

.grid { display: grid; gap: 16px; }
.grid--kpi { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid--2 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.grid--2e { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(17, 36, 33, 0.72), rgba(9, 20, 18, 0.86));
  box-shadow: inset 0 1px 0 rgba(233, 255, 249, 0.04);
  padding: 18px;
  overflow: hidden;
}
.card--flush { padding: 0; }
.card__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.card__head h3 { font-size: 14px; letter-spacing: -0.01em; }
.card__head span { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-faint); }

.kpi { padding: 16px 16px 14px; display: grid; gap: 8px; }
.kpi__label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.kpi__value {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.kpi__value small { font-size: 13px; font-weight: 500; color: var(--text-faint); margin-left: 3px; letter-spacing: 0; }
.kpi__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--text-faint); }
.kpi__spark { height: 30px; }
.kpi--accent { background: linear-gradient(160deg, rgba(23, 128, 110, 0.4), rgba(9, 20, 18, 0.9) 62%); border-color: rgba(53, 198, 165, 0.32); }
.kpi--accent .kpi__value { color: #DFFFF5; }

.trend { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 10.5px; }
.trend--up { color: var(--mint); }
.trend--down { color: var(--red); }
.trend--flat { color: var(--text-faint); }

/* charts */
.chart { width: 100%; overflow: visible; }
.chart text { font-family: var(--mono); font-size: 9.5px; fill: var(--text-faint); letter-spacing: 0.03em; }
.chart .gridline { stroke: rgba(146, 226, 208, 0.09); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-dim); }
.legend i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }

.donut { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 16px; align-items: center; }
.donut__center { font-family: var(--mono); font-size: 11px; fill: var(--text-faint); letter-spacing: 0.06em; }
.donut__big { font-family: var(--sans); font-size: 22px; font-weight: 600; fill: var(--text); letter-spacing: -0.02em; }
.donut__list { display: grid; gap: 9px; }
.donut__row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 9px; align-items: center; font-size: 12.5px; }
.donut__row i { width: 9px; height: 9px; border-radius: 3px; }
.donut__row b { font-weight: 500; }
.donut__row em { font-style: normal; font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); }

/* lists */
.feed { display: grid; gap: 2px; }
.feed__row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 9px 8px;
  border-radius: 9px;
  transition: background 0.14s;
}
.feed__row:hover { background: rgba(23, 51, 46, 0.5); }
.feed__dot {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: rgba(23, 128, 110, 0.16);
  border: 1px solid rgba(53, 198, 165, 0.2);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--mint);
  text-transform: uppercase;
}
.feed__main { min-width: 0; }
.feed__main b { display: block; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed__main span { display: block; font-size: 11.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed__when { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); white-space: nowrap; }

.flaglist { display: grid; gap: 8px; }
.flag {
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(10, 22, 20, 0.6);
}
.flag i { width: 4px; align-self: stretch; border-radius: 4px; background: var(--amber); }
.flag--red i { background: var(--red); }
.flag--mint i { background: var(--mint); }
.flag b { display: block; font-size: 12.5px; font-weight: 500; }
.flag span { font-size: 11.5px; color: var(--text-faint); }
.flag em { font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--text-dim); }

/* table */
.tablewrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: rgba(9, 20, 18, 0.7); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  position: sticky; top: 0;
  text-align: left;
  padding: 11px 14px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: rgba(11, 25, 22, 0.96);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid rgba(146, 226, 208, 0.06); vertical-align: middle; }
tbody tr { transition: background 0.13s; }
tbody tr:hover { background: rgba(23, 51, 46, 0.45); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.is-click { cursor: pointer; }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.cellname { display: grid; gap: 1px; }
.cellname b { font-weight: 500; font-size: 13px; }
.cellname span { font-size: 11px; color: var(--text-faint); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .search { min-width: 300px; flex: 1; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button {
  height: 30px; padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  text-transform: capitalize;
}
.filters button.on { border-color: rgba(53, 198, 165, 0.4); background: rgba(53, 198, 165, 0.14); color: var(--mint); }

.empty { padding: 30px; text-align: center; color: var(--text-faint); font-size: 13px; }

td select {
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(4, 12, 11, 0.82);
  font-size: 12px;
  text-transform: capitalize;
  outline: none;
}
td select:focus { border-color: rgba(53, 198, 165, 0.5); }
td select:hover { border-color: var(--line-strong); }

/* ---------------------------------------------------------------- drawer */

.drawer { position: fixed; inset: 0; z-index: 40; }
.drawer__scrim { position: absolute; inset: 0; background: rgba(3, 8, 7, 0.62); backdrop-filter: blur(2px); animation: fade 0.2s ease both; }
@keyframes fade { from { opacity: 0; } }
.drawer__panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(720px, 94vw);
  display: flex; flex-direction: column;
  border-left: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(13, 29, 26, 0.98), rgba(7, 16, 15, 0.99));
  box-shadow: -30px 0 80px -40px #000;
  animation: slide 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes slide { from { transform: translateX(28px); opacity: 0.4; } }
.drawer__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
}
.drawer__kicker { font-family: var(--mono); font-size: 10px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 4px; }
.drawer__head h3 { font-size: 20px; letter-spacing: -0.02em; }
.drawer__body { overflow: auto; padding: 20px 22px 40px; display: grid; gap: 18px; }

.statrow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stat {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 12px;
  background: rgba(10, 22, 20, 0.6);
  display: grid; gap: 3px;
}
.stat b { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat span { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); }

.field { display: grid; gap: 6px; }
.field > label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); }
.field select, .field input {
  height: 38px;
  padding: 0 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(4, 12, 11, 0.8);
  outline: none;
  font-size: 13px;
}
.field select:focus, .field input:focus { border-color: rgba(53, 198, 165, 0.5); }
.formrow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: end; }

.subhead {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 2px;
}

/* ------------------------------------------------------------------- AI */

.copilot { display: grid; gap: 14px; }
.copilot__prompts { display: flex; flex-wrap: wrap; gap: 8px; }
.copilot__prompts button {
  height: 32px; padding: 0 13px;
  border-radius: 999px;
  border: 1px solid rgba(156, 140, 240, 0.3);
  background: rgba(156, 140, 240, 0.09);
  color: #CFC6FF;
  font-size: 12.5px;
}
.copilot__prompts button:hover { background: rgba(156, 140, 240, 0.18); }
.askrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.askrow input {
  height: 44px; padding: 0 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(4, 12, 11, 0.8);
  outline: none;
  font-size: 13.5px;
}
.answer {
  border-radius: var(--radius);
  border: 1px solid rgba(156, 140, 240, 0.24);
  background: linear-gradient(170deg, rgba(156, 140, 240, 0.1), rgba(9, 20, 18, 0.7) 46%);
  padding: 18px;
  display: grid; gap: 12px;
}
.answer__text { font-size: 14px; line-height: 1.7; color: #E4F2EE; white-space: pre-wrap; }
.answer__meta { display: flex; flex-wrap: wrap; gap: 12px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em; color: var(--text-faint); text-transform: uppercase; }
.answer--thinking .answer__text { color: var(--text-faint); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  translate: -50% 0;
  z-index: 90;
  padding: 11px 18px;
  border-radius: 12px;
  border: 1px solid rgba(53, 198, 165, 0.35);
  background: rgba(11, 30, 26, 0.96);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: rise 0.22s ease both;
}
.toast--err { border-color: rgba(228, 112, 122, 0.5); color: #F6C3C8; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 1400px) {
  .grid--kpi { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .grid--2, .grid--2e { grid-template-columns: minmax(0, 1fr); }
  .gate { grid-template-columns: 1fr; }
  .gate__mark { display: none; }
  .gate__panel { margin: 40px auto; }
}
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .rail {
    position: sticky; top: 0; height: auto; flex-direction: row;
    align-items: center; gap: 10px; padding: 10px 12px; overflow-x: auto;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .rail__brandtxt, .rail__foot { display: none; }
  .nav { flex-direction: row; gap: 4px; }
  .nav__item span { display: none; }
  .nav__item { height: 36px; width: 40px; justify-content: center; padding: 0; }
  .topbar { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px 16px; }
  .topbar__tools { flex-wrap: wrap; }
  .search { min-width: 0; flex: 1; }
  .view { padding: 16px 16px 50px; }
  .grid--kpi, .grid--3, .statrow, .formrow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .donut { grid-template-columns: 112px minmax(0, 1fr); }
}
/* ============================================================================
   Live AI — voice stage, transcript, artifacts. Additive to the console.
   ========================================================================== */

/* motion language: a little more life on every surface */
.card { transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.22s, box-shadow 0.22s; }
.card:hover { transform: translateY(-2px); border-color: rgba(146, 226, 208, 0.2); box-shadow: 0 26px 60px -40px rgba(0, 0, 0, 0.9); }
.kpi:hover .kpi__value { color: var(--mint); transition: color 0.25s; }
.btn { transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.18s, background 0.18s, box-shadow 0.18s; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.99); }
.nav__item { position: relative; overflow: hidden; }
.nav__item::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 2px; border-radius: 2px;
  background: linear-gradient(180deg, var(--mint), transparent);
  opacity: 0; transition: opacity 0.2s;
}
.nav__item.is-on::after { opacity: 1; }
.nav__item--live { color: #DCD6FF; }
.nav__item--live svg { stroke: #BFB4FF; }
.nav__spark {
  width: 6px; height: 6px; border-radius: 50%; margin-left: auto;
  background: var(--violet); box-shadow: 0 0 0 0 rgba(156, 140, 240, 0.6);
  animation: spark 2.6s ease-out infinite;
}
@keyframes spark {
  0% { box-shadow: 0 0 0 0 rgba(156, 140, 240, 0.55); opacity: 1; }
  70% { box-shadow: 0 0 0 7px rgba(156, 140, 240, 0); opacity: 0.8; }
  100% { box-shadow: 0 0 0 0 rgba(156, 140, 240, 0); opacity: 1; }
}

.live { display: grid; grid-template-columns: minmax(340px, 0.85fr) minmax(0, 1.15fr); gap: 18px; align-items: stretch; }

.stage {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: 20px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background:
    radial-gradient(600px 320px at 50% 0%, rgba(156, 140, 240, 0.14), transparent 62%),
    linear-gradient(180deg, rgba(17, 36, 33, 0.82), rgba(7, 16, 15, 0.94));
  overflow: hidden;
}
.stage::before {
  content: ""; position: absolute; inset: -40%;
  background: conic-gradient(from 0deg, transparent, rgba(53, 198, 165, 0.14), transparent 40%, rgba(217, 115, 143, 0.12), transparent 70%);
  animation: spin 28s linear infinite;
  pointer-events: none;
}
.stage__top { position: relative; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.livestate {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(6, 16, 14, 0.7);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim);
}
.livestate em { font-style: normal; color: var(--text-faint); text-transform: none; letter-spacing: 0; }
.stage__mode { display: flex; padding: 3px; gap: 2px; border-radius: 999px; border: 1px solid var(--line); background: rgba(6, 16, 14, 0.7); }
.stage__mode button {
  height: 26px; padding: 0 11px; border: 0; border-radius: 999px; background: transparent;
  color: var(--text-faint); font-size: 11.5px;
}
.stage__mode button.on { background: rgba(156, 140, 240, 0.2); color: #D8D1FF; }

.orb {
  --level: 0.2;
  position: relative;
  width: 240px; height: 240px;
  display: grid; place-items: center;
  margin: 6px 0 2px;
}
.orb__halo {
  position: absolute; inset: 8%;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 38%, rgba(124, 240, 208, 0.5), rgba(53, 198, 165, 0.18) 42%, rgba(156, 140, 240, 0.12) 68%, transparent 72%);
  filter: blur(18px);
  opacity: calc(0.45 + var(--level) * 0.6);
  transform: scale(calc(0.86 + var(--level) * 0.22));
  transition: transform 0.18s ease-out, opacity 0.18s;
}
.orb__ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(124, 240, 208, 0.22);
  transform: scale(calc(0.62 + var(--level) * 0.5));
  transition: transform 0.25s ease-out, border-color 0.25s;
}
.orb__ring.r2 { border-color: rgba(217, 115, 143, 0.18); transform: scale(calc(0.78 + var(--level) * 0.36)); }
.orb__ring.r3 { border-color: rgba(156, 140, 240, 0.16); transform: scale(calc(0.94 + var(--level) * 0.24)); }
.orb__core {
  position: relative;
  width: 116px; height: 116px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: #04120F;
  background: linear-gradient(150deg, #BFF7E7, var(--teal-bright) 42%, var(--teal) 78%, #0B5D52);
  box-shadow: 0 22px 60px -26px rgba(53, 198, 165, 0.9), inset 0 0 30px rgba(255, 255, 255, 0.25);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), filter 0.3s;
}
.orb__core svg { width: 52px; height: 52px; }
.orb.is-live .orb__core { animation: breathe 4.2s ease-in-out infinite; }
.orb.is-listening .orb__core { filter: saturate(1.2) brightness(1.06); }
.orb.is-speaking .orb__core { box-shadow: 0 26px 80px -22px rgba(124, 240, 208, 0.95), inset 0 0 34px rgba(255, 255, 255, 0.35); }
.orb.is-speaking .orb__ring { border-color: rgba(124, 240, 208, 0.42); }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }

.stage__controls { position: relative; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.micbtn {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: rgba(10, 22, 20, 0.9);
  font-size: 17px;
  display: grid; place-items: center;
  transition: transform 0.16s, background 0.2s, border-color 0.2s;
}
.micbtn:hover { transform: scale(1.05); border-color: rgba(53, 198, 165, 0.5); }
.micbtn.is-on { background: linear-gradient(160deg, rgba(217, 115, 143, 0.5), rgba(217, 115, 143, 0.15)); border-color: rgba(217, 115, 143, 0.7); }
.stage__voice { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-faint); }
.stage__voice select {
  height: 30px; padding: 0 8px; border-radius: 8px;
  border: 1px solid var(--line); background: rgba(4, 12, 11, 0.85); font-size: 12px;
}
.btn.is-warn { background: linear-gradient(160deg, #E5B45F, #B58339); color: #2A1D06; }
.stage__hint { position: relative; text-align: center; font-size: 11.5px; color: var(--text-faint); line-height: 1.6; max-width: 34ch; }

.panel {
  display: flex; flex-direction: column; min-height: 560px;
  border-radius: 22px; border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(12, 27, 24, 0.86), rgba(7, 16, 15, 0.95));
  overflow: hidden;
}
.panel__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.panel__head h3 { font-size: 14px; }
.panel__head .muted { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); }

.turns { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.turn { display: flex; flex-direction: column; gap: 4px; max-width: 92%; animation: turnIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes turnIn { from { opacity: 0; transform: translateY(8px) scale(0.99); } }
.turn--user { align-self: flex-end; align-items: flex-end; }
.turn--model { align-self: flex-start; }
.turn__who { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); }
.turn__bubble {
  padding: 10px 13px; border-radius: 14px;
  font-size: 13.5px; line-height: 1.7;
  background: rgba(23, 51, 46, 0.72);
  border: 1px solid var(--line);
}
.turn--user .turn__bubble { background: linear-gradient(160deg, rgba(23, 128, 110, 0.42), rgba(23, 128, 110, 0.16)); border-color: rgba(53, 198, 165, 0.35); }
.turn__bubble .li { display: block; }
.turn--system { align-self: center; max-width: 100%; }
.turn--system span {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.04em;
  color: var(--text-faint); padding: 4px 10px; border-radius: 999px;
  border: 1px dashed var(--line); display: inline-block;
}
.caret {
  display: inline-block; width: 7px; height: 14px; margin-left: 3px; vertical-align: -2px;
  background: var(--mint); border-radius: 2px; animation: caret 0.9s steps(2) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

.askbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; padding: 12px 14px 14px; border-top: 1px solid var(--line); }
.askbar input {
  height: 42px; padding: 0 13px; border-radius: 11px;
  border: 1px solid var(--line); background: rgba(4, 12, 11, 0.85); outline: none; font-size: 13.5px;
}
.askbar input:focus { border-color: rgba(53, 198, 165, 0.5); box-shadow: 0 0 0 3px rgba(53, 198, 165, 0.1); }

.artifact {
  border-radius: 14px; border: 1px solid rgba(156, 140, 240, 0.28);
  background: linear-gradient(170deg, rgba(156, 140, 240, 0.1), rgba(9, 20, 18, 0.8) 52%);
  padding: 12px 14px; display: grid; gap: 10px;
  animation: turnIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.artifact__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.artifact__head span { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint); }
.artifact__head em { font-style: normal; font-size: 12.5px; color: var(--text); }
.artifact--action { border-color: rgba(229, 180, 95, 0.4); background: linear-gradient(170deg, rgba(229, 180, 95, 0.1), rgba(9, 20, 18, 0.82) 52%); }
.action__row { display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; }
.action__row b { font-weight: 600; }
.action__row span { color: var(--mint); font-family: var(--mono); font-size: 12px; }
.action__sub { font-size: 11.5px; color: var(--text-faint); }
.action__why { font-size: 12.5px; color: var(--text-dim); line-height: 1.6; }
.action__btns { display: flex; gap: 8px; }
.artifact.is-done { border-color: rgba(53, 198, 165, 0.45); }
.artifact .ok { color: var(--mint); font-size: 12px; }
.artifact .muted, .muted { color: var(--text-faint); font-size: 12px; }

.chartwrap { display: flex; align-items: center; gap: 16px; }
.chartsvg { width: 100%; height: auto; }
.chartsvg text { font-family: var(--mono); font-size: 9px; fill: var(--text-faint); }
.chartsvg .cv { fill: var(--text); font-size: 18px; font-family: var(--sans); font-weight: 600; }
.chartlegend { display: grid; gap: 5px; font-size: 11.5px; color: var(--text-dim); }
.chartlegend span { display: inline-flex; align-items: center; gap: 6px; }
.chartlegend i { width: 8px; height: 8px; border-radius: 3px; }
.chartlegend em { font-style: normal; font-family: var(--mono); color: var(--text-faint); }

@media (max-width: 1180px) {
  .live { grid-template-columns: minmax(0, 1fr); }
  .panel { min-height: 420px; }
}
