/* ============================
   CSS VARIABLES & RESET
   ============================ */
:root {
  --bg-page:          #F2F2F2;
  --bg-card:          #FFFFFF;
  --bg-topbar:        #FFFFFF;
  --bg-hover:         #F8F8F8;
  --text-primary:     #1A1A1A;
  --text-muted:       #6B6B6B;
  --border:           #E0E0E0;
  --shadow:           0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:        0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg:        0 8px 24px rgba(0,0,0,0.12);
  --radius:           8px;
  --radius-sm:        4px;
  --radius-lg:        12px;

  --red:              #B01A18;
  --red-hover:        #8B1210;
  --navy:             #1B3A6B;
  --green:            #2D7A55;
  --amber:            #B87A14;
  --danger:           #C0181E;

  --sidebar-bg:       #151920;
  --sidebar-text:     #9aa3b2;
  --sidebar-active-text: #E84444;
  --sidebar-active-bg:   rgba(176,26,24,0.12);
  --sidebar-hover-bg:    rgba(255,255,255,0.05);
  --sidebar-label:    #6b7482;
  --sidebar-width:    220px;
  --topbar-height:    56px;

  --transition:       0.15s ease;

  /* Names the page code also uses (it was written against these; they were never defined, so
     every use fell back to white / near-black whatever the theme). */
  --text:             var(--text-primary);
  --card-bg:          var(--bg-card);
  --surface:          var(--bg-card);
  --bg:               var(--bg-page);
  --bg-input:         #FAFAFA;
  --bg-subtle:        #F9FAFB;
  --accent:           #B01A18;
  --red-text:         #B01A18;   /* CTI red / navy used as TEXT (the swatches stay for fills) */
  --navy-text:        #1B3A6B;
  color-scheme:       light;
}

[data-theme="dark"] {
  --bg-page:          #0e1014;
  --bg-card:          #151920;
  --bg-topbar:        #151920;
  --bg-hover:         #1b2029;
  --text-primary:     #e6e9ef;
  --text-muted:       #9aa3b2;
  --border:           #262c37;
  --shadow:           0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:        0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg:        0 8px 24px rgba(0,0,0,0.6);
  --bg-input:         #0f131a;
  --bg-subtle:        #1b2029;
  --accent:           #e5534b;
  --red-text:         #ff6b68;   /* readable on the dark cards */
  --navy-text:        #7ea6e0;
  color-scheme:       dark;      /* native scrollbars, date pickers and dropdowns turn dark too */
}

/* Report papers (CUK weekly report, heat map) are documents: they stay white with dark text in
   dark mode, like a page lying on the desk. Also their hidden copies made for PDF export. */
[data-theme="dark"] .rpt-doc,
[data-theme="dark"] .hm-doc,
[data-theme="dark"] [style*="left:-99999px"] {
  --bg-page: #F2F2F2; --bg-card: #FFFFFF; --bg-hover: #F8F8F8; --bg-topbar: #FFFFFF;
  --text-primary: #1A1A1A; --text-muted: #6B6B6B; --border: #E0E0E0;
  --text: #1A1A1A; --card-bg: #FFFFFF; --surface: #FFFFFF; --bg: #F2F2F2; --bg-input: #FAFAFA; --bg-subtle: #F9FAFB;
  --accent: #B01A18; --red-text: #B01A18; --navy-text: #1B3A6B;
  color-scheme: light; color: #1A1A1A;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 12px; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-primary);
  background: var(--bg-page);
  line-height: 1.5;
  transition: background var(--transition), color var(--transition);
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ============================
   APP SHELL
   ============================ */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ============================
   SIDEBAR
   ============================ */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: transform 0.25s ease, width 0.25s ease;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 14px 10px 14px 12px; /* room for logo + brand text beside the collapse button */
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 64px;
  flex-shrink: 0;
}

/* Brand block: CTI logo, then name over subtitle. Same rules as Indonesia's (Hermes)
   public/core/style.css. The sidebar is dark in both themes, so the label red is fixed
   rather than var(--red-text), which lightens in dark mode. */
.sidebar-brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}
.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}
/* A page still holding the pre-logo markup (label and name straight inside .sidebar-brand,
   e.g. an HTML copy cached before the change) stacks its two lines instead of squeezing them
   onto one row. */
.sidebar-brand:not(:has(.brand-text)) {
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}
.brand-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  overflow: hidden;
}
.brand-label {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.01em;
  color: #B01A18;
  text-transform: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--sidebar-text, #aaa);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Collapse toggle button */
.sidebar-collapse-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: var(--sidebar-label, #555);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.sidebar-collapse-btn:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-color: rgba(255,255,255,0.25);
}
.collapse-chevron {
  transition: transform 0.25s ease;
}

/* Logo image — shown when logo.png exists */
.sidebar-logo-img {
  max-width: 130px;
  max-height: 70px;
  object-fit: contain;
  display: block;
}

/* Text logo fallback */
.sidebar-logo-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.logo-mark {
  font-size: 20px;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.5px;
  line-height: 1;
}

.logo-mark em {
  font-style: italic;
  font-size: 22px;
}

.logo-group {
  color: var(--red-text);
  margin-left: 2px;
}

.logo-sub {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--sidebar-label);
  margin-top: 4px;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
  overflow-y: auto;
}

/* ── Sidebar user footer ─────────────────── */
.sidebar-user-footer {
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
}

.sidebar-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-details {
  min-width: 0;
  flex: 1;
}

.sidebar-user-name {
  font-size: 12px;
  font-weight: 600;
  color: #ddd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 10px;
  color: var(--sidebar-label);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: var(--sidebar-label);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.sidebar-logout-btn:hover {
  background: rgba(176,26,24,0.2);
  color: #ff6b6b;
  border-color: rgba(176,26,24,0.4);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px 9px 13px; /* 3px border + 13px = 16px — matches header brand */
  font-size: 12.5px;
  font-weight: 500;
  color: var(--sidebar-text);
  border-left: 3px solid transparent;
  text-decoration: none;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.nav-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity var(--transition);
}
.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
  opacity: 1;
}
.nav-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.2s ease, width 0.2s ease;
}

.nav-link:hover {
  background: var(--sidebar-hover-bg);
  color: #FFFFFF;
}

.nav-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  border-left-color: var(--red);
}

/* ── Collapsed sidebar ───────────────────────────────── */
.sidebar.collapsed {
  width: 54px;
  min-width: 54px;
}
.sidebar.collapsed .sidebar-brand {
  display: none;
}
.sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 14px 0;
}
.sidebar.collapsed .collapse-chevron {
  transform: rotate(180deg);
}
.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 10px 0;
  border-left: none;
  border-right: 3px solid transparent;
}
.sidebar.collapsed .nav-link.active {
  border-left: none;
  border-right-color: var(--red);
}
.sidebar.collapsed .nav-text {
  display: none;
}
.sidebar.collapsed .nav-icon {
  opacity: 0.65;
}
.sidebar.collapsed .nav-link:hover .nav-icon {
  opacity: 1;
}
.sidebar.collapsed .sidebar-user-details {
  display: none;
}
.sidebar.collapsed .sidebar-user-info {
  flex: 0 0 auto;   /* stop stretching — let footer centre the avatar */
}
.sidebar.collapsed .sidebar-user-footer {
  justify-content: center;
  padding: 10px 0;
}
.sidebar.collapsed .sidebar-logout-btn {
  display: none;
}
.sidebar.collapsed .hub-nav-link {
  justify-content: center !important;
  padding-top: 10px !important;
  padding-right: 0 !important;
  padding-bottom: 10px !important;
  padding-left: 0 !important;
  gap: 0 !important;
  border-left: 0 !important;
  border-right: 3px solid transparent !important; /* match .nav-link alignment */
  border-bottom: 1px solid rgba(255,255,255,0.07) !important;
  margin-bottom: 4px !important;
}
.sidebar.collapsed .hub-nav-link svg {
  margin: 0 !important;
}

/* ── Task page tab bar (top) ──────────────────────────────── */
.task-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.task-tabbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border-bottom: 1.5px solid var(--border, #e5e7eb);
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.task-sub-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1.5px;   /* overlap parent border */
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted, #6B7280);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.task-sub-link:hover {
  color: var(--text, #1A1A1A);
  background: var(--bg-hover, rgba(0,0,0,0.03));
}
.task-sub-link.active {
  color: var(--red-text,#B01A18);
  border-bottom-color: #B01A18;
}
.task-content {
  width: 100%;
  min-width: 0;
}

/* Inner sub-nav (Report vs Requisition Setup) */
.rpt-subnav {
  display: inline-flex;
  gap: 4px;
  background: var(--bg-page, #f4f4f4);
  border: 1px solid var(--border, #ddd);
  border-radius: 9px;
  padding: 3px;
  margin-bottom: 16px;
}
.rpt-subnav-btn {
  padding: 6px 16px;
  font-size: 12.5px;
  font-weight: 600;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted, #888);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.rpt-subnav-btn.active {
  background: #B01A18;
  color: #fff;
}
/* Heat Map sub-nav (Parameter Explanation / Performance / Executive Summary) */
.hm-subnav-btn {
  padding: 6px 16px;
  font-size: 12.5px;
  font-weight: 600;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted, #888);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.hm-subnav-btn.active {
  background: #B01A18;
  color: #fff;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Locked nav links */
.nav-link[data-locked] {
  opacity: 0.42;
}
.nav-link[data-locked]::after {
  content: '🔒';
  font-size: 10px;
  margin-left: auto;
  opacity: 0.7;
}
.nav-link[data-locked]:hover {
  background: transparent;
  color: var(--sidebar-text);
  cursor: default;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

/* ============================
   MAIN WRAPPER
   ============================ */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ============================
   TOPBAR
   ============================ */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition);
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border-radius: var(--radius-sm);
}

.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: background var(--transition);
}

.hamburger:hover span { background: var(--red); }

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.breadcrumb-app { color: var(--text-muted); font-weight: 400; }
.breadcrumb-sep { color: var(--border); }
.breadcrumb-page { color: var(--text-primary); font-weight: 600; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-date {
  font-size: 12px;
  color: var(--text-muted);
}

/* Theme Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 500;
  transition: border-color var(--transition);
}

.theme-toggle-light,
.theme-toggle-dark {
  padding: 4px 10px;
  border-radius: 20px;
  transition: background var(--transition), color var(--transition);
  color: var(--text-muted);
}

[data-theme="light"] .theme-toggle-light {
  background: var(--text-primary);
  color: #FFFFFF;
}

[data-theme="dark"] .theme-toggle-dark {
  background: var(--text-primary);
  color: var(--bg-card);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--red);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* User chip in topbar */
.user-chip {
  display: flex;
  align-items: center;
  gap: 7px;
}
.user-chip-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}
@media (max-width: 600px) {
  .user-chip-name { display: none; }
}

/* ============================
   MAIN CONTENT
   ============================ */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  transition: opacity var(--transition);
}

.main-footer {
  padding: 12px 24px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--bg-topbar);
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition);
}

/* ============================
   PAGE HEADER
   ============================ */
.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.page-header .subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.division-header {
  border-left: 4px solid var(--red);
  padding-left: 12px;
}

/* ============================
   PERIOD FILTER
   ============================ */
.period-filter {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.period-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  background: var(--bg-card);
  transition: all var(--transition);
}

.period-btn:hover { border-color: var(--red); color: var(--red-text); }

.period-btn.active {
  background: var(--red);
  border-color: var(--red);
  color: #FFFFFF;
}

/* ============================
   KPI CARDS
   ============================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), background var(--transition), border-color var(--transition);
}

.kpi-card:hover { box-shadow: var(--shadow-md); }

.kpi-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.kpi-value {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 6px;
}

.kpi-change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 500;
}

.kpi-change.positive { color: var(--green); }
.kpi-change.negative { color: var(--danger); }
.kpi-change.neutral  { color: var(--text-muted); }

/* ============================
   CHARTS & CARDS
   ============================ */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.chart-grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: -12px;
  margin-bottom: 14px;
}

.chart-wrap {
  position: relative;
}

.chart-wrap canvas {
  max-height: 260px;
}

/* ============================
   DIVISION SUMMARY CARDS
   ============================ */
.division-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.division-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), background var(--transition), border-color var(--transition);
}

.division-card:hover { box-shadow: var(--shadow-md); }

.division-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.division-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.division-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.division-detail-link {
  font-size: 12px;
  color: var(--red-text);
  font-weight: 500;
  transition: opacity var(--transition);
}

.division-detail-link:hover { opacity: 0.75; }

.mini-bar-group { display: flex; flex-direction: column; gap: 10px; }

.mini-bar-item {}

.mini-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.mini-bar-label strong { color: var(--text-primary); font-weight: 600; }

.mini-bar-track {
  height: 5px;
  background: var(--bg-page);
  border-radius: 3px;
  overflow: hidden;
}

.mini-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* ============================
   TABLES
   ============================ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: var(--bg-page);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
}

thead th:hover { color: var(--text-primary); }
thead th.sort-asc::after  { content: ' ↑'; color: var(--red-text); }
thead th.sort-desc::after { content: ' ↓'; color: var(--red-text); }

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

tbody td {
  padding: 10px 14px;
  color: var(--text-primary);
  vertical-align: middle;
}

.td-muted { color: var(--text-muted); font-size: 12px; }

.table-actions { display: flex; gap: 6px; }

.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: all var(--transition);
}

.btn-sm:hover { border-color: var(--red); color: var(--red-text); }

/* ============================
   BADGES
   ============================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge--active      { background: rgba(45,122,85,0.12);   color: var(--green); }
.badge--pending     { background: rgba(184,122,20,0.12);  color: var(--amber); }
.badge--processing  { background: rgba(27,58,107,0.12);   color: var(--navy); }
.badge--placed      { background: rgba(45,122,85,0.12);   color: #1E5C38; }
.badge--applied     { background: rgba(107,107,107,0.12); color: var(--text-muted); }
.badge--screening   { background: rgba(27,58,107,0.12);   color: var(--navy); }
.badge--interviewing{ background: rgba(184,122,20,0.12);  color: var(--amber); }
.badge--offered     { background: rgba(45,122,85,0.15);   color: var(--green); }
.badge--rejected    { background: rgba(176,26,24,0.12);   color: var(--red-text); }
.badge--on-hold     { background: rgba(107,107,107,0.12); color: var(--text-muted); }
.badge--expired     { background: rgba(176,26,24,0.12);   color: var(--red-text); }
.badge--negotiating { background: rgba(184,122,20,0.12);  color: var(--amber); }
.badge--approved    { background: rgba(45,122,85,0.12);   color: var(--green); }
.badge--additional  { background: rgba(184,122,20,0.12);  color: var(--amber); }
.badge--under-review{ background: rgba(27,58,107,0.12);   color: var(--navy); }

.badge--cruise  { background: rgba(176,26,24,0.10);   color: var(--red-text); }
.badge--j1      { background: rgba(27,58,107,0.10);   color: var(--navy); }
.badge--marine  { background: rgba(45,122,85,0.10);   color: var(--green); }
.badge--visa    { background: rgba(184,122,20,0.10);  color: var(--amber); }

/* ============================
   FILTER BAR
   ============================ */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}

.filter-search {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}

.filter-search:focus { border-color: var(--red); }

.filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.filter-select:focus { border-color: var(--red); }

/* ============================
   PAGINATION
   ============================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 13px;
}

.pagination-info { color: var(--text-muted); }

.pagination-controls { display: flex; gap: 6px; align-items: center; }

.page-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  transition: all var(--transition);
}

.page-btn:hover:not(:disabled) { border-color: var(--red); color: var(--red-text); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-btn.active { background: var(--red); border-color: var(--red); color: #FFFFFF; }

/* ============================
   BUTTONS
   ============================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--red);
  color: #FFFFFF;
  border-color: var(--red);
}

.btn-primary:hover { background: var(--red-hover); border-color: var(--red-hover); }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover { border-color: var(--red); color: var(--red-text); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 6px 12px;
}

.btn-ghost:hover { color: var(--red-text); }

/* ============================
   EMPTY STATE
   ============================ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.empty-state p { font-size: 13px; }

/* ============================
   ERROR BANNER
   ============================ */
.error-banner {
  background: rgba(192,24,30,0.10);
  border: 1px solid rgba(192,24,30,0.25);
  border-radius: var(--radius);
  color: var(--danger);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}

/* ============================
   SKELETON LOADER
   ============================ */
.loading-state { padding: 0; }

.skeleton-block {
  background: var(--border);
  border-radius: var(--radius);
  animation: shimmer 1.4s ease-in-out infinite;
  height: 80px;
}

.skeleton-block.tall   { height: 48px; margin-bottom: 20px; }
.skeleton-block.medium { height: 260px; }

.skeleton-row-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

@keyframes shimmer {
  0%   { opacity: 1; }
  50%  { opacity: 0.4; }
  100% { opacity: 1; }
}

/* ============================
   SIDE PANEL (Candidates)
   ============================ */
.side-panel {
  position: fixed;
  top: 0;
  right: -480px;
  width: 420px;
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease, background var(--transition), border-color var(--transition);
  box-shadow: var(--shadow-lg);
}

.side-panel.open { right: 0; }

.side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.side-panel-header h3 {
  font-size: 15px;
  font-weight: 700;
}

.panel-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  transition: background var(--transition), color var(--transition);
}

.panel-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.side-panel-body { flex: 1; overflow-y: auto; padding: 20px; }

.panel-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 199;
}

.panel-overlay.active { display: block; }

.panel-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--red);
  color: #FFFFFF;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.panel-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.panel-profile-info h4 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
}

.panel-profile-info p {
  font-size: 12px;
  color: var(--text-muted);
}

.panel-section { margin-bottom: 18px; }

.panel-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.panel-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.panel-info-row:last-child { border-bottom: none; }

.panel-info-row span:first-child { color: var(--text-muted); }
.panel-info-row span:last-child  { color: var(--text-primary); font-weight: 500; }

.timeline { list-style: none; padding: 0; }

.timeline-item {
  position: relative;
  padding-left: 20px;
  padding-bottom: 14px;
  font-size: 12px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
}

.timeline-item::after {
  content: '';
  position: absolute;
  left: 8px;
  top: 13px;
  width: 1px;
  height: calc(100% - 8px);
  background: var(--border);
}

.timeline-item:last-child::after { display: none; }

.timeline-item strong { display: block; color: var(--text-primary); font-weight: 600; }
.timeline-item span   { color: var(--text-muted); }

/* ============================
   MODAL (Clients)
   ============================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 660px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition: background var(--transition);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}

.modal-header h3 { font-size: 16px; font-weight: 700; }

.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  transition: background var(--transition), color var(--transition);
}

.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1 1 auto; }

/* ============================
   CLIENT CARDS
   ============================ */
.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.client-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow var(--transition), background var(--transition), border-color var(--transition);
  cursor: pointer;
}

.client-card:hover { box-shadow: var(--shadow-md); }

.client-card-header { display: flex; align-items: center; gap: 12px; }

.client-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #FFFFFF;
  flex-shrink: 0;
}

.client-card-info h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.client-card-info p {
  font-size: 12px;
  color: var(--text-muted);
}

/* Client category badges */
.cat-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 20px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.cat-badge.cruise { background: rgba(176,26,24,0.12);  color: var(--red-text,#B01A18); }
.cat-badge.j1     { background: rgba(27,58,107,0.12);   color: var(--navy-text,#1B3A6B); }
.cat-badge.other  { background: rgba(45,122,85,0.12);   color: #2D7A55; }

/* Category filter buttons */
.cat-filter-btn { transition: all 0.15s; }
.cat-filter-btn:hover { opacity: 0.85; }

.client-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.client-stat {
  background: var(--bg-page);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.client-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.client-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================
   REPORT CARDS
   ============================ */
.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.report-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow var(--transition), background var(--transition), border-color var(--transition);
}

.report-card:hover { box-shadow: var(--shadow-md); }

.report-card h4 { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.report-card p  { font-size: 12px; color: var(--text-muted); flex: 1; }

.report-last-gen {
  font-size: 11px;
  color: var(--text-muted);
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.report-actions { display: flex; gap: 8px; margin-top: 4px; }

/* ============================
   SETTINGS
   ============================ */
.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: background var(--transition), border-color var(--transition);
}

.settings-section h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.settings-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.settings-field:last-child { margin-bottom: 0; }

.settings-field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.settings-field input,
.settings-field select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}

.settings-field input:focus,
.settings-field select:focus { border-color: var(--red); }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.toggle-row:last-child { border-bottom: none; }

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
}

.toggle input { display: none; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: background var(--transition);
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #FFFFFF;
  border-radius: 50%;
  transition: transform var(--transition);
}

.toggle input:checked + .toggle-slider { background: var(--red); }
.toggle input:checked + .toggle-slider::after { transform: translateX(18px); }

/* ============================
   ANALYTICS
   ============================ */
.analytics-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* ============================
   TOAST
   ============================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #151920;
  color: #FFFFFF;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  min-width: 240px;
  animation: toastIn 0.25s ease;
  border-left: 3px solid var(--green);
}

.toast.error  { border-left-color: var(--danger); }
.toast.info   { border-left-color: var(--navy); }
.toast.out    { animation: toastOut 0.25s ease forwards; }

@keyframes toastIn  { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(5px); } }

/* ============================
   MISC HELPERS
   ============================ */
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.text-muted { color: var(--text-muted); font-size: 12px; }
.text-red   { color: var(--red-text); }

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.stat-row:last-child { border-bottom: none; }

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    z-index: 100;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.active { display: block; }

  .main-wrapper { width: 100%; }

  .hamburger { display: flex; }

  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .main-content { padding: 16px; }

  .kpi-grid { grid-template-columns: 1fr 1fr; }

  .chart-grid { grid-template-columns: 1fr; }

  .division-grid { grid-template-columns: 1fr; }

  .client-grid { grid-template-columns: 1fr; }

  .topbar-date { display: none; }

  .side-panel { width: 100%; right: -100%; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }

  .period-filter { gap: 3px; }

  .period-btn { padding: 5px 10px; font-size: 11px; }

  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-search { max-width: 100%; }
}

/* ============================
   J1 MULTI-SELECT DROPDOWN
   ============================ */
.j1-multiselect {
  position: relative;
  display: inline-block;
}

.j1-ms-btn {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.j1-ms-btn:hover {
  border-color: #1B3A6B;
  box-shadow: 0 0 0 2px rgba(27,58,107,0.12);
}
.j1-ms-arrow { font-size: 9px; opacity: 0.5; margin-left: 2px; }
.j1-ms-badge { font-size: 11px; font-weight: 700; }

.j1-ms-panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  max-width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.13);
  z-index: 200;
  overflow: hidden;
}
.j1-ms-panel.open { display: block; }

.j1-ms-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 6px 0;
}

.j1-ms-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.1s;
}
.j1-ms-item:hover { background: var(--bg-hover); }
.j1-ms-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: #1B3A6B;
  flex-shrink: 0;
  cursor: pointer;
}
.j1-ms-opt {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.j1-ms-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-page);
}
.j1-ms-clear-one {
  font-size: 11px;
  color: var(--red-text,#B01A18);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  font-weight: 600;
}
.j1-ms-clear-one:hover { text-decoration: underline; }
.j1-ms-sel-count { font-size: 11px; color: var(--text-muted); }
.j1-ms-btn.j1-ms-active {
  border-color: #1B3A6B;
  background: rgba(27,58,107,0.06);
  color: var(--navy-text,#1B3A6B);
  font-weight: 700;
}

/* ============================
   J1 TIMELINE SLIDER (noUiSlider)
   ============================ */
#j1TimelineSlider {
  height: 6px;
}
#j1TimelineSlider .noUi-connect {
  background: #1B3A6B;
}
#j1TimelineSlider .noUi-handle {
  width: 18px;
  height: 18px;
  right: -9px;
  top: -7px;
  border-radius: 50%;
  border: 2px solid #1B3A6B;
  background: var(--bg-card, #fff);
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
  cursor: grab;
}
#j1TimelineSlider .noUi-handle:active { cursor: grabbing; }
#j1TimelineSlider .noUi-handle::before,
#j1TimelineSlider .noUi-handle::after { display: none; }
#j1TimelineSlider .noUi-tooltip {
  font-size: 10px;
  font-family: Inter, system-ui, sans-serif;
  padding: 2px 6px;
  border-radius: 4px;
  background: #1B3A6B;
  color: #fff;
  border: none;
  white-space: nowrap;
  bottom: 22px;
}
#j1TimelineSlider .noUi-base,
#j1TimelineSlider .noUi-connects {
  border-radius: 4px;
}
[data-theme="dark"] #j1TimelineSlider .noUi-handle {
  background: #1b2029;
}

/* ============================
   J1 GENDER PILLS
   ============================ */
.j1-gpill--active {
  background: #1B3A6B !important;
  border-color: #1B3A6B !important;
  color: #fff !important;
}
.j1-gpill--active[data-g="Male"]   { background: #1B3A6B !important; border-color: #1B3A6B !important; }
.j1-gpill--active[data-g="Female"] { background: #B01A18 !important; border-color: #B01A18 !important; }
.j1-gpill--active[data-g=""]       { background: #444    !important; border-color: #444    !important; }

/* ============================
   J1 COLUMN FILTER BUTTONS
   ============================ */
.j1-col-ms-btn:hover,
.j1-col-date-btn:hover {
  border-color: #1B3A6B;
  color: var(--navy-text,#1B3A6B);
}
#j1ColFloatPanel label:hover {
  background: var(--bg-hover, rgba(0,0,0,0.04));
}

/* ============================
   J1 PARTICIPANT CARDS
   ============================ */
.j1-participant-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.13) !important;
  transform: translateY(-2px) !important;
}

/* Sortable table header highlight */
thead th.sortable:hover {
  color: var(--text-primary);
  background: var(--bg-hover, rgba(0,0,0,0.03));
}

/* Column filter row – no uppercase/transform styling */
#j1ColFilterRow th {
  text-transform: none;
  letter-spacing: 0;
  padding: 4px 6px;
  background: var(--bg-page);
}

/* ============================
   REQUISITION PAGE REDESIGN
   ============================ */

/* ── Page header ──────────────────────────────────────── */
.req-page-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

/* ── Pinned page header ──────────────────────────────────────────────
   #main-content is the element that scrolls, so `top` here is measured from
   the top of its scrollport, not the window. The page header pins first and
   the filter bar pins directly beneath it — core/sticky.js keeps
   --athena-hdr-h in sync with the header's live height, which differs per
   page and grows when the header wraps on a narrow window. The header's old
   bottom margin becomes padding so the two pinned rows read as one opaque
   band with no see-through seam for content to slide through. */
.req-page-header,
.page-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg-page);
  margin-bottom: 0;
}
.req-page-header { padding-bottom: 14px; }
.page-header { padding-bottom: 24px; }
/* The scroll container is padded, so a pinned header sits a little below the
   top of the scrollport — and content scrolling past would otherwise show in
   that gap, above the header. This strip paints the gap in the page colour;
   it is clipped by the container, so it is invisible at rest. */
.req-page-header::before,
.page-header::before,
.kb-page-header::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 60px;
  background: var(--bg-page);
}
.req-page-header h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  border-left: 3px solid var(--red);
  padding-left: 10px;
  line-height: 1.2;
}
.req-page-sub {
  font-size: 10.5px;
  color: var(--text-muted);
}
.req-live-badge {
  font-size: 10px;
  font-weight: 600;
  background: rgba(45,122,85,0.13);
  color: #2D7A55;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.04em;
}

/* ── Filter bar ───────────────────────────────────────── */
.req-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  margin-bottom: 14px;
  position: sticky;
  top: var(--athena-hdr-h, 0px);
  z-index: 25;
  background-color: var(--bg-card) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  border-radius: var(--radius);
}
.req-filter-bar select,
.req-gsel {
  font-size: 11px;
  padding: 4px 8px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg-card);
  color: var(--text-primary);
  width: 148px;
  flex: 0 0 148px;
  cursor: pointer;
}
.req-filter-bar select:focus,
.req-gsel:focus {
  outline: none;
  border-color: var(--red);
}
.req-clear-btn {
  height: 28px;
  padding: 0 12px;
  border: 1.5px solid var(--red);
  border-radius: 5px;
  background: transparent;
  color: var(--red-text);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}
.req-clear-btn:hover { background: var(--red); color: #fff; }
.req-count-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: 4px;
}

/* ── KPI Grid ─────────────────────────────────────────── */
.req-kpi-grid {
  display: grid;
  /* --kpi-cols lets a page set its own column count without an inline
     grid-template-columns, which would outrank the breakpoints below. */
  grid-template-columns: repeat(var(--kpi-cols, 4), minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
@media (max-width: 900px)  { .req-kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 480px)  { .req-kpi-grid { grid-template-columns: minmax(0,1fr); } }

.req-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: box-shadow var(--transition);
}
.req-kpi-card:hover { box-shadow: var(--shadow-md); }
.req-kpi-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.req-kpi-value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-primary);
}
.req-kpi-sub {
  font-size: 9.5px;
  color: var(--text-muted);
}

/* ── Chart layout ─────────────────────────────────────── */
.req-chart-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
@media (max-width: 900px) { .req-chart-row { grid-template-columns: minmax(0,1fr); } }

.req-chart-card {
  padding: 14px 16px;
}
.req-chart-card canvas {
  max-height: 220px;
}
/* Doughnut sponsor chart — legend at bottom, needs extra height */
#reqSponsorChart {
  max-height: 230px !important;
}
/* Dept bar chart — extra room for datalabels */
#reqDeptChart {
  max-height: 240px !important;
}
.req-date-card {
  padding: 14px 16px;
  margin-bottom: 14px;
}
.req-date-card canvas {
  max-height: 200px;
}
.req-card-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.req-drill-hint {
  font-size: 10px;
  font-weight: 600;
  color: var(--red-text,#B01A18);
  letter-spacing: 0.02em;
}
.req-card-sub {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.req-chart-hint {
  font-size: 9.5px;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: right;
  font-style: italic;
}

/* ── Table ────────────────────────────────────────────── */
.req-table-card {
  padding: 0;
  overflow: hidden;
}
.req-table-outer {
  max-height: calc(100vh - 280px);
  min-height: 260px;
  overflow: auto;
}
.req-table-outer table {
  font-size: 11px;
  min-width: 900px;
}
.req-table-outer thead th {
  position: sticky;
  top: 0;
  background: var(--bg-page);
  font-size: 10px;
  line-height: 1.4;           /* explicit so row height is predictable: 14px */
  padding: 7px 10px;
  white-space: nowrap;
  z-index: 3;
  box-shadow: inset 0 0 0 999px var(--bg-page); /* force opaque — no bleed-through */
}
.req-table-outer thead tr:first-child th {
  top: 0;
  border-bottom: 1px solid var(--border);
  /* row height = line-height(14) + pad-top(7) + pad-bot(7) + border(1) = 29px */
}
.req-table-outer thead tr:nth-child(2) th {
  top: 29px;
  background: var(--bg-card) !important;
  padding: 3px 5px;
  border-bottom: 2px solid var(--border);
  z-index: 4;
  box-shadow: inset 0 0 0 999px var(--bg-card) !important; /* force opaque */
}
.req-table-outer tbody td {
  padding: 6px 10px;
  font-size: 11px;
  vertical-align: middle;
}
/* Frozen first column (e.g. Visa Journey) — sticky on horizontal scroll */
.req-table-outer th.j1-frozen-col,
.req-table-outer td.j1-frozen-col {
  position: sticky;
  left: 0;
}
.req-table-outer tbody td.j1-frozen-col {
  z-index: 2;
  background: var(--bg-card);
  box-shadow: inset 0 0 0 999px var(--bg-card); /* opaque — no bleed-through */
  border-right: 1px solid var(--border);
}
.req-table-outer thead th.j1-frozen-col {
  z-index: 7 !important;      /* above other sticky headers (beats more-specific base rule) */
  border-right: 1px solid var(--border);
}
.req-dept-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(27,58,107,0.09);
  color: var(--navy-text,#1B3A6B);
  font-weight: 600;
  white-space: nowrap;
  display: inline-block;
}
.req-prog-tag {
  display: inline-block;
  margin: 1px 2px;
  padding: 1px 5px;
  border-radius: 8px;
  background: rgba(176,26,24,0.09);
  color: var(--red-text,#B01A18);
  font-weight: 600;
  font-size: 10px;
  white-space: nowrap;
}
.req-slots-num {
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  display: block;
}
.req-detail-btn {
  padding: 3px 9px;
  border: 1.5px solid var(--navy);
  border-radius: 4px;
  background: transparent;
  color: var(--navy);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  font-family: inherit;
}
.req-detail-btn:hover { background: var(--navy); color: #fff; }

/* Column filter inputs */
.req-cf {
  width: 100%;
  font-size: 10px;
  padding: 2px 5px;
  height: 22px;
  position: relative;
  z-index: 4;
  border: 1px solid var(--border);
  border-radius: 3px;
  background-color: var(--bg-card) !important;
  color: var(--text-primary);
  box-sizing: border-box;
}
.req-cf:focus { outline: none; border-color: var(--red); }
.req-cf-sel { cursor: pointer; }

/* Sort icons */
.req-sort-icon { opacity: 0.35; font-size: 9px; margin-left: 3px; }
.req-sort-asc  .req-sort-icon,
.req-sort-desc .req-sort-icon { opacity: 1; color: var(--red-text); }

/* ── Context-menu chart popup ─────────────────────────── */
.req-ctx-popup {
  position: fixed;
  z-index: 9999;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  min-width: 240px;
  max-width: 420px;
  max-height: 360px;
  overflow: auto;
  font-size: 11px;
}
.req-ctx-popup-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 11.5px;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}
.req-ctx-popup-close {
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  background: none;
  border: none;
  font-family: inherit;
  line-height: 1;
  padding: 0;
}
.req-ctx-popup table {
  width: 100%;
  font-size: 11px;
  border-collapse: collapse;
  min-width: unset;
}
.req-ctx-popup thead th {
  position: static;
  background: var(--bg-page);
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.req-ctx-popup tbody td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
}
.req-ctx-popup tbody tr:last-child td { border-bottom: none; }

  50%       { box-shadow: 0 4px 28px rgba(176,26,24,0.8); }
}

/* ── Error banner ─────────────────────────────────────── */
.req-error-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(176,26,24,0.07);
  border: 1px solid rgba(176,26,24,0.25);
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 11px;
}
.req-error-banner strong { color: var(--red-text,#B01A18); }

/* ── Participant KPI status grid ─────────────────────── */
.par-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.par-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 14px 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.par-kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.par-kpi-card-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.par-kpi-card-count {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  margin-top: 8px;
}
.par-kpi-card-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.3;
}
.par-kpi-card-sub {
  font-size: 9px;
  color: var(--text-muted);
  opacity: 0.75;
}
.par-kpi-placement { border-color: rgba(176,26,24,0.25); }
[data-theme="dark"] .par-kpi-placement { border-color: rgba(176,26,24,0.35); }

/* ── Date filter labels in filter bar ────────────────── */
.par-date-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  align-self: center;
}
.par-date-input { width: 138px; font-size: 11px; }

/* ── Participant status tabs ──────────────────────────── */
.par-tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.par-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.par-tab:hover { border-color: var(--navy); color: var(--navy); }
.par-tab.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.par-tab-count {
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
}
.par-tab.active .par-tab-count {
  background: rgba(255,255,255,0.22);
  color: #fff;
}
.par-tab:not(.active) .par-tab-count {
  background: rgba(0,0,0,0.07);
  color: var(--text-muted);
}
[data-theme="dark"] .par-tab:not(.active) .par-tab-count {
  background: rgba(255,255,255,0.08);
}
/* Total Placement tab — CTI red accent */
.par-tab.par-tab-placement { border-color: rgba(176,26,24,0.3); }
.par-tab.par-tab-placement:hover { border-color: var(--red); color: var(--red-text); }
.par-tab.par-tab-placement.active { background: var(--red); border-color: var(--red); color: #fff; }
.par-tab.par-tab-placement.active .par-tab-count { background: rgba(255,255,255,0.22); }

/* Column-level multi-select — compact size for table header cells */
.req-cf-ms {
  width: 100%;
}
.req-cf-ms .j1-ms-btn {
  height: 26px;
  font-size: 10px;
  padding: 0 6px;
  width: 100%;
  max-width: none;
  min-width: 0;
  box-sizing: border-box;
}
.req-cf-ms .j1-ms-panel {
  min-width: 160px;
}
.req-cf-ms .j1-ms-item {
  font-size: 10px;
  padding: 4px 10px;
  gap: 6px;
}
.req-cf-ms .j1-ms-item input[type="checkbox"] {
  width: 12px;
  height: 12px;
}
.req-cf-ms .j1-ms-footer {
  padding: 4px 10px;
}
.req-cf-ms .j1-ms-clear-one {
  font-size: 9px;
}
.req-cf-ms .j1-ms-sel-count {
  font-size: 9px;
}

/* ── Date input — fix oversized calendar picker indicator ────────────────── */
input[type="date"]::-webkit-calendar-picker-indicator {
  width: 14px;
  height: 14px;
  opacity: 0.5;
  cursor: pointer;
  padding: 0;
  margin: 0;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 0.85;
}

/* ── Reports page: frozen controls ─────────────────────────────────────────
   The Heat Map preview runs to a dozen printed pages, so the report tab bar
   and the control card (quarter, report date, step sub-nav, AI Autofill /
   Clear Text / Save) pin under the already-pinned page header instead of
   scrolling away. Both heights are measured by core/sticky.js and published
   as --athena-hdr-h / --athena-tab-h, because either row wraps on a narrow
   window and neither height is a constant. */
.task-tabbar.is-pinned {
  position: sticky;
  top: var(--athena-hdr-h, 0px);
  z-index: 28;
  background: var(--bg-page);
}
.task-section[data-section="heatmap"] > .card.hm-controls {
  position: sticky;
  top: calc(var(--athena-hdr-h, 0px) + var(--athena-tab-h, 0px));
  z-index: 26;
}
/* .task-layout's flex gap sits between the pinned tab bar and the pinned card;
   without this strip the report would show through it. Painted in the page
   colour, clipped by the scroll container, and sitting under the tab bar's own
   z-index, so it is invisible at rest and harmless if it overshoots. */
.task-section[data-section="heatmap"] > .card.hm-controls::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 32px;
  background: var(--bg-page);
}


/* Heat map "send feedback" dialog: a modal over the page, not part of the report paper. */
[data-theme="dark"] .hm-fb-modal { background: var(--bg-card); color: var(--text-primary); }
[data-theme="dark"] .hm-fb-to { background: var(--bg-hover); color: var(--navy-text); }
[data-theme="dark"] .hm-fb-cancel { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border); }

/* Dark mode: CTI red / navy set as TEXT colour straight in the page code (status pills, waiting
   times, KPI numbers…) read as near-black on the dark cards — swap in the readable tints.
   Anything that uses them as a FILL (background-color) is left alone, and so are the report
   papers and their hidden export copies. Covers both the written form and the form the
   browser stores after element.style.color = '…'. */
[data-theme="dark"] :is([style*="color:#B01A18" i], [style*="color: #B01A18" i], [style*="color: rgb(176, 26, 24)"]):not([style*="background-color:#B01A18" i]):not([style*="background-color: #B01A18" i]):not([style*="background-color: rgb(176, 26, 24)"]):not(.rpt-doc *):not(.hm-doc *):not([style*="left:-99999px"] *) {
  color: var(--red-text) !important;
}
[data-theme="dark"] :is([style*="color:#1B3A6B" i], [style*="color: #1B3A6B" i], [style*="color: rgb(27, 58, 107)"]):not([style*="background-color:#1B3A6B" i]):not([style*="background-color: #1B3A6B" i]):not([style*="background-color: rgb(27, 58, 107)"]):not(.rpt-doc *):not(.hm-doc *):not([style*="left:-99999px"] *) {
  color: var(--navy-text) !important;
}

/* ============================
   J1 EVENT DASHBOARD (Indonesia applicants by stage)
   ============================ */
.ev-stages { display: grid; grid-template-columns: repeat(11, minmax(max-content, 1fr)); gap: 10px; margin-bottom: 16px; }
.ev-stage { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px 12px; border-radius: var(--radius-lg);
  background: var(--bg-card); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--text-muted); text-align: left; font-family: inherit; cursor: pointer;
  transition: border-color var(--transition), background var(--transition); }
.ev-stage { min-width: 0; }
/* Card titles stay on one line; a name that still does not fit ends in … (full name on hover). */
.ev-stage span { font-size: 11px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-stage b { font-size: 26px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.ev-stage:hover { border-color: var(--text-muted); }
.ev-card { padding: 16px 18px; margin-bottom: 16px; }
.ev-h { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.ev-h h3 { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.ev-sub { font-size: 11.5px; color: var(--text-muted); }
.ev-drill { font-size: 11.5px; font-weight: 700; color: var(--red, #B01A18); white-space: nowrap; }
.ev-waits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ev-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ev-charts .ev-card { margin-bottom: 16px; min-width: 0; }
.ev-chartbox { position: relative; height: 280px; margin-top: 10px; }
@media (max-width: 1000px) { .ev-charts { grid-template-columns: 1fr; } }
.ev-wait { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-hover); color: var(--text-primary); text-align: left; font-family: inherit; cursor: pointer; }
.ev-wait b { font-size: 24px; font-weight: 800; line-height: 1.1; color: #B87A14; }
.ev-wait span { font-size: 12.5px; font-weight: 700; }
.ev-wait small { font-size: 11px; color: var(--text-muted); }
/* Eligible Sponsor cards: per-stage breakdown in the visa cards' split-button style, kept on one
   line (evFitMinis switches to short stage names when it would not fit). */
.ev-waits > .ev-wait { min-width: 0; }
.ev-split-1 { flex-wrap: nowrap; overflow: hidden; max-width: 100%; }
.ev-split-1 .ev-split-b { flex: none; white-space: nowrap; }
.ev-split-b i { font-style: normal; }
.ev-wait:hover { border-color: var(--text-muted); }
.ev-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ev-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-primary); font-size: 12px; font-weight: 600; font-family: inherit; cursor: pointer; }
.ev-chip b { font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 99px; background: var(--bg-hover); color: var(--text-muted); }
.ev-chip.on { border-color: #B01A18; color: var(--red-text); }
.ev-chip.on b { background: rgba(176,26,24,.12); color: var(--red-text); }
.ev-toolbar { align-items: center; }
.ev-sp { flex: 1; }
.ev-search { width: 260px; max-width: 100%; height: 32px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg-input); color: var(--text-primary); font-size: 12px; outline: none; }
.ev-search:focus { border-color: #B01A18; }
.ev-export { height: 32px; padding: 0 14px; border-radius: var(--radius); background: #2D7A55; color: #fff; font-size: 12px; font-weight: 700; }
.ev-export:hover { background: #24654a; }
.ev-tablecard { padding-bottom: 6px; }
.ev-tablewrap { overflow: auto; max-height: 62vh; border: 1px solid var(--border); border-radius: var(--radius); }
.ev-table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 1100px; }
.ev-table th { position: sticky; top: 0; z-index: 1; background: var(--bg-card); text-align: left; padding: 9px 10px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
.ev-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text-primary); white-space: nowrap; }
.ev-table tbody tr:hover td { background: var(--bg-hover); }
.ev-name { font-weight: 600; }
.ev-muted { color: var(--text-muted); }
.ev-pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; background: rgba(27,58,107,.10); color: var(--navy-text); }
.ev-tag { display: inline-block; margin-right: 4px; padding: 1px 8px; border-radius: 5px; font-size: 10.5px; font-weight: 700; background: rgba(184,122,20,.14); color: #B87A14; }
[data-theme="dark"] .ev-wait b, [data-theme="dark"] .ev-tag { color: #e6b455; }
.ev-empty { text-align: center; padding: 30px 10px !important; color: var(--text-muted) !important; }
.ev-kpis { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.ev-kpis .ev-stage { min-width: 0; }
.ev-kpis .ev-stage span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-kpis .ev-stage small { font-size: 11px; line-height: 1.35; color: var(--text-muted); font-weight: 500; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-kpis .ev-kpi-total b { color: var(--red, #B01A18); }
@media (max-width: 1500px) { .ev-stages { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 1300px) { .ev-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 760px) { .ev-stages { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ev-waits { grid-template-columns: 1fr; } }
.ev-tabs { margin: 0 0 14px; }
.ev-tab { display: inline-flex; align-items: center; gap: 7px; }
.ev-st { font-size: 9.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; line-height: 1.2; }
.ev-st-active { color: #15803D; background: rgba(21,128,61,.12); border: 1px solid rgba(21,128,61,.3); }
.ev-st-completed { color: var(--text-muted); background: rgba(128,128,128,.12); border: 1px solid rgba(128,128,128,.28); }
.ev-tab-completed:not(.active) { opacity: .62; }
.ev-tab.ev-dragging { opacity: .35; }
.ev-subtabs { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0 10px; }
.ev-subtab { padding: 5px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-card); color: var(--text-muted); font: 600 12px Inter, sans-serif; cursor: pointer; }
.ev-subtab:hover { color: var(--text-primary); border-color: var(--text-muted); }
.ev-subtab.active { color: #fff; background: var(--red, #B01A18); border-color: var(--red, #B01A18); }
.ev-tab.ev-drop-before { box-shadow: inset 3px 0 0 var(--red, #B01A18); }
.ev-tab.ev-drop-after { box-shadow: inset -3px 0 0 var(--red, #B01A18); }
.ev-tabmenu { position: fixed; z-index: 1000; min-width: 180px; padding: 4px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.ev-tabmenu button { display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; border-radius: 5px; background: none; color: var(--text-primary); font: 500 12.5px Inter, sans-serif; cursor: pointer; }
.ev-tabmenu button:hover:not(:disabled) { background: rgba(176,26,24,.08); }
.ev-tabmenu button:disabled { color: var(--text-muted); cursor: default; opacity: .6; }
.ev-evsub { margin: 0 0 12px; font-size: 12px; color: var(--text-muted); }
.ev-sbadge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 10px; font-weight: 700; border: 1px solid; white-space: nowrap; }
.ev-srcb { display: inline-block; padding: 2px 7px; border-radius: 10px; font-size: 10px; font-weight: 700; border: 1px solid; }
.ev-srcb.rec { background: rgba(27,58,107,.10); color: var(--navy-text); border-color: rgba(27,58,107,.35); }
.ev-srcb.crm { background: rgba(124,58,237,.10); color: #7C3AED; border-color: rgba(124,58,237,.35); }
[data-theme="dark"] .ev-srcb.crm { color: #b69cf5; }
.ev-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.ev-filters:empty { display: none; }
.ev-filters .j1-ms-btn { height: 30px; font-size: 12px; }
.ev-filters .j1-ms-panel { max-width: 320px; }
.ev-filters-clear { font-size: 12px; font-weight: 600; color: var(--red-text); padding: 4px 6px; }
/* Right-click drill-down */
.ev-dd-bg { position: fixed; inset: 0; z-index: 900; background: rgba(5,7,10,.55); display: grid; place-items: center; padding: 40px 32px; }
.ev-dd { width: min(1480px, 100%); max-height: calc(100vh - 80px); display: flex; flex-direction: column; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.ev-dd-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.ev-dd-h h3 { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.ev-dd-x { width: 32px; height: 32px; border-radius: var(--radius); color: var(--text-muted); font-size: 15px; }
.ev-dd-x:hover { background: var(--bg-hover); color: var(--text-primary); }
.ev-dd-body { margin: 10px 12px 14px; max-height: none; flex: 1; min-height: 0; }
/* Drill-down fits one screen: no forced min width, long text cells clip with a tooltip. */
.ev-dd .ev-table { min-width: 0; font-size: 11.5px; }
.ev-dd .ev-table td, .ev-dd .ev-table th { padding-left: 5px; padding-right: 5px; }
.ev-dd .ev-table td.ev-clip { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.ev-dd .ev-table td.ev-clip-name { max-width: 150px; }
/* Headers stay on one line (asked 2026-10-14); the sort arrow takes no width so it adds nothing. */
.ev-dd .ev-table th { white-space: nowrap; vertical-align: bottom; }
.ev-dd .ev-table th .ev-sarr { display: inline-block; width: 0; margin-left: 2px; overflow: visible; white-space: nowrap; }
.ev-dd .ev-table td.ev-clip-sm { max-width: 90px; }
.ev-table td.ev-sp { line-height: 1.45; vertical-align: middle; }
.ev-vd { color: var(--text-muted); font-size: 10.5px; margin-right: 3px; }
.ev-vd-sep { color: var(--text-muted); margin: 0 6px; }
.nav-icon-fav { color: #F5B301; opacity: 1; }
.ev-stage, .ev-wait, .ev-chip { -webkit-user-select: none; user-select: none; }
.ev-waits { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ev-split { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.ev-split-b { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-muted); font-size: 11px; font-weight: 600; font-family: inherit; cursor: pointer; }
.ev-split-b b { font-size: 12px; font-weight: 800; color: var(--text-primary); }
.ev-split-b:hover { border-color: var(--text-muted); color: var(--text-primary); }
@media (max-width: 1100px) { .ev-waits { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ev-table th.ev-sortable { cursor: pointer; -webkit-user-select: none; user-select: none; }
.ev-table th.ev-sortable:hover, .ev-table th.ev-sortable.on { color: var(--text-primary); }
.ev-sarr { display: inline-block; margin-left: 5px; font-size: 8px; opacity: 0; transform: translateY(-1px); }
.ev-table th.ev-sortable:hover .ev-sarr { opacity: .45; }
.ev-table th.ev-sortable.on .ev-sarr { opacity: 1; color: var(--red-text); }
.ev-dd-h .ev-search { width: 240px; }
.ev-sprow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-hover); }
.ev-splabel { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.ev-sprow .ev-chips { flex: 1; min-width: 0; }
.ev-tabedit { height: 32px; margin: 4px 0; padding: 0 10px; border: 1px solid var(--red-text, #B01A18); border-radius: 6px; background: var(--bg-card); color: var(--text-primary); font: 600 13px Inter, sans-serif; outline: none; }
