:root {
  --bg-primary: #0f0f13;
  --bg-surface: #1a1a24;
  --bg-surface-hover: #22222f;
  --bg-surface-raised: #252533;
  --border-subtle: #2e2e3f;
  --border-focus: #7c3aed;
  --accent-purple: #7c3aed;
  --accent-purple-light: #a78bfa;
  --accent-purple-glow: rgba(124,58,237,0.15);
  --accent-green: #22c55e;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --accent-blue: #3b82f6;
  --text-primary: #f1f0ff;
  --text-secondary: #9896b0;
  --text-tertiary: #5c5a7a;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-card: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow-purple: 0 0 24px rgba(124,58,237,0.2);
  --sidebar-width: 260px;
}

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

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--accent-purple-light); text-decoration: none; }
a:hover { text-decoration: underline; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--accent-purple); color: #fff; }
.btn-primary:hover:not(:disabled) {
  background: var(--accent-purple-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow-purple);
}
.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--accent-purple);
  background: var(--accent-purple-glow);
}
.btn-danger {
  background: transparent;
  color: var(--accent-red);
  border: 1px solid var(--accent-red);
}
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,0.1); }
.btn-success {
  background: transparent;
  color: var(--accent-green);
  border: 1px solid var(--accent-green);
}
.btn-success:hover:not(:disabled) { background: rgba(34,197,94,0.1); }
.btn-warn {
  background: transparent;
  color: var(--accent-amber);
  border: 1px solid var(--accent-amber);
}
.btn-warn:hover:not(:disabled) { background: rgba(245,158,11,0.1); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.card:hover {
  border-color: var(--accent-purple);
  box-shadow: var(--shadow-glow-purple);
}
.card-flat {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.card-raised {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
}
.badge-shadow, .badge-active_shadow {
  background: rgba(245,158,11,0.12);
  color: var(--accent-amber);
  border: 1px solid rgba(245,158,11,0.3);
}
.badge-live, .badge-active_live, .badge-active, .badge-success {
  background: rgba(34,197,94,0.12);
  color: var(--accent-green);
  border: 1px solid rgba(34,197,94,0.3);
}
.badge-provisioning {
  background: rgba(148,163,184,0.08);
  color: #94a3b8;
  border: 1px solid rgba(148,163,184,0.2);
}
.badge-suspended, .badge-danger, .badge-fired, .badge-disabled {
  background: rgba(239,68,68,0.08);
  color: var(--accent-red);
  border: 1px solid rgba(239,68,68,0.25);
}
.badge-trial, .badge-included {
  background: rgba(124,58,237,0.12);
  color: var(--accent-purple-light);
  border: 1px solid rgba(124,58,237,0.3);
}
.badge-info {
  background: rgba(59,130,246,0.12);
  color: var(--accent-blue);
  border: 1px solid rgba(59,130,246,0.3);
}
.badge-warning, .badge-past_due {
  background: rgba(245,158,11,0.12);
  color: var(--accent-amber);
  border: 1px solid rgba(245,158,11,0.3);
}
.badge-critical {
  background: rgba(239,68,68,0.12);
  color: var(--accent-red);
  border: 1px solid rgba(239,68,68,0.3);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
  background: rgba(124,58,237,0.1);
  color: var(--accent-purple-light);
  border: 1px solid rgba(124,58,237,0.2);
}
.tag-grey {
  background: rgba(148,163,184,0.08);
  color: #94a3b8;
  border: 1px solid rgba(148,163,184,0.15);
}
.tag-green {
  background: rgba(34,197,94,0.1);
  color: var(--accent-green);
  border: 1px solid rgba(34,197,94,0.2);
}
.tag-red {
  background: rgba(239,68,68,0.1);
  color: var(--accent-red);
  border: 1px solid rgba(239,68,68,0.2);
}

.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-input {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 14px;
  width: 100%;
  transition: border-color 0.15s;
}
.form-input:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px var(--accent-purple-glow);
}
.form-input.error { border-color: var(--accent-red); }
.form-hint { font-size: 12px; color: var(--text-tertiary); }

.toggle-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.toggle-wrapper:last-child { border-bottom: none; }
.toggle-info .toggle-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.toggle-info .toggle-desc { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.toggle { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  background: var(--border-subtle);
  cursor: pointer;
  transition: 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--accent-purple); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

.stat-block { display: flex; flex-direction: column; gap: 4px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.alert-banner {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  font-size: 14px;
}
.alert-banner-warning {
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.3);
  color: var(--accent-amber);
}
.alert-banner-critical {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--accent-red);
}
.alert-banner-info {
  background: rgba(124,58,237,0.1);
  border: 1px solid rgba(124,58,237,0.25);
  color: var(--accent-purple-light);
}

.flash {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: 20px;
}
.flash-success {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.3);
  color: var(--accent-green);
}
.flash-error, .flash-danger {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--accent-red);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 520px;
  width: 100%;
  transform: translateY(8px);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-title { font-size: 20px; font-weight: 700; margin-bottom: 12px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { margin-bottom: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; }

.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 28px;
}
.tab-btn {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent-purple);
  font-weight: 600;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-subtle);
}
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(46,46,63,0.5);
  color: var(--text-secondary);
  vertical-align: middle;
}
.data-table tr:hover td { background: var(--bg-surface-hover); }
.data-table tr.clickable { cursor: pointer; }
.data-table tr:last-child td { border-bottom: none; }

.agent-avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.agent-avatar-lg { width: 64px; height: 64px; border-radius: 18px; font-size: 28px; }
.avatar-marko { background: linear-gradient(135deg, #7c3aed, #4f46e5); }
.avatar-claudia { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.avatar-dot { background: linear-gradient(135deg, #22c55e, #16a34a); }
.avatar-unknown { background: linear-gradient(135deg, #374151, #1f2937); }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 3px; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  animation: pulse 2s infinite;
  display: inline-block;
  margin-right: 6px;
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  padding: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.sidebar-brand .brand-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent-purple-light);
  letter-spacing: -0.02em;
}
.sidebar-brand .brand-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  padding: 20px 20px 8px;
}
.nav-section-label:first-child { padding-top: 4px; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  margin: 2px 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}
.sidebar-nav a:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  text-decoration: none;
}
.sidebar-nav a.active {
  background: var(--accent-purple-glow);
  color: var(--accent-purple-light);
  font-weight: 600;
}
.sidebar-nav a .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
  flex-shrink: 0;
}
.sidebar-nav a .nav-badge {
  margin-left: auto;
  background: var(--accent-red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-purple);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.sidebar-user-info {
  flex: 1;
  min-width: 0;
}
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-email {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-footer-actions a,
.sidebar-footer-actions button {
  font-size: 13px;
  color: var(--text-tertiary);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.sidebar-footer-actions a:hover,
.sidebar-footer-actions button:hover {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
  text-decoration: none;
}

.main-content {
  margin-left: var(--sidebar-width);
  padding: 40px 48px;
  flex: 1;
  min-height: 100vh;
}

.page-header {
  margin-bottom: 32px;
}
.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

.section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}
.section h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}
.section h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  margin-top: 16px;
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.agent-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.agent-card:hover {
  border-color: var(--accent-purple);
  box-shadow: var(--shadow-glow-purple);
}
.agent-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.agent-card-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.agent-card .agent-role {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.agent-card .agent-meta {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 12px;
}
.agent-card .agent-meta span { display: block; margin-bottom: 4px; }
.agent-card .detail-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--accent-purple-light);
  font-weight: 600;
}
.agent-card .detail-link:hover { text-decoration: underline; }

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}
.catalog-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.catalog-card:hover {
  border-color: var(--accent-purple);
  box-shadow: var(--shadow-glow-purple);
}
.catalog-card h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.catalog-card .price {
  font-size: 14px;
  color: var(--accent-purple-light);
  font-weight: 600;
  margin-bottom: 8px;
}
.catalog-card .desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}
.catalog-card .role-tag { margin-bottom: 12px; }
.catalog-card.coming-soon { opacity: 0.5; }

.tos-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary);
}
.tos-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-purple);
}
.tos-row label { margin: 0; font-size: 13px; font-weight: 400; color: var(--text-secondary); }

.hire-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 20px;
  background: var(--accent-purple);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.hire-btn:hover:not(:disabled) {
  background: var(--accent-purple-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow-purple);
}
.hire-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}
.empty-state a { color: var(--accent-purple-light); font-weight: 600; }

.controls { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.controls form { display: inline; }

.confirm-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--text-primary);
}
.confirm-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-purple);
}
.confirm-row label { margin: 0; font-weight: 400; }

.token-bar {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  height: 22px;
  overflow: hidden;
  margin-top: 8px;
  max-width: 400px;
}
.token-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-purple-light));
  transition: width 0.3s;
  border-radius: 8px;
}
.token-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.version-list { font-size: 13px; color: var(--text-secondary); list-style: none; }
.version-list li {
  padding: 6px 0;
  border-bottom: 1px solid rgba(46,46,63,0.3);
  display: flex;
  align-items: center;
  gap: 8px;
}
.version-list li:last-child { border-bottom: none; }

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-connected { background: var(--accent-green); }
.dot-disconnected { background: var(--accent-red); }
.dot-degraded { background: var(--accent-amber); }
.dot-configured { background: var(--accent-green); }
.dot-not_configured { background: var(--text-tertiary); }

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text-primary);
}

.meta { font-size: 13px; color: var(--text-secondary); margin-top: 8px; }

.alert-filters {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
}
.alert-filters a {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  transition: all 0.15s;
}
.alert-filters a:hover {
  color: var(--text-primary);
  border-color: var(--accent-purple);
  text-decoration: none;
}
.alert-filters a.active {
  background: var(--accent-purple-glow);
  color: var(--accent-purple-light);
  border-color: var(--accent-purple);
}

.stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}
.stats-row .stat-card {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.included-tag, .included-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(124,58,237,0.12);
  color: var(--accent-purple-light);
  border: 1px solid rgba(124,58,237,0.3);
  margin-left: 8px;
}
.coming-soon-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(148,163,184,0.08);
  color: #94a3b8;
  border: 1px solid rgba(148,163,184,0.2);
  margin-left: 8px;
}

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
}
.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}
.login-card h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
  text-align: center;
}
.login-card .login-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 28px;
}
.login-card .form-group { margin-bottom: 16px; }
.login-card label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.login-card input[type="text"],
.login-card input[type="email"],
.login-card input[type="password"] {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-primary);
  transition: border-color 0.15s;
}
.login-card input:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px var(--accent-purple-glow);
}
.login-card button[type="submit"] {
  width: 100%;
  padding: 12px;
  margin-top: 8px;
  background: var(--accent-purple);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.login-card button[type="submit"]:hover {
  background: var(--accent-purple-light);
  box-shadow: var(--shadow-glow-purple);
}
.login-card .error {
  color: var(--accent-red);
  font-size: 14px;
  margin-bottom: 16px;
  text-align: center;
  padding: 10px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-md);
}

.auth-hidden { display: none !important; }
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand-name { font-size: 22px; font-weight: 800; color: var(--accent-purple-light); }
.auth-brand-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }
.auth-success {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.3);
  color: #22c55e;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}
.auth-toggle-link { text-align: center; font-size: 14px; color: var(--text-secondary); }
.auth-forgot-link { text-align: center; margin-top: 12px; font-size: 13px; }
.auth-forgot-link a { color: var(--accent-purple-light); }
.auth-create-link { text-align: center; margin-top: 12px; font-size: 14px; color: var(--text-secondary); }
.auth-back-link { text-align: center; margin-top: 16px; font-size: 14px; color: var(--text-secondary); }
.auth-hint { font-size: 12px; color: var(--text-tertiary); margin-top: 8px; }
.auth-verify-section { text-align: center; }
.auth-verify-expiry { font-size: 13px; color: var(--text-tertiary); margin-top: 16px; }
.auth-verify-actions { margin-top: 24px; }
.auth-resend-form { display: inline; }
.auth-resend-btn {
  background: transparent;
  border: 1px solid var(--accent-purple);
  color: var(--accent-purple-light);
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  transition: background 0.15s, color 0.15s;
}
.theme-toggle:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  margin-top: 12px;
}
form label:first-child { margin-top: 0; }

form input[type="number"],
form input[type="text"],
form input[type="email"],
form input[type="password"] {
  width: 100%;
  max-width: 400px;
  padding: 10px 14px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-primary);
  transition: border-color 0.15s;
}
form input:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px var(--accent-purple-glow);
}
form input::placeholder { color: var(--text-tertiary); }

.error-msg {
  color: var(--accent-red);
  font-size: 14px;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-md);
}

.empty-row { color: var(--text-tertiary); font-style: italic; font-size: 14px; }

.clickable {
  cursor: pointer;
  color: var(--accent-purple-light);
  font-weight: 500;
}
.clickable:hover { text-decoration: underline; }

.modal pre {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  padding: 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-secondary);
}
.modal .close-btn {
  margin-top: 16px;
  padding: 8px 20px;
  background: var(--accent-purple);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}
.modal .close-btn:hover {
  background: var(--accent-purple-light);
}

.top-actions { margin-bottom: 24px; }
.top-actions a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--accent-purple);
  color: #fff;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s;
}
.top-actions a:hover {
  background: var(--accent-purple-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow-purple);
  text-decoration: none;
}

.section-danger {
  border-color: rgba(239,68,68,0.3);
}
.section-danger h2 {
  color: var(--accent-red);
}
.section-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.info-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}
.info-value {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.agent-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--border-subtle);
  margin-top: 16px;
  padding-top: 16px;
}

.agent-card-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.summary-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 32px;
}

@media (max-width: 768px) {
  .agent-grid {
    grid-template-columns: 1fr;
  }
  .summary-row {
    grid-template-columns: 1fr;
  }
}

.agent-template-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 10px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.agent-template-card:hover:not(.disabled) {
  border-color: var(--accent-purple);
  background: var(--accent-purple-glow);
}
.agent-template-card.selected {
  border-color: var(--accent-purple);
  background: var(--accent-purple-glow);
  box-shadow: var(--shadow-glow-purple);
}
.agent-template-card.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.form-error {
  font-size: 12px;
  color: var(--accent-red);
}

.tag-input-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  min-height: 42px;
  align-items: center;
  cursor: text;
  transition: border-color 0.15s;
}
.tag-input-wrapper:focus-within {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px var(--accent-purple-glow);
}
.tag-real-input {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  flex: 1;
  min-width: 120px;
}
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  background: rgba(124,58,237,0.15);
  border: 1px solid rgba(124,58,237,0.3);
  border-radius: 20px;
  font-size: 12px;
  color: var(--accent-purple-light);
  white-space: nowrap;
}
.tag-pill-remove {
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  opacity: 0.7;
}
.tag-pill-remove:hover {
  opacity: 1;
  color: var(--accent-red);
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.drawer-overlay.open { opacity: 1; pointer-events: all; }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  max-width: 90vw;
  height: 100vh;
  background: var(--bg-surface-raised);
  border-left: 1px solid var(--border-subtle);
  padding: 32px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 1101;
}
.drawer-overlay.open .drawer { transform: translateX(0); }
.drawer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.drawer-close:hover { color: var(--text-primary); background: var(--bg-surface-hover); }

.progress-mini {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-mini-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-purple-light));
  border-radius: 4px;
  transition: width 0.3s;
}
.progress-mini-fill.warn { background: linear-gradient(90deg, var(--accent-amber), #fbbf24); }
.progress-mini-fill.danger { background: linear-gradient(90deg, var(--accent-red), #f87171); }

.health-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}
.health-stat-card .stat-label { margin-bottom: 6px; }
.health-stat-card .stat-value { font-size: 18px; }

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.checklist-item:last-child { border-bottom: none; }
.checklist-icon { font-size: 16px; flex-shrink: 0; margin-top: 2px; }
.checklist-icon.pass { color: var(--accent-green); }
.checklist-icon.fail { color: var(--accent-red); }
.checklist-desc { font-size: 14px; color: var(--text-primary); }
.checklist-hint { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

.audit-filter.active {
  background: var(--accent-purple-glow);
  color: var(--accent-purple-light);
  border-color: var(--accent-purple);
}

.drawer-section { margin-bottom: 20px; }
.drawer-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}
.drawer-section-value {
  font-size: 14px;
  color: var(--text-primary);
}

@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.settings-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 28px;
  overflow-x: auto;
}
.settings-tab {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.settings-tab:hover {
  color: var(--text-primary);
  text-decoration: none;
}
.settings-tab.active {
  color: var(--accent-purple-light);
  border-bottom-color: var(--accent-purple);
}
.settings-tab-danger { color: var(--accent-red); }
.settings-tab-danger.active { color: var(--accent-red); border-bottom-color: var(--accent-red); }

.settings-content { padding-bottom: 40px; }

.settings-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-purple-glow);
  border: 2px solid var(--accent-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-purple-light);
  flex-shrink: 0;
}

.toggle-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.toggle-wrapper:last-child { border-bottom: none; }
.toggle-info { flex: 1; }
.toggle-title { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.toggle-desc { font-size: 13px; color: var(--text-secondary); }

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-surface-raised);
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: #fff;
}

.danger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.danger-row:last-of-type { border-bottom: none; }

.referral-step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-purple-glow);
  border: 1px solid var(--accent-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-purple-light);
  flex-shrink: 0;
}
