:root {
  color-scheme: dark;
  --bg: #09111f;
  --panel: rgba(8, 20, 40, 0.86);
  --panel-strong: rgba(7, 16, 34, 0.96);
  --line: rgba(132, 177, 255, 0.18);
  --line-strong: rgba(132, 177, 255, 0.28);
  --text: #eef5ff;
  --muted: #8fa7c3;
  --accent: #57c7ff;
  --accent-2: #8df2c2;
  --danger: #ff758f;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  --font: "IBM Plex Sans", "Segoe UI Variable", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Code", "Consolas", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(87, 199, 255, 0.16), transparent 32%),
    radial-gradient(circle at top right, rgba(141, 242, 194, 0.1), transparent 26%),
    linear-gradient(180deg, #0a1324, #07111d 42%, #060d17);
}

button,
input,
textarea,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  padding: 20px;
}

.sidebar,
.main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 20px;
  backdrop-filter: blur(18px);
}

.compact {
  padding: 18px;
}

.fill {
  flex: 1;
}

.brand h1,
.hero h2 {
  margin: 4px 0 8px;
  font-size: 1.8rem;
}

.eyebrow {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.muted,
.hint {
  color: var(--muted);
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 0.95rem;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(7, 16, 34, 0.92);
  color: var(--text);
  border-radius: 16px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 180ms ease, transform 180ms ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  transform: translateY(-1px);
}

textarea {
  resize: vertical;
}

button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 11px 16px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary {
  background: linear-gradient(135deg, var(--accent), #2b8fff);
  color: #03101d;
  font-weight: 700;
}

.ghost {
  background: rgba(10, 22, 42, 0.72);
  color: var(--text);
  border-color: var(--line);
}

.danger {
  border-color: rgba(255, 117, 143, 0.32);
  color: #ffd9e1;
}

.small {
  padding: 8px 12px;
  font-size: 0.88rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.section-header h2,
.section-header h3 {
  margin: 0;
}

.bot-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bot-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  text-align: left;
  background: rgba(7, 16, 34, 0.8);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 18px;
  padding: 14px;
}

.bot-card.active {
  border-color: var(--accent);
  background: rgba(18, 42, 80, 0.92);
}

.bot-name {
  font-weight: 700;
}

.bot-sub,
.bot-state {
  font-size: 0.88rem;
  color: var(--muted);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.stat {
  min-height: 120px;
}

.stat-label {
  margin: 0;
  color: var(--muted);
}

.stat-value {
  margin: 14px 0 0;
  font-size: 1.8rem;
  font-weight: 700;
}

.stat-value.small {
  font-size: 1rem;
  line-height: 1.5;
  word-break: break-all;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.wide {
  grid-column: span 2;
}

.toggle {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}

.toggle input {
  width: auto;
}

.large-textarea {
  min-height: 280px;
}

.mono,
.logs-output,
.file-editor,
.current-dir,
.current-file {
  font-family: var(--mono);
}

.files-panel,
.logs-panel {
  grid-column: span 2;
}

.files-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
}

.file-tree,
.editor-pane {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
}

.current-dir,
.current-file {
  font-size: 0.9rem;
  color: var(--accent-2);
  margin-bottom: 10px;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
}

.file-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(5, 13, 24, 0.72);
  color: var(--text);
  padding: 12px;
}

.file-entry-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.file-editor {
  width: 100%;
  min-height: 420px;
  border-radius: 14px;
}

.logs-output {
  margin: 0;
  min-height: 240px;
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.small-link {
  color: var(--accent);
  text-decoration: none;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: rgba(5, 14, 28, 0.96);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 14px 18px;
  box-shadow: var(--shadow);
}

.toast.error {
  border-color: rgba(255, 117, 143, 0.32);
}

.hidden {
  display: none;
}

@media (max-width: 1200px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .status-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .files-panel,
  .logs-panel,
  .wide {
    grid-column: span 1;
  }

  .files-layout,
  .form-grid,
  .hero {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }
}
