:root {
  --bg: #0e1114;
  --panel: #161b20;
  --panel-2: #1c2329;
  --line: #2a333c;
  --text: #e7eef4;
  --muted: #8b9aab;
  --accent: #3d9a7a;
  --accent-2: #c4a35a;
  --danger: #d4645a;
  --ok: #4caf82;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, #1a2a28 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #243040 0%, transparent 50%),
    var(--bg);
  color: var(--text);
}

a { color: var(--accent); }
button, input, select, textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #04140f;
  font-weight: 600;
  padding: 0.65rem 1rem;
}
button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
button.danger { background: var(--danger); color: #fff; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
input, select, textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
}
textarea {
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.45;
  min-height: 320px;
  resize: vertical;
  width: 100%;
}
textarea#promptEditor,
textarea#docEditor {
  min-height: min(68vh, 780px);
}
label { display: grid; gap: 0.35rem; font-size: 0.85rem; color: var(--muted); }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.ok { color: var(--ok); }

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.auth-card {
  width: min(420px, 100%);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.75rem;
  display: grid;
  gap: 0.85rem;
}
.brand {
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--accent-2);
  margin: 0;
}
.auth-card h1 { margin: 0; font-size: 1.6rem; font-weight: 650; }

.shell {
  max-width: 1680px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2rem;
  display: grid;
  gap: 1rem;
}
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}
.top h1 { margin: 0; font-size: 1.45rem; }
.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}
@media (min-width: 1100px) {
  .layout {
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 1.5rem;
  }
  .shell { padding: 1.5rem 2rem 2.5rem; }
  textarea { font-size: 0.92rem; }
  textarea#promptEditor,
  textarea#docEditor {
    min-height: calc(100vh - 14rem);
  }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  textarea#promptEditor,
  textarea#docEditor { min-height: 280px; }
}
.panel {
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.15rem;
}
#detail.panel {
  min-height: calc(100vh - 7.5rem);
}
.list { display: grid; gap: 0.5rem; }
.agent-item {
  text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0.75rem;
  border-radius: 10px;
  display: grid;
  gap: 0.2rem;
}
.agent-item.active {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  box-shadow: inset 3px 0 0 var(--accent);
}
.agent-item .name { font-weight: 650; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--line);
  color: var(--muted);
}
.badge.running { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.badge.stopped { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }

.tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.9rem; }
.tab {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  font-weight: 500;
}
.tab.active { color: var(--text); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 15%, transparent); }
.row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.stack { display: grid; gap: 0.75rem; }
.skill {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
}
.docs-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
@media (min-width: 1100px) {
  .docs-layout { grid-template-columns: 280px minmax(0, 1fr); gap: 1.25rem; }
}
@media (max-width: 860px) {
  .docs-layout { grid-template-columns: 1fr; }
}
.docs-list { display: grid; gap: 0.35rem; max-height: min(55vh, 520px); overflow: auto; }
.doc-btn {
  text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
}
.doc-btn.active { border-color: var(--accent-2); }
.mono { font-family: var(--mono); font-size: 0.82rem; }
.hidden { display: none !important; }
.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  max-width: min(360px, calc(100vw - 2rem));
}
.create-box {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
