/* ============================================================
   Trinetra SOC — light palette override (indigo + violet)
   Targets the existing dark-theme variable names used across
   /opt/trinetra-health/*.html so we swap the look without
   rewriting every page.
   Load this AFTER the page's inline <style> so it wins.
   ============================================================ */

:root, html, body {
  /* Old "bk-*" vars (used in console + tenant + reports + onboard + agent-enroll + settings + audit) */
  --bk-dark:        #ffffff;
  --bk-bg:          #fafbfc;
  --bk-panel:       #ffffff;
  --bk-panel-2:     #f7f8fa;
  --bk-border:      #e7e9ee;
  --bk-border-2:    #d0d4dc;
  --bk-text:        #1c1f26;
  --bk-text-muted:  #5b6478;
  --bk-text-mute:   #8a90a0;
  --bk-accent:      #4338CA;
  --bk-accent-glow: rgba(67, 56, 202, 0.18);
  --bk-violet:      #7C3AED;
  --bk-p1:          #dc2626;
  --bk-p2:          #d97706;
  --bk-p3:          #ca8a04;
  --bk-p4:          #2563eb;
  --bk-ok:          #16a34a;
  --bk-gold:        #b45309;
  --bk-info:        #2563eb;
}

/* Override page background gradients */
body {
  background: #fafbfc !important;
  background-image: none !important;
  color: #1c1f26 !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, 'Segoe UI', Roboto, sans-serif !important;
  -webkit-font-smoothing: antialiased;
}

/* Header (sticky) — flip dark to light */
header {
  background: rgba(255, 255, 255, 0.95) !important;
  border-bottom: 1px solid #e7e9ee !important;
  backdrop-filter: blur(12px) !important;
}

/* Brand logo — indigo→violet gradient */
.logo, .brand-mark, .brand .logo {
  background: linear-gradient(135deg, #4338CA 0%, #7C3AED 100%) !important;
  color: white !important;
  box-shadow: 0 6px 20px rgba(67, 56, 202, 0.22) !important;
}

/* Section title / muted text */
.section-title, .panel-title, .generator-title, .page-heading p {
  color: #5b6478 !important;
}

/* Cards, panels */
.tenant-card, .kpi, .panel, .comp-card, .quick-card, .step-card, .schedule-row, .feature-card, .price-card,
.client-hero {
  background: #ffffff !important;
  border: 1px solid #e7e9ee !important;
  box-shadow: none !important;
}
.tenant-card:hover, .quick-card:hover, .feature-card:hover, .price-card:hover {
  border-color: #4338CA !important;
  box-shadow: 0 1px 2px rgba(28, 31, 38, 0.04), 0 4px 14px rgba(28, 31, 38, 0.05) !important;
  transform: translateY(-1px);
}

/* KPI accent strip */
.kpi::before { background: #4338CA !important; }
.kpi.p1::before { background: #dc2626 !important; }
.kpi.p2::before { background: #d97706 !important; }
.kpi.p3::before { background: #ca8a04 !important; }
.kpi.p4::before { background: #2563eb !important; }

/* Tier badges */
.tier-platinum { background: rgba(0,0,0,0.05) !important; color: #1c1f26 !important; }
.tier-gold     { background: rgba(180, 83, 9, 0.10) !important; color: #b45309 !important; }
.tier-silver   { background: rgba(0,0,0,0.05) !important; color: #5b6478 !important; }

/* Compliance tags inside tenant cards (and elsewhere) */
.tag { background: #f7f8fa !important; color: #5b6478 !important; border: 1px solid #e7e9ee !important; }
.tag.sebi  { background: rgba(37, 99, 235, 0.08) !important; color: #2563eb !important; border-color: transparent !important; }
.tag.rbi   { background: rgba(67, 56, 202, 0.10) !important; color: #4338CA !important; border-color: transparent !important; }
.tag.irdai { background: rgba(217, 119, 6, 0.10) !important; color: #b45309 !important; border-color: transparent !important; }
.tag.dpdp  { background: rgba(202, 138, 4, 0.10) !important; color: #92400e !important; border-color: transparent !important; }
.tag.iso   { background: rgba(109, 40, 217, 0.10) !important; color: #6d28d9 !important; border-color: transparent !important; }
.tag.tier  { background: rgba(180, 83, 9, 0.10) !important; color: #b45309 !important; border-color: transparent !important; }

/* Priority pills */
.priority-pill { font-weight: 700 !important; }
.priority-pill.P1 { background: rgba(220, 38, 38, 0.10) !important; color: #dc2626 !important; }
.priority-pill.P2 { background: rgba(217, 119, 6, 0.10) !important; color: #d97706 !important; }
.priority-pill.P3 { background: rgba(202, 138, 4, 0.10) !important; color: #ca8a04 !important; }
.priority-pill.P4 { background: rgba(37, 99, 235, 0.08) !important; color: #2563eb !important; }

/* Stat numbers */
.stat-num    { color: #1c1f26 !important; }
.stat-num.p1 { color: #dc2626 !important; }
.stat-num.p2 { color: #d97706 !important; }
.stat-num.p3 { color: #ca8a04 !important; }
.stat-num.p4 { color: #5b6478 !important; }
.stat-lbl    { color: #8a90a0 !important; }

/* Tables (alerts, reports, agents) */
.alerts-table, .reports, .agent-table, table.sla {
  background: #ffffff !important;
}
.alerts-table th, .reports th, .agent-table th, table.sla th {
  background: #f7f8fa !important;
  color: #5b6478 !important;
  border-bottom: 1px solid #e7e9ee !important;
}
table.sla th { background: #1c1f26 !important; color: #ffffff !important; }
.alerts-table td, .reports td, .agent-table td, table.sla td {
  border-bottom: 1px solid #e7e9ee !important;
}
.alerts-table tr:hover td, .reports tr:hover td { background: rgba(67, 56, 202, 0.04) !important; }
table.sla tr:nth-child(even) td { background: #fafbfc !important; }

/* Sub-elements that often go dark */
.tenant-name, .schedule-name, .agent-info, .kpi-value, .kpi-label, .kpi-sub,
.tenant-stats, .tenant-code, .health-dot,
.comp-card h4, .comp-numbers {
  color: inherit !important;
}
.tenant-name { color: #1c1f26 !important; font-weight: 600 !important; }
.tenant-code { color: #8a90a0 !important; font-family: 'JetBrains Mono', monospace !important; }
.kpi-value { color: #1c1f26 !important; }
.kpi-label, .kpi-sub { color: #5b6478 !important; }

/* Agent bars */
.agent-bar { background: #e7e9ee !important; }
.agent-bar-fill { background: linear-gradient(90deg, #4338CA, #7C3AED) !important; }

/* Compliance meters */
.comp-meter { background: #e7e9ee !important; }
.comp-meter-fill { background: linear-gradient(90deg, #4338CA, #7C3AED) !important; }
.comp-meter-fill.warn { background: linear-gradient(90deg, #d97706, #ca8a04) !important; }
.comp-meter-fill.crit { background: linear-gradient(90deg, #dc2626, #d97706) !important; }

/* Forms */
input, select, textarea {
  background: #ffffff !important;
  color: #1c1f26 !important;
  border: 1px solid #d0d4dc !important;
}
input:focus, select:focus, textarea:focus {
  outline: 0 !important;
  border-color: #4338CA !important;
  box-shadow: 0 0 0 3px rgba(67, 56, 202, 0.14) !important;
}
.form-group label { color: #5b6478 !important; }

/* Buttons (.btn legacy class — used in onboard, reports, settings, audit) */
.btn { background: linear-gradient(135deg, #4338CA 0%, #7C3AED 100%) !important; color: white !important; border: 0 !important; box-shadow: 0 6px 20px rgba(67,56,202,0.22) !important; transition: transform 0.15s !important; }
.btn:hover { transform: translateY(-1px) !important; }
.btn.outline {
  background: transparent !important;
  color: #1c1f26 !important;
  border: 1px solid #d0d4dc !important;
  box-shadow: none !important;
}
.btn.outline:hover { border-color: #4338CA !important; color: #4338CA !important; }
.btn.danger { background: #dc2626 !important; box-shadow: 0 6px 18px rgba(220,38,38,0.18) !important; }
.btn-small { padding: 6px 12px !important; font-size: 11px !important; }

/* Toggle (schedule rows) */
.toggle { background: #d0d4dc !important; }
.toggle.on { background: #4338CA !important; }

/* Footer */
footer {
  background: #f7f8fa !important;
  color: #5b6478 !important;
  border-top: 1px solid #e7e9ee !important;
}
footer .gold { color: #b45309 !important; }

/* Compliance posture status text */
.control-status.met     { color: #16a34a !important; }
.control-status.partial { color: #d97706 !important; }
.control-status.gap     { color: #dc2626 !important; }

/* Action pill (audit log) */
.action-pill { background: rgba(37, 99, 235, 0.08) !important; color: #2563eb !important; }

/* Badge variants in tables */
.badge.compliance { background: rgba(67, 56, 202, 0.10) !important; color: #3730A3 !important; }
.badge.system     { background: rgba(37, 99, 235, 0.10) !important; color: #2563eb !important; }
.badge.weekly     { background: rgba(180, 83, 9, 0.10) !important; color: #b45309 !important; }
.badge.monthly    { background: rgba(124, 58, 237, 0.10) !important; color: #6d28d9 !important; }
.badge.quarterly  { background: rgba(217, 119, 6, 0.10) !important; color: #d97706 !important; }
.badge.open       { background: rgba(220, 38, 38, 0.10) !important; color: #dc2626 !important; }
.badge.closed     { background: rgba(0, 0, 0, 0.05) !important; color: #5b6478 !important; }
.badge.success    { background: rgba(22, 163, 74, 0.10) !important; color: #16a34a !important; }
.badge.failure    { background: rgba(220, 38, 38, 0.10) !important; color: #dc2626 !important; }
.badge.pending    { background: rgba(37, 99, 235, 0.08) !important; color: #2563eb !important; }
.badge.ok         { background: rgba(22, 163, 74, 0.10) !important; color: #16a34a !important; }
.badge.fail       { background: rgba(220, 38, 38, 0.10) !important; color: #dc2626 !important; }

/* Tenant ref / monospace inline tags */
.tenant-ref { color: #3730A3 !important; font-family: 'JetBrains Mono', monospace !important; }

/* Filter pills (audit) */
.filter-pill { background: #ffffff !important; border: 1px solid #e7e9ee !important; color: #5b6478 !important; }
.filter-pill:hover, .filter-pill.active { border-color: #4338CA !important; color: #3730A3 !important; background: rgba(67, 56, 202, 0.04) !important; }

/* Empty states inside tables */
.empty { color: #8a90a0 !important; }

/* SVG chart areas (chart-area) */
.chart-area { background: #fafbfc; border-radius: 6px; }

/* Generator card (onboard, reports) */
.generator { background: #ffffff !important; border-left: 4px solid #4338CA !important; }

/* Notice banners (client hero, info-banner) */
.notice, .info-banner {
  background: rgba(67, 56, 202, 0.04) !important;
  border: 1px solid rgba(67, 56, 202, 0.20) !important;
  color: #5b6478 !important;
}
.info-banner strong { color: #1c1f26 !important; }
.info-banner code   { background: rgba(0,0,0,0.04) !important; color: #3730A3 !important; }
.client-hero { border-left: 4px solid #b45309 !important; }

/* Tier-cards in onboard */
.tier-card { background: #fafbfc !important; border: 2px solid #e7e9ee !important; }
.tier-card.selected { background: rgba(67, 56, 202, 0.04) !important; border-color: #4338CA !important; }
.tier-card:hover { border-color: #4338CA !important; }

/* Modal dialogs (used in onboard, reports) */
.modal-backdrop { background: rgba(28, 31, 38, 0.45) !important; }
.modal {
  background: #ffffff !important;
  border: 1px solid #e7e9ee !important;
  box-shadow: 0 20px 60px rgba(28, 31, 38, 0.16) !important;
}
.modal-row { border-bottom: 1px solid #e7e9ee !important; }
.modal-row .lbl { color: #5b6478 !important; }

/* Role / breadcrumb / user pill */
.role-badge {
  background: rgba(67, 56, 202, 0.10) !important;
  border: 1px solid rgba(67, 56, 202, 0.30) !important;
  color: #3730A3 !important;
}
.breadcrumb { color: #5b6478 !important; }
.breadcrumb a { color: #4338CA !important; }
.breadcrumb .sep { color: #d0d4dc !important; }

/* The "+ Onboard tenant" CTA in master dashboard header (was teal on dark) */
.top-meta a {
  color: #4338CA !important;
  border-color: #4338CA !important;
  background: rgba(67, 56, 202, 0.05) !important;
}

/* Console shell sidebar — overridden in JS too but provide CSS safety net */
.tcs-sidebar {
  background: #ffffff !important;
  border-right: 1px solid #e7e9ee !important;
}
.tcs-brand .name { color: #1c1f26 !important; }
.tcs-brand .tag  { color: #8a90a0 !important; }
.tcs-nav a       { color: #5b6478 !important; }
.tcs-nav a:hover { background: rgba(67, 56, 202, 0.06) !important; color: #1c1f26 !important; }
.tcs-nav a.active{ background: rgba(67, 56, 202, 0.10) !important; color: #3730A3 !important; box-shadow: inset 2px 0 0 #4338CA !important; }
.tcs-nav-group-label { color: #8a90a0 !important; }
.tcs-user { border-top: 1px solid #e7e9ee !important; }
.tcs-avatar {
  background: linear-gradient(135deg, #4338CA 0%, #7C3AED 100%) !important;
  color: white !important;
  border: none !important;
}
.tcs-user .email { color: #1c1f26 !important; }
.tcs-user .role  { color: #8a90a0 !important; }
.tcs-logout { border-color: #e7e9ee !important; color: #5b6478 !important; }
.tcs-logout:hover { border-color: #dc2626 !important; color: #dc2626 !important; }
.tcs-main { background: #fafbfc !important; }
.tcs-topbar {
  background: rgba(255, 255, 255, 0.95) !important;
  border-bottom: 1px solid #e7e9ee !important;
}
.tcs-page-title { color: #1c1f26 !important; }
.tcs-breadcrumb { color: #8a90a0 !important; }
.tcs-clock      { background: #f7f8fa !important; color: #5b6478 !important; }
.tcs-live-dot   { background: #4338CA !important; box-shadow: 0 0 8px #4338CA !important; }

/* Toasts */
.tcs-toast { background: #ffffff !important; border: 1px solid #e7e9ee !important; border-left: 4px solid #4338CA !important; color: #1c1f26 !important; box-shadow: 0 4px 14px rgba(28,31,38,0.10) !important; }
.tcs-toast.error { border-left-color: #dc2626 !important; }
.tcs-toast.warn  { border-left-color: #d97706 !important; }
.tcs-toast .b    { color: #5b6478 !important; }

/* Sparkline labels (legacy dashboard) */
.spark-axis { color: #8a90a0 !important; }

/* Logo letter accent inside .logo */
.logo { color: #ffffff !important; }
