/* Staff CMS — custom styles (Bootstrap 5 base) */

/* =========================================
   DESIGN TOKENS (Bootstrap 5.3 Overrides)
   ========================================= */
:root {
  --bs-body-bg: #f8f9fa;
  --bs-body-color: #212529;
  --bs-primary: #0d6efd;
  --bs-sidebar-bg: #ffffff;
  --bs-sidebar-border: rgba(0, 0, 0, 0.08);
  --bs-card-bg: #ffffff;
  --bs-navbar-bg: #ffffff;
}

[data-bs-theme="dark"] {
  --bs-body-bg: #0f1113;
  --bs-body-color: #e9ecef;
  --bs-primary: #3d8bfd;
  --bs-sidebar-bg: #15181b;
  --bs-sidebar-border: rgba(255, 255, 255, 0.1);
  --bs-card-bg: #1a1d20;
  --bs-navbar-bg: #15181b;
}

/* Layout Transitions */
#sidebar, #page-content, .navbar {
  transition: all 0.25s ease-in-out, background-color 0.2s ease, border-color 0.2s ease;
}

/* Sidebar */
#sidebar {
  width: 240px;
  height: 100vh; /* Fallback */
  height: 100dvh;
  position: sticky;
  top: 0;
  flex-shrink: 0;
  z-index: 1000;
  background-color: var(--bs-sidebar-bg);
  border-right: 1px solid var(--bs-sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  overflow: hidden; /* Main container shouldn't scroll, inner body should */
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 1rem;
}

.sidebar-body::-webkit-scrollbar {
  width: 4px;
}
.sidebar-body::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
}

#sidebar .nav-link {
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.875rem;
  white-space: nowrap;
  margin: 0.2rem 0;
}

#sidebar .nav-link.active {
  background-color: var(--bs-primary);
  color: white !important;
}

#sidebar .nav-link:hover:not(.active) {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Sidebar icon fallback: visible even when BI glyph class is invalid/missing. */
#sidebar .sidebar-nav-icon--fallback {
  font-family: inherit !important;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
}

/* Desktop Collapsed State */
@media (min-width: 768px) {
  .sidebar-collapsed #sidebar {
    width: 70px;
    /* Allow fly-out children (nav groups + profile panel) to escape the
       70 px boundary. All text is already display:none at this point so
       nothing bleeds during the width transition. */
    overflow: visible;
  }

  .sidebar-collapsed #sidebar .sidebar-header,
  .sidebar-collapsed #sidebar .sidebar-body,
  .sidebar-collapsed #sidebar .sidebar-footer {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }

  /* Sidebar body still needs its own scroll clip */
  .sidebar-collapsed #sidebar .sidebar-body {
    overflow-y: auto;
    overflow-x: hidden;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .sidebar-collapsed #sidebar .sidebar-header {
    justify-content: center;
  }

  /* Container-level centering so icon pills cannot drift left. */
  .sidebar-collapsed #sidebar #sidebarNav {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .sidebar-collapsed #sidebar #sidebarNav > .nav-item,
  .sidebar-collapsed #sidebar #sidebarNav > .sidebar-group-item {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .sidebar-collapsed #sidebar .nav-link span,
  .sidebar-collapsed #sidebar .brand-text,
  .sidebar-collapsed #sidebar .staff-meta,
  .sidebar-collapsed #sidebar .staff-info,
  .sidebar-collapsed #sidebar hr,
  .sidebar-collapsed #sidebar .staff-name {
    display: none;
  }

  .sidebar-collapsed #sidebar #sidebarToggle {
    margin: 0 !important;
  }

  .sidebar-collapsed #sidebar #userMenu {
    overflow: visible !important;
  }

  /* Nuclear fix: absolutely pin icon to center — immune to flex/block/display */
  .sidebar-collapsed #sidebar .nav-link,
  .sidebar-collapsed #sidebar .dropdown-toggle {
    position: relative !important;
    display: grid !important;
    place-items: center !important;
    height: 2.8rem !important;
    padding: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    text-align: center !important;
  }

  /* Use centered square icon buttons in collapsed mode for consistent optics. */
  .sidebar-collapsed #sidebar .nav-item > .nav-link,
  .sidebar-collapsed #sidebar .sidebar-group-item > .sidebar-group-btn {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    margin: 0.2rem auto !important;
    border-radius: 10px !important;
    padding: 0 !important;
  }

  .sidebar-collapsed #sidebar .nav-link > i:first-child {
    position: static !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    margin: 0 !important;
    font-size: 1.25rem !important;
    display: inline-block !important;
    line-height: 1 !important;
    opacity: 1 !important;
    visibility: visible !important;
    color: currentColor !important;
    z-index: 2;
  }

  .sidebar-collapsed #sidebar .sidebar-nav-icon--fallback {
    font-size: 1.25rem !important;
  }

  /* Group headers sometimes diverge from generic nav-link rendering.
     Mirror the same visibility guarantees for their leading icon. */
  .sidebar-collapsed #sidebar .sidebar-group-btn > i:first-child {
    position: static !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    margin: 0 !important;
    font-size: 1.25rem !important;
    display: inline-block !important;
    line-height: 1 !important;
    opacity: 1 !important;
    visibility: visible !important;
    color: currentColor !important;
    z-index: 2;
  }

  /* Final collapsed alignment guard: utility classes like .me-2 can shift
     icon glyphs off-center; zero them all in icon-only mode. */
  .sidebar-collapsed #sidebar .sidebar-nav-icon {
    margin: 0 !important;
    width: 1.25rem !important;
    min-width: 1.25rem !important;
    text-align: center !important;
    justify-self: center !important;
    align-self: center !important;
  }

  /* Keep icon foreground strong against both active and hover fills. */
  .sidebar-collapsed #sidebar .nav-link,
  .sidebar-collapsed #sidebar .sidebar-group-btn {
    color: rgba(255, 255, 255, 0.92) !important;
  }

  .sidebar-collapsed #sidebar .nav-link.active,
  .sidebar-collapsed #sidebar .sidebar-group-btn.has-active-child {
    color: #fff !important;
  }

  [data-bs-theme="light"] .sidebar-collapsed #sidebar .nav-link,
  [data-bs-theme="light"] .sidebar-collapsed #sidebar .sidebar-group-btn {
    color: rgba(0, 0, 0, 0.78) !important;
  }

  [data-bs-theme="light"] .sidebar-collapsed #sidebar .nav-link.active,
  [data-bs-theme="light"] .sidebar-collapsed #sidebar .sidebar-group-btn.has-active-child {
    color: var(--bs-primary) !important;
  }

  .sidebar-collapsed #sidebar .dropdown-toggle::after {
    display: none;
  }

  /* ── Bug Fix 1: Centre the avatar in icon-only mode ─────────────────────
     The trigger is d-flex w-100; without this, the avatar hugs the left. */
  .sidebar-collapsed .profile-trigger {
    justify-content: center;
    padding: 0.6rem 0;
  }

  /* ── Bug Fix 2: Profile panel escape anchor ──────────────────────────────
     Sidebar footer becomes the positioning context so the panel can fly
     out to the right (same pattern as .sidebar-group-item for nav groups). */
  .sidebar-collapsed .sidebar-footer {
    position: relative;
    overflow: visible;
  }
}

/* ── Grouped Sidebar: Section Labels ─────────────────────────────────────── */

.sidebar-section-label {
  padding: 0.85rem 0.8rem 0.25rem;
  pointer-events: none;
  user-select: none;
}

.sidebar-section-label span {
  display: block;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
  white-space: nowrap;
  overflow: hidden;
}

/* Light theme: section labels are dark-on-light */
[data-bs-theme="light"] .sidebar-section-label span {
  color: rgba(0, 0, 0, 0.35);
}

/* Hide section labels in collapsed icon-only mode */
.sidebar-collapsed .sidebar-section-label {
  opacity: 0;
  height: 0;
  padding: 0;
  overflow: hidden;
}

/* ── Grouped Sidebar: Group Header Button ────────────────────────────────── */

.sidebar-group-btn {
  width: 100%;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  text-align: left;
  cursor: pointer;
  position: relative;   /* anchor for fly-out */
}

.sidebar-group-btn:hover:not(.has-active-child) {
  background-color: rgba(255, 255, 255, 0.08);
}

/* Active-child state: subtle primary tint on the group header */
.sidebar-group-btn.has-active-child {
  background-color: rgba(var(--bs-primary-rgb, 61, 139, 253), 0.15);
  color: white;
}

[data-bs-theme="light"] .sidebar-group-btn.has-active-child {
  background-color: rgba(13, 110, 253, 0.12);
}

/* Chevron rotation when expanded */
.sidebar-group-btn[aria-expanded="true"] .sidebar-group-chevron {
  transform: rotate(180deg);
}

.sidebar-group-chevron {
  font-size: 0.7rem;
  opacity: 0.5;
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

.sidebar-group-btn:hover .sidebar-group-chevron,
.sidebar-group-btn[aria-expanded="true"] .sidebar-group-chevron {
  opacity: 0.9;
}

/* ── Grouped Sidebar: Children Container + Left Accent Rail ──────────────── */

.sidebar-group-children {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1);

  /* The vertical rail — runs down the left, aligned with the icon centre */
  position: relative;
  margin-left: 1.35rem; /* aligns rail with centre of the group icon */
}

.sidebar-group-children::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.4rem;
  bottom: 0.4rem;
  width: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.2s ease;
  pointer-events: none;
}

.sidebar-group-children.show {
  max-height: 600px;
}

/* Rail glows primary when any child inside is active */
.sidebar-group-children:has(.nav-link-child.active)::before {
  background: color-mix(in srgb, var(--bs-primary) 60%, transparent);
}

/* ── Child Links ──────────────────────────────────────────────────────────── */

.nav-link-child {
  position: relative;
  padding-left: 1.5rem;   /* indent from the rail */
  font-size: 0.81rem;
  border-radius: 0 8px 8px 0 !important;
  margin-left: 0;         /* margin is on the container now */
  border-left: none;      /* rail is on container, not individual links */
  color: rgba(255, 255, 255, 0.72) !important; /* muted — children are secondary */
  transition: color 0.15s ease, background 0.15s ease, padding-left 0.15s ease;
}

/* Horizontal connector tick from rail to link */
.nav-link-child::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 0.6rem;
  height: 1.5px;
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-50%);
  border-radius: 1px;
  transition: background 0.15s ease, width 0.15s ease;
}

/* Child icon — smaller and muted */
.nav-link-child .bi {
  font-size: 0.78rem;
  opacity: 0.65;
  transition: opacity 0.15s ease;
}

/* ── Hover state ──────────────────────────────────────────────────────────── */

.nav-link-child:hover:not(.active) {
  background-color: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.95) !important;
  padding-left: 1.7rem; /* subtle forward nudge */
}

.nav-link-child:hover:not(.active)::before {
  background: rgba(255, 255, 255, 0.30);
  width: 0.75rem;
}

.nav-link-child:hover:not(.active) .bi {
  opacity: 0.9;
}

/* ── Active state ─────────────────────────────────────────────────────────── */

.nav-link-child.active {
  background-color: color-mix(in srgb, var(--bs-primary) 18%, transparent);
  color: #ffffff !important;
  font-weight: 600;
  padding-left: 1.7rem;
}

.nav-link-child.active::before {
  background: var(--bs-primary);
  width: 0.75rem;
}

.nav-link-child.active .bi {
  opacity: 1;
}

/* ── Light theme overrides ────────────────────────────────────────────────── */

[data-bs-theme="light"] .sidebar-group-children::before {
  background: rgba(0, 0, 0, 0.10);
}

[data-bs-theme="light"] .sidebar-group-children:has(.nav-link-child.active)::before {
  background: color-mix(in srgb, var(--bs-primary) 50%, transparent);
}

[data-bs-theme="light"] .nav-link-child {
  color: rgba(0, 0, 0, 0.60) !important;
}

[data-bs-theme="light"] .nav-link-child::before {
  background: rgba(0, 0, 0, 0.12);
}

[data-bs-theme="light"] .nav-link-child:hover:not(.active) {
  background-color: rgba(0, 0, 0, 0.05);
  color: rgba(0, 0, 0, 0.90) !important;
}

[data-bs-theme="light"] .nav-link-child:hover:not(.active)::before {
  background: rgba(0, 0, 0, 0.25);
}

[data-bs-theme="light"] .nav-link-child.active {
  color: var(--bs-primary) !important;
  background-color: color-mix(in srgb, var(--bs-primary) 10%, transparent);
}

[data-bs-theme="light"] .nav-link-child.active::before {
  background: var(--bs-primary);
}


/* ── Global: fly-out panels are always hidden by default ─────────────────── */
/* Must live OUTSIDE any media query so mobile offcanvas never renders them.  */
.sidebar-flyout {
  display: none;
}

/* ── Collapsed Desktop: Hide group text, show only icon ──────────────────── */

@media (min-width: 768px) {
  .sidebar-collapsed .sidebar-group-btn span,
  .sidebar-collapsed .sidebar-group-chevron {
    display: none;
  }

  /* Hide the children list when collapsed — fly-out takes over */
  .sidebar-collapsed .sidebar-group-children {
    display: none !important;
  }

  /* ── Fly-out Panel (CSS-only, no JavaScript) ──────────────────────────── */
  /* Positioned absolutely to the right of the group icon, appears on hover  */

  .sidebar-group-item {
    position: relative;
  }

  /* desktop collapsed: show fly-out on hover (overrides global display:none) */
  .sidebar-collapsed .sidebar-flyout {
    display: block;
    position: absolute;
    left: calc(100% + 8px);
    top: 0;
    min-width: 200px;
    background-color: var(--bs-sidebar-bg);
    border: 1px solid var(--bs-sidebar-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    padding: 0.5rem;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 1100;
  }

  .sidebar-collapsed .sidebar-group-item:hover .sidebar-flyout {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
  }

  .sidebar-flyout-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--bs-primary);
    padding: 0.25rem 0.5rem 0.4rem;
    border-bottom: 1px solid var(--bs-sidebar-border);
    margin-bottom: 0.25rem;
  }

  .sidebar-flyout-link {
    display: flex;
    align-items: center;
    padding: 0.45rem 0.75rem;
    border-radius: 7px;
    font-size: 0.83rem;
    color: var(--bs-body-color);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
  }

  .sidebar-flyout-link:hover,
  .sidebar-flyout-link.active {
    background-color: color-mix(in srgb, var(--bs-primary) 12%, transparent);
    color: var(--bs-primary);
  }

  .sidebar-flyout-link.active {
    font-weight: 600;
  }
}

/* Mobile Adjustments */
@media (max-width: 767.98px) {
  #sidebar {
    width: 280px;
    position: fixed;
    height: 100dvh;
    z-index: 1045;
  }
  
  .sidebar-footer {
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)) !important;
    background: var(--bs-dark);
  }
  
  .brand-logo {
    height: 28px !important;
  }
}

/* Theme-dependent icon visibility */
[data-bs-theme="light"] .d-none-light { display: none !important; }
[data-bs-theme="dark"] .d-none-dark { display: none !important; }

/* Page content */
#page-content {
  min-height: 100vh;
  background-color: var(--bs-body-bg);
  width: 100%;
}

/* Top Navbar (Mobile only) */
.navbar-mobile {
  border-bottom: 1px solid var(--bs-sidebar-border);
  background-color: var(--bs-navbar-bg) !important;
}

/* Timeline */
.border-start.border-2 {
  border-color: var(--bs-border-color) !important;
}

/* Cards */
.card {
  border-radius: 12px;
  border: 1px solid var(--bs-border-color-translucent);
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.card-header {
  border-radius: 12px 12px 0 0 !important;
  background-color: transparent;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  font-weight: 600;
  padding: 1rem 1.25rem;
}

/* Badges */
.badge {
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.4em 0.6em;
}

/* Tables */
.table > :not(caption) > * > * {
  padding: 1rem 1.25rem;
}

/* Font monospace smaller */
.font-monospace {
  font-size: 0.85em;
  letter-spacing: 0.05em;
}

/* Utility */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.9rem;
  color: var(--bs-body-color);
  background-color: var(--bs-body-bg);
}

/* Brand Logo */
.brand-logo {
  transition: all 0.25s ease-in-out;
  flex-shrink: 0;
  max-width: 100%;
  height: 32px;
  width: auto;
}

.sidebar-collapsed .brand-container {
  justify-content: center;
  width: 100%;
}

.sidebar-collapsed .brand-logo {
  margin-right: 0 !important;
  height: 24px; /* Slightly smaller to fit better in tight space */
}

/* Card Hover Effects */
.card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover, .hover-lift:hover {
  transform: translateY(-3px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1) !important;
}

.hover-lift {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Mobile Responsive Tables */
@media (max-width: 767.98px) {
  .table-responsive .table thead {
    display: none;
  }
  .table-responsive .table tbody tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    background: var(--bs-card-bg);
    padding: 0.5rem;
  }
  .table-responsive .table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: none;
    padding: 0.5rem 0.75rem;
    text-align: right;
  }
  .table-responsive .table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    text-align: left;
    margin-right: 1rem;
    color: var(--bs-secondary-color);
  }
}

[data-bs-theme="light"] .bg-success-subtle {
    background-color: #e6fcf5 !important;
}
[data-bs-theme="light"] .bg-danger-subtle {
    background-color: #fff5f5 !important;
}

/* Clean, Theme-Agnostic Action Highlights */
.request-row, .request-card {
    border-left: 4px solid transparent;
    transition: all 0.15s ease;
}

/* Approved State: Green left border, clean background */
.table-success, .bg-success-subtle {
    background-color: transparent !important; /* Keep theme background */
    border-left: 4px solid #198754 !important;
    color: inherit !important;
}

/* Cancelled State: Red left border, clean background */
.table-danger, .bg-danger-subtle {
    background-color: transparent !important; /* Keep theme background */
    border-left: 4px solid #dc3545 !important;
    color: inherit !important;
}

/* Fix text contrast inside highlighted rows - remove forced inheritance */
.table-success :not(.badge):not(button), 
.bg-success-subtle :not(.badge):not(button),
.table-danger :not(.badge):not(button), 
.bg-danger-subtle :not(.badge):not(button) {
    color: inherit !important;
}

/* Calibrated Semantic Colors for Both Themes */
.text-success, .text-success-emphasis {
    color: #2fb380 !important; /* Vibrant green visible on white and black */
}
.text-danger, .text-danger-emphasis {
    color: #f66d6d !important; /* Vibrant red visible on white and black */
}

/* --- Login Screen Modernization (Split Screen) --- */

.login-page-wrapper {
  background-color: #0a0a0a;
  overflow-x: hidden;
}

/* Brand Side Styling — always stays dark for mascot impact */
.login-brand-side {
  background-color: #0d0d0d;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  flex: 0 0 55%; /* Asymmetric split for more mascot presence */
}

.login-form-side {
  flex: 0 0 45%;
  background-color: var(--bs-body-bg);
  transition: background-color 0.2s ease;
}

.brand-bg-glow {
  background: radial-gradient(circle at center, rgba(30,136,229,0.22) 0%, transparent 70%); /* Intensified */
  transition: all 0.5s ease;
}

[data-bs-theme="dark"] .brand-bg-glow,
[data-bs-theme="light"] .brand-bg-glow {
  background: 
    radial-gradient(circle at 50% 50%, rgba(30,136,229,0.25) 0%, transparent 65%),
    radial-gradient(circle at 65% 75%, rgba(139,92,246,0.18) 0%, transparent 50%),
    radial-gradient(circle at 35% 25%, rgba(30,136,229,0.12) 0%, transparent 40%);
  animation: glow-pulse-dark 10s ease-in-out infinite alternate;
}

.zym-logo.hover-rotate {
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.zym-logo.hover-rotate:hover {
  transform: rotate(10deg) scale(1.1);
}

@keyframes glow-pulse-dark {
  from { opacity: 0.7; transform: scale(1); }
  to { opacity: 1; transform: scale(1.15); }
}

.mascot-container {
  z-index: 2;
  animation: float 5s ease-in-out infinite;
}

.zym-bear {
  height: auto;
  filter: url(#green-screen-mask) drop-shadow(0 20px 40px rgba(0, 0, 0, 0.7));
}

.zym-bear.desktop-only {
  max-width: 700px; /* Cinematic scale */
  width: 85%;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-35px) rotate(2deg); } /* More dynamic motion */
}

/* Form Side Styling */
.login-form-side {
  background-color: var(--bs-body-bg);
  transition: background-color 0.2s ease;
}

.login-card {
  background-color: var(--bs-card-bg);
  backdrop-filter: blur(12px); /* Premium glass effect */
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--bs-sidebar-border) !important;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.2s ease, border-color 0.2s ease;
  z-index: 2;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
}

.login-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 35px 60px -15px rgba(0, 0, 0, 0.6) !important;
}

.google-signin-btn {
  background-color: white !important;
  color: #333 !important;
  border: 1px solid #ddd !important;
  padding: 0.8rem 1.5rem !important; /* Increased padding */
  font-size: 1.05rem !important; /* Slightly larger text */
  transition: all 0.2s ease;
  white-space: nowrap; /* Prevent unprofessional text wrapping */
}

.google-signin-btn:hover {
  background-color: #f8f9fa !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
}

[data-bs-theme="dark"] .google-signin-btn {
  background-color: #fff !important;
  color: #000 !important;
  border: none !important;
}

/* Mobile & Tablet Optimizations */
@media (max-width: 991.98px) {
  .login-page-wrapper {
    background-color: #121212;
    align-items: flex-start !important;
  }
  
  .login-form-side {
    min-height: 100vh;
    padding: 2rem 1rem !important; /* Slightly tighter side padding */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 4rem !important;
  }
  
  .mobile-mascot-header {
    z-index: 10;
    margin-bottom: -40px; 
    pointer-events: none;
    position: relative;
    /* Added subtle glow for mobile mascot */
    filter: drop-shadow(0 0 20px rgba(30,136,229,0.15));
  }

  .zym-bear.mobile-only {
    max-width: 150px;
    filter: url(#green-screen-mask) drop-shadow(0 15px 30px rgba(0, 0, 0, 0.6));
    animation: float-mobile 4s ease-in-out infinite;
  }

  @keyframes float-mobile {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
  }

  .login-content-container {
  width: 100%;
  max-width: 650px; /* Hero-sized card container */
  transition: max-width 0.3s ease;
}

@media (max-width: 991.98px) {
  .login-content-container {
    max-width: 420px; /* Kept tight for mobile */
    padding-top: 10px;
  }
}

  .login-card .login-form-content {
    padding: 2.5rem 1.5rem !important; /* Optimized padding for mobile button width */
  }

  .login-card {
    box-shadow: 0 15px 50px rgba(0,0,0,0.5) !important;
  }
}

/* ================================================
   LOGIN SCREEN ENHANCEMENTS
   ================================================ */

.mascot-floor-shadow {
  position: absolute;
  bottom: 8%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px; /* Matched to hero-sized mascot */
  height: 50px;
  background: radial-gradient(ellipse at center, rgba(30,136,229,0.35) 0%, transparent 75%);
  z-index: 1;
  animation: shadow-pulse 6s ease-in-out infinite;
  filter: blur(12px);
  transition: background 0.5s ease;
}

[data-bs-theme="dark"] .mascot-floor-shadow,
[data-bs-theme="light"] .mascot-floor-shadow {
  background: radial-gradient(ellipse at center, rgba(30,136,229,0.45) 0%, transparent 75%);
  filter: blur(10px);
}

@keyframes shadow-pulse {
  0%, 100% { transform: translateX(-50%) scale(1.15); opacity: 0.7; }
  50% { transform: translateX(-50%) scale(0.8); opacity: 0.3; }
}

/* Floating theme toggle — login page only */
.login-theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1100;
}

.login-theme-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

[data-bs-theme="dark"] .login-theme-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.85);
}

[data-bs-theme="dark"] .login-theme-btn:hover {
  background: rgba(255,255,255,0.18);
  transform: rotate(20deg) scale(1.1);
}

[data-bs-theme="light"] .login-theme-btn {
  background: rgba(0,0,0,0.07);
  border: 1px solid rgba(0,0,0,0.1);
  color: rgba(0,0,0,0.65);
}

[data-bs-theme="light"] .login-theme-btn:hover {
  background: rgba(0,0,0,0.12);
  transform: rotate(-20deg) scale(1.1);
}

/* Light theme — form side switches, brand side stays permanently dark (mascot lives here) */
[data-bs-theme="light"] .login-page-wrapper {
  background-color: #f0f4ff;
}

[data-bs-theme="light"] .login-form-side {
  background-color: #f0f4ff;
}

/* Mobile light mode: mascot sits on dark top zone, card on light bottom zone */
@media (max-width: 991.98px) {
  [data-bs-theme="light"] .login-form-side {
    background:
      radial-gradient(ellipse 70% 32% at 50% 24%, rgba(30,136,229,0.14) 0%, transparent 100%),
      linear-gradient(to bottom, #0f0f13 0%, #0f0f13 30%, #f0f4ff 55%) !important;
  }

  /* Toggle sits over the dark zone on mobile — keep it white/glass regardless of theme */
  [data-bs-theme="light"] .login-theme-btn {
    background: rgba(255,255,255,0.16) !important;
    border: 1px solid rgba(255,255,255,0.28) !important;
    color: rgba(255,255,255,0.92) !important;
  }

  [data-bs-theme="light"] .login-theme-btn:hover {
    background: rgba(255,255,255,0.26) !important;
    transform: rotate(-20deg) scale(1.1);
  }
}

/* Richer dark form-side background — gradient mesh for glassmorphism depth */
[data-bs-theme="dark"] .login-form-side {
  background:
    radial-gradient(ellipse at 25% 65%, rgba(30,136,229,0.09) 0%, transparent 50%),
    radial-gradient(ellipse at 78% 18%, rgba(139,92,246,0.07) 0%, transparent 45%),
    #0f0f13;
}

/* Stronger brand-side glow with dual blue + purple accent */
[data-bs-theme="dark"] .brand-bg-glow {
  background:
    radial-gradient(circle at 50% 45%, rgba(30,136,229,0.22) 0%, transparent 55%),
    radial-gradient(circle at 55% 75%, rgba(139,92,246,0.10) 0%, transparent 45%);
}

/* Glassmorphism login card — dark mode */
[data-bs-theme="dark"] .login-card {
  background: rgba(22,22,28,0.75) !important;
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--bs-sidebar-border) !important;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5), 0 10px 40px rgba(30, 136, 229, 0.08) !important;
}

/* Light mode — premium shadow */
[data-bs-theme="light"] .login-card {
  box-shadow: 0 10px 30px rgba(0,0,0,0.08) !important;
}

/* Card entrance animation */
@keyframes card-enter {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-card {
  animation: card-enter 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Logo pop animation on load */
@keyframes logo-pop {
  0%   { transform: scale(0.75); opacity: 0; }
  65%  { transform: scale(1.06); }
  100% { transform: scale(1);    opacity: 1; }
}

.zym-logo {
  animation: logo-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) 0.25s both;
}

/* ── @property — smooth gradient colour interpolation for NEXUS breathe ─── */
/* Chrome 85+, Edge 85+, Safari 15.4+. Enables animating gradient stops.    */

@property --nexus-c1 {
  syntax: '<color>';
  inherits: false;
  initial-value: #1e88e5;
}

@property --nexus-c2 {
  syntax: '<color>';
  inherits: false;
  initial-value: #26c6da;
}

/* ── Login Portal Word: "NEXUS" brand lockup ───────────────────────────── */
/* Two-phase animation system:                                               */
/*   Phase 1 (one-time) : entrance fade-up + dramatic shimmer sweep         */
/*   Phase 2 (infinite) : gradient colour breathe + slow periodic glint     */

/* Tighten logo-to-NEXUS gap — compensates for PNG internal whitespace      */
/* mb-0 on the img removes Bootstrap's margin; -6px pulls NEXUS up to give  */
/* a ~7px perceived gap between logo glyphs and NEXUS letterforms.           */
.login-form-content .zym-logo {
  margin-bottom: -6px !important;
}

.login-portal-word {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  padding-right: 0.3em;     /* compensate trailing letter-spacing visual offset */
  margin: 0;
  display: block;
  text-align: center;
  position: relative;       /* stacking context for ::after shimmer layer       */

  /* Gradient uses @property vars — allows smooth colour interpolation        */
  background: linear-gradient(
    90deg,
    var(--nexus-c1)  0%,
    var(--nexus-c2) 50%,
    #1565c0         100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;

  /* Phase 1: entrance fade-up (once)                                        */
  /* Phase 2: idle gradient colour breathe (infinite, starts after 3s)       */
  animation:
    nexus-word-enter  0.55s cubic-bezier(0.16, 1, 0.3, 1)  0.6s  both,
    nexus-breathe     6s   ease-in-out                      3s    infinite;
}

/* ── Gradient colour breathe ────────────────────────────────────────────── */
/* Oscillates: electric-blue/teal ↔ deep-navy/electric-cyan                 */
/* @property makes this a smooth colour morph, not a jump.                  */
@keyframes nexus-breathe {
  0%, 100% {
    --nexus-c1: #1e88e5;   /* electric blue  */
    --nexus-c2: #26c6da;   /* teal           */
  }
  50% {
    --nexus-c1: #0d47a1;   /* deep navy      */
    --nexus-c2: #00e5ff;   /* electric cyan  */
  }
}

/* ── Shimmer sweep layer ─────────────────────────────────────────────────── */
/* A ::after pseudo duplicates the text and carries a transparent→white     */
/* glint gradient. Two animations on separate timing:                        */
/*   nexus-shimmer-entrance : dramatic full-opacity sweep once at load       */
/*   nexus-shimmer-loop     : soft half-opacity periodic sweep every 14s     */
.login-portal-word::after {
  content: 'NEXUS';
  position: absolute;
  inset: 0;
  display: block;

  /* Typography must exactly match parent */
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-align: inherit;
  padding-right: inherit;

  /* Narrow white glint on a transparent carrier */
  background: linear-gradient(
    90deg,
    transparent              0%,
    transparent             38%,
    rgba(255,255,255,0.92)  50%,   /* sharp bright glint peak */
    transparent             62%,
    transparent            100%
  );
  background-size: 300% 100%;
  background-position: 210% center;   /* glint off-screen right to start   */
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;

  /* Phase 1: dramatic one-time entrance sweep (full opacity)               */
  /* Phase 2: slow periodic soft glint (half opacity, loops every 14s)      */
  /* CSS spec: later animation wins when both target same property.         */
  /* nexus-shimmer-loop takes over background-position from t=6s onwards.   */
  animation:
    nexus-shimmer-entrance  1.6s  cubic-bezier(0.4, 0, 0.2, 1)  0.9s  1        forwards,
    nexus-shimmer-loop      14s   ease-in-out                     6s    infinite;
}

@keyframes nexus-word-enter {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0);   }
}

/* Dramatic entrance: full opacity right→left sweep */
@keyframes nexus-shimmer-entrance {
  from { background-position: 210% center; }
  to   { background-position: -80% center; }
}

/* Periodic idle glint loop (14s cycle):                                    */
/*  0–25%  = 3.5s: soft glint sweeps right→left at 50% opacity             */
/*  26–99% = 10.2s: invisible rest (no distraction during use)              */
/*  100%   : silent position reset, ready for next loop                     */
@keyframes nexus-shimmer-loop {
  0%   { background-position: 210% center; opacity: 0.5; }
  25%  { background-position: -80% center; opacity: 0.5; }
  26%  { background-position: -80% center; opacity: 0;   }
  99%  { background-position: 210% center; opacity: 0;   }
  100% { background-position: 210% center; opacity: 0.5; }
}

/* ── Accessibility: respect reduced-motion preference ───────────────────── */
@media (prefers-reduced-motion: reduce) {
  .login-portal-word {
    animation: nexus-word-enter 0.3s ease 0.2s both;
    --nexus-c1: #1e88e5;
    --nexus-c2: #26c6da;
  }
  .login-portal-word::after {
    animation: none;
  }
}

/* ── Responsive overrides ────────────────────────────────────────────────── */

/* Landscape compact (e.g. S23 Ultra landscape) */
@media (max-width: 991.98px) and (orientation: landscape) and (max-height: 520px) {
  .login-portal-word {
    font-size: 1.25rem;
    letter-spacing: 0.22em;
    padding-right: 0.22em;
  }
  .login-form-content .zym-logo {
    margin-bottom: -4px !important;
  }
}

/* Very small screens — iPhone SE / 320–374px */
@media (max-width: 374px) {
  .login-portal-word {
    font-size: 1.5rem;
    letter-spacing: 0.22em;
    padding-right: 0.22em;
  }
}
/* ─────────────────────────────────────────────────────────────────────────── */


/* Google button — touch active state + tap highlight removal */
.google-signin-btn {
  -webkit-tap-highlight-color: transparent;
}

.google-signin-btn:active {
  transform: translateY(0) scale(0.97) !important;
  box-shadow: none !important;
  transition: transform 0.08s ease !important;
}

/* Mobile mascot size increase for high-end devices like S23 Ultra */
@media (max-width: 991.98px) {
  .zym-bear.mobile-only {
    width: 55vw;
    max-width: 280px;
    height: auto;
  }

  .mobile-mascot-header {
    margin-bottom: -60px;
  }
}

/* Landscape phone: Mini Split-Screen for Premium Branding on S23 Ultra */
@media (max-width: 991.98px) and (orientation: landscape) and (max-height: 520px) {
  .login-form-side {
    justify-content: center !important;
    padding: 1.5rem !important;
    min-height: 100dvh;
    overflow-y: auto;
  }

  .login-content-container {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    max-width: 800px !important;
    padding-top: 0 !important;
  }

  .mobile-mascot-header {
    display: block !important;
    margin-bottom: 0 !important;
    margin-right: -40px !important;
    z-index: 12 !important;
    flex-shrink: 0;
  }

  .zym-bear.mobile-only {
    width: 25vw !important;
    max-width: 180px !important;
    max-height: 85vh !important;
  }

  .login-card {
    flex: 1;
    max-width: 380px !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4) !important;
  }

  .login-card .login-form-content {
    padding: 1.25rem 1.5rem !important;
  }

  .zym-logo {
    height: 36px !important;
    margin-bottom: 0.5rem !important;
  }

  .login-footer {
    display: none; /* Hide footer in landscape to save critical vertical space */
  }
}

/* Safe area insets — notch (top) and home bar (bottom) on iOS/Android */
@media (max-width: 991.98px) {
  .login-form-side {
    padding-top: max(4rem, calc(2rem + env(safe-area-inset-top))) !important;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }

  .login-footer {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* Very small screens — iPhone SE and below (320–374px) */
@media (max-width: 374px) {
  .login-card .login-form-content {
    padding: 2rem 1.25rem !important;
  }

  .zym-bear.mobile-only {
    max-width: 160px;
  }

  .google-signin-btn {
    font-size: 0.875rem;
    padding: 0.6rem 1rem !important;
  }
}

/* ==========================================================================
   PROFILE PANEL — premium user menu replacing old dropdown-menu-dark
   ========================================================================== */

/* ── Trigger button ─────────────────────────────────────────────────────── */
.profile-trigger {
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

/* Sidebar is always on a dark bg; white-tinted hover is correct */
#sidebar .profile-trigger:hover,
#sidebar .profile-trigger:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.profile-trigger[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.1);
}

.profile-chevron {
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.75rem;
  color: rgba(255,255,255,0.55);
}

.profile-trigger[aria-expanded="true"] .profile-chevron {
  transform: rotate(180deg);
}

/* ── Avatar ─────────────────────────────────────────────────────────────── */
.profile-avatar {
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: border-color 0.2s ease;
}

.profile-trigger:hover .profile-avatar {
  border-color: rgba(255, 255, 255, 0.45);
}

.profile-avatar-fallback {
  width: 34px;
  height: 34px;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.85);
  font-size: 1rem;
}

/* ── Online dot ──────────────────────────────────────────────────────────── */
.profile-online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 9px;
  height: 9px;
  background: #22c55e;
  border: 2px solid var(--bs-sidebar-bg);
  border-radius: 50%;
  animation: onlinePulse 3s ease-in-out infinite;
}

@keyframes onlinePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  50%       { box-shadow: 0 0 0 4px rgba(34, 197, 94, 0); }
}

/* ── Panel container (inline collapsible — no absolute positioning) ──────── */
.profile-panel {
  /* Collapsed state — hidden via max-height clamp */
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Explicit surface colours — breaks out of sidebar dark context */
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);

  /* Visual card styling */
  border-radius: 12px;
  border: 1px solid var(--bs-border-color);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  margin: 0 8px;
}

.profile-panel.is-open {
  max-height: 400px; /* Generous cap — actual content ~260px */
}


/* ── Identity block ──────────────────────────────────────────────────────── */
.profile-panel-identity {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--bs-primary) 8%, transparent),
    transparent 70%
  );
  border-radius: 11px 11px 0 0;
}

/* Role badge — primary-tinted pill, NOT uppercase raw role_name */
.profile-role-badge {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: color-mix(in srgb, var(--bs-primary) 15%, transparent);
  color: var(--bs-primary);
  border: 1px solid color-mix(in srgb, var(--bs-primary) 30%, transparent);
  padding: 0.25em 0.55em;
  border-radius: 6px;
  display: inline-block;
}

/* ── Divider ─────────────────────────────────────────────────────────────── */
.profile-panel-divider {
  height: 1px;
  background: var(--bs-border-color);
  opacity: 0.5;
}

/* ── Panel rows ──────────────────────────────────────────────────────────── */
.profile-panel-row {
  background: transparent;
  color: var(--bs-body-color);
  transition: background 0.15s ease, color 0.15s ease;
  cursor: pointer;
  text-align: left;
}

.profile-panel-row:hover,
.profile-panel-row:focus-visible {
  background: var(--bs-tertiary-bg);
  outline: none;
}

/* ── Row icon pill ───────────────────────────────────────────────────────── */
.profile-panel-row-icon {
  /* Explicit dimensions prevent flex from collapsing them */
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--bs-primary) 12%, transparent);
  color: var(--bs-primary);
  flex-shrink: 0;
  font-size: 0.9rem;
}

/* ── iOS toggle pill ─────────────────────────────────────────────────────── */
.profile-theme-pill {
  /* Explicit dimensions prevent flex collapse */
  display: inline-flex;
  align-items: center;
  min-width: 36px;
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: var(--bs-secondary-bg);
  border: 1px solid var(--bs-border-color);
  padding: 2px;
  transition: background 0.22s ease, border-color 0.22s ease;
  flex-shrink: 0;
}

[data-bs-theme="dark"] .profile-theme-pill {
  background: var(--bs-primary);
  border-color: var(--bs-primary);
}

.profile-theme-pill-knob {
  width: 14px;
  min-width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bs-body-tertiary-color, #adb5bd);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), background 0.22s ease;
  flex-shrink: 0;
}

[data-bs-theme="dark"] .profile-theme-pill-knob {
  background: #fff;
  transform: translateX(16px);
}

/* ── Sign out row ────────────────────────────────────────────────────────── */
.profile-signout-row {
  color: var(--bs-body-color);
}

/* Override the default blue icon for sign-out — red treatment */
.profile-signout-icon {
  background: color-mix(in srgb, #ef4444 10%, transparent) !important;
  color: #ef4444 !important;
}

.profile-signout-row:hover {
  background: color-mix(in srgb, #ef4444 8%, transparent) !important;
  color: #ef4444 !important;
}

.profile-signout-row:hover .profile-signout-arrow {
  opacity: 1 !important;
  transform: translateX(3px);
}

.profile-signout-arrow {
  transition: opacity 0.15s ease, transform 0.15s ease;
  font-size: 1.1rem;
  color: #ef4444;
}

/* ── Collapsed sidebar: hide text labels in trigger ─────────────────────── */
.sidebar-collapsed .profile-chevron {
  display: none;
}

/* ── Collapsed sidebar: profile panel fly-out ────────────────────────────────
   When the sidebar is in icon-only (70 px) mode the panel must escape the
   narrow container and render as an absolute overlay to the right —
   identical architectural pattern to .sidebar-flyout for nav groups.
   ─────────────────────────────────────────────────────────────────────────── */
@media (min-width: 768px) {
  .sidebar-collapsed .profile-panel {
    /* Detach from document flow and anchor to sidebar-footer */
    position: absolute;
    left: calc(100% + 8px);
    bottom: 0;
    width: 264px;

    /* Reset inline-flow defaults */
    margin: 0;
    border-radius: 12px;

    /* Hidden by default — same max-height gate as the expanded version */
    max-height: 0;
    overflow: hidden;

    /* Fly-in animation mirroring .sidebar-flyout */
    opacity: 0;
    pointer-events: none;
    transform: translateX(-6px);
    transition:
      max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
      opacity    0.18s ease,
      transform  0.18s ease;
  }

  .sidebar-collapsed .profile-panel.is-open {
    max-height: 400px;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
  }
}

/* ==========================================================================
   ZYM NEXUS DESIGN SYSTEM — Brand Tokens & Shared Components
   ========================================================================== */

/* ── Brand Tokens ──────────────────────────────────────────────────────────── */
:root {
  --nexus-navy:   #0A1628;
  --nexus-teal:   #00BCD4;
  --nexus-red:    #DC2626;
  --nexus-amber:  #F59E0B;

  /* Pipeline state semantic colors */
  --state-pending:    #6b7280;
  --state-approved:   #16a34a;
  --state-processing: #d97706;
  --state-mvne-ok:    #059669;
  --state-mvne-fail:  #dc2626;
  --state-email-ok:   #0891b2;
  --state-email-fail: #dc2626;
  --state-rejected:   #be123c;
}
[data-bs-theme="dark"] {
  --state-pending:    #9ca3af;
  --state-approved:   #34d399;
  --state-processing: #fbbf24;
  --state-mvne-ok:    #34d399;
  --state-mvne-fail:  #f87171;
  --state-email-ok:   #38bdf8;
  --state-email-fail: #f87171;
  --state-rejected:   #fb7185;
}

/* ── State Badges ──────────────────────────────────────────────────────────── */
.state-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.3em 0.75em;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.state-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.state-dot.pulsing {
  animation: stateDotPulse 1.5s ease-in-out infinite;
}
@keyframes stateDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.7); }
}

.state-badge-pending-review {
  background: rgba(107,114,128,0.10);
  color: var(--state-pending);
  border: 1px solid rgba(107,114,128,0.22);
}
.state-badge-pending-review .state-dot { background: var(--state-pending); }

.state-badge-approved {
  background: rgba(22,163,74,0.10);
  color: var(--state-approved);
  border: 1px solid rgba(22,163,74,0.22);
}
.state-badge-approved .state-dot { background: var(--state-approved); }

.state-badge-processing-mvne {
  background: rgba(217,119,6,0.10);
  color: var(--state-processing);
  border: 1px solid rgba(217,119,6,0.22);
}
.state-badge-processing-mvne .state-dot { background: var(--state-processing); }

.state-badge-mvne-success {
  background: rgba(5,150,105,0.10);
  color: var(--state-mvne-ok);
  border: 1px solid rgba(5,150,105,0.22);
}
.state-badge-mvne-success .state-dot { background: var(--state-mvne-ok); }

.state-badge-mvne-failed {
  background: rgba(220,38,38,0.08);
  color: var(--state-mvne-fail);
  border: 1px solid rgba(220,38,38,0.22);
}
.state-badge-mvne-failed .state-dot { background: var(--state-mvne-fail); }

.state-badge-email-sent {
  background: rgba(8,145,178,0.10);
  color: var(--state-email-ok);
  border: 1px solid rgba(8,145,178,0.22);
}
.state-badge-email-sent .state-dot { background: var(--state-email-ok); }

.state-badge-email-failed {
  background: rgba(220,38,38,0.08);
  color: var(--state-email-fail);
  border: 1px solid rgba(220,38,38,0.22);
}
.state-badge-email-failed .state-dot { background: var(--state-email-fail); }

.state-badge-rejected {
  background: rgba(190,18,60,0.08);
  color: var(--state-rejected);
  border: 1px solid rgba(190,18,60,0.20);
}
.state-badge-rejected .state-dot { background: var(--state-rejected); }

/* Large variant */
.state-badge.state-badge-lg {
  font-size: 0.82rem;
  padding: 0.45em 1.1em;
  gap: 0.45em;
}
.state-badge.state-badge-lg .state-dot { width: 9px; height: 9px; }

/* ── Pipeline Track ────────────────────────────────────────────────────────── */
.pipeline-track {
  display: flex;
  align-items: flex-start;
  overflow-x: auto;
  padding: 0.25rem 0 0.5rem;
  scrollbar-width: thin;
}
.pipeline-track::-webkit-scrollbar { height: 4px; }
.pipeline-track::-webkit-scrollbar-thumb {
  background: var(--bs-border-color);
  border-radius: 4px;
}

.pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 74px;
  position: relative;
}
.pipeline-step-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bs-border-color);
  background: var(--bs-secondary-bg);
  color: var(--bs-secondary-color);
  font-size: 0.75rem;
  position: relative;
  z-index: 1;
  transition: border-color .2s, background .2s, color .2s;
}
.pipeline-step.done .pipeline-step-icon {
  border-color: var(--state-approved);
  background: var(--state-approved);
  color: #fff;
}
.pipeline-step.active .pipeline-step-icon {
  border-color: var(--nexus-teal, #00BCD4);
  background: var(--nexus-teal, #00BCD4);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(0,188,212,0.18);
}
.pipeline-step.failed .pipeline-step-icon {
  border-color: var(--state-mvne-fail);
  background: var(--state-mvne-fail);
  color: #fff;
}
.pipeline-step.warning .pipeline-step-icon {
  border-color: var(--nexus-amber, #F59E0B);
  background: var(--nexus-amber, #F59E0B);
  color: #fff;
}
.pipeline-step-label {
  font-size: 0.59rem;
  text-align: center;
  margin-top: 5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bs-secondary-color);
  max-width: 72px;
  line-height: 1.3;
}
.pipeline-step.done .pipeline-step-label,
.pipeline-step.active .pipeline-step-label { color: var(--bs-body-color); }
.pipeline-step-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--bs-body-color);
  margin-top: 1px;
}
.pipeline-connector {
  flex: 1;
  height: 2px;
  background: var(--bs-border-color);
  margin-top: 14px;
  min-width: 12px;
  transition: background .2s;
}
.pipeline-connector.done  { background: var(--state-approved); }
.pipeline-connector.active { background: var(--nexus-teal, #00BCD4); }
.pipeline-connector.failed { background: var(--state-mvne-fail); }

/* ── Nexus Cards ───────────────────────────────────────────────────────────── */
.nexus-card {
  border-radius: 12px;
  border: 1px solid var(--bs-border-color-translucent);
  box-shadow: 0 1px 4px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.03);
  background: var(--bs-card-bg);
  transition: box-shadow .18s;
}
.nexus-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.10); }
.nexus-card-navy  { border-left: 4px solid var(--nexus-navy); }
.nexus-card-teal  { border-left: 4px solid var(--nexus-teal); }
.nexus-card-red   { border-left: 4px solid var(--nexus-red); }
.nexus-card-amber { border-left: 4px solid var(--nexus-amber); }

/* ── Age Badges ────────────────────────────────────────────────────────────── */
.age-badge {
  font-size: 0.66rem;
  font-weight: 600;
  padding: 0.15em 0.55em;
  border-radius: 10px;
  display: inline-block;
  white-space: nowrap;
  line-height: 1.4;
}
.age-badge-fresh  { background: rgba(22,163,74,0.10);  color: #16a34a; }
.age-badge-warn   { background: rgba(245,158,11,0.12); color: #b45309; }
.age-badge-urgent { background: rgba(220,38,38,0.10);  color: #dc2626; }
[data-bs-theme="dark"] .age-badge-fresh  { background: rgba(52,211,153,0.12); color: #34d399; }
[data-bs-theme="dark"] .age-badge-warn   { background: rgba(251,191,36,0.12); color: #fbbf24; }
[data-bs-theme="dark"] .age-badge-urgent { background: rgba(248,113,113,0.12); color: #f87171; }

/* ── Template Card Grid ────────────────────────────────────────────────────── */
.tpl-card {
  border-radius: 12px;
  border: 1px solid var(--bs-border-color-translucent);
  background: var(--bs-card-bg);
  transition: box-shadow .18s, transform .18s;
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.tpl-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,.10);
  transform: translateY(-2px);
}
.tpl-card-system { border-left: 4px solid var(--nexus-navy); }
.tpl-card-user   { border-left: 4px solid var(--nexus-teal); }

/* System badge CSS vars — consumed via inline style so they survive Bootstrap's cascade */
:root {
  --badge-system-bg: rgba(10,22,40,.08);
  --badge-system-color: #0A1628;
  --badge-system-border: rgba(10,22,40,.22);
}
[data-bs-theme="dark"] {
  --badge-system-bg: rgba(255,255,255,.12);
  --badge-system-color: #c8d6ea;
  --badge-system-border: rgba(255,255,255,.25);
}
.tpl-card-header {
  padding: 1rem 1.1rem 0.65rem;
  border-bottom: 1px solid var(--bs-border-color-translucent);
}
.tpl-card-body   { padding: 0.8rem 1.1rem; flex: 1; }
.tpl-card-footer {
  padding: 0.6rem 1.1rem;
  border-top: 1px solid var(--bs-border-color-translucent);
  background: var(--bs-tertiary-bg);
  margin-top: auto;
}

/* ── Stat Card Accents (execution dashboard) ───────────────────────────────── */
/* Legacy: used when stat cards are plain .card elements (not .card-metric) */
.stat-card-approved   { border-top: 3px solid var(--state-approved); }
.stat-card-processing { border-top: 3px solid var(--state-processing); }
.stat-card-mvne-ok    { border-top: 3px solid var(--state-mvne-ok); }
.stat-card-mvne-fail  { border-top: 3px solid var(--state-mvne-fail); }
.stat-card-email-ok   { border-top: 3px solid var(--state-email-ok); }
.stat-card-email-fail { border-top: 3px solid var(--state-email-fail); }
/* When .card-metric is used, the ::after pseudo-element owns the top stripe —
   suppress the legacy border-top so they don't double-stack. */
.card-metric.stat-card-approved,
.card-metric.stat-card-processing,
.card-metric.stat-card-mvne-ok,
.card-metric.stat-card-mvne-fail,
.card-metric.stat-card-email-ok,
.card-metric.stat-card-email-fail { border-top: none; }


/* ═══════════════════════════════════════════════════════════════════════════
   DESIGN SYSTEM v2 — Mailchimp-inspired component library
   All components are additive; existing classes are untouched.
   Every rule has a [data-bs-theme="dark"] counterpart below.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Spacing scale (8px grid) ──────────────────────────────────────────────── */
:root {
  --space-1: 0.25rem;   /*  4px */
  --space-2: 0.5rem;    /*  8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.5rem;    /* 24px */
  --space-6: 2rem;      /* 32px */
  --space-7: 3rem;      /* 48px */
  --space-8: 4rem;      /* 64px */

  /* Component tokens */
  --gallery-card-radius: 14px;
  --gallery-card-shadow: 0 2px 8px rgba(0,0,0,.07);
  --gallery-card-shadow-hover: 0 8px 24px rgba(0,0,0,.13);
  --gallery-thumb-height: 160px;

  --status-pill-radius: 20px;
  --pipeline-dot: 10px;

  --timeline-dot: 10px;
  --timeline-line-color: var(--bs-border-color);

  --bulk-bar-bg: #fffbeb;
  --bulk-bar-border: #fde68a;

  --wizard-active-color: var(--bs-primary);
  --wizard-done-color: #22c55e;
  --wizard-idle-color: var(--bs-secondary-color);
}

[data-bs-theme="dark"] {
  --gallery-card-shadow: 0 2px 8px rgba(0,0,0,.28);
  --gallery-card-shadow-hover: 0 8px 28px rgba(0,0,0,.45);
  --bulk-bar-bg: rgba(253,230,138,.08);
  --bulk-bar-border: rgba(253,230,138,.25);
  --timeline-line-color: rgba(255,255,255,.1);
}

/* ── Gallery Card ──────────────────────────────────────────────────────────── */
/* Usage: .gallery-card wrapping a template or campaign preview */
.gallery-card {
  border-radius: var(--gallery-card-radius);
  border: 1px solid var(--bs-border-color-translucent);
  background: var(--bs-card-bg);
  box-shadow: var(--gallery-card-shadow);
  transition: box-shadow .2s ease, transform .2s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}
.gallery-card:hover {
  box-shadow: var(--gallery-card-shadow-hover);
  transform: translateY(-3px);
}
.gallery-card:hover .gallery-overlay { opacity: 1; }

/* Thumbnail area */
.gallery-thumb {
  height: var(--gallery-thumb-height);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e0e7ff 0%, #f0fdf4 100%);
  font-size: 2.5rem;
  color: rgba(99,102,241,.35);
}
[data-bs-theme="dark"] .gallery-thumb {
  background: linear-gradient(135deg, #1e1b4b 0%, #052e16 100%);
  color: rgba(165,180,252,.25);
}
/* Per-type gradient variants */
.gallery-thumb--system {
  background: linear-gradient(135deg, #ede9fe 0%, #e0f2fe 100%);
}
.gallery-thumb--user {
  background: linear-gradient(135deg, #ecfdf5 0%, #f0f9ff 100%);
}
.gallery-thumb--campaign {
  background: linear-gradient(135deg, #fff7ed 0%, #fef2f2 100%);
}
[data-bs-theme="dark"] .gallery-thumb--system {
  background: linear-gradient(135deg, #2e1065 0%, #082f49 100%);
}
[data-bs-theme="dark"] .gallery-thumb--user {
  background: linear-gradient(135deg, #052e16 0%, #082f49 100%);
}
[data-bs-theme="dark"] .gallery-thumb--campaign {
  background: linear-gradient(135deg, #431407 0%, #450a0a 100%);
}

/* ── Email visual mockup — CSS-only mini email layout in gallery thumbnails ── */
.etpl-mock {
  width: 76%;
  height: 80%;
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,.14);
  display: flex;
  flex-direction: column;
  pointer-events: none;
  user-select: none;
}
[data-bs-theme="dark"] .etpl-mock {
  background: #1e293b;
  box-shadow: 0 2px 10px rgba(0,0,0,.45);
}
.etpl-mock-header {
  height: 20px;
  background: #0A1628;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 6px;
  gap: 3px;
}
.etpl-mock-header::before,
.etpl-mock-header::after {
  content: '';
  width: 12px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,.18);
  display: block;
}
.etpl-mock-header::after { width: 24px; }
/* Hero banner — richer than a plain stripe: shows title + subtitle pseudo-elements */
.etpl-mock-banner {
  height: 32px;
  background: #6610f2;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 7px;
  gap: 4px;
}
.etpl-mock-banner::before {
  content: '';
  height: 5px;
  width: 54%;
  border-radius: 2px;
  background: rgba(255,255,255,.88);
  display: block;
  flex-shrink: 0;
}
.etpl-mock-banner::after {
  content: '';
  height: 3px;
  width: 33%;
  border-radius: 1.5px;
  background: rgba(255,255,255,.40);
  display: block;
  flex-shrink: 0;
}
/* Per-template-key banner colours */
.gallery-thumb-key--staff_review_reminder .etpl-mock-banner     { background: #DC2626; }
.gallery-thumb-key--staff_attention_reminder .etpl-mock-banner  { background: #EA580C; }
.gallery-thumb-key--staff_batch_created .etpl-mock-banner       { background: #2563EB; }
.gallery-thumb-key--termination_confirmation .etpl-mock-banner  { background: #00838F; }
.etpl-mock-body {
  padding: 6px 8px 5px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}
.etpl-mock-line {
  height: 4px;
  border-radius: 2px;
  background: #e2e8f0;
  flex-shrink: 0;
}
[data-bs-theme="dark"] .etpl-mock-line { background: #334155; }
.etpl-mock-gap { height: 3px; flex-shrink: 0; }
.etpl-mock-btn {
  height: 9px;
  width: 44%;
  border-radius: 4px;
  background: #6610f2;
  align-self: center;
  flex-shrink: 0;
  margin-top: 2px;
}
/* Match button colour to banner */
.gallery-thumb-key--staff_review_reminder .etpl-mock-btn    { background: #DC2626; }
.gallery-thumb-key--staff_attention_reminder .etpl-mock-btn { background: #EA580C; }
.gallery-thumb-key--staff_batch_created .etpl-mock-btn      { background: #2563EB; }
.gallery-thumb-key--termination_confirmation .etpl-mock-btn { background: #00838F; }
/* Dark footer bar — mirrors ZYM email footer */
.etpl-mock-footer {
  height: 10px;
  background: #0A1628;
  flex-shrink: 0;
}
[data-bs-theme="dark"] .etpl-mock-footer { background: #060d1a; }

/* ── Email template editor — sticky action bar ───────────────────────────── */
.editor-sticky-bar {
  position: sticky;
  top: 0;
  z-index: 200;
  background-color: var(--bs-body-bg);
  padding-top: 0.75rem;
  padding-bottom: 0.625rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--bs-border-color);
  transition: box-shadow 0.15s ease;
}
.editor-sticky-bar.is-stuck {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}
[data-bs-theme="dark"] .editor-sticky-bar.is-stuck {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

/* Version pill inside thumbnail */
.gallery-version {
  position: absolute;
  bottom: var(--space-2);
  right: var(--space-2);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: .04em;
  padding: .2em .55em;
  border-radius: 8px;
  background: rgba(0,0,0,.18);
  color: #fff;
  backdrop-filter: blur(4px);
}

/* Hover action overlay */
.gallery-overlay {
  position: absolute;
  inset: 0;
  height: var(--gallery-thumb-height);
  background: rgba(15,17,19,.55);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  z-index: 2;
}
.gallery-overlay .btn {
  transform: translateY(4px);
  transition: transform .2s ease;
}
.gallery-card:hover .gallery-overlay .btn {
  transform: translateY(0);
}

/* Body */
.gallery-body {
  padding: var(--space-3) var(--space-4);
  flex: 1;
}
.gallery-key {
  font-family: var(--bs-font-monospace);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--bs-body-color);
  margin-bottom: var(--space-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gallery-meta {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
}

/* Footer */
.gallery-footer {
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--bs-border-color-translucent);
  background: var(--bs-tertiary-bg);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.72rem;
  color: var(--bs-secondary-color);
}
.gallery-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bs-primary);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Ghost "add" card */
.gallery-card--ghost {
  border: 2px dashed var(--bs-border-color);
  background: transparent;
  cursor: pointer;
  min-height: 240px;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--bs-secondary-color);
  transition: border-color .2s, color .2s, box-shadow .2s;
  box-shadow: none;
}
.gallery-card--ghost:hover {
  border-color: var(--bs-primary);
  color: var(--bs-primary);
  transform: none;
  box-shadow: 0 4px 16px rgba(13,110,253,.12);
}
.gallery-card--ghost .gallery-ghost-icon {
  font-size: 2rem;
  opacity: .45;
  margin-bottom: var(--space-2);
  transition: opacity .2s;
}
.gallery-card--ghost:hover .gallery-ghost-icon { opacity: .75; }

/* ── Status Pill ───────────────────────────────────────────────────────────── */
/* A unified, accessible status indicator: color + icon + label */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: .28em .75em;
  border-radius: var(--status-pill-radius);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
  line-height: 1.4;
  user-select: none;
}
.status-pill i { font-size: .8em; }

/* Variants */
.status-pill--success  { background: #dcfce7; color: #166534; }
.status-pill--danger   { background: #fee2e2; color: #991b1b; }
.status-pill--warning  { background: #fef9c3; color: #854d0e; }
.status-pill--info     { background: #dbeafe; color: #1e40af; }
.status-pill--secondary{ background: var(--bs-secondary-bg); color: var(--bs-secondary-color); }
.status-pill--processing {
  background: #dbeafe;
  color: #1e40af;
  animation: pill-pulse 2s ease-in-out infinite;
}

[data-bs-theme="dark"] .status-pill--success  { background: rgba(34,197,94,.15);  color: #4ade80; }
[data-bs-theme="dark"] .status-pill--danger   { background: rgba(239,68,68,.15);  color: #f87171; }
[data-bs-theme="dark"] .status-pill--warning  { background: rgba(234,179,8,.15);  color: #fde047; }
[data-bs-theme="dark"] .status-pill--info     { background: rgba(59,130,246,.15); color: #93c5fd; }
[data-bs-theme="dark"] .status-pill--secondary{ background: rgba(255,255,255,.07); color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .status-pill--processing { background: rgba(59,130,246,.15); color: #93c5fd; }

/* Clickable pill (for dashboard filter trigger) */
.status-pill--clickable {
  cursor: pointer;
  transition: box-shadow .15s, transform .15s;
}
.status-pill--clickable:hover  { box-shadow: 0 0 0 2px var(--bs-primary); transform: scale(1.03); }
.status-pill--clickable:active { transform: scale(0.98); }

/* Dot-only size variant */
.status-dot-sm {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot-sm--success  { background: #22c55e; }
.status-dot-sm--danger   { background: #ef4444; }
.status-dot-sm--warning  { background: #f59e0b; }
.status-dot-sm--info     { background: #3b82f6; }
.status-dot-sm--processing {
  background: #3b82f6;
  animation: dot-pulse 1.5s ease-in-out infinite;
}

@keyframes pill-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .7; }
}
@keyframes dot-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.35); opacity: .6; }
}

/* ── Pipeline Progress Bar ─────────────────────────────────────────────────── */
/* Horizontal step strip showing the 5-state termination lifecycle */
.pipeline-bar {
  display: flex;
  align-items: center;
  gap: 0;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: .03em;
  white-space: nowrap;
  overflow: hidden;
}
.pipeline-step {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: .25em .55em;
  border-radius: 4px;
  position: relative;
  color: var(--bs-secondary-color);
  transition: background .15s, color .15s;
}
.pipeline-step--done {
  color: #16a34a;
}
.pipeline-step--active {
  color: #2563eb;
  background: rgba(37,99,235,.08);
}
.pipeline-step--failed {
  color: #dc2626;
}
[data-bs-theme="dark"] .pipeline-step--done   { color: #4ade80; }
[data-bs-theme="dark"] .pipeline-step--active { color: #93c5fd; background: rgba(147,197,253,.08); }
[data-bs-theme="dark"] .pipeline-step--failed { color: #f87171; }

.pipeline-step-dot {
  width: var(--pipeline-dot);
  height: var(--pipeline-dot);
  border-radius: 50%;
  border: 2px solid currentColor;
  background: transparent;
  flex-shrink: 0;
  transition: background .15s;
}
.pipeline-step--done   .pipeline-step-dot { background: currentColor; border-color: currentColor; }
.pipeline-step--active .pipeline-step-dot {
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(37,99,235,.2);
  animation: dot-pulse 1.4s ease-in-out infinite;
}
.pipeline-step--failed .pipeline-step-dot { background: currentColor; }

/* Connector line between steps */
.pipeline-connector {
  flex: 1;
  min-width: 12px;
  height: 2px;
  background: var(--bs-border-color);
  border-radius: 1px;
}
.pipeline-connector--done {
  background: #22c55e;
}
[data-bs-theme="dark"] .pipeline-connector--done { background: #4ade80; }

/* Compact single-line variant (for table rows) */
.pipeline-bar--compact .pipeline-step-label { display: none; }
.pipeline-bar--compact { gap: 2px; width: fit-content; }
.pipeline-bar--compact .pipeline-connector { flex: 0 0 10px; min-width: 6px; max-width: 10px; }

/* ── Activity Timeline ─────────────────────────────────────────────────────── */
.timeline-feed {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}
.timeline-feed::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--timeline-line-color);
  border-radius: 1px;
}
.timeline-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-2) 0 var(--space-4) 0;
  position: relative;
}
.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  width: var(--timeline-dot);
  height: var(--timeline-dot);
  border-radius: 50%;
  border: 2px solid var(--bs-card-bg);
  flex-shrink: 0;
  margin-top: .35rem;
  position: relative;
  z-index: 1;
  box-shadow: 0 0 0 2px currentColor;
}
/* Dot colour variants */
.timeline-dot--approve    { color: #22c55e; background: #22c55e; }
.timeline-dot--reject     { color: #ef4444; background: #ef4444; }
.timeline-dot--cancel     { color: #ef4444; background: #ef4444; }
.timeline-dot--uncancel   { color: #22c55e; background: #22c55e; }
.timeline-dot--remark     { color: #94a3b8; background: #94a3b8; }
.timeline-dot--submit     { color: #f59e0b; background: #f59e0b; }
.timeline-dot--amend      { color: #3b82f6; background: #3b82f6; }
.timeline-dot--email      { color: #8b5cf6; background: #8b5cf6; }
.timeline-dot--default    { color: var(--bs-secondary-color); background: var(--bs-secondary-color); }

.timeline-body {
  flex: 1;
  min-width: 0;
}
.timeline-action {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--bs-body-color);
  margin-bottom: .1rem;
}
.timeline-meta {
  font-size: 0.73rem;
  color: var(--bs-secondary-color);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.timeline-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--bs-primary);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 700;
  flex-shrink: 0;
}
.timeline-note {
  margin-top: var(--space-1);
  font-size: 0.8rem;
  color: var(--bs-body-color);
  background: var(--bs-tertiary-bg);
  border-left: 3px solid var(--bs-border-color);
  padding: .4em .75em;
  border-radius: 0 6px 6px 0;
  line-height: 1.5;
}

/* ── Bulk Action Bar ───────────────────────────────────────────────────────── */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bulk-bar-bg);
  border: 1px solid var(--bulk-bar-border);
  border-radius: 10px;
  font-size: 0.84rem;
  flex-wrap: wrap;
}
.bulk-bar--sticky {
  position: sticky;
  bottom: var(--space-4);
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
}
[data-bs-theme="dark"] .bulk-bar { box-shadow: 0 4px 20px rgba(0,0,0,.4); }

.bulk-bar-count {
  font-weight: 700;
  color: #92400e;
}
[data-bs-theme="dark"] .bulk-bar-count { color: #fde047; }

.bulk-bar-sep {
  width: 1px;
  height: 1.2em;
  background: var(--bulk-bar-border);
  flex-shrink: 0;
}
.bulk-bar-spacer { flex: 1; }

/* ── Wizard Step Header ────────────────────────────────────────────────────── */
.wizard-steps {
  display: flex;
  align-items: center;
  gap: 0;
  padding: var(--space-4) 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.wizard-steps::-webkit-scrollbar { display: none; }

.wizard-step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--wizard-idle-color);
  transition: color .2s;
}
.wizard-step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  background: transparent;
  transition: background .2s, border-color .2s;
  flex-shrink: 0;
}
.wizard-step--active {
  color: var(--wizard-active-color);
}
.wizard-step--active .wizard-step-num {
  background: var(--wizard-active-color);
  border-color: var(--wizard-active-color);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(13,110,253,.15);
}
.wizard-step--done {
  color: var(--wizard-done-color);
}
.wizard-step--done .wizard-step-num {
  background: var(--wizard-done-color);
  border-color: var(--wizard-done-color);
  color: #fff;
}
.wizard-connector {
  flex: 1;
  min-width: 20px;
  max-width: 60px;
  height: 2px;
  background: var(--bs-border-color);
  border-radius: 1px;
  margin: 0 var(--space-1);
  transition: background .2s;
}
.wizard-connector--done { background: var(--wizard-done-color); }

/* Mobile: show only number */
@media (max-width: 575px) {
  .wizard-step-label { display: none; }
  .wizard-connector  { min-width: 10px; max-width: 30px; }
}

/* ── Card Metric (enhanced stat card) ─────────────────────────────────────── */
.card-metric {
  border-radius: 14px;
  border: 1px solid var(--bs-border-color-translucent);
  background: var(--bs-card-bg);
  padding: var(--space-5) var(--space-5) var(--space-4);
  box-shadow: var(--gallery-card-shadow);
  transition: box-shadow .2s, transform .2s;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.card-metric:hover {
  box-shadow: var(--gallery-card-shadow-hover);
  transform: translateY(-2px);
}
.card-metric-value {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--bs-body-color);
  margin-bottom: var(--space-1);
}
.card-metric-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--bs-secondary-color);
}
.card-metric-trend {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: .2em .5em;
  border-radius: 6px;
}
.card-metric-trend--up   { color: #16a34a; background: rgba(34,197,94,.1); }
.card-metric-trend--down { color: #dc2626; background: rgba(239,68,68,.1); }
.card-metric-trend--flat { color: var(--bs-secondary-color); background: var(--bs-secondary-bg); }
[data-bs-theme="dark"] .card-metric-trend--up   { color: #4ade80; background: rgba(74,222,128,.1); }
[data-bs-theme="dark"] .card-metric-trend--down { color: #f87171; background: rgba(248,113,113,.1); }

/* Accent stripe (top border) — keep existing .stat-card-* convention */
.card-metric::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 14px 14px 0 0;
  background: var(--card-metric-accent, var(--bs-primary));
}

/* ── Urgency Border Variants (submission cards) ────────────────────────────── */
/* Left-border urgency strip on batch / submission cards */
.urgency-danger  { border-left: 4px solid #ef4444 !important; }
.urgency-warning { border-left: 4px solid #f59e0b !important; }
.urgency-info    { border-left: 4px solid #3b82f6 !important; }
.urgency-success { border-left: 4px solid #22c55e !important; }
.urgency-none    { border-left: 4px solid var(--bs-border-color) !important; }

/* ── Tab Strip (pill style) ────────────────────────────────────────────────── */
/* Reusable pill-tab navigation: filter tabs on list pages */
.tab-strip {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
  padding: var(--space-1);
  background: var(--bs-secondary-bg);
  border-radius: 10px;
  border: 1px solid var(--bs-border-color-translucent);
}
.tab-strip-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: .35em .85em;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: background .15s, color .15s, box-shadow .15s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}
.tab-strip-item:hover {
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
}
.tab-strip-item.active,
.tab-strip-item[aria-selected="true"] {
  background: var(--bs-body-bg);
  color: var(--bs-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
[data-bs-theme="dark"] .tab-strip-item.active,
[data-bs-theme="dark"] .tab-strip-item[aria-selected="true"] {
  background: var(--bs-card-bg);
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.tab-strip-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--bs-secondary-bg);
  color: var(--bs-secondary-color);
  line-height: 1;
}
.tab-strip-item.active .tab-strip-badge,
.tab-strip-item[aria-selected="true"] .tab-strip-badge {
  background: var(--bs-primary);
  color: #fff;
}

/* ── Quick Filter Pills (inline form shortcuts) ────────────────────────────── */
.qfilter-pills {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
}
.qfilter-pill {
  padding: .3em .85em;
  border-radius: 20px;
  border: 1.5px solid var(--bs-border-color);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap;
  line-height: 1.5;
}
.qfilter-pill:hover {
  border-color: var(--bs-primary);
  color: var(--bs-primary);
  background: rgba(13,110,253,.05);
}
.qfilter-pill.active {
  border-color: var(--bs-primary);
  color: var(--bs-primary);
  background: rgba(13,110,253,.1);
}
[data-bs-theme="dark"] .qfilter-pill.active {
  background: rgba(61,139,253,.15);
}

/* ── Info / Alert Banner Variants ─────────────────────────────────────────── */
/* Replaces generic Bootstrap alerts for contextual banners */
.banner {
  border-radius: 10px;
  border: 1px solid transparent;
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: 0.86rem;
  line-height: 1.5;
}
.banner-icon {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: .1rem;
}
.banner--info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e3a5f;
  border-left: 4px solid #3b82f6;
}
.banner--warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #713f12;
  border-left: 4px solid #f59e0b;
}
.banner--danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: #7f1d1d;
  border-left: 4px solid #ef4444;
}
.banner--success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #14532d;
  border-left: 4px solid #22c55e;
}
/* Emergency pulse variant */
.banner--emergency {
  background: #fef2f2;
  border-color: #fecaca;
  color: #7f1d1d;
  border-left: 4px solid #ef4444;
  animation: banner-pulse 2s ease-in-out infinite;
}
@keyframes banner-pulse {
  0%, 100% { border-left-color: #ef4444; }
  50%       { border-left-color: #dc2626; box-shadow: 0 0 0 3px rgba(239,68,68,.12); }
}

[data-bs-theme="dark"] .banner--info    { background: rgba(59,130,246,.08);  border-color: rgba(59,130,246,.25);  color: #93c5fd; }
[data-bs-theme="dark"] .banner--warning { background: rgba(245,158,11,.08);  border-color: rgba(245,158,11,.25);  color: #fde047; }
[data-bs-theme="dark"] .banner--danger  { background: rgba(239,68,68,.08);   border-color: rgba(239,68,68,.25);   color: #f87171; }
[data-bs-theme="dark"] .banner--success { background: rgba(34,197,94,.08);   border-color: rgba(34,197,94,.25);   color: #4ade80; }
[data-bs-theme="dark"] .banner--emergency { background: rgba(239,68,68,.1);  border-color: rgba(239,68,68,.3);    color: #f87171; }

/* ── Pill Pagination ───────────────────────────────────────────────────────── */
.pill-nav {
  display: flex;
  gap: var(--space-1);
  align-items: center;
  flex-wrap: wrap;
}
.pill-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 var(--space-3);
  border-radius: 18px;
  border: 1.5px solid var(--bs-border-color);
  background: var(--bs-card-bg);
  color: var(--bs-body-color);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  text-decoration: none;
  line-height: 1;
}
.pill-nav-btn:hover:not(:disabled):not(.active) {
  border-color: var(--bs-primary);
  color: var(--bs-primary);
}
.pill-nav-btn.active {
  background: var(--bs-primary);
  border-color: var(--bs-primary);
  color: #fff;
}
.pill-nav-btn:disabled,
.pill-nav-btn[aria-disabled="true"] {
  opacity: .4;
  cursor: not-allowed;
}

/* ── Submission / Batch Card ───────────────────────────────────────────────── */
/* Horizontal card for batch list and execution dashboard */
.sub-card {
  border-radius: 12px;
  border: 1px solid var(--bs-border-color-translucent);
  background: var(--bs-card-bg);
  box-shadow: var(--gallery-card-shadow);
  /* Note: overflow:hidden clips expandable rows and tooltips in execution dashboard.
     Use overflow:visible and rely on border-radius clipping at the element level. */
  overflow: visible;
  transition: box-shadow .2s;
}
/* Clip the visual corners without blocking expansion content */
.sub-card > .sub-card-header:first-child { border-radius: 12px 12px 0 0; }
.sub-card > :last-child { border-radius: 0 0 12px 12px; }
.sub-card:hover { box-shadow: var(--gallery-card-shadow-hover); }

.sub-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  flex-wrap: wrap;
  border-bottom: 1px solid var(--bs-border-color-translucent);
  background: var(--bs-tertiary-bg);
}
.sub-card-no {
  font-family: var(--bs-font-monospace);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--bs-body-color);
}
.sub-card-range {
  font-size: 0.78rem;
  color: var(--bs-secondary-color);
  display: flex;
  align-items: center;
  gap: 4px;
}
.sub-card-age {
  font-size: 0.72rem;
  color: var(--bs-secondary-color);
}
.sub-card-spacer { flex: 1; }
.sub-card-body {
  padding: var(--space-3) var(--space-4);
}
.sub-card-footer {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--bs-border-color-translucent);
  background: var(--bs-tertiary-bg);
  flex-wrap: wrap;
}

/* ── Review Row Card (request_detail mobile) ──────────────────────────────── */
.review-card {
  border-radius: 10px;
  border: 1px solid var(--bs-border-color-translucent);
  background: var(--bs-card-bg);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-2);
  transition: box-shadow .15s;
  border-left: 4px solid var(--bs-border-color);
}
.review-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.review-card--approved { border-left-color: #22c55e; }
.review-card--rejected { border-left-color: #ef4444; }
.review-card--pending  { border-left-color: #f59e0b; }
[data-bs-theme="dark"] .review-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.25); }

/* ── Editor Toolbar (email template editor) ────────────────────────────────── */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: var(--bs-card-bg);
  border-bottom: 1px solid var(--bs-border-color-translucent);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-wrap: wrap;
  min-height: 56px;
}
.editor-toolbar-breadcrumb {
  font-size: 0.78rem;
  color: var(--bs-secondary-color);
  flex-shrink: 0;
}
.editor-toolbar-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--bs-body-color);
  flex-shrink: 0;
  cursor: text;
  border-bottom: 2px solid transparent;
  transition: border-color .15s;
  padding-bottom: 1px;
}
.editor-toolbar-title:hover  { border-bottom-color: var(--bs-primary); }
.editor-toolbar-spacer { flex: 1; }

/* Auto-save indicator */
.save-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.73rem;
  color: var(--bs-secondary-color);
  opacity: 0;
  transition: opacity .3s;
}
.save-indicator.visible  { opacity: 1; }
.save-indicator-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #22c55e;
  animation: dot-pulse 1.5s ease-in-out infinite;
}
.save-indicator--saving .save-indicator-dot  { background: #f59e0b; }
.save-indicator--saved  .save-indicator-dot  { background: #22c55e; animation: none; }

/* ── Merge Tag Pills (editor sidebar) ─────────────────────────────────────── */
.merge-tags-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
}
.merge-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: .3em .75em;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--bs-font-monospace);
  background: var(--bs-secondary-bg);
  border: 1px solid var(--bs-border-color);
  color: var(--bs-body-color);
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
  text-decoration: none;
  user-select: all;
}
.merge-tag-chip:hover {
  background: rgba(13,110,253,.08);
  border-color: var(--bs-primary);
  color: var(--bs-primary);
  transform: scale(1.02);
}
.merge-tag-chip--system {
  background: rgba(99,102,241,.08);
  border-color: rgba(99,102,241,.3);
  color: #4f46e5;
}
[data-bs-theme="dark"] .merge-tag-chip--system {
  color: #a5b4fc;
  background: rgba(99,102,241,.12);
  border-color: rgba(99,102,241,.25);
}
.merge-tag-copy-hint {
  font-size: 0.6rem;
  opacity: 0;
  transition: opacity .15s;
  color: var(--bs-secondary-color);
  font-family: var(--bs-font-sans-serif);
  font-weight: 400;
}
.merge-tag-chip:hover .merge-tag-copy-hint { opacity: 1; }

/* ── Responsive grid helpers ─────────────────────────────────────────────── */
/* Gallery grid — minmax(0,1fr) prevents tracks from exceeding the container
   even when card content has a large intrinsic min-width (e.g. long monospace keys).
   Default: 3 cols; 4 cols only on very wide screens (≥1400px) to avoid
   overflow on typical 1280–1366 px laptops with the 240px sidebar present. */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}
@media (min-width: 1400px) { .gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 991px)  { .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575px)  { .gallery-grid { grid-template-columns: minmax(0, 1fr); } }

/* 6-col metric grid (execution dashboard) */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-4);
}
@media (max-width: 1199px) { .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 767px)  { .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 479px)  { .metric-grid { grid-template-columns: 1fr; } }

/* ── Utility: rounded search input ──────────────────────────────────────────── */
.search-input-pill {
  border-radius: 20px !important;
  padding-left: 1rem !important;
  padding-right: 1rem !important;
  border-color: var(--bs-border-color) !important;
  transition: border-color .15s, box-shadow .15s !important;
}
.search-input-pill:focus {
  border-color: var(--bs-primary) !important;
  box-shadow: 0 0 0 3px rgba(13,110,253,.12) !important;
}

/* ── End Design System v2 ─────────────────────────────────────────────────── */

/* ── Close Case custom two-line select ───────────────────────────────────── */
/* Inline-expand pattern: no position:absolute — safe inside modal-dialog-scrollable */
.cc-custom-select { position: relative; }

.cc-select-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--bs-body-color);
  background-color: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  cursor: pointer;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  min-height: 2.25rem;
}
.cc-select-trigger:hover { border-color: var(--bs-secondary-color); }
.cc-select-trigger:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
  outline: 0;
}

.cc-select-placeholder { color: var(--bs-secondary-color); font-style: italic; flex-grow: 1; }

.cc-select-chevron {
  font-size: 0.75rem;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  color: var(--bs-secondary-color);
}
#cc-type-picker[data-open="true"] .cc-select-chevron { transform: rotate(180deg); }

.cc-select-options {
  list-style: none;
  margin: 2px 0 0;
  padding: 0.25rem 0;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  box-shadow: var(--bs-box-shadow-sm);
  overflow: hidden;
}

.cc-select-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  border-bottom: 1px solid var(--bs-border-color-translucent);
  min-height: 44px; /* WCAG touch target */
  transition: background-color 0.1s ease;
  user-select: none;
}
.cc-select-option:last-child { border-bottom: none; }
.cc-select-option:hover { background: var(--bs-tertiary-bg); }
.cc-select-option:focus { background: var(--bs-tertiary-bg); outline: 2px solid var(--bs-primary); outline-offset: -2px; }
.cc-select-option[aria-selected="true"] { background: var(--bs-primary-bg-subtle); }

.cc-opt-check {
  margin-top: 0.2rem;
  font-size: 0.85rem;
  color: var(--bs-success);
  flex-shrink: 0;
  width: 1rem;
  visibility: hidden;
}
.cc-select-option[aria-selected="true"] .cc-opt-check { visibility: visible; }

.cc-opt-body { display: flex; flex-direction: column; gap: 0.15rem; flex-grow: 1; min-width: 0; }

.cc-opt-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--bs-body-color);
  line-height: 1.3;
}
.cc-opt-desc {
  font-size: 0.72rem;
  color: var(--bs-secondary-color);
  line-height: 1.4;
  white-space: normal;
}
/* ── End Close Case custom select ────────────────────────────────────────── */
