/* === Brand Tokens (Design B) === */
:root {
  /* Colors */
  --primary: #E63946;
  --primary-light: #EF6B77;
  --primary-dark: #C4202E;
  --secondary: #FF9F43;
  --cta: #00E676;
  --cta-dark: #00C853;
  --cyan: #00D4FF;
  --yellow: #FFE033;
  --error: #FF5252;
  --warning: #FFAB00;
  --info: #448AFF;

  /* Surfaces */
  --bg: #FFFFFF;
  --surface: #F5F5F5;
  --surface-hover: #EBEBEB;
  --border: #E0E0E0;

  /* Text */
  --text-primary: #1A1A1E;
  --text-muted: #757575;
  --text-dim: #9E9E9E;

  /* Glow */
  --glow: rgba(230, 57, 70, 0.08);
  --glow-strong: rgba(230, 57, 70, 0.15);

  /* Typography */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-pixel: 'Press Start 2P', monospace;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 9999px;

  /* Shadows */
  --shadow-glow: 0 0 30px var(--glow);
  --shadow-glow-strong: 0 0 48px var(--glow-strong);
  --shadow-elevation: 0 4px 24px rgba(0, 0, 0, 0.08);

  /* Derived (hardcoded-color replacements) */
  --cta-text: #FFFFFF;
  --cta-glow: rgba(230, 57, 70, 0.2);
  --cta-glow-strong: rgba(230, 57, 70, 0.3);
  --edge-color: #C0C0C0;
}

/* === Reset === */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

::selection {
  background: rgba(230, 57, 70, 0.3);
  color: #fff;
}

/* === Layout === */
.layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* === Login === */
.login-container {
  width: 100%;
  max-width: 420px;
  padding: 1.5rem;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
}

.login-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

/* === Forms === */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.form-input {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input::placeholder {
  color: var(--text-dim);
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.15);
}

/* === Buttons === */
.btn {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--cta);
  color: var(--cta-text);
  font-weight: 700;
  box-shadow: 0 0 24px var(--cta-glow);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 0 40px var(--cta-glow-strong);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: border-color 0.2s, color 0.2s;
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

/* === Errors === */
.login-error:empty {
  display: none;
}

.error-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--error);
  background: rgba(255, 82, 82, 0.1);
  border: 1px solid rgba(255, 82, 82, 0.3);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
}

/* === Page links === */
.login-link {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 1.25rem;
}

.login-link a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.login-link a:hover {
  color: var(--primary-light);
}

.forgot-password-link {
  display: block;
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.375rem;
  text-decoration: none;
}

.forgot-password-link:hover {
  color: var(--primary);
}

/* === App Layout === */
.app-layout {
  display: flex;
  height: 100vh;
}

.app-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

/* === Sidebar === */
.sidebar {
  width: 240px;
  background: var(--bg);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  transition: width 0.2s;
  overflow: hidden;
}

.sidebar.sidebar-collapsed {
  width: 60px;
}

.sidebar-header {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-logo {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0;
}

.sidebar-nav a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  border-left: 3px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  transition: color 0.15s, background 0.15s;
}

.sidebar-nav a:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

.sidebar-nav a.active {
  color: var(--text-primary);
  border-left-color: var(--primary);
}

.sidebar-separator {
  border-top: 1px solid var(--border);
  margin: 0.5rem 0;
}

.sidebar-footer {
  margin-top: auto;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  position: relative;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
  min-width: 0;
  cursor: pointer;
}

.sidebar-user-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.sidebar-menu-btn {
  font-family: var(--font-display);
  width: 100%;
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.sidebar-menu-btn:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

.sidebar-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.sidebar-avatar-img {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.sidebar-avatar-img.account-avatar-large {
  width: 64px;
  height: 64px;
  min-width: 64px;
}

.sidebar-username {
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-collapse-btn {
  font-family: inherit;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  width: 28px;
  height: 28px;
  min-width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  transition: border-color 0.15s, color 0.15s;
}

.sidebar-collapse-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

/* === Sidebar Icons === */
.sidebar-icon {
  display: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
}

.sidebar-collapsed .sidebar-icon {
  display: block;
}

.sidebar-collapsed .sidebar-nav a {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hide labels when sidebar is collapsed */
.sidebar-collapsed .sidebar-label {
  display: none;
}

.sidebar-collapsed .sidebar-header {
  padding: 1.25rem 0.5rem;
  justify-content: center;
}

.sidebar-collapsed .sidebar-logo {
  display: none;
}

.sidebar-collapsed .sidebar-nav a {
  padding: 0.5rem;
  border-left: none;
  text-align: center;
}

.sidebar-collapsed .sidebar-footer {
  padding: 0.75rem 0.5rem;
}


/* === Mobile Menu Button === */
.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  cursor: pointer;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: block;
  }

  .sidebar.sidebar-collapsed {
    width: 0;
    border-right: none;
  }
}

/* === Agents Filter Bar === */
.agents-filter-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.agents-filter-bar .form-select {
  max-width: 250px;
}

/* === Agents Table === */
.agents-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.agents-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.agents-table th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--primary);
  color: var(--text-dim);
  white-space: nowrap;
}

.agents-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.agents-table tr:hover {
  background: var(--surface-hover);
}

.agents-table a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
}

.agents-table a:hover {
  color: var(--primary);
}

.agents-table .project-link {
  font-weight: 400;
  color: var(--text-muted);
}

/* === Status Badges === */
.status-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.6rem;
  border: none;
  border-radius: var(--radius-pill);
}

.status-pending {
  color: #9CA3AF;
  background: rgba(107, 114, 128, 0.12);
}

.status-running {
  color: #448AFF;
  background: rgba(68, 138, 255, 0.12);
}

.status-waiting {
  color: #FFAB00;
  background: rgba(255, 171, 0, 0.12);
}

.status-captcha {
  color: #FFAB00;
  background: rgba(255, 171, 0, 0.12);
}

.status-completed {
  color: #00E676;
  background: rgba(0, 230, 118, 0.12);
}

.status-failed {
  color: #FF5252;
  background: rgba(255, 82, 82, 0.12);
}

/* === Pagination === */
.pagination {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
}

.pagination a,
.pagination span {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-muted);
  background: var(--surface);
  transition: border-color 0.15s, color 0.15s;
}

.pagination a:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--primary);
}

.pagination .disabled {
  color: var(--text-dim);
  border-color: var(--border);
  background: var(--bg);
  cursor: not-allowed;
  pointer-events: none;
}

/* === Back Link === */
.back-link {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  text-decoration: none;
  margin-bottom: 1rem;
  transition: color 0.15s;
}

.back-link:hover {
  color: var(--primary);
}

/* === Section Title === */
.section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

/* === Agent Meta === */
.agent-meta {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.meta-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.meta-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.meta-value {
  font-size: 0.9rem;
}

.meta-prompt {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.meta-prompt .meta-value {
  white-space: pre-wrap;
  word-break: break-word;
}

/* === Agent Result Card === */
.agent-result {
  padding: 1.5rem;
  border: 1px solid;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.agent-result-success {
  background: rgba(0, 230, 118, 0.06);
  border-color: rgba(0, 230, 118, 0.3);
}
.agent-result-failure {
  background: rgba(255, 82, 82, 0.06);
  border-color: rgba(255, 82, 82, 0.3);
}
.agent-result-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}
.agent-result-success .agent-result-title { color: var(--cta); }
.agent-result-failure .agent-result-title { color: var(--error); }
.agent-result-text {
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.agent-result-success .agent-result-text { color: var(--cta); }
.agent-result-failure .agent-result-text { color: var(--error); }

/* === Conversation Thread === */
.conversation {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.msg {
  padding: 1rem;
  border-left: 4px solid;
}

.msg-user {
  border-left-color: var(--primary);
  background: rgba(230, 57, 70, 0.06);
}

.msg-model {
  border-left-color: var(--border);
  background: var(--surface);
}

.msg-role {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.msg-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.85rem;
  line-height: 1.6;
}

.msg-fn-call,
.msg-fn-resp {
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

.msg-fn-call summary,
.msg-fn-resp summary {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  color: var(--text-dim);
  padding: 0.25rem 0;
}

.msg-fn-call summary:hover,
.msg-fn-resp summary:hover {
  color: var(--text-primary);
}

.msg-fn-call pre,
.msg-fn-resp pre {
  background: var(--bg);
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding: 0.75rem;
  margin-top: 0.25rem;
  overflow-x: auto;
  font-size: 0.75rem;
  line-height: 1.5;
  border-radius: var(--radius-md);
}

.msg-screenshot {
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: 0.5rem;
}

.msg-screenshot-thumb {
  max-width: 300px;
  cursor: zoom-in;
}

/* === Lightbox === */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-img {
  max-width: 95vw;
  max-height: 95vh;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

/* === Live Badge === */
.vnc-live-badge {
  display: inline-block;
  color: #fff;
  background: #dc2626;
  padding: 0.1rem 0.4rem;
  font-size: 0.6rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  animation: pulse-live 2s ease-in-out infinite;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.vnc-ended {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* === Meta Live Link === */
.meta-live-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.85rem;
}

.meta-live-link:hover {
  text-decoration: underline;
}

/* === Full-Page Browser View === */
.browser-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 4rem);
}

.browser-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.browser-header .back-link {
  margin-bottom: 0;
}

.browser-screen {
  flex: 1;
  min-height: 0;
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

/* === Page Header (title + action) === */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-header .page-title,
.page-header .section-title { margin-bottom: 0; }

/* === Create Agent Form === */
.create-form {
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.create-error:empty { display: none; }

.form-hint {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
}

.form-select {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.15);
}

.form-textarea {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
  outline: none;
  resize: vertical;
  min-height: 120px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.15);
}

.form-checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.form-checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* === Dashboard === */
.dash-section { margin-bottom: 2rem; }
.dash-empty { font-size: 0.85rem; color: var(--text-dim); padding: 1rem 0; }

/* CTA banner */
.dash-cta {
  background: rgba(230, 57, 70, 0.06);
  border: 1px solid rgba(230, 57, 70, 0.2);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.dash-cta-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}
.dash-cta-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Quota bar */
.quota-bar-container { display: flex; align-items: center; gap: 1rem; }
.quota-bar { flex: 1; height: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-pill); overflow: hidden; }
.quota-bar-fill { height: 100%; background: var(--primary); transition: width 0.3s ease; border-radius: var(--radius-pill); }
.quota-text { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; white-space: nowrap; color: var(--text-muted); }

/* Dashboard card list */
.dash-list { display: flex; flex-direction: column; gap: 0.5rem; }
.dash-card { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); text-decoration: none; color: var(--text-primary); transition: border-color 0.2s, transform 0.15s; }
.dash-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.dash-card-text { flex: 1; font-size: 0.85rem; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dash-card-meta { font-size: 0.7rem; color: var(--text-dim); white-space: nowrap; }

/* Draft status badge (experiments — mirrors .status-pending) */
.status-draft { color: #9CA3AF; background: rgba(107, 114, 128, 0.12); }

/* === Discovery Hero === */
.discovery-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.discovery-hero .section-title { margin-bottom: 1rem; }
.discovery-form { display: flex; flex-direction: column; gap: 0.75rem; }
.discovery-fields {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: flex-start;
}
.discovery-fields .form-select { flex: 0 0 auto; min-width: 140px; }
.discovery-fields .form-input { flex: 1; min-width: 200px; }
.discovery-fields .btn { flex: 0 0 auto; white-space: nowrap; }
.discovery-error:not(:empty) { margin-bottom: 0.5rem; }

/* === App Map Card Grid === */
.app-map {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.app-map-node {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-left-color: var(--text-dim);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.app-map-node--blue  { border-left-color: var(--info); }
.app-map-node--olive { border-left-color: var(--cta); }
.app-map-node--amber { border-left-color: var(--warning); }
.app-map-node--red   { border-left-color: var(--error); }
.app-map-node--purple{ border-left-color: #7c3aed; }
.app-map-node--muted { border-left-color: var(--text-dim); }
.app-map-node-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.app-map-node-title { font-weight: 700; font-size: 0.9rem; color: var(--text-primary); }
.app-map-node-type {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.1rem 0.4rem;
  white-space: nowrap;
}
.app-map-node-url { font-size: 0.8rem; color: var(--text-dim); word-break: break-all; }
.app-map-node-actions { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.app-map-action-tag {
  font-size: 0.7rem;
  background: rgba(230, 57, 70, 0.08);
  border: 1px solid rgba(230, 57, 70, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.4rem;
  color: var(--primary);
}
.app-map-node-notes { font-size: 0.8rem; color: var(--text-dim); font-style: italic; }

/* === App Map Graph === */
.appmap-container {
  position: relative;
  height: 80vh;
  min-height: 600px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg);
  margin-bottom: 1.5rem;
}
.appmap-dashboard { height: 500px; min-height: unset; }
.appmap-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.appmap-svg {
  position: absolute;
  top: 0;
  left: 0;
}
.appmap-edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  cursor: pointer;
  pointer-events: stroke;
}
.appmap-edge {
  fill: none;
  stroke: var(--edge-color);
  stroke-width: 1.5;
  pointer-events: none;
}
.appmap-arrow { fill: var(--edge-color); pointer-events: none; }
.appmap-edge-label-fo {
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.appmap-edge-label-fo.appmap-edge-label-visible { opacity: 1; }
.appmap-edge-label {
  display: inline-block;
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
  box-shadow: var(--shadow-elevation);
}
.appmap-node {
  position: absolute;
  top: 0;
  left: 0;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--radius-md);
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  cursor: default;
  box-sizing: border-box;
  min-width: 240px;
  background: var(--surface);
  color: var(--text-primary);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.appmap-node:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.4); border-color: var(--primary); z-index: 100; }
.appmap-node-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
}
.appmap-node-title {
  font-weight: 700;
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.appmap-node-type {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid;
  padding: 0.05rem 0.35rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.appmap-node-url {
  font-size: 0.7rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.appmap-node-actions {
  font-size: 0.65rem;
  color: var(--text-dim);
}
/* Collapse toggle */
.appmap-node-toggle {
  cursor: pointer;
  font-size: 0.6rem;
  color: var(--text-dim);
  flex-shrink: 0;
  width: 16px;
  text-align: center;
  user-select: none;
}
.appmap-node-toggle:hover { color: var(--text-primary); }
/* Collapsed summary badge */
.appmap-node-summary {
  font-size: 0.65rem;
  color: var(--text-muted);
  background: var(--surface-hover);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  margin-top: 0.1rem;
}
.appmap-node-summary-errors { color: var(--error); font-weight: 700; }
.appmap-node-collapsed { border-style: solid; border-right-width: 4px; }
/* Tooltip */
.appmap-tooltip {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.6rem;
  min-width: 180px;
  max-width: 300px;
  z-index: 200;
  box-shadow: var(--shadow-elevation);
  font-size: 0.75rem;
}
.appmap-node:hover .appmap-tooltip { display: block; }
.appmap-tooltip-title { font-weight: 700; color: var(--text-primary); margin-bottom: 0.2rem; }
.appmap-tooltip-title:not(:first-child) { margin-top: 0.4rem; }
.appmap-tooltip-item { color: var(--text-muted); padding-left: 0.4rem; }
/* Focus / dim */
.appmap-focus-active .appmap-node.appmap-dimmed { opacity: 0.2; }
.appmap-focus-active .appmap-edge.appmap-dimmed { stroke-opacity: 0.1; }
.appmap-focus-active .appmap-arrow.appmap-dimmed { fill-opacity: 0.1; }
.appmap-focus-active .appmap-edge.appmap-focused { stroke: var(--primary); stroke-width: 2.5; }
.appmap-focus-active .appmap-arrow.appmap-focused { fill: var(--primary); }
.appmap-metadata {
  display: flex;
  gap: 1.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  position: relative;
  z-index: 2;
}
.appmap-metadata-item strong { color: var(--text-primary); }
.appmap-controls {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 3;
  display: flex;
  gap: 0.25rem;
}
.appmap-control-btn {
  width: 28px;
  height: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.appmap-control-btn:hover { background: var(--surface-hover); color: var(--text-primary); }
.appmap-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--text-dim);
  font-size: 0.9rem;
}
.appmap-loading-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  height: 300px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}
.appmap-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: appmap-spin 0.8s linear infinite;
}
@keyframes appmap-spin { to { transform: rotate(360deg); } }
.appmap-dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.appmap-dashboard-header .section-title { margin: 0; }
.appmap-dashboard-link { font-size: 0.85rem; color: var(--primary); font-weight: 600; }

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-card {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  margin: 1rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  font-family: inherit;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-dim);
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 1.25rem;
}

/* === Account Page === */
.account-section {
  margin-bottom: 2rem;
}

.account-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 600px;
}

.account-card-danger {
  border-color: rgba(255, 82, 82, 0.3);
}

.account-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.account-muted {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.account-avatar-preview {
  margin-bottom: 1rem;
}

.account-avatar-img {
  object-fit: cover;
  border: 1px solid var(--border);
}

.account-avatar-large {
  width: 64px;
  height: 64px;
  min-width: 64px;
  font-size: 1.25rem;
}

/* === API Key Display === */
.api-key-display {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
}

.api-key-code {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--cta);
  word-break: break-all;
}

.copy-success {
  color: var(--cta);
}

/* === Button Variants === */
.btn-danger {
  background: var(--error);
  color: #fff;
  box-shadow: none;
}

.btn-danger:hover:not(:disabled) {
  background: #E04545;
  box-shadow: 0 0 24px rgba(255, 82, 82, 0.25);
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.8rem;
}

.btn-xs {
  padding: 0.25rem 0.6rem;
  font-size: 0.7rem;
}

/* === Success Text === */
.success-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cta);
  background: rgba(0, 230, 118, 0.1);
  border: 1px solid rgba(0, 230, 118, 0.3);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
}

/* === File Browser === */
.files-scopes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  max-width: 800px;
}

.files-scope-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 2rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 0.2s, transform 0.15s;
}

.files-scope-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.files-scope-label {
  font-size: 0.85rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.files-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
}

.files-breadcrumb a {
  color: var(--text-dim);
  text-decoration: none;
}

.files-breadcrumb a:hover {
  color: var(--primary);
}

.files-breadcrumb-sep {
  color: var(--text-dim);
}

.files-entity-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.files-entity-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 0.2s, transform 0.15s;
}

.files-entity-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.files-entity-icon {
  min-width: 24px;
}

.files-entity-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.files-entity-name {
  font-size: 0.85rem;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.files-entity-id {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.files-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.files-table th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--primary);
  color: var(--text-dim);
  white-space: nowrap;
}

.files-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.files-table tr:hover {
  background: var(--surface-hover);
}

.files-icon-col {
  width: 32px;
}

.files-icon {
  width: 32px;
}

.files-menu-col {
  width: 40px;
}

.files-name-link {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
}

.files-name-link:hover {
  color: var(--primary);
}

.files-size {
  color: var(--text-dim);
  font-size: 0.8rem;
  white-space: nowrap;
}

.files-menu-btn {
  font-family: inherit;
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-dim);
  padding: 0.25rem 0.5rem;
  line-height: 1;
}

.files-menu-btn:hover {
  color: var(--text-primary);
}

.files-context-menu {
  position: fixed;
  z-index: 800;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevation);
  min-width: 140px;
}

.files-ctx-btn {
  font-family: var(--font-display);
  display: block;
  width: 100%;
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}

.files-ctx-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.files-ctx-btn-danger {
  color: var(--error);
}

.files-ctx-btn-danger:hover {
  background: rgba(255, 82, 82, 0.08);
}

.files-actions {
  display: flex;
  gap: 0.5rem;
}

@media (max-width: 768px) {
  .files-scopes {
    grid-template-columns: 1fr;
  }
}

/* === Docs === */
.docs-layout {
  display: flex;
  min-height: 100vh;
}

.docs-sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: margin-left 0.2s;
  height: 100vh;
  position: sticky;
  top: 0;
}

.docs-sidebar.docs-sidebar-hidden {
  margin-left: -260px;
}

.docs-sidebar-header {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.docs-logo {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.docs-logo:hover {
  color: var(--primary);
}

.docs-sidebar-close {
  font-family: inherit;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-dim);
  line-height: 1;
  display: none;
}

.docs-sidebar-title {
  padding: 1rem 1rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
}

.docs-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.25rem 0;
  overflow-y: auto;
}

.docs-nav a {
  display: block;
  padding: 0.45rem 1rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
  border-left: 3px solid transparent;
}

.docs-nav a:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

.docs-nav a.active {
  color: var(--text-primary);
  border-left-color: var(--primary);
}

.docs-sidebar-footer {
  margin-top: auto;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
}

.docs-signin-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  text-decoration: none;
}

.docs-signin-link:hover {
  color: var(--primary);
}

.docs-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  max-width: 900px;
}

.docs-mobile-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  cursor: pointer;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

/* Docs page elements */
.docs-page-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.docs-intro {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 1.5rem;
  max-width: 700px;
}

.docs-intro code {
  background: var(--surface);
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--primary);
}

.docs-section-heading {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

/* Cards */
.docs-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.docs-auth-card {
  border-color: rgba(230, 57, 70, 0.3);
}

.docs-card-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.docs-card-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.docs-card-text code {
  background: var(--bg);
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--primary);
}

.docs-card-text a {
  color: var(--primary);
  font-weight: 600;
}

/* Section cards grid */
.docs-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.docs-section-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 0.2s, transform 0.15s;
}

.docs-section-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.docs-section-card-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
}

.docs-section-card-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.docs-section-card-count {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
}

/* API key input card */
.docs-apikey-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  max-width: 500px;
}

.docs-apikey-card .form-input {
  width: 100%;
  margin-top: 0.25rem;
}

.docs-apikey-card .form-hint a {
  color: var(--primary);
  font-weight: 600;
}

/* Endpoint section */
.docs-endpoint {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  margin-bottom: 1.5rem;
  scroll-margin-top: 1rem;
}

.docs-endpoint-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0 0.75rem;
  flex-wrap: wrap;
}

.docs-method-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border: none;
  border-radius: var(--radius-pill);
  min-width: 55px;
  text-align: center;
}

.docs-method-get {
  color: #448AFF;
  background: rgba(68, 138, 255, 0.12);
}

.docs-method-post {
  color: #00E676;
  background: rgba(0, 230, 118, 0.12);
}

.docs-method-patch {
  color: #FFAB00;
  background: rgba(255, 171, 0, 0.12);
}

.docs-method-delete {
  color: #FF5252;
  background: rgba(255, 82, 82, 0.12);
}

.docs-endpoint-path {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.docs-endpoint-summary {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.docs-endpoint-desc {
  padding: 0.5rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Params table */
.docs-params-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.docs-params-table th {
  text-align: left;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--primary);
  color: var(--text-dim);
  white-space: nowrap;
}

.docs-params-table td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-muted);
}

.docs-params-table code {
  font-size: 0.8rem;
  font-weight: 600;
}

.docs-param-default {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* cURL preview */
.docs-curl-container {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin: 0;
  overflow: hidden;
}

.docs-curl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.docs-curl-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.docs-copy-btn {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  padding: 0.15rem 0.5rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.docs-copy-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.docs-llm-card {
  border-color: var(--border);
  margin-top: 1.5rem;
}

.docs-llm-card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.docs-llm-copy-btn {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  background: var(--cta) !important;
  color: var(--cta-text) !important;
  border: none !important;
  border-radius: var(--radius-md);
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: box-shadow 0.15s, transform 0.15s;
  box-shadow: 0 0 24px var(--cta-glow);
}

.docs-llm-copy-btn:hover {
  box-shadow: 0 0 40px var(--cta-glow-strong) !important;
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .docs-llm-card-body {
    flex-direction: column;
    align-items: stretch;
  }
  .docs-llm-copy-btn {
    text-align: center;
  }
}

.docs-curl-text {
  padding: 0.75rem;
  color: var(--cta);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
  margin: 0;
}

/* Try-it panel */
.docs-tryit-toggle {
  font-family: var(--font-display);
  display: block;
  width: 100%;
  padding: 0.5rem 0;
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--primary);
  cursor: pointer;
  text-align: left;
}

.docs-tryit-toggle:hover {
  background: var(--surface-hover);
}

.docs-tryit-panel {
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.docs-tryit-panel .form-input-sm {
  padding: 0.45rem 0.6rem;
  font-size: 0.85rem;
}

.docs-required {
  color: #dc2626;
}

.docs-execute-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

/* Response display */
.docs-response-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.docs-response-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.docs-response-status {
  font-size: 0.8rem;
  font-weight: 700;
}

.docs-response-body {
  background: var(--bg);
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding: 0.75rem;
  margin-top: 0.25rem;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.5;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

/* In-page TOC */
.docs-toc {
  margin-bottom: 1.5rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.docs-toc-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.docs-toc-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.docs-toc-link:hover {
  color: var(--primary);
}

.docs-toc-link code {
  font-size: 0.8rem;
  font-weight: 600;
}

.docs-toc-summary {
  color: var(--text-dim);
  font-size: 0.75rem;
}

/* Small method badge (TOC + sidebar) */
.docs-method-badge-sm {
  font-size: 0.55rem;
  padding: 0.1rem 0.3rem;
  min-width: 40px;
}

/* Sidebar endpoint links */
.docs-nav-endpoint {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 1rem 0.3rem 1.5rem;
  color: var(--text-dim);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: none;
  border-left: 3px solid transparent;
  white-space: nowrap;
  overflow: hidden;
}

.docs-nav-endpoint:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

/* Doc link (creation pages) */
.docs-link {
  font-size: 0.75rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.docs-link:hover {
  text-decoration: underline;
}

/* Section notes */
.docs-notes {
  margin-bottom: 1.5rem;
}

.docs-notes-heading {
  font-size: 0.95rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  scroll-margin-top: 1rem;
}

.docs-notes-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 0.5rem;
  max-width: 700px;
}

.docs-notes-text code {
  background: var(--surface);
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--primary);
}

.docs-notes-text em {
  color: var(--text-dim);
}

.docs-notes-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}

.docs-notes-list li {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.7;
  padding: 0.15rem 0 0.15rem 1rem;
  border-left: 3px solid var(--primary);
  margin-bottom: 0.25rem;
}

.docs-notes-list li code {
  background: var(--surface);
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--primary);
}

.docs-notes-code {
  margin: 0.5rem 0;
}

.docs-notes-code pre {
  background: var(--bg);
  color: var(--cta);
  font-family: var(--font-mono);
  padding: 0.75rem;
  font-size: 0.8rem;
  line-height: 1.5;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

/* Mobile */
@media (max-width: 768px) {
  .docs-sidebar {
    position: fixed;
    z-index: 100;
    top: 0;
    left: 0;
    bottom: 0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
  }

  .docs-sidebar.docs-sidebar-hidden {
    margin-left: -260px;
  }

  .docs-sidebar-close {
    display: block;
  }

  .docs-mobile-toggle {
    display: block;
  }

  .docs-content {
    max-width: 100%;
  }

  .docs-endpoint-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }
}

/* === Error Page === */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 60vh;
  gap: 1rem;
}

.error-code {
  font-family: var(--font-display);
  font-size: 8rem;
  font-weight: 800;
  line-height: 1;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.error-message {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-muted);
}

.error-detail {
  font-size: 0.85rem;
  color: var(--text-dim);
  max-width: 400px;
}

/* === Code Block === */
.code-block {
  background: var(--bg);
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}

/* === Clarification Banner === */
.clarification-banner {
  background: rgba(255, 171, 0, 0.08);
  border: 1px solid rgba(255, 171, 0, 0.3);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.clarification-banner h3 {
  color: var(--warning);
}
.clarification-banner h3 {
  margin: 0;
  font-size: 0.95rem;
}
.clarification-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.clarification-icon {
  font-size: 1.1rem;
}
.clarification-question {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-dim);
}

/* === Alpine cloak === */
[x-cloak] {
  display: none !important;
}
