:root {
  color-scheme: dark;
  --bg: #06020b;
  --bg-deep: #020104;
  --surface: rgb(18 9 31 / .82);
  --surface-strong: rgb(25 12 43 / .94);
  --surface-soft: rgb(11 5 20 / .82);
  --border: rgb(151 104 217 / .25);
  --border-strong: rgb(172 119 255 / .58);
  --text: #fbf8ff;
  --muted: #b9adca;
  --accent: #8b5cf6;
  --accent-hover: #b48cff;
  --accent-2: #e3d7ff;
  --danger: #fb7185;
  --success: #4adeaa;
  --shadow: rgb(0 0 0 / .5);
  --glow: rgb(139 92 246 / .2);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 86% -10%, rgb(126 34 206 / .19), transparent 36rem),
    linear-gradient(160deg, #08030f 0%, #08040f 48%, #030105 100%);
}
body::selection { background: rgb(139 92 246 / .38); color: #fff; }
button, input, select, textarea { font: inherit; }

.ambient-scene {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(180deg, rgb(0 0 0 / .03), rgb(0 0 0 / .38));
}
.aurora {
  position: absolute;
  width: 58rem;
  height: 36rem;
  border-radius: 50%;
  filter: blur(82px) saturate(128%);
  opacity: .25;
  mix-blend-mode: screen;
  will-change: transform;
}
.aurora-one {
  top: -20rem;
  left: -14rem;
  background: radial-gradient(circle, #7c3aed 0%, #4c1d95 38%, transparent 72%);
  animation: aurora-drift-one 18s ease-in-out infinite alternate;
}
.aurora-two {
  top: 1rem;
  right: -25rem;
  background: radial-gradient(circle, #c084fc 0%, #7e22ce 34%, transparent 70%);
  animation: aurora-drift-two 22s ease-in-out infinite alternate;
}
.aurora-three {
  bottom: -24rem;
  left: 30%;
  background: radial-gradient(circle, #6d28d9 0%, #2e1065 42%, transparent 72%);
  opacity: .18;
  animation: aurora-drift-three 25s ease-in-out infinite alternate;
}
.ambient-grid {
  position: absolute;
  inset: 0;
  opacity: .12;
  background-image:
    linear-gradient(rgb(186 138 255 / .2) 1px, transparent 1px),
    linear-gradient(90deg, rgb(186 138 255 / .2) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: radial-gradient(ellipse 88% 74% at 50% 34%, #000 8%, transparent 78%);
  transform: perspective(900px) rotateX(61deg) translateY(47%);
  transform-origin: bottom center;
}
.ambient-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, transparent 32%, rgb(2 0 5 / .5) 100%),
    linear-gradient(90deg, rgb(2 0 5 / .28), transparent 22%, transparent 78%, rgb(2 0 5 / .28));
}

.shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: clamp(1rem, 2.5vw, 2.3rem);
}
.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  padding: clamp(1.6rem, 4vw, 3.7rem) 0 clamp(1.3rem, 2.4vw, 2rem);
}
.brand-lockup { max-width: 760px; }
.topbar-side {
  display: grid;
  justify-items: end;
  gap: .7rem;
  min-width: min(100%, 330px);
}
.topbar-actions,
.terminal-actions,
.key-row {
  display: flex;
  gap: .55rem;
  flex-wrap: wrap;
}
.eyebrow,
.panel-index {
  display: block;
  margin: 0 0 .45rem;
  color: var(--accent-hover);
  font-size: .68rem;
  font-weight: 860;
  letter-spacing: .21em;
  text-transform: uppercase;
}
.panel-index {
  color: #765795;
  font-size: .61rem;
  letter-spacing: .18em;
}
h1, h2, p { margin-top: 0; }
h1 {
  width: fit-content;
  margin: .36rem 0 .7rem;
  font-size: clamp(3.5rem, 8.2vw, 7rem);
  font-style: normal;
  font-weight: 840;
  letter-spacing: -.078em;
  line-height: .8;
}
h1 span, h1 em { font-style: normal; }
h1 em { color: #b07cff; }
.shiny-text {
  color: transparent;
  background: linear-gradient(105deg, #fbf8ff 8%, #fff 30%, #c9a7ff 48%, #fff 61%, #a86df6 84%);
  background-size: 230% auto;
  -webkit-background-clip: text;
  background-clip: text;
  animation: text-shine 8.5s linear infinite;
  filter: drop-shadow(0 0 30px rgb(139 92 246 / .15));
}
.shiny-text span, .shiny-text em {
  color: transparent;
  background: inherit;
  -webkit-background-clip: text;
  background-clip: text;
}
h2 {
  margin: .28rem 0 .78rem;
  color: #fff;
  font-size: clamp(1.28rem, 2vw, 1.6rem);
  letter-spacing: -.038em;
}
.banner {
  width: fit-content;
  margin-bottom: .45rem;
  color: #d9caf0;
  font-size: .95rem;
  font-weight: 650;
}
.hero-copy {
  max-width: 680px;
  margin-bottom: 0;
  color: #9e91b1;
  font-size: clamp(.9rem, 1.2vw, 1.02rem);
  line-height: 1.68;
}
.system-chip,
.badge,
.connection {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: linear-gradient(145deg, rgb(31 17 50 / .8), rgb(10 5 18 / .78));
  color: #d8c6f5;
  box-shadow: inset 0 1px rgb(255 255 255 / .055), 0 12px 32px rgb(0 0 0 / .25);
  backdrop-filter: blur(16px);
}
.system-chip {
  padding: .48rem .8rem;
  color: #b5a3c8;
  font-size: .72rem;
  font-weight: 730;
  letter-spacing: .04em;
}
.system-chip i,
.lock-dot {
  width: .45rem;
  height: .45rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgb(74 222 170 / .08), 0 0 14px rgb(74 222 170 / .62);
}
.badge,
.connection { padding: .42rem .72rem; font-size: .76rem; white-space: nowrap; }
.connection { color: #d8c7ff; }

button {
  min-height: 44px;
  position: relative;
  border: 1px solid transparent;
  border-radius: 13px;
  padding: .75rem 1rem;
  overflow: hidden;
  background: linear-gradient(135deg, #7c3aed 0%, #9658f5 56%, #bb82ff 100%);
  color: #fff;
  font-weight: 780;
  letter-spacing: -.01em;
  box-shadow: 0 12px 28px rgb(109 40 217 / .25), inset 0 1px rgb(255 255 255 / .18);
  cursor: pointer;
  transition: transform .18s ease, filter .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}
button:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-2px);
  box-shadow: 0 17px 36px rgb(109 40 217 / .34), inset 0 1px rgb(255 255 255 / .22);
}
button:active:not(:disabled) { transform: translateY(0); }
button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgb(180 140 255 / .3);
  outline-offset: 2px;
}
.primary-action::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 24%, rgb(255 255 255 / .3) 46%, transparent 67%);
  transform: translateX(-125%);
  transition: transform .58s ease;
}
.primary-action:hover::after { transform: translateX(125%); }
button.secondary {
  background: rgb(21 10 35 / .78);
  color: var(--accent-2);
  border-color: var(--border);
  box-shadow: inset 0 1px rgb(255 255 255 / .035);
}
button.secondary:hover:not(:disabled) {
  border-color: rgb(165 108 244 / .52);
  background: rgb(42 22 65 / .9);
  box-shadow: 0 10px 24px rgb(0 0 0 / .25);
}
button.danger {
  background: rgb(59 12 27 / .35);
  color: #ff9caf;
  border-color: rgb(251 113 133 / .34);
  box-shadow: none;
}
button.danger:hover:not(:disabled) { background: rgb(84 17 38 / .58); box-shadow: 0 10px 24px rgb(30 0 8 / .24); }
.compact { min-height: 38px; padding: .55rem .8rem; font-size: .76rem; }

.panel {
  --spot-x: 50%;
  --spot-y: 0%;
  position: relative;
  isolation: isolate;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: clamp(1.1rem, 2.1vw, 1.55rem);
  background:
    linear-gradient(155deg, rgb(25 13 42 / .89), rgb(10 5 18 / .84));
  box-shadow:
    0 30px 82px rgb(0 0 0 / .5),
    inset 0 1px rgb(255 255 255 / .04),
    0 0 0 1px rgb(139 92 246 / .025);
  backdrop-filter: blur(22px) saturate(120%);
}
.panel::after {
  content: '';
  position: absolute;
  inset: -1px;
  z-index: -2;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgb(206 164 255 / .42), transparent 31%, transparent 69%, rgb(111 50 178 / .26));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: .54;
  pointer-events: none;
}
.rb-spotlight::before,
.session-card::before,
.metrics > div::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(420px circle at 50% 0%, rgb(177 116 255 / .14), transparent 56%);
  opacity: 0;
  transition: opacity .28s ease;
  pointer-events: none;
}
.rb-spotlight:hover::before,
.session-card:hover::before,
.metrics > div:hover::before { opacity: 1; }
.panel > *, .session-card > *, .metrics > div > * { position: relative; z-index: 1; }
.login-panel {
  max-width: 900px;
  margin: clamp(2rem, 7vh, 5rem) auto;
  display: grid;
  grid-template-columns: .95fr 1.05fr;
  gap: clamp(1.3rem, 3vw, 2.6rem);
  padding: clamp(1.4rem, 3vw, 2.1rem);
}
.login-copy { align-self: center; }
.login-copy > p:last-child { margin-bottom: 0; color: var(--muted); line-height: 1.65; }
.stack { display: grid; gap: .95rem; }
label {
  display: grid;
  gap: .45rem;
  color: #b5a8c5;
  font-size: .85rem;
  font-weight: 620;
}
input, select, textarea {
  width: 100%;
  color: var(--text);
  background: rgb(8 4 14 / .86);
  border: 1px solid rgb(139 92 246 / .3);
  border-radius: 14px;
  padding: .82rem .88rem;
  box-shadow: inset 0 1px rgb(255 255 255 / .025);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease, transform .18s ease;
}
input:hover, select:hover, textarea:hover { border-color: rgb(177 116 255 / .52); background: rgb(15 7 26 / .94); }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-hover);
  background: #0e0718;
  box-shadow: 0 0 0 3px rgb(139 92 246 / .14), 0 15px 34px rgb(0 0 0 / .28);
}
.select-shell { position: relative; display: block; }
.select-shell::before {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 13px;
  background: linear-gradient(110deg, rgb(139 92 246 / .08), transparent 48%);
  pointer-events: none;
}
.select-shell::after {
  content: '';
  position: absolute;
  right: 15px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--accent-2);
  border-bottom: 2px solid var(--accent-2);
  transform: translateY(-72%) rotate(45deg);
  pointer-events: none;
}
select { appearance: none; min-height: 50px; padding-right: 2.8rem; cursor: pointer; }
select:disabled { cursor: not-allowed; opacity: .55; }
select option { color: var(--text); background: #10091b; }
.muted { color: var(--muted); }
.repository-status,
.mode-description,
.lock-note {
  margin: -.35rem 0 0;
  font-size: .76rem;
  line-height: 1.5;
}
.lock-note { display: flex; align-items: flex-start; gap: .58rem; margin-top: .2rem; }
.lock-note .lock-dot { margin-top: .38rem; background: #c084fc; box-shadow: 0 0 0 4px rgb(192 132 252 / .08), 0 0 14px rgb(192 132 252 / .44); }
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr);
  gap: 1rem;
}
.sessions-panel,
.terminal-panel { margin-top: 1rem; }
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.section-heading .eyebrow { margin-top: .35rem; }
.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin-top: .95rem;
}
.metrics > div {
  position: relative;
  isolation: isolate;
  min-width: 0;
  border: 1px solid rgb(151 104 217 / .24);
  border-radius: 15px;
  padding: 1rem;
  background: linear-gradient(145deg, rgb(35 19 54 / .9), rgb(12 6 21 / .92));
  box-shadow: inset 0 1px rgb(255 255 255 / .03);
  overflow: hidden;
}
.metrics span {
  display: block;
  overflow-wrap: anywhere;
  color: #e7d8ff;
  font-size: clamp(1.45rem, 3vw, 1.85rem);
  font-weight: 840;
  letter-spacing: -.04em;
}
.metrics small { color: #a596b7; }
.usage-note { margin: .95rem 0 0; font-size: .78rem; line-height: 1.55; }
.session-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: .8rem;
  margin-top: .5rem;
}
.session-card {
  position: relative;
  isolation: isolate;
  text-align: left;
  display: grid;
  gap: .45rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: linear-gradient(145deg, rgb(30 16 47 / .94), rgb(10 5 18 / .94));
  color: var(--text);
  box-shadow: inset 0 1px rgb(255 255 255 / .03);
}
.session-card:hover:not(:disabled) { border-color: var(--border-strong); transform: translateY(-2px); }
.session-card.selected { border-color: var(--accent-hover); box-shadow: 0 0 0 2px rgb(139 92 246 / .11), 0 14px 34px rgb(0 0 0 / .3); }
.session-card strong { font-size: 1rem; }
.session-meta { color: var(--muted); font-size: .79rem; }
.status-running { color: var(--success); }
.status-action { color: #d8a5ff; }
.status-ended { color: var(--muted); }
.action-required {
  margin-bottom: .8rem;
  border: 1px solid rgb(177 116 255 / .55);
  border-radius: 13px;
  padding: .8rem .9rem;
  background: linear-gradient(105deg, rgb(126 34 206 / .2), rgb(88 28 135 / .11));
  color: #e3d2ff;
  box-shadow: inset 0 1px rgb(255 255 255 / .04);
}
.terminal-output {
  min-height: 430px;
  max-height: 65vh;
  overflow: auto;
  border: 1px solid rgb(151 104 217 / .26);
  border-radius: 15px;
  padding: 1rem;
  background: linear-gradient(180deg, #030106, #07020b);
  color: #eee6f8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  scrollbar-color: #70499a #08040e;
  box-shadow: inset 0 20px 44px rgb(0 0 0 / .3);
  font: 13px/1.52 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.terminal-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .75rem;
  margin-top: .75rem;
  align-items: stretch;
}
.key-row { margin-top: .65rem; }
.error { min-height: 1.2em; margin: 0; color: #ff9aaf; font-size: .82rem; }
code { color: #e0cbff; }

@keyframes aurora-drift-one { to { transform: translate3d(12rem, 8rem, 0) scale(1.12) rotate(8deg); } }
@keyframes aurora-drift-two { to { transform: translate3d(-12rem, 9rem, 0) scale(.93) rotate(-10deg); } }
@keyframes aurora-drift-three { to { transform: translate3d(4rem, -8rem, 0) scale(1.15); } }
@keyframes text-shine { to { background-position: 230% center; } }

@media (max-width: 1040px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .usage-panel { order: -1; }
}
@media (max-width: 760px) {
  .shell { padding: .8rem; }
  .topbar, .section-heading { align-items: stretch; flex-direction: column; }
  .topbar { padding-top: 1.8rem; margin-bottom: .3rem; }
  .topbar-side { justify-items: start; min-width: 0; }
  .topbar-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .login-panel { grid-template-columns: 1fr; gap: 1.2rem; margin: 1.4rem 0; }
  .panel { border-radius: 19px; padding: 1rem; }
  .terminal-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #stopSessionButton { grid-column: 1 / -1; }
  .terminal-input-row { grid-template-columns: 1fr; }
  .terminal-output { min-height: 52vh; max-height: 62vh; padding: .8rem; font-size: 12.5px; }
  .session-cards { grid-template-columns: 1fr; }
  input, select, textarea { font-size: 16px; }
  .key-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .key-row button { min-width: 0; padding-inline: .45rem; }
}
@media (max-width: 460px) {
  h1 { font-size: clamp(3.1rem, 20vw, 4.4rem); }
  .eyebrow { font-size: .64rem; letter-spacing: .16em; }
  .topbar-actions { grid-template-columns: 1fr; }
  .metrics { gap: .55rem; }
  .metrics > div { padding: .78rem; }
  .metrics span { font-size: 1.35rem; }
  .terminal-actions { grid-template-columns: 1fr; }
  #stopSessionButton { grid-column: auto; }
  .key-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
