:root {
  color-scheme: dark;
  --bg: #080a0c;
  --panel: rgba(18, 22, 27, 0.86);
  --panel-2: #10151a;
  --ink: #eef2e8;
  --muted: #8c969c;
  --line: #262e35;
  --lime: #c9ff63;
  --lime-ink: #101407;
  --cyan: #73e0ff;
  --amber: #ffc46b;
  --red: #ff7d7d;
  --radius: 16px;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.35);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(201, 255, 99, 0.10), transparent 58%),
    radial-gradient(800px 500px at 100% 0%, rgba(115, 224, 255, 0.08), transparent 55%),
    var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(20px, 4vw, 52px);
  border-bottom: 1px solid var(--line);
  background: rgba(8, 10, 12, 0.82);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: lowercase;
}

.mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--lime);
  color: var(--lime-ink);
  font-weight: 800;
}

.slash { color: var(--lime); padding: 0 2px; }

.top-right { display: flex; align-items: center; gap: 12px; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 11px;
  text-transform: lowercase;
}
.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 14px var(--amber);
}
.status.online::before { background: var(--lime); box-shadow: 0 0 14px var(--lime); }
.status.offline::before { background: var(--red); box-shadow: 0 0 14px var(--red); }

main { width: min(1220px, calc(100% - 40px)); margin: 0 auto; padding: 44px 0 60px; }

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 34px;
}

.kicker {
  margin: 0 0 12px;
  color: var(--lime);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(38px, 6vw, 76px);
  line-height: 0.94;
  letter-spacing: -0.055em;
  font-weight: 650;
}
h1 span { color: var(--muted); }

.lede { max-width: 640px; margin: 20px 0 0; color: var(--muted); font-size: 15px; line-height: 1.6; }

.hero-meta {
  display: grid;
  gap: 8px;
  min-width: 170px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.hero-meta div { display: flex; justify-content: space-between; gap: 18px; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 11px; }
.hero-meta span { color: var(--muted); }
.hero-meta strong { color: var(--ink); font-weight: 500; }

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

.card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(22, 27, 33, 0.94), rgba(12, 16, 20, 0.92));
  box-shadow: var(--shadow);
}
.card.wide { grid-column: 1 / -1; }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
h2 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }

.badge {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--lime);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 10px;
  text-transform: lowercase;
}
.badge.quiet { color: var(--muted); }
.badge.bad { color: var(--red); }

.muted { color: var(--muted); font-size: 13px; line-height: 1.55; }
.small { font-size: 12px; }

.models { display: grid; gap: 8px; margin-top: 14px; }
.model {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-2);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 12px;
}
.model strong { font-weight: 550; }
.model .meta { color: var(--muted); font-size: 10px; }
.model .ok { color: var(--lime); }
.model .down { color: var(--red); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 14px; }
.stats div { padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-2); }
.stats span { display: block; color: var(--muted); font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.stats strong { display: block; margin-top: 4px; font-size: 22px; font-weight: 600; }

.list { display: grid; gap: 8px; }
.approval {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
}
.approval .q { min-width: 0; }
.approval .q strong { display: block; font-size: 13px; font-weight: 550; }
.approval .q span { display: block; margin-top: 4px; color: var(--muted); font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions { display: flex; gap: 6px; flex-shrink: 0; }

button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.ghost, .primary, .mini {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  padding: 8px 11px;
  font-size: 12px;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}
.ghost:hover { border-color: #3a454e; }
.primary { border-color: var(--lime); background: var(--lime); color: var(--lime-ink); font-weight: 650; }
.primary:hover { background: #d8ff8f; }
.mini { padding: 6px 9px; font-size: 11px; }
.mini.yes { border-color: #42502d; color: var(--lime); }
.mini.no { border-color: #4a2b2b; color: var(--red); }

.task { display: grid; gap: 10px; }
label { color: var(--muted); font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
textarea, input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #0a0e12;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
  resize: vertical;
}
textarea:focus, input[type="text"]:focus { border-color: #526049; box-shadow: 0 0 0 3px rgba(201, 255, 99, 0.08); }
.row { display: flex; gap: 8px; }
.row input { flex: 1; }

.output {
  min-height: 44px;
  max-height: 320px;
  overflow: auto;
  margin: 14px 0 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #080b0e;
  color: #cdd7cf;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.output.tall { max-height: 420px; min-height: 120px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 10px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr[data-session] { cursor: pointer; }
tbody tr[data-session]:hover td { background: rgba(201, 255, 99, 0.04); }
td.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 11px; }
td.muted { color: var(--muted); }

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 22px;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 10px;
}

.login-body { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login { width: min(460px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); box-shadow: var(--shadow); }
.login .brand { margin-bottom: 28px; }
.login h1 { font-size: 42px; }
.login .lede { margin-top: 12px; }
.login-form { display: grid; gap: 10px; margin-top: 26px; }
.login-form input { margin-bottom: 2px; }
.error { min-height: 18px; margin: 2px 0; color: var(--red); font-size: 12px; }
.login-form .primary { width: 100%; margin-top: 4px; padding: 11px; }

@media (max-width: 820px) {
  .grid { grid-template-columns: 1fr; }
  .hero { display: block; }
  .hero-meta { margin-top: 24px; }
  .top { padding: 14px 18px; }
  main { width: min(100% - 24px, 1220px); padding-top: 28px; }
  .approval { align-items: flex-start; flex-direction: column; }
  footer { flex-direction: column; gap: 6px; }
}

/* Tabs: one control surface, seven rooms. */
.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: 0 0 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(16, 21, 26, 0.8);
}
.tabs button {
  flex: 0 0 auto;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 11px;
  text-transform: lowercase;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { background: var(--lime); color: var(--lime-ink); font-weight: 650; }

.view[hidden] { display: none; }

select {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0a0e12;
  color: var(--ink);
  padding: 10px 11px;
  min-width: 150px;
}
select:focus { border-color: #526049; outline: none; }

input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #0a0e12;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
}
input[type="password"]:focus { border-color: #526049; box-shadow: 0 0 0 3px rgba(201, 255, 99, 0.08); }

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}
.check input { width: auto; }

.wide-stats { grid-template-columns: repeat(4, 1fr); }

/* Chat */
.chat-card .card-head { flex-wrap: wrap; }
.chat {
  display: grid;
  gap: 9px;
  align-content: start;
  max-height: 460px;
  min-height: 120px;
  overflow-y: auto;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #080b0e;
}
.chat .muted { margin: 0; }
.bubble {
  max-width: 92%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble.user { justify-self: end; border-color: #43532c; background: rgba(201, 255, 99, 0.10); }
.bubble.assistant { justify-self: start; }
.bubble.tool, .bubble.receipt, .bubble.note { justify-self: start; max-width: 100%; color: var(--muted); font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 10px; }
.bubble.tool { border-color: #2d3a45; color: var(--cyan); }
.bubble.receipt { border-color: #30392a; color: var(--lime); }
.bubble.error { border-color: #4a2b2b; color: var(--red); }
.bubble summary { cursor: pointer; color: var(--muted); }
.bubble pre { margin: 7px 0 0; white-space: pre-wrap; word-break: break-word; font-size: 10px; }
.chat .working { color: var(--amber); }

/* Workspaces */
.thread-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.thread-state { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 10px; }
.thread-state.dirty { color: var(--amber); }
.thread-state.clean { color: var(--lime); }
.thread-state.gone { color: var(--red); }

/* Integrations and settings */
.connector-on { color: var(--lime); }
.connector-off { color: var(--muted); }
.insight { display: flex; justify-content: space-between; gap: 18px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); font-size: 12px; }
.insight strong { font-weight: 550; }
.insight span { color: var(--muted); font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 10px; }
.provider { display: flex; justify-content: space-between; gap: 18px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 11px; }
.provider .meta { color: var(--muted); }
.provider .ok { color: var(--lime); }
.provider .down { color: var(--red); }
.bot-row .muted { font-size: 11px; }
.bot-status { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 10px; }
.bot-status.running { color: var(--lime); }
.bot-status.stopped { color: var(--muted); }
.bot-status.error { color: var(--red); }

@media (max-width: 820px) {
  .wide-stats { grid-template-columns: repeat(2, 1fr); }
  .tabs { border-radius: 10px; }
  .bubble { max-width: 100%; }
  .row { flex-wrap: wrap; }
  .row > * { flex: 1 1 140px; }
}
tbody tr.active td { background: rgba(201, 255, 99, 0.08); }
