:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #16181d;
  --muted: #6b7280;
  --panel: #f4f5f7;
  --panel-hover: #eceef1;
  --border: rgba(15, 23, 42, 0.11);
  --button: #17191d;
  --button-text: #ffffff;
  --success: #15803d;
  --danger: #b42318;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1e;
    --fg: #f5f6f7;
    --muted: #a6a9b0;
    --panel: #292b2f;
    --panel-hover: #33363b;
    --border: rgba(255, 255, 255, 0.1);
    --button: #f5f6f7;
    --button-text: #151619;
    --success: #5ed989;
    --danger: #ff8b82;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  letter-spacing: 0;
}

button, input { font: inherit; letter-spacing: 0; }

button { cursor: pointer; }

button:disabled { cursor: not-allowed; opacity: 0.52; }

.shell {
  width: min(880px, calc(100% - 40px));
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 0 max(36px, env(safe-area-inset-bottom));
}

.topbar {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--button);
  color: var(--button-text);
  font-size: 15px;
  font-weight: 700;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 1px; }

.auth-layout {
  min-height: calc(100vh - 150px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 72px;
  align-items: center;
}

.auth-copy h1, .section-heading h1 {
  margin: 5px 0 10px;
  font-size: 30px;
  line-height: 1.2;
  font-weight: 680;
}

.auth-copy > p:last-child, .section-copy {
  max-width: 470px;
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 14px;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.auth-panel {
  display: grid;
  gap: 10px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.auth-panel label { font-size: 13px; font-weight: 620; margin-top: 4px; }

.auth-panel input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  padding: 0 12px;
  outline: none;
}

.auth-panel input:focus { border-color: var(--fg); box-shadow: 0 0 0 2px color-mix(in srgb, var(--fg) 12%, transparent); }

.primary-button, .secondary-button, .quiet-button {
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 0 14px;
  white-space: nowrap;
}

.primary-button { background: var(--button); color: var(--button-text); margin-top: 8px; }
.secondary-button { background: transparent; color: var(--fg); border-color: var(--border); }
.secondary-button:hover, .quiet-button:hover { background: var(--panel); }
.quiet-button { background: transparent; color: var(--muted); padding-inline: 9px; }

.error-text { margin: 4px 0 0; color: var(--danger); font-size: 13px; line-height: 1.5; }

#agents-view { padding-top: 56px; }

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.agent-list { display: grid; gap: 10px; }

.agent-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  min-height: 82px;
  padding: 15px 16px;
  background: var(--panel);
  border: 1px solid transparent;
  border-radius: 8px;
}

.agent-row:hover { background: var(--panel-hover); border-color: var(--border); }
.agent-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.agent-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }

.status-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--muted); }
.status-dot.online { background: var(--success); }

.agent-meta { margin: 7px 0 0 16px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.agent-action { min-width: 80px; }

.empty-state {
  padding: 52px 20px;
  text-align: center;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.empty-state p { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.page-status { min-height: 20px; margin-top: 18px; color: var(--muted); font-size: 12px; }

@media (max-width: 680px) {
  .shell { width: min(100% - 28px, 520px); }
  .auth-layout { grid-template-columns: 1fr; align-content: center; gap: 30px; padding: 48px 0; }
  .auth-copy h1, .section-heading h1 { font-size: 26px; }
  #agents-view { padding-top: 38px; }
  .section-heading { align-items: center; }
  .agent-row { gap: 12px; padding: 14px; }
  .agent-action { min-width: 72px; padding-inline: 10px; }
}
