/* ==========================================================================
   easyJet Flight Ops Analytics — Design System
   Version 2.0 | 2026
   ========================================================================== */

/* --- Google Fonts -------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- Design Tokens (Custom Properties) ----------------------------------- */
:root {
  /* Brand */
  --ej-orange:        #FF6600;
  --ej-orange-hover:  #E85D00;
  --ej-orange-light:  #FFF0E6;
  --ej-orange-subtle: rgba(255, 102, 0, 0.08);

  /* Neutrals */
  --sidebar-bg:       #2D2D2D;
  --sidebar-hover:    #3A3A3A;
  --sidebar-active:   #353535;
  --content-bg:       #F5F6FA;
  --card-bg:          #FFFFFF;
  --text-primary:     #1A1A2E;
  --text-secondary:   #6B7280;
  --text-muted:       #9CA3AF;
  --border-color:     #E5E7EB;
  --border-light:     #F0F0F0;

  /* RAG Status */
  --rag-green:        #00A86B;
  --rag-amber:        #FFB800;
  --rag-red:          #DC3545;
  --rag-green-bg:     rgba(0, 168, 107, 0.08);
  --rag-amber-bg:     rgba(255, 184, 0, 0.08);
  --rag-red-bg:       rgba(220, 53, 69, 0.08);

  /* Layout */
  --sidebar-width:    240px;
  --topbar-height:    56px;

  /* Elevation */
  --shadow-sm:        0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md:        0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg:        0 4px 16px rgba(0, 0, 0, 0.10);
  --shadow-card:      0 1px 4px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.02);

  /* Radii */
  --radius-sm:        6px;
  --radius-md:        8px;
  --radius-lg:        12px;
  --radius-xl:        16px;
  --radius-full:      9999px;

  /* Transitions */
  --ease-default:     cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast:    150ms;
  --duration-normal:  250ms;
}


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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--content-bg);
  overflow-x: hidden;
}

a {
  color: var(--ej-orange);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-default);
}

a:hover {
  color: var(--ej-orange-hover);
}

img {
  max-width: 100%;
  display: block;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

h1 { font-size: 1.625rem; letter-spacing: -0.02em; }
h2 { font-size: 1.375rem; letter-spacing: -0.015em; }
h3 { font-size: 1.125rem; letter-spacing: -0.01em; }
h4 { font-size: 1rem; }
h5 { font-size: 0.875rem; }
h6 { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); }


/* --- Page Transition Animation ------------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-content,
.main-content {
  animation: fadeIn 0.3s ease both;
}


/* ==========================================================================
   LAYOUT — Sidebar + Main
   ========================================================================== */

/* --- Sidebar ------------------------------------------------------------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo img {
  height: 28px;
  width: auto;
}

.sidebar-logo .logo-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.01em;
}

.sidebar-logo .logo-text span {
  color: var(--ej-orange);
}

.sidebar-label {
  display: block;
  padding: 20px 20px 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.35);
}

/* --- Navigation Links ---------------------------------------------------- */
.sidebar-nav {
  flex: 1;
  padding: 8px 0;
}

.sidebar-nav ul {
  list-style: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.65);
  border-left: 3px solid transparent;
  transition: all var(--duration-fast) var(--ease-default);
  cursor: pointer;
  text-decoration: none;
  position: relative;
}

.nav-link:hover {
  color: #FFFFFF;
  background: var(--sidebar-hover);
  border-left-color: rgba(255, 102, 0, 0.4);
}

.nav-link.active {
  color: #FFFFFF;
  background: var(--sidebar-active);
  border-left-color: var(--ej-orange);
  font-weight: 600;
}

.nav-link .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.6;
}

.nav-link.active .nav-icon {
  opacity: 1;
}

.nav-link .nav-badge {
  margin-left: auto;
  background: var(--ej-orange);
  color: #FFFFFF;
  font-size: 0.625rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  line-height: 1.4;
}

/* --- Sidebar Footer / Year Selector -------------------------------------- */
.sidebar-footer {
  padding: 16px 20px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.year-selector {
  width: 100%;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color var(--duration-fast) var(--ease-default);
}

.year-selector:hover,
.year-selector:focus {
  border-color: var(--ej-orange);
  outline: none;
}

.year-selector option {
  background: var(--sidebar-bg);
  color: #FFFFFF;
}

.sidebar-footer label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.35);
  margin-bottom: 8px;
}


/* --- Main Content Area --------------------------------------------------- */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  background: var(--content-bg);
}


/* --- Top Bar (Sticky) ---------------------------------------------------- */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  /* Layout: [toggle button] [page title — eats spare width] [actions group at right].
     Title carries flex:1 so the actions group sits flush right without
     needing justify-content:space-between (which would float the title
     in the middle once we added the button as a third child). */
  padding: 0 24px 0 18px;
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.92);
  gap: 14px;
}

.top-bar-title { flex: 1; }

.top-bar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-bar-breadcrumb {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.top-bar-breadcrumb span {
  color: var(--text-primary);
  font-weight: 500;
}


/* --- Page Container ------------------------------------------------------ */
.page-content {
  padding: 28px 32px 48px;
  max-width: 1440px;
  margin: 0 auto;
}

/* --- Page sections (one shows at a time) -------------------------------- */
.page-section {
  display: none;
  animation: fadeIn 0.3s ease both;
}

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


/* ==========================================================================
   HERO BANNER
   ========================================================================== */
.hero-banner {
  background: linear-gradient(135deg, #FFF0E6 0%, #FFFFFF 60%);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  margin-bottom: 28px;
  border: 1px solid rgba(255, 102, 0, 0.08);
  position: relative;
  overflow: hidden;
}

.hero-banner::after {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(255, 102, 0, 0.06) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-banner h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.hero-banner p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  max-width: 540px;
}


/* ==========================================================================
   KPI CARDS
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-card);
  border-left: 4px solid var(--border-color);
  text-align: center;
  transition: box-shadow var(--duration-normal) var(--ease-default),
              transform var(--duration-normal) var(--ease-default);
  position: relative;
  /* Default stacking context — siblings overlap by document order
     otherwise, and a tooltip on this card would be hidden by the next
     card to the right. Hover lifts above siblings so the tooltip on
     a kpi-help glyph is fully visible. */
  z-index: 1;
}

.kpi-card:hover {
  z-index: 10;
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* RAG border colours */
.kpi-card.rag-green  { border-left-color: var(--rag-green); }
.kpi-card.rag-amber  { border-left-color: var(--rag-amber); }
.kpi-card.rag-red    { border-left-color: var(--rag-red); }
.kpi-card.rag-orange { border-left-color: var(--ej-orange); }

.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.kpi-delta {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.kpi-delta.positive {
  color: var(--rag-green);
  background: var(--rag-green-bg);
}

.kpi-delta.negative {
  color: var(--rag-red);
  background: var(--rag-red-bg);
}

.kpi-delta.neutral {
  color: var(--rag-amber);
  background: var(--rag-amber-bg);
}

.kpi-subtext {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 4px;
}


/* ==========================================================================
   RAG DOTS
   ========================================================================== */
.rag-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.rag-dot.green  { background-color: var(--rag-green); }
.rag-dot.amber  { background-color: var(--rag-amber); }
.rag-dot.red    { background-color: var(--rag-red); }

.rag-dot-sm {
  width: 8px;
  height: 8px;
}

.rag-dot-lg {
  width: 12px;
  height: 12px;
}

/* Pulsing variant for live indicators */
@keyframes ragPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

.rag-dot.pulse {
  animation: ragPulse 2s ease-in-out infinite;
}


/* ==========================================================================
   CHART CONTAINERS
   ========================================================================== */
.chart-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
  /* min-width:0 lets a chart-card sitting in a grid (e.g. .chart-row.cols-2)
     shrink below its content's intrinsic width — without this, wide tables
     prevent the grid from honouring its 1fr 1fr columns and content overflows
     past the card edge instead of triggering the inner table's horizontal
     scroll. */
  min-width: 0;
}

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--border-light);
  position: relative;
}

.chart-card-header::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 48px;
  height: 2px;
  background: var(--ej-orange);
  border-radius: 1px;
}

.chart-card-header h3 {
  font-size: 0.9375rem;
  font-weight: 600;
}

.chart-card-header .chart-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.chart-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.chart-container canvas {
  width: 100% !important;
  height: auto !important;
}


/* ==========================================================================
   RESPONSIVE GRID HELPERS
   ========================================================================== */
.chart-row {
  display: grid;
  gap: 24px;
  margin-bottom: 24px;
}

.chart-row.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.chart-row.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.chart-row .half {
  grid-column: span 1;
}

.chart-row .two-thirds {
  grid-column: span 2;
}

.chart-row .full {
  grid-column: 1 / -1;
}

/* Standalone fractional widths (flex-based) */
.row-flex {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
}

.row-flex > .half       { flex: 1 1 50%; min-width: 0; }
.row-flex > .two-thirds { flex: 1 1 66.666%; min-width: 0; }
.row-flex > .one-third  { flex: 1 1 33.333%; min-width: 0; }


/* ==========================================================================
   SECTION HEADERS
   ========================================================================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-light);
  position: relative;
}

.section-header::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 40px;
  height: 2px;
  background: var(--ej-orange);
  border-radius: 1px;
}

.section-header h2 {
  font-size: 1.125rem;
}

.section-header .section-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}


/* ==========================================================================
   DATA TABLES
   ========================================================================== */
.table-wrapper {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: 24px;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.table-toolbar h3 {
  font-size: 0.9375rem;
}

.table-scroll {
  overflow-x: auto;          /* horizontal scroll when columns exceed wrapper width */
  overflow-y: auto;
  max-height: 520px;
  -webkit-overflow-scrolling: touch;  /* smooth momentum scroll on iOS */
}

/* Force the inner table to take *at least* the wrapper width but allow
   it to grow beyond — that's what triggers the table-scroll's
   overflow-x. Without this, table { width: 100% } pins it to the
   wrapper and the scroll never engages. */
.table-scroll table {
  min-width: 100%;
  width: max-content;
}

/* Thin scrollbar styling */
.table-scroll::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.table-scroll::-webkit-scrollbar-track {
  background: #F0F0F0;
}

.table-scroll::-webkit-scrollbar-thumb {
  background: #C4C4C4;
  border-radius: 3px;
}

.table-scroll::-webkit-scrollbar-thumb:hover {
  background: #A0A0A0;
}

/* Firefox scrollbar */
.table-scroll {
  scrollbar-width: thin;
  scrollbar-color: #C4C4C4 #F0F0F0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--sidebar-bg);
  color: #FFFFFF;
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  text-align: left;
  white-space: nowrap;
  border-bottom: none;
}

thead th:first-child { border-radius: 0; }
thead th:last-child  { border-radius: 0; }

tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}

/* Alternating rows */
tbody tr:nth-child(even) {
  background: #FAFBFC;
}

tbody tr:nth-child(odd) {
  background: var(--card-bg);
}

/* Hover */
tbody tr {
  transition: background var(--duration-fast) var(--ease-default);
}

tbody tr:hover {
  background: var(--ej-orange-subtle);
}

/* Sortable headers */
th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 24px;
}

th.sortable:hover {
  background: #3A3A3A;
}

th.sortable::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid rgba(255, 255, 255, 0.3);
}

th.sortable.asc::after {
  border-top: none;
  border-bottom: 5px solid #FFFFFF;
}

th.sortable.desc::after {
  border-top: 5px solid #FFFFFF;
}

/* Numeric columns */
td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Status cells */
td .status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

td .status-pill.green  { background: var(--rag-green-bg); color: var(--rag-green); }
td .status-pill.amber  { background: var(--rag-amber-bg); color: #B38600; }
td .status-pill.red    { background: var(--rag-red-bg);   color: var(--rag-red); }

/* Table footer / pagination row */
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-muted);
}


/* ==========================================================================
   SEARCH INPUT (for tables)
   ========================================================================== */
.search-input {
  width: 100%;
  max-width: 280px;
  padding: 8px 14px 8px 36px;
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  color: var(--text-primary);
  background: var(--content-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  outline: none;
  transition: border-color var(--duration-fast) var(--ease-default),
              box-shadow var(--duration-fast) var(--ease-default);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}

.search-input:focus {
  border-color: var(--ej-orange);
  box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.1);
  background-color: var(--card-bg);
}

.search-input::placeholder {
  color: var(--text-muted);
}


/* ==========================================================================
   INSIGHT BOXES
   ========================================================================== */
.insight-box {
  background: var(--content-bg);
  border-left: 3px solid var(--ej-orange);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 16px 20px;
  margin-bottom: 16px;
  font-size: 0.8125rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.insight-box strong {
  color: var(--text-primary);
  font-weight: 600;
}

.insight-box.highlight {
  background: var(--ej-orange-light);
  border-left-color: var(--ej-orange);
}

.insight-box.success {
  border-left-color: var(--rag-green);
  background: var(--rag-green-bg);
}

.insight-box.warning {
  border-left-color: var(--rag-amber);
  background: var(--rag-amber-bg);
}

.insight-box.danger {
  border-left-color: var(--rag-red);
  background: var(--rag-red-bg);
}


/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.4;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

/* Primary — orange bg, white text */
.btn-primary {
  background: var(--ej-orange);
  color: #FFFFFF;
}

.btn-primary:hover {
  background: var(--ej-orange-hover);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(255, 102, 0, 0.3);
}

/* Outlined — orange border */
.btn-outline {
  background: transparent;
  color: var(--ej-orange);
  border: 1.5px solid var(--ej-orange);
}

.btn-outline:hover {
  background: var(--ej-orange-subtle);
  color: var(--ej-orange-hover);
}

/* Ghost / subtle */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

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

/* Small variant */
.btn-sm {
  padding: 5px 12px;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

/* Large variant */
.btn-lg {
  padding: 11px 24px;
  font-size: 0.875rem;
  border-radius: var(--radius-md);
}

/* Icon-only button */
.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
}

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

/* Button group */
.btn-group {
  display: inline-flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.btn-group .btn {
  border-radius: 0;
  border: none;
  border-right: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-secondary);
  padding: 6px 14px;
  font-size: 0.75rem;
}

.btn-group .btn:last-child {
  border-right: none;
}

.btn-group .btn.active {
  background: var(--ej-orange);
  color: #FFFFFF;
  border-color: var(--ej-orange);
}


/* ==========================================================================
   TOOLTIPS
   ========================================================================== */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.92);
  background: var(--sidebar-bg);
  color: #FFFFFF;
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.45;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  /* Allow wrapping at a sensible width so long descriptions don't
     extend horizontally past the parent into the adjacent card. */
  white-space: normal;
  width: max-content;
  max-width: 260px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-fast) var(--ease-default),
              transform var(--duration-fast) var(--ease-default);
  z-index: 1000;
  box-shadow: var(--shadow-md);
}

[data-tooltip]::after {
  content: '';
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--sidebar-bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-fast) var(--ease-default);
  z-index: 1000;
}

[data-tooltip]:hover::before {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

[data-tooltip]:hover::after {
  opacity: 1;
}


/* ==========================================================================
   TEXT UTILITIES
   ========================================================================== */
.text-xs      { font-size: 0.6875rem; }
.text-sm      { font-size: 0.75rem; }
.text-base    { font-size: 0.875rem; }
.text-lg      { font-size: 1rem; }
.text-xl      { font-size: 1.25rem; }

.text-muted   { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--text-primary); }
.text-orange  { color: var(--ej-orange); }
.text-green   { color: var(--rag-green); }
.text-amber   { color: var(--rag-amber); }
.text-red     { color: var(--rag-red); }
.text-white   { color: #FFFFFF; }

.text-bold    { font-weight: 700; }
.text-semibold { font-weight: 600; }
.text-medium  { font-weight: 500; }
.text-normal  { font-weight: 400; }

.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-left    { text-align: left; }

.text-upper   { text-transform: uppercase; letter-spacing: 0.04em; }
.text-nowrap  { white-space: nowrap; }
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-tabular { font-variant-numeric: tabular-nums; }

.small-caps {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.caption {
  font-size: 0.6875rem;
  color: var(--text-muted);
  line-height: 1.5;
}


/* ==========================================================================
   SPACING UTILITIES
   ========================================================================== */
.mt-0  { margin-top: 0; }
.mt-1  { margin-top: 4px; }
.mt-2  { margin-top: 8px; }
.mt-3  { margin-top: 12px; }
.mt-4  { margin-top: 16px; }
.mt-5  { margin-top: 24px; }
.mt-6  { margin-top: 32px; }

.mb-0  { margin-bottom: 0; }
.mb-1  { margin-bottom: 4px; }
.mb-2  { margin-bottom: 8px; }
.mb-3  { margin-bottom: 12px; }
.mb-4  { margin-bottom: 16px; }
.mb-5  { margin-bottom: 24px; }
.mb-6  { margin-bottom: 32px; }

.p-0   { padding: 0; }
.p-1   { padding: 4px; }
.p-2   { padding: 8px; }
.p-3   { padding: 12px; }
.p-4   { padding: 16px; }
.p-5   { padding: 24px; }

.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 24px; }


/* ==========================================================================
   DISPLAY & FLEX UTILITIES
   ========================================================================== */
.d-flex        { display: flex; }
.d-grid        { display: grid; }
.d-inline-flex { display: inline-flex; }
.d-block       { display: block; }
.d-none        { display: none; }

.flex-col      { flex-direction: column; }
.flex-wrap     { flex-wrap: wrap; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.items-end     { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.flex-1        { flex: 1; }


/* ==========================================================================
   DIVIDERS & MISC
   ========================================================================== */
.divider {
  height: 1px;
  background: var(--border-color);
  margin: 20px 0;
  border: none;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 24px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--content-bg);
  color: var(--text-secondary);
}

.badge.orange { background: var(--ej-orange-subtle); color: var(--ej-orange); }
.badge.green  { background: var(--rag-green-bg);    color: var(--rag-green); }
.badge.red    { background: var(--rag-red-bg);      color: var(--rag-red); }
.badge.amber  { background: var(--rag-amber-bg);    color: #B38600; }

.tag {
  display: inline-block;
  padding: 3px 10px;
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  background: var(--content-bg);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

/* Loading skeleton shimmer */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(90deg, #F0F0F0 25%, #E8E8E8 50%, #F0F0F0 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}


/* ==========================================================================
   FORM ELEMENTS
   ========================================================================== */
.form-input,
.form-select {
  width: 100%;
  padding: 8px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  color: var(--text-primary);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--duration-fast) var(--ease-default),
              box-shadow var(--duration-fast) var(--ease-default);
}

.form-input:focus,
.form-select:focus {
  border-color: var(--ej-orange);
  box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.1);
}

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


/* ==========================================================================
   TABS
   ========================================================================== */
.tab-nav {
  display: flex;
  border-bottom: 2px solid var(--border-light);
  gap: 0;
  margin-bottom: 24px;
}

.tab-nav .tab {
  padding: 10px 20px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--duration-fast) var(--ease-default);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: 'Inter', sans-serif;
}

.tab-nav .tab:hover {
  color: var(--text-primary);
}

.tab-nav .tab.active {
  color: var(--ej-orange);
  border-bottom-color: var(--ej-orange);
  font-weight: 600;
}


/* ==========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 1200px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .chart-row.cols-3 {
    grid-template-columns: 1fr 1fr;
  }

  .chart-row.cols-3 > :last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 960px) {
  .sidebar {
    width: 200px;
  }

  :root {
    --sidebar-width: 200px;
  }

  .page-content {
    padding: 20px 24px 40px;
  }

  .chart-row.cols-2 {
    grid-template-columns: 1fr;
  }

  .chart-row .two-thirds,
  .chart-row .half {
    grid-column: span 1;
  }

  .row-flex {
    flex-direction: column;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s var(--ease-default);
    width: var(--sidebar-width);
    z-index: 200;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
  }

  .main-content {
    margin-left: 0;
  }

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

  .chart-row.cols-2,
  .chart-row.cols-3 {
    grid-template-columns: 1fr;
  }

  .chart-row .two-thirds {
    grid-column: span 1;
  }

  .top-bar {
    padding: 0 16px;
  }

  .page-content {
    padding: 16px 16px 32px;
  }
}


/* ==========================================================================
   PRINT STYLES
   ========================================================================== */
@media print {
  *,
  *::before,
  *::after {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    background: #FFFFFF !important;
    color: #000000 !important;
    font-size: 11pt;
    line-height: 1.4;
  }

  .sidebar {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .top-bar {
    position: static;
    border-bottom: 2px solid #000000;
    background: #FFFFFF !important;
  }

  .page-content {
    padding: 0;
  }

  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }

  .kpi-card {
    border: 1px solid #CCCCCC;
    border-left-width: 4px;
    page-break-inside: avoid;
  }

  .chart-card {
    border: 1px solid #CCCCCC;
    page-break-inside: avoid;
  }

  .chart-row.cols-2,
  .chart-row.cols-3 {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  table {
    font-size: 10pt;
  }

  thead th {
    background: #333333 !important;
    color: #FFFFFF !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  tbody tr:nth-child(even) {
    background: #F5F5F5 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .btn,
  .search-input,
  .year-selector,
  .btn-group,
  .tab-nav,
  .chart-card-actions {
    display: none !important;
  }

  .hero-banner {
    background: #FFFFFF !important;
    border: 1px solid #CCCCCC;
  }

  a {
    color: #000000 !important;
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #666666;
  }

  .nav-link[href]::after {
    content: none;
  }

  h1, h2, h3 {
    page-break-after: avoid;
  }

  .insight-box {
    border: 1px solid #CCCCCC;
    border-left: 3px solid var(--ej-orange);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}


/* ==========================================================================
   LOADER OVERLAY
   ========================================================================== */
.loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 9999;
  animation: fadeIn 0.2s ease both;
}

.loader-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border-color);
  border-top-color: var(--ej-orange);
  border-radius: 50%;
  animation: spinnerRotate 0.8s linear infinite;
}

.loader-text {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.02em;
}

@keyframes spinnerRotate {
  to { transform: rotate(360deg); }
}


/* ==========================================================================
   TOPBAR ICON BUTTON (hamburger lives inside the topbar)
   ========================================================================== */
/* Single button at the start of the topbar — visible on every viewport.
   No fixed positioning, so it never overlaps the page title. On mobile
   it triggers .sidebar.open; on desktop it toggles body.sidebar-collapsed.
   Replaces the older floating .sidebar-toggle + in-sidebar chevron. */
.topbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-right: 14px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
  font-family: inherit;
}

.topbar-icon-btn:hover {
  background: var(--content-bg);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.topbar-icon-btn:focus-visible {
  outline: 2px solid var(--ej-orange);
  outline-offset: 2px;
}

/* ── Sidebar transition machinery ─────────────────────────────── */
.sidebar {
  transition: transform var(--duration-normal) var(--ease-default);
}

.main-content {
  transition: margin-left var(--duration-normal) var(--ease-default);
}

/* Desktop: collapsed state slides the sidebar off-screen and frees
   the main content to fill the viewport. The toggle button is part
   of the topbar so it moves with main-content automatically. */
@media (min-width: 769px) {
  body.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
  }
  body.sidebar-collapsed .main-content {
    margin-left: 0;
  }
}

/* Mobile: on small screens we want the topbar to lay out clean — the
   "Airline" breadcrumb is hidden via the existing 768px media query,
   and the toggle button stays where it is. */


/* ==========================================================================
   SIDEBAR LOGO REFINEMENTS
   ========================================================================== */
.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-text {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.logo-sub {
  display: block;
  font-size: 0.6875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 2px;
  letter-spacing: 0.02em;
}

.sidebar-meta {
  font-size: 0.6875rem;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 10px;
  letter-spacing: 0.02em;
}


/* ==========================================================================
   STATS PANEL (Delays)
   ========================================================================== */
.stats-panel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 4px 0;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--content-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  transition: border-color var(--duration-fast) var(--ease-default);
}

.stat-card:hover {
  border-color: var(--ej-orange);
}

.stat-card .stat-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.stat-card .stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.stat-card .stat-unit {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 2px;
}


/* ==========================================================================
   METRIC VALUE (Predictions KPI cards)
   ========================================================================== */
.metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}


/* ==========================================================================
   METHODOLOGY GRID
   ========================================================================== */
.methodology-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-top: 8px;
}

.methodology-item {
  padding: 18px 20px;
  background: var(--content-bg);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--ej-orange);
}

.methodology-item h4 {
  margin-bottom: 8px;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
}

.methodology-item p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.methodology-item code {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.75rem;
  background: rgba(255, 102, 0, 0.08);
  color: var(--ej-orange);
  padding: 1px 5px;
  border-radius: 3px;
}

@media (max-width: 768px) {
  .methodology-grid { grid-template-columns: 1fr; }
  .stats-panel { grid-template-columns: 1fr; }
}


/* ==========================================================================
   STATIC TABLES (Methodology — non-sortable)
   ========================================================================== */
.static-table {
  width: 100%;
  border-collapse: collapse;
}

.static-table thead th {
  position: static;
  background: var(--content-bg);
  color: var(--text-primary);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border-color);
  text-align: left;
}

.static-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  vertical-align: top;
}

.static-table tbody td strong {
  color: var(--text-primary);
}

.static-table tbody td code {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.75rem;
  background: var(--content-bg);
  color: var(--text-primary);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--border-light);
}


/* ==========================================================================
   CODE BLOCKS (Methodology SQL)
   ========================================================================== */
pre {
  background: #1F2937;
  color: #E5E7EB;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 0.75rem;
  line-height: 1.6;
  margin-top: 12px;
}

pre code {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  background: transparent;
  color: inherit;
  padding: 0;
  border: none;
}

pre code.sql { color: #F3F4F6; }


/* ==========================================================================
   POLISH — KPI cards default border
   ========================================================================== */
.kpi-card { border-left-color: var(--ej-orange); }


/* ==========================================================================
   POLISH — Insight box "P" inside structured pattern
   ========================================================================== */
.insight-box strong + p,
.insight-box p { margin-top: 4px; }
.insight-box strong {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ej-orange);
  margin-bottom: 4px;
}


/* ==========================================================================
   TABLE WRAPPER STATUS PILLS — better contrast on amber
   ========================================================================== */
td .status-pill { font-variant-numeric: tabular-nums; min-width: 52px; justify-content: center; }


/* (Obsolete: the topbar used to reserve space for a fixed hamburger
   at left:12px on mobile. The toggle now lives inside the topbar so
   no extra left padding is needed.) */


/* ==========================================================================
   CASE STUDY PAGE
   ========================================================================== */
.case-study-hero {
  background: linear-gradient(135deg, #1F2937 0%, #2D2D2D 60%, #1A1A2E 100%);
  border: none;
  color: #fff;
}

.case-study-hero h1 {
  color: #fff;
  font-size: 1.625rem;
}

.case-study-hero p {
  color: rgba(255, 255, 255, 0.78);
  max-width: 720px;
}

.case-study-hero::after {
  background: radial-gradient(circle, rgba(255, 102, 0, 0.18) 0%, transparent 70%);
}

.case-study-badge {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(255, 102, 0, 0.18);
  color: var(--ej-orange);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 102, 0, 0.4);
  margin-bottom: 12px;
}

/* --- Stage markers (Descriptive / Diagnostic / Predictive / Prescriptive) --- */
.case-stage {
  position: relative;
  margin: 32px 0 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-light);
}

.case-stage::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 64px;
  height: 2px;
  background: var(--ej-orange);
  border-radius: 1px;
}

.case-stage-marker {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.case-stage-marker span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--ej-orange);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* --- 3-up KPI grid (case study) --- */
.kpi-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 960px) {
  .kpi-grid-3 { grid-template-columns: 1fr; }
}

/* --- Prescription cards --- */
.prescription-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.prescription-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border-left: 4px solid var(--ej-orange);
  overflow: hidden;
  transition: box-shadow var(--duration-normal) var(--ease-default);
}

.prescription-card:hover {
  box-shadow: var(--shadow-md);
}

.prescription-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 24px;
  background: linear-gradient(90deg, rgba(255, 102, 0, 0.06) 0%, transparent 80%);
  border-bottom: 1px solid var(--border-light);
}

.prescription-head h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.prescription-priority {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 26px;
  background: var(--ej-orange);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.prescription-body {
  padding: 18px 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.prescription-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 16px;
  align-items: start;
}

.prescription-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding-top: 2px;
}

.prescription-row p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

.prescription-row.prescription-caveat p {
  color: var(--text-muted);
  font-style: italic;
}

@media (max-width: 768px) {
  .prescription-row { grid-template-columns: 1fr; gap: 4px; }
  .prescription-head { padding: 14px 18px; }
  .prescription-body { padding: 14px 18px 18px; }
}


/* ==========================================================================
   STRATEGIC INSIGHTS PAGE
   ========================================================================== */

.insights-hero {
  background: linear-gradient(135deg, #FFF0E6 0%, #FFFFFF 60%);
}

.insights-hero .case-study-badge {
  background: rgba(255, 102, 0, 0.10);
  color: var(--ej-orange);
  border: 1px solid rgba(255, 102, 0, 0.30);
}

.insights-tabs {
  display: flex;
  gap: 4px;
  padding: 6px;
  background: var(--card-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
  overflow-x: auto;
}

.insights-tab {
  flex: 1 1 auto;
  padding: 10px 18px;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--duration-fast) var(--ease-default);
}

.insights-tab:hover {
  background: var(--content-bg);
  color: var(--text-primary);
}

.insights-tab.active {
  background: var(--ej-orange);
  color: #FFFFFF;
  box-shadow: 0 1px 3px rgba(255, 102, 0, 0.4);
}

.insights-panel {
  display: none;
  animation: fadeIn 0.3s ease both;
}

.insights-panel.active {
  display: block;
}

/* Chart caption — short explainer below each chart */
.chart-caption {
  margin-top: 14px;
  padding: 10px 14px;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--text-secondary);
  background: var(--content-bg);
  border-left: 2px solid var(--ej-orange);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.chart-caption strong { color: var(--text-primary); }


@media (max-width: 768px) {
  .insights-tabs { flex-direction: column; }
  .insights-tab { width: 100%; }
}


/* ==========================================================================
   EXECUTIVE SUMMARY  (UI A)
   ========================================================================== */
.exec-summary {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 22px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
  border-top: 3px solid var(--ej-orange);
}

.exec-summary-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ej-orange);
  margin-bottom: 12px;
}

.exec-summary-list {
  list-style: none;
  counter-reset: exec-counter;
  padding: 0;
  margin: 0;
}

.exec-summary-list li {
  position: relative;
  padding-left: 38px;
  margin-bottom: 12px;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-secondary);
  counter-increment: exec-counter;
}

.exec-summary-list li:last-child { margin-bottom: 0; }

.exec-summary-list li::before {
  content: counter(exec-counter);
  position: absolute;
  left: 0; top: 1px;
  width: 26px; height: 26px;
  background: var(--ej-orange);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.exec-summary-list li strong { color: var(--text-primary); }


/* ==========================================================================
   ABOUT MODAL  (UI B)
   ========================================================================== */
.sidebar-byline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 0.6875rem;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.02em;
}

.sidebar-byline strong { color: rgba(255, 255, 255, 0.7); font-weight: 600; }

.sidebar-about-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.55);
  padding: 4px 10px;
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
  font-family: inherit;
}

.sidebar-about-btn:hover {
  background: var(--ej-orange);
  color: #fff;
  border-color: var(--ej-orange);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 24px;
  animation: fadeIn 0.2s ease both;
}

.modal-overlay[hidden] { display: none; }

.modal-content {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  padding: 36px 40px 32px;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: relative;
}

.modal-content h2 {
  font-size: 1.375rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.modal-content h3 {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ej-orange);
  margin-top: 22px;
  margin-bottom: 8px;
}

.modal-lead {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 8px;
}

.modal-content p {
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.modal-list {
  list-style: none;
  padding: 0;
}

.modal-list li {
  padding: 4px 0 4px 18px;
  position: relative;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.modal-list li::before {
  content: '·';
  position: absolute;
  left: 4px;
  color: var(--ej-orange);
  font-weight: 700;
  font-size: 1.2em;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 50%;
  transition: all var(--duration-fast) var(--ease-default);
  line-height: 1;
}

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


/* ==========================================================================
   TOOLTIPS — small help glyph  (UI C)
   ========================================================================== */
.kpi-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--content-bg);
  color: var(--text-muted);
  font-size: 0.625rem;
  font-weight: 700;
  margin-left: 6px;
  cursor: help;
  border: 1px solid var(--border-color);
  vertical-align: middle;
  transition: all var(--duration-fast) var(--ease-default);
}

.kpi-help:hover {
  background: var(--ej-orange);
  color: #fff;
  border-color: var(--ej-orange);
}


/* ==========================================================================
   KEY TAKEAWAY CALLOUT  (UI E)
   ========================================================================== */
.key-takeaway {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  margin-bottom: 24px;
  background: linear-gradient(90deg, rgba(255, 102, 0, 0.04) 0%, transparent 100%);
  border-left: 3px solid var(--ej-orange);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.key-takeaway-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ej-orange);
  white-space: nowrap;
  padding-top: 2px;
  flex-shrink: 0;
}

.key-takeaway p {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.key-takeaway p strong { color: var(--text-primary); }


/* ==========================================================================
   CASE STUDY STICKY NAV  (UI F)
   ========================================================================== */
.case-nav {
  position: sticky;
  top: var(--topbar-height);
  z-index: 40;
  display: flex;
  gap: 4px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin: 0 0 24px;
  border: 1px solid var(--border-color);
}

.case-nav-item {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast) var(--ease-default);
}

.case-nav-item:hover {
  background: var(--content-bg);
  color: var(--text-primary);
}

.case-nav-item.active {
  background: var(--ej-orange);
  color: #fff;
}

.case-nav-item span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  font-size: 0.75rem;
  font-weight: 700;
}

.case-nav-item:not(.active) span {
  background: var(--content-bg);
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  .case-nav-item { padding: 6px 8px; font-size: 0.6875rem; }
  .case-nav-item span { width: 16px; height: 16px; font-size: 0.625rem; }
}


/* ==========================================================================
   COLOUR-BLIND SAFETY  (UI G)
   ========================================================================== */
.kpi-arrow {
  font-size: 0.75rem;
  margin-right: 2px;
}

.status-pill-icon {
  display: inline-block;
  margin-right: 4px;
  font-size: 0.625rem;
  line-height: 1;
}

/* RAG dot reinforced with inner symbol for accessibility */
.kpi-card.rag-green::before    { content: '✓'; }
.kpi-card.rag-amber::before    { content: '!'; }
.kpi-card.rag-red::before      { content: '⚠'; }
.kpi-card.rag-orange::before   { content: '★'; }

.kpi-card[class*="rag-"]::before {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  border-radius: 50%;
  opacity: 0.9;
}

.kpi-card.rag-green::before  { background: rgba(0, 168, 107, 0.12);   color: var(--rag-green); }
.kpi-card.rag-amber::before  { background: rgba(255, 184, 0, 0.12);   color: #B38600; }
.kpi-card.rag-red::before    { background: rgba(220, 53, 69, 0.12);   color: var(--rag-red); }
.kpi-card.rag-orange::before { background: rgba(255, 102, 0, 0.10);   color: var(--ej-orange); }


/* ==========================================================================
   DATA QUALITY BADGE  (UI H)
   ========================================================================== */
.data-quality-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(0, 168, 107, 0.08);
  border: 1px solid rgba(0, 168, 107, 0.2);
  border-radius: var(--radius-full);
  cursor: help;
}

.data-quality-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rag-green);
  box-shadow: 0 0 0 3px rgba(0, 168, 107, 0.2);
  animation: ragPulse 2.5s ease-in-out infinite;
  flex-shrink: 0;
}


/* ==========================================================================
   SKELETON LOADING  (UI I)
   ========================================================================== */
.skeleton-line {
  display: block;
  height: 14px;
  width: 70%;
  background: linear-gradient(90deg, #F0F0F0 25%, #E8E8E8 50%, #F0F0F0 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
  margin-top: 8px;
}

.skeleton-text {
  height: 13px;
  margin: 6px 0;
}


/* ==========================================================================
   PREDICTIONS HERO LAYOUT  (UI K)
   ========================================================================== */
.predictions-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  background: linear-gradient(135deg, #1F2937 0%, #2D2D2D 70%, #1A1A2E 100%);
  border: none;
  color: #fff;
}

.predictions-hero h1, .predictions-hero p { color: #fff; }
.predictions-hero p { color: rgba(255, 255, 255, 0.78); }
.predictions-hero::after {
  background: radial-gradient(circle, rgba(255, 102, 0, 0.18) 0%, transparent 70%);
}

.predictions-hero-text { flex: 1; }
.predictions-hero-dial { flex-shrink: 0; }

@media (max-width: 768px) {
  .predictions-hero { flex-direction: column; align-items: flex-start; gap: 16px; }
}


/* ==========================================================================
   PRINT POLISH  (UI D — extends existing print stylesheet)
   ========================================================================== */
@media print {
  .sidebar-toggle,
  .insights-tabs,
  .case-nav,
  .modal-overlay,
  .sidebar-byline,
  .data-quality-badge,
  .table-toolbar,
  .table-filter,
  .search-input { display: none !important; }

  .page-section { display: block !important; page-break-before: always; }
  .page-section.active { page-break-before: avoid; }

  .key-takeaway,
  .insight-box,
  .chart-caption,
  .exec-summary,
  .prescription-card,
  .chart-card { page-break-inside: avoid; }

  .hero-banner { background: #fff !important; border: 1px solid #ccc; }
  .case-study-hero, .predictions-hero, .insights-hero {
    background: #fff !important; color: #000 !important;
  }
  .case-study-hero h1, .case-study-hero p,
  .predictions-hero h1, .predictions-hero p,
  .insights-hero h1, .insights-hero p { color: #000 !important; }

  pre { background: #f5f5f5 !important; color: #000 !important; border: 1px solid #ddd; }
  pre code, pre code.sql { color: #000 !important; }

  .skeleton-line { display: none; }
}


/* ==========================================================================
   MOBILE RESPONSIVE TIGHTENING  (UI L)
   ========================================================================== */
@media (max-width: 768px) {
  .top-bar-actions { gap: 6px; }
  .top-bar-breadcrumb { display: none; }
  .data-quality-badge { font-size: 0.625rem; padding: 3px 8px; }
  .exec-summary { padding: 16px 18px; }
  .exec-summary-list li { padding-left: 32px; font-size: 0.875rem; }
  .key-takeaway { flex-direction: column; gap: 6px; }
  .modal-content { padding: 24px 20px; }
  .hero-banner h1 { font-size: 1.25rem; }
  .hero-banner p  { font-size: 0.8125rem; }
  .kpi-grid { grid-template-columns: 1fr; }
  .stat-card .stat-value { font-size: 1.0625rem; }
}


/* ==========================================================================
   PREDICTION INTERVALS + TREND ICONS
   ========================================================================== */
.pred-interval {
  display: block;
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
}

.trend-up   { color: var(--rag-green); font-weight: 700; }
.trend-down { color: var(--rag-red);   font-weight: 700; }
.trend-flat { color: var(--text-muted); font-weight: 700; }




