/* === 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; /* unused — kept for reference */

  /* 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;
  text-decoration: none;
  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-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--border);
}

.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;
}

/* === Credentials Card === */
.credentials-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
}

.credentials-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.credentials-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
  line-height: 1.4;
}

.credentials-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-bottom: 0.5rem;
}

.credentials-field-display {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

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

.credentials-field-value {
  font-size: 0.85rem;
  color: var(--text-primary);
}

.credentials-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.credentials-form-grid .full-width {
  grid-column: 1 / -1;
}

.credentials-extra-fields {
  margin-top: 0.75rem;
}

.credentials-extra-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.credentials-extra-row .form-input {
  flex: 1;
}

@media (max-width: 600px) {
  .credentials-form-grid {
    grid-template-columns: 1fr;
  }
}

/* === 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);
}

.login-divider {
  display: flex;
  align-items: center;
  margin: 1.25rem 0;
  gap: 0.75rem;
}
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.login-divider span {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-github {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.625rem 1rem;
  background: #24292e;
  color: #fff;
  border: 1px solid #1b1f23;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-github:hover {
  background: #2f363d;
  color: #fff;
}

/* === 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-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.25rem 1rem;
  display: block;
}

.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.avatar-sm {
  width: 28px;
  height: 28px;
  min-width: 28px;
  font-size: 0.7rem;
}

.sidebar-avatar-img.avatar-sm {
  width: 28px;
  height: 28px;
  min-width: 28px;
}

.sidebar-avatar.avatar-md {
  width: 40px;
  height: 40px;
  min-width: 40px;
  font-size: 0.85rem;
}

.sidebar-avatar-img.avatar-md {
  width: 40px;
  height: 40px;
  min-width: 40px;
}

.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;
}

.sidebar-version {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.5;
  text-align: center;
  margin-top: 0.5rem;
  user-select: all;
}


/* === 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;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.agents-filter-bar .form-select {
  font-size: 0.85rem;
  padding: 0.5rem 2rem 0.5rem 0.65rem;
  max-width: 200px;
}
.agents-filter-bar .form-input {
  font-size: 0.85rem;
  padding: 0.5rem 0.65rem;
  max-width: 220px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-primary);
}

/* === 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);
}

.sortable-th {
  cursor: pointer;
}
.sortable-th a {
  text-decoration: none;
  color: inherit;
}
.sortable-th a:hover {
  color: var(--primary);
}
.sort-indicator {
  font-size: 0.65rem;
  color: var(--primary);
  margin-left: 0.15rem;
}

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

/* === Role Badges === */
.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);
}
.badge-green { color: #22C55E; background: rgba(34, 197, 94, 0.12); }
.badge-gray  { color: #9CA3AF; background: rgba(107, 114, 128, 0.12); }

/* === 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-stopped {
  color: #78909C;
  background: rgba(120, 144, 156, 0.12);
}

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

.status-warning {
  color: #FFAB00;
  background: rgba(255, 171, 0, 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-status-fragment { margin-bottom: 1rem; }

/* === 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;
}

.meta-prompt-collapse {
  font-size: 0.9rem;
}

.meta-prompt-collapse summary {
  cursor: pointer;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
}

.meta-prompt-collapse summary:hover {
  color: var(--text-primary);
}

.meta-prompt-collapse[open] summary {
  color: var(--accent);
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
}

/* === Chat Input Bar === */
.chat-input-bar { margin: 1rem 0; }
.chat-input-form { display: flex; gap: 0.5rem; align-items: center; }
.chat-input-form .chat-input { flex: 1; }

/* === Conversation Grid === */
.conv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.35rem;
  margin-bottom: 2rem;
}

/* Full-width parts */
.conv-prompt,
.conv-text,
.conv-screenshot {
  grid-column: 1 / -1;
}

/* Prompt collapse */
.conv-prompt {
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.conv-prompt summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  list-style: none;
}

.conv-prompt summary::-webkit-details-marker {
  display: none;
}

.conv-prompt .msg-text {
  padding: 0 0.75rem 0.75rem;
}

/* All card types share base style */
.conv-call,
.conv-resp,
.conv-text,
.conv-thinking {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  min-width: 0;
}

/* Text card */
.conv-text {
  padding: 0.6rem 0.75rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
}

/* Summaries (call, response, thinking) */
.conv-call summary,
.conv-resp summary,
.conv-thinking summary {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  color: var(--text-dim);
  padding: 0.4rem 0.6rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* Open card: expand full-width, push subsequent cards down */
.conv-call[open],
.conv-resp[open],
.conv-thinking[open] {
  grid-column: 1 / -1;
}

.conv-call[open] summary,
.conv-resp[open] summary,
.conv-thinking[open] summary {
  padding: 0.5rem 0.75rem 0.25rem;
  white-space: normal;
  color: var(--text-primary);
}

/* Expanded content (inline, not positioned) */
.conv-call pre,
.conv-resp pre {
  background: var(--bg);
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding: 0.75rem;
  margin: 0.25rem 0.75rem 0.75rem;
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
  font-size: 0.7rem;
  line-height: 1.4;
  border-radius: var(--radius-sm);
}

.conv-thinking .msg-thinking-text {
  padding: 0.5rem 0.75rem 0.75rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted);
  font-style: italic;
}

/* Screenshot */
.conv-screenshot {
  max-width: 300px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: zoom-in;
}

/* === Agent Result Card === */
.agent-result {
  margin-top: 1rem;
  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-warning {
  background: rgba(255, 171, 0, 0.06);
  border-color: rgba(255, 171, 0, 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-warning .agent-result-title { color: var(--warning); }
.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); }
.agent-result-warning .agent-result-text { color: var(--warning); }

/* === Agent Summary (legacy classes kept for positive/negative lists) === */

/* === Agent Video Recording === */
.agent-video {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.agent-video-player {
  height: 160px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #000;
}

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

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

/* === Tool Icons === */
.tool-icon {
  font-family: var(--font-display);
  font-size: 0.55rem;
  font-weight: 700;
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.04em;
  line-height: 1;
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.3rem;
}

.tool-icon-nav     { background: rgba(68, 138, 255, 0.15);  color: #448AFF; }
.tool-icon-interact{ background: rgba(230, 57, 70, 0.12);   color: var(--primary); }
.tool-icon-observe { background: rgba(0, 212, 255, 0.15);   color: var(--cyan); }
.tool-icon-wait    { background: rgba(255, 171, 0, 0.15);   color: var(--warning); }
.tool-icon-js      { background: rgba(255, 224, 51, 0.15);  color: #D4A800; }
.tool-icon-file    { background: rgba(0, 230, 118, 0.12);   color: var(--cta); }
.tool-icon-net     { background: rgba(124, 58, 237, 0.12);  color: #7c3aed; }
.tool-icon-done    { background: rgba(0, 230, 118, 0.15);   color: var(--cta); }
.tool-icon-meta    { background: rgba(107, 114, 128, 0.12); color: var(--text-dim); }
.tool-icon-thinking{ background: rgba(167, 139, 250, 0.15); color: #a78bfa; }

/* === 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);
}

#vnc-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* === 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; }

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

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

.create-error:empty { display: none; }
.upload-error:empty { display: none; }
.upload-error {
  margin-top: 0.75rem;
}


.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 2rem 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;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23757575' d='M6 8.5L1 3.5h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 12px;
}
.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);
}

/* Getting started checklist */
.dash-getting-started {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 2rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Header with progress */
.dash-gs-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.dash-gs-header-text { flex: 1; }
.dash-gs-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}
.dash-gs-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.dash-gs-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}
.dash-gs-progress {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  min-width: 160px;
}
.dash-gs-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--surface);
  border-radius: var(--radius-pill);
  overflow: hidden;
  border: 1px solid var(--border);
}
.dash-gs-progress-fill {
  height: 100%;
  background: var(--cta-dark);
  border-radius: var(--radius-pill);
  transition: width 0.4s ease;
}
.dash-gs-progress-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* Steps – vertical timeline */
.dash-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.dash-step {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: 4.5rem;
}

/* Rail: indicator + connector line */
.dash-step-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 2.5rem;
  flex-shrink: 0;
}
.dash-step-indicator {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--bg);
  border: 2px solid var(--border);
  color: var(--text-dim);
  position: relative;
  z-index: 1;
  transition: all 0.2s ease;
}
.dash-step-done .dash-step-indicator {
  background: var(--cta-dark);
  border-color: var(--cta-dark);
  color: #fff;
}
.dash-step-connector {
  flex: 1;
  width: 2px;
  background: var(--border);
  min-height: 1rem;
}
.dash-step-done .dash-step-connector {
  background: var(--cta-dark);
}
.dash-step:last-child .dash-step-connector {
  display: none;
}

/* Body: content + action */
.dash-step-body {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  padding: 0.15rem 0 0.15rem 1rem;
  margin-bottom: 0;
  border-radius: var(--radius);
  transition: background 0.15s;
}
.dash-step:not(.dash-step-done) .dash-step-body:hover {
  background: var(--surface);
}
.dash-step-content {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
}
.dash-step-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}
.dash-step-done .dash-step-title {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: var(--text-dim);
}
.dash-step-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.4;
}
.dash-step-body .btn {
  flex-shrink: 0;
}

/* Dismiss button */
.dash-gs-dismiss {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 1.35rem;
  line-height: 1;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.dash-gs-dismiss:hover {
  color: var(--text-primary);
  background: var(--surface);
}

/* Responsive: stack header on small screens */
@media (max-width: 600px) {
  .dash-gs-header { flex-direction: column; gap: 1rem; }
  .dash-gs-progress { align-items: flex-start; min-width: unset; width: 100%; }
}

/* 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); }

/* === Project Health Dashboard === */

/* Project selector bar */
.dash-project-bar {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.dash-project-bar .form-select {
  max-width: 280px;
  font-weight: 600;
}

/* Health strip */
.dash-health-strip {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
}
.health-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 110px;
}
.health-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.health-healthy .health-dot { background: var(--cta); box-shadow: 0 0 6px var(--cta); }
.health-healthy { color: var(--cta-dark); }
.health-degraded .health-dot { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.health-degraded { color: #E6A700; }
.health-failing .health-dot { background: var(--error); box-shadow: 0 0 6px var(--error); }
.health-failing { color: var(--error); }
.health-low_coverage .health-dot { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.health-low_coverage { color: #E6A700; }
.health-unknown .health-dot { background: var(--text-dim); }
.health-unknown { color: var(--text-dim); }

.health-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}
.health-stat-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
}
.health-stat-value.risk-count {
  color: var(--warning);
}
.health-stat-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Sparkline */
.sparkline {
  width: 80px;
  height: 24px;
  margin-top: 0.15rem;
}

/* Two-panel layout */
.dash-panels {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 768px) {
  .dash-panels { grid-template-columns: 1fr; }
  .dash-health-strip { flex-wrap: wrap; gap: 1rem; }
}
.dash-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}
.dash-panel .section-title { margin-bottom: 1rem; }

/* Runs table */
.dash-runs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.dash-runs-table th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
.dash-runs-table td {
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.dash-runs-table tbody tr:last-child td { border-bottom: none; }
.dash-run-time { color: var(--text-dim); white-space: nowrap; font-size: 0.75rem; }
.dash-run-link { color: var(--text-primary); text-decoration: none; font-weight: 600; }
.dash-run-link:hover { color: var(--primary); }
.dash-run-steps { color: var(--text-dim); text-align: right; }

/* Coverage pages list */
.dash-pages-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.dash-page-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.5rem;
  border-left: 3px solid var(--border);
}
.dash-page-passed  { border-left-color: var(--cta); }
.dash-page-failed  { border-left-color: var(--error); }
.dash-page-warning { border-left-color: var(--warning); }
.dash-page-never   { border-left-color: var(--text-dim); }

.dash-page-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-passed  { background: var(--cta); }
.dot-failed  { background: var(--error); }
.dot-warning { background: var(--warning); }
.dot-never   { background: var(--text-dim); }

.dash-page-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.dash-page-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-page-url {
  font-size: 0.7rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-page-status {
  font-size: 0.7rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* Risks */
.dash-risks { margin-bottom: 1.5rem; }
.dash-risks .section-title { margin-bottom: 0.75rem; }
.dash-risks-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.dash-risk-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.risk-failure { border-left: 3px solid var(--error); }
.risk-qa_issue { border-left: 3px solid var(--warning); }
.risk-coverage_gap { border-left: 3px solid var(--text-dim); }
.risk-flaky { border-left: 3px solid var(--info); }
.risk-stale { border-left: 3px solid var(--warning); }

.dash-risk-icon {
  font-size: 1rem;
  flex-shrink: 0;
  line-height: 1.2;
}
.dash-risk-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.dash-risk-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}
.dash-risk-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-risk-link {
  font-size: 0.75rem;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
  align-self: center;
}
.dash-risk-link:hover { text-decoration: underline; }

/* --- Dashboard: page meta (run counts, sparkline, flaky badge) --- */
.dash-page-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
}
.dash-page-runs {
  font-variant-numeric: tabular-nums;
}
.dash-page-flaky-badge {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  background: var(--info);
  color: #fff;
}
.mini-sparkline {
  display: inline-flex;
  align-items: flex-end;
  gap: 1px;
  height: 12px;
}
.mini-spark-pass,
.mini-spark-fail {
  display: inline-block;
  width: 3px;
  height: 10px;
  border-radius: 1px;
}
.mini-spark-pass { background: var(--cta); }
.mini-spark-fail { background: var(--error); }

/* --- Dashboard: page action (Test button) --- */
.dash-page-action {
  flex-shrink: 0;
  margin: 0;
}

/* --- Dashboard: page groups (subpage folding) --- */
.dash-page-group { border-left: 3px solid var(--border); }
.dash-page-group.dash-page-passed  { border-left-color: var(--cta); }
.dash-page-group.dash-page-failed  { border-left-color: var(--error); }
.dash-page-group.dash-page-warning { border-left-color: var(--warning); }
.dash-page-group.dash-page-never   { border-left-color: var(--text-dim); }
.dash-page-group-summary { display:flex; align-items:center; gap:0.75rem; padding:0.5rem; cursor:pointer; list-style:none; }
.dash-page-group-summary::-webkit-details-marker { display:none; }
.dash-page-group-summary .dash-page-status { margin-left:auto; }
.dash-page-group-summary .dash-page-action { margin-left:0; }
.dash-page-group-count { font-size:0.7rem; color:var(--text-dim); white-space:nowrap; }
.dash-page-group-children { padding-left:1.25rem; }
.dash-page-group-children .dash-page-item { border-left-width:2px; padding-left:0.25rem; }

/* --- Dashboard: agent link on coverage pages --- */
.dash-page-agent-link { color:inherit; text-decoration:none; }
.dash-page-agent-link:hover { text-decoration:underline; color:var(--primary); }

/* --- Dashboard: Journeys section --- */
.dash-journeys { margin-bottom: 1.5rem; }
.dash-journeys-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.dash-journeys-header .section-title { margin-bottom: 0; }
.section-count {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-dim);
  margin-left: 0.25rem;
}
.section-link {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
}
.section-link:hover { color: var(--primary); text-decoration: underline; }
.dash-journeys-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.dash-journey-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.dash-journey-row:last-child { border-bottom: none; }
.dash-journey-overflow[style*="display: none"] { display: none; }
.dash-journey-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-left: auto;
}
.dash-journey-name {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.dash-journey-name:hover {
  text-decoration: underline;
  color: var(--primary);
}
.dash-journey-importance {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
  line-height: 1.3;
}
.importance-critical { background: rgba(230, 57, 70, 0.12); color: var(--primary); }
.importance-high     { background: rgba(255, 159, 67, 0.12); color: var(--secondary); }
.importance-medium   { background: rgba(68, 138, 255, 0.12); color: var(--info); }
.importance-low      { background: rgba(158, 158, 158, 0.12); color: var(--text-dim); }
.dash-journeys-toggle {
  display: block;
  width: 100%;
  padding: 0.4rem;
  margin-top: 0.25rem;
  background: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.72rem;
  cursor: pointer;
  text-align: center;
}
.dash-journeys-toggle:hover {
  color: var(--primary);
  border-color: var(--primary);
}
.btn-xs {
  font-size: 0.65rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
}

/* === 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; }
.btn-dismiss {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.1rem 0.35rem;
  transition: color 0.15s, border-color 0.15s;
}
.btn-dismiss:hover {
  color: var(--error);
  border-color: var(--error);
}

.btn-inline-edit {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.1rem 0.25rem;
  transition: color 0.15s;
}
.btn-inline-edit:hover {
  color: var(--primary);
}

/* === 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-live-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
  background: var(--cta-dark);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  margin-left: 0.5rem;
  vertical-align: middle;
  animation: appmap-pulse 2s ease-in-out infinite;
}
@keyframes appmap-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.appmap-progress-bar {
  position: relative;
  height: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  margin-bottom: 1rem;
  overflow: hidden;
}
.appmap-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cta-dark), var(--cta));
  border-radius: var(--radius-pill);
  transition: width 0.5s ease;
}
.appmap-progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  pointer-events: none;
}
.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;
}

.modal-body .form-group + .form-group {
  margin-top: 0.75rem;
}

.modal-card-wide {
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
}

.agent-report-btn {
  margin-top: 0.5rem;
  align-self: flex-start;
}

/* Markdown report styles */
.report-content {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.report-content h1,
.report-content h2,
.report-content h3,
.report-content h4 {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  font-family: var(--font-display);
}

.report-content h1 { font-size: 1.4rem; }
.report-content h2 { font-size: 1.2rem; }
.report-content h3 { font-size: 1.05rem; }

.report-content p {
  margin-bottom: 0.75rem;
}

.report-content ul,
.report-content ol {
  margin-bottom: 0.75rem;
  padding-left: 1.5rem;
}

.report-content li {
  margin-bottom: 0.25rem;
}

.report-content pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  overflow-x: auto;
  margin-bottom: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.report-content code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--surface);
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius-sm);
}

.report-content pre code {
  background: none;
  padding: 0;
}

.report-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}

.report-content th,
.report-content td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.report-content th {
  background: var(--surface);
  font-weight: 600;
}

.report-content blockquote {
  border-left: 3px solid var(--primary);
  padding: 0.5rem 1rem;
  margin-bottom: 0.75rem;
  background: var(--surface);
  color: var(--text-muted);
}

/* === 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);
}

/* === Integrations Page === */
.page-subtitle {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 1.5rem;
}

.integrations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
}

.integration-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}

.integration-card-disabled {
  opacity: 0.6;
}

.integration-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.integration-icon {
  flex-shrink: 0;
  color: var(--text);
}

.integration-name {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.integration-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin: 0.25rem 0 0;
}

.integration-card-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.integration-account {
  font-size: 0.8rem;
  color: var(--text);
  font-weight: 500;
}

.integration-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin: 0.25rem 0 0;
}

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

/* === Pricing Page === */
.pricing-subtitle {
  text-align: center;
  margin-bottom: 1.5rem;
}

.pricing-toggle {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.pricing-toggle-group {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 3px;
}

.pricing-toggle-btn {
  padding: 0.4rem 1.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.pricing-toggle-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 4px rgba(230, 57, 70, 0.3);
}

.pricing-container {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
}

.pricing-card {
  flex: 1;
  min-width: 260px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.pricing-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-elevation);
  border-color: var(--primary-light);
}

.pricing-card-featured {
  border: 2px solid var(--primary);
  box-shadow: 0 0 24px rgba(230, 57, 70, 0.12);
  transform: scale(1.03);
}

.pricing-card-featured:hover {
  transform: scale(1.03) translateY(-4px);
  box-shadow: 0 0 30px rgba(230, 57, 70, 0.18), var(--shadow-elevation);
}

.pricing-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.85rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.pricing-plan-name {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.pricing-price {
  font-size: 2.25rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  line-height: 1.2;
}

.pricing-price-interval {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
}

.pricing-description {
  text-align: center;
  margin: 0.75rem 0 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pricing-divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin-bottom: 1.25rem;
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  width: 100%;
  font-size: 0.85rem;
}

.pricing-feature {
  padding: 0.3rem 0;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.pricing-feature-check {
  color: var(--cta);
  flex-shrink: 0;
}

.pricing-cta {
  margin-top: auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.pricing-cta .btn {
  width: 100%;
  text-align: center;
}

@media (max-width: 768px) {
  .pricing-container {
    flex-direction: column;
    align-items: center;
  }
  .pricing-card {
    max-width: 100%;
    width: 100%;
  }
  .pricing-card-featured {
    transform: none;
  }
  .pricing-card-featured:hover {
    transform: translateY(-4px);
  }
}

/* === 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;
}

.btn-link {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.7rem;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
}
.btn-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: border-color 0.2s, color 0.2s;
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.btn-journey {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.btn-journey:hover {
  background: var(--primary);
  color: var(--bg);
}

/* === 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;
}

/* File Picker (modal) — reuses .files-table styles */
.fp {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  height: 500px;
  overflow: hidden;
}
.fp-breadcrumb {
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.fp-breadcrumb button {
  appearance: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  font-size: 0.75rem;
  font-family: inherit;
  line-height: inherit;
  text-decoration: none;
}
.fp-breadcrumb button:hover {
  color: var(--primary);
  text-decoration: underline;
}
.fp-breadcrumb > span {
  color: var(--text-primary);
  font-weight: 600;
}
.fp-breadcrumb-sep {
  color: var(--text-dim);
}
.fp-table-wrap {
  flex: 1;
  overflow-y: auto;
}
.fp-table td:first-child {
  width: 20px;
  padding-left: 0.5rem;
  padding-right: 0.75rem;
}
.fp-table .files-icon {
  width: 24px;
  padding-left: 0;
  padding-right: 0.25rem;
}
.fp-row--selected {
  background: rgba(230, 57, 70, 0.06);
}
.fp-row--selected:hover {
  background: rgba(230, 57, 70, 0.10);
}
.fp-row-back td {
  color: var(--text-muted);
}
.fp-check {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1.5px solid var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.fp-row--selected .fp-check {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.fp-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}
.fp-upload {
  border-top: 1px solid var(--border);
  padding: 0.75rem;
  flex-shrink: 0;
}
.fp-upload-zone {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.5rem 1rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.fp-upload-text strong {
  color: var(--primary);
}
.fp-upload-zone:hover,
.fp-upload-zone--drag {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(230, 57, 70, 0.04);
}

@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;
  overflow: hidden;
}

.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-method-tool {
  color: #B388FF;
  background: rgba(179, 136, 255, 0.12);
}

.docs-method-resource {
  color: #64FFDA;
  background: rgba(100, 255, 218, 0.12);
}

.docs-method-prompt {
  color: #FF80AB;
  background: rgba(255, 128, 171, 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;
  text-overflow: ellipsis;
}

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

.docs-nav-divider {
  height: 1px;
  background: var(--border);
  margin: 0.75rem 0;
}

.docs-mcp-group-heading {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin: 1.5rem 0 0.5rem;
  padding: 0;
}

/* 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-subheading {
  font-size: 0.88rem;
  font-weight: 700;
  margin-top: 1rem;
  margin-bottom: 0.35rem;
}

.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;
}

/* === Workspace Banner === */
.workspace-banner {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.workspace-banner a {
  color: var(--cta);
  text-decoration: underline;
}

/* === 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);
}

/* === Issue loading bar === */
.issue-loading-bar {
  position: relative;
  height: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.issue-loading-bar-fill {
  position: absolute;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, var(--cta-dark), var(--cta));
  border-radius: var(--radius-pill);
  animation: issue-loading-slide 1.2s ease-in-out infinite;
}
@keyframes issue-loading-slide {
  0%   { left: -40%; }
  100% { left: 100%; }
}

/* === Regression Runs (Support) === */
.reg-summary {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.reg-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 80px;
}
.reg-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--text-primary);
}
.reg-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.reg-passed { color: var(--cta-dark); }
.reg-failed { color: var(--error); }

.reg-runs-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.reg-run {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.reg-run-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 1rem;
  cursor: pointer;
  background: var(--surface);
  transition: background 0.15s;
}
.reg-run-header:hover {
  background: var(--surface-hover);
}
.reg-run-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}
.reg-run-time {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
}
.reg-run-repo {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reg-run-version {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--cta-dark);
  background: rgba(0, 200, 83, 0.1);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.reg-run-id {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.reg-run-stats {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}
.reg-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.reg-total {
  background: var(--surface-hover);
  color: var(--text-muted);
}
.reg-pass {
  background: rgba(0, 200, 83, 0.12);
  color: var(--cta-dark);
}
.reg-fail {
  background: rgba(255, 82, 82, 0.12);
  color: var(--error);
}
.reg-running {
  background: rgba(68, 138, 255, 0.12);
  color: var(--info);
}
.reg-run-chevron {
  font-size: 0.85rem;
  color: var(--text-dim);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.reg-run-chevron.reg-open {
  transform: rotate(90deg);
}

.reg-run-agents {
  border-top: 1px solid var(--border);
  padding: 0.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.reg-agent {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}
.reg-agent:hover {
  background: var(--surface);
}
.reg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-passed  { background: var(--cta-dark); }
.dot-failed  { background: var(--error); }
.dot-error   { background: var(--warning); }
.dot-running { background: var(--info); }
.reg-agent-name {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reg-agent-name:hover {
  color: var(--primary);
  text-decoration: underline;
}
.reg-agent-status {
  font-size: 0.75rem;
  color: var(--text-dim);
  flex-shrink: 0;
}

.reg-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
  padding: 1rem 0;
}
.reg-page-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: background 0.15s, border-color 0.15s;
}
.reg-page-btn:hover {
  background: var(--surface-hover);
  border-color: var(--text-dim);
}
.reg-page-info {
  font-size: 0.8125rem;
  color: var(--text-dim);
}

/* === Journey Health Board === */
.health-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.health-page-header h1 { font-size: 1.5rem; font-weight: 700; }
.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.health-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  transition: all 0.15s;
  font-family: var(--font-display);
  text-decoration: none;
}
.health-btn:hover { border-color: var(--text-primary); }
.health-btn-primary {
  background: var(--text-primary);
  color: white;
  border-color: var(--text-primary);
}
.health-btn-primary:hover { opacity: 0.9; color: white; }

/* Hero health strip */
.health-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}
.health-hero.hero-degraded {
  border-color: rgba(245, 158, 11, 0.2);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, var(--surface) 40%);
}
.health-hero.hero-broken {
  border-color: rgba(230, 57, 70, 0.2);
  background: linear-gradient(135deg, rgba(230, 57, 70, 0.06) 0%, var(--surface) 40%);
}
.health-hero-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 1;
  min-width: 0;
}
.health-icon { width: 48px; height: 48px; flex-shrink: 0; }
.health-headline h2 { font-size: 1.25rem; font-weight: 700; }
.health-headline p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}
.health-stats {
  display: flex;
  gap: 1.25rem;
  margin-left: auto;
}
.health-stat { text-align: center; }
.health-stat-value {
  font-size: 1.25rem;
  font-weight: 800;
  font-family: var(--font-mono);
}
.health-stat-label {
  font-size: 0.6875rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.125rem;
}
.health-stat-value.green { color: var(--cta-dark); }
.health-stat-value.amber { color: var(--warning); }
.health-stat-value.red { color: var(--primary); }

/* Alert banners */
.alert-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
}
.alert-banner.alert-amber {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #92400e;
}
.alert-banner.alert-red {
  background: rgba(230, 57, 70, 0.06);
  border: 1px solid rgba(230, 57, 70, 0.2);
  color: #991b1b;
}
.alert-banner svg { flex-shrink: 0; }
.alert-banner .alert-action {
  margin-left: auto;
  font-weight: 600;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
  flex-shrink: 0;
}

/* Section headers */
.section-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.875rem;
  margin-top: 0.5rem;
}
.section-header h3 {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.section-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
}
.section-badge.critical { background: rgba(230, 57, 70, 0.06); color: var(--primary); border: 1px solid rgba(230, 57, 70, 0.2); }
.section-badge.important { background: rgba(245, 158, 11, 0.08); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.section-badge.other { background: rgba(68, 138, 255, 0.08); color: var(--info); border: 1px solid rgba(68, 138, 255, 0.2); }
.section-line { flex: 1; height: 1px; background: var(--border); }

/* Journey cards */
.journey-grid { display: grid; gap: 0.75rem; margin-bottom: 1.75rem; }
.journey-grid.critical-grid { grid-template-columns: 1fr; }
.journey-grid.other-grid { grid-template-columns: 1fr 1fr; }

.journey-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
  display: block;
}
.journey-card:hover {
  border-color: var(--text-dim);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.journey-card.critical-card { border-left: 3px solid var(--cta-dark); }
.journey-card.critical-card.card-failing {
  border-left-color: var(--primary);
  background: linear-gradient(90deg, rgba(230, 57, 70, 0.06) 0%, var(--surface) 8%);
}
.journey-card.critical-card.card-flaky { border-left-color: var(--warning); }

.journey-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.journey-card-title { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.journey-card-title h4 { font-size: 0.9375rem; font-weight: 600; }
.journey-card-actions { display: flex; align-items: center; gap: 0.5rem; }

.journey-status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.625rem;
  border-radius: 999px;
}
.journey-status.passing { background: rgba(0, 200, 83, 0.08); color: var(--cta-dark); }
.journey-status.failing { background: rgba(230, 57, 70, 0.06); color: var(--primary); }
.journey-status.flaky { background: rgba(245, 158, 11, 0.08); color: var(--warning); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.passing .status-dot { background: var(--cta-dark); }
.failing .status-dot { background: var(--primary); }
.flaky .status-dot { background: var(--warning); }

.journey-card-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}
.journey-card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* Heatmap */
.heatmap { display: flex; gap: 3px; align-items: center; }
.heatmap-cell {
  width: 18px; height: 18px; border-radius: 3px;
  transition: transform 0.1s;
}
.heatmap-cell.pass { background: var(--cta-dark); opacity: 0.8; }
.heatmap-cell.fail { background: var(--primary); opacity: 0.8; }
.heatmap-cell.skip { background: var(--border); }
.heatmap-cell:hover { opacity: 1; transform: scale(1.15); }
.heatmap-cell.latest { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px currentColor; }
.heatmap-cell.latest.pass { color: var(--cta-dark); }
.heatmap-cell.latest.fail { color: var(--primary); }
a.heatmap-cell { display: block; text-decoration: none; }
.heatmap-label {
  font-size: 0.6875rem; color: var(--text-dim);
  margin-left: 0.5rem; font-family: var(--font-mono);
}

/* Badges */
.checkpoint-badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.6875rem; font-weight: 600;
  padding: 0.2rem 0.5rem; border-radius: var(--radius-sm);
  background: rgba(139, 92, 246, 0.08); color: #8b5cf6; border: 1px solid rgba(139, 92, 246, 0.2);
}
.checkpoint-badge.cp-warning { background: rgba(245, 158, 11, 0.08); color: var(--warning); border-color: rgba(245, 158, 11, 0.2); }
.checkpoint-badge.cp-fail { background: rgba(230, 57, 70, 0.06); color: var(--primary); border-color: rgba(230, 57, 70, 0.2); }
.regression-tag {
  font-size: 0.625rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; padding: 0.125rem 0.375rem; border-radius: 3px;
  background: var(--primary); color: white;
}
.version-pill {
  font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 600;
  padding: 0.15rem 0.5rem; border-radius: 999px;
  background: rgba(68, 138, 255, 0.08); color: var(--info); border: 1px solid rgba(68, 138, 255, 0.2);
}

/* Failure reason */
.failure-reason {
  font-size: 0.75rem; color: var(--primary);
  background: rgba(230, 57, 70, 0.06); padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm); border: 1px solid rgba(230, 57, 70, 0.2);
  margin-top: 0.625rem;
  display: flex; align-items: flex-start; gap: 0.5rem; line-height: 1.4;
  flex-wrap: wrap;
}
.failure-reason > div { flex: 1; min-width: 0; }
.failure-reason strong { font-weight: 700; }

/* Interactive card elements */
.journey-card-name-link {
  text-decoration: none; color: inherit;
}
.journey-card-name-link:hover h4 { text-decoration: underline; }

.card-action-btns {
  display: flex; align-items: center; gap: 0.375rem;
}

.health-btn-sm {
  font-size: 0.6875rem; font-weight: 600; font-family: inherit;
  padding: 0.2rem 0.5rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-dim); cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.25rem;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  text-decoration: none; line-height: 1.4;
}
.health-btn-sm:hover { border-color: var(--text-dim); color: var(--text); }
.health-btn-sm:disabled { opacity: 0.5; cursor: not-allowed; }
.health-btn-sm-icon { padding: 0.3rem; line-height: 0; }

.health-btn-run {
  border-color: rgba(0, 200, 83, 0.3); color: var(--cta-dark);
}
.health-btn-run:hover { border-color: var(--cta-dark); background: rgba(0, 200, 83, 0.06); }

.health-btn-queued {
  border-color: rgba(37, 99, 235, 0.3); color: #2563eb;
}
.health-btn-queued:hover { border-color: #2563eb; background: rgba(37, 99, 235, 0.06); }

.failure-investigate-link {
  font-size: 0.6875rem; font-weight: 600; color: var(--primary);
  text-decoration: none; white-space: nowrap; margin-left: auto;
}
.failure-investigate-link:hover { text-decoration: underline; }

.run-all-result {
  font-size: 0.8125rem; font-weight: 600; color: var(--cta-dark);
  display: inline-flex; align-items: center;
}
.run-all-result a { color: var(--cta-dark); font-weight: 500; }

.stale-warning {
  font-size: 0.75rem; color: var(--warning);
  display: flex; align-items: center; gap: 0.3rem;
}

/* Trend chart */
.trend-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem 1.5rem; margin-bottom: 1.5rem;
}
.trend-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.trend-header h3 { font-size: 0.875rem; font-weight: 600; }
.trend-period { display: flex; gap: 0.25rem; }
.trend-period button {
  font-size: 0.6875rem; padding: 0.2rem 0.625rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  font-weight: 500; color: var(--text-muted); font-family: var(--font-display);
}
.trend-period button.active { background: var(--text-primary); color: white; border-color: var(--text-primary); }
.trend-chart { height: 80px; display: flex; align-items: flex-end; gap: 4px; padding: 0 0.25rem; }
.trend-bar {
  flex: 1; border-radius: 3px 3px 0 0; position: relative;
  min-height: 4px; transition: opacity 0.15s;
}
.trend-bar:hover { opacity: 0.8; }
.trend-bar .trend-tooltip {
  display: none; position: absolute; bottom: calc(100% + 6px);
  left: 50%; transform: translateX(-50%); background: var(--text-primary);
  color: white; font-size: 0.625rem; padding: 0.25rem 0.5rem;
  border-radius: 4px; white-space: nowrap; font-family: var(--font-mono); z-index: 10;
}
.trend-bar:hover .trend-tooltip { display: block; }
.trend-labels {
  display: flex; justify-content: space-between; margin-top: 0.5rem;
  font-size: 0.625rem; color: var(--text-dim); font-family: var(--font-mono);
}

/* Add journey CTA */
.add-journey-cta {
  border: 2px dashed var(--border); border-radius: var(--radius-lg);
  padding: 1.5rem; text-align: center; color: var(--text-dim);
  cursor: pointer; transition: all 0.15s;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.add-journey-cta:hover { border-color: var(--info); color: var(--info); background: rgba(68, 138, 255, 0.08); }
.add-journey-cta .cta-icon { font-size: 1.5rem; margin-bottom: 0.25rem; }
.add-journey-cta p { font-size: 0.8125rem; font-weight: 500; }

@media (max-width: 768px) {
  .health-hero { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .health-stats { margin-left: 0; }
  .journey-grid.other-grid { grid-template-columns: 1fr; }
  .health-page-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
}

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