/* ==========================================================================
   YT-RES Modern Dashboard CSS Stylesheet
   Dark-first Responsive Design, Glassmorphism Cards & Micro-interactions
   ========================================================================== */

:root {
  --bg-main: #0b0f19;
  --bg-card: #151d2f;
  --bg-card-hover: #1c273e;
  --bg-subtle: #1e293b;
  --border-color: #2a374f;
  --border-active: #3b82f6;

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

  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-info: #06b6d4;

  --badge-low-bg: rgba(16, 185, 129, 0.15);
  --badge-low-text: #34d399;
  --badge-low-border: rgba(16, 185, 129, 0.3);

  --badge-medium-bg: rgba(245, 158, 11, 0.15);
  --badge-medium-text: #fbbf24;
  --badge-medium-border: rgba(245, 158, 11, 0.3);

  --badge-high-bg: rgba(239, 68, 68, 0.15);
  --badge-high-text: #f87171;
  --badge-high-border: rgba(239, 68, 68, 0.3);

  --badge-pending-bg: rgba(100, 116, 139, 0.15);
  --badge-pending-text: #cbd5e1;
  --badge-pending-border: rgba(100, 116, 139, 0.3);

  --badge-owner-bg: rgba(99, 102, 241, 0.15);
  --badge-owner-text: #a5b4fc;
  --badge-owner-border: rgba(99, 102, 241, 0.3);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

/* ==========================================================================
   Layout: Header, Navigation & Main Container
   ========================================================================== */

.app-header {
  background-color: rgba(21, 29, 47, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 0.75rem 1.5rem;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.brand-logo:hover {
  text-decoration: none;
}

.brand-badge {
  font-size: 0.7rem;
  background: var(--bg-subtle);
  color: var(--color-primary);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-weight: 600;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  text-decoration: none;
}

.nav-btn:hover, .nav-btn.active {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.nav-btn.active {
  color: var(--color-primary);
  border-bottom: 2px solid var(--color-primary);
}

.main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
  width: 100%;
  flex: 1;
}

.app-footer {
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
  padding: 1rem 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ==========================================================================
   KPI Summary Grid
   ========================================================================== */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-active);
  box-shadow: var(--shadow-md);
}

.kpi-title {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-value {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.kpi-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* Health Score Pill */
.health-score-high { color: var(--color-success); }
.health-score-med  { color: var(--color-warning); }
.health-score-low  { color: var(--color-danger); }

/* ==========================================================================
   Quick Actions & Search Toolbars
   ========================================================================== */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  background: transparent;
  color: var(--text-primary);
}

.btn:hover {
  text-decoration: none;
}

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

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

.btn-outline {
  border-color: var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.btn-outline:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-active);
}

.btn-sm {
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
}

/* Stable Action Buttons (Calculated for max label length without layout shift) */
.btn-action-save           { min-width: 108px; text-align: center; justify-content: center; }
.btn-action-rescan         { min-width: 155px; text-align: center; justify-content: center; }
.btn-action-sync-nlm       { min-width: 178px; text-align: center; justify-content: center; }
.btn-action-resync-asr     { min-width: 175px; text-align: center; justify-content: center; }
.btn-action-diagnose       { min-width: 135px; text-align: center; justify-content: center; }
.btn-action-diagnose-modal { min-width: 195px; text-align: center; justify-content: center; }
.btn-action-sync-all       { min-width: 275px; text-align: center; justify-content: center; }
.btn-action-save-tg        { min-width: 175px; text-align: center; justify-content: center; }
.btn-action-test-tg        { min-width: 145px; text-align: center; justify-content: center; }
.btn-action-save-email     { min-width: 160px; text-align: center; justify-content: center; }
.btn-action-test-email     { min-width: 130px; text-align: center; justify-content: center; }
.btn-action-save-proxy     { min-width: 165px; text-align: center; justify-content: center; }
.btn-action-save-auth      { min-width: 250px; text-align: center; justify-content: center; }
.btn-action-test-auth      { min-width: 195px; text-align: center; justify-content: center; }

/* Review Panel Toolbar - Single Row on Desktop */
.review-panel-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.review-panel-actions-left,
.review-panel-actions-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

@media (max-width: 860px) {
  .review-panel-actions {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  .review-panel-actions-left,
  .review-panel-actions-right {
    flex-wrap: wrap;
  }
}

.input-search, .select-filter {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

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

/* ==========================================================================
   Charts & Visualizations Section
   ========================================================================== */

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.chart-header {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chart-container {
  position: relative;
  height: 240px;
  width: 100%;
}

/* ==========================================================================
   Tables & Data Presentation
   ========================================================================== */

.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.data-table th {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

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

.data-table tbody tr {
  transition: var(--transition);
}

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

.data-table .text-center, th.text-center, td.text-center {
  text-align: center;
}

.data-table .text-right, th.text-right, td.text-right {
  text-align: right;
}

.data-table .col-nowrap, th.col-nowrap, td.col-nowrap {
  white-space: nowrap;
  width: 1%;
}

.data-table .col-text-expand, th.col-text-expand, td.col-text-expand {
  width: 100%;
}

/* Thumbnails */
.video-thumb-preview {
  width: 80px;
  height: 45px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  display: block;
}

/* Risk Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-low {
  background: var(--badge-low-bg);
  color: var(--badge-low-text);
  border-color: var(--badge-low-border);
}

.badge-medium {
  background: var(--badge-medium-bg);
  color: var(--badge-medium-text);
  border-color: var(--badge-medium-border);
}

.badge-high {
  background: var(--badge-high-bg);
  color: var(--badge-high-text);
  border-color: var(--badge-high-border);
}

.badge-pending {
  background: var(--badge-pending-bg);
  color: var(--badge-pending-text);
  border-color: var(--badge-pending-border);
}

.badge-owner {
  background: var(--badge-owner-bg);
  color: var(--badge-owner-text);
  border-color: var(--badge-owner-border);
}

.badge-type {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-color: var(--border-color);
}

/* ==========================================================================
   Dynamic Settings & Feature Toggles
   ========================================================================== */

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  gap: 1rem;
  transition: var(--transition);
}

.setting-item:hover {
  border-color: var(--border-active);
}

.setting-info {
  flex: 1;
}

.setting-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.setting-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Toggle Switch Switcher */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-main);
  border: 1px solid var(--border-color);
  transition: .3s;
  border-radius: 26px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-secondary);
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

input:checked + .slider:before {
  transform: translateX(22px);
  background-color: #ffffff;
}

/* ==========================================================================
   AI-Copilot Interactive Widget
   ========================================================================== */

.copilot-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
}

.copilot-chat-box {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

.copilot-response {
  white-space: pre-wrap;
  color: var(--text-primary);
}

.copilot-input-group {
  display: flex;
  gap: 0.5rem;
}

.quick-prompts {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.prompt-chip {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.prompt-chip:hover {
  background: var(--bg-card-hover);
  color: var(--color-primary);
  border-color: var(--border-active);
}

/* ==========================================================================
   Modal Dialogs (Video Detail & Audit Breakdown)
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop.show {
  display: flex;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 980px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 10;
}

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

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

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

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.risk-vector-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
}

@media (max-width: 860px) {
  .risk-vector-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .risk-vector-grid {
    grid-template-columns: 1fr;
  }
}

.vector-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
  max-height: 135px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.vector-box::-webkit-scrollbar {
  width: 4px;
}

.vector-box::-webkit-scrollbar-track {
  background: transparent;
}

.vector-box::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 4px;
}

.vector-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.advice-box {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  color: var(--text-primary);
  margin-top: 0.75rem;
}

/* Transcript Container */
.transcript-box {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  max-height: 300px;
  overflow-y: auto;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-primary);
  white-space: pre-wrap;
  font-family: inherit;
}

.transcript-empty {
  color: var(--text-muted);
  font-style: italic;
  padding: 1rem 0;
  text-align: center;
}

/* Trigger Word Highlighting */
.trigger-highlight {
  background-color: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid rgba(239, 68, 68, 0.5);
  text-decoration: none;
}

/* Advice Accordion / Collapsible Button */
.advice-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #93c5fd;
  transition: var(--transition);
}

.advice-toggle-btn:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: #60a5fa;
  color: #ffffff;
}

/* Transcript Tabs */
.transcript-tabs-header {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.transcript-tab-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.8rem;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.transcript-tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.transcript-tab-btn.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: #3b82f6;
  color: #93c5fd;
}

/* Source Badges for Risk Findings */
.finding-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.finding-badge-speech {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.finding-badge-ocr {
  background: rgba(234, 179, 8, 0.2);
  color: #fde047;
  border: 1px solid rgba(234, 179, 8, 0.4);
}

.finding-badge-desc {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.finding-badge-link {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.finding-badge-title {
  background: rgba(168, 85, 247, 0.2);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.advice-collapsible {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

.advice-collapsible.show {
  display: block;
}

/* Formatted Markdown Content Inside Advice & Reports */
.markdown-rendered {
  line-height: 1.65;
  color: var(--text-primary);
}

.markdown-rendered h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 1rem;
  margin-bottom: 0.4rem;
  color: #93c5fd;
}

.markdown-rendered h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 0.8rem;
  margin-bottom: 0.3rem;
  color: var(--text-primary);
}

.markdown-rendered p {
  margin-bottom: 0.6rem;
  font-size: 0.9rem;
}

.markdown-rendered ul, .markdown-rendered ol {
  margin-left: 1.4rem;
  margin-bottom: 0.75rem;
  font-size: 0.88rem;
}

.markdown-rendered li {
  margin-bottom: 0.35rem;
}

.markdown-rendered hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 1rem 0;
}

.markdown-rendered strong {
  font-weight: 700;
  color: #ffffff;
}

/* ==========================================================================
   Toasts & Alerts
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 480px;
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  color: #f8fafc;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.toast-success {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid #10b981;
  color: #ecfdf5;
  box-shadow: 0 8px 20px -4px rgba(16, 185, 129, 0.25), 0 4px 6px -2px rgba(0, 0, 0, 0.5);
}

.toast.toast-error {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid #ef4444;
  color: #fef2f2;
  box-shadow: 0 8px 20px -4px rgba(239, 68, 68, 0.25), 0 4px 6px -2px rgba(0, 0, 0, 0.5);
}

.toast.toast-info {
  background: rgba(59, 130, 246, 0.18);
  border: 1px solid #3b82f6;
  color: #eff6ff;
  box-shadow: 0 8px 20px -4px rgba(59, 130, 246, 0.25), 0 4px 6px -2px rgba(0, 0, 0, 0.5);
}

.toast.toast-hiding {
  animation: toastSlideOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

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

/* Review Controls */
.select-review {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}

.select-review:hover {
  border-color: #60a5fa;
  background: var(--bg-card-hover);
}

.select-review:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.review-panel {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .nav-links {
    width: 100%;
    overflow-x: auto;
  }
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

/* System Health & Status Bar */
.system-status-bar {
  transition: var(--transition);
}

.system-status-bar:hover {
  border-color: rgba(59, 130, 246, 0.4);
}

.module-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
}

.module-pill:hover {
  background: var(--bg-card-hover);
  border-color: #60a5fa;
  color: var(--text-primary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.green {
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.7);
}

.status-dot.yellow {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.7);
}

.status-dot.red {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.7);
}

.status-dot.gray {
  background: #64748b;
}

/* Health Grid */
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.health-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

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

.health-item-title {
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
