/* ═══════════════════════════════════════════════════════════════════════════
   Sierra Digital — S/4 Transformation Advisory
   Design System v4 · Dark Shell + White Cards · Plus Jakarta Sans
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('../vendor/fonts/jakarta.css');

/* ── Variables ────────────────────────────────────────────────────────────── */
:root {
  /* Light shell (page background) — bright theme v2 */
  --bg:            #F1F5F9;
  --shell:         #0B1120;
  --shell2:        #0F1629;
  --shell3:        #162038;

  /* Card surfaces — WHITE for readability */
  --surface:       #FFFFFF;
  --surface2:      #F8FAFC;
  --surface3:      #F1F5F9;
  --border:        rgba(0,0,0,.09);
  --border-mid:    rgba(0,0,0,.14);
  --border-bright: rgba(0,0,0,.20);

  /* Legacy navy names — still used in gradient banners */
  --slb-navy:      #080D1A;
  --slb-navy-mid:  #0F1629;
  --slb-navy-lt:   #162038;

  /* Brand accents */
  --slb-orange:    #FF6600;
  --slb-orange-lt: #FF8533;
  --sierra-blue:   #2563EB;
  --teal:          #0D9488;
  --teal-lt:       rgba(13,148,136,.12);

  /* Card text hierarchy — DARK for white card backgrounds */
  --text:          #0F172A;
  --text-2:        #475569;
  --text-3:        #94A3B8;

  /* Gray scale — light mode */
  --white:         #FFFFFF;
  --gray-50:       #F8FAFC;
  --gray-100:      #F1F5F9;
  --gray-200:      #E2E8F0;
  --gray-300:      #CBD5E1;
  --gray-400:      #94A3B8;
  --gray-500:      #64748B;
  --gray-600:      #475569;
  --gray-700:      #334155;
  --gray-800:      #1E293B;

  /* Status — mid-tone, readable on both light cards and dark strips */
  --green:         #059669;
  --green-lt:      rgba(5,150,105,.12);
  --amber:         #D97706;
  --amber-lt:      rgba(217,119,6,.12);
  --red:           #DC2626;
  --red-lt:        rgba(220,38,38,.12);
  --blue:          #2563EB;
  --blue-lt:       rgba(37,99,235,.12);
  --purple:        #7C3AED;
  --purple-lt:     rgba(124,58,237,.12);

  /* Typography */
  --font:          'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;

  /* Geometry */
  --radius:        10px;
  --radius-lg:     14px;
  --shadow:        0 1px 4px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.08);
  --shadow-md:     0 4px 20px rgba(0,0,0,.10);
  --shadow-lg:     0 12px 40px rgba(0,0,0,.14);
  --sidebar-w:     240px;
  --header-h:      60px;
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);      /* dark text on light background */
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: var(--font); }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: #060B16;
  border-right: 1px solid rgba(255,255,255,.07);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;

  /* Re-scope CSS vars to keep sidebar dark regardless of global surface/text */
  --text:      #EEF2FF;
  --text-2:    rgba(238,242,255,.60);
  --text-3:    rgba(238,242,255,.32);
  --surface:   #0F1629;
  --surface2:  #162038;
  --surface3:  #1E2D48;
  --border:    rgba(255,255,255,.08);
  --border-mid: rgba(255,255,255,.14);
  color: var(--text);
}
.sidebar-brand {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .brand-top {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.sidebar-brand .brand-logo {
  width: 28px; height: 28px;
  background: var(--slb-orange);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; color: white;
  box-shadow: 0 0 12px rgba(255,102,0,.4);
}
.sidebar-brand .brand-name { font-size: 13px; font-weight: 700; color: white; }
.sidebar-brand .brand-sub  { font-size: 10px; color: var(--text-3); letter-spacing:.5px; text-transform:uppercase; }
.sidebar-brand .brand-customer {
  margin-top: 8px; background: rgba(255,102,0,.12);
  border: 1px solid rgba(255,102,0,.25);
  border-radius: 4px; padding: 4px 8px;
  font-size: 11px; color: var(--slb-orange-lt); font-weight: 600;
}

.sidebar-section { padding: 14px 12px 4px; }
.sidebar-section-label {
  font-size: 9.5px; font-weight: 700; color: var(--text-3);
  letter-spacing: 1.2px; text-transform: uppercase; padding: 0 4px; margin-bottom: 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 7px; margin-bottom: 2px;
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface2); color: white; }
.nav-item.active {
  background: linear-gradient(135deg, rgba(255,102,0,.25), rgba(255,102,0,.12));
  color: white;
  border: 1px solid rgba(255,102,0,.3);
}
.nav-item .nav-icon { width: 18px; text-align: center; font-size: 14px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.nav-item .nav-icon svg { width: 15px; height: 15px; stroke: currentColor; }
.nav-item .nav-badge {
  margin-left: auto;
  background: rgba(255,102,0,.2); color: #FF8533;
  border-radius: 10px; padding: 1px 7px; font-size: 9px; font-weight: 700;
  letter-spacing: .3px;
}
.nav-item.active .nav-badge { background: rgba(255,255,255,.15); color: white; }

.sidebar-footer {
  margin-top: auto; padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text-3);
}
.sidebar-footer strong { color: var(--text-2); }

/* ── Main content ─────────────────────────────────────────────────────────── */
.main, .main-content {
  margin-left: var(--sidebar-w);
  flex: 1; display: flex; flex-direction: column; min-height: 100vh;
}

/* ── Top header / topbar ──────────────────────────────────────────────────── */
.topbar {
  height: var(--header-h);
  background: #0B1120;    /* explicitly dark — not a card */
  border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 12px rgba(0,0,0,.4);

  /* Re-scope to dark for topbar children */
  --text:      #EEF2FF;
  --text-2:    rgba(238,242,255,.60);
  --text-3:    rgba(238,242,255,.32);
  --surface:   #0F1629;
  --surface2:  #162038;
  --border:    rgba(255,255,255,.08);
  --border-mid: rgba(255,255,255,.14);
  color: var(--text);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-size: 15px; font-weight: 700; color: white; }
.topbar-subtitle { font-size: 12px; color: var(--text-3); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.system-badge {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface2); border: 1px solid var(--border-mid);
  border-radius: 20px; padding: 4px 12px;
  font-size: 11.5px; color: var(--text-2);
}
.system-badge .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(16,185,129,.22);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600; border: none;
  transition: all .15s; font-family: var(--font);
}
.btn-primary {
  background: linear-gradient(135deg, #FF6600, #E55A00);
  color: white; box-shadow: 0 0 16px rgba(255,102,0,.3);
}
.btn-primary:hover { box-shadow: 0 0 24px rgba(255,102,0,.45); transform: translateY(-1px); }
.btn-secondary {
  background: var(--surface2); color: var(--text-2);
  border: 1px solid var(--border-mid);
}
.btn-secondary:hover { background: var(--surface3); color: var(--text); }
.btn-navy {
  background: var(--surface2); color: var(--text);
  border: 1px solid var(--border-mid);
}
.btn-navy:hover { background: var(--surface3); }
.btn-sm { padding: 5px 11px; font-size: 12px; }

/* ── Page body ────────────────────────────────────────────────────────────── */
.page-body { flex: 1; padding: 24px; background: var(--bg); }
.page-header { margin-bottom: 24px; }
.page-header h1 {
  font-size: 24px; font-weight: 800; color: var(--text); margin-bottom: 4px; letter-spacing: -.3px;
}
.page-header p { font-size: 13px; color: var(--text-2); }

/* ── KPI Cards ────────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr));
  gap: 14px; margin-bottom: 24px;
}
.kpi-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.kpi-card::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 2px; background: var(--slb-orange);
}
.kpi-card.green::after  { background: var(--green); }
.kpi-card.amber::after  { background: var(--amber); }
.kpi-card.red::after    { background: var(--red); }
.kpi-card.blue::after   { background: var(--blue); }
.kpi-card.purple::after { background: var(--purple); }
.kpi-card.teal::after   { background: var(--teal); }
.kpi-label {
  font-size: 10px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .8px; margin-bottom: 8px;
}
.kpi-value {
  font-size: 30px; font-weight: 800; color: var(--text); line-height: 1;
}
.kpi-sub    { font-size: 11px; color: var(--text-3); margin-top: 5px; }
.kpi-icon   { position: absolute; top: 14px; right: 16px; font-size: 22px; opacity: .12; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);   /* #FFFFFF */
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  color: var(--text);           /* #0F172A — dark text on white card */
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 14px; font-weight: 700; color: var(--text); }
.card-body  { padding: 20px; }

/* ── Grid layouts ─────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: 18px; }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: var(--surface2);
  color: var(--text-3);
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--border-mid);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .12s; }
tbody tr:hover { background: var(--surface2); }
tbody td { padding: 11px 14px; color: var(--text); }
tbody tr:last-child { border-bottom: none; }

/* ── Badges / Pills ───────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 12px;
  font-size: 10.5px; font-weight: 700; white-space: nowrap;
}
.badge-green    { background: var(--green-lt);   color: #047857; }
.badge-amber    { background: var(--amber-lt);   color: #B45309; }
.badge-red      { background: var(--red-lt);     color: #B91C1C; }
.badge-blue     { background: var(--blue-lt);    color: #1D4ED8; }
.badge-purple   { background: var(--purple-lt);  color: #6D28D9; }
.badge-gray     { background: var(--surface2);   color: var(--text-2); }
.badge-navy     { background: #0F172A;           color: #EEF2FF; }
.badge-orange   { background: rgba(255,102,0,.12); color: #C2410C; }
.badge-teal     { background: var(--teal-lt);    color: #0F766E; }

/* ── Classification colours ──────────────────────────────────────────────── */
.cls-DEPRECATED      { background: var(--red-lt);    color: #B91C1C; }
.cls-FIT_TO_STANDARD { background: var(--green-lt);  color: #047857; }
.cls-IN_APP          { background: var(--blue-lt);   color: #1D4ED8; }
.cls-DEVELOPER_EXT   { background: var(--purple-lt); color: #6D28D9; }
.cls-SIDE_BY_SIDE    { background: rgba(255,102,0,.12); color: #C2410C; }

/* ── Progress bar ─────────────────────────────────────────────────────────── */
.progress-bar {
  height: 6px; background: var(--surface3);
  border-radius: 3px; overflow: hidden;
}
.progress-bar-fill { height: 100%; border-radius: 3px; transition: width .5s; }
.fill-green   { background: var(--green); }
.fill-orange  { background: var(--slb-orange); }
.fill-red     { background: var(--red); }
.fill-blue    { background: var(--blue); }
.fill-navy    { background: var(--sierra-blue); }
.fill-teal    { background: var(--teal); }

/* ── Search / Filter bar ─────────────────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.filter-bar input, .filter-bar select {
  padding: 8px 14px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  font-size: 13px; font-family: var(--font);
  background: var(--surface); color: var(--text);
  outline: none;
}
.filter-bar input::placeholder { color: var(--text-3); }
.filter-bar input:focus, .filter-bar select:focus {
  border-color: var(--slb-orange);
  box-shadow: 0 0 0 3px rgba(255,102,0,.15);
}
.filter-bar input { min-width: 220px; }
.filter-bar select option { background: var(--surface); }

/* ── Tabs ─────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px; gap: 0;
}
.tab-btn {
  padding: 10px 18px; background: none; border: none;
  font-size: 13px; font-weight: 600; color: var(--text-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: all .15s; font-family: var(--font);
}
.tab-btn.active { color: var(--slb-orange); border-bottom-color: var(--slb-orange); }
.tab-btn:hover:not(.active) { color: var(--text); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; color: var(--text-3);
}
.empty-state .es-icon { font-size: 48px; margin-bottom: 12px; opacity: .3; }
.empty-state h3 { font-size: 16px; font-weight: 700; color: var(--text-2); margin-bottom: 4px; }

/* ── Loading spinner ──────────────────────────────────────────────────────── */
.spinner {
  display: inline-block; width: 20px; height: 20px;
  border: 2px solid var(--surface3); border-top-color: var(--slb-orange);
  border-radius: 50%; animation: spin .7s linear infinite;
}
.loading-overlay {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 40px; color: var(--text-3); font-size: 13px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Module header strip ─────────────────────────────────────────────────── */
.module-header {
  background: linear-gradient(135deg, #0F1629 0%, #162038 100%);  /* always dark */
  border-bottom: 1px solid rgba(255,255,255,.07);
  padding: 22px 28px; margin: -24px -24px 24px;
  display: flex; align-items: center; gap: 16px; color: white;
  /* Re-scope vars so children using var(--text-2) etc. get light values */
  --text:   #EEF2FF;
  --text-2: rgba(238,242,255,.60);
  --text-3: rgba(238,242,255,.35);
}
.module-header .mod-icon { font-size: 28px; line-height: 1; }
.module-header h2 { font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.module-header p  { font-size: 12px; color: rgba(238,242,255,.55); margin-top: 2px; }
.module-header .mod-actions { margin-left: auto; display: flex; gap: 8px; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ── Chart container ─────────────────────────────────────────────────────── */
.chart-wrap { position: relative; }
.chart-wrap canvas { max-width: 100%; }

/* ── Toast notifications ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--surface2); color: var(--text);
  padding: 11px 16px; border-radius: var(--radius);
  font-size: 13px; box-shadow: var(--shadow-lg);
  border-left: 3px solid var(--slb-orange);
  animation: slideIn .2s ease; max-width: 320px;
}
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
@keyframes slideIn { from{transform:translateX(20px);opacity:0} to{transform:translateX(0);opacity:1} }

/* ── Step/Phase indicator ────────────────────────────────────────────────── */
.phase-steps { display: flex; align-items: center; gap: 0; margin-bottom: 24px; }
.phase-step  { flex: 1; text-align: center; position: relative; }
.phase-step::after {
  content: ''; position: absolute; top: 18px; left: 50%; right: -50%;
  height: 2px; background: var(--surface3); z-index: 0;
}
.phase-step:last-child::after { display: none; }
.phase-dot {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface3); color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; margin: 0 auto 6px;
  position: relative; z-index: 1; transition: all .3s;
}
.phase-step.done .phase-dot   { background: var(--green); color: white; }
.phase-step.active .phase-dot { background: var(--slb-orange); color: white; box-shadow: 0 0 16px rgba(255,102,0,.4); }
.phase-step.done::after        { background: var(--green); }
.phase-label { font-size: 11px; font-weight: 600; color: var(--text-3); }
.phase-step.done .phase-label   { color: var(--green); }
.phase-step.active .phase-label { color: var(--slb-orange); }

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-300); }

/* ── Help tooltip ────────────────────────────────────────────────────────── */
.tip-wrap { display: inline-flex; align-items: center; gap: 5px; }
.tip-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--surface3); color: var(--text-3);
  font-size: 9px; font-weight: 800; cursor: help; flex-shrink: 0;
  position: relative; vertical-align: middle;
}
.tip-icon::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%);
  background: var(--surface3); color: var(--text); border: 1px solid var(--border-mid);
  font-size: 11px; font-weight: 400; line-height: 1.55;
  padding: 8px 11px; border-radius: 7px;
  white-space: pre-wrap; min-width: 200px; max-width: 300px;
  pointer-events: none; opacity: 0; transition: opacity .15s;
  z-index: 9999; text-align: left; text-transform: none;
  letter-spacing: 0; font-family: var(--font);
  box-shadow: var(--shadow-md);
}
.tip-icon:hover::after { opacity: 1; }

/* ── Legend panel ────────────────────────────────────────────────────────── */
.legend-panel {
  background: rgba(59,130,246,.08); border: 1px solid rgba(59,130,246,.2);
  border-radius: var(--radius); padding: 13px 16px; margin-top: 12px;
}
.legend-panel.amber { background: rgba(245,158,11,.08); border-color: rgba(245,158,11,.25); }
.legend-panel.green { background: rgba(16,185,129,.08); border-color: rgba(16,185,129,.25); }
.legend-panel-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: #1D4ED8; margin-bottom: 10px;
}
.legend-panel.amber .legend-panel-title { color: #B45309; }
.legend-panel.green .legend-panel-title { color: #047857; }
.legend-items { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.legend-item  { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; min-width: 160px; flex: 1; }
.legend-item .li-label { flex-shrink: 0; }
.legend-item .li-desc  { color: var(--text-2); line-height: 1.4; }
.legend-item .li-desc strong { color: var(--text); display: block; margin-bottom: 1px; }

/* ── Page explainer banner ───────────────────────────────────────────────── */
.page-explainer {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--sierra-blue);
  border-radius: var(--radius); padding: 13px 16px;
  margin-bottom: 20px; font-size: 12px; color: var(--text-2);
  box-shadow: var(--shadow);
}
.page-explainer .pe-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.page-explainer strong   { color: var(--slb-orange); }
