:root {
  --bg: #08090c;
  --panel: rgba(24, 26, 32, 0.66);
  --panel-strong: rgba(34, 37, 45, 0.88);
  --line: rgba(255, 255, 255, 0.1);
  --line-bright: rgba(255, 255, 255, 0.18);
  --text: #f5f6f8;
  --muted: #9297a3;
  --accent: #dfff59;
  --accent-ink: #151806;
  --danger: #ff6b72;
  --ok: #65e6a7;
  --radius: 22px;
  --radius-sm: 14px;
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 18px;
  --space-4: 24px;
  --space-5: 32px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--text);
  background: var(--bg);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(
      circle at 15% 10%,
      rgba(160, 255, 80, 0.08),
      transparent 30%
    ),
    var(--bg);
  overflow: hidden;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.12;
  pointer-events: none;
}
.orb-a {
  width: 420px;
  height: 420px;
  background: var(--accent);
  top: -250px;
  left: 20%;
}
.orb-b {
  width: 360px;
  height: 360px;
  background: #7b6cff;
  right: -220px;
  bottom: -100px;
}
.glass {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
}
.hidden {
  display: none !important;
}
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-4);
}
.login-card {
  width: min(520px, 100%);
  padding: 48px;
  border-radius: var(--radius);
  text-align: center;
}
.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  margin: 0 auto var(--space-4);
  font-weight: 900;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 0 34px rgba(223, 255, 89, 0.18);
}
.brand-mark.small {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  margin: 0;
}
.eyebrow,
.section-label {
  color: var(--muted);
  letter-spacing: 0.15em;
  font-size: 11px;
  font-weight: 800;
  margin: 0 0 var(--space-1);
}
h1 {
  font-size: clamp(38px, 5vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.05em;
  margin: 0 0 var(--space-3);
}
h2,
h3,
p {
  margin-top: 0;
}
h2 {
  letter-spacing: -0.03em;
}
h3 {
  margin-bottom: 0;
}
.muted {
  color: var(--muted);
  line-height: 1.6;
}
.button {
  border: 1px solid var(--line-bright);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  padding: 11px 16px;
  cursor: pointer;
  transition: 0.18s;
}
.button:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}
.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
}
.wide {
  width: 100%;
}
.inline-form {
  display: flex;
  gap: var(--space-1);
  margin-top: var(--space-2);
}
input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.24);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  outline: none;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
}
details {
  margin-top: var(--space-3);
  color: var(--muted);
}
.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--space-3);
  height: 100vh;
  padding: var(--space-3);
}
.sidebar {
  border-radius: var(--radius);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.section-label {
  margin-top: var(--space-4);
}
.project-list {
  overflow: auto;
  display: grid;
  gap: 6px;
}
.project-item {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  padding: 11px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.project-item:hover,
.project-item.active {
  background: rgba(255, 255, 255, 0.07);
}
.project-item.active {
  box-shadow: inset 2px 0 var(--accent);
}
.project-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
}
.project-item small,
.account small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}
.account {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: var(--space-3);
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: var(--space-2);
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7b6cff);
}
.icon-button,
.close {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
}
.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.topbar {
  height: 82px;
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar h2 {
  margin: 0;
}
.topbar-actions,
.environment-actions,
.editor-head,
.editor-head > div {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.vpn {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 13px;
  color: var(--muted);
}
.vpn span:first-child {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.vpn.ok span:first-child {
  background: var(--ok);
  box-shadow: 0 0 14px var(--ok);
}
.vpn.bad span:first-child {
  background: var(--danger);
}
.empty {
  flex: 1;
  border-radius: var(--radius);
  display: grid;
  place-content: center;
  text-align: center;
}
.empty-icon {
  font-size: 44px;
  color: var(--accent);
}
.content {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 240px minmax(360px, 1fr) 280px;
  gap: var(--space-3);
}
.episodes-panel,
.chat-panel,
.preview-panel {
  border-radius: var(--radius);
  min-height: 0;
  padding: var(--space-3);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.panel-head .section-label {
  margin-top: 0;
}
.episodes {
  display: grid;
  gap: var(--space-2);
  overflow: auto;
}
.episode {
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
}
.episode.active {
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.075);
}
.episode p {
  font-size: 13px;
  color: var(--muted);
  margin: 6px 0 0;
}
.chat-panel {
  display: flex;
  flex-direction: column;
}
.chat-panel select {
  width: auto;
  max-width: 190px;
}
.agent-controls {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.messages {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.welcome {
  margin: auto;
  text-align: center;
  max-width: 330px;
  color: var(--muted);
  line-height: 1.5;
}
.welcome span {
  font-size: 30px;
  color: var(--accent);
}
.message {
  max-width: 88%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message.user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--accent-ink);
}
.message.tool,
.message.agent_event {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  color: #bec4cf;
  background: rgba(0, 0, 0, 0.25);
}
.composer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: var(--space-2);
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 18px;
  padding: 8px;
}
.composer textarea {
  border: 0;
  background: transparent;
  resize: none;
  max-height: 160px;
}
.attach input {
  display: none;
}
.attach,
.send {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}
.attach {
  color: var(--muted);
  font-size: 22px;
}
.send {
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 20px;
}
.progress-wrap {
  padding: var(--space-2) 0;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}
.progress {
  height: 5px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.progress i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.3s;
}
.preview-panel {
  display: flex;
  flex-direction: column;
}
.phone {
  flex: 1;
  display: grid;
  place-items: center;
}
.phone-screen {
  aspect-ratio: 9/16;
  width: min(100%, 205px);
  border-radius: 26px;
  border: 1px solid var(--line-bright);
  background:
    radial-gradient(
      circle at 50% 25%,
      rgba(223, 255, 89, 0.12),
      transparent 35%
    ),
    rgba(0, 0, 0, 0.3);
  display: grid;
  place-content: center;
  text-align: center;
  padding: var(--space-4);
  color: var(--muted);
  box-shadow: inset 0 0 0 6px rgba(0, 0, 0, 0.25);
}
.phone-screen span {
  color: var(--text);
  font-weight: 800;
  font-size: 24px;
}
.phone-screen p {
  font-size: 12px;
  line-height: 1.5;
}
dialog {
  border: 0;
  background: transparent;
  padding: 0;
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}
.modal {
  position: relative;
  width: min(440px, calc(100vw - 32px));
  border-radius: var(--radius);
  padding: var(--space-5);
}
.modal label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin: var(--space-3) 0;
}
.modal label input,
.modal label select,
.modal label textarea {
  margin-top: 7px;
}
.environment-modal {
  width: min(1080px, calc(100vw - 32px));
  height: min(760px, calc(100vh - 32px));
  display: flex;
  flex-direction: column;
}
.environment-head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  align-items: flex-start;
  margin-bottom: var(--space-3);
}
.environment-head .muted {
  margin: var(--space-1) 0 0;
}
.environment-actions label {
  margin: 0;
  color: var(--text);
  font-size: inherit;
}
.environment-actions input {
  display: none;
}
.environment-body {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: var(--space-3);
}
.environment-files,
.environment-editor {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
}
.environment-files {
  overflow: auto;
  padding: var(--space-1);
}
.environment-entry {
  width: 100%;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.environment-entry:hover,
.environment-entry.active {
  background: rgba(255, 255, 255, 0.07);
}
.environment-entry small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}
.environment-editor {
  display: flex;
  flex-direction: column;
  padding: var(--space-2);
}
.editor-head {
  justify-content: space-between;
  min-height: 42px;
  padding: 0 var(--space-1) var(--space-2);
}
.editor-head strong {
  overflow-wrap: anywhere;
}
#environmentContent {
  flex: 1;
  min-height: 0;
  resize: none;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}
#environmentPlaceholder {
  display: grid;
  place-content: center;
  flex: 1;
}
.close {
  position: absolute;
  right: 18px;
  top: 14px;
}
@media (max-width: 1100px) {
  .content {
    grid-template-columns: 210px 1fr;
  }
  .preview-panel {
    display: none;
  }
}
@media (max-width: 760px) {
  body {
    overflow: auto;
  }
  .app-shell {
    display: block;
    height: auto;
    padding: var(--space-2);
  }
  .sidebar {
    min-height: auto;
    margin-bottom: var(--space-2);
  }
  .project-list {
    display: flex;
  }
  .account {
    display: none;
  }
  .workspace {
    min-height: calc(100vh - 160px);
  }
  .content {
    grid-template-columns: 1fr;
  }
  .episodes-panel {
    max-height: 250px;
  }
  .topbar {
    position: sticky;
    top: var(--space-2);
    z-index: 3;
  }
  .topbar-actions {
    gap: var(--space-1);
  }
  .environment-modal {
    height: calc(100vh - 24px);
    padding: var(--space-3);
  }
  .environment-head {
    display: block;
  }
  .environment-actions {
    margin-top: var(--space-2);
    flex-wrap: wrap;
  }
  .environment-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(150px, 35%) 1fr;
  }
  .chat-panel {
    min-height: 70vh;
  }
}
