/* ==========================================================================
   RecoverAI – AI Revenue Recovery Command Center Theme
   Inspired by modern fintech & SaaS command centers (Stripe, Razorpay, Brex)
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;

  --accent-indigo: #4f46e5;
  --accent-indigo-light: #eef2ff;

  --success: #10b981;
  --success-dark: #059669;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;

  --warning: #f59e0b;
  --warning-dark: #d97706;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;

  --danger: #ef4444;
  --danger-dark: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;

  --sidebar-width: 240px;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --sidebar-hover: #1e293b;
  --sidebar-active: #2563eb;

  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;

  --border: #e2e8f0;
  --border-focus: #94a3b8;

  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-subtle: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-drawer: -10px 0 25px -5px rgba(0, 0, 0, 0.1), -8px 0 10px -6px rgba(0, 0, 0, 0.08);

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

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

/* ==========================================================================
   Left Navigation Sidebar
   ========================================================================== */
.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  border-right: 1px solid #1e293b;
  transition: transform 0.25s ease;
}

.sidebar-top {
  padding: 1.25rem 1rem;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.5rem 1.25rem;
  border-bottom: 1px solid #1e293b;
  margin-bottom: 1.25rem;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent-indigo) 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.brand-tag {
  font-size: 0.65rem;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  background: transparent;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.15s ease;
  position: relative;
}

.nav-item:hover {
  background-color: var(--sidebar-hover);
  color: #ffffff;
}

.nav-item.active {
  background-color: var(--sidebar-active);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.nav-badge {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 700;
  background-color: #1e293b;
  color: #94a3b8;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  font-family: var(--font-mono);
}

.nav-item.active .nav-badge {
  background-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.sidebar-bottom {
  padding: 1rem;
  border-top: 1px solid #1e293b;
}

.system-status-box {
  background-color: #1e293b;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.status-dot.online {
  background-color: var(--success);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.status-text {
  font-size: 0.76rem;
  font-weight: 700;
  color: #ffffff;
}

/* ==========================================================================
   Main Content Area & Topbar
   ========================================================================== */
.app-main-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-topbar {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: var(--shadow-subtle);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mobile-toggle-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-main);
}

.topbar-title-wrap h2 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.topbar-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.engine-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ==========================================================================
   Content Body & Multi-Section Views
   ========================================================================== */
.content-body {
  padding: 1.5rem 1.75rem;
  flex-grow: 1;
}

.section-view {
  display: none;
  flex-direction: column;
  gap: 1.5rem;
  animation: fadeIn 0.2s ease forwards;
}

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

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

/* ==========================================================================
   Cards & Layout Primitives
   ========================================================================== */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

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

.card-header-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary);
}

.card-header-title h3, .card-header-title h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.card-body {
  padding: 1.25rem;
}

.dashboard-row {
  display: flex;
  gap: 1.25rem;
}

.card-flex-1 { flex: 1; }
.card-flex-2 { flex: 2; }
.card-span-2 { grid-column: span 2; }

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.metric-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.metric-card.highlight-card {
  border-color: var(--success-border);
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);
}

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

.metric-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bg-blue-subtle { background-color: var(--primary-light); color: var(--primary); }
.bg-red-subtle { background-color: var(--danger-bg); color: var(--danger); }
.bg-amber-subtle { background-color: var(--warning-bg); color: var(--warning-dark); }
.bg-green-subtle { background-color: var(--success-bg); color: var(--success); }
.bg-indigo-subtle { background-color: var(--accent-indigo-light); color: var(--accent-indigo); }

.metric-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
  margin-bottom: 0.25rem;
}

.metric-footer {
  font-size: 0.76rem;
}

/* Revenue Overview Chart Bars */
.revenue-bars-container {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  margin-bottom: 1.5rem;
}

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

.rev-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.rev-bar-track {
  height: 10px;
  background-color: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
}

.rev-bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Baseline Comparison Box */
.baseline-comparison-box {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
}

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

.comparison-header h4 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.comparison-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.comparison-item {
  display: flex;
  flex-direction: column;
}

.comp-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.comp-val {
  font-size: 1.15rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

/* Activity List */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
}

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-grow: 1;
}

.act-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.act-count {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 800;
}

.activity-cta-box {
  margin-top: 1.15rem;
}

/* ==========================================================================
   Table Styling & Filters
   ========================================================================== */
.table-section {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

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

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

.sort-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.form-select-sm {
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-family: var(--font-sans);
  background-color: var(--bg-subtle);
  outline: none;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chip {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-sans);
}

.chip:hover {
  background-color: #e2e8f0;
  color: var(--text-main);
}

.chip.active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: var(--text-inverse);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 260px;
}

.search-wrap svg {
  position: absolute;
  left: 0.85rem;
  color: var(--text-muted);
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  padding: 0.45rem 0.85rem 0.45rem 2.25rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  font-size: 0.82rem;
  font-family: var(--font-sans);
  background-color: var(--bg-subtle);
  transition: all 0.2s ease;
}

.search-wrap input:focus {
  outline: none;
  background-color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.table-container {
  overflow-x: auto;
  max-height: 620px;
}

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

.payment-table thead {
  background-color: var(--bg-subtle);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
}

.payment-table th {
  padding: 0.75rem 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.payment-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  white-space: nowrap;
}

.payment-table tbody tr {
  transition: background-color 0.15s ease;
  cursor: pointer;
}

.payment-table tbody tr:hover {
  background-color: #f8fafc;
}

.payment-table tbody tr.row-selected {
  background-color: var(--primary-light);
}

.tx-mono {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--primary);
}

.amount-mono {
  font-family: var(--font-mono);
  font-weight: 700;
}

/* Badges & Status */
.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-low {
  background-color: var(--success-bg);
  color: var(--success-dark);
  border: 1px solid var(--success-border);
}

.badge-medium {
  background-color: var(--warning-bg);
  color: var(--warning-dark);
  border: 1px solid var(--warning-border);
}

.badge-high {
  background-color: var(--danger-bg);
  color: var(--danger-dark);
  border: 1px solid var(--danger-border);
}

.action-pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.action-retry { background-color: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.action-wait { background-color: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.action-contact { background-color: #fefce8; color: #a16207; border: 1px solid #fef08a; }
.action-alternate, .action-update { background-color: #faf5ff; color: #7e22ce; border: 1px solid #e9d5ff; }
.action-stop { background-color: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.action-recovered { background-color: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; font-weight: 800; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.status-failed { background-color: #fee2e2; color: #991b1b; }
.status-recovered { background-color: #d1fae5; color: #065f46; font-weight: 800; }
.status-contacted { background-color: #fef3c7; color: #92400e; }
.status-stopped { background-color: #f1f5f9; color: #475569; border: 1px solid var(--border); }

.prob-cell-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 110px;
}

.prob-cell-bar {
  flex-grow: 1;
  height: 6px;
  background-color: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
}

.prob-cell-fill {
  height: 100%;
  border-radius: 9999px;
}

.fill-emerald { background-color: var(--success); }
.fill-amber { background-color: var(--warning); }
.fill-rose { background-color: var(--danger); }

.table-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  background-color: var(--bg-subtle);
}

/* Demo Scenarios Fast Bar */
.demo-scenarios-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  box-shadow: var(--shadow-card);
}

.scenarios-header { margin-bottom: 0.75rem; }
.scenarios-title { display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; color: var(--primary-dark); }
.scenarios-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0.75rem; }

.scenario-btn {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.scenario-btn:hover {
  background-color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

.scenario-btn.active { border-color: var(--primary); background-color: var(--primary-light); }
.scenario-number { width: 26px; height: 26px; border-radius: 50%; background-color: var(--text-main); color: #ffffff; font-weight: 700; font-size: 0.78rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.scenario-desc { display: flex; flex-direction: column; }
.scenario-desc strong { font-size: 0.82rem; color: var(--text-main); }
.scenario-desc span { font-size: 0.72rem; color: var(--text-muted); }
.scenario-guard .scenario-number { background-color: var(--danger); }
.scenario-success .scenario-number { background-color: var(--success); }

/* ==========================================================================
   Analytics Charts Styling
   ========================================================================== */
.analytics-header-banner, .lab-header-banner {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  padding: 1.25rem 1.75rem;
  border-radius: var(--radius-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-card);
}

.analytics-header-banner h3, .lab-header-banner h3 {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 0.2rem;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.analytics-chart-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.chart-bar-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.chart-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.chart-bar-track {
  height: 8px;
  background-color: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
}

.chart-bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.4s ease;
}

.outcomes-distribution-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.outcome-box {
  padding: 0.85rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Strategy Lab Grid
   ========================================================================== */
.strategy-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

.strategy-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: transform 0.2s ease;
}

.strategy-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

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

.strat-card-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
}

.strat-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.strat-stat-item {
  background-color: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
}

.strat-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.strat-stat-val {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 800;
}

.strat-reason-box {
  background-color: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.strategy-comparison-mini {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.strat-comp-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  background-color: var(--bg-subtle);
}

.strat-comp-row.best-choice {
  background-color: #ecfdf5;
  color: #065f46;
  font-weight: 700;
  border: 1px solid #a7f3d0;
}

/* ==========================================================================
   Admin & Policies Styling
   ========================================================================== */
.admin-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.5rem;
}

.admin-side-cards {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.policy-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.form-group label {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-main);
}

.form-range {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

.form-control {
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-size: 0.84rem;
  font-family: var(--font-sans);
  background-color: #ffffff;
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-check {
  flex-direction: row;
  align-items: center;
  gap: 0.65rem;
}

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

.guardrails-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.guardrail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 600;
}

.status-grid-mini {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.status-mini-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
}

/* ==========================================================================
   Slide-Over Drawer & Analysis History
   ========================================================================== */
.analysis-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 560px;
  z-index: 100;
  visibility: hidden;
  transition: visibility 0.3s ease;
}

.analysis-drawer.open { visibility: visible; }

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.analysis-drawer.open .drawer-backdrop { opacity: 1; }

.drawer-content {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 560px;
  background-color: var(--bg-card);
  box-shadow: var(--shadow-drawer);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}

.analysis-drawer.open .drawer-content { transform: translateX(0); }

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

.drawer-title-tag { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.35rem; }
.tx-id-badge { font-family: var(--font-mono); font-weight: 700; font-size: 0.9rem; color: var(--primary); background-color: #ffffff; padding: 0.15rem 0.5rem; border-radius: var(--radius-sm); border: 1px solid var(--primary-border); }
.status-pill { font-size: 0.72rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 9999px; }
.scenario-badge { font-size: 0.7rem; font-weight: 600; padding: 0.15rem 0.45rem; border-radius: 9999px; background-color: #fef08a; color: #854d0e; border: 1px solid #fde047; }
.drawer-header h3 { font-size: 1.15rem; font-weight: 700; color: var(--text-main); }

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-close:hover { background-color: #e2e8f0; color: var(--text-main); }
.drawer-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 1.25rem; }
.drawer-section { display: flex; flex-direction: column; gap: 0.5rem; }
.drawer-section-title { font-size: 0.72rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.facts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.fact-box { background-color: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0.75rem 1rem; display: flex; flex-direction: column; }
.fact-label { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; margin-bottom: 0.2rem; }
.fact-value { font-size: 0.95rem; font-weight: 700; color: var(--text-main); }

/* Recovery Guard Card */
.guard-card {
  border: 1.5px solid var(--success-border);
  background-color: #f0fdf4;
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  transition: all 0.2s ease;
}

.guard-card.blocked { border-color: var(--danger-border); background-color: #fef2f2; }
.guard-card.recovered { border-color: var(--success-border); background-color: #ecfdf5; }
.guard-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.guard-icon { width: 36px; height: 36px; border-radius: var(--radius-md); background-color: #dcfce7; color: #16a34a; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.guard-card.blocked .guard-icon { background-color: #fee2e2; color: #dc2626; }
.guard-card.recovered .guard-icon { background-color: #d1fae5; color: #059669; }
.guard-title-wrap h4 { font-size: 0.75rem; font-weight: 800; letter-spacing: 0.05em; color: var(--text-secondary); }
.guard-status-badge { font-size: 0.78rem; font-weight: 800; color: #15803d; font-family: var(--font-mono); }
.guard-card.blocked .guard-status-badge { color: #b91c1c; }
.guard-card.recovered .guard-status-badge { color: #065f46; font-size: 0.85rem; }
.guard-meter { margin-bottom: 0.65rem; }
.meter-label { display: flex; justify-content: space-between; font-size: 0.76rem; color: var(--text-secondary); margin-bottom: 0.35rem; }
.meter-track { height: 8px; background-color: #e2e8f0; border-radius: 9999px; overflow: hidden; }
.meter-fill { height: 100%; background-color: var(--success); border-radius: 9999px; transition: width 0.3s ease; }
.guard-card.blocked .meter-fill { background-color: var(--danger); }
.guard-card.recovered .meter-fill { background-color: var(--success); }
.guard-explanation { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.4; }

/* AI Analysis Card */
.ai-analysis-card {
  border: 1px solid #bfdbfe;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
}

.ai-analysis-card.state-resolved {
  border-color: var(--success-border);
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);
}

.ai-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.ai-header-left { display: flex; align-items: center; gap: 0.5rem; color: var(--primary); }
.ai-header-left h4 { font-size: 0.95rem; font-weight: 700; color: var(--text-main); }
.engine-tag { font-size: 0.7rem; font-weight: 600; padding: 0.2rem 0.5rem; border-radius: 9999px; background-color: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.ai-stats-row { display: grid; grid-template-columns: 1.3fr 1fr 1.3fr; gap: 0.75rem; margin-bottom: 1rem; }
.ai-stat-box { background-color: var(--bg-subtle); border-radius: var(--radius-md); padding: 0.65rem 0.75rem; display: flex; flex-direction: column; }
.ai-stat-label { font-size: 0.68rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; margin-bottom: 0.25rem; }
.ai-prob-row { display: flex; align-items: center; gap: 0.5rem; }
.ai-prob-number { font-family: var(--font-mono); font-size: 1.2rem; font-weight: 800; color: var(--primary); }
.prob-bar-wrap { flex-grow: 1; height: 6px; background-color: #e2e8f0; border-radius: 9999px; overflow: hidden; }
.prob-bar-fill { height: 100%; background-color: var(--primary); border-radius: 9999px; transition: width 0.4s ease; }
.risk-badge { font-size: 0.8rem; font-weight: 800; text-transform: uppercase; }
.action-badge { font-size: 0.74rem; font-weight: 700; font-family: var(--font-mono); }

.ai-reason-box { background-color: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0.85rem; }
.reason-title { display: flex; align-items: center; gap: 0.35rem; font-size: 0.74rem; font-weight: 700; color: var(--text-secondary); margin-bottom: 0.35rem; text-transform: uppercase; }
.ai-reason-box p { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.45; }

/* Simulation Banner */
.simulation-banner { background-color: #ecfdf5; border: 1.5px solid var(--success-border); border-radius: var(--radius-lg); padding: 1rem; animation: slideDown 0.3s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.simulation-banner.sim-failed { background-color: #fef2f2; border-color: var(--danger-border); }
.simulation-banner.sim-blocked { background-color: #fffbeb; border-color: var(--warning-border); }
.sim-header { display: flex; align-items: center; gap: 0.65rem; margin-bottom: 0.5rem; }
.sim-icon { width: 28px; height: 28px; border-radius: 50%; background-color: #d1fae5; color: #059669; display: flex; align-items: center; justify-content: center; }
.simulation-banner.sim-failed .sim-icon { background-color: #fee2e2; color: #dc2626; }
.simulation-banner.sim-blocked .sim-icon { background-color: #fef3c7; color: #d97706; }
.sim-title-group strong { font-size: 0.85rem; color: var(--text-main); }
.sim-detail-row { display: flex; justify-content: space-between; margin-bottom: 0.25rem; font-size: 0.82rem; }
.sim-message { margin-top: 0.45rem; color: var(--text-secondary); font-size: 0.78rem; line-height: 1.35; }

/* Action Buttons */
.action-buttons-group { display: grid; grid-template-columns: 1.3fr 1fr; gap: 0.75rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; font-family: var(--font-sans); font-size: 0.84rem; font-weight: 600; padding: 0.65rem 1rem; border-radius: var(--radius-md); border: 1px solid transparent; cursor: pointer; transition: all 0.15s ease; }
.btn-primary { background-color: var(--primary); color: #ffffff; }
.btn-primary:hover:not(:disabled) { background-color: var(--primary-dark); box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35); }
.btn-secondary { background-color: #ffffff; border-color: var(--border); color: var(--text-main); }
.btn-secondary:hover:not(:disabled) { background-color: var(--bg-subtle); border-color: var(--border-focus); }
.btn-outline { background-color: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { background-color: var(--bg-subtle); color: var(--text-main); }
.btn-block { width: 100%; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.78rem; }
.btn-xs { padding: 0.22rem 0.55rem; font-size: 0.72rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(0.6); }

/* Customer Message Section */
.customer-message-section { border: 1px solid var(--border); background-color: #ffffff; border-radius: var(--radius-lg); padding: 1.15rem; box-shadow: var(--shadow-card); }
.message-section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.msg-title { display: flex; align-items: center; gap: 0.45rem; color: var(--accent-indigo); }
.msg-title h4 { font-size: 0.88rem; font-weight: 700; color: var(--text-main); }
.message-bubble { background-color: #f8fafc; border: 1px solid #e2e8f0; border-radius: var(--radius-md); padding: 0.85rem; font-size: 0.82rem; line-height: 1.45; color: var(--text-secondary); }

/* Analysis History Timeline */
.history-section { border: 1px solid var(--border); background-color: #ffffff; border-radius: var(--radius-lg); padding: 1.15rem; }
.history-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; color: var(--primary); }
.history-header h4 { font-size: 0.85rem; font-weight: 700; color: var(--text-main); }
.history-timeline { display: flex; flex-direction: column; gap: 0.65rem; max-height: 220px; overflow-y: auto; }
.history-item { background-color: var(--bg-subtle); border-radius: var(--radius-md); padding: 0.65rem 0.85rem; font-size: 0.78rem; display: flex; flex-direction: column; gap: 0.2rem; }
.hist-item-top { display: flex; justify-content: space-between; font-weight: 700; }

/* Modals */
.audit-modal { border: none; background: transparent; padding: 1rem; max-width: 720px; width: 95%; margin: auto; }
.audit-modal::backdrop { background-color: rgba(15, 23, 42, 0.5); backdrop-filter: blur(3px); }
.modal-card { background-color: #ffffff; border-radius: var(--radius-xl); box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); overflow: hidden; display: flex; flex-direction: column; max-height: 85vh; }
.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background-color: var(--bg-subtle); }
.modal-title-wrap { display: flex; align-items: center; gap: 0.75rem; }
.modal-icon { width: 38px; height: 38px; border-radius: var(--radius-md); background-color: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.modal-title-wrap h3 { font-size: 1.05rem; font-weight: 700; }
.modal-body { padding: 1.5rem; overflow-y: auto; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background-color: var(--bg-subtle); }

.audit-timeline { display: flex; flex-direction: column; gap: 1rem; position: relative; padding-left: 1rem; }
.audit-timeline::before { content: ''; position: absolute; top: 8px; bottom: 8px; left: 3px; width: 2px; background-color: var(--border); }
.audit-item { position: relative; display: flex; flex-direction: column; gap: 0.25rem; }
.audit-dot { position: absolute; left: -17px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background-color: var(--primary); border: 2px solid #ffffff; box-shadow: 0 0 0 2px var(--border); }
.audit-item-header { display: flex; align-items: center; gap: 0.6rem; font-size: 0.75rem; }
.audit-time { font-family: var(--font-mono); color: var(--text-muted); font-weight: 600; }
.audit-tag { padding: 0.1rem 0.45rem; border-radius: 9999px; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; }
.audit-item p { font-size: 0.82rem; color: var(--text-secondary); }

/* Toasts */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; display: flex; flex-direction: column; gap: 0.6rem; z-index: 200; }
.toast { background-color: #0f172a; color: #ffffff; padding: 0.75rem 1.15rem; border-radius: var(--radius-md); font-size: 0.82rem; box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3); display: flex; align-items: center; gap: 0.6rem; animation: toastIn 0.25s ease forwards; max-width: 380px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.toast.toast-success { border-left: 4px solid var(--success); }
.toast.toast-error { border-left: 4px solid var(--danger); }
.toast.toast-warning { border-left: 4px solid var(--warning); }

/* Utility */
.badge-tag { font-size: 0.7rem; font-weight: 700; padding: 0.2rem 0.55rem; border-radius: 9999px; background-color: rgba(255, 255, 255, 0.15); color: #ffffff; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-emerald { color: var(--success); }
.text-emerald-dark { color: var(--success-dark); }
.text-amber { color: var(--warning-dark); }
.text-center { text-align: center; }
.py-5 { padding-top: 2rem; padding-bottom: 2rem; }

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(37, 99, 235, 0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 0.5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive layout */
@media (max-width: 1080px) {
  .charts-grid { grid-template-columns: 1fr; }
  .card-span-2 { grid-column: span 1; }
  .admin-grid { grid-template-columns: 1fr; }
  .dashboard-row { flex-direction: column; }
}

@media (max-width: 860px) {
  .app-sidebar {
    position: fixed;
    transform: translateX(-100%);
  }
  .app-sidebar.open {
    transform: translateX(0);
  }
  .mobile-toggle-btn {
    display: inline-flex;
  }
  .topbar-right .engine-indicator {
    display: none;
  }
}


/* ==========================================================================
   ADVANCED ANALYTICS VISUALIZATIONS STYLES
   ========================================================================== */
.analytics-two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 1080px) {
  .analytics-two-col-grid {
    grid-template-columns: 1fr;
  }
}

.chart-legend-pills {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* Trend Line/Area Chart */
.trend-chart-container {
  width: 100%;
  min-height: 280px;
  position: relative;
}

.trend-svg-wrap {
  width: 100%;
  height: 280px;
  overflow: visible;
}

.chart-axis-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  fill: #64748b;
}

.chart-grid-line {
  stroke: #e2e8f0;
  stroke-dasharray: 4 4;
}

/* Donut Chart */
.donut-chart-container {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 1.5rem;
  min-height: 260px;
  flex-wrap: wrap;
}

.donut-svg-wrap {
  position: relative;
  width: 200px;
  height: 200px;
  flex-shrink: 0;
}

.donut-center-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.donut-center-title {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.donut-center-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 2px;
}

.donut-legend-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem 1rem;
  flex-grow: 1;
  max-width: 380px;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.76rem;
}

.donut-legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.donut-legend-name {
  color: var(--text-secondary);
  font-weight: 500;
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.donut-legend-stat {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-main);
}

/* Channel Bars */
.channel-chart-container {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.channel-bar-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.channel-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

.channel-name {
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.channel-stats {
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

/* Actions Chart */
.actions-chart-container {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.action-bar-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.action-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

.action-label-title {
  font-weight: 600;
  color: var(--text-main);
}

.action-stat-pill {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
}

/* Strategy Performance Table */
.strategy-perf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.strategy-perf-table th {
  text-align: left;
  padding: 0.5rem 0.6rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
}

.strategy-perf-table td {
  padding: 0.6rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.strategy-perf-table tr:last-child td {
  border-bottom: none;
}

/* Failure Strategy Mapping Cards */
.failure-strat-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

@media (max-width: 680px) {
  .failure-strat-list {
    grid-template-columns: 1fr;
  }
}

.failure-strat-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.failure-strat-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.failure-strat-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
}

.failure-strat-rate {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--success-dark);
}

.failure-strat-reason {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* Decision Quality Grid */
.decision-quality-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dq-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

@media (max-width: 768px) {
  .dq-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

.dq-stat-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.dq-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.dq-stat-value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
}

.dq-badges-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.dq-badge-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.76rem;
  font-weight: 600;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
}

/* Horizontal Comparison Grid */
.comparison-grid-horizontal {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  padding: 0.5rem 0;
}

@media (max-width: 860px) {
  .comparison-grid-horizontal {
    grid-template-columns: 1fr 1fr;
  }
}

.comp-h-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
}

.comp-h-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.comp-h-val {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 800;
}

/* Metric Definitions */
.metric-definitions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 860px) {
  .metric-definitions-grid {
    grid-template-columns: 1fr;
  }
}

.def-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem;
}

.def-item strong {
  display: block;
  font-size: 0.84rem;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.def-item p {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0;
}

.def-item code {
  font-family: var(--font-mono);
  background: #e2e8f0;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  font-size: 0.74rem;
}

/* Interactive Floating Tooltip */
.chart-tooltip {
  position: absolute;
  background: #0f172a;
  color: #ffffff;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.74rem;
  pointer-events: none;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: opacity 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -120%);
}

.chart-tooltip.visible {
  opacity: 1;
}

.chart-tooltip strong {
  display: block;
  margin-bottom: 0.15rem;
  color: #f8fafc;
}

/* ==========================================================================
   RecoverAI 8-Section Navigation & Workspace Extensions
   ========================================================================== */

/* Brand Subtitle */
.brand-subtitle {
  font-size: 0.65rem;
  color: #94a3b8;
  margin-top: 0.15rem;
  line-height: 1.2;
}

/* Topbar Brand Row & Badges */
.topbar-brand-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.topbar-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  letter-spacing: 0.03em;
}

.topbar-status-badge .pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}

.backend-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #4338ca;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  font-family: var(--font-mono);
}

.backend-status-badge .backend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6366f1;
}

/* Dashboard Sentinel Alert Banner */
.sentinel-alert-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
  flex-wrap: wrap;
}

.sentinel-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(37, 99, 235, 0.25);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.sentinel-alerts-list {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: #cbd5e1;
}

.sentinel-item strong {
  color: #ffffff;
}

/* Dashboard Charts Grid */
.dashboard-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

@media (max-width: 960px) {
  .dashboard-charts-grid {
    grid-template-columns: 1fr;
  }
}

.mini-legend {
  font-size: 0.72rem;
}

/* AI Analyzer Workspace Styles */
.analyzer-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.analyzer-tx-selector-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-subtle);
}

.analyzer-tx-selector-wrap label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.analyzer-tx-selector-wrap select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.6rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  background-color: var(--bg-subtle);
  outline: none;
}

.analyzer-pills-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.analyzer-pills-bar .pill-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
}

.mini-scenario-pill {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.mini-scenario-pill:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
  border-color: #cbd5e1;
}

.mini-scenario-pill.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

.analyzer-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 960px) {
  .analyzer-grid {
    grid-template-columns: 1fr;
  }
}

.an-meta-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.an-meta-tx {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--bg-subtle);
  color: var(--primary);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  margin-bottom: 0.35rem;
}

.an-meta-customer {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.an-meta-amount-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-align: right;
}

.an-meta-amount {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 800;
}

.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.telemetry-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
}

.tel-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.tel-val {
  font-size: 0.84rem;
  font-weight: 700;
}

.an-decision-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.an-prob-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem;
}

.an-prob-big {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 800;
  color: var(--emerald);
  line-height: 1;
}

.an-strat-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem;
}

/* Strategy Lab Visual Flow Architecture */
.strategy-flow-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.5rem 0;
}

.flow-step {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.85rem;
  flex: 1;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  position: relative;
}

.flow-step.highlight-step {
  background: #eff6ff;
  border-color: #93c5fd;
}

.flow-step.success-step {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.flow-step-number {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #0f172a;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flow-step.highlight-step .flow-step-number {
  background: var(--primary);
}

.flow-step.success-step .flow-step-number {
  background: var(--success);
}

.flow-step-content strong {
  display: block;
  font-size: 0.78rem;
  color: var(--text-main);
  line-height: 1.3;
}

.flow-step-content span {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.3;
  display: block;
}

.flow-arrow {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 700;
  flex-shrink: 0;
}

/* Simulation Lab Workspace Styles */
.simulation-lab-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 1.5rem;
}

@media (max-width: 960px) {
  .simulation-lab-grid {
    grid-template-columns: 1fr;
  }
}

.distribution-pill-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

.dist-pill {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.sim-progress-container {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
}

.sim-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.sim-progress-track {
  height: 8px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
}

.sim-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--success) 100%);
  border-radius: 9999px;
  transition: width 0.25s ease;
}

.sim-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

@media (max-width: 680px) {
  .sim-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.sim-kpi-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
}

.sim-kpi-box.highlight-box {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.sim-kpi-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.sim-kpi-val {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 800;
}

/* Compliance Audit Ledger Styles */
.compliance-header-banner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.compliance-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.audit-filter-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.audit-ledger-table th,
.audit-ledger-table td {
  padding: 0.7rem 0.75rem;
  font-size: 0.8rem;
}

.audit-ledger-table td {
  font-family: var(--font-mono);
  font-size: 0.76rem;
}
