/* ArticleBot — Dark Professional Design System */
:root {
  --bg-base: #0a0e17;
  --bg-surface: #111827;
  --bg-surface-raised: #1e293b;
  --bg-surface-hover: #263348;
  --bg-input: #0d1320;
  
  --border-subtle: #1f293d;
  --border-strong: #334155;
  --border-focus: #3b82f6;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  --accent-primary: #3b82f6;
  --accent-primary-hover: #2563eb;
  --accent-success: #10b981;
  --accent-success-bg: rgba(16, 185, 129, 0.15);
  --accent-warning: #f59e0b;
  --accent-warning-bg: rgba(245, 158, 11, 0.15);
  --accent-danger: #ef4444;
  --accent-danger-bg: rgba(239, 68, 68, 0.15);
  --accent-info: #06b6d4;
  --accent-info-bg: rgba(6, 182, 212, 0.15);
  --accent-purple: #8b5cf6;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.6), 0 2px 4px -2px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7), 0 4px 6px -4px rgba(0, 0, 0, 0.7);

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* App Layout */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar — Dark Navy / Charcoal Theme */
.sidebar {
  width: 260px;
  background-color: #0b0f19;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform var(--transition-normal);
  z-index: 40;
}

.sidebar-header {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: #0b0f19;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(37, 99, 235, 0.4);
  flex-shrink: 0;
}

.logo-text {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #f8fafc;
}

.logo-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  margin-left: auto;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.sidebar-nav {
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  overflow-y: auto;
  background-color: #0b0f19;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #64748b;
  padding: 14px 12px 6px 12px;
  background: transparent;
  user-select: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 12px;
  border-radius: 8px;
  background-color: transparent;
  color: #94a3b8;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-align: left;
  width: 100%;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  outline: none;
}

.nav-item .nav-icon {
  font-size: 15px;
  width: 20px;
  text-align: center;
  color: #94a3b8;
  filter: grayscale(20%);
  opacity: 0.85;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-item:hover {
  background-color: #151d2f;
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, 0.04);
}

.nav-item:hover .nav-icon {
  color: #f1f5f9;
  opacity: 1;
  filter: none;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.22) 0%, rgba(30, 58, 138, 0.35) 100%);
  color: #ffffff;
  border-color: rgba(59, 130, 246, 0.45);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.15);
}

.nav-item.active .nav-icon {
  color: #60a5fa;
  opacity: 1;
  filter: none;
}

.nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background-color: #1e293b;
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-badge.active-badge {
  background-color: #2563eb;
  color: #ffffff;
  border-color: #3b82f6;
}

.user-profile-widget {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background-color: #131a29;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #2563eb, #0284c7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.3);
}

.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 2px;
}

.user-email {
  font-size: 12.5px;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.user-role-tag {
  font-size: 10px;
  color: #38bdf8;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.4px;
}

/* Sign Out Button */
#logout-btn,
.btn-secondary {
  background-color: #131a29;
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
}

#logout-btn:hover:not(:disabled),
.btn-secondary:hover:not(:disabled) {
  background-color: #1e293b;
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.2);
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: hidden;
}

/* Top Navbar */
.topbar {
  min-height: 64px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 30;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 18px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.page-title-wrap h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.system-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-surface-raised);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background-color: var(--accent-success);
  box-shadow: 0 0 8px var(--accent-success);
}

.status-dot.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Main Body Views */
.content-area {
  padding: 28px;
  flex: 1;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

.view-section {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Grid & Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.stat-card {
  display: flex;
  flex-direction: column;
}

.stat-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 8px 0;
  font-variant-numeric: tabular-nums;
}

.stat-card-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* Tables */
.table-container {
  overflow-x: auto;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.data-table th {
  background-color: var(--bg-surface-raised);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background-color: var(--bg-surface-hover);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.badge-success {
  background-color: var(--accent-success-bg);
  color: var(--accent-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
  background-color: var(--accent-warning-bg);
  color: var(--accent-warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-danger {
  background-color: var(--accent-danger-bg);
  color: var(--accent-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-info {
  background-color: var(--accent-info-bg);
  color: var(--accent-info);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.badge-secondary {
  background-color: var(--bg-surface-raised);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
}

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

.btn-primary {
  background-color: var(--accent-primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--accent-primary-hover);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
  background-color: var(--bg-surface-raised);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-surface-hover);
  border-color: var(--text-secondary);
}

.btn-danger {
  background-color: rgba(239, 68, 68, 0.15);
  color: var(--accent-danger);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
  background-color: var(--accent-danger);
  color: #fff;
}

.btn-success {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--accent-success);
  border-color: rgba(16, 185, 129, 0.3);
}

.btn-success:hover:not(:disabled) {
  background-color: var(--accent-success);
  color: #fff;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

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

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Password Input & Visibility Toggle */
.password-input-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.password-input-wrapper .form-input {
  padding-right: 44px;
}

.password-toggle-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 6px;
  margin: 0;
  cursor: pointer;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background-color var(--transition-fast);
  user-select: none;
  line-height: 1;
}

.password-toggle-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-hover);
}

.password-toggle-btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 1px;
}

.password-toggle-btn svg {
  display: block;
  pointer-events: none;
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  user-select: none;
}

.checkbox-input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  padding: 20px;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

#modal-create-user-add-site {
  z-index: 150;
}

.modal-dialog {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: scale(0.95);
  transition: transform var(--transition-fast);
}

.modal-backdrop.open .modal-dialog {
  transform: scale(1);
}

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

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

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

.modal-body {
  padding: 24px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background-color: var(--bg-surface-raised);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
  max-width: 380px;
  width: 100%;
}

.toast {
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: slideIn 0.25s ease-out forwards;
  color: var(--text-primary);
  font-size: 14px;
  position: relative;
  overflow: hidden;
}

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

.toast.toast-success { border-left: 4px solid var(--accent-success); }
.toast.toast-error { border-left: 4px solid var(--accent-danger); }
.toast.toast-warning { border-left: 4px solid var(--accent-warning); }
.toast.toast-info { border-left: 4px solid var(--accent-info); }

.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-message { flex: 1; }

/* Filter & Action Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-input {
  max-width: 300px;
}

/* Login View Screen */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: radial-gradient(circle at top center, #1e293b 0%, #0a0e17 70%);
}

.auth-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 36px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-header .logo-icon {
  margin: 0 auto 16px auto;
  width: 44px;
  height: 44px;
  font-size: 22px;
}

.auth-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.auth-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

.demo-pills {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  justify-content: center;
}

.demo-pill {
  font-size: 12px;
  padding: 4px 10px;
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--accent-info);
  cursor: pointer;
  font-weight: 600;
}

.demo-pill:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--accent-info);
}

/* Health Component Indicators & Dashboard */
.health-dashboard {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.health-header-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.health-last-checked {
  font-size: 13px;
  color: var(--text-muted);
}

.health-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.health-summary-card {
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.health-summary-card:hover {
  border-color: var(--border-focus);
}

.health-summary-card-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.health-summary-card-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.health-section-box {
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.health-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
}

.health-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.health-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.health-metric-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.health-metric-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.health-metric-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.health-metric-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.health-progress-track {
  width: 100%;
  height: 8px;
  background-color: var(--bg-surface-hover);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
}

.health-progress-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.health-progress-fill.status-healthy { background: #10b981; }
.health-progress-fill.status-warning { background: #f59e0b; }
.health-progress-fill.status-degraded { background: #f97316; }
.health-progress-fill.status-critical { background: #ef4444; }

.badge-healthy { background-color: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-warning { background-color: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-degraded { background-color: rgba(249, 115, 22, 0.15); color: #f97316; border: 1px solid rgba(249, 115, 22, 0.3); }
.badge-critical { background-color: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-down { background-color: rgba(239, 68, 68, 0.2); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.4); }
.badge-unknown { background-color: rgba(148, 163, 184, 0.15); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.3); }
.badge-idle { background-color: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }

.health-reason-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.4;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}
.health-reason-banner.status-healthy {
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.25);
  background-color: rgba(16, 185, 129, 0.06);
}
.health-reason-banner.status-warning {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.3);
  background-color: rgba(245, 158, 11, 0.08);
}
.health-reason-banner.status-degraded {
  color: #f97316;
  border-color: rgba(249, 115, 22, 0.3);
  background-color: rgba(249, 115, 22, 0.08);
}
.health-reason-banner.status-critical {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.35);
  background-color: rgba(239, 68, 68, 0.1);
}
.health-reason-banner.status-unknown {
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.25);
  background-color: rgba(148, 163, 184, 0.05);
}

.health-section-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.health-checked-at {
  font-size: 11px;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.health-card-reason {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.health-expand-btn {
  background: none;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.health-expand-btn:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.health-details-drawer {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 12px;
  margin-top: 8px;
}

.health-table-wrapper {
  overflow-x: auto;
}

.health-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.health-table th {
  background-color: var(--bg-surface);
  color: var(--text-muted);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.health-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

.health-table tr:hover {
  background-color: var(--bg-surface-hover);
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.health-item {
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.health-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.health-item-name {
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.health-item-details {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.empty-state-text {
  font-size: 13px;
}

/* Responsive Overrides */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

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

  .topbar {
    padding: 0 16px;
  }

  .content-area {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .topbar {
    padding: 8px 12px;
    flex-wrap: wrap;
    height: auto;
    min-height: 56px;
    gap: 8px;
  }

  .topbar-left {
    gap: 8px;
  }

  .topbar-right {
    gap: 8px;
  }

  .user-email {
    max-width: 110px;
  }

  .user-profile-widget {
    padding: 4px 8px;
    gap: 6px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-input {
    max-width: 100%;
  }
}

/* ============================================================================ */
/* PHASE 10: ARTICLE SUBMIT UI DESIGN SYSTEM */
/* ============================================================================ */

.submit-page-header {
  margin-bottom: 24px;
}

.page-main-heading {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.page-sub-heading {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.required-indicator {
  color: var(--accent-danger);
  font-weight: bold;
}

/* Main Submit Card Layout */
.submit-main-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 28px;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
}

.submit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "desc   image"
    "desc   category"
    "source sites"
    "source status"
    "action action";
  gap: 24px;
  align-items: start;
}

.cell-description {
  grid-area: desc;
}

.cell-featured-image {
  grid-area: image;
}

.cell-category-selection {
  grid-area: category;
  width: 100%;
}

.cell-source-url {
  grid-area: source;
}

.cell-target-sites {
  grid-area: sites;
}

.cell-publish-status {
  grid-area: status;
}

.cell-submit-action {
  grid-area: action;
  margin-top: 8px;
}

/* Form Inputs Precision */
.submit-desc-textarea {
  min-height: 140px;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
}

.source-url-input {
  font-size: 14px;
  padding: 12px 14px;
  background-color: var(--bg-input);
  border-color: var(--border-strong);
}

.source-url-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

/* Featured Image Segmented Controls */
.featured-image-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.image-source-segmented {
  display: inline-flex;
  background: var(--bg-surface-raised);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  gap: 2px;
}

.segmented-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.segmented-btn.active {
  background-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.image-input-panel {
  margin-bottom: 10px;
}

.image-dropzone {
  border: 2px dashed var(--border-strong);
  background-color: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.image-dropzone:hover, .image-dropzone.dragover {
  border-color: var(--accent-primary);
  background-color: rgba(59, 130, 246, 0.05);
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.dropzone-icon {
  font-size: 24px;
  margin-bottom: 2px;
}

.dropzone-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.dropzone-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* Image Preview */
.featured-image-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  margin-top: 8px;
}

.preview-thumb-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: var(--bg-input);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
}

.preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.preview-filename {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-filesize {
  font-size: 11px;
  color: var(--text-muted);
}

.preview-remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.preview-remove-btn:hover {
  color: var(--accent-danger);
  background-color: var(--accent-danger-bg);
}

/* Target Sites List */
.target-sites-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px;
}

.site-select-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.site-select-row:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.site-select-row.selected {
  background-color: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.4);
}

.site-select-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.site-checkbox {
  width: 17px;
  height: 17px;
  accent-color: var(--accent-primary);
  cursor: pointer;
  flex-shrink: 0;
}

.site-name-text {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-domain-text {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  font-family: monospace;
}

.sites-loading-placeholder, .sites-empty-placeholder {
  padding: 14px;
  font-size: 13px;
  color: var(--text-secondary);
  background-color: var(--bg-surface-raised);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-subtle);
  text-align: center;
}

/* Publish Status Radio Cards */
.status-radio-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.status-radio-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.status-radio-card:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.status-radio-input {
  display: none;
}

.radio-custom-dot {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.status-radio-input:checked + .radio-custom-dot {
  border-color: var(--accent-primary);
  background-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.status-radio-card.active {
  background-color: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.4);
}

.radio-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Submit Form Action Buttons (Add To Queue + Rewrite Article) */
.submit-actions-group {
  display: flex;
  gap: 16px;
  align-items: center;
  width: 100%;
}

.submit-actions-group .btn-add-queue,
.submit-actions-group .btn-rewrite-action {
  flex: 1;
  width: 100%;
}

.btn-add-queue {
  width: 100%;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  border-radius: var(--radius-md);
  background-color: var(--accent-primary);
  color: #ffffff;
  border: 1px solid rgba(59, 130, 246, 0.4);
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.35);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

.btn-add-queue:hover:not(:disabled) {
  background-color: var(--accent-primary-hover);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.5);
  transform: translateY(-1px);
}

.btn-add-queue:active:not(:disabled) {
  transform: translateY(0);
}

.btn-add-queue:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-add-queue.btn-success-state {
  background-color: var(--accent-success);
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
}

/* Rewrite Article Action Button */
.btn-rewrite-action {
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
  color: #ffffff;
  border: 1px solid rgba(167, 139, 250, 0.3);
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.35);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

.btn-rewrite-action:hover:not(:disabled) {
  background: linear-gradient(135deg, #8b5cf6 0%, #4f46e5 100%);
  box-shadow: 0 4px 18px rgba(124, 58, 237, 0.55);
  transform: translateY(-1px);
}

.btn-rewrite-action:active:not(:disabled) {
  transform: translateY(0);
}

.btn-rewrite-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-rewrite-action.btn-success-state {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: rgba(52, 211, 153, 0.4);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
}

@media (max-width: 640px) {
  .submit-actions-group {
    flex-direction: column;
    gap: 12px;
  }
}

/* Two-Card Status Section Below Submit */
.status-section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.status-card-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.status-card-header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.status-card-body {
  min-height: 180px;
}

/* Processing Card Elements */
.idle-processing-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}

.idle-icon {
  font-size: 28px;
  margin-bottom: 8px;
  opacity: 0.7;
}

.idle-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.idle-desc {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 320px;
}

.active-processing-box {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.active-job-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.active-job-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-job-id {
  font-size: 12px;
  color: var(--accent-info);
  font-weight: 600;
  font-family: monospace;
}

/* Progress Bar */
.progress-bar-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-bar-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background-color: var(--bg-surface-raised);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-info));
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

/* Steps Pipeline */
.steps-pipeline-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.step-row-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.step-indicator-badge {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.step-indicator-badge.completed {
  background-color: var(--accent-success-bg);
  color: var(--accent-success);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.step-indicator-badge.current {
  background-color: rgba(59, 130, 246, 0.2);
  color: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  animation: pulse 1.5s infinite;
}

.step-indicator-badge.retry {
  background-color: rgba(245, 158, 11, 0.2);
  color: #d97706;
  border: 1px solid #d97706;
  animation: pulse 1.5s infinite;
}

.step-indicator-badge.failed {
  background-color: var(--accent-danger-bg);
  color: var(--accent-danger);
  border: 1px solid var(--accent-danger);
}

.step-indicator-badge.pending {
  background-color: var(--bg-surface-raised);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.step-label-text {
  color: var(--text-secondary);
}

.step-row-item.current .step-label-text {
  color: var(--text-primary);
  font-weight: 600;
}

.step-row-item.retry .step-label-text {
  color: #d97706;
  font-weight: 600;
}

.step-row-item.failed .step-label-text {
  color: var(--accent-danger);
  font-weight: 600;
}

.step-row-item.completed .step-label-text {
  color: var(--text-muted);
}

.progress-bar-fill.fill-completed {
  background: var(--accent-success);
}

.progress-bar-fill.fill-failed {
  background: var(--accent-danger);
}

.progress-bar-fill.fill-retry {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

/* Queue Card Elements */
.queue-card-body {
  padding: 0;
}

.queue-table-wrap {
  border: none;
  border-radius: 0;
  max-height: 260px;
}

.queue-table th {
  padding: 10px 14px;
}

.queue-table td {
  padding: 10px 14px;
  font-size: 13px;
}

/* Responsive Overrides for Submit Article UI */
@media (max-width: 900px) {
  .submit-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }

  .cell-description { order: 1; }
  .cell-source-url { order: 2; }
  .cell-featured-image { order: 3; }
  .cell-category-selection { order: 4; }
  .cell-target-sites { order: 5; }
  .cell-publish-status { order: 6; }
  .cell-submit-action { order: 7; }

  .status-section-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

/* Spinner Animation */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

/* Radio Button in Target Site list */
.site-radio {
  width: 17px;
  height: 17px;
  accent-color: var(--accent-primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* Category Selection Area */
.category-selection-container {
  min-height: 44px;
  width: 100%;
}

.category-placeholder-text {
  padding: 10px 14px;
  background-color: var(--bg-surface-raised);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-muted);
}

.category-loading-state {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
}

.category-error-state {
  padding: 10px 14px;
  background-color: rgba(239, 68, 68, 0.08);
  border: 1px solid var(--accent-danger);
  border-radius: var(--radius-md);
  color: var(--accent-danger);
  font-size: 13px;
}

.category-select-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.category-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

/* ============================================================================
   AI PROVIDERS ADMIN SECTION (Dark Navy / Charcoal Theme)
   ============================================================================ */

.ai-provider-security-banner {
  background-color: #0e1524;
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.ai-default-indicator {
  background-color: #162035;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  font-size: 13px;
  white-space: nowrap;
}

.ai-providers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 20px;
}

@media (max-width: 640px) {
  .ai-providers-grid {
    grid-template-columns: 1fr;
  }
}

.ai-provider-card {
  background-color: #111827;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.ai-provider-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.ai-provider-card.is-default {
  border-color: rgba(34, 197, 94, 0.4);
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.08);
}

.ai-provider-card-header {
  padding: 16px 20px;
  background-color: #141d2f;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-provider-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-provider-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background-color: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.ai-provider-title {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-provider-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-provider-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.ai-key-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.ai-key-input-wrapper .form-input {
  padding-right: 42px;
  font-family: monospace;
  font-size: 13px;
  background-color: #0b0f19;
  border-color: rgba(255, 255, 255, 0.1);
}

.ai-key-toggle-btn {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.ai-key-toggle-btn:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.05);
}

.ai-provider-card-footer {
  padding: 14px 20px;
  background-color: #0e1524;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.btn-default-badge {
  background-color: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-connected {
  background-color: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.3);
}

.badge-ready {
  background-color: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-phase-notice {
  background-color: rgba(148, 163, 184, 0.08);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
  font-size: 10px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.ai-provider-card.is-non-integrated {
  border-color: rgba(255, 255, 255, 0.05);
}

.ai-provider-card.is-non-integrated .ai-provider-card-header {
  background-color: #111827;
}

.ai-model-free-badge {
  color: #4ade80;
  font-weight: 600;
}

/* Phase 3A: Rewrite Article Admin Status Banner */
.rewrite-ai-status-banner {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.rewrite-ai-banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.rewrite-ai-banner-icon {
  font-size: 18px;
}

.rewrite-ai-banner-title {
  color: var(--text-primary);
  font-weight: 600;
}

.rewrite-ai-banner-model {
  color: #60a5fa;
  font-family: var(--font-mono, monospace);
  font-weight: 600;
  background: rgba(59, 130, 246, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.rewrite-ai-banner-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-job-rewrite {
  background-color: rgba(147, 51, 234, 0.15);
  color: #c084fc;
  border: 1px solid rgba(147, 51, 234, 0.3);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.badge-job-import {
  background-color: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

/* Failed Job Retry Action Box in My Articles */
.failed-job-retry-box {
  margin-top: 8px;
  padding: 6px 10px;
  background: var(--bg-surface-raised, #1e293b);
  border: 1px solid var(--border-subtle, #1f293d);
  border-radius: var(--radius-sm, 6px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  max-width: 280px;
}

.failed-job-retry-box .retry-label {
  font-size: 11px;
  color: var(--text-secondary, #94a3b8);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  user-select: none;
}

.failed-job-retry-box .btn-retry {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm, 4px);
  background: var(--accent-primary, #3b82f6);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all var(--transition-fast, 0.15s ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  height: 24px;
  line-height: 1;
}

.failed-job-retry-box .btn-retry:hover:not(:disabled) {
  background: var(--accent-primary-hover, #2563eb);
}

.failed-job-retry-box .btn-retry:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* My Articles Table Retry Action Button */
.btn-table-retry {
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm, 4px);
  border: 1px solid rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  line-height: 1.2;
  transition: all var(--transition-fast, 0.15s ease);
}

.btn-table-retry:hover:not(:disabled) {
  background: var(--accent-primary, #3b82f6);
  color: #ffffff;
  border-color: var(--accent-primary, #3b82f6);
}

.btn-table-retry:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Pagination Controls */
.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  flex-wrap: wrap;
  padding: 8px 0;
}

.pagination-btn {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background-color: var(--bg-surface, #1e293b);
  color: var(--text-secondary, #94a3b8);
  cursor: pointer;
  transition: all var(--transition-fast, 0.15s ease);
  min-width: 36px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pagination-btn:hover:not(:disabled) {
  background-color: var(--accent-primary, #3b82f6);
  color: #ffffff;
  border-color: var(--accent-primary, #3b82f6);
}

.pagination-btn.active {
  background-color: var(--accent-primary, #3b82f6);
  color: #ffffff;
  border-color: var(--accent-primary, #3b82f6);
  font-weight: 600;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.35);
}

.pagination-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.pagination-ellipsis {
  color: var(--text-muted, #64748b);
  padding: 0 4px;
  font-size: 14px;
  user-select: none;
}

/* ============================================================================ */
/* PERFORMANCE ANALYTICS & MONITORING PAGE                                      */
/* ============================================================================ */
.perf-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.perf-range-selector {
  display: inline-flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}
.perf-range-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.perf-range-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}
.perf-range-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.perf-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.perf-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast);
}
.perf-card:hover {
  border-color: var(--border-strong);
}
.perf-card-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.perf-card-val {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.perf-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}
.perf-status-reason {
  font-size: 13px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--border-strong);
  margin-bottom: 16px;
}
.perf-status-reason.healthy {
  border-left-color: var(--accent-success);
}
.perf-status-reason.warning {
  border-left-color: var(--accent-warning);
}
.perf-status-reason.degraded {
  border-left-color: #f97316;
}
.perf-status-reason.critical {
  border-left-color: var(--accent-danger);
}
.perf-pill-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  flex: 1;
  min-width: 200px;
}
.perf-pill-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.perf-pill-values {
  display: flex;
  gap: 14px;
  font-size: 13px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}
.perf-pill-values strong {
  color: var(--text-primary);
}
.perf-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}
.perf-chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
}
.perf-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.perf-chart-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.perf-chart-container {
  width: 100%;
  height: 180px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.perf-chart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 24px;
}
.perf-empty-icon {
  font-size: 24px;
  opacity: 0.6;
}
.perf-site-row {
  cursor: pointer;
  transition: background-color var(--transition-fast);
}
.perf-site-row:hover {
  background-color: var(--bg-surface-hover);
}
.perf-site-details-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 8px;
}
.badge-degraded {
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.3);
}
.badge-critical {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.badge-healthy {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-unknown {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

/* ============================================================================ */
/* AI AGENT CHAT UI (Stage 5)                                                  */
/* ============================================================================ */
.agent-chat-wrapper {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 130px);
  min-height: 600px;
  max-width: 1000px;
  margin: 0 auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.agent-header-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #0f172a;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.agent-header-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-header-icon {
  font-size: 22px;
  line-height: 1;
}

.agent-header-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.agent-header-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.badge-read-only {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.agent-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
  background: #0b0f19;
}

/* Empty State */
.agent-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: auto 0;
  padding: 30px 16px;
  text-align: center;
  max-width: 680px;
  align-self: center;
}

.agent-empty-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.agent-empty-icon {
  font-size: 28px;
}

.agent-empty-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.agent-empty-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}

.agent-suggestions-section {
  width: 100%;
}

.agent-suggestions-heading {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.agent-suggestions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.agent-suggestion-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}

.agent-suggestion-chip:hover {
  background: var(--bg-surface-raised);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.agent-suggestion-chip:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* Chat Message Rows */
.agent-message-row {
  display: flex;
  gap: 12px;
  max-width: 85%;
  animation: fadeIn 0.2s ease-in-out;
}

.agent-message-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.agent-message-agent {
  align-self: flex-start;
}

.agent-message-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  font-weight: 700;
}

.agent-avatar-user {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #ffffff;
}

.agent-avatar-bot {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #ffffff;
}

.agent-bubble-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.agent-message-user .agent-bubble-wrap {
  align-items: flex-end;
}

.agent-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.6;
  position: relative;
  word-break: break-word;
}

.agent-bubble-user {
  background: #2563eb;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.agent-bubble-agent {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 4px;
}

.agent-bubble-error {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-bottom-left-radius: 4px;
}

.agent-bubble-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agent-bubble-content p {
  margin: 0;
}

.agent-bubble-content ul, .agent-bubble-content ol {
  margin: 4px 0 4px 20px;
  padding: 0;
}

.agent-bubble-content li {
  margin-bottom: 4px;
}

.agent-inline-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12.5px;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 4px;
  color: #93c5fd;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.agent-code-block {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  padding: 12px;
  background: #050811;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow-x: auto;
  color: #e2e8f0;
}

.agent-message-time {
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 4px;
}

/* Metadata Bar */
.agent-metadata-bar {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  font-size: 12px;
  color: var(--text-secondary);
}

.agent-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.agent-sources-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.agent-source-chip {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  padding: 2px 8px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #93c5fd;
  border-radius: var(--radius-full);
}

.agent-partial-warning-box {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: #fde68a;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

/* Loading Dots */
.agent-loading-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
}

.agent-loading-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

.agent-loading-dots .dot {
  width: 6px;
  height: 6px;
  background: #60a5fa;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.agent-loading-dots .dot:nth-child(1) { animation-delay: -0.32s; }
.agent-loading-dots .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.agent-loading-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
}

/* Input Area */
.agent-input-container {
  padding: 14px 20px;
  background: #0f172a;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.agent-input-box {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.agent-input-box:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.agent-textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  max-height: 150px;
  padding: 4px 0;
  outline: none;
}

.agent-textarea::placeholder {
  color: var(--text-muted);
}

.agent-send-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.agent-input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.agent-input-footer kbd {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-family: inherit;
}

.agent-input-security-badge {
  font-size: 11px;
  color: var(--text-secondary);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
  .agent-chat-wrapper {
    height: calc(100vh - 100px);
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .agent-message-row {
    max-width: 95%;
  }
  .agent-suggestions-grid {
    grid-template-columns: 1fr;
  }
  .agent-input-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

/* Stage 7.3: Brain Hardening Badges & Notices */
.agent-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  line-height: 1.4;
  white-space: nowrap;
}
.agent-evidence-high {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.agent-evidence-medium {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.agent-evidence-low {
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.3);
}
.agent-evidence-insufficient {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.agent-confidence-high {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}
.agent-confidence-medium {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.agent-confidence-low {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}
.agent-early-stop {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}
.agent-tokens {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.3);
}
.agent-cost {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.agent-inference {
  background: rgba(234, 179, 8, 0.15);
  color: #fde047;
  border: 1px solid rgba(234, 179, 8, 0.3);
}
.agent-fact {
  background: rgba(20, 184, 166, 0.15);
  color: #5eead4;
  border: 1px solid rgba(20, 184, 166, 0.3);
}
.agent-missing-data {
  background: rgba(244, 63, 94, 0.15);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.3);
}
.agent-conflict-warning-box {
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: #fca5a5;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

/* ==================================================================== */
/* FIRST-RUN MULTI-STEP SETUP WIZARD                                    */
/* ==================================================================== */
.setup-wizard-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  width: 100%;
  max-width: 780px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.7), 0 8px 10px -6px rgba(0, 0, 0, 0.7);
  margin: 24px auto;
}

.wizard-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  overflow-x: auto;
}

.wizard-step-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0 6px;
  color: inherit;
  transition: all var(--transition-fast);
}

.wizard-step-node:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.wizard-step-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-surface-raised);
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  margin-bottom: 6px;
}

.wizard-step-node.active .wizard-step-circle {
  background: #1e3a8a;
  border-color: #3b82f6;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
}

.wizard-step-node.completed .wizard-step-circle {
  background: #064e3b;
  border-color: #10b981;
  color: #34d399;
}

.wizard-step-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.wizard-step-node.active .wizard-step-title {
  color: #60a5fa;
  font-weight: 700;
}

.wizard-step-node.completed .wizard-step-title {
  color: #34d399;
}

.wizard-step-connector {
  flex: 1;
  height: 2px;
  background: var(--border-strong);
  margin: 0 4px 20px 4px;
  position: relative;
  z-index: 1;
}

.wizard-step-connector.completed {
  background: #10b981;
}

.wizard-step-panel {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.wizard-step-panel.active {
  display: block;
}

.wizard-panel-header {
  margin-bottom: 22px;
}

.wizard-panel-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.wizard-panel-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.wizard-audit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.wizard-audit-card {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
}

.wizard-audit-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.wizard-audit-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.wizard-audit-item:last-child {
  border-bottom: none;
}

.wizard-audit-label {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.wizard-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
}

.wizard-badge.success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.wizard-badge.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.wizard-badge.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.wizard-badge.info {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.wizard-badge.neutral {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.wizard-notice-box {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #93c5fd;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  line-height: 1.5;
}

.wizard-guide-step {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

.wizard-guide-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1e3a8a;
  color: #60a5fa;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wizard-guide-content h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.wizard-guide-content p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.password-meter {
  height: 4px;
  background: var(--bg-surface-hover);
  border-radius: var(--radius-full);
  margin-top: 6px;
  overflow: hidden;
  display: flex;
}

.password-meter-bar {
  height: 100%;
  width: 0%;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.wizard-nav-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 10px;
  margin-bottom: 16px;
}

.preset-card {
  background: rgba(17, 24, 39, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.preset-card:hover {
  border-color: var(--accent-primary);
  background: rgba(30, 41, 59, 0.6);
}

.preset-card.active {
  border-color: #3b82f6;
  background: rgba(30, 58, 138, 0.25);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.preset-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.preset-specs {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.preset-details {
  font-size: 11px;
  font-family: monospace;
  background: rgba(0, 0, 0, 0.3);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: #93c5fd;
}

.toggle-group {
  display: inline-flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-strong);
}

.toggle-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  background: var(--bg-surface-raised);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toggle-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
}





