/* ==========================================================================
   PM POSHAN - Soft UI / Claymorphic Design System
   Universal Design Tokens, Responsive Components, Shell & Analytics Primitives
   Version: 1.0.0 (Phased Adoption)
   ========================================================================== */

:root {
  /* ── Neutral & Canvas Colors ── */
  --color-white: #ffffff;
  --color-black: #000000;
  --bg-canvas: #ebeef5;
  --card-bg: rgba(255, 255, 255, 0.9);
  --card-bg-solid: #ffffff;
  --card-border: rgba(255, 255, 255, 0.95);
  --card-radius: 1.5rem;

  /* ── Typography & Accents ── */
  --text-main: #0f172a;
  --text-muted: #8c98a9;
  --text-sub: #475569;

  /* ── Brand Iris Tokens ── */
  --accent-iris: #8e72ef;
  --accent-iris-deep: #7755e8;
  --accent-iris-dark: #6a42ea;
  --accent-iris-light: #ece7fd;
  --accent-iris-glow: rgba(142, 114, 239, 0.28);
  --brand-grad: linear-gradient(135deg, var(--accent-iris), var(--accent-iris-dark));

  /* ── Distinct 3-Stage Split Bar Palette (High Contrast Triad) ── */
  --split-bv: #f59e0b;
  /* Bal Vatika: Warm Golden Amber */
  --split-bv-grad: linear-gradient(180deg, #fbbf24, #d97706);

  --split-pri: #8b5cf6;
  /* Primary: Vibrant Iris Purple */
  --split-pri-grad: linear-gradient(180deg, #a78bfa, #7c3aed);

  --split-upr: #0284c7;
  /* Upper Primary: Electric Sky Blue */
  --split-upr-grad: linear-gradient(180deg, #38bdf8, #0369a1);

  --split-track: #e5e9f2;
  --split-border: rgba(255, 255, 255, 0.55);

  /* ── Status Accents ── */
  --accent-green: #10b981;
  --accent-green-bg: #d1fae5;
  --accent-green-border: rgba(16, 185, 129, 0.3);
  --accent-red: #f43f5e;
  --accent-red-bg: #ffe4e6;
  --accent-red-border: rgba(244, 63, 94, 0.3);
  --accent-amber: #f59e0b;
  --accent-amber-bg: #fef3c7;
  --accent-amber-border: rgba(245, 158, 11, 0.3);
  --accent-sky: #0284c7;
  --accent-sky-bg: #e0f2fe;

  /* ── Component Fills & Overlays ── */
  --drawer-bg: rgba(255, 255, 255, 0.94);
  --scrim-bg: rgba(15, 23, 42, 0.35);
  --pill-track-bg: rgba(226, 232, 240, 0.5);
  --ctrl-select-bg: rgba(226, 232, 240, 0.4);
  --border-hairline: rgba(140, 152, 169, 0.15);
  --color-white-translucent: rgba(255, 255, 255, 0.5);
  --color-dark-translucent: rgba(0, 0, 0, 0.4);
  --kpi-icon-bg: rgba(142, 114, 239, 0.12);
  --kpi-icon-border: rgba(142, 114, 239, 0.25);
  --kpi-hover-bg: rgba(142, 114, 239, 0.15);
  --fy-badge-border: rgba(142, 114, 239, 0.3);
  --progress-track-bg: rgba(140, 152, 169, 0.15);
  --progress-grad: linear-gradient(90deg, #a78bfa, #8b5cf6);
  --progress-bar-shadow: rgba(139, 92, 246, 0.4);
  --gauge-active-start: #8b5cf6;
  --gauge-active-end: #a78bfa;
  --gauge-track: rgba(140, 152, 169, 0.2);

  /* ── Soft Tactile Diffuse Shadows (rem-based) ── */
  --shadow-soft:
    0 0.875rem 2.125rem -0.25rem rgba(135, 145, 180, 0.12),
    0 0.25rem 0.875rem 0 rgba(135, 145, 180, 0.05),
    inset 0 0.0625rem 0.0625rem 0 rgba(255, 255, 255, 0.95);

  --shadow-card-hover:
    0 1.25rem 2.625rem -0.375rem rgba(120, 135, 175, 0.18),
    0 0.375rem 1.125rem 0 rgba(120, 135, 175, 0.08),
    inset 0 0.0625rem 0.0625rem 0 rgba(255, 255, 255, 1);

  --shadow-nav-active:
    0 0.375rem 1rem rgba(120, 135, 175, 0.14),
    0 0.125rem 0.25rem rgba(0, 0, 0, 0.02);

  --shadow-dropdown:
    0 1.125rem 3rem -0.375rem rgba(50, 65, 90, 0.18),
    0 0.375rem 1.125rem 0 rgba(50, 65, 90, 0.08),
    inset 0 0.0625rem 0.0625rem rgba(255, 255, 255, 0.9);

  --shadow-drawer:
    -1rem 0 3.375rem rgba(40, 55, 80, 0.16),
    -0.25rem 0 1rem rgba(40, 55, 80, 0.08);

  --shadow-capsule: 0 0.25rem 0.625rem rgba(0, 0, 0, 0.04);
  --shadow-capsule-hover: 0 0.5rem 1.5rem rgba(142, 114, 239, 0.28);
  --shadow-badge: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.06);

  /* ── Ambient Mesh Gradients (Light) ── */
  --grad-mesh-1: rgba(248, 182, 162, 0.3);
  --grad-mesh-2: rgba(210, 222, 248, 0.55);
  --grad-mesh-3: rgba(225, 215, 252, 0.45);

  /* ── Extended Semantic Color, Border & Glow Tokens ── */
  --accent-iris-deep-dark: #4c1d95;
  --accent-iris-border: rgba(142, 114, 239, 0.3);
  --accent-iris-border-strong: rgba(142, 114, 239, 0.45);
  --accent-iris-border-dashed: rgba(142, 114, 239, 0.4);
  --accent-iris-tint-15: rgba(142, 114, 239, 0.15);
  --accent-iris-tint-20: rgba(142, 114, 239, 0.2);
  --accent-iris-tint-25: rgba(142, 114, 239, 0.25);
  --accent-iris-glow-hover: rgba(142, 114, 239, 0.45);
  --accent-iris-shadow-sm: 0 0.375rem 1rem rgba(142, 114, 239, 0.2);
  --accent-iris-shadow-md: 0 0.25rem 0.75rem rgba(142, 114, 239, 0.4);
  --accent-iris-shadow-card: 0 0.5rem 1.25rem rgba(142, 114, 239, 0.12);
  --accent-iris-grad-dark: linear-gradient(135deg, #7c3aed, #5b21b6);
  --accent-iris-soft-text: #ede9fe;
  --accent-iris-soft-light: #c4b5fd;

  --accent-green-dark: #059669;
  --accent-green-grad: linear-gradient(135deg, var(--accent-green), var(--accent-green-dark));
  --accent-green-shadow-sm: 0 0.2rem 0.6rem rgba(16, 185, 129, 0.3);
  --accent-green-shadow-md: 0 0.35rem 0.9rem rgba(16, 185, 129, 0.45);
  --accent-green-shadow-pill: 0 0.125rem 0.5rem rgba(16, 185, 129, 0.4);
  --accent-green-shadow-pill-hover: 0 0.25rem 0.85rem rgba(16, 185, 129, 0.6);

  --accent-red-dark: #e11d48;
  --accent-red-grad: linear-gradient(135deg, var(--accent-red), var(--accent-red-dark));
  --accent-red-shadow-pill: 0 0.125rem 0.5rem rgba(244, 63, 94, 0.4);
  --accent-red-shadow-pill-hover: 0 0.25rem 0.85rem rgba(244, 63, 94, 0.6);
  --accent-red-shadow-card: 0 0.125rem 0.625rem rgba(239, 68, 68, 0.25);

  --surface-muted-tint: rgba(140, 152, 169, 0.1);
  --surface-white-border-25: rgba(255, 255, 255, 0.25);
  --surface-white-border-30: rgba(255, 255, 255, 0.3);
  --surface-white-border-35: rgba(255, 255, 255, 0.35);
  --surface-white-border-10: rgba(255, 255, 255, 0.1);
  --surface-floating-dark: rgba(15, 23, 42, 0.88);
  --text-dark-primary: #f1f5f9;
  --btn-secondary-dark-text: #cbd5e1;

  --shadow-inset-xs: inset 0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.03);
  --shadow-inset-sm: inset 0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.04);
  --shadow-inset-md: inset 0 0.125rem 0.25rem rgba(0, 0, 0, 0.04);
  --shadow-subtle-xs: 0 0.25rem 0.625rem rgba(0, 0, 0, 0.03);
  --shadow-floating-dark: 0 0.375rem 1.25rem rgba(0, 0, 0, 0.35);
  --shadow-btn-sm: 0 0.125rem 0.375rem rgba(0, 0, 0, 0.15);
}

/* ── Dark Mode Token Override ── */
[data-theme-resolved="dark"],
html.theme-dark {
  --bg-canvas: #090d16;
  --card-bg: rgba(20, 27, 45, 0.82);
  --card-bg-solid: #151d30;
  --card-border: rgba(255, 255, 255, 0.08);

  --shadow-soft:
    0 0.875rem 2.125rem -0.25rem rgba(0, 0, 0, 0.45),
    0 0.25rem 0.875rem 0 rgba(0, 0, 0, 0.25),
    inset 0 0.0625rem 0.0625rem 0 rgba(255, 255, 255, 0.08);

  --shadow-card-hover:
    0 1.25rem 2.625rem -0.375rem rgba(0, 0, 0, 0.6),
    0 0.375rem 1.125rem 0 rgba(0, 0, 0, 0.35),
    inset 0 0.0625rem 0.0625rem 0 rgba(255, 255, 255, 0.14);

  --shadow-nav-active:
    0 0.375rem 1.125rem rgba(0, 0, 0, 0.5),
    inset 0 0.0625rem 0 rgba(255, 255, 255, 0.15);

  --shadow-dropdown:
    0 1.25rem 3.125rem rgba(0, 0, 0, 0.65),
    0 0.375rem 1.125rem rgba(0, 0, 0, 0.4),
    inset 0 0.0625rem 0 rgba(255, 255, 255, 0.12);

  --shadow-drawer:
    -1rem 0 3.375rem rgba(0, 0, 0, 0.7),
    -0.25rem 0 1.125rem rgba(0, 0, 0, 0.4);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-sub: #cbd5e1;

  --accent-iris: #a78bfa;
  --accent-iris-deep: #8b5cf6;
  --accent-iris-dark: #7c3aed;
  --accent-iris-light: rgba(167, 139, 250, 0.18);
  --accent-iris-glow: rgba(167, 139, 250, 0.35);

  /* 3-Stage Split Bar Palette (Dark mode luminous) */
  --split-bv: #fbbf24;
  --split-bv-grad: linear-gradient(180deg, #fde68a, #d97706);

  --split-pri: #a78bfa;
  --split-pri-grad: linear-gradient(180deg, #c4b5fd, #7c3aed);

  --split-upr: #38bdf8;
  --split-upr-grad: linear-gradient(180deg, #7dd3fc, #0284c7);

  --split-track: #1b2336;
  --split-border: rgba(0, 0, 0, 0.35);

  --accent-green-bg: rgba(16, 185, 129, 0.18);
  --accent-red-bg: rgba(244, 63, 94, 0.18);
  --accent-amber-bg: rgba(245, 158, 11, 0.18);
  --accent-sky-bg: rgba(2, 132, 199, 0.18);

  --drawer-bg: rgba(15, 23, 42, 0.96);
  --scrim-bg: rgba(0, 0, 0, 0.65);
  --pill-track-bg: rgba(30, 41, 59, 0.5);
  --ctrl-select-bg: rgba(30, 41, 59, 0.4);
  --border-hairline: rgba(148, 163, 184, 0.15);
  --gauge-track: rgba(140, 152, 169, 0.25);

  /* Ambient Mesh Gradients (Dark) */
  --grad-mesh-1: rgba(225, 29, 72, 0.12);
  --grad-mesh-2: rgba(99, 102, 241, 0.18);
  --grad-mesh-3: rgba(139, 92, 246, 0.15);
}

/* ==========================================================================
   Global Ambient Mesh Canvas
   ========================================================================== */
body {
  min-height: 100vh;
  background-color: var(--bg-canvas) !important;
  background-image:
    radial-gradient(at 0% 100%, var(--grad-mesh-1) 0, transparent 48%),
    radial-gradient(at 100% 0%, var(--grad-mesh-2) 0, transparent 45%),
    radial-gradient(at 95% 95%, var(--grad-mesh-3) 0, transparent 45%) !important;
  background-attachment: fixed !important;
  color: var(--text-main);
  transition: background-color 0.35s ease, color 0.35s ease;
}

/* ==========================================================================
   Typography & Universal Primitives
   ========================================================================== */
.gradient-text {
  background: var(--progress-grad);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
}

.greeting-section {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.greeting-title {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.greeting-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.1875rem;
}

.fy-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem;
  border-radius: 9999rem;
  background: var(--accent-iris-light);
  color: var(--accent-iris-deep);
  border: 0.0625rem solid var(--fy-badge-border);
  font-size: 0.78rem;
  font-weight: 700;
}

/* ==========================================================================
   Frosted Glass Top Navigation Bar
   ========================================================================== */
.soft-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: nowrap;
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.75rem 1.5rem;
  background: var(--card-bg);
  backdrop-filter: blur(1rem);
  -webkit-backdrop-filter: blur(1rem);
  border-bottom: 0.0625rem solid var(--card-border);
  box-shadow: var(--shadow-soft);
  transition: all 0.25s ease;
}

.soft-top-bar .nav-container {
  width: 100%;
  max-width: 80rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-logo-disc {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999rem;
  background: var(--brand-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-white);
  box-shadow: 0 0.5rem 1.125rem var(--accent-iris-glow);
}

.brand-logo-disc svg {
  width: 1.35rem;
  height: 1.35rem;
}

.brand-logo-disc.brand-logo-disc-sm {
  width: 2rem;
  height: 2rem;
}

.brand-text-block {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.brand-tag {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
}

/* Frosted Pill Navigation Track */
.pill-navbar {
  display: inline-flex;
  align-items: center;
  background: var(--pill-track-bg);
  backdrop-filter: blur(0.75rem);
  -webkit-backdrop-filter: blur(0.75rem);
  padding: 0.3125rem;
  border-radius: 9999rem;
  gap: 0.25rem;
  border: 0.0625rem solid var(--card-border);
  flex-shrink: 0;
  position: relative;
  z-index: 60;
}

.pill-nav-btn {
  padding: 0.5rem 1.125rem;
  border-radius: 9999rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: none;
  background: transparent;
  outline: none;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.pill-nav-btn:hover {
  color: var(--text-main);
}

.pill-nav-btn.active {
  background: var(--card-bg-solid);
  color: var(--text-main);
  font-weight: 700;
  box-shadow: var(--shadow-nav-active);
}

/* Nav Dropdown Menus */
.pill-nav-dropdown-wrapper {
  position: relative;
  display: inline-flex;
  z-index: 70;
}

.dropdown-caret {
  transition: transform 0.2s ease;
}

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

.pill-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.375rem);
  left: 50%;
  transform: translateX(-50%);
  min-width: 13.5rem;
  background: var(--card-bg-solid);
  border: 0.0625rem solid var(--card-border);
  border-radius: 1rem;
  box-shadow: var(--shadow-dropdown);
  padding: 0.375rem;
  z-index: 1000;
  display: none;
  flex-direction: column;
  gap: 0.125rem;
  animation: dropdownPopCentered 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownPopCentered {
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(0.92) translateY(-0.375rem);
  }

  100% {
    opacity: 1;
    transform: translateX(-50%) scale(1) translateY(0);
  }
}

.pill-dropdown-menu.show {
  display: flex;
}

.pill-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.875rem;
  border-radius: 0.625rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-sub);
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  text-align: left;
}

.pill-dropdown-item:hover,
.pill-dropdown-item.is-active,
.pill-dropdown-item.active {
  background: var(--accent-iris-light);
  color: var(--accent-iris-deep);
}

[data-theme-resolved="dark"] .pill-dropdown-item:hover,
html.theme-dark .pill-dropdown-item:hover,
[data-theme-resolved="dark"] .pill-dropdown-item.is-active,
html.theme-dark .pill-dropdown-item.is-active {
  background: var(--accent-iris-tint-25);
  color: var(--accent-iris-soft-text);
}

/* Right Header Actions & Buttons */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-shrink: 0;
}

.theme-cycle-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
  padding: 0.4375rem 0.875rem;
  border-radius: 9999rem;
  background: var(--card-bg);
  backdrop-filter: blur(0.75rem);
  border: 0.0625rem solid var(--card-border);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  transition: all 0.2s ease;
  outline: none;
}

.theme-cycle-pill:hover {
  transform: translateY(-0.0625rem);
  box-shadow: var(--shadow-card-hover);
}

.theme-cycle-icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-iris);
}

.icon-pill-btn {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 9999rem;
  background: var(--card-bg);
  backdrop-filter: blur(0.75rem);
  border: 0.0625rem solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: all 0.2s ease;
  position: relative;
}

.icon-pill-btn:hover {
  transform: translateY(-0.0625rem);
  color: var(--text-main);
  box-shadow: var(--shadow-card-hover);
}

/* User Profile Pill Trigger */
.profile-pill,
#profilePillBtn {
  width: auto;
  height: auto;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  background: var(--card-bg);
  backdrop-filter: blur(0.75rem);
  padding: 0.25rem 0.875rem 0.25rem 0.3125rem;
  border-radius: 9999rem;
  box-shadow: var(--shadow-soft);
  border: 0.0625rem solid var(--card-border);
  cursor: pointer;
  transition: all 0.2s ease;
}

.profile-pill:hover,
#profilePillBtn:hover {
  transform: translateY(-0.0625rem);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--accent-iris);
}

.profile-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 9999rem;
  background: var(--brand-grad);
  color: var(--color-white);
  font-weight: 800;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
}

.profile-role {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Slide-in Right Navigation Drawer
   ========================================================================== */
.drawer-scrim,
.nav-drawer-scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim-bg);
  backdrop-filter: blur(0.25rem);
  -webkit-backdrop-filter: blur(0.25rem);
  z-index: 99990 !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.drawer-scrim.is-open,
.nav-drawer-scrim.is-open {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.soft-drawer-panel,
.nav-drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 24rem;
  background: var(--drawer-bg);
  backdrop-filter: blur(1.5rem);
  -webkit-backdrop-filter: blur(1.5rem);
  border-left: 0.0625rem solid var(--card-border);
  box-shadow: var(--shadow-drawer);
  z-index: 99995 !important;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.soft-drawer-panel.is-open,
.nav-drawer-panel.is-open {
  transform: translateX(0) !important;
}

.drawer-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 0.0625rem solid var(--border-hairline);
}

.drawer-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.drawer-brand-title {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-main);
  line-height: 1.1;
}

.drawer-close-btn {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999rem;
  background: var(--card-bg-solid);
  border: 0.0625rem solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.drawer-close-btn:hover {
  color: var(--text-main);
  background: var(--accent-red-bg);
  border-color: var(--accent-red);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.drawer-user-card {
  background: var(--card-bg-solid);
  border: 0.0625rem solid var(--card-border);
  border-radius: 1.125rem;
  padding: 1rem;
  box-shadow: var(--shadow-soft);
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.drawer-avatar-lg {
  width: 3rem;
  height: 3rem;
  border-radius: 9999rem;
  background: var(--brand-grad);
  color: var(--color-white);
  font-weight: 800;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0.25rem 0.75rem var(--accent-iris-glow);
  overflow: hidden;
}

.drawer-avatar-lg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.drawer-user-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
}

.drawer-role-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--accent-iris-light);
  color: var(--accent-iris-deep);
  padding: 0.125rem 0.5rem;
  border-radius: 0.375rem;
  margin-top: 0.25rem;
}

.drawer-nav-group-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.drawer-nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.drawer-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: 0.75rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-sub);
  text-decoration: none;
  transition: all 0.15s ease;
}

.drawer-nav-link:hover {
  background: var(--card-bg-solid);
  color: var(--accent-iris-deep);
  transform: translateX(0.1875rem);
}

.drawer-nav-link.active,
.drawer-nav-item.is-active,
.drawer-subnav-item.is-active,
[data-theme-resolved="dark"] .drawer-nav-item.is-active,
[data-theme-resolved="dark"] .drawer-subnav-item.is-active,
html.theme-dark .drawer-nav-item.is-active,
html.theme-dark .drawer-subnav-item.is-active {
  background: var(--accent-iris-light) !important;
  color: var(--accent-iris-deep) !important;
  font-weight: 700 !important;
  border-radius: 0.75rem !important;
  box-shadow: none !important;
  transform: translateX(0.1875rem);
}

.drawer-nav-link.active .nav-icon,
.drawer-nav-link.active svg,
.drawer-nav-item.is-active .nav-icon,
.drawer-nav-item.is-active .sub-icon,
.drawer-subnav-item.is-active .nav-icon,
.drawer-subnav-item.is-active .sub-icon,
[data-theme-resolved="dark"] .drawer-nav-item.is-active .nav-icon,
[data-theme-resolved="dark"] .drawer-subnav-item.is-active .sub-icon,
html.theme-dark .drawer-nav-item.is-active .nav-icon,
html.theme-dark .drawer-subnav-item.is-active .sub-icon {
  color: var(--accent-iris-deep) !important;
  font-variation-settings: 'FILL' 1;
}

.drawer-nav-item,
.drawer-subnav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem !important;
  border-radius: 0.75rem !important;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-sub) !important;
  text-decoration: none;
  transition: all 0.15s ease;
  border: none !important;
  box-shadow: none !important;
}

.drawer-nav-item:hover,
.drawer-subnav-item:hover {
  background: var(--card-bg-solid) !important;
  color: var(--accent-iris-deep) !important;
  transform: translateX(0.1875rem);
}

.drawer-nav-item:hover .nav-icon,
.drawer-subnav-item:hover .sub-icon {
  color: var(--accent-iris-deep) !important;
}

.drawer-accordion-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.875rem;
  border-radius: 0.75rem;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  text-align: left;
}

.drawer-accordion-btn:hover {
  background: var(--card-bg-solid);
  color: var(--accent-iris-deep);
}

.drawer-accordion-btn.is-active-parent {
  color: var(--accent-iris-deep);
  font-weight: 700;
}

.drawer-accordion-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.accordion-arrow {
  font-size: 1.25rem;
  color: var(--text-muted);
  transition: transform 0.25s ease;
}

.drawer-accordion-btn.is-open .accordion-arrow {
  transform: rotate(180deg);
}

.drawer-submenu {
  display: none;
  flex-direction: column;
  padding: 0.25rem 0 0.25rem 1.25rem;
  gap: 0.15rem;
}

.drawer-submenu.is-open {
  display: flex;
}

.drawer-submenu-category {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.5rem 0.5rem 0.25rem;
}

.drawer-footer {
  padding: 1.125rem 1.5rem;
  border-top: 0.0625rem solid var(--border-hairline);
}

.btn-signout {
  width: 100%;
  padding: 0.6875rem;
  border-radius: 9999rem;
  background: transparent;
  border: 0.0625rem solid var(--accent-red);
  color: var(--accent-red);
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-signout:hover {
  background: var(--accent-red-bg);
  transform: translateY(-0.0625rem);
}

/* ==========================================================================
   Fluid Dynamic KPI Grid (Context-Driven, Variable Cardinality)
   ========================================================================== */
.kpi-grid,
.kpi-deck {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr));
  gap: 1.25rem;
  width: 100%;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 30;
}

.soft-card {
  background: var(--card-bg);
  backdrop-filter: blur(1rem);
  -webkit-backdrop-filter: blur(1rem);
  border-radius: var(--card-radius);
  border: 0.0625rem solid var(--card-border);
  box-shadow: var(--shadow-soft);
  padding: 1.5rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.soft-card:hover {
  transform: translateY(-0.1875rem);
  box-shadow: var(--shadow-card-hover);
}

.kpi-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 9.75rem;
  align-items: flex-start;
}

.kpi-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
  width: 100%;
}

.kpi-icon-pill {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: var(--kpi-icon-bg);
  border: 0.0625rem solid var(--kpi-icon-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-iris);
}

.kpi-icon-pill.danger {
  color: var(--accent-red);
  background: var(--accent-red-bg);
  border-color: var(--accent-red-border);
}

.kpi-icon-pill.success {
  color: var(--accent-green);
  background: var(--accent-green-bg);
  border-color: var(--accent-green-border);
}

.kpi-icon-pill.deep {
  color: var(--accent-iris-deep);
  background: var(--accent-iris-light);
  border-color: var(--fy-badge-border);
}

.kpi-card:has(.kpi-dropdown-menu.show),
.kpi-card.dropdown-open,
.kpi-card:focus-within {
  z-index: 40;
}

.kpi-dropdown-wrapper {
  position: relative;
}

.kpi-dropdown-wrapper:has(.kpi-dropdown-menu.show),
.kpi-dropdown-wrapper.open {
  z-index: 50;
}

.kpi-more-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.375rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.kpi-more-btn:hover,
.kpi-more-btn[aria-expanded="true"] {
  background: var(--kpi-hover-bg);
  color: var(--accent-iris);
}

.kpi-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.375rem);
  right: 0;
  min-width: 13.5rem;
  background: var(--card-bg-solid);
  border: 0.0625rem solid var(--card-border);
  border-radius: 1rem;
  box-shadow: var(--shadow-dropdown);
  padding: 0.375rem;
  z-index: 1000;
  display: none;
  flex-direction: column;
  gap: 0.125rem;
  animation: dropdownPop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.kpi-dropdown-menu.show {
  display: flex;
}

@keyframes dropdownPop {
  0% {
    opacity: 0;
    transform: scale(0.92) translateY(-0.375rem);
  }

  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.kpi-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.625rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-sub);
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  text-align: left;
}

.kpi-dropdown-item:hover {
  background: var(--accent-iris-light);
  color: var(--accent-iris-deep);
}

.kpi-dropdown-divider {
  height: 0.0625rem;
  background: var(--border-hairline);
  margin: 0.25rem 0.375rem;
}

.kpi-value {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
  line-height: 1.1;
  margin-top: 0.875rem;
}

.kpi-value.danger {
  color: var(--accent-red);
}

.kpi-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 0.3125rem;
}

/* ==========================================================================
   Analytics Layout & 3-Split Segmented Bar Chart
   ========================================================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  position: relative;
  z-index: 10;
}

.dashboard-col {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.1875rem;
}

.header-ctrls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ctrl-pill-wrapper {
  position: relative;
  display: inline-flex;
}

.ctrl-pill-select {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.4375rem 0.875rem;
  border-radius: 9999rem;
  background: var(--ctrl-select-bg);
  border: 0.0625rem solid var(--card-border);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.ctrl-pill-select:hover {
  background: var(--card-bg-solid);
  color: var(--text-main);
}

.ctrl-pill-select[aria-expanded="true"] .dropdown-caret {
  transform: rotate(180deg);
}

.month-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.375rem);
  right: 0;
  min-width: 17.5rem;
  background: var(--card-bg-solid);
  border: 0.0625rem solid var(--card-border);
  border-radius: 1rem;
  box-shadow: var(--shadow-dropdown);
  padding: 0.75rem;
  z-index: 100;
  display: none;
  flex-direction: column;
  gap: 0.625rem;
  animation: dropdownPop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.month-dropdown-menu.show {
  display: flex;
}

.month-dropdown-header {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 0.375rem;
  border-bottom: 0.0625rem solid var(--border-hairline);
}

.month-grid {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.month-quarter-group {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.quarter-tag {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-muted);
  width: 1.75rem;
  text-align: center;
  flex-shrink: 0;
}

.month-item {
  flex: 1;
  padding: 0.375rem 0.25rem;
  border-radius: 0.5rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-sub);
  background: var(--ctrl-select-bg);
  border: 0.0625rem solid transparent;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.month-item:hover {
  background: var(--accent-iris-light);
  color: var(--accent-iris-deep);
}

.month-item.active {
  background: var(--accent-iris);
  color: var(--color-white);
  font-weight: 700;
  box-shadow: 0 0.125rem 0.5rem var(--accent-iris-glow);
}

.arrow-link-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 9999rem;
  background: var(--card-bg-solid);
  border: 0.0625rem solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.arrow-link-btn:hover {
  background: var(--accent-iris-light);
  color: var(--accent-iris-deep);
  border-color: var(--accent-iris);
  transform: translateY(-0.0625rem);
}

.dashboard-wrapper,
.dashboard-container {
  width: 100%;
  max-width: 80rem;
  margin: 1.5rem auto;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.625rem;
}

.legend-chip-dot {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 9999rem;
  display: inline-block;
  flex-shrink: 0;
}

.legend-chip-dot.dot-bv {
  background: var(--split-bv);
}

.legend-chip-dot.dot-pri {
  background: var(--split-pri);
}

.legend-chip-dot.dot-upr {
  background: var(--split-upr);
}

.metric-duo {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 1.25rem;
}

.duo-item {
  display: flex;
  flex-direction: column;
}

.duo-caption {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.duo-figures {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.duo-num {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.1875rem 0.5625rem;
  border-radius: 9999rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.badge-pill.success {
  background: var(--accent-green-bg);
  color: var(--accent-green);
}

.badge-pill.danger {
  background: var(--accent-red-bg);
  color: var(--accent-red);
}

/* Pure CSS 3-Split Segmented Bar Container (Border-bottom removed per Request C) */
.bar-chart-container {
  height: 13.75rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.5rem 0.25rem 0;
  position: relative;
  margin-top: 0.375rem;
}

.bar-chart-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  position: relative;
  cursor: pointer;
}

.split-bar-capsule {
  width: 100%;
  max-width: 2.625rem;
  border-radius: 1rem 1rem 0.5rem 0.5rem;
  overflow: hidden;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.15rem;
  background: var(--split-track);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  border: 0.0625rem solid var(--split-border);
  box-shadow: var(--shadow-capsule);
}

.bar-chart-column:hover .split-bar-capsule {
  transform: scaleY(1.05);
  transform-origin: bottom;
  box-shadow: var(--shadow-capsule-hover);
}

.bar-chart-column.active .split-bar-capsule {
  box-shadow: 0 0.5rem 1.625rem var(--accent-iris-glow);
}

.bar-seg {
  width: 100%;
  transition: height 0.3s ease;
  position: relative;
  border-radius: 0.5rem;
}

.bar-seg+.bar-seg {
  border-top: 0.09375rem solid var(--color-white-translucent);
}

[data-theme-resolved="dark"] .bar-seg+.bar-seg {
  border-top: 0.09375rem solid var(--color-dark-translucent);
}

.bar-seg-bv {
  background: var(--split-bv-grad);
}

.bar-seg-pri {
  background: var(--split-pri-grad);
}

.bar-seg-upr {
  background: var(--split-upr-grad);
}

.bar-label {
  margin-top: 0.75rem;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.bar-chart-column:hover .bar-label,
.bar-chart-column.active .bar-label {
  color: var(--accent-iris);
  font-weight: 800;
}

/* Jitter-Free Hover-Only Breakdown Tooltip (Centered anchor) */
.chart-tooltip-split {
  position: absolute;
  top: -5.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-bg-solid);
  border: 0.0625rem solid var(--card-border);
  border-radius: 0.875rem;
  box-shadow: var(--shadow-dropdown);
  padding: 0.625rem 0.875rem;
  font-size: 0.72rem;
  white-space: nowrap;
  z-index: 60;
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  pointer-events: none;
  animation: tooltipPop 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.chart-tooltip-split::after {
  content: "";
  position: absolute;
  bottom: -0.375rem;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 0.625rem;
  height: 0.625rem;
  background: var(--card-bg-solid);
  border-right: 0.0625rem solid var(--card-border);
  border-bottom: 0.0625rem solid var(--card-border);
}

@keyframes tooltipPop {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(0.25rem) scale(0.95);
  }

  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

.tooltip-header {
  font-weight: 800;
  color: var(--text-main);
  border-bottom: 0.0625rem solid var(--border-hairline);
  padding-bottom: 0.3125rem;
  margin-bottom: 0.1875rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.tooltip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.875rem;
  color: var(--text-sub);
}

.tooltip-stage-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999rem;
  display: inline-block;
}

.tooltip-stage-dot.dot-bv {
  background: var(--split-bv);
}

.tooltip-stage-dot.dot-pri {
  background: var(--split-pri);
}

.tooltip-stage-dot.dot-upr {
  background: var(--split-upr);
}

.tooltip-row span:last-child {
  font-weight: 800;
  color: var(--text-main);
}

/* ==========================================================================
   Activity / Grievances Table (Retaining border-bottom per Request B)
   ========================================================================== */
.activity-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.625rem;
}

.activity-row {
  transition: all 0.2s ease;
}

.activity-row td {
  padding: 0.75rem 0.875rem;
  background: var(--card-bg-solid);
  font-size: 0.84rem;
  vertical-align: middle;
  color: var(--text-main);
  border: none;
  border-bottom: 0.0625rem solid var(--border-hairline) !important;
}

.activity-row td:first-child {
  border-radius: 0.875rem 0 0 0.875rem;
}

.activity-row td:last-child {
  border-radius: 0 0.875rem 0.875rem 0;
  text-align: right;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.avatar-circle {
  width: 2rem;
  height: 2rem;
  border-radius: 9999rem;
  background: var(--accent-iris-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.76rem;
  color: var(--accent-iris-deep);
}

.user-name {
  font-weight: 700;
  color: var(--text-main);
}

.meta-tag {
  color: var(--text-muted);
  font-size: 0.76rem;
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.status-badge.urgent {
  background: var(--accent-red-bg);
  color: var(--accent-red);
}

.status-badge.pending {
  background: var(--accent-amber-bg);
  color: var(--accent-amber);
}

.status-badge.resolved {
  background: var(--accent-green-bg);
  color: var(--accent-green);
}

.time-stamp {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ==========================================================================
   Telemetry Widgets (Progress Pill & Radial Gauge)
   ========================================================================== */
.progress-pill-track {
  width: 100%;
  height: 1.5rem;
  background: var(--progress-track-bg);
  border-radius: 9999rem;
  overflow: hidden;
  margin: 1rem 0 1.25rem;
  padding: 0.1875rem;
  box-sizing: border-box;
  box-shadow: var(--shadow-inset-md);
}

.progress-pill-bar {
  height: 100%;
  width: 78%;
  background: var(--progress-grad);
  border-radius: 9999rem;
  box-shadow: 0 0.125rem 0.5rem var(--progress-bar-shadow);
  transition: width 0.6s ease;
}

.action-btn-soft {
  width: 100%;
  padding: 0.8125rem 1.25rem;
  background: var(--card-bg-solid);
  border: 0.0625rem solid var(--card-border);
  border-radius: 9999rem;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-main);
  box-shadow: var(--shadow-subtle-xs);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
}

.action-btn-soft:hover {
  background: var(--accent-iris-light);
  color: var(--accent-iris-deep);
  border-color: var(--accent-iris);
  transform: translateY(-0.125rem);
  box-shadow: var(--accent-iris-shadow-sm);
}

.gauge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.radial-gauge-wrapper {
  position: relative;
  width: 11.25rem;
  height: 6.25rem;
  margin: 0.75rem 0 0.375rem;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.gauge-semi-circle {
  position: absolute;
  top: 0;
  left: 0;
  width: 11.25rem;
  height: 5.625rem;
  border-top-left-radius: 5.625rem;
  border-top-right-radius: 5.625rem;
  background: conic-gradient(from 270deg at 50% 100%,
      var(--gauge-active-start) 0deg,
      var(--gauge-active-end) 140deg,
      var(--gauge-track) 140deg,
      var(--gauge-track) 180deg);
  mask: radial-gradient(circle at 50% 100%, transparent 4.25rem, var(--color-black) 4.3125rem);
  -webkit-mask: radial-gradient(circle at 50% 100%, transparent 4.25rem, var(--color-black) 4.3125rem);
}

.gauge-center-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 0.125rem;
}

.gauge-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--card-bg-solid);
  padding: 0.1875rem 0.5rem;
  border-radius: 9999rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-iris-deep);
  box-shadow: var(--shadow-badge);
  margin-bottom: 0.25rem;
}

.gauge-score {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.gauge-delta {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-green);
  margin-top: 0.125rem;
}

.gauge-mini-stats {
  display: flex;
  justify-content: space-around;
  width: 100%;
  margin-top: 1.375rem;
  padding-top: 1rem;
  border-top: 0.0625rem solid var(--border-hairline);
}

.mini-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mini-stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.mini-stat-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

/* ==========================================================================
   Multi-Screen Responsiveness (Mobile, Tablet, Desktop, Ultra-Wide)
   ========================================================================== */
/* Ultra-wide (>1440px) */
@media (min-width: 90rem) {

  .soft-top-bar .nav-container,
  .dashboard-wrapper {
    max-width: 86rem;
  }
}

/* Standard Desktop / Laptop (<1200px) */
@media (max-width: 75rem) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .kpi-deck,
  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  }
}

/* Tablet (<992px) */
@media (max-width: 62rem) {
  .soft-top-bar {
    padding: 0.625rem 1rem;
  }

  .soft-top-bar .pill-navbar {
    display: none;
    /* Priority navigation shifts to slide-in drawer on mobile/tablet */
  }

  .kpi-deck,
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

/* Mobile Portrait (<640px) */
@media (max-width: 40rem) {

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

  .metric-duo {
    gap: 1rem;
    flex-direction: column;
    align-items: flex-start;
  }

  .bar-chart-container {
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }

  .split-bar-capsule {
    min-width: 1.75rem;
  }

  .greeting-title {
    font-size: 1.35rem;
  }

  .profile-role,
  .profile-name {
    display: none;
    /* Show only avatar pill on mobile */
  }

  .profile-pill {
    padding: 0.25rem;
  }

  .theme-cycle-pill span:not(.theme-cycle-icon-box) {
    display: none;
    /* Show icon only */
  }
}

/* ==========================================================================
   Phase 4: Universal Form, Table, Modal & Subsystem Bridges
   ========================================================================== */

/* ── Universal Card Elevation ── */
.pmp-card {
  background: var(--card-bg) !important;
  backdrop-filter: blur(1rem);
  -webkit-backdrop-filter: blur(1rem);
  border-radius: var(--card-radius) !important;
  border: 0.0625rem solid var(--card-border) !important;
  box-shadow: var(--shadow-soft) !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible !important;
}

.pmp-card:hover {
  box-shadow: var(--shadow-card-hover) !important;
}

.pmp-card-header {
  background: transparent !important;
  border-bottom: 0.0625rem solid var(--border-hairline) !important;
  padding: 1.125rem 1.5rem !important;
}

.pmp-card-header-title {
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  color: var(--text-main) !important;
  letter-spacing: -0.01em;
}

.pmp-card-body {
  background: transparent !important;
}

/* ── Typography & Header Primitives ── */
.pmp-page-title {
  font-size: 1.65rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em !important;
  color: var(--text-main) !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pmp-page-title-2 {
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em !important;
  color: var(--text-main) !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pmp-page-subtitle {
  font-size: 0.88rem !important;
  color: var(--text-muted) !important;
  line-height: 1.4;
}

/* ── Button Soft UI Transitions ── */
.btn-primary {
  background: var(--brand-grad) !important;
  color: var(--color-white) !important;
  border: none !important;
  border-radius: 9999rem !important;
  box-shadow: 0 0.25rem 0.75rem var(--accent-iris-glow) !important;
  font-weight: 700 !important;
  transition: all 0.2s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-decoration: none !important;
}

.btn-primary:hover {
  transform: translateY(-0.0625rem) !important;
  box-shadow: 0 0.5rem 1.25rem var(--accent-iris-glow) !important;
  color: var(--color-white) !important;
}

.btn-secondary {
  background: var(--card-bg-solid) !important;
  color: var(--text-sub) !important;
  border: 0.0625rem solid var(--card-border) !important;
  border-radius: 9999rem !important;
  box-shadow: var(--shadow-soft) !important;
  font-weight: 600 !important;
  transition: all 0.2s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-decoration: none !important;
}

.btn-secondary:hover {
  background: var(--accent-iris-light) !important;
  color: var(--accent-iris-deep) !important;
  border-color: var(--accent-iris) !important;
  transform: translateY(-0.0625rem) !important;
}

.btn-secondary.active {
  background: var(--accent-iris-light) !important;
  color: var(--accent-iris-deep) !important;
  border-color: var(--accent-iris) !important;
  font-weight: 700 !important;
}

.btn-back {
  padding: 0.45rem 1rem !important;
  gap: 0.35rem !important;
  font-size: 0.84rem !important;
}

/* ── Split Buttons ── */
.m3-split-button,
.pmp-split-btn {
  display: inline-flex;
  align-items: stretch;
  border-radius: 9999rem;
  box-shadow: 0 0.25rem 0.75rem var(--accent-iris-glow);
  position: relative;
}

.m3-split-button-main,
.pmp-split-btn>.btn-primary {
  border-radius: 9999rem 0 0 9999rem !important;
  background: var(--brand-grad) !important;
  border: none !important;
  padding: 0.5rem 1rem !important;
  color: var(--color-white) !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.375rem !important;
}

.m3-split-button-toggle,
.pmp-split-toggle {
  border-radius: 0 9999rem 9999rem 0 !important;
  background: var(--accent-iris-deep) !important;
  border: none !important;
  border-left: 0.0625rem solid var(--surface-white-border-25) !important;
  color: var(--color-white) !important;
  padding: 0.5rem 0.65rem !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.m3-split-menu,
.pmp-split-menu {
  position: absolute;
  top: calc(100% + 0.375rem);
  right: 0;
  background: var(--card-bg-solid);
  border: 0.0625rem solid var(--card-border);
  border-radius: 1rem;
  box-shadow: var(--shadow-dropdown);
  padding: 0.375rem;
  min-width: 13rem;
  z-index: 1050;
  pointer-events: auto;
}

.m3-split-menu-item,
.pmp-split-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  border-radius: 0.625rem;
  border: none;
  background: transparent;
  width: 100%;
  color: var(--text-sub);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  text-align: left;
}

.m3-split-menu-item:hover,
.pmp-split-menu-item:hover {
  background: var(--accent-iris-light);
  color: var(--accent-iris-deep);
}

/* ── Form Inputs & Select Controls (Soft UI Claymorphic) ── */
.form-control {
  background: var(--ctrl-select-bg) !important;
  border: 0.0625rem solid var(--card-border) !important;
  border-radius: 0.75rem !important;
  color: var(--text-main) !important;
  font-size: 0.86rem !important;
  padding: 0.55rem 0.875rem !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.form-control:focus {
  background: var(--card-bg-solid) !important;
  border-color: var(--accent-iris) !important;
  box-shadow: 0 0 0 0.1875rem var(--accent-iris-light) !important;
  outline: none !important;
}

/* ── Central Textarea Inputs (Soft UI Claymorphic) ── */
textarea,
.form-textarea,
.form-control[rows] {
  width: 100%;
  background: var(--ctrl-select-bg) !important;
  border: 0.0625rem solid var(--card-border) !important;
  border-radius: 0.875rem !important;
  color: var(--text-main) !important;
  font-family: inherit !important;
  font-size: 0.875rem !important;
  line-height: 1.55 !important;
  padding: 0.75rem 1rem !important;
  box-shadow: var(--shadow-inset-xs), var(--shadow-soft) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  resize: vertical;
  box-sizing: border-box;
}

textarea:hover,
.form-textarea:hover,
.form-control[rows]:hover {
  background: var(--card-bg-solid) !important;
  border-color: var(--accent-iris-border-strong) !important;
}

textarea:focus,
.form-textarea:focus,
.form-control[rows]:focus {
  background: var(--card-bg-solid) !important;
  border-color: var(--accent-iris) !important;
  box-shadow: 0 0 0 0.2rem var(--accent-iris-light), var(--shadow-soft) !important;
  outline: none !important;
}

textarea::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

textarea:disabled,
.form-textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--surface-muted-tint) !important;
}

/* Dark mode textarea override */
[data-theme-resolved="dark"] textarea,
[data-theme-resolved="dark"] .form-textarea,
html.theme-dark textarea,
html.theme-dark .form-textarea {
  background: var(--ctrl-select-bg) !important;
  border-color: var(--card-border) !important;
  color: var(--text-main) !important;
}

[data-theme-resolved="dark"] textarea:focus,
[data-theme-resolved="dark"] .form-textarea:focus,
html.theme-dark textarea:focus,
html.theme-dark .form-textarea:focus {
  background: var(--card-bg-solid) !important;
  border-color: var(--accent-iris) !important;
}

/* ── Central File Inputs (Soft UI Claymorphic) ── */
input[type="file"].form-control,
input[type="file"] {
  background: var(--ctrl-select-bg) !important;
  border: 0.0625rem dashed var(--accent-iris-border-dashed) !important;
  border-radius: 0.875rem !important;
  color: var(--text-sub) !important;
  padding: 0.15rem 0.65rem !important;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  display: flex;
  align-items: center;
  box-shadow: var(--shadow-soft) !important;
}

input[type="file"].form-control:hover,
input[type="file"]:hover {
  background: var(--card-bg-solid) !important;
  border-color: var(--accent-iris) !important;
  box-shadow: var(--shadow-card-hover) !important;
}

input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  padding: 0.45rem 1.15rem !important;
  margin-right: 0.875rem !important;
  border-radius: 9999rem !important;
  background: var(--brand-grad) !important;
  color: var(--color-white) !important;
  border: none !important;
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  box-shadow: 0 0.125rem 0.5rem var(--accent-iris-glow) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

input[type="file"]::file-selector-button:hover,
input[type="file"]::-webkit-file-upload-button:hover {
  transform: translateY(-0.0625rem) scale(1.04) !important;
  box-shadow: 0 0.25rem 0.75rem var(--accent-iris-glow) !important;
}

[data-theme-resolved="dark"] input[type="file"].form-control,
[data-theme-resolved="dark"] input[type="file"],
html.theme-dark input[type="file"].form-control,
html.theme-dark input[type="file"] {
  background: var(--ctrl-select-bg) !important;
  border-color: var(--accent-iris-border) !important;
  color: var(--text-muted) !important;
}

[data-theme-resolved="dark"] input[type="file"]::file-selector-button,
[data-theme-resolved="dark"] input[type="file"]::-webkit-file-upload-button,
html.theme-dark input[type="file"]::file-selector-button,
html.theme-dark input[type="file"]::-webkit-file-upload-button {
  background: var(--accent-iris-grad-dark) !important;
  color: var(--color-white) !important;
}

/* ── Date Picker Input & Inline Calendar Action Button ── */
.date-input-wrapper {
  position: relative !important;
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
}

.date-picker-input {
  width: 100% !important;
  padding-right: 2.75rem !important;
  cursor: pointer;
}

.date-picker-icon-btn {
  position: absolute !important;
  right: 0.625rem !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  width: 1.75rem !important;
  height: 1.75rem !important;
  min-height: 1.75rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  color: var(--accent-iris) !important;
  z-index: 5 !important;
  transition: color 0.18s ease, transform 0.18s ease !important;
}

.date-picker-icon-btn:hover {
  color: var(--accent-iris-deep) !important;
  transform: translateY(-50%) scale(1.12) !important;
  background: transparent !important;
  box-shadow: none !important;
}

.date-picker-icon-btn:active {
  transform: translateY(-50%) scale(0.95) !important;
}

input[type="date"].form-control,
input[type="date"] {
  position: relative;
  cursor: pointer;
}

/* Hide native webkit indicator when custom date picker button (.date-picker-icon-btn / .date-input-wrapper) is present */
.date-picker-input::-webkit-calendar-picker-indicator,
.date-input-wrapper input::-webkit-calendar-picker-indicator,
.date-input-wrapper input[type="date"]::-webkit-calendar-picker-indicator {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  -webkit-appearance: none !important;
  width: 0 !important;
  height: 0 !important;
  pointer-events: none !important;
}

/* For standalone date inputs without custom icon buttons, style the native calendar indicator nicely */
input[type="date"]:not(.date-picker-input)::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 1 !important;
  display: inline-block !important;
  filter: invert(45%) sepia(85%) saturate(1200%) hue-rotate(225deg) brightness(95%) contrast(95%);
  transition: filter 0.18s ease;
  padding: 0.2rem;
  border-radius: 0.375rem;
  font-size: 1.15rem;
}

input[type="date"]:not(.date-picker-input)::-webkit-calendar-picker-indicator:hover {
  filter: invert(35%) sepia(90%) saturate(2000%) hue-rotate(235deg) brightness(90%) contrast(100%);
}

[data-theme-resolved="dark"] input[type="date"]:not(.date-picker-input)::-webkit-calendar-picker-indicator,
html.theme-dark input[type="date"]:not(.date-picker-input)::-webkit-calendar-picker-indicator {
  filter: invert(80%) sepia(30%) saturate(1000%) hue-rotate(215deg) brightness(110%) contrast(100%);
}

/* ── Selected School Card (Soft UI Claymorphic) ── */
.selected-school-card {
  margin-top: 0.5rem;
  padding: 0.875rem 1.15rem;
  background: var(--card-bg-solid) !important;
  border: 0.0625rem solid var(--card-border) !important;
  border-left: 0.3125rem solid var(--accent-iris) !important;
  border-radius: 1rem !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--shadow-soft) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  animation: fadeIn 0.2s ease-in-out;
}

.selected-school-card:hover {
  box-shadow: var(--shadow-card-hover) !important;
  transform: translateY(-0.0625rem);
}

.selected-school-info {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.selected-school-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.selected-school-title .icon-brand,
.selected-school-title .material-symbols-rounded {
  color: var(--accent-iris-deep);
  font-size: 1.25rem;
  background: var(--accent-iris-light);
  padding: 0.25rem;
  border-radius: 9999rem;
}

.selected-school-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.selected-school-meta code {
  background: var(--ctrl-select-bg);
  color: var(--accent-iris-dark);
  padding: 0.15rem 0.45rem;
  border-radius: 0.375rem;
  font-weight: 600;
  border: 0.0625rem solid var(--border-hairline);
}

.selected-school-card .btn-secondary,
.selected-school-card .btn-sm {
  border-radius: 9999rem !important;
  padding: 0.4rem 0.875rem !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  background: var(--ctrl-select-bg) !important;
  border: 0.0625rem solid var(--card-border) !important;
  color: var(--text-sub) !important;
  box-shadow: var(--shadow-soft);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.2s ease;
}

.selected-school-card .btn-secondary:hover,
.selected-school-card .btn-sm:hover {
  background: var(--accent-iris-light) !important;
  color: var(--accent-iris-deep) !important;
  border-color: var(--accent-iris) !important;
}

/* Dark mode selected-school-card */
[data-theme-resolved="dark"] .selected-school-card,
html.theme-dark .selected-school-card {
  background: var(--card-bg-solid) !important;
  border-color: var(--card-border) !important;
  border-left-color: var(--accent-iris) !important;
}

[data-theme-resolved="dark"] .selected-school-title .icon-brand,
html.theme-dark .selected-school-title .icon-brand {
  background: var(--accent-iris-tint-20);
  color: var(--accent-iris-soft-light);
}

[data-theme-resolved="dark"] .selected-school-meta code,
html.theme-dark .selected-school-meta code {
  background: var(--accent-iris-tint-15);
  color: var(--accent-iris-soft-light);
}

.form-select {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-color: var(--ctrl-select-bg) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e72ef' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.875rem center !important;
  background-size: 1.15rem 1.15rem !important;
  padding: 0.55rem 2.5rem 0.55rem 0.875rem !important;
  border: 0.0625rem solid var(--card-border) !important;
  border-radius: 0.75rem !important;
  color: var(--text-main) !important;
  font-size: 0.86rem !important;
  font-weight: 500 !important;
  box-shadow: var(--shadow-soft) !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.form-select:hover {
  background-color: var(--card-bg-solid) !important;
  border-color: var(--accent-iris-border-strong) !important;
  box-shadow: var(--shadow-card-hover) !important;
}

.form-select:focus {
  background-color: var(--card-bg-solid) !important;
  border-color: var(--accent-iris) !important;
  box-shadow: 0 0 0 0.2rem var(--accent-iris-light), var(--shadow-soft) !important;
  outline: none !important;
}

.form-select:disabled {
  opacity: 0.55 !important;
  cursor: not-allowed !important;
  background-color: var(--surface-muted-tint) !important;
  border-color: var(--border-hairline) !important;
}

.form-select option {
  background-color: var(--card-bg-solid);
  color: var(--text-main);
  padding: 0.5rem;
}

/* Dark mode select overrides */
[data-theme-resolved="dark"] .form-select,
html.theme-dark .form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a78bfa' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important;
  background-color: var(--ctrl-select-bg) !important;
  border-color: var(--card-border) !important;
  color: var(--text-main) !important;
}

[data-theme-resolved="dark"] .form-select:hover,
html.theme-dark .form-select:hover {
  background-color: var(--card-bg-solid) !important;
  border-color: var(--accent-iris) !important;
}

[data-theme-resolved="dark"] .form-select option,
html.theme-dark .form-select option {
  background-color: var(--card-bg-solid);
  color: var(--text-dark-primary);
}

/* ── Reusable Soft UI Searchbox & Action Group Component ── */
.soft-search-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  width: 100%;
  flex-wrap: wrap;
}

.soft-search-group {
  position: relative;
  flex: 1;
  min-width: 17.5rem;
  display: flex;
  align-items: center;
}

.soft-search-group .soft-search-input {
  width: 100%;
  padding-left: 2.85rem !important;
  /* Ample clearance so text never touches or gets hidden under icon */
  padding-right: 1.15rem !important;
  height: 2.75rem;
  background: var(--ctrl-select-bg) !important;
  border: 0.0625rem solid var(--card-border) !important;
  border-radius: 9999rem !important;
  font-size: 0.88rem !important;
  font-weight: 500;
  color: var(--text-main) !important;
  box-shadow: var(--shadow-inset-sm);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.soft-search-group .soft-search-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.soft-search-group .soft-search-input:focus {
  background: var(--card-bg-solid) !important;
  border-color: var(--accent-iris) !important;
  box-shadow: 0 0 0 0.2rem var(--accent-iris-light), var(--shadow-soft) !important;
  outline: none !important;
}

.soft-search-group .soft-search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
  z-index: 2;
}

.soft-search-group:focus-within .soft-search-icon {
  color: var(--accent-iris-deep);
}

.soft-search-actions {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

/* ── Universal / School Search & Icon-Input Soft UI Styling ── */
.school-search-input-box,
.form-group-with-icon {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.school-search-input-box .search-icon,
.form-control-icon,
.input-icon-left {
  position: absolute;
  left: 1rem !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  color: var(--text-muted) !important;
  font-size: 1.25rem !important;
  line-height: 1 !important;
  pointer-events: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: color 0.2s ease !important;
  z-index: 2 !important;
}

.school-search-input-box:focus-within .search-icon,
div:has(> .form-control-with-icon:focus) .input-icon-left {
  color: var(--accent-iris-deep) !important;
}

.school-search-input,
.form-control-with-icon {
  width: 100% !important;
  padding-left: 2.85rem !important;
  /* Ample clearance so text never touches or gets hidden under icon */
  padding-right: 2.5rem !important;
  height: 2.75rem !important;
  background: var(--ctrl-select-bg) !important;
  border: 0.0625rem solid var(--card-border) !important;
  border-radius: 9999rem !important;
  font-size: 0.88rem !important;
  font-weight: 500 !important;
  color: var(--text-main) !important;
  box-shadow: var(--shadow-inset-sm) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.school-search-input:focus,
.form-control-with-icon:focus {
  background: var(--card-bg-solid) !important;
  border-color: var(--accent-iris) !important;
  box-shadow: 0 0 0 0.2rem var(--accent-iris-light), var(--shadow-soft) !important;
  outline: none !important;
}

.school-clear-btn {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border-radius: 50%;
  transition: all 0.15s ease;
  z-index: 3;
}

.school-clear-btn:hover {
  background: var(--accent-iris-light);
  color: var(--accent-iris-deep);
}

/* Pill Action Buttons */
.soft-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.25rem;
  border-radius: 9999rem;
  background: var(--brand-grad);
  color: var(--color-white) !important;
  border: 0.0625rem solid var(--surface-white-border-30);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 0.25rem 0.75rem var(--accent-iris-glow);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.soft-btn-primary:hover {
  transform: translateY(-0.0625rem);
  box-shadow: 0 0.375rem 1.125rem var(--accent-iris-glow-hover);
  color: var(--color-white) !important;
}

.soft-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.15rem;
  border-radius: 9999rem;
  background: var(--card-bg-solid);
  color: var(--text-sub) !important;
  border: 0.0625rem solid var(--card-border);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  position: relative;
}

.soft-btn-secondary:hover {
  background: var(--accent-iris-light);
  color: var(--accent-iris-deep) !important;
  border-color: var(--accent-iris);
  transform: translateY(-0.0625rem);
}

.soft-btn-secondary.active {
  background: var(--accent-iris-light);
  color: var(--accent-iris-deep) !important;
  border-color: var(--accent-iris);
  box-shadow: 0 0 0 0.125rem var(--accent-iris-light);
}

[data-theme-resolved="dark"] .soft-btn-secondary,
html.theme-dark .soft-btn-secondary {
  background: var(--card-bg-solid);
  color: var(--btn-secondary-dark-text) !important;
  border-color: var(--surface-white-border-10);
}

[data-theme-resolved="dark"] .soft-btn-secondary:hover,
html.theme-dark .soft-btn-secondary:hover,
[data-theme-resolved="dark"] .soft-btn-secondary.active,
html.theme-dark .soft-btn-secondary.active {
  background: var(--accent-iris-tint-25);
  color: var(--text-dark-primary) !important;
  border-color: var(--accent-iris);
}

.form-label {
  color: var(--text-sub) !important;
  font-weight: 600 !important;
  margin-bottom: 0.35rem !important;
  display: inline-block;
}

/* ── Universal Data Tables & MIS Ledgers (High Density preserved) ── */
.pmp-table,
.table-schools,
.grievance-fit-table {
  width: 100%;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

.pmp-table th,
.table-schools th,
.grievance-fit-table th {
  background: var(--card-bg-solid) !important;
  color: var(--text-muted) !important;
  font-size: 0.74rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
  border-bottom: 0.0625rem solid var(--border-hairline) !important;
  padding: 0.75rem 0.65rem !important;
  position: sticky;
  top: 0;
  z-index: 10;
}

.pmp-table td,
.table-schools td,
.grievance-fit-table td {
  padding: 0.55rem 0.65rem !important;
  font-size: 0.825rem !important;
  color: var(--text-main) !important;
  border-bottom: 0.0625rem solid var(--border-hairline) !important;
  vertical-align: middle;
}

.pmp-table tbody tr:hover,
.table-schools tbody tr:hover,
.grievance-fit-table tbody tr:hover {
  background: var(--accent-iris-light) !important;
}

/* ── Pagination Soft UI Bar ── */
.pmp-pagination-container {
  background: transparent !important;
  border-top: 0.0625rem solid var(--border-hairline) !important;
  padding: 0.875rem 1.5rem !important;
  color: var(--text-muted) !important;
}

.pmp-pagination-info strong,
.pmp-pagination-highlight {
  color: var(--text-main) !important;
  font-weight: 700 !important;
}

.pmp-pagination-btn {
  background: var(--card-bg-solid) !important;
  color: var(--text-main) !important;
  border: 0.0625rem solid var(--card-border) !important;
  border-radius: 9999rem !important;
  box-shadow: var(--shadow-soft) !important;
  padding: 0.375rem 0.875rem !important;
  font-weight: 600 !important;
  transition: all 0.2s ease !important;
  text-decoration: none !important;
}

.pmp-pagination-btn:hover:not(:disabled) {
  background: var(--accent-iris-light) !important;
  color: var(--accent-iris-deep) !important;
  border-color: var(--accent-iris) !important;
  transform: translateY(-0.0625rem);
}

.pmp-pagination-page-select,
.pmp-pagination-size-select {
  background: var(--ctrl-select-bg) !important;
  color: var(--text-main) !important;
  border: 0.0625rem solid var(--card-border) !important;
  border-radius: 0.5rem !important;
  padding: 0.25rem 0.5rem !important;
}

/* ── Central Modal Dialogs ── */
.central-modal-scrim,
.md-dialog-scrim {
  background: var(--scrim-bg) !important;
  backdrop-filter: blur(0.35rem) !important;
  -webkit-backdrop-filter: blur(0.35rem) !important;
  z-index: 99999 !important;
}

.central-modal-container,
.md-dialog-container {
  background: var(--card-bg-solid) !important;
  border: 0.0625rem solid var(--card-border) !important;
  border-radius: var(--card-radius) !important;
  box-shadow: var(--shadow-drawer) !important;
  overflow: hidden;
  animation: modalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  0% {
    opacity: 0;
    transform: scale(0.92) translateY(0.75rem);
  }

  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.central-modal-header {
  background: transparent !important;
  border-bottom: 0.0625rem solid var(--border-hairline) !important;
  padding: 1.25rem 1.5rem !important;
}

.central-modal-title {
  font-size: 1.15rem !important;
  font-weight: 800 !important;
  color: var(--text-main) !important;
}

.central-modal-close-btn {
  width: 2.25rem !important;
  height: 2.25rem !important;
  border-radius: 9999rem !important;
  background: var(--ctrl-select-bg) !important;
  border: 0.0625rem solid var(--card-border) !important;
  color: var(--text-muted) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer;
  transition: all 0.2s ease;
}

.central-modal-close-btn:hover {
  background: var(--accent-red-bg) !important;
  color: var(--accent-red) !important;
  border-color: var(--accent-red) !important;
}

.central-modal-footer {
  border-top: 0.0625rem solid var(--border-hairline) !important;
  padding: 1rem 1.5rem !important;
  background: transparent !important;
}

/* ── Floating Row Hover Action Block (Frosted Iris Pill) ── */
.row-hover-actions {
  background: var(--card-bg-solid) !important;
  border: 0.0625rem solid var(--card-border) !important;
  border-radius: 9999rem !important;
  box-shadow: var(--shadow-dropdown) !important;
  padding: 0.25rem 0.5rem !important;
  backdrop-filter: blur(0.75rem) !important;
  -webkit-backdrop-filter: blur(0.75rem) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.25rem !important;
}

.row-hover-actions .row-action-btn {
  color: var(--text-sub) !important;
  border-radius: 9999rem !important;
  padding: 0.25rem 0.5rem !important;
  transition: all 0.15s ease !important;
  text-decoration: none !important;
}

/* ── KPI Row Subsystem Bridge (Grievance & MIS Reports) ── */
.kpi-row {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr)) !important;
  gap: 1.25rem !important;
  width: 100% !important;
  margin-bottom: 1.5rem !important;
}

.kpi-row .kpi-card {
  background: var(--card-bg) !important;
  backdrop-filter: blur(1rem);
  -webkit-backdrop-filter: blur(1rem);
  border-radius: var(--card-radius) !important;
  border: 0.0625rem solid var(--card-border) !important;
  box-shadow: var(--shadow-soft) !important;
  padding: 1.25rem 1.5rem !important;
  min-height: auto !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex !important;
  /*   align-items: center !important; */
  gap: 1rem !important;
}

.kpi-row .kpi-card:hover {
  transform: translateY(-0.1875rem);
  box-shadow: var(--shadow-card-hover) !important;
}

.kpi-row .kpi-icon {
  width: 2.75rem !important;
  height: 2.75rem !important;
  border-radius: 0.75rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: var(--kpi-icon-bg) !important;
  border: 0.0625rem solid var(--kpi-icon-border) !important;
  color: var(--accent-iris) !important;
  flex-shrink: 0;
}

.kpi-row .kpi-card.received .kpi-icon {
  background: var(--accent-red-bg) !important;
  border-color: var(--accent-red-border) !important;
  color: var(--accent-red) !important;
}

.kpi-row .kpi-card.processing .kpi-icon {
  background: var(--accent-amber-bg) !important;
  border-color: var(--accent-amber-border) !important;
  color: var(--accent-amber) !important;
}

.kpi-row .kpi-card.resolved .kpi-icon {
  background: var(--accent-green-bg) !important;
  border-color: var(--accent-green-border) !important;
  color: var(--accent-green) !important;
}

.kpi-row .kpi-card.out-of-jurisdiction .kpi-icon {
  background: var(--ctrl-select-bg) !important;
  border-color: var(--card-border) !important;
  color: var(--text-muted) !important;
}

.kpi-row .kpi-number {
  font-size: 1.85rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em !important;
  color: var(--text-main) !important;
  line-height: 1.1;
}

.kpi-row .kpi-label {
  font-size: 0.8rem !important;
  color: var(--text-muted) !important;
  margin-top: 0.25rem;
}

/* ── Authentication Card ── */
.auth-container {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: calc(100vh - 12rem) !important;
  padding: 2rem 1rem !important;
}

.auth-card {
  max-width: 28rem !important;
  width: 100% !important;
  margin: 0 auto !important;
}

.auth-avatar-icon {
  width: 3.5rem !important;
  height: 3.5rem !important;
  border-radius: 9999rem !important;
  background: var(--brand-grad) !important;
  color: var(--color-white) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  /* margin: 0 auto 1rem !important; */
  box-shadow: 0 0.25rem 0.75rem var(--accent-iris-glow) !important;
}

.auth-title {
  font-size: 1.45rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em !important;
  color: var(--text-main) !important;
  text-align: center !important;
}

.auth-subtitle {
  font-size: 0.84rem !important;
  color: var(--text-muted) !important;
  text-align: center !important;
  margin-top: 0.25rem !important;
}

.row-hover-actions .row-action-btn:hover {
  background: var(--accent-iris-light) !important;
  color: var(--accent-iris-deep) !important;
}

/* ── Bulk Schools Modals (Soft UI Claymorphic) ── */
.bulk-mode-card {
  border: 0.0625rem solid var(--card-border);
  border-radius: 0.875rem;
  padding: 0.875rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  background: var(--card-bg-solid);
  box-shadow: var(--shadow-soft);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.bulk-mode-card:hover {
  transform: translateY(-0.0625rem);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--accent-iris);
}

.bulk-mode-card.is-active {
  border-color: var(--accent-iris) !important;
  box-shadow: 0 0.125rem 0.625rem var(--accent-iris-glow) !important;
}

.bulk-mode-card.is-danger-active {
  border-color: var(--accent-red) !important;
  box-shadow: var(--accent-red-shadow-card) !important;
}

.bulk-dropzone {
  border: 0.125rem dashed var(--accent-iris);
  border-radius: 1.125rem;
  padding: 1.75rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  background: var(--ctrl-select-bg);
  box-shadow: var(--shadow-soft);
  margin-bottom: 1.25rem;
}

.bulk-dropzone:hover,
.bulk-dropzone.is-dragover {
  background: var(--accent-iris-light);
  border-color: var(--accent-iris-deep);
  transform: scale(1.008);
}

/* ── Shared Row Hover Floating Action Bar (Soft UI Pill Bar) ── */
.soft-hover-table tbody tr {
  position: relative;
}

.soft-hover-table tbody tr td:last-child {
  position: relative;
}

.row-hover-actions {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%) translateX(0.65rem);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.5rem;
  border-radius: 9999rem;
  background: var(--surface-floating-dark);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 0.0625rem solid var(--surface-white-border-25);
  box-shadow: var(--shadow-floating-dark);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10;
}

:root[data-theme-resolved="dark"] .row-hover-actions,
:root[data-theme="dark"] .row-hover-actions,
:root.theme-dark .row-hover-actions {
  background: rgba(248, 250, 252, 0.94);
  border: 0.0625rem solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 0.375rem 1.25rem rgba(0, 0, 0, 0.45);
}

.soft-hover-table tbody tr:hover .row-hover-actions,
.soft-hover-table tbody tr:focus-within .row-hover-actions {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
  pointer-events: auto;
}

@media (hover: none) {
  .row-hover-actions {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(-50%) translateX(0) !important;
    pointer-events: auto !important;
  }
}

.btn-hover-action {
  height: 2.125rem;
  min-width: 2.125rem;
  padding: 0 0.65rem;
  border-radius: 9999rem !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 700;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-hover-action .material-symbols-rounded {
  font-size: 1.15rem;
}

.btn-hover-action.btn-contact {
  background: var(--accent-green-grad) !important;
  color: var(--color-white) !important;
  border: 0.0625rem solid var(--surface-white-border-35) !important;
  box-shadow: var(--accent-green-shadow-pill) !important;
}

.btn-hover-action.btn-contact:hover {
  transform: scale(1.08) translateY(-0.0625rem) !important;
  box-shadow: var(--accent-green-shadow-pill-hover) !important;
  color: var(--color-white) !important;
}

.btn-hover-action.btn-edit {
  background: var(--color-white) !important;
  color: var(--accent-iris-dark) !important;
  border: 0.0625rem solid var(--accent-iris) !important;
  box-shadow: var(--shadow-btn-sm) !important;
}

.btn-hover-action.btn-edit:hover {
  background: var(--accent-iris-light) !important;
  color: var(--accent-iris-deep-dark) !important;
  transform: scale(1.08) translateY(-0.0625rem) !important;
  box-shadow: var(--accent-iris-shadow-md) !important;
}

.btn-hover-action.btn-grievance {
  background: var(--accent-red-grad) !important;
  color: var(--color-white) !important;
  border: 0.0625rem solid var(--surface-white-border-35) !important;
  box-shadow: var(--accent-red-shadow-pill) !important;
}

.btn-hover-action.btn-grievance:hover {
  transform: scale(1.08) translateY(-0.0625rem) !important;
  box-shadow: var(--accent-red-shadow-pill-hover) !important;
  color: var(--color-white) !important;
}

.btn-hover-action.btn-cch {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  color: var(--color-white) !important;
  border: 0.0625rem solid var(--surface-white-border-35) !important;
  box-shadow: 0 0.125rem 0.5rem rgba(245, 158, 11, 0.4) !important;
}

.btn-hover-action.btn-cch:hover {
  transform: scale(1.08) translateY(-0.0625rem) !important;
  box-shadow: 0 0.25rem 0.85rem rgba(245, 158, 11, 0.6) !important;
  color: var(--color-white) !important;
}

/* ── School Contacts Modal Cards (Soft UI) ── */
.school-contact-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
  padding: 0.9rem 1.1rem;
  background: var(--card-bg-solid);
  border: 0.0625rem solid var(--card-border);
  border-left: 0.275rem solid var(--accent-iris);
  border-radius: 1rem;
  box-shadow: var(--shadow-soft);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.school-contact-card:hover {
  transform: translateY(-0.0625rem);
  box-shadow: var(--accent-iris-shadow-card);
}

.school-contact-call-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.95rem;
  border-radius: 9999rem;
  background: var(--accent-green-grad);
  color: var(--color-white) !important;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--accent-green-shadow-sm);
  transition: all 0.2s ease;
}

.school-contact-call-btn:hover {
  transform: translateY(-0.0625rem);
  box-shadow: var(--accent-green-shadow-md);
  color: var(--color-white) !important;
}

/* ── Universal Body-Portaled Soft-UI Tooltip (#pmpGlobalTooltip) ── */
.soft-tooltip-surface {
  position: fixed;
  z-index: 99999;
  display: none;
  pointer-events: none;
  max-width: 20rem;
  min-width: 4rem;
  padding: 0.55rem 0.85rem;
  border-radius: 0.875rem;
  background: var(--card-bg-solid);
  color: var(--text-main);
  border: 0.0625rem solid var(--border-hairline);
  box-shadow: var(--shadow-card-hover);
  font-size: 0.78rem;
  line-height: 1.45;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.14s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.14s cubic-bezier(0.16, 1, 0.3, 1);
  --tt-arrow-offset: 50%;
}

.soft-tooltip-surface.is-visible {
  opacity: 1;
  transform: scale(1);
}

.soft-tooltip-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
}

.soft-tooltip-icon {
  font-size: 1rem;
  color: var(--accent-iris);
  flex-shrink: 0;
}

.soft-tooltip-title {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-main);
}

.soft-tooltip-badge {
  margin-left: auto;
  font-size: 0.675rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 9999rem;
  background: var(--accent-iris-light);
  color: var(--accent-iris-deep);
}

.soft-tooltip-body {
  color: var(--text-sub);
  font-weight: 500;
  word-wrap: break-word;
}

.soft-tooltip-surface:not(:has(.soft-tooltip-header)) .soft-tooltip-body {
  color: var(--text-main);
}

/* Variant Accents */
.soft-tooltip-surface.is-variant-brand {
  border-color: var(--accent-iris);
}

.soft-tooltip-surface.is-variant-success {
  border-color: var(--accent-green-border);
}

.soft-tooltip-surface.is-variant-success .soft-tooltip-icon {
  color: var(--accent-green);
}

.soft-tooltip-surface.is-variant-success .soft-tooltip-badge {
  background: var(--accent-green-bg);
  color: var(--accent-green);
}

.soft-tooltip-surface.is-variant-warning {
  border-color: var(--accent-amber-border);
}

.soft-tooltip-surface.is-variant-warning .soft-tooltip-icon {
  color: var(--accent-amber);
}

.soft-tooltip-surface.is-variant-warning .soft-tooltip-badge {
  background: var(--accent-amber-bg);
  color: var(--accent-amber);
}

.soft-tooltip-surface.is-variant-danger {
  border-color: var(--accent-red-border);
}

.soft-tooltip-surface.is-variant-danger .soft-tooltip-icon {
  color: var(--accent-red);
}

.soft-tooltip-surface.is-variant-danger .soft-tooltip-badge {
  background: var(--accent-red-bg);
  color: var(--accent-red);
}

/* Directional Arrow */
.soft-tooltip-arrow {
  position: absolute;
  width: 0.55rem;
  height: 0.55rem;
  background: var(--card-bg-solid);
  border: 0.0625rem solid var(--border-hairline);
  transform: rotate(45deg);
}

.soft-tooltip-surface.is-pos-top .soft-tooltip-arrow {
  bottom: -0.3125rem;
  left: var(--tt-arrow-offset);
  margin-left: -0.275rem;
  border-top: none;
  border-left: none;
}

.soft-tooltip-surface.is-pos-bottom .soft-tooltip-arrow {
  top: -0.3125rem;
  left: var(--tt-arrow-offset);
  margin-left: -0.275rem;
  border-bottom: none;
  border-right: none;
}

.soft-tooltip-surface.is-pos-left .soft-tooltip-arrow {
  right: -0.3125rem;
  top: var(--tt-arrow-offset);
  margin-top: -0.275rem;
  border-bottom: none;
  border-left: none;
}

.soft-tooltip-surface.is-pos-right .soft-tooltip-arrow {
  left: -0.3125rem;
  top: var(--tt-arrow-offset);
  margin-top: -0.275rem;
  border-top: none;
  border-right: none;
}

/* ==========================================================================
   Reusable Card Accent Identities & Quick Action Subsystem Grids
   ========================================================================== */
.soft-card.accent-1 {
  border-top: 0.25rem solid var(--accent-iris);
}

.soft-card.accent-1 .auth-avatar-icon {
  background: var(--accent-iris-light);
  color: var(--accent-iris-deep);
}

.soft-card.accent-2 {
  border-top: 0.25rem solid var(--accent-green);
}

.soft-card.accent-2 .auth-avatar-icon {
  background: var(--accent-green-bg);
  color: var(--accent-green);
}

.soft-card.accent-3 {
  border-top: 0.25rem solid var(--accent-sky);
}

.soft-card.accent-3 .auth-avatar-icon {
  background: var(--accent-sky-bg);
  color: var(--accent-sky);
}

.soft-card.accent-4 {
  border-top: 0.25rem solid var(--accent-amber);
}

.soft-card.accent-4 .auth-avatar-icon {
  background: var(--accent-amber-bg);
  color: var(--accent-amber);
}

.soft-card.accent-5 {
  border-top: 0.25rem solid var(--accent-red);
}

.soft-card.accent-5 .auth-avatar-icon {
  background: var(--accent-red-bg);
  color: var(--accent-red);
}

.soft-card.accent-6 {
  border-top: 0.25rem solid var(--accent-iris-dark);
}

.soft-card.accent-6 .auth-avatar-icon {
  background: var(--accent-iris-tint-15);
  color: var(--accent-iris-dark);
}

/* Left-Bordered Accent Variants for Summary / Metric Cards */
.soft-card.accent-left-1 {
  border-left: 0.25rem solid var(--accent-iris);
}

.soft-card.accent-left-2 {
  border-left: 0.25rem solid var(--accent-green);
}

.soft-card.accent-left-3 {
  border-left: 0.25rem solid var(--accent-sky);
}

.soft-card.accent-left-4 {
  border-left: 0.25rem solid var(--accent-amber);
}

.soft-card.accent-left-5 {
  border-left: 0.25rem solid var(--accent-red);
}

.soft-card.accent-left-6 {
  border-left: 0.25rem solid var(--accent-iris-dark);
}

/* Quick Action Subsystems Grid Layout */
.subsystem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.subsystem-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.35rem;
}

.subsystem-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.subsystem-card-icon {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0;
  flex-shrink: 0;
}

.subsystem-card-icon .material-symbols-rounded {
  font-size: 1.35rem;
}

.subsystem-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
}

.subsystem-card-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.subsystem-card-desc {
  font-size: 0.825rem;
  color: var(--text-sub);
  line-height: 1.45;
  margin-bottom: 1rem;
}

.subsystem-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.soft-btn-block {
  width: 100%;
  justify-content: center;
}

/* ==========================================================================
   AI Chat Workspace & Global 50vw Side Panel (Soft-UI)
   ========================================================================== */

.ai-chat-shell {
  display: grid;
  grid-template-columns: 18rem minmax(0, 1fr);
  gap: 1rem;
  height: calc(100vh - 9.5rem);
  min-height: 34rem;
}

.ai-chat-shell.sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
  gap: 0;
}

.ai-chat-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.9rem;
  border-radius: var(--card-radius, 1.5rem);
  background: var(--card-bg-solid);
  border: 0.0625rem solid var(--border-hairline);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  min-height: 0;
  transition: opacity 0.2s ease, padding 0.2s ease;
}

.ai-chat-shell.sidebar-collapsed .ai-chat-sidebar {
  padding: 0;
  border-width: 0;
  opacity: 0;
  pointer-events: none;
}

.ai-chat-sidebar-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ai-chat-search-wrap {
  position: relative;
}

.ai-chat-search-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  border: 0.0625rem solid var(--border-hairline);
  background: var(--pill-track-bg);
  color: var(--text-main);
  font-size: 0.84rem;
}

.ai-chat-search-input:focus {
  outline: none;
  border-color: var(--accent-iris);
}

.ai-chat-history-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-right: 0.15rem;
}

.ai-chat-history-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}

.ai-chat-history-spinner {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 0.15rem solid var(--border-hairline);
  border-top-color: var(--accent-iris);
  animation: ai-history-spin 0.75s linear infinite;
}

@keyframes ai-history-spin {
  to {
    transform: rotate(360deg);
  }
}

.ai-history-load-more {
  margin: 0.45rem 0 0.25rem;
  width: 100%;
  padding: 0.45rem 0.75rem;
  border-radius: 0.65rem;
  border: 0.0625rem solid var(--border-hairline);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.ai-history-load-more:hover:not(:disabled) {
  background: var(--pill-track-bg);
  color: var(--text-main);
}

.ai-history-load-more:disabled {
  opacity: 0.6;
  cursor: default;
}

.ai-tree-prompts-loading {
  padding: 0.3rem 0.5rem 0.3rem 1.4rem;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.ai-chat-history-group {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0.45rem 0.35rem 0.2rem;
}

.ai-chat-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.5rem 0.65rem;
  border-radius: 0.75rem;
  border: 0.0625rem solid transparent;
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ai-chat-history-item:hover {
  background: var(--pill-track-bg);
}

.ai-chat-history-item.active {
  background: var(--accent-iris-light);
  border-color: var(--accent-iris);
}

.ai-chat-history-title {
  flex: 1;
  min-width: 0;
  font-size: 0.84rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.ai-chat-history-actions {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.ai-chat-history-item:hover .ai-chat-history-actions,
.ai-chat-history-item.active .ai-chat-history-actions {
  opacity: 1;
}

.ai-chat-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border: none;
  border-radius: 0.45rem;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
}

.ai-chat-icon-btn:hover {
  background: var(--card-bg-solid);
  color: var(--text-main);
}

.ai-chat-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-radius: var(--card-radius, 1.5rem);
  background: var(--card-bg-solid);
  border: 0.0625rem solid var(--border-hairline);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.ai-chat-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  border-bottom: 0.0625rem solid var(--border-hairline);
  background: var(--card-bg-solid);
}

.ai-chat-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.ai-chat-active-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 22rem;
}

.ai-chat-topbar-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ai-chat-compact-select {
  min-width: 9.5rem;
}

.ai-quota-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999rem;
  border: 0.0625rem solid var(--border-hairline);
  background: var(--pill-track-bg);
  color: var(--text-sub);
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
}

.ai-quota-pill.quota-low {
  border-color: var(--accent-amber);
  background: var(--accent-amber-bg);
  color: var(--accent-amber);
}

.ai-quota-pill.quota-exhausted {
  border-color: var(--accent-red);
  background: var(--accent-red-bg);
  color: var(--accent-red);
}

.ai-chat-feed {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--bg-canvas);
}

.ai-chat-empty {
  margin: auto;
  max-width: 36rem;
  text-align: center;
  padding: 1.5rem 1rem;
}

.ai-chat-empty-title {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.ai-chat-empty-sub {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.ai-quick-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
}

.ai-quick-chip {
  padding: 0.42rem 0.78rem;
  border-radius: 999rem;
  border: 0.0625rem solid var(--border-hairline);
  background: var(--card-bg-solid);
  color: var(--text-main);
  font-size: 0.8rem;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.ai-quick-chip:hover {
  border-color: var(--accent-iris);
  transform: translateY(-0.05rem);
}

.ai-msg-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
}

.ai-msg-row.user {
  align-items: flex-end;
}

.ai-msg-row.assistant {
  align-items: flex-start;
}

.ai-msg-bubble-user {
  max-width: 82%;
  padding: 0.7rem 0.95rem;
  border-radius: 1rem 1rem 0.25rem 1rem;
  background: var(--brand-grad);
  color: var(--color-white);
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: var(--shadow-soft);
}

.ai-msg-card {
  width: 100%;
  padding: 0.95rem 1.05rem;
  border-radius: 1rem;
  background: var(--card-bg-solid);
  border: 0.0625rem solid var(--border-hairline);
  box-shadow: var(--shadow-soft);
}

.ai-msg-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.55rem;
}

.ai-msg-card-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
}

.ai-msg-card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.ai-msg-explanation {
  margin: 0 0 0.65rem;
  font-size: 0.84rem;
  color: var(--text-sub);
}

.ai-msg-summary {
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.75rem;
  border-radius: 0.75rem;
  background: var(--pill-track-bg);
  border-left: 0.2rem solid var(--accent-iris);
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-main);
  white-space: pre-wrap;
}

.ai-msg-table-wrap {
  max-height: 22rem;
  overflow: auto;
  border-radius: 0.75rem;
  border: 0.0625rem solid var(--border-hairline);
}

.ai-msg-telemetry {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.65rem;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.ai-telemetry-chip {
  padding: 0.18rem 0.5rem;
  border-radius: 999rem;
  background: var(--pill-track-bg);
  border: 0.0625rem solid var(--border-hairline);
  color: var(--text-sub);
}

.ai-msg-sql-details {
  margin-top: 0.6rem;
}

.ai-msg-sql-details summary {
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-sub);
}

.ai-msg-sql-pre {
  margin: 0.4rem 0 0;
  padding: 0.65rem 0.8rem;
  border-radius: 0.75rem;
  background: var(--pill-track-bg);
  border: 0.0625rem solid var(--border-hairline);
  font-size: 0.76rem;
  overflow-x: auto;
  color: var(--text-main);
}

.ai-msg-error {
  padding: 0.7rem 0.9rem;
  border-radius: 0.75rem;
  border: 0.0625rem solid var(--accent-red);
  background: var(--accent-red-bg);
  color: var(--accent-red);
  font-size: 0.86rem;
}

.ai-msg-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.84rem;
  color: var(--text-sub);
}

.ai-chat-composer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  border-top: 0.0625rem solid var(--border-hairline);
  background: var(--card-bg-solid);
}

.ai-chat-composer-row {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
}

.ai-chat-textarea {
  flex: 1;
  min-height: 2.8rem;
  max-height: 9rem;
  resize: vertical;
  padding: 0.6rem 0.85rem;
  border-radius: 0.75rem;
  border: 0.0625rem solid var(--border-hairline);
  background: var(--pill-track-bg);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
}

.ai-chat-textarea:focus {
  outline: none;
  border-color: var(--accent-iris);
}

.ai-chat-composer-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* Global 50vw Slide-Over AI Chat Drawer */
.ai-drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: var(--scrim-bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.ai-drawer-scrim.open {
  opacity: 1;
  pointer-events: auto;
}

.ai-drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 50vw;
  max-width: 100vw;
  z-index: 1201;
  display: flex;
  flex-direction: column;
  background: var(--card-bg-solid);
  color: var(--text-main);
  border-left: 0.0625rem solid var(--border-hairline);
  box-shadow: var(--shadow-card-hover);
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.ai-drawer-panel.open {
  transform: translateX(0);
}

.ai-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 0.0625rem solid var(--border-hairline);
  background: var(--card-bg-solid);
}

.ai-drawer-subbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  border-bottom: 0.0625rem solid var(--border-hairline);
  background: var(--bg-canvas);
}

@media (max-width: 64rem) {
  .ai-chat-shell {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    min-height: 75vh;
  }

  .ai-chat-sidebar {
    max-height: 15rem;
  }

  .ai-drawer-panel {
    width: 100vw;
  }
}

/* ==========================================================================
   Subtle Soft-UI Highlight for "AI Assistant" & "Ask AI" Header Buttons
   ========================================================================== */

.pill-nav-btn.ai-nav-highlight {
  background: var(--kpi-icon-bg);
  border: 0.0625rem solid var(--kpi-icon-border);
  color: var(--accent-iris-deep);
}

.pill-nav-btn.ai-nav-highlight .material-symbols-rounded {
  color: var(--accent-iris);
  font-size: 1.05rem;
  transition: transform 0.22s ease, color 0.22s ease;
}

.pill-nav-btn.ai-nav-highlight:hover {
  background: var(--accent-iris-light);
  border-color: var(--accent-iris);
  color: var(--accent-iris-dark);
  transform: translateY(-0.0625rem);
  box-shadow: 0 0.25rem 0.9rem var(--accent-iris-glow);
}

.pill-nav-btn.ai-nav-highlight:hover .material-symbols-rounded {
  transform: scale(1.12) rotate(-8deg);
}

.pill-nav-btn.ai-nav-highlight.active {
  background: var(--brand-grad);
  border-color: transparent;
  color: var(--color-white);
  box-shadow: 0 0.375rem 1.1rem var(--accent-iris-glow);
}

.pill-nav-btn.ai-nav-highlight.active .material-symbols-rounded {
  color: var(--color-white);
}

.ai-ask-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
  padding: 0.4375rem 0.95rem;
  border-radius: 9999rem;
  background: var(--accent-iris-light);
  backdrop-filter: blur(0.75rem);
  border: 0.0625rem solid var(--kpi-icon-border);
  box-shadow: var(--shadow-soft), 0 0 0 0.0625rem var(--kpi-icon-bg);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-iris-deep);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.ai-ask-pill .material-symbols-rounded {
  font-size: 1.05rem;
  color: var(--accent-iris);
  transition: transform 0.22s ease, color 0.22s ease;
}

.ai-ask-pill:hover {
  background: var(--brand-grad);
  border-color: transparent;
  color: var(--color-white);
  transform: translateY(-0.08rem);
  box-shadow: 0 0.45rem 1.25rem var(--accent-iris-glow);
}

.ai-ask-pill:hover .material-symbols-rounded {
  color: var(--color-white);
  transform: scale(1.14) rotate(-8deg);
}

.ai-ask-pill:active {
  transform: translateY(0);
}

/* ==========================================================================
   AI Chat Tree History & Icon-Only PDF / Excel Export Buttons
   ========================================================================== */

.ai-tree-node {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.ai-tree-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: none;
  border-radius: 0.35rem;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.ai-tree-toggle:hover {
  background: var(--card-bg-solid);
  color: var(--accent-iris);
}

.ai-tree-prompts {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-left: 1.05rem;
  padding-left: 0.55rem;
  border-left: 0.0625rem solid var(--border-hairline);
}

.ai-tree-prompt-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.3rem 0.45rem;
  border: 0.0625rem solid transparent;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--text-sub);
  font-size: 0.76rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.ai-tree-prompt-btn:hover {
  background: var(--pill-track-bg);
  color: var(--text-main);
}

.ai-tree-prompt-btn.active {
  background: var(--accent-iris-light);
  border-color: var(--kpi-icon-border);
  color: var(--accent-iris-deep);
  font-weight: 600;
}

.ai-tree-branch {
  color: var(--text-muted);
  font-size: 0.72rem;
  flex-shrink: 0;
}

.ai-tree-prompt-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-msg-highlight .ai-msg-bubble-user,
.ai-msg-highlight .ai-msg-card {
  box-shadow: 0 0 0 0.15rem var(--accent-iris), var(--shadow-card-hover);
}

.ai-export-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 0.65rem;
  border: 0.0625rem solid var(--border-hairline);
  background: var(--pill-track-bg);
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.18s ease;
}

.ai-export-icon-btn .material-symbols-rounded {
  font-size: 1.1rem;
  line-height: 1;
}

.ai-export-icon-btn.ai-export-pdf:hover {
  background: var(--accent-red-bg);
  border-color: var(--accent-red-border);
  color: var(--accent-red);
  transform: translateY(-0.0625rem);
}

.ai-export-icon-btn.ai-export-excel:hover {
  background: var(--accent-green-bg);
  border-color: var(--accent-green-border);
  color: var(--accent-green);
  transform: translateY(-0.0625rem);
}

/* Drawer Header History Icon Button & Slide-Over History Sidebar */
.ai-drawer-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 0.65rem;
  border: 0.0625rem solid var(--border-hairline);
  background: var(--pill-track-bg);
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.18s ease;
  flex-shrink: 0;
}

.ai-drawer-icon-btn .material-symbols-rounded {
  font-size: 1.15rem;
  line-height: 1;
}

.ai-drawer-icon-btn:hover,
.ai-drawer-icon-btn[aria-expanded="true"] {
  background: var(--accent-iris-light);
  border-color: var(--kpi-icon-border);
  color: var(--accent-iris-deep);
}

.ai-drawer-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ai-drawer-history-sidebar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 18.5rem;
  max-width: 85%;
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.9rem;
  background: var(--card-bg-solid);
  border-right: 0.0625rem solid var(--border-hairline);
  box-shadow: var(--shadow-card-hover);
  transform: translateX(-105%);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}

.ai-drawer-panel.history-open .ai-drawer-history-sidebar {
  transform: translateX(0);
}

/* AI Result Table Formatting (Container-Scoped, Zero Inline Styles) */
.ai-msg-table-wrap table,
.ai-result-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.ai-msg-table-wrap th,
.ai-result-table th {
  white-space: nowrap;
  text-align: left;
  background: var(--card-bg-solid);
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.65rem 0.75rem;
  border-bottom: 0.0625rem solid var(--border-hairline);
  position: sticky;
  top: 0;
  z-index: 5;
}

.ai-msg-table-wrap td,
.ai-result-table td {
  padding: 0.52rem 0.75rem;
  font-size: 0.825rem;
  color: var(--text-main);
  border-bottom: 0.0625rem solid var(--border-hairline);
  vertical-align: middle;
}

.ai-msg-table-wrap tbody tr:nth-child(even),
.ai-result-table tbody tr:nth-child(even) {
  background: var(--pill-track-bg);
}

.ai-msg-table-wrap tbody tr:hover,
.ai-result-table tbody tr:hover {
  background: var(--accent-iris-light);
}

.ai-msg-table-wrap tbody tr:last-child td,
.ai-result-table tbody tr:last-child td {
  border-bottom: none;
}

.ai-msg-table-wrap .ai-num-cell,
.ai-result-table .ai-num-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ai-chat-empty-table {
  margin: 0.5rem 0;
}