:root {
  /* DocumantStudio Design Tokens (Sakon Nakhon Navy & Royal Gold) */
  --brand-900: #10233F;     /* 16 35 63 — Dark Navy Sidebar, Primary BG */
  --brand-800: #152E52;     /* 21 46 82 — Active menu, inner border */
  --brand-700: #1D3C64;     /* 29 60 100 — Hover state, subtle edges */
  --brand-100: #DDE8F4;     /* 221 232 244 — Selected tint, highlight text */
  --brand-50:  #F0F5FA;     /* 240 245 250 — Section BG, card tint */

  --gold-600:  #A8792C;     /* 168 121 44 — Gold dark, borders */
  --gold-500:  #C28E38;     /* 194 142 56 — Gold main, logo, badges */
  --gold-100:  #F5EBD9;     /* 245 235 217 — Gold tint, warm BG */
  --gold-50:   #FAF5EC;     /* 250 245 236 — Faintest gold, hover tint */

  --bg-app: #F6F7F9;
  --bg-sidebar: var(--brand-900);
  --bg-card: #ffffff;
  --border-color: #E2E8F0;
  
  --text-main: #172033;
  --text-muted: #64748B;
  
  --color-primary: #10233F;
  --color-primary-hover: #152E52;
  --color-primary-light: #F0F5FA;
  
  --color-gold: #C28E38;
  --color-gold-hover: #A8792C;
  --color-gold-light: #F5EBD9;
  --color-yellow: #EAB308;
  
  --color-success: #137333;
  --color-success-bg: #E6F4EA;
  --color-error: #C5221F;
  --color-error-bg: #FCE8E6;
  --color-warning: #C28E38;
  --color-warning-bg: #FAF5EC;
  
  --color-68: #C28E38;       /* Gold-500 */
  --color-69: #10233F;       /* Brand-900 */
  
  --font-stack: "Google Sans", "Google Sans Flex", "Sarabun", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 6px;
  
  --shadow-sm: 0 1px 3px 0 rgba(16, 35, 63, 0.08), 0 1px 2px -1px rgba(16, 35, 63, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(16, 35, 63, 0.1), 0 2px 4px -2px rgba(16, 35, 63, 0.06);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-stack);
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
}

/* App Layout Container */
.app-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Left Sidebar (DocumantStudio Dark Navy & Gold Style) */
.sidebar {
  width: 250px;
  background-color: var(--brand-900); /* #10233F */
  border-right: 1px solid var(--brand-800); /* #152E52 */
  padding: 16px 10px 12px;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 100;
  color: #ffffff;
  box-shadow: 4px 0 20px rgba(16, 35, 63, 0.12);
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), padding 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  box-sizing: border-box;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0; /* CRITICAL: Enables flex child scrolling */
  overflow: hidden;
}

/* Brand logo with DocumantStudio Dark Navy & Gold */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px 12px;
  border-bottom: 1px solid var(--brand-800);
  position: relative;
  flex-shrink: 0;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--gold-500) 0%, var(--brand-700) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(168, 121, 44, 0.4);
  flex-shrink: 0;
}

.brand-name {
  overflow: hidden;
  white-space: nowrap;
}

.brand-name h2 {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.brand-name p {
  font-size: 11px;
  color: var(--gold-100);
  font-weight: 500;
  opacity: 0.9;
}

/* Sidebar Collapse Toggle Button */
.sidebar-collapse-btn {
  background: rgba(21, 46, 82, 0.6);
  border: 1px solid var(--brand-800);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-100);
  cursor: pointer;
  margin-left: auto;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-collapse-btn svg {
  transition: transform 0.25s ease;
}

.sidebar-collapse-btn:hover {
  background-color: var(--brand-700);
  color: #ffffff;
}

/* Nav Menu Items */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  list-style: none;
  flex: 1;
  min-height: 0; /* CRITICAL: Enables scrolling */
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  margin: 0;
  padding-left: 0;
}

/* Custom Sleek Scrollbar for Sidebar Nav */
.nav-menu::-webkit-scrollbar {
  width: 5px;
}
.nav-menu::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
}
.nav-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}
.nav-menu::-webkit-scrollbar-thumb:hover {
  background: var(--gold-500, #d97706);
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7.5px 12px;
  color: rgba(221, 232, 244, 0.85); /* var(--brand-100) */
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  white-space: nowrap;
}

.nav-item a:hover {
  background-color: var(--brand-700);
  color: #ffffff;
}

.nav-item.active a {
  background-color: var(--brand-800);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  border-left: 3.5px solid var(--gold-500);
}

.nav-item.active a .nav-icon {
  color: var(--gold-500);
}

.nav-icon {
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-100);
  flex-shrink: 0;
}

/* Collapsed Sidebar State (Desktop & Large Screens) */
.sidebar-collapsed .sidebar {
  width: 72px;
  padding: 18px 8px;
}

.sidebar-collapsed .brand {
  padding: 0 0 12px;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--brand-800);
  cursor: pointer;
}

.sidebar-collapsed .brand-name {
  display: none;
}

.sidebar-collapsed .sidebar-collapse-btn {
  display: flex;
  margin: 0 auto;
  width: 24px;
  height: 24px;
}

.sidebar-collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

.sidebar-collapsed .nav-item a {
  padding: 11px 0;
  justify-content: center;
}

.sidebar-collapsed .nav-item a span:not(.nav-icon) {
  display: none;
}

.sidebar-collapsed .nav-icon {
  font-size: 18px;
}

.sidebar-collapsed .profile-card {
  padding: 8px 0;
  justify-content: center;
  background: transparent;
  border: none;
}

.sidebar-collapsed .profile-info {
  display: none;
}

.sidebar-collapsed .main-content {
  margin-left: 72px;
  max-width: calc(100vw - 72px);
}

/* Bottom Profile Card in DocumantStudio Navy */
.profile-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: rgba(21, 46, 82, 0.5);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--brand-800);
}

.profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--brand-800);
  border: 1px solid rgba(194, 142, 56, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-100);
}

.profile-info h4 {
  font-size: 12.5px;
  font-weight: 700;
  color: #ffffff;
}

.profile-info p {
  font-size: 10.5px;
  color: var(--brand-100);
  opacity: 0.8;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #34a853; /* Online green */
  display: inline-block;
}

/* Main Content Area */
.main-content {
  flex: 1;
  margin-left: 250px;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: calc(100vw - 250px);
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Executive Header & Control Hub (Clean, Compact, Enterprise-Grade) */
.executive-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.header-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.header-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-title-flex {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.system-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--brand-900);
  line-height: 1.2;
  margin: 0;
  letter-spacing: -0.3px;
}

.system-badge {
  background-color: var(--gold-100);
  color: var(--gold-600);
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 12px;
  border: 1px solid rgba(194, 142, 56, 0.4);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background-color: var(--brand-50);
  color: var(--brand-700);
  border: 1px solid var(--brand-100);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--color-success);
}

.system-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin: 2px 0 0 0;
}

.header-search {
  flex: 1;
  max-width: 320px;
}

.modern-search {
  position: relative;
  width: 100%;
}

.modern-search input {
  width: 100%;
  background-color: #f1f3f4;
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 7px 16px 7px 34px;
  font-size: 12.5px;
  color: var(--text-main);
  outline: none;
  transition: var(--transition-fast);
}

.modern-search input:focus {
  background-color: #ffffff;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

.modern-search::before {
  content: '🔍';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  opacity: 0.5;
  pointer-events: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Excel Export Button & Dropdown */
.export-dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.btn-excel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #0e703c;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(14, 112, 60, 0.25);
  transition: var(--transition-fast);
}

.btn-excel:hover {
  background-color: #0b5930;
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(14, 112, 60, 0.35);
}

.btn-primary.btn-sm {
  padding: 7px 12px;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  border-radius: var(--radius-md);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 290px;
  padding: 6px 0;
  z-index: 1000;
  display: none;
}

.dropdown-menu.show {
  display: block;
  animation: fadeIn 0.15s ease;
}

.dropdown-header {
  padding: 8px 14px 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 14px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-fast);
}

.dropdown-item:hover {
  background-color: #f1f3f4;
}

.dropdown-icon {
  font-size: 16px;
  line-height: 1.2;
}

.dropdown-text strong {
  display: block;
  font-size: 12.5px;
  color: var(--text-main);
  font-weight: 600;
}

.dropdown-text small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.dropdown-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 4px 0;
}

.dropdown-item.highlight {
  background-color: rgba(14, 112, 60, 0.05);
}

.dropdown-item.highlight:hover {
  background-color: rgba(14, 112, 60, 0.12);
}

/* Filter & Analytics Control Toolbar Ribbon */
.filter-toolbar-ribbon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-group.right-group {
  margin-left: auto;
}

/* Top bar legacy compatibility */
.top-bar {
  display: none;
}

.search-box {
  position: relative;
}

.search-box input {
  padding: 8px 16px 8px 36px;
  border-radius: var(--radius-md);
  border: none;
  background-color: #eef1f6;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  min-width: 240px;
  transition: var(--transition-fast);
}

.search-box input:focus {
  background-color: #ffffff;
  box-shadow: 0 0 0 2px var(--color-primary-light), 0 1px 3px rgba(0,0,0,0.1);
}

.search-box::before {
  content: '🔍';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  opacity: 0.5;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.top-icon-btn {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.top-icon-btn:hover {
  color: var(--text-main);
}

.user-profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

/* Page Title Section */
.page-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.page-title p {
  font-size: 13px;
  color: var(--text-muted);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-select {
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: #ffffff;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  min-width: 200px;
  transition: var(--transition-fast);
}

.control-select:hover {
  border-color: var(--text-muted);
}

.tab-group {
  display: flex;
  background-color: #eef1f6;
  padding: 3px;
  border-radius: var(--radius-md);
}

.tab-control-btn {
  background: none;
  border: none;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: calc(var(--radius-md) - 2px);
  transition: var(--transition-fast);
}

.tab-control-btn.active {
  background: linear-gradient(135deg, var(--brand-900) 0%, var(--brand-800) 100%);
  color: #ffffff;
  font-weight: 700;
  border: 1px solid rgba(194, 142, 56, 0.35);
  box-shadow: 0 1px 3px rgba(16, 35, 63, 0.25);
}

/* Custom Pairwise Period Bar */
.pairwise-period-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 3px 8px;
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}

.pairwise-select-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pairwise-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.pairwise-select {
  height: 32px;
  padding: 4px 8px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 6px;
  background-color: #f8f9fa;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  cursor: pointer;
  outline: none;
  transition: var(--transition-fast);
}

.pairwise-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-light);
}

body.dark-theme .pairwise-period-bar {
  background-color: #1e1f22;
  border-color: #3c4043;
}

body.dark-theme .pairwise-select {
  background-color: #282a2d;
  border-color: #3c4043;
  color: #e8eaed;
}

body.dark-theme .executive-header {
  background-color: #1e1f22;
  border-color: #3c4043;
}

body.dark-theme .modern-search input {
  background-color: #282a2d;
  color: #e8eaed;
}

body.dark-theme .status-pill {
  background-color: #282a2d;
  color: #9aa0a6;
}

body.dark-theme .dropdown-menu {
  background-color: #1e1f22;
  border-color: #3c4043;
}

body.dark-theme .dropdown-item:hover {
  background-color: #282a2d;
}

body.dark-theme .dropdown-text strong {
  color: #e8eaed;
}

body.dark-theme .filter-toolbar-ribbon {
  border-top-color: #3c4043;
}

.pairwise-arrow-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-gold);
}

.btn-refresh {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.btn-refresh:hover {
  background-color: #f1f3f4;
  color: var(--text-main);
}

.btn-primary {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #1A365D 0%, #20406F 100%);
  color: #ffffff;
  border: 1px solid rgba(212, 175, 55, 0.4);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(26, 54, 93, 0.25);
  transition: var(--transition-fast);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #10243E 0%, #1A365D 100%);
  border-color: #D4AF37;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(26, 54, 93, 0.35);
}

/* --- High-Contrast Action Buttons (.primary-btn) --- */
.primary-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  color: #ffffff !important;
  font-family: var(--font-stack) !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  padding: 7px 15px !important;
  border-radius: var(--radius-sm) !important;
  border: 1px solid transparent !important;
  cursor: pointer !important;
  transition: var(--transition-fast) !important;
  box-shadow: 0 2px 4px rgba(16, 35, 63, 0.25) !important;
  text-decoration: none !important;
  line-height: 1.4 !important;
}

.primary-btn svg {
  stroke: #ffffff !important;
  fill: none !important;
  flex-shrink: 0 !important;
}

.primary-btn:hover {
  filter: brightness(1.15) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 10px rgba(16, 35, 63, 0.35) !important;
}

.primary-btn:active {
  transform: translateY(0) !important;
  box-shadow: 0 1px 3px rgba(16, 35, 63, 0.2) !important;
}

/* Ensure all buttons with dark navy/indigo or gold background have crisp white text */
button[style*="var(--color-primary)"],
button[style*="var(--brand-900)"],
button[style*="#10233F"],
button[style*="#0D1F3C"],
button[style*="#1A365D"] {
  color: #ffffff !important;
}

button[style*="var(--color-primary)"] svg,
button[style*="var(--brand-900)"] svg,
button[style*="#10233F"] svg,
button[style*="#0D1F3C"] svg,
button[style*="#1A365D"] svg {
  stroke: #ffffff !important;
}

button[style*="var(--color-gold)"],
button[style*="#C28E38"] {
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25) !important;
}

button[style*="var(--color-gold)"] svg,
button[style*="#C28E38"] svg {
  stroke: #ffffff !important;
}

/* Active Period Indicator & Quick Timeline Bar */
.active-period-banner {
  background: linear-gradient(135deg, rgba(16, 35, 63, 0.04) 0%, rgba(194, 142, 56, 0.08) 100%);
  border: 1px solid rgba(194, 142, 56, 0.35);
  border-radius: var(--radius-md);
  padding: 11px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.period-indicator-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.period-pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: var(--color-gold);
  box-shadow: 0 0 0 0 rgba(194, 142, 56, 0.7);
  animation: pulse-gold 2s infinite;
  display: inline-block;
  flex-shrink: 0;
}

@keyframes pulse-gold {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(194, 142, 56, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 7px rgba(194, 142, 56, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(194, 142, 56, 0); }
}

.period-indicator-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-primary);
}

.period-badge-target {
  background: var(--color-primary);
  color: #ffffff;
  padding: 3px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.2px;
}

.period-compare-text {
  font-size: 12px;
  color: var(--text-muted);
}

.period-compare-text strong {
  color: var(--text-main);
}

.single-period-timeline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.timeline-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.timeline-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.timeline-btn {
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.timeline-btn:hover {
  border-color: var(--color-gold);
  color: var(--color-gold);
  background: rgba(194, 142, 56, 0.05);
}

.timeline-btn.active {
  background: var(--color-gold);
  color: #ffffff;
  border-color: var(--color-gold);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(194, 142, 56, 0.35);
}

body.dark-theme .active-period-banner {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(194, 142, 56, 0.4);
}

body.dark-theme .period-indicator-label {
  color: #8ab4f8;
}

body.dark-theme .timeline-btn {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: #e0e0e0;
}

/* KPI Cards Layout (4 Columns) */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

@media (max-width: 1024px) {
  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.kpi-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  transition: var(--transition-fast);
}

.kpi-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 1px 6px rgba(0,0,0,0.03);
}

/* KPI Circular Icons Containers (Google colors) */
.kpi-icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.kpi-icon-circle.blue { background-color: var(--color-primary-light); color: var(--color-primary); }
.kpi-icon-circle.green { background-color: var(--color-success-bg); color: var(--color-success); }
.kpi-icon-circle.red { background-color: var(--color-error-bg); color: var(--color-error); }
.kpi-icon-circle.yellow { background-color: var(--color-warning-bg); color: var(--color-warning); }

.kpi-info-block {
  display: flex;
  flex-direction: column;
}

.kpi-info-block h4 {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 2px;
}

.kpi-info-block .main-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.kpi-info-block .unit-val {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.kpi-trend-wrapper {
  position: absolute;
  top: 14px;
  right: 14px;
}

.trend-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.trend-badge.positive {
  background-color: var(--color-success-bg);
  color: var(--color-success);
}

.trend-badge.negative {
  background-color: var(--color-error-bg);
  color: var(--color-error);
}

.trend-badge.stable {
  background-color: #f1f3f4;
  color: var(--text-muted);
}

/* Visualization Panel (8 cols + 4 cols) */
.vis-row {
  display: grid;
  grid-template-columns: 8fr 4fr;
  gap: 20px;
}

@media (max-width: 1024px) {
  .vis-row {
    grid-template-columns: 1fr;
  }
}

.card-panel {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-title h3 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
}

.panel-title p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

.panel-legend {
  display: flex;
  gap: 12px;
  font-size: 11.5px;
  font-weight: 500;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
}

.legend-color {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.legend-color.y68 { background-color: var(--color-68); }
.legend-color.y69 { background-color: var(--color-primary); }
.legend-color.y69_1 { background-color: #0284c7; }
.legend-color.y69_2 { background-color: var(--color-primary); }

.chart-area {
  position: relative;
  width: 100%;
  height: 280px;
}

#studentsChartPanel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

#studentsChartPanel .chart-area {
  flex: 1;
  min-height: 280px;
  height: 100%;
}

/* Executive Summary Ribbon below Chart */
.chart-summary-ribbon {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.summary-metric-card {
  background-color: var(--brand-50);
  border: 1px solid var(--brand-100);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: var(--transition-fast);
}

.summary-metric-card:hover {
  background-color: #ffffff;
  border-color: var(--gold-500);
  box-shadow: var(--shadow-sm);
}

.summary-metric-card .metric-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.summary-metric-card .metric-value {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--brand-900);
}

.summary-metric-card .metric-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 500;
}

@media (max-width: 768px) {
  .chart-summary-ribbon {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Alerts Panel */
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alert-box {
  background-color: var(--color-error-bg);
  color: var(--color-error);
  border-left: 4px solid var(--color-error);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.alert-box-header {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.35;
}

.status-box {
  background-color: var(--color-success-bg);
  color: var(--color-success);
  border-left: 4px solid var(--color-success);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #34a853;
}

/* Progress Bars inside side panel */
.progress-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
}

.progress-list h4 {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 2px;
}

.progress-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 500;
}

.progress-name {
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.progress-val {
  color: var(--color-primary);
  font-weight: 700;
}

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background-color: #f1f3f4;
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--color-primary);
  border-radius: 9999px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Table Area */
.table-panel {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 20px;
}

.table-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.table-filter-search {
  position: relative;
}

.table-filter-search input {
  padding: 8px 12px 8px 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: #ffffff;
  color: var(--text-main);
  font-size: 12.5px;
  outline: none;
  min-width: 220px;
  transition: var(--transition-fast);
}

.table-filter-search input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-light);
}

.table-filter-search::before {
  content: '🔍';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  opacity: 0.5;
}

.responsive-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

table.dashboard-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

table.dashboard-table th {
  background-color: #f8f9fa;
  padding: 12px 14px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: var(--transition-fast);
}

table.dashboard-table th:hover {
  background-color: #f1f3f4;
  color: var(--text-main);
}

table.dashboard-table th.sorted-asc::after {
  content: ' ▴';
}

table.dashboard-table th.sorted-desc::after {
  content: ' ▾';
}

table.dashboard-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  color: var(--text-main);
}

table.dashboard-table tbody tr {
  transition: var(--transition-fast);
}

table.dashboard-table tbody tr:hover {
  background-color: #f8f9fa;
}

/* Table comparative badges */
.table-change-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.table-change-badge.positive {
  background-color: var(--color-success-bg);
  color: var(--color-success);
}

.table-change-badge.negative {
  background-color: var(--color-error-bg);
  color: var(--color-error);
}

.table-change-badge.neutral {
  background-color: #f1f3f4;
  color: var(--text-muted);
}

.table-school-link {
  color: var(--text-main);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px dashed var(--border-color);
  transition: var(--transition-fast);
}

.table-school-link:hover {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* Footer layout */
.footer-row {
  margin-top: 12px;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  transition: var(--transition-fast);
}

.modal-card {
  background-color: #ffffff;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 400px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  border: 1px solid var(--border-color);
  overflow: hidden;
  animation: modalSlideIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

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

.modal-header h3 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
}

.settings-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.color-options {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.color-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition-fast);
}

.color-dot:hover {
  transform: scale(1.1);
}

.color-dot.active {
  border-color: #202124;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.08);
}

/* Glow effects when navigated to panels */
.glow-highlight {
  animation: glowAnimation 1.5s ease-in-out;
}

@keyframes glowAnimation {
  0% { box-shadow: none; border-color: var(--border-color); }
  50% { box-shadow: 0 0 15px rgba(26, 115, 232, 0.4); border-color: var(--color-primary); }
  100% { box-shadow: none; border-color: var(--border-color); }
}

/* --- Responsive & Mobile Layout Additions --- */

/* Hamburger / Sidebar Collapse Toggle (Active on both Desktop and Mobile) */
.menu-toggle-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--color-primary);
  cursor: pointer;
  padding: 6px;
  transition: var(--transition-fast);
}

.menu-toggle-btn:hover {
  background-color: var(--color-primary-light);
  border-color: var(--color-primary);
}

/* Backdrop for sidebar drawer */
.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* Media Query: Tablets & Mobile Devices (<= 992px) */
@media (max-width: 992px) {
  /* Sidebar transitions to slide-out drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.05);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  /* Shift main content to cover full page width */
  .main-content {
    margin-left: 0;
    max-width: 100%;
    padding: 20px 24px;
  }

  /* Show mobile hamburger icon button */
  .menu-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 8px;
    margin-right: 8px;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
  }

  .menu-toggle-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
  }

  .menu-toggle-btn svg {
    display: block;
  }

  /* Align top-bar to accommodate the hamburger button */
  .top-bar {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
  }

  .top-bar-right {
    margin-left: auto;
  }
}

/* Media Query: Small Screen & Mobile Devices (<= 768px) */
@media (max-width: 768px) {
  .main-content {
    padding: 12px;
    gap: 14px;
  }

  .executive-header {
    padding: 12px;
    gap: 10px;
  }
  .header-main-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .header-search {
    max-width: 100%;
  }
  .header-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .filter-toolbar-ribbon {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .toolbar-group {
    width: 100%;
  }
  .toolbar-group.right-group {
    margin-left: 0;
    justify-content: space-between;
  }

  /* Stack dashboard header elements vertically */
  .page-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .page-title h1 {
    font-size: 20px;
  }

  .page-title p {
    font-size: 12.5px;
  }

  /* Stack actions, filter selectors, and buttons */
  .page-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .control-select {
    width: 100%;
    min-width: unset;
  }

  .tab-group {
    width: 100%;
    display: flex;
  }

  .tab-control-btn {
    flex: 1;
    text-align: center;
  }

  .btn-refresh {
    padding: 10px;
    justify-content: center;
  }

  .btn-primary {
    width: 100%;
    justify-content: center;
    padding: 10px 16px;
  }

  /* Table Header Controls Alignment */
  .table-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .table-filter-search input {
    width: 100%;
    min-width: unset;
  }

  /* Lower chart panel height for compact view */
  .chart-area {
    height: 240px;
  }

  /* KPI Card adjustments */
  .kpi-card {
    padding: 14px 16px;
  }

  .kpi-info-block .main-val {
    font-size: 20px;
  }
}

/* Media Query: Extra Small Mobile Devices (<= 480px) */
@media (max-width: 480px) {
  .top-bar {
    padding-bottom: 4px;
  }

  .search-box input {
    min-width: 120px;
    max-width: 160px;
    padding: 8px 12px 8px 30px;
  }

  .search-box::before {
    left: 10px;
  }
}

/* --- Collapsible Responsive Table Styles --- */

/* Default hide toggle column and button styling */
.col-toggle {
  display: none;
}

.row-toggle-btn {
  background-color: var(--color-primary-light);
  border: none;
  color: var(--color-primary);
  border-radius: 4px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: var(--transition-fast);
}

.row-toggle-btn:hover {
  background-color: var(--color-primary);
  color: #ffffff;
}

/* Row states */
tr.expanded {
  background-color: #fcfdfe !important;
}

/* Default show for all table columns */
.col-seq, .col-name, .col-std68, .col-std69, .col-change, .col-room68, .col-room69, .col-ratio68, .col-ratio69 {
  display: table-cell;
}

/* Tablet Breakpoint (<= 1024px) */
@media (max-width: 1024px) {
  .col-toggle {
    display: table-cell;
  }
  /* Hide minor columns on tablet */
  .col-room68, .col-room69, .col-ratio68, .col-ratio69 {
    display: none;
  }
  
  /* Details Sub-row Styling */
  tr.child-row {
    background-color: #f8fafc !important;
  }
  
  tr.child-row td {
    padding: 0 !important;
    border-bottom: 1px solid var(--border-color);
  }
  
  .child-details-wrapper {
    padding: 12px 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    border-left: 4px solid var(--color-primary);
    background-color: #f8fafc;
    animation: childSlideIn 0.18s ease-out;
  }
  
  @keyframes childSlideIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  .child-detail-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
  }
  
  .detail-label {
    font-weight: 700;
    color: var(--text-muted);
  }
  
  .detail-val {
    color: var(--text-main);
  }
}

/* Mobile Breakpoint (<= 768px) */
@media (max-width: 768px) {
  /* On mobile, also hide std68 */
  .col-std68 {
    display: none;
  }
  
  .child-details-wrapper {
    flex-direction: column;
    gap: 8px;
    padding: 10px 14px;
  }
}

/* --- Presentation Dark Mode Styles --- */

body.dark-theme {
  --bg-app: #121214;          /* Google dark app background */
  --bg-sidebar: #1e1e24;      /* Google dark sidebar */
  --bg-card: #1e1e24;         /* Google dark card */
  --border-color: #3c4043;    /* Google dark border color */
  
  --text-main: #f1f3f4;       /* Google dark primary text */
  --text-muted: #9aa0a6;      /* Google dark secondary text */
  
  --color-primary-light: rgba(26, 115, 232, 0.15);
  --color-success-bg: rgba(19, 115, 51, 0.15);
  --color-error-bg: rgba(197, 34, 31, 0.15);
  --color-warning-bg: rgba(176, 96, 0, 0.15);
}

/* Specific UI Element overrides under Dark Mode */
body.dark-theme select,
body.dark-theme input[type="text"] {
  background-color: #2e3033;
  color: #f1f3f4;
  border-color: #3c4043;
}

body.dark-theme input[type="range"] {
  accent-color: var(--color-primary);
}

body.dark-theme .modal-card {
  background-color: #1e1e24;
  color: #f1f3f4;
  border-color: #3c4043;
}

body.dark-theme .tab-group {
  background-color: #2e3033;
}

body.dark-theme .tab-control-btn.active {
  background-color: #1e1e24;
  color: #f1f3f4;
}

body.dark-theme .profile-card,
body.dark-theme .search-box input,
body.dark-theme .btn-refresh:hover,
body.dark-theme .nav-item a:hover {
  background-color: #2e3033;
  color: #f1f3f4;
}

body.dark-theme .nav-item.active a {
  background-color: rgba(26, 115, 232, 0.2);
  color: #8ab4f8; /* Google Sans Blue light */
}

body.dark-theme table.dashboard-table th {
  background-color: #25262b;
  color: #9aa0a6;
}

body.dark-theme table.dashboard-table tbody tr:hover {
  background-color: #25262b;
}

body.dark-theme .child-details-wrapper {
  background-color: #202124;
}

body.dark-theme .row-toggle-btn {
  background-color: rgba(26, 115, 232, 0.2);
  color: #8ab4f8;
}

body.dark-theme .row-toggle-btn:hover {
  background-color: var(--color-primary);
  color: #ffffff;
}

body.dark-theme footer-row {
  color: var(--text-muted);
}

/* --- School Comparison & Advanced Insights Layouts --- */

.comparison-grid,
.insights-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Strategic Insights list items styling */
.insight-bullet {
  padding-left: 20px;
  position: relative;
}

.insight-bullet::before {
  content: "•";
  position: absolute;
  left: 6px;
  color: var(--color-primary);
  font-weight: bold;
}

/* Responsive queries for comparison */
@media (max-width: 992px) {
  .comparison-grid,
  .insights-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* Dark theme overrides for Comparison specific colors */
body.dark-theme #schoolCardB {
  border-left-color: var(--color-warning, #b06000) !important;
}

body.dark-theme .comparison-grid .kpi-card {
  background-color: var(--bg-card);
}

/* --- School Detail Modal (Drill-down) --- */
.school-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  backdrop-filter: blur(4px);
  transition: var(--transition-fast);
}

.school-modal-card {
  background-color: #ffffff;
  border-radius: var(--radius-lg);
  width: 95%;
  max-width: 800px;
  max-height: 90vh;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  border: 1px solid var(--border-color);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-theme .school-modal-card {
  background-color: #1e1e24;
  color: #f1f3f4;
  border-color: #3c4043;
}

.school-modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.school-modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.school-modal-header p {
  font-size: 12px;
  color: var(--text-muted);
}

.school-modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.school-modal-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.school-modal-kpi-card {
  background-color: #f8f9fa;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  text-align: center;
}

body.dark-theme .school-modal-kpi-card {
  background-color: #25262b;
}

.school-modal-kpi-card h4 {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.school-modal-kpi-card p {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.school-modal-charts-row {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .school-modal-charts-row {
    grid-template-columns: 1fr;
  }
  .school-modal-kpi-row {
    grid-template-columns: 1fr;
  }
}

.school-modal-chart-container {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  background-color: #ffffff;
  min-height: 280px;
  position: relative;
}

body.dark-theme .school-modal-chart-container {
  background-color: #1e1e24;
}

.school-modal-chart-container h4 {
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-main);
}

/* --- School Clustering Tab styling --- */
.cluster-tabs-container {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.cluster-tab-btn {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
}

.cluster-tab-btn:hover {
  background-color: #f1f3f4;
  color: var(--text-main);
}

.cluster-tab-btn.active {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

body.dark-theme .cluster-tab-btn {
  background-color: #1e1e24;
  color: var(--text-muted);
}

body.dark-theme .cluster-tab-btn:hover {
  background-color: #2e3033;
  color: #f1f3f4;
}

body.dark-theme .cluster-tab-btn.active {
  background-color: rgba(26, 115, 232, 0.2);
  color: #8ab4f8;
  border-color: #8ab4f8;
}

/* --- Print Stylesheet (@media print) --- */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  
  .sidebar,
  .top-bar-right,
  .header-actions,
  .header-search,
  .export-dropdown-wrapper,
  .btn-excel,
  .dropdown-menu,
  .page-actions,
  .table-controls,
  .modal-overlay,
  .school-modal-overlay,
  .theme-toggle,
  .btn-refresh,
  #closeSettingsBtn,
  #btnExport,
  .cluster-tabs-container,
  #btnExecutivePrintPdf,
  #btnExecutiveMasterExcel,
  .forecast-scenario-btn,
  .resource-view-btn,
  .retention-mode-btn,
  .district-view-btn {
    display: none !important;
  }
  
  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
  }
  
  .card-panel,
  .kpi-card,
  table.dashboard-table {
    border: 1px solid #000000 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }
  
  table.dashboard-table th {
    background-color: #f0f0f0 !important;
    color: #000000 !important;
  }
  
  .kpi-row {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 10px !important;
  }
  
  .vis-row {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }
  
  .chart-area {
    height: 300px !important;
    page-break-inside: avoid;
  }
}







/* ==========================================================================
   ENTERPRISE MODULES EXPANSION (GIS, SANDBOX, RADAR, EXECUTIVE SPEECH & PWA)
   ========================================================================== */

/* GIS Map Section */
.gis-map-container,
#schoolGisMap {
  position: relative;
  width: 100%;
  height: 560px !important;
  min-height: 560px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color, #e2e8f0);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  background: #f1f5f9;
}
.gis-controls-ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}
.gis-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.gis-filter-btn {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 20px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  transition: all 0.2s ease;
}
.gis-filter-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}
.gis-filter-btn.active {
  background: var(--color-navy, #1e3a8a);
  color: #ffffff;
  border-color: var(--color-navy, #1e3a8a);
}
.leaflet-popup-content-wrapper {
  border-radius: 10px !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15) !important;
  font-family: 'Sarabun', sans-serif !important;
}
.school-popup-card {
  padding: 4px;
}
.school-popup-card h4 {
  margin: 0 0 4px 0;
  color: #0f172a;
  font-size: 15px;
  font-weight: 700;
}
.school-popup-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 8px;
}
.school-popup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 8px 0;
  font-size: 12px;
}
.school-popup-grid div {
  background: #f8fafc;
  padding: 4px 6px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}
.school-popup-btn {
  width: 100%;
  margin-top: 6px;
  padding: 6px 10px;
  background: #1e3a8a;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.school-popup-btn:hover {
  background: #1d4ed8;
}

/* Early Warning Radar */
.radar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.radar-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 18px 20px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.radar-card:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  box-shadow: 0 8px 20px -4px rgba(15, 23, 42, 0.08);
}
.radar-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.06);
}
/* Clean red radar */
/* Clean yellow radar */
/* Clean orange radar */
/* Clean blue radar */

.radar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.radar-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.radar-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  animation: pulse-ring 1.5s infinite;
}
@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
  100% { transform: scale(0.95); opacity: 1; }
}
.radar-card.red .radar-pulse-dot { background: #ef4444; }
.radar-card.yellow .radar-pulse-dot { background: #f59e0b; }
.radar-card.orange .radar-pulse-dot { background: #f97316; }
.radar-card.blue .radar-pulse-dot { background: #3b82f6; }

.radar-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 230px;
  overflow-y: auto;
  padding-right: 4px;
}
.radar-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: #f8fafc;
  border-radius: 6px;
  border: 1px solid #f1f5f9;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.radar-item:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.radar-action-box {
  margin-top: 14px;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 12px;
  color: #475569;
  border: 1px solid #edf2f7;
  line-height: 1.5;
}

/* What-If Policy Sandbox */
.sandbox-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 20px;
}
.sandbox-sliders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}
.slider-control-card {
  background: #ffffff;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.slider-control-card label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 10px;
}
.slider-val-badge {
  padding: 2px 8px;
  background: #e0e7ff;
  color: #3730a3;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
}
.custom-range-slider {
  width: 100%;
  accent-color: #1e3a8a;
  cursor: pointer;
}
.slider-limits {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}
.sandbox-kpis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 10px;
}
.sandbox-kpi-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 16px 18px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
}
.sandbox-kpi-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px -2px rgba(15, 23, 42, 0.06);
}
.sandbox-kpi-card h5 {
  font-size: 12px;
  color: #64748b;
  margin: 0 0 6px 0;
  text-transform: uppercase;
}
.sandbox-kpi-card p.val {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}
.sandbox-kpi-card span.sub {
  font-size: 12px;
  color: #059669;
  font-weight: 600;
}

/* Executive Speech Security Gate & Modal */
.security-gate-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.security-gate-card {
  background: #ffffff;
  border-radius: 16px;
  max-width: 440px;
  width: 90%;
  padding: 32px 28px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
  border: 1px solid #cbd5e1;
  text-align: center;
}
.security-icon-circle {
  width: 60px;
  height: 60px;
  margin: 0 auto 16px auto;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b45309;
}
.security-pin-input {
  letter-spacing: 12px;
  font-size: 28px;
  text-align: center;
  font-weight: 700;
  width: 180px;
  padding: 8px 12px;
  margin: 16px auto;
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  outline: none;
  transition: all 0.2s;
}
.security-pin-input:focus {
  border-color: #d97706;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.2);
}
@keyframes shake-anim {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
.shake {
  animation: shake-anim 0.4s ease-in-out;
}

/* Executive Speech Generator Modal */
.speech-modal-card {
  background: #ffffff;
  border-radius: 16px;
  max-width: 860px;
  width: 92%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
  border: 1px solid #cbd5e1;
  overflow: hidden;
  box-sizing: border-box;
}

.speech-modal-header {
  padding: 16px 22px;
  background: #1e3a8a;
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  box-sizing: border-box;
}

.speech-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
  overflow-x: auto;
  box-sizing: border-box;
  min-height: 58px;
}

.speech-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  height: 38px;
  min-height: 38px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: 'Sarabun', sans-serif;
  line-height: 1.4;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-sizing: border-box;
}

.speech-tab-btn:hover {
  background: #ffffff;
  color: #1e293b;
  border-color: #94a3b8;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.speech-tab-btn.active {
  background: #1e3a8a;
  color: #ffffff;
  border-color: #1e3a8a;
  box-shadow: 0 2px 6px rgba(30, 58, 138, 0.25);
}

.speech-content-box {
  flex: 1 1 auto;
  min-height: 200px;
  max-height: calc(90vh - 220px);
  overflow-y: auto;
  padding: 24px;
  font-family: 'Sarabun', sans-serif;
  line-height: 1.85;
  color: #1e293b;
  background: #fafaf9;
  border: 1px solid #e7e5e4;
  border-radius: 10px;
  margin: 16px 22px;
  font-size: 15px;
  white-space: pre-line;
  box-sizing: border-box;
}

.speech-modal-footer {
  padding: 14px 22px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  flex-shrink: 0;
  box-sizing: border-box;
}

.sidebar-bottom {
  flex-shrink: 0;
  padding-top: 10px;
  margin-top: 6px;
  border-top: 1px solid var(--brand-800);
}

/* Nav Section Header Category Dividers */
.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  color: rgba(148, 163, 184, 0.65);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 10px 2px;
  list-style: none;
  pointer-events: none;
  user-select: none;
}
.sidebar-collapsed .nav-section-title {
  display: none;
}


/* Filter Pill Group (used in 5-Wave Longitudinal & DSS Analytics) */
.filter-pill-group {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  gap: 2px;
}

body.dark-theme .filter-pill-group {
  background: #1e293b;
  border-color: #334155;
}

.filter-pill {
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: #475569;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Sarabun', sans-serif;
}

body.dark-theme .filter-pill {
  color: #94a3b8;
}

.filter-pill:hover {
  color: #1e293b;
  background: rgba(255, 255, 255, 0.6);
}

body.dark-theme .filter-pill:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.05);
}

.filter-pill.active {
  background: #1e3a8a;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(30, 58, 138, 0.2);
}

body.dark-theme .filter-pill.active {
  background: #3b82f6;
  color: #ffffff;
}

.health-row-clickable {
  cursor: pointer;
  transition: background 0.15s ease;
}

.health-row-clickable:hover {
  background: #f8fafc !important;
}

body.dark-theme .health-row-clickable:hover {
  background: #1e293b !important;
}

.health-row-clickable.selected-row {
  background: #eff6ff !important;
  font-weight: 600;
}

body.dark-theme .health-row-clickable.selected-row {
  background: rgba(59, 130, 246, 0.15) !important;
}


/* ==========================================================================
   FEATURE 1: UNIVERSAL COMMAND PALETTE (CTRL + K)
   ========================================================================== */
.cmd-palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 10vh;
}

.cmd-palette-card {
  width: 90%;
  max-width: 640px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35);
  border: 1px solid #cbd5e1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.dark-theme .cmd-palette-card {
  background: #1e293b;
  border-color: #334155;
}

.cmd-palette-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
}

body.dark-theme .cmd-palette-header {
  border-color: #334155;
}

.cmd-search-icon {
  font-size: 18px;
}

.cmd-palette-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  font-family: 'Sarabun', sans-serif;
  color: #1e293b;
  outline: none;
}

body.dark-theme .cmd-palette-input {
  color: #f8fafc;
}

.cmd-palette-badge {
  font-size: 11px;
  background: #f1f5f9;
  color: #64748b;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
}

body.dark-theme .cmd-palette-badge {
  background: #334155;
  color: #94a3b8;
}

.cmd-palette-body {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: 'Sarabun', sans-serif;
}

.cmd-item:hover, .cmd-item.active {
  background: #f1f5f9;
}

body.dark-theme .cmd-item:hover, body.dark-theme .cmd-item.active {
  background: #334155;
}

.cmd-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cmd-item-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #1e293b;
}

body.dark-theme .cmd-item-title {
  color: #f1f5f9;
}

.cmd-item-desc {
  font-size: 11.5px;
  color: #64748b;
}

body.dark-theme .cmd-item-desc {
  color: #94a3b8;
}

.cmd-item-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #e2e8f0;
  color: #475569;
  font-weight: 600;
}

body.dark-theme .cmd-item-tag {
  background: #475569;
  color: #cbd5e1;
}

.cmd-palette-footer {
  padding: 10px 20px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #64748b;
}

body.dark-theme .cmd-palette-footer {
  background: #0f172a;
  border-color: #334155;
  color: #94a3b8;
}

/* ==========================================================================
   FEATURE 2: A4 EXECUTIVE POLICY ONE-PAGER
   ========================================================================== */
.one-pager-modal-card {
  width: 95%;
  max-width: 860px;
  max-height: 94vh;
  background: #ffffff;
  border-radius: 14px;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.4);
  display: flex;
  flex-direction: column;
}

.one-pager-header-bar {
  padding: 14px 22px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

.a4-sheet-container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 30px;
  background: #ffffff;
  color: #0f172a;
  font-family: 'Sarabun', sans-serif;
  line-height: 1.45;
  box-sizing: border-box;
}

.a4-gov-header {
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 2px solid #1e3a8a;
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.a4-garuda {
  width: 55px;
  height: 55px;
  object-fit: contain;
}

.a4-gov-titles {
  flex: 1;
}

.a4-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #1e3a8a;
}

.a4-subtitle {
  margin: 2px 0;
  font-size: 13.5px;
  font-weight: 600;
  color: #334155;
}

.a4-meta {
  margin: 0;
  font-size: 11px;
  color: #64748b;
}

.a4-box {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 12px;
}

.a4-box-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #1e3a8a;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #e2e8f0;
}

.a4-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  text-align: center;
}

.a4-kpi-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
}

.a4-kpi-lbl {
  font-size: 10px;
  color: #64748b;
  font-weight: 600;
}

.a4-kpi-val {
  font-size: 14px;
  color: #0f172a;
  margin: 2px 0;
}

.a4-kpi-sub {
  font-size: 9.5px;
  color: #64748b;
}

.text-green { color: #16a34a !important; }
.text-blue { color: #0284c7 !important; }
.text-gold { color: #c28e38 !important; }
.text-red { color: #b91c1c !important; }

.a4-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.a4-compact-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.a4-compact-table th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
  padding: 4px 6px;
  border: 1px solid #cbd5e1;
}

.a4-compact-table td {
  padding: 4px 6px;
  border: 1px solid #cbd5e1;
}

.a4-badge {
  font-size: 9.5px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.bg-green { background: #dcfce7; color: #166534; }
.bg-blue { background: #e0f2fe; color: #075985; }
.bg-yellow { background: #fef9c3; color: #854d0e; }
.bg-orange { background: #ffedd5; color: #9a3412; }

.a4-directives-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
}

.a4-directive-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.a4-num {
  background: #1e3a8a;
  color: #ffffff;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.a4-signoff {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 10px;
  color: #64748b;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed #cbd5e1;
}

@media print {
  body * {
    visibility: hidden;
  }
  #printableOnePagerContent, #printableOnePagerContent * {
    visibility: visible;
  }
  #printableOnePagerContent {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border: none;
  }
  .no-print {
    display: none !important;
  }
  @page {
    size: A4 portrait;
    margin: 8mm;
  }
}

/* ==========================================================================
   FEATURE 3: AI EXECUTIVE POLICY COPILOT
   ========================================================================== */
.floating-copilot-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9990;
  background: linear-gradient(135deg, #1e3a8a, #0f172a);
  color: #ffffff;
  border: 1.5px solid #3b82f6;
  border-radius: 9999px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Sarabun', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 25px -3px rgba(30, 58, 138, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-copilot-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 20px 25px -5px rgba(30, 58, 138, 0.5);
  border-color: #60a5fa;
}

.copilot-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-green 1.8s infinite;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.copilot-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10001;
  display: flex;
  justify-content: flex-end;
  animation: fadeInOverlay 0.22s ease-out;
}

@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

.copilot-drawer {
  width: 100%;
  max-width: 490px;
  height: 100%;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  box-shadow: -15px 0 50px rgba(15, 23, 42, 0.28);
  animation: slideInRight 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  border-left: 1px solid rgba(226, 232, 240, 0.8);
  position: relative;
  overflow: hidden;
}

body.dark-theme .copilot-drawer {
  background: #0b1120;
  border-color: #1e293b;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

/* Header */
.copilot-drawer-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #090d16 0%, #0f172a 45%, #1e3a8a 100%);
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  position: relative;
}

.copilot-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.55);
  flex-shrink: 0;
}

.copilot-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  font-family: 'Prompt', sans-serif;
  letter-spacing: -0.2px;
  color: #ffffff;
}

.copilot-badge-live {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.copilot-badge-live::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.copilot-subtitle {
  font-size: 11.5px;
  color: #93c5fd;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.copilot-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.copilot-header-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.copilot-header-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  transform: translateY(-1px);
}

.copilot-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.2s ease;
}

.copilot-close-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
  transform: translateY(-1px);
}

/* Status Bar */
.copilot-status-bar {
  padding: 9px 18px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Sarabun', sans-serif;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

body.dark-theme .copilot-status-bar {
  background: #0f172a;
  border-color: #1e293b;
}

.copilot-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #334155;
}

body.dark-theme .copilot-status-indicator {
  color: #cbd5e1;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.online {
  background: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.9);
}

.status-dot.offline {
  background: #94a3b8;
}

.btn-setup-gemini {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #ffffff;
  border: none;
  border-radius: 9999px;
  padding: 4px 12px;
  font-size: 11.5px;
  font-family: 'Sarabun', sans-serif;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
  transition: all 0.2s ease;
}

.btn-setup-gemini:hover {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}

.btn-setup-gemini.active-mode {
  background: linear-gradient(135deg, #059669, #10b981);
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

/* Suggestion Chips Wrapper & Carousel */
.copilot-chips-wrapper {
  padding: 10px 16px 8px;
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}

body.dark-theme .copilot-chips-wrapper {
  background: #0f172a;
  border-color: #1e293b;
}

.copilot-chips-header {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.copilot-chips-bar {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  white-space: nowrap;
  padding-bottom: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.copilot-chips-bar::-webkit-scrollbar {
  display: none;
}

.copilot-chip {
  padding: 6px 13px;
  border-radius: 9999px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 500;
  font-family: 'Sarabun', sans-serif;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

body.dark-theme .copilot-chip {
  background: #1e293b;
  border-color: #334155;
  color: #cbd5e1;
}

.copilot-chip:hover {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #93c5fd;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

/* Messages Stream */
.copilot-messages {
  flex: 1;
  padding: 18px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-family: 'Sarabun', sans-serif;
  background: #f8fafc;
}

body.dark-theme .copilot-messages {
  background: #0b1120;
}

.copilot-msg {
  display: flex;
  width: 100%;
}

.copilot-msg.bot {
  justify-content: flex-start;
}

.copilot-msg.user {
  justify-content: flex-end;
}

/* Bot Card (Executive AI Card) */
.copilot-msg-card {
  max-width: 95%;
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 18px 18px 18px 4px;
  padding: 14px 16px;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
  transition: all 0.2s ease;
}

body.dark-theme .copilot-msg-card {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.25);
}

.copilot-msg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 11.5px;
}

body.dark-theme .copilot-msg-header {
  border-color: #334155;
}

.copilot-msg-author {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #1e293b;
}

body.dark-theme .copilot-msg-author {
  color: #f1f5f9;
}

.copilot-bot-sparkle {
  font-size: 14px;
}

.copilot-engine-tag {
  background: #eff6ff;
  border: 1px solid #dbeafe;
  color: #1e40af;
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
}

body.dark-theme .copilot-engine-tag {
  background: #1e3a8a;
  border-color: #1d4ed8;
  color: #bfdbfe;
}

.btn-copy-bubble {
  background: transparent;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  color: #64748b;
  cursor: pointer;
  font-family: 'Sarabun', sans-serif;
  transition: all 0.15s ease;
}

.btn-copy-bubble:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
}

.btn-copy-bubble.copied {
  background: #f0fdf4;
  color: #16a34a;
  border-color: #86efac;
}

.msg-content {
  font-size: 13.5px;
  line-height: 1.68;
  color: #1e293b;
}

body.dark-theme .msg-content {
  color: #e2e8f0;
}

/* User Bubble */
.user-bubble {
  max-width: 85%;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #ffffff;
  padding: 11px 16px;
  border-radius: 18px 18px 4px 18px;
  font-size: 13.5px;
  line-height: 1.55;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28);
  word-break: break-word;
}

/* Copilot Markdown Tables */
.copilot-markdown-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  margin: 10px 0;
  font-size: 12px;
}
.copilot-markdown-table th {
  background: #f1f5f9;
  color: #1e293b;
  font-weight: 700;
  padding: 6px 10px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
}
.copilot-markdown-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}
.copilot-markdown-table tr:last-child td {
  border-bottom: none;
}
.copilot-markdown-table tr:nth-child(even) td {
  background: #f8fafc;
}
body.dark-theme .copilot-markdown-table {
  border-color: #334155;
}
body.dark-theme .copilot-markdown-table th {
  background: #1e293b;
  color: #f1f5f9;
  border-color: #334155;
}
body.dark-theme .copilot-markdown-table td {
  color: #cbd5e1;
  border-color: #334155;
}
body.dark-theme .copilot-markdown-table tr:nth-child(even) td {
  background: #0f172a;
}

/* Composer Container */
.copilot-composer-container {
  padding: 12px 16px 14px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}

body.dark-theme .copilot-composer-container {
  background: #0f172a;
  border-color: #1e293b;
}

.copilot-composer-card {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 14px;
  padding: 8px 12px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

body.dark-theme .copilot-composer-card {
  background: #1e293b;
  border-color: #334155;
}

.copilot-composer-card:focus-within {
  border-color: #3b82f6;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15), 0 8px 20px -4px rgba(15, 23, 42, 0.08);
}

body.dark-theme .copilot-composer-card:focus-within {
  background: #0f172a;
  border-color: #3b82f6;
}

.copilot-composer-input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13.5px;
  font-family: 'Sarabun', sans-serif;
  color: #0f172a;
  padding: 4px 0 6px 0;
}

body.dark-theme .copilot-composer-input {
  color: #ffffff;
}

.copilot-composer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(226, 232, 240, 0.6);
}

body.dark-theme .copilot-composer-bottom {
  border-color: rgba(51, 65, 85, 0.6);
}

.copilot-composer-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-composer-tool {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 11.5px;
  font-family: 'Sarabun', sans-serif;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.btn-composer-tool:hover {
  background: #e2e8f0;
  color: #0f172a;
}

body.dark-theme .btn-composer-tool:hover {
  background: #334155;
  color: #f1f5f9;
}

.copilot-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #1e40af, #2563eb);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.35);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.copilot-send-btn:hover {
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  transform: scale(1.08);
  box-shadow: 0 5px 14px rgba(37, 99, 235, 0.45);
}

.copilot-disclaimer {
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
  margin-top: 8px;
  line-height: 1.4;
}

.copilot-settings-panel {
  padding: 12px 14px;
  background: #f8fafc;
  border-bottom: 2px solid #cbd5e1;
  font-family: 'Sarabun', sans-serif;
  animation: fadeIn 0.2s ease-out;
  flex-shrink: 0;
}

body.dark-theme .copilot-settings-panel {
  background: #1e293b;
  border-color: #475569;
}

.settings-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.settings-close-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  color: #64748b;
  cursor: pointer;
  line-height: 1;
}

.api-key-input-group {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.copilot-key-input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12px;
  font-family: monospace;
}

body.dark-theme .copilot-key-input {
  background: #0f172a;
  border-color: #475569;
  color: #f1f5f9;
}

.btn-toggle-vis {
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 10px;
  cursor: pointer;
}

.settings-btn-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.btn-save-key {
  background: #16a34a;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-save-key:hover {
  background: #15803d;
}

.btn-clear-key {
  background: #ef4444;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-clear-key:hover {
  background: #b91c1c;
}

.settings-help-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.link-get-key {
  font-size: 11px;
  color: #2563eb;
  text-decoration: underline;
  font-weight: 600;
}

.security-note {
  font-size: 10px;
  color: #94a3b8;
}

/* Typing indicator animation */
.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 4px 6px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: #3b82f6;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.copilot-msg.bot .msg-bubble h3,
.copilot-msg.bot .msg-bubble h4 {
  margin: 8px 0 4px;
  color: #1e3a8a;
}

body.dark-theme .copilot-msg.bot .msg-bubble h3,
body.dark-theme .copilot-msg.bot .msg-bubble h4 {
  color: #93c5fd;
}

/* ==========================================================================
   OFFICIAL SCHOOL METADATA BAR & CONTACT PILLS
   ========================================================================== */
.school-modal-official-bar {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 12px;
  font-family: 'Sarabun', sans-serif;
  line-height: 1.5;
}

body.dark-theme .school-modal-official-bar {
  background: #0f172a;
  border-color: #334155;
  color: #cbd5e1;
}

.school-popup-tag {
  display: inline-block;
  line-height: 1.3;
}

/* ==========================================================================
   EXECUTIVE INSPECTION ROUTE PLANNER STYLES
   ========================================================================== */
.route-preset-btn {
  background: #ffffff;
  color: #475569;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 11.5px;
  font-family: 'Sarabun', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.route-preset-btn:hover {
  background: #f1f5f9;
  color: #1e40af;
  border-color: #93c5fd;
}

.route-preset-btn.active {
  background: #1e40af;
  color: #ffffff;
  border-color: #1e40af;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(30, 58, 138, 0.2);
}

.route-school-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.route-school-chip:hover {
  border-color: #93c5fd;
  background: #f8fafc;
}

.route-school-chip.checked {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1e40af;
  font-weight: 600;
}

.route-stop-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
  position: relative;
}

.route-stop-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 6px -1px rgba(30, 58, 138, 0.08);
}

.route-stop-card.start-hub {
  background: #f8fafc;
  border-left: 4px solid #1e3a8a;
}

.route-stop-card.lunch-break {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
}

.route-stop-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1e40af;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13.5px;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(30, 58, 138, 0.2);
}

.route-stop-number.start {
  background: #1e3a8a;
}

.route-stop-number.lunch {
  background: #f59e0b;
}

.route-leg-divider {
  padding: 4px 16px 4px 44px;
  font-size: 11px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.route-leg-divider::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 1px;
  background: #cbd5e1;
}

/* Custom Leaflet Numbered Marker Icon */
.leaflet-route-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1e40af;
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  border: 2.5px solid #ffffff;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s;
}

.leaflet-route-marker:hover {
  transform: scale(1.18);
  z-index: 1000 !important;
}

.leaflet-route-marker.start {
  background: #15803d;
  font-size: 15px;
}

/* Dark Theme Adaptations */
body.dark-theme .route-planner-panel {
  background: #1e293b !important;
  border-color: #334155 !important;
}

body.dark-theme .route-preset-btn {
  background: #0f172a;
  color: #94a3b8;
  border-color: #334155;
}

body.dark-theme .route-preset-btn.active {
  background: #3b82f6;
  color: #ffffff;
  border-color: #3b82f6;
}

body.dark-theme .route-stop-card {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark-theme .route-stop-card.start-hub {
  background: #1e293b;
  border-left-color: #3b82f6;
}

body.dark-theme .route-stop-card.lunch-break {
  background: #291d09;
  border-left-color: #f59e0b;
}

body.dark-theme .route-school-chip {
  background: #0f172a;
  border-color: #334155;
  color: #cbd5e1;
}

body.dark-theme .route-school-chip.checked {
  background: #1e3a8a30;
  border-color: #60a5fa;
  color: #93c5fd;
}
