/* ================================================================
   ระบบเสนอโครงการออนไลน์ วิทยาลัยเทคนิคลพบุรี (SRS-v4.0)
   Master Design System: Maroon (#730000), Navy Blue (#1B365D), White (#FFFFFF)
   ================================================================ */

:root {
  /* Primary & Brand Colors: Maroon จากแบบ (#730000) */
  --primary: #730000;
  --primary-hover: #5A0000;
  --primary-light: #8C0000;
  --primary-dark: #4A0000;

  /* Accent Colors: Navy Blue จากแบบ (#1B365D) */
  --accent: #1B365D;
  --accent-hover: #0D253F;
  --accent-light: #1D4ED8;
  --accent-soft: #EDF4FA;
  --accent-text: #1B365D;

  /* Neutral & Backgrounds (สีขาวสะอาด) */
  --bg-main: #FFFFFF;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F8FAFC;
  --bg-surface-secondary: #F8FAFC;

  /* Typography & Borders */
  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-light: #94A3B8;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --border-color: #E2E8F0;

  /* Status Colors */
  --success: #10B981;
  --success-soft: #D1FAE5;
  --warning: #F59E0B;
  --warning-soft: #FEF3C7;
  --danger: #EF4444;
  --danger-soft: #FEE2E2;
  --info: #2563EB;
  --info-soft: #DBEAFE;

  /* Shadows & Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ================================================================
   Dark Mode Theme System ([data-theme="dark"]) — YouTube Dark Palette
   ================================================================ */
[data-theme="dark"] {
  color-scheme: dark;
  /* Brand Primary in Dark Mode: Pure White for maximum readability */
  --primary: #FFFFFF;
  --primary-hover: #E2E8F0;
  --primary-light: #F8FAFC;
  --primary-dark: #CBD5E1;

  /* Neutral & Backgrounds (YouTube Exact Pure Dark Palette) */
  --bg-main: #0F0F0F;       /* YouTube Pure Dark Canvas */
  --bg-surface: #212121;    /* YouTube Card / Surface */
  --bg-subtle: #272727;     /* YouTube Chip / Pill / Input Background */
  --bg-surface-secondary: #1E1E1E; /* Dark Card Header / Elevated Surface */

  /* Typography & Borders */
  --text-main: #F1F1F1;     /* YouTube Primary Text */
  --text-muted: #AAAAAA;    /* YouTube Secondary Text */
  --text-light: #717171;    /* YouTube Tertiary / Disabled Text */
  --border: #303030;        /* YouTube Separator / Border */
  --border-strong: #3F3F3F; /* YouTube Elevated Border */
  --border-color: #303030;  /* YouTube Separator / Border Alias */

  /* Accent Colors adjustments for YouTube Dark Mode */
  --accent: #3EA6FF;
  --accent-hover: #70BAFF;
  --accent-light: #93C5FD;
  --accent-soft: rgba(62, 166, 255, 0.15);
  --accent-text: #3EA6FF;   /* YouTube Signature Accent Blue */

  /* Shadows for Dark Mode */
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.6);
  --shadow-md: 0 4px 8px -1px rgba(0, 0, 0, 0.7), 0 2px 4px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 20px -3px rgba(0, 0, 0, 0.8), 0 4px 6px -2px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 20px 30px -5px rgba(0, 0, 0, 0.9), 0 10px 10px -5px rgba(0, 0, 0, 0.7);
}

/* Base Reset & Fonts */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  font-size: 15px;
  min-height: 100vh;
  display: flex;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  color: var(--accent);
}

/* ================================================================
   App Layout Structure (Sidebar + Main Content Canvas)
   ================================================================ */

.app-wrapper {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* ================================================================
   macOS Dock Wave Sidebar & Horizontal Sub-Navbar Architecture
   1. Left Main Rail: Widened 216px, User Role Section Dividers, Outward Wave
   2. Horizontal Sub-Navbar: Rounded tabs hanging below top navbar (per user drawing)
   3. Unified 60px Header Height & Gold Baseline (#D4AF37)
   ================================================================ */

:root {
  --sidebar-width: 216px;
  --header-height: 60px;
  --subnav-height: 82px;
}

/* Edge Hover Sensor (แตะขอบซ้ายสุดเพื่อสไลด์กางเมนู) */
.sidebar-edge-sensor {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 16px;
  z-index: 110;
  cursor: default;
  background: transparent;
}

/* ----------------------------------------------------------------
   1. Left Main Rail (แถบเมนูหลักซ้ายสุด กว้าง 216px พอดีตัวอักษร)
   ---------------------------------------------------------------- */
.app-sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #6B0000 0%, #4E0000 65%, #3B0000 100%);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  height: 100vh;
  z-index: 105;
  border-right: 2px solid #D4AF37; /* ขอบตัดสีทองพรีเมียม */
  box-shadow: 4px 0 22px rgba(0, 0, 0, 0.22);
  transition: transform 0.34s cubic-bezier(0.34, 1.32, 0.64, 1);
  overflow: visible !important; /* สำคัญมาก: ให้เอฟเฟกต์คลื่นลอยพ้นขอบออกมาด้านหน้า */
}

/* ด้ามจับกลางขอบ: ทำให้สถานะเปิด/ปิดของ drawer ชัดเจนและกดได้เสมอ */
.sidebar-drawer-toggle {
  position: absolute;
  top: 50%;
  right: -20px;
  width: 20px;
  height: 68px;
  transform: translateY(-50%);
  border: 1px solid #D4AF37;
  border-left: 0;
  border-radius: 0 18px 18px 0;
  background: linear-gradient(180deg, #8C0000, #5E0000);
  color: #FFFFFF;
  cursor: pointer;
  /* Wave items use z-index: 9999 while magnified; the handle stays above them. */
  z-index: 10000;
  box-shadow: 4px 3px 10px rgba(0, 0, 0, 0.24);
  font-size: 0.82rem;
  line-height: 1;
  padding: 0;
  transition: width 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-drawer-toggle:hover,
.sidebar-drawer-toggle:focus-visible {
  width: 26px;
  background: linear-gradient(180deg, #A30000, #730000);
  box-shadow: 5px 3px 14px rgba(115, 0, 0, 0.42);
  outline: none;
}

.sidebar-edge-sensor::after {
  content: '';
  position: absolute;
  top: 42%;
  bottom: 42%;
  left: 4px;
  width: 3px;
  border-radius: 4px;
  background: rgba(212, 175, 55, 0.75);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.8);
  transition: top 0.2s ease, bottom 0.2s ease;
}

.sidebar-edge-sensor:hover::after {
  top: 36%;
  bottom: 36%;
}

/* 1.1 Brand Header (ความสูงเสมอ Header Bar: 60px ขอบทองระดับ Pixel-Perfect) */
.sidebar-header {
  height: var(--header-height);
  padding: 0 12px;
  background: #4A0000;
  border-bottom: 2px solid #D4AF37;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  box-sizing: border-box;
}

.sidebar-logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-circle-frame {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 2px solid #D4AF37;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.logo-circle-frame:hover {
  transform: scale(1.08);
}

.logo-circle-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

.sidebar-title {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-title h2 {
  font-size: 0.88rem;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.25;
  margin: 0;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.sidebar-badge-sys {
  font-size: 0.64rem;
  color: #FCD34D;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ปุ่ม Pin ตรึงเมนู */
.btn-rail-pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  cursor: pointer;
  font-size: 0.78rem;
  transition: all 0.15s ease;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.btn-rail-pin:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.08);
}

.btn-rail-pin.active {
  background: #D4AF37;
  color: #1B365D;
  border-color: #FFFFFF;
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.7);
}

/* 1.2 Left-Side Smooth Scrollbar (direction: rtl บน Container) */
.dock-wave-container {
  flex: 1;
  direction: rtl; /* ย้าย Scrollbar ไปชิดขอบจอซ้ายสุด */
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  scrollbar-color: transparent transparent;
  padding: 0;
}

.dock-wave-container::-webkit-scrollbar { display: none; width: 0; height: 0; }

.dock-wave-container::-webkit-scrollbar-track {
  background: transparent;
}

.dock-wave-container::-webkit-scrollbar-thumb { background: transparent; }

.dock-wave-inner {
  direction: ltr; /* คืนค่าทิศทางเนื้อหาด้านในเป็นซ้ายไปขวาปกติ */
  padding: 8px 10px 64px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}

/* กลุ่มเมนูเรียงตามระดับสิทธิ์: ผู้ดูแลระบบ → งานแผน → ผู้ใช้งาน */
.sidebar-menu-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-menu-section-admin { order: 1; }
.sidebar-menu-section-planning { order: 2; }
.sidebar-menu-section-users { order: 3; }

/* Highlight the role's main-menu section while its dashboard home is open. */
.sidebar-menu-section.is-role-home {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.sidebar-menu-section.is-role-home > .sidebar-section-home-link {
  border: 1px solid rgba(255, 255, 255, 0.72);
}

/* Section dividers: labels by default; role-home dividers are links. */
.sidebar-section-divider {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 10px 5px;
  margin-top: 4px;
  user-select: none;
}

.sidebar-section-home-link {
  border-radius: 7px;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.16s ease, transform 0.16s ease;
}

.sidebar-section-home-link:hover,
.sidebar-section-home-link:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  outline: none;
  transform: translateX(2px);
}

.sidebar-section-home-link:focus-visible {
  box-shadow: 0 0 0 2px rgba(252, 211, 77, 0.9);
}

.sidebar-section-centered-home,
.sidebar-section-admin-home {
  justify-content: center;
}

.sidebar-section-centered-home .section-title-line,
.sidebar-section-admin-home .section-title-line {
  flex: 1 1 0;
}

.section-title-icon {
  font-size: 0.92rem;
  line-height: 1;
}

.section-title-text {
  font-size: 0.88rem;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.section-title-line {
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.50);
}

/* หมวดงานแผน (สีทอง) */
.sidebar-section-divider.planning .section-title-text {
  color: #FCD34D;
}
.sidebar-section-divider.planning .section-title-line {
  background: rgba(252, 211, 77, 0.4);
}

/* หมวดผู้ดูแลระบบ (สีแดงอ่อน) */
.sidebar-section-divider.admin .section-title-text {
  color: #FCA5A5;
}
.sidebar-section-divider.admin .section-title-line {
  background: rgba(252, 165, 165, 0.4);
}

/* Main navigation items */
.dock-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 8px;
  background: transparent;
  border: 0;
  color: #FFFFFF;
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease;
  text-decoration: none;
}

.dock-item:hover {
  background: rgba(255, 255, 255, 0.10);
}

/* Accordion controls and their in-sidebar child links. */
.sidebar-group-toggle {
  width: 100%;
  text-align: left;
  font: inherit;
}

.sidebar-group-toggle:focus-visible,
.sidebar-submenu-link:focus-visible {
  outline: 2px solid #FCD34D;
  outline-offset: 2px;
}

.sidebar-group-chevron {
  margin-left: auto;
  padding: 2px 4px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  pointer-events: none;
  transition: transform 0.18s ease;
}

.sidebar-group-toggle[aria-expanded="false"] .sidebar-group-chevron {
  transform: rotate(-90deg);
}

.sidebar-submenu {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin: 0 7px 0 39px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: max-height 0.2s ease, opacity 0.15s ease, margin-bottom 0.2s ease;
}

.sidebar-submenu.is-open {
  max-height: 620px;
  opacity: 1;
  margin-bottom: 4px;
}

.sidebar-submenu-link {
  display: block;
  max-width: 100%;
  padding: 8px 10px;
  border-radius: 7px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.82rem;
  line-height: 1.35;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-submenu-link:hover,
.sidebar-submenu-link.active {
  background: rgba(255, 255, 255, 0.16);
  color: #FFFFFF;
}

/* Dock Item Active */
.dock-item.active {
  background: rgba(255, 255, 255, 0.16);
  box-shadow: none;
}

.dock-indicator,
.dock-sublabel,
.dock-count,
.sidebar-badge-sys {
  display: none;
}

/* Keep role markers visible so users know which menu belongs to which duty. */
.dock-badge-plan,
.dock-badge-admin {
  display: none !important;
}

.dock-icon-wrapper {
  width: 26px;
  height: 26px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dock-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.dock-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dock-label {
  font-size: 0.92rem;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.25;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.dock-sublabel {
  font-size: 0.66rem;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.15;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.dock-count {
  background: rgba(0, 0, 0, 0.4);
  color: #FCD34D;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, 0.4);
  flex-shrink: 0;
}

.dock-badge-plan,
.dock-badge-admin {
  font-size: 0.60rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 6px;
  flex-shrink: 0;
}

.dock-badge-plan {
  background: #854D0E;
  color: #FEF08A;
  border: 1px solid #FACC15;
}

.dock-badge-admin {
  background: #991B1B;
  color: #FECACA;
  border: 1px solid #F87171;
}

/* 1.5 Primary Rail Footer */
.sidebar-primary-footer {
  padding: 8px 12px;
  background: #3B0000;
  border-top: 1px solid rgba(212, 175, 55, 0.35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.sidebar-footer-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dock-footer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  transition: transform 0.15s ease, background 0.15s ease;
}

.dock-footer-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.15);
}

.dock-fy-text {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
}

.dock-role-pill {
  background: rgba(255, 255, 255, 0.15);
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
  color: #FFFFFF;
}

/* ----------------------------------------------------------------
   2. Horizontal Sub-Navbar (แถบเมนูย่อยแนวนอนใต้ Navbar หลักตามภาพร่าง)
   ---------------------------------------------------------------- */
.app-subnavbar {
  height: var(--subnav-height);
  background: var(--bg-surface, #FFFFFF);
  border-bottom: 1px solid var(--border); /* ไม่มีเส้นทอง */
  display: flex;
  align-items: flex-start;
  padding: 0 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  position: sticky;
  top: var(--header-height);
  z-index: 85;
  box-sizing: border-box;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.22s ease;
  will-change: transform, opacity;
}

/* ซ่อนกล่องเมนูย่อยเมื่อเลื่อนหน้าจอลง */
.app-subnavbar.subnav-collapsed-up {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

.subnav-container {
  display: flex;
  align-items: center;
  width: 100%;
}

.subnav-tabs-wrapper {
  display: flex;
  align-items: flex-start;
  width: 100%;
  flex: 1;
}

.subnav-tab-pane {
  display: none;
  width: 100%;
}

.subnav-tab-pane.active {
  display: flex;
  width: 100%;
  align-items: flex-start;
  gap: 16px;
}

/* สไตล์แท็บโค้งมนสีแดงห้อยใต้บาร์ ตามภาพร่างของผู้ใช้ (Red Rounded Pills) ขนาดเสมอกันเกลี่ยเต็มความกว้าง */
.subnav-tab {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 64px;
  padding: 16px 24px;
  border-radius: 0 0 18px 18px;
  border: 1.5px solid #730000;
  border-top: none;
  background: #FFFFFF;
  color: #730000;
  font-size: 1.08rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.18s ease;
  box-shadow: 0 2px 5px rgba(115, 0, 0, 0.08);
  text-align: center;
}

.subnav-tab:hover {
  background: #730000;
  color: #FFFFFF;
  transform: translateY(2px);
  box-shadow: 0 4px 10px rgba(115, 0, 0, 0.22);
}

.subnav-tab.active {
  background: #730000;
  color: #FFFFFF;
  font-weight: 700;
  border-color: #730000;
  box-shadow: 0 4px 12px rgba(115, 0, 0, 0.28);
}

.subnav-tab-icon {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.subnav-tab-text {
  min-width: 0;
  max-width: 100%;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ----------------------------------------------------------------
   3. Main Content Area Layout (Workspace)
   ---------------------------------------------------------------- */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Auto-Collapse Rules (เมื่อผู้ใช้ไม่ได้ Pin ไว้) */
.app-sidebar:not(.is-pinned):not(.sidebar-expanded) {
  transform: translateX(calc(-1 * var(--sidebar-width) + 12px)); /* หุบเหลือขอบเรืองแสง 12px */
}

.app-sidebar:not(.is-pinned):not(.sidebar-expanded) ~ .app-main {
  margin-left: 12px;
}

/* Dark Theme Overrides */
[data-theme="dark"] .app-subnavbar {
  background: #18181B;
  border-bottom-color: var(--border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .subnav-tab {
  background: #27272A;
  border-color: rgba(255, 255, 255, 0.2);
  color: #F1F1F1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .subnav-tab:hover,
[data-theme="dark"] .subnav-tab.active {
  background: #730000;
  color: #FFFFFF;
  border-color: #8C0000;
}

/* Top Header Bar (ความสูงเสมอ Sidebar Header: 60px) */
.app-header {
  height: 60px;
  box-sizing: border-box;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

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

/* Brand moved from the sidebar to the main header. */
.header-college-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}

.header-college-brand:hover {
  color: var(--primary-hover);
  text-decoration: none;
}

.header-logo-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 2px solid #D4AF37;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 auto;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
}

.header-logo-circle img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@media (max-width: 540px) {
  .app-header { padding: 0 16px; }
  .header-college-name { font-size: 0.9rem; }
}

/* Navigation History Buttons (Back / Forward) */
.header-nav-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-nav-history {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-main);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s ease;
  user-select: none;
  padding: 0;
  line-height: 1;
}

.btn-nav-history:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--accent);
  border-color: var(--border-strong, #CBD5E1);
  transform: translateY(-1px);
}

.btn-nav-history:active {
  transform: scale(0.95);
}

[data-theme="dark"] .btn-nav-history {
  background: #212121;
  border-color: #383838;
  color: #E2E8F0;
}

[data-theme="dark"] .btn-nav-history:hover {
  background: #2F2F2F;
  border-color: #555555;
  color: #F59E0B;
}

.breadcrumb {
  font-size: 0.88rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.breadcrumb a,
.breadcrumb .breadcrumb-link {
  color: var(--text-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 6px;
  transition: all 0.15s ease;
  max-width: 100%;
}

.breadcrumb a:hover,
.breadcrumb .breadcrumb-link:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--accent);
  text-decoration: none;
}

.breadcrumb-separator {
  color: var(--text-muted);
  opacity: 0.5;
  user-select: none;
  font-size: 0.8rem;
}

.breadcrumb-current {
  color: var(--primary);
  font-weight: 600;
  padding: 3px 6px;
  border-radius: 6px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.breadcrumb-current:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--accent);
  text-decoration: none;
}

/* Breadcrumb Text Ellipsis for Long Titles */
.breadcrumb-label {
  display: inline-block;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

@media (max-width: 768px) {
  .breadcrumb-label {
    max-width: 120px;
  }
}

@media (min-width: 1200px) {
  .breadcrumb-label {
    max-width: 320px;
  }
}

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

/* Header Dropdown Containers */
.header-dropdown-container {
  position: relative;
}

/* Notification Bell Button */
.header-icon-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  color: var(--primary);
}

.header-icon-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.header-badge-count {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #EF4444;
  color: #FFFFFF;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
}

/* User Profile Pill Toggle */
.user-profile-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 5px 14px 5px 8px;
  border-radius: 99px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.user-profile-pill:hover {
  border-color: var(--accent);
  background: #FFFDF9;
  box-shadow: var(--shadow-sm);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #1E4976 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  border: 2px solid var(--accent-light);
}

/* Floating Dropdown Popovers */
.dropdown-popover {
  display: none;
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  z-index: 1000;
  overflow: hidden;
  animation: popoverFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.dropdown-popover.show {
  display: block;
}

@keyframes popoverFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }

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

/* Notification Popover Card */
.notif-popover-card {
  width: 400px;
}

.popover-header {
  padding: 14px 18px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}

#notif-badge-in-popover {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  white-space: nowrap !important;
  line-height: 1.2 !important;
  padding: 3px 9px !important;
  border-radius: 99px !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  background: #FEF3C7 !important;
  color: #B45309 !important;
  border: 1px solid #FDE68A !important;
  flex-shrink: 0 !important;
  text-align: center !important;
}

.btn-mark-all-read {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.btn-mark-all-read:hover {
  background: rgba(14, 42, 71, 0.08);
  color: var(--accent);
}

.notif-list-scrollable {
  max-height: 350px;
  overflow-y: auto;
  overflow-x: hidden;
}

.notif-item {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  transition: all 0.15s ease;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  max-width: 100%;
  box-sizing: border-box;
}

.notif-item:hover {
  background: #F8FAFC;
}

.notif-item.unread {
  background: #F0F7FF;
  border-left: 3px solid var(--accent);
}

.notif-item.unread:hover {
  background: #E0EFFF;
}

.unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  box-shadow: 0 0 6px rgba(217, 119, 6, 0.6);
  flex-shrink: 0;
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item-icon {
  font-size: 1.3rem;
  line-height: 1;
  padding-top: 2px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notif-item-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

.notif-item-content {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.notif-item-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.notif-item-desc {
  font-size: 0.78rem;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
}

.notif-item-comment {
  font-size: 0.75rem;
  color: #B45309;
  background: #FEF3C7;
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
}

.notif-item-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Global Text Ellipsis Single-Line Utility with Hover Support */
.text-ellipsis-single {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  display: block;
  max-width: 100%;
  cursor: default;
}

.text-ellipsis-single a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

.text-ellipsis-single a:hover {
  color: #0284C7 !important;
  text-decoration: underline;
}

/* Modal Windows */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  max-width: 580px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  overflow: hidden;
  animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }

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

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

.modal-body {
  padding: 24px;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Custom Scrollbar for Modal Text Boxes */
.modal-body *::-webkit-scrollbar {
  width: 6px;
}

.modal-body *::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 99px;
}

.modal-body *::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 99px;
}

.modal-body *::-webkit-scrollbar-thumb:hover {
  background: var(--accent-hover);
}

.modal-footer {
  padding: 16px 24px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-close-modal:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--danger);
}

/* Timeline & Submission Deadline Banner (Warm Amber / Gold Theme) */
.timeline-banner {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 2px solid #F59E0B;
  border-left: 6px solid #D97706;
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 4px 16px rgba(217, 119, 6, 0.14);
  color: #78350F;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
  cursor: pointer;
}

.timeline-banner:hover {
  box-shadow: 0 6px 20px rgba(217, 119, 6, 0.22);
  border-color: #D97706;
  transform: translateY(-1px);
}

.timeline-content-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.timeline-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #FFFFFF;
  border: 1.5px solid #FDE68A;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
}

.timeline-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #78350F;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.timeline-desc {
  font-size: 0.85rem;
  color: #451A03;
  line-height: 1.45;
}

.timeline-meta {
  color: #78350F;
  font-size: 0.78rem;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.timeline-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Slider Navigation Container & Buttons */
.timeline-slider-nav {
  display: inline-flex;
  align-items: center;
  background: #FFFFFF;
  border: 1.5px solid #FDE68A;
  border-radius: 8px;
  padding: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.btn-timeline-slider {
  border: none;
  background: transparent;
  padding: 4px 10px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  color: #92400E;
  border-radius: 6px;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
}

.btn-timeline-slider:hover {
  background: #FEF3C7;
  color: #78350F;
}

/* Timeline Action Buttons */
.btn-timeline-overall {
  white-space: nowrap;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FCD34D;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.btn-timeline-overall:hover {
  background: #FDE68A;
  color: #78350F;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.2);
}

.btn-timeline-detail {
  white-space: nowrap;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #EFF6FF;
  color: #1E40AF;
  border: 1px solid #BFDBFE;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.btn-timeline-detail:hover {
  background: #DBEAFE;
  color: #1E3A8A;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.15);
}

/* Timeline Badges */
.timeline-badge-info {
  background: #DBEAFE;
  color: #1E40AF;
  border: 1px solid #93C5FD;
}

.timeline-badge-warning {
  background: #FEF9C3;
  color: #854D0E;
  border: 1px solid #FDE047;
}

.timeline-badge-success {
  background: #DCFCE7;
  color: #166534;
  border: 1px solid #86EFAC;
}

.timeline-badge-danger {
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #FCA5A5;
}

.timeline-badge-primary {
  background: #E0E7FF;
  color: #3730A3;
  border: 1px solid #A5B4FC;
}

.timeline-slider-counter {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FCD34D;
  font-weight: 700;
}

/* Overall Modal Cards */
.overall-card-item {
  background: var(--bg-surface, #FFFFFF);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  border-left: 5px solid #F59E0B;
}

.overall-desc-box {
  font-size: 0.90rem;
  line-height: 1.6;
  color: var(--text-main);
  margin-bottom: 12px;
  white-space: pre-wrap;
  background: var(--bg-subtle, #F8FAFC);
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.timeline-detail-desc-box {
  background: var(--bg-surface, #FFFDF9);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  padding: 16px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text-main);
  margin-bottom: 18px;
  max-height: 250px;
  overflow-y: auto;
  overflow-x: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.timeline-detail-meta-box {
  background: var(--bg-subtle, #F8FAFC);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Announcement colours follow the configured status colour in every view. */
.timeline-banner.timeline-color-info { --timeline-bg-start: #EFF6FF; --timeline-bg-end: #DBEAFE; --timeline-border: #3B82F6; --timeline-accent: #2563EB; --timeline-title-color: #1E3A8A; --timeline-text-color: #1E40AF; }
.timeline-banner.timeline-color-warning { --timeline-bg-start: #FFFBEB; --timeline-bg-end: #FEF3C7; --timeline-border: #F59E0B; --timeline-accent: #D97706; --timeline-title-color: #78350F; --timeline-text-color: #92400E; }
.timeline-banner.timeline-color-danger { --timeline-bg-start: #FEF2F2; --timeline-bg-end: #FEE2E2; --timeline-border: #EF4444; --timeline-accent: #DC2626; --timeline-title-color: #7F1D1D; --timeline-text-color: #991B1B; }
.timeline-banner.timeline-color-success { --timeline-bg-start: #F0FDF4; --timeline-bg-end: #DCFCE7; --timeline-border: #22C55E; --timeline-accent: #16A34A; --timeline-title-color: #14532D; --timeline-text-color: #166534; }
.timeline-banner.timeline-color-primary { --timeline-bg-start: #EEF2FF; --timeline-bg-end: #E0E7FF; --timeline-border: #4F46E5; --timeline-accent: #3730A3; --timeline-title-color: #312E81; --timeline-text-color: #3730A3; }
.timeline-banner.timeline-color-info, .timeline-banner.timeline-color-warning, .timeline-banner.timeline-color-danger, .timeline-banner.timeline-color-success, .timeline-banner.timeline-color-primary { background: linear-gradient(135deg, var(--timeline-bg-start), var(--timeline-bg-end)); border-color: var(--timeline-border); border-left-color: var(--timeline-accent); color: var(--timeline-text-color); }
.timeline-banner.timeline-color-info:hover, .timeline-banner.timeline-color-warning:hover, .timeline-banner.timeline-color-danger:hover, .timeline-banner.timeline-color-success:hover, .timeline-banner.timeline-color-primary:hover { border-color: var(--timeline-accent); }
.timeline-banner.timeline-color-info .timeline-title, .timeline-banner.timeline-color-warning .timeline-title, .timeline-banner.timeline-color-danger .timeline-title, .timeline-banner.timeline-color-success .timeline-title, .timeline-banner.timeline-color-primary .timeline-title { color: var(--timeline-title-color); }
.timeline-banner.timeline-color-info .timeline-desc, .timeline-banner.timeline-color-warning .timeline-desc, .timeline-banner.timeline-color-danger .timeline-desc, .timeline-banner.timeline-color-success .timeline-desc, .timeline-banner.timeline-color-primary .timeline-desc, .timeline-banner.timeline-color-info .timeline-meta, .timeline-banner.timeline-color-warning .timeline-meta, .timeline-banner.timeline-color-danger .timeline-meta, .timeline-banner.timeline-color-success .timeline-meta, .timeline-banner.timeline-color-primary .timeline-meta { color: var(--timeline-text-color); }
.timeline-banner .timeline-meta i, .overall-card-item i, .timeline-detail-meta-box i, .timeline-contact-box i, .timeline-modal-icon { width: 1em; height: 1em; vertical-align: -0.14em; margin-right: .2em; }
.timeline-icon-box .lucide { width: 22px; height: 22px; color: var(--timeline-accent, #D97706); }
.timeline-remain-urgent { color: #B91C1C; font-weight: 700; }
.timeline-remain-ended { color: var(--text-muted); font-weight: 600; }
.timeline-modal-icon { width: 26px; height: 26px; color: var(--primary); }
.overall-card-title, .overall-card-desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overall-card-title { font-size: 1.05rem; font-weight: 700; color: var(--primary); margin: 0 0 8px; line-height: 1.4; }
.overall-card-desc { white-space: nowrap; }
.overall-card-item.timeline-color-info { border-left-color: #2563EB; }
.overall-card-item.timeline-color-warning { border-left-color: #D97706; }
.overall-card-item.timeline-color-danger { border-left-color: #DC2626; }
.overall-card-item.timeline-color-success { border-left-color: #16A34A; }
.overall-card-item.timeline-color-primary { border-left-color: #3730A3; }
.timeline-detail-section > h4, .timeline-contact-box > h4 { color: var(--primary); font-size: .86rem; margin: 0 0 7px; font-weight: 700; }
.timeline-detail-section .timeline-detail-desc-box { margin-bottom: 16px; }
.timeline-detail-meta-box #modal-timeline-dates { display: grid; grid-template-columns: auto 1fr; column-gap: 7px; row-gap: 2px; }
.timeline-detail-meta-box #modal-timeline-dates b, .timeline-detail-meta-box #modal-timeline-dates span { grid-column: 2; }
.timeline-contact-box { background: var(--bg-subtle, #F8FAFC); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; color: var(--text-muted); font-size: .84rem; line-height: 1.65; }
.approved-project-filter { width: 100%; justify-content: space-between; }
.approved-project-filter .dashboard-year-control-group { margin-right: auto; }
.approved-project-filter #approved-project-status { margin-left: auto; width: auto; min-width: 165px; }

[data-theme="dark"] .timeline-banner.timeline-color-info { --timeline-bg-start: #0C2442; --timeline-bg-end: #111827; --timeline-border: #60A5FA; --timeline-accent: #93C5FD; --timeline-title-color: #DBEAFE; --timeline-text-color: #BFDBFE; }
[data-theme="dark"] .timeline-banner.timeline-color-warning { --timeline-bg-start: #422006; --timeline-bg-end: #211807; --timeline-border: #FBBF24; --timeline-accent: #FDE68A; --timeline-title-color: #FFFBEB; --timeline-text-color: #FDE68A; }
[data-theme="dark"] .timeline-banner.timeline-color-danger { --timeline-bg-start: #450A0A; --timeline-bg-end: #240B0B; --timeline-border: #F87171; --timeline-accent: #FCA5A5; --timeline-title-color: #FEF2F2; --timeline-text-color: #FECACA; }
[data-theme="dark"] .timeline-banner.timeline-color-success { --timeline-bg-start: #052E16; --timeline-bg-end: #0B2015; --timeline-border: #4ADE80; --timeline-accent: #86EFAC; --timeline-title-color: #F0FDF4; --timeline-text-color: #BBF7D0; }
[data-theme="dark"] .timeline-banner.timeline-color-primary { --timeline-bg-start: #172554; --timeline-bg-end: #111827; --timeline-border: #818CF8; --timeline-accent: #C7D2FE; --timeline-title-color: #EEF2FF; --timeline-text-color: #C7D2FE; }
[data-theme="dark"] .timeline-banner.timeline-color-info, [data-theme="dark"] .timeline-banner.timeline-color-warning, [data-theme="dark"] .timeline-banner.timeline-color-danger, [data-theme="dark"] .timeline-banner.timeline-color-success, [data-theme="dark"] .timeline-banner.timeline-color-primary { background: linear-gradient(135deg, var(--timeline-bg-start), var(--timeline-bg-end)) !important; border-color: var(--timeline-border) !important; border-left-color: var(--timeline-accent) !important; }
[data-theme="dark"] .timeline-banner.timeline-color-info .timeline-title, [data-theme="dark"] .timeline-banner.timeline-color-warning .timeline-title, [data-theme="dark"] .timeline-banner.timeline-color-danger .timeline-title, [data-theme="dark"] .timeline-banner.timeline-color-success .timeline-title, [data-theme="dark"] .timeline-banner.timeline-color-primary .timeline-title { color: var(--timeline-title-color) !important; }
[data-theme="dark"] .timeline-banner.timeline-color-info .timeline-desc, [data-theme="dark"] .timeline-banner.timeline-color-warning .timeline-desc, [data-theme="dark"] .timeline-banner.timeline-color-danger .timeline-desc, [data-theme="dark"] .timeline-banner.timeline-color-success .timeline-desc, [data-theme="dark"] .timeline-banner.timeline-color-primary .timeline-desc, [data-theme="dark"] .timeline-banner.timeline-color-info .timeline-meta, [data-theme="dark"] .timeline-banner.timeline-color-warning .timeline-meta, [data-theme="dark"] .timeline-banner.timeline-color-danger .timeline-meta, [data-theme="dark"] .timeline-banner.timeline-color-success .timeline-meta, [data-theme="dark"] .timeline-banner.timeline-color-primary .timeline-meta { color: var(--timeline-text-color) !important; }

/* Compact, baseline-aligned announcement controls and icons. */
.timeline-meta { align-items: baseline; gap: 9px; line-height: 1.35; }
.timeline-meta > span, #slider-timeline-remain, #modal-timeline-remain { display: inline-flex; align-items: baseline; gap: 3px; white-space: nowrap; }
.timeline-meta .lucide { width: .9em; height: .9em; flex: 0 0 auto; vertical-align: -.08em; stroke-width: 2; }
.timeline-actions { display: grid; grid-template-columns: auto auto; align-items: center; column-gap: 8px; row-gap: 0; }
.timeline-primary-actions { display: flex; flex-direction: column; align-items: stretch; gap: 5px; }
.timeline-slider-nav { padding: 1px; border-radius: 7px; }
.btn-timeline-slider { min-width: 28px; min-height: 28px; padding: 3px 6px; }
.btn-timeline-slider .lucide { width: 14px; height: 14px; stroke-width: 2.1; }
.btn-timeline-overall, .btn-timeline-detail { min-height: 29px; padding: 5px 10px; gap: 5px; font-size: .78rem; line-height: 1.1; justify-content: center; }
.btn-timeline-overall .lucide, .btn-timeline-detail .lucide { width: 14px; height: 14px; flex: 0 0 auto; stroke-width: 2; }
.timeline-modal-icon { width: 21px; height: 21px; margin-right: 0; stroke-width: 2; }
#modal-timeline-remain { font-size: .82rem; line-height: 1.25; }
#modal-timeline-remain .lucide { width: 13px; height: 13px; flex: 0 0 auto; stroke-width: 2; }
.timeline-detail-meta-box #modal-timeline-dates .lucide { width: 14px; height: 14px; margin-top: 2px; stroke-width: 2; }
.timeline-contact-box > h4 { display: inline-flex; align-items: center; gap: 5px; }
.timeline-contact-box > h4 .lucide { width: 16px; height: 16px; margin: 0; flex: 0 0 auto; stroke-width: 2; }
.timeline-inline-icon { width: 13px; height: 13px; flex: 0 0 auto; vertical-align: -.11em; margin-right: 4px; stroke: currentColor; }
#modal-timeline-remain .timeline-inline-icon { width: 13px; height: 13px; }
.timeline-detail-meta-box #modal-timeline-dates .timeline-inline-icon { width: 14px; height: 14px; margin: 2px 0 0; }
.timeline-contact-box > h4 .timeline-inline-icon { width: 16px; height: 16px; margin: 0; }
.overall-card-item .lucide { width: 13px; height: 13px; vertical-align: -.1em; margin-right: 3px; stroke-width: 2; }
.overall-card-item .btn .lucide { width: 13px; height: 13px; margin: 0; }
@media (max-width: 700px) {
  .timeline-actions { width: 100%; grid-template-columns: auto 1fr; }
  .timeline-primary-actions { width: 100%; }
  .btn-timeline-overall, .btn-timeline-detail { width: 100%; }
}
[data-theme="dark"] .timeline-contact-box { background: #272727; border-color: #383838; color: #CBD5E1; }
[data-theme="dark"] .timeline-contact-box > h4 { color: #F1F5F9; }
[data-theme="dark"] .timeline-remain-urgent { color: #FCA5A5; }
@media (max-width: 640px) { .approved-project-filter { align-items: stretch; } .approved-project-filter .dashboard-year-control-group, .approved-project-filter #approved-project-status { width: 100%; margin-left: 0; } }

.popover-footer {
  padding: 10px 16px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  text-align: center;
}

.btn-popover-full {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.btn-popover-full:hover {
  background: rgba(14, 42, 71, 0.08);
  color: var(--accent-hover);
}

/* User Profile Menu Popover Card */
.user-menu-popover-card {
  width: 290px;
}

.user-popover-profile-section {
  padding: 24px 20px 18px;
  text-align: center;
  background: linear-gradient(180deg, #F8FAFC 0%, #FFFFFF 100%);
}

.user-popover-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #D97706 0%, #F59E0B 100%);
  color: #FFFFFF;
  font-size: 1.8rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
  border: 3px solid #FFFFFF;
}

.user-popover-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.user-popover-badge {
  display: inline-block;
  background: #FEF3C7;
  color: #92400E;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 99px;
  margin-bottom: 10px;
  border: 1px solid #FCD34D;
  letter-spacing: 0.5px;
}

.user-popover-badge.badge-role-super_admin {
  background: #FEE2E2;
  color: #991B1B;
  border-color: #FCA5A5;
}

.user-popover-badge.badge-role-admin {
  background: #FEF3C7;
  color: #92400E;
  border-color: #FCD34D;
}

.user-popover-badge.badge-role-user {
  background: #DBEAFE;
  color: #1E40AF;
  border-color: #93C5FD;
}

.user-popover-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

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

/* 2 Action Buttons */
.user-popover-actions {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #FFFFFF;
}

.btn-user-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.btn-user-profile {
  background: var(--bg-subtle);
  color: var(--primary);
  border-color: var(--border);
}

.btn-user-profile:hover {
  background: #FEF3C7;
  border-color: var(--accent);
  color: #92400E;
}

.btn-user-logout {
  background: #FEE2E2;
  color: #991B1B;
  border-color: #FCA5A5;
}

.btn-user-logout:hover {
  background: #EF4444;
  color: #FFFFFF;
  border-color: #EF4444;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

/* Main Container Body */
.app-content {
  flex: 1;
  padding: 28px;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
}

/* ================================================================
   UI Components (Cards, Buttons, Tables, Badges)
   ================================================================ */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 24px;
}

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

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Stat Cards Grid */
.dashboard-project-overview {
  background: #FFFFFF;
  border: 1px solid #DDE7F0;
  border-top: 3px solid #2F80ED;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.dashboard-project-overview[aria-busy="true"] {
  opacity: .72;
}

.dashboard-year-ajax-status {
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}

.dashboard-year-control-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sidebar-floating-home-button {
  position: fixed;
  left: 24px;
  bottom: 144px;
  z-index: 10004;
  min-width: 168px;
  min-height: 52px;
  padding: 11px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 2px solid #d4af37;
  border-radius: 12px;
  background: #fff;
  color: #5e0000;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 800;
  white-space: nowrap;
  transition: bottom 0.2s ease, background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

/* เมื่อ Sidebar เปิด ให้ปุ่มเลื่อนไปพ้นแถบเมนู; เมื่อพับจะกลับมาชิดซ้าย */
body:has(.app-sidebar.is-pinned) .sidebar-floating-home-button {
  left: calc(var(--sidebar-width) + 24px);
}

.sidebar-floating-home-button svg {
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
}

.sidebar-floating-back-button {
  position: fixed;
  left: 24px;
  bottom: 82px;
  z-index: 10004;
  width: 168px;
  min-width: 168px;
  min-height: 52px;
  padding: 10px 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 2px solid #d4af37;
  border-radius: 12px;
  background: #fff;
  color: #5e0000;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  transition: bottom 0.2s ease, background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

body:has(.app-sidebar.is-pinned) .sidebar-floating-back-button {
  left: calc(var(--sidebar-width) + 24px);
}

.sidebar-floating-back-button svg {
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
}

.sidebar-floating-home-button:hover,
.sidebar-floating-home-button:focus-visible {
  background: #fef3c7;
  color: #730000;
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(115, 0, 0, 0.3);
  outline: none;
}

.sidebar-floating-back-button:hover,
.sidebar-floating-back-button:focus-visible {
  background: #fef3c7;
  color: #730000;
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(115, 0, 0, 0.3);
  outline: none;
}

/* ปุ่มลอยต้องคงความต่างสีในโหมดกลางคืน ไม่ให้กลืนกับพื้นหลังหน้า */
[data-theme="dark"] .sidebar-floating-home-button {
  background: #1d2b44;
  border-color: #f2c94c;
  color: #fff3b0;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.48);
}

[data-theme="dark"] .sidebar-floating-back-button {
  background: #1d2b44;
  border-color: #f2c94c;
  color: #fff3b0;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.48);
}

[data-theme="dark"] .sidebar-floating-home-button:hover,
[data-theme="dark"] .sidebar-floating-home-button:focus-visible {
  background: #2b4267;
  color: #ffffff;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .sidebar-floating-back-button:hover,
[data-theme="dark"] .sidebar-floating-back-button:focus-visible {
  background: #2b4267;
  color: #ffffff;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.6);
}

/* เก็บชื่อเดิมไว้เฉพาะกรณีมี markup เก่าจาก cache/partial */
.sidebar-home-button {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 52px;
  z-index: 10001;
  min-height: 36px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(212, 175, 55, 0.75);
  border-radius: 8px;
  background: #fff;
  color: #5e0000;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  transition: bottom 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.sidebar-home-button svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

.sidebar-home-button:hover,
.sidebar-home-button:focus-visible {
  background: #fef3c7;
  color: #730000;
  transform: translateY(-1px);
  outline: none;
}

@media (max-height: 620px) {
  .sidebar-floating-home-button {
    bottom: 110px;
  }
  .sidebar-floating-back-button {
    bottom: 48px;
  }
}

@media (max-width: 1024px) {
  body:has(.app-sidebar.is-pinned) .sidebar-floating-home-button,
  .sidebar-floating-home-button {
    left: 24px;
    bottom: 140px;
  }

  body:has(.app-sidebar.is-pinned) .sidebar-floating-back-button,
  .sidebar-floating-back-button {
    left: 24px;
    bottom: 78px;
  }

  .sidebar-home-button {
    bottom: 52px;
  }
}

/* Global floating scroll-to-top control and tooltip.  Kept here because both
   are emitted by the shared footer on every authenticated page. */
.btn-scroll-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10005;
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #1558b0;
  border-radius: 50%;
  background: #1f6fd1;
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(16, 74, 150, 0.35);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.18s ease, visibility 0.18s ease, transform 0.18s ease, background-color 0.18s ease;
}

.btn-scroll-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.btn-scroll-top:hover,
.btn-scroll-top:focus-visible {
  background: #1558b0;
  transform: translateY(-2px);
  outline: 3px solid rgba(59, 130, 246, 0.35);
  outline-offset: 2px;
}

.btn-scroll-top svg {
  width: 22px;
  height: 22px;
}

.instant-tooltip {
  position: fixed;
  z-index: 10006;
  display: none;
  max-width: calc(100vw - 20px);
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  background: #172033;
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
  overflow-wrap: normal;
  pointer-events: none;
}

.instant-tooltip.show {
  display: block;
}

.instant-tooltip.tooltip-bottom::after,
.instant-tooltip::after {
  content: '';
  position: absolute;
  left: 50%;
  width: 0;
  height: 0;
  margin-left: -5px;
  border: 5px solid transparent;
}

.instant-tooltip::after {
  bottom: -10px;
  border-top-color: #172033;
}

.instant-tooltip.tooltip-bottom::after {
  top: -10px;
  bottom: auto;
  border-top-color: transparent;
  border-bottom-color: #172033;
}

[data-theme="dark"] .btn-scroll-top {
  border-color: #5ba6ff;
  background: #174c88;
  box-shadow: 0 7px 20px rgba(0, 0, 0, 0.52);
}

[data-theme="dark"] .btn-scroll-top:hover,
[data-theme="dark"] .btn-scroll-top:focus-visible {
  background: #236fc4;
}

[data-theme="dark"] .instant-tooltip {
  border-color: #4b6388;
  background: #e8f0ff;
  color: #10213d;
}

[data-theme="dark"] .instant-tooltip::after {
  border-top-color: #e8f0ff;
}

[data-theme="dark"] .instant-tooltip.tooltip-bottom::after {
  border-top-color: transparent;
  border-bottom-color: #e8f0ff;
}

@media (max-width: 640px) {
  .btn-scroll-top {
    right: 16px;
    bottom: 16px;
  }
}

.dashboard-summary-panel {
  padding: 18px;
}

.dashboard-project-list-card {
  background: transparent;
  border: 0;
  border-top: 1px solid #DDE7F0;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  padding: 22px 18px 18px;
}

.dashboard-summary-heading {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 2px 14px;
}

.dashboard-summary-heading h2 {
  margin: 0;
  color: var(--text-main);
  font-size: 0.92rem;
}

.dashboard-summary-status {
  display: flex;
  align-items: center;
  gap: 9px;
}

.dashboard-scope-switch,
.dashboard-view-switch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid #D9E4F1;
  border-radius: 999px;
  background: var(--bg-surface, #FFF);
}

.dashboard-scope-switch-link,
.dashboard-view-switch-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 5px 12px;
  border-radius: 999px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
  transition: color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.dashboard-scope-switch-link:hover,
.dashboard-view-switch-link:hover { color: var(--primary); background: var(--bg-subtle, #F1F5F9); }
.dashboard-scope-switch-link.is-active,
.dashboard-view-switch-link.is-active { color: #FFF; background: var(--primary, #1B365D); box-shadow: 0 2px 6px rgba(14, 42, 71, .2); }

.approved-project-filter { display: flex; align-items: center; gap: 9px; }
.approved-project-filter label { color: var(--text-muted); font-size: .82rem; font-weight: 600; white-space: nowrap; }
.approved-project-filter .form-control { width: auto; min-width: 150px; }
.approved-project-table-wrap { width: 100%; }
.approved-project-table { min-width: 760px; }
.approved-project-table th { text-align: center; }
.approved-project-title-cell { max-width: 520px; }
.approved-project-title-cell strong { display: block; color: var(--text-main); font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.approved-project-title-cell small { display: block; margin-top: 3px; color: var(--text-muted); font-size: .76rem; }
.approved-project-budget { color: var(--primary); font-weight: 700; text-align: right; white-space: nowrap; }
.approved-project-status-cell, .approved-project-action-cell { text-align: center; white-space: nowrap; }
.approved-project-status { display: inline-flex; align-items: center; justify-content: center; min-width: 92px; padding: 5px 10px; border-radius: 6px; font-size: .78rem; font-weight: 700; }
.approved-project-status.is-proposed { color: #047857; background: #D1FAE5; }
.approved-project-status.is-unproposed { color: #92400E; background: #FEF3C7; }
.approved-project-status.is-draft { color: #475569; background: #E2E8F0; }
.approved-project-status.is-pending { color: #92400E; background: #FEF3C7; }
.approved-project-action-empty { display: inline-block; min-width: 1px; min-height: 1px; }
.approved-project-empty { padding: 48px !important; color: var(--text-muted); text-align: center; }

[data-theme="dark"] .dashboard-scope-switch,
[data-theme="dark"] .dashboard-view-switch { border-color: #404040; background: #242424; }
[data-theme="dark"] .dashboard-scope-switch-link,
[data-theme="dark"] .dashboard-view-switch-link { color: #CBD5E1; }
[data-theme="dark"] .dashboard-scope-switch-link:hover,
[data-theme="dark"] .dashboard-view-switch-link:hover { color: #FFF; background: #383838; }
[data-theme="dark"] .dashboard-scope-switch-link.is-active,
[data-theme="dark"] .dashboard-view-switch-link.is-active { color: #FFF; background: #1D4ED8; }
[data-theme="dark"] .approved-project-title-cell strong { color: #F1F5F9; }
[data-theme="dark"] .approved-project-status.is-proposed { color: #BBF7D0; background: #14532D; }
[data-theme="dark"] .approved-project-status.is-unproposed { color: #FDE68A; background: #713F12; }
[data-theme="dark"] .approved-project-status.is-draft { color: #CBD5E1; background: #334155; }
[data-theme="dark"] .approved-project-status.is-pending { color: #FDE68A; background: #713F12; }

/* The role home only highlights the menu item; it must not add a grey halo. */
.sidebar-menu-section.is-role-home .dock-item,
.sidebar-menu-section.is-role-home .dock-item.active {
  box-shadow: none;
}

.dashboard-summary-year {
  background: #FFFFFF;
  border: 1px solid #D9E4F1;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 6px 10px;
  white-space: nowrap;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.dashboard-stat-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 0;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-stat-grid .stat-card {
  min-width: 0;
  padding: 12px;
  display: block;
}

.dashboard-stat-grid .stat-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.dashboard-stat-grid .stat-label {
  margin-top: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-stat-grid .stat-icon {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
}

.dashboard-stat-grid .stat-val {
  margin-top: 6px;
}

.dashboard-message-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 8px;
  background: #e2e8f0;
  color: #1e293b;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.archive-page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding: 0 2px;
}

.archive-page-heading h1 {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 1.4rem;
  font-weight: 700;
}

.archive-page-heading p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* คลังโครงการ: ให้หัวข้อ/คำอธิบายอยู่ในกรอบเดียวกับสถานะ
   และให้ปุ่มรายงานกับตัวกรองปีเริ่มจากฝั่งซ้ายของกรอบรายการ */
.archive-page-heading-in-panel {
  margin: 0;
  padding: 0;
}

.dashboard-summary-heading-archive {
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 14px;
}

.dashboard-summary-heading-list {
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 14px;
}

.dashboard-list-summary-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.dashboard-list-summary-heading h2 {
  margin: 0;
  color: var(--primary);
  font-size: 1.15rem;
  font-weight: 700;
}

.dashboard-list-summary-heading span {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 400;
}

.dashboard-summary-heading-archive .archive-page-heading h1 {
  font-size: 1.25rem;
  margin-bottom: 3px;
}

.dashboard-summary-heading-archive .archive-page-heading p {
  font-size: 0.82rem;
}

.dashboard-archive-list-header #archive-search-form {
  width: 100%;
  justify-content: space-between;
}

.archive-search-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.dashboard-archive-list-header {
  justify-content: flex-start;
}

.dashboard-main-list-header {
  justify-content: flex-start;
}

.dashboard-main-list-header form {
  width: 100%;
  justify-content: space-between;
}

.dashboard-search-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

@media (max-width: 640px) {
  .archive-page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-summary-heading-archive {
    align-items: flex-start;
    gap: 8px;
  }

  .dashboard-summary-heading-list {
    align-items: flex-start;
    gap: 8px;
  }

  .dashboard-summary-heading-list .dashboard-summary-status {
    align-self: flex-start;
  }

  .dashboard-scope-switch,
  .dashboard-view-switch { max-width: calc(100vw - 60px); }
  .dashboard-scope-switch-link,
  .dashboard-view-switch-link { padding: 5px 9px; font-size: .73rem; }
  .approved-project-filter { width: 100%; }

  .dashboard-summary-heading-archive .dashboard-summary-status {
    align-self: flex-end;
  }

  .dashboard-archive-list-header #archive-search-form,
  .archive-search-controls {
    justify-content: flex-start;
    margin-left: 0;
  }

  .dashboard-main-list-header form,
  .dashboard-search-controls {
    justify-content: flex-start;
    margin-left: 0;
  }

  .dashboard-year-control-group {
    flex-wrap: wrap;
  }

  .dashboard-year-ajax-status {
    white-space: normal;
  }
}

.dashboard-message-box-wrap {
  flex: 0 0 auto;
  margin-left: auto;
  text-align: right;
}

.dashboard-message-box:hover,
.dashboard-message-box:focus-visible {
  background: #f1f5f9;
  color: #0f172a;
  transform: translateY(-1px);
}

.dashboard-message-box-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  line-height: 1;
}

@media (max-width: 640px) {
  .dashboard-message-box-wrap {
    margin-left: 0;
    text-align: left;
  }

  .dashboard-message-box {
    font-size: 0.84rem;
  }
}

.stat-card-executing {
  border-color: #B9DEF4;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 38px;
}

.stat-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stat-val {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.stat-hint {
  color: #64748B;
  font-size: 0.64rem;
  margin-top: 3px;
}

@media (max-width: 1180px) {
  .dashboard-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .dashboard-summary-panel,
  .dashboard-project-list-card {
    padding: 14px;
  }

  .dashboard-summary-heading {
    align-items: flex-end;
  }

  .dashboard-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary,
a.btn-primary,
button.btn-primary {
  background: var(--primary);
  color: #FFFFFF !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:visited,
a.btn-primary:hover,
a.btn-primary:focus,
a.btn-primary:visited,
button.btn-primary:hover,
button.btn-primary:focus {
  background: var(--primary-hover);
  color: #FFFFFF !important;
}

a.btn,
a.btn-tbl-action,
a.btn-action,
a.btn:visited,
a.btn-tbl-action:visited,
a.btn-action:visited {
  text-decoration: none !important;
}

a.btn-track,
a.btn-track:visited,
a.btn-primary,
a.btn-primary:visited,
a.btn-navy,
a.btn-navy:visited,
a.btn-forward,
a.btn-forward:visited,
a.btn-studio,
a.btn-studio:visited,
a.btn-report,
a.btn-report:visited,
a.btn-gold,
a.btn-gold:visited,
a.btn-approve,
a.btn-approve:visited,
a.btn-edit,
a.btn-edit:visited,
a.btn-danger,
a.btn-danger:visited,
a.btn-search,
a.btn-search:visited {
  color: #FFFFFF !important;
}

.btn-edit {
  background: #1B365D !important;
  color: #FFFFFF !important;
  border-color: #12243F !important;
}

.btn-edit:hover {
  background: #12243F !important;
  border-color: #0A1526 !important;
  color: #FFFFFF !important;
}

/* Table Action Buttons System — Max 3 Buttons Per Row (เกิน 3 ปุ่มจะตัดขึ้นแถวใหม่ลงมาข้างล่าง) */
.btn-action-group {
  display: inline-grid !important;
  grid-template-columns: repeat(3, auto) !important;
  gap: 6px !important;
  align-items: center !important;
  justify-content: start !important;
  vertical-align: middle !important;
  width: fit-content !important;
}

.btn-tbl-action {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 33px !important;
  min-height: 33px !important;
  max-height: 33px !important;
  padding: 0 11px !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
  text-decoration: none !important;
  line-height: 1 !important;
  flex-shrink: 0 !important;
  cursor: pointer;
  border: 1px solid transparent;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.15s ease-in-out;
}

/* 1. ปุ่ม A4 (ดู/พิมพ์เอกสาร A4) */
.btn-a4,
a.btn-a4,
button.btn-a4 {
  background: #EEF2F6 !important;
  color: #1E293B !important;
  border: 1.5px solid #94A3B8 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08) !important;
  font-size: 1.05rem !important;
  line-height: 1 !important;
}

.btn-a4:hover,
a.btn-a4:hover,
button.btn-a4:hover {
  background: #E2E8F0 !important;
  border-color: #64748B !important;
  color: #0F172A !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12) !important;
  transform: translateY(-1px);
}

/* 2. ปุ่ม ติดตาม (ศูนย์ติดตามความก้าวหน้าโครงการ) - สีฟ้าสดใส Sky Blue ชัดเจน ไม่ทับซ้อนกับปุ่มแก้ไข */
.btn-review,
a.btn-review,
button.btn-review {
  background: #EEF2F6 !important;
  color: #1E293B !important;
  border: 1px solid #94A3B8 !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  line-height: 1 !important;
}

.btn-review:hover,
a.btn-review:hover,
button.btn-review:hover {
  background: #E2E8F0 !important;
  border-color: #64748B !important;
  color: #0F172A !important;
}

.btn-track {
  background: #0284C7 !important;
  color: #FFFFFF !important;
  border: 1px solid #0369A1 !important;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.25);
}

.btn-track:hover {
  background: #0369A1 !important;
  border-color: #075985 !important;
  color: #FFFFFF !important;
  box-shadow: 0 3px 8px rgba(2, 132, 199, 0.4);
  transform: translateY(-1px);
}

/* 3. ปุ่ม Studio (แก้ไขใน Word Studio) - สีเขียว Emerald */
.btn-studio {
  background: #047857 !important;
  color: #FFFFFF !important;
  border: 1px solid #065F46 !important;
  box-shadow: 0 1px 3px rgba(4, 120, 87, 0.25);
}

.btn-studio:hover {
  background: #065F46 !important;
  border-color: #064E3B !important;
  color: #FFFFFF !important;
  box-shadow: 0 3px 8px rgba(4, 120, 87, 0.4);
  transform: translateY(-1px);
}

/* 4. ปุ่ม ส่งต่อ (ในหน้าแฟ้มลายเซ็น) - สีฟ้าสดใส */
.btn-forward {
  background: #0284C7 !important;
  color: #FFFFFF !important;
  border: 1px solid #0369A1 !important;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.25);
}

.btn-forward:hover {
  background: #0369A1 !important;
  border-color: #075985 !important;
  color: #FFFFFF !important;
  transform: translateY(-1px);
}

/* 5. ปุ่ม อนุมัติ / ผ่าน */
.btn-approve {
  background: #10B981 !important;
  color: #FFFFFF !important;
  border: 1px solid #059669 !important;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.25);
}

.btn-approve:hover {
  background: #059669 !important;
  border-color: #047857 !important;
  color: #FFFFFF !important;
  transform: translateY(-1px);
}

.btn-search {
  background: #1B365D !important;
  color: #FFFFFF !important;
  border-color: #12243F !important;
  font-weight: 500;
  transition: all 0.15s ease;
}

.btn-search:hover {
  background: #12243F !important;
  border-color: #0A1526 !important;
  color: #FFFFFF !important;
}

.btn-navy {
  background: #1B365D !important;
  color: #FFFFFF !important;
  border-color: #12243F !important;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(27, 54, 93, 0.25);
  transition: all 0.15s ease;
}

.btn-navy:hover {
  background: #12243F !important;
  border-color: #0A1526 !important;
  box-shadow: 0 4px 12px rgba(27, 54, 93, 0.4);
  transform: translateY(-1px);
  color: #FFFFFF !important;
}

.btn-report,
.btn-gold {
  background: #D97706 !important;
  color: #FFFFFF !important;
  font-weight: 600;
  border: 1px solid #B45309 !important;
  box-shadow: 0 1px 4px rgba(217, 119, 6, 0.25);
}

.btn-report:hover,
.btn-gold:hover {
  background: #B45309 !important;
  border-color: #92400E !important;
  box-shadow: 0 3px 8px rgba(217, 119, 6, 0.4);
  transform: translateY(-1px);
  color: #FFFFFF !important;
}

.btn-secondary {
  background: var(--bg-subtle);
  border-color: var(--border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: #E2E8F0;
}

.btn-danger {
  background: #FEE2E2 !important;
  color: #DC2626 !important;
  border: 1px solid #FCA5A5 !important;
  box-shadow: 0 1px 2px rgba(220, 38, 38, 0.06);
}

.btn-danger:hover {
  background: #DC2626 !important;
  border-color: #B91C1C !important;
  color: #FFFFFF !important;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.25);
}

.btn-danger svg,
.btn-danger .lucide,
.btn-danger i[data-lucide] {
  color: #DC2626 !important;
  stroke: #DC2626 !important;
}

.btn-danger:hover svg,
.btn-danger:hover .lucide,
.btn-danger:hover i[data-lucide] {
  color: #FFFFFF !important;
  stroke: #FFFFFF !important;
}

/* Square Icon Button (Matches standard .form-control height: ~38px) */
.btn-icon-square {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: var(--radius-sm, 6px) !important;
  box-sizing: border-box !important;
  flex-shrink: 0;
}
.btn-icon-square svg,
.btn-icon-square .lucide,
.btn-icon-square i[data-lucide] {
  width: 16px !important;
  height: 16px !important;
  stroke-width: 2.2 !important;
  display: block !important;
}

/* Compact Square Icon Button (Matches sub-row input height: ~34px) */
.btn-icon-square-sm {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  min-height: 34px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: var(--radius-sm, 6px) !important;
  box-sizing: border-box !important;
  flex-shrink: 0;
}
.btn-icon-square-sm svg,
.btn-icon-square-sm .lucide,
.btn-icon-square-sm i[data-lucide] {
  width: 15px !important;
  height: 15px !important;
  stroke-width: 2.2 !important;
  display: block !important;
}

/* Dedicated Sub-row Goal Content Remove Button */
.btn-remove-goal-content {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  min-height: 34px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: var(--radius-sm, 6px) !important;
  background: #FEE2E2 !important;
  border: 1px solid #FCA5A5 !important;
  color: #DC2626 !important;
  box-shadow: 0 1px 2px rgba(220, 38, 38, 0.06);
  cursor: pointer;
  box-sizing: border-box !important;
  flex-shrink: 0;
  transition: all 0.15s ease-in-out;
}
.btn-remove-goal-content svg,
.btn-remove-goal-content .lucide,
.btn-remove-goal-content i[data-lucide] {
  width: 15px !important;
  height: 15px !important;
  stroke-width: 2.2 !important;
  color: #DC2626 !important;
  stroke: #DC2626 !important;
  display: block !important;
}
.btn-remove-goal-content:hover {
  background: #DC2626 !important;
  border-color: #B91C1C !important;
  color: #FFFFFF !important;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.25);
}
.btn-remove-goal-content:hover svg,
.btn-remove-goal-content:hover .lucide,
.btn-remove-goal-content:hover i[data-lucide] {
  color: #FFFFFF !important;
  stroke: #FFFFFF !important;
}

/* Dashed Pill Boxed Button for Add Sub-Content */
.btn-add-subcontent {
  min-height: 32px;
  padding: 4px 12px;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px dashed #94A3B8;
  background: #FFFFFF;
  color: #1E293B;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  margin-top: 4px;
}
.btn-add-subcontent svg,
.btn-add-subcontent .lucide,
.btn-add-subcontent i[data-lucide] {
  width: 14px !important;
  height: 14px !important;
  stroke-width: 2.2;
  color: #2563EB;
  stroke: #2563EB;
}
.btn-add-subcontent:hover {
  background: #EFF6FF;
  border-color: #3B82F6;
  color: #1D4ED8;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

/* Data Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th {
  background: var(--bg-subtle);
  color: var(--primary);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
}

.data-table tbody tr:hover {
  background-color: rgba(248, 250, 252, 0.8);
}

/* Form Elements */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-label.form-section-label,
.form-section-label {
  font-size: 1rem !important;
  font-weight: 600 !important;
  color: var(--primary) !important;
  margin-bottom: 6px;
  display: block;
}

.form-label.required::after {
  content: ' *';
  color: var(--danger);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--text-main);
  background: #FFFFFF;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.18);
}

.form-control:disabled,
.form-control[readonly] {
  background: var(--bg-subtle);
  color: var(--text-muted);
  cursor: not-allowed;
}

textarea.form-control {
  min-height: 100px;
  line-height: 1.6;
}

/* Form Type Card Selector */
.type-selector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.type-card-option {
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #FFFFFF;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.type-card-option:hover {
  border-color: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.type-card-option.selected {
  border-color: var(--accent);
  background: #FFFDF9;
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-md);
}

/* ทำให้ตัวเลือกที่ไม่ได้เลือกดูซีดลง เพื่อให้เห็นตัวเลือกปัจจุบันชัดเจน */
.type-card-option:not(.selected) {
  opacity: 0.52;
  background: #F8FAFC;
  border-color: #CBD5E1;
  box-shadow: none;
}

.type-card-option:not(.selected):hover {
  opacity: 0.78;
}

.type-card-radio {
  margin-top: 4px;
  accent-color: var(--accent);
}

/* Multi-Step Stepper Header */
.stepper-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  margin-bottom: 32px;
  padding: 0 12px;
}

.stepper-progress-line {
  position: absolute;
  top: 20px;
  left: 40px;
  right: 40px;
  height: 4px;
  background: var(--border);
  z-index: 1;
}

.stepper-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.step-node {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.step-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 3px solid var(--border);
  color: var(--text-muted);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.step-node.active .step-circle {
  border-color: var(--accent);
  background: var(--accent);
  color: #FFFFFF;
  box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.2);
}

.step-node.completed .step-circle {
  border-color: var(--primary);
  background: var(--primary);
  color: #FFFFFF;
}

.step-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.step-node.active .step-label {
  color: var(--primary);
}

/* Alerts */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success {
  background: var(--success-soft);
  color: #065F46;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.alert-danger {
  background: var(--danger-soft);
  color: #991B1B;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-info {
  background: var(--info-soft);
  color: #1E40AF;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Responsiveness */
/* Responsiveness for Dual-Tier Navigation */
@media (max-width: 1024px) {
  .app-sidebar {
    transform: translateX(-100%);
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.35);
  }

  .app-sidebar.sidebar-expanded,
  .app-sidebar.mobile-open {
    transform: translateX(0);
  }

  .app-main {
    margin-left: 0 !important;
  }

  .type-selector-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar-subnav {
    width: auto;
  }

  .subnav-header,
  .subnav-body {
    padding-left: 14px;
    padding-right: 14px;
  }

  .subnav-item {
    flex-basis: 100%;
    max-width: none;
  }

  .app-header {
    padding: 0 14px;
  }
}
/* ================================================================
   Chatbot Floating Widget — ระบบ Chatbot ช่วยเหลือผู้ใช้
   ================================================================ */

/* FAB Button (ไอคอนหูฟัง) */
#chatbot-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

#chatbot-fab {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #730000;
  border: 3px solid #1B365D;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(115, 0, 0, 0.45), 0 2px 8px rgba(18, 50, 85, 0.3);
  transition: all 0.25s ease;
  position: relative;
  flex-shrink: 0;
}

#chatbot-fab:hover {
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 10px 32px rgba(115, 0, 0, 0.55), 0 4px 14px rgba(18, 50, 85, 0.4);
}

.chatbot-fab-label {
  position: absolute;
  right: 64px;
  top: 50%;
  transform: translateY(-50%);
  background: #730000;
  color: #FFF;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  border: 1px solid #1B365D;
  font-family: 'Prompt', sans-serif;
}

#chatbot-fab:hover .chatbot-fab-label {
  opacity: 1;
}

#chatbot-fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #EF4444;
  color: #FFF;
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #FFF;
  animation: chatbot-pulse 2s infinite;
}

@keyframes chatbot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  50%       { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

/* Popup Panel */
#chatbot-popup {
  width: 360px;
  height: 540px;
  background: #FFFFFF;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18), 0 4px 16px rgba(18,50,85,0.15);
  border: 2px solid #1B365D;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: chatbot-slideup 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes chatbot-slideup {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Chat Header */
.chat-header {
  padding: 14px 16px;
  background: #730000;
  color: #FFF;
  border-bottom: 3px solid #1B365D;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

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

.chat-avatar-bot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1B365D;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border: 2px solid rgba(255,255,255,0.3);
  flex-shrink: 0;
}

.chat-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: #FFF;
}

.chat-subtitle {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.online  { background: #10B981; }
.status-dot.waiting { background: #F59E0B; animation: chatbot-pulse 1.5s infinite; }

.chat-header-actions {
  display: flex;
  gap: 4px;
}

.chat-header-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #FFF;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.chat-header-btn:hover { background: rgba(255,255,255,0.28); }

/* Quick Topics */
#chatbot-quick-topics {
  padding: 14px 14px 8px;
  background: #F8FAFC;
  border-bottom: 1px solid #E2E8F0;
  flex-shrink: 0;
}

.quick-topics-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748B;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.quick-topics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.qt-pill {
  background: #FFF;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  font-family: 'Prompt', sans-serif;
}

.qt-pill:hover {
  background: #EFF6FF;
  border-color: #1B365D;
  color: #1B365D;
}

/* Messages Area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #F8FAFC;
}

.chat-msg-wrap {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.user-wrap { flex-direction: row-reverse; }
.bot-wrap  { flex-direction: row; }

.chat-avatar-small {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  align-self: flex-start;
}

.chat-bubble {
  max-width: 78%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 0.82rem;
  line-height: 1.5;
  word-break: break-word;
}

.chat-bubble-user {
  background: #730000;
  color: #FFF;
  border-radius: 14px 14px 4px 14px;
}

.chat-bubble-bot {
  background: #FFF;
  color: #0F172A;
  border: 1px solid #E2E8F0;
  border-radius: 14px 14px 14px 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.chat-bubble-admin {
  background: #1B365D;
  color: #FFF;
  border-radius: 14px 14px 14px 4px;
}

.bubble-anim {
  animation: bubblePop 0.2s ease-out;
}

@keyframes bubblePop {
  from { opacity: 0; transform: scale(0.92) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Links */
.chat-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  padding-left: 32px;
}

.chat-link-btn {
  display: inline-block;
  background: #EFF6FF;
  border: 1px solid #93C5FD;
  color: #1B365D;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s;
}
.chat-link-btn:hover { background: #1B365D; color: #FFF; border-color: #1B365D; }

/* Quick Replies */
.chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 0 4px 32px;
}

.chat-qr-btn {
  background: #FFF;
  border: 1px solid #CBD5E1;
  border-radius: 99px;
  padding: 5px 12px;
  font-size: 0.76rem;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Prompt', sans-serif;
}
.chat-qr-btn:hover { background: #730000; color: #FFF; border-color: #730000; }

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: #94A3B8;
  border-radius: 50%;
  animation: typing-bounce 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-6px); }
}

/* Handoff Banner */
.handoff-banner {
  margin: 0 12px 6px;
  background: #FEF3C7;
  border: 1px solid #FDE68A;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.78rem;
  color: #92400E;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Input Area */
.chat-input-wrap {
  padding: 10px 12px;
  background: #FFF;
  border-top: 1px solid #E2E8F0;
  flex-shrink: 0;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 7px;
}

.chat-input {
  flex: 1;
  border: 1px solid #CBD5E1;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 0.85rem;
  font-family: 'Prompt', sans-serif;
  color: #0F172A;
  outline: none;
  transition: border-color 0.15s;
}
.chat-input:focus { border-color: #1B365D; }

.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #730000;
  border: none;
  color: #FFF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.chat-send-btn:hover { background: #5A0000; }

.chat-handoff-btn {
  width: 100%;
  background: transparent;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #1B365D;
  cursor: pointer;
  font-family: 'Prompt', sans-serif;
  transition: all 0.15s;
}
.chat-handoff-btn:hover { background: #1B365D; color: #FFF; border-color: #1B365D; }

/* ================================================================
   Dark Mode Component Overrides ([data-theme="dark"])
   ================================================================ */

/* Theme Toggle Button */
.theme-toggle-btn {
  cursor: pointer;
  position: relative;
  transition: transform 0.25s ease, background-color 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
}

.theme-toggle-btn:hover {
  transform: rotate(15deg) scale(1.08);
}

.theme-toggle-btn span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Dark Mode Form Inputs & Selects (YouTube Dark Style) */
[data-theme="dark"] .form-control,
[data-theme="dark"] input[type="text"]:not(.dept-multi-input),
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="datetime-local"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] input[type="month"],
[data-theme="dark"] input[type="week"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background-color: #121212;
  color: #F1F1F1;
  border-color: #303030;
  color-scheme: dark;
}

/* Calendar & Time picker icon in Dark Mode — Crisp White */
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="month"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="week"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] .form-control[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] .form-control[type="datetime-local"]::-webkit-calendar-picker-indicator {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E") !important;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 16px 16px;
  cursor: pointer;
  opacity: 0.95;
  filter: none !important;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] .form-control[type="time"]::-webkit-calendar-picker-indicator {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cpolyline points='12 6 12 12 16 14'%3E%3C/polyline%3E%3C/svg%3E") !important;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 16px 16px;
  cursor: pointer;
  opacity: 0.95;
  filter: none !important;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator:hover,
[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
[data-theme="dark"] input[type="month"]::-webkit-calendar-picker-indicator:hover,
[data-theme="dark"] input[type="week"]::-webkit-calendar-picker-indicator:hover,
[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator:hover,
[data-theme="dark"] .form-control::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233EA6FF' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E") !important;
  transform: scale(1.15);
}

[data-theme="dark"] .form-control::placeholder,
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: #717171;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  border-color: #3EA6FF;
  box-shadow: 0 0 0 3px rgba(62, 166, 255, 0.25);
  background-color: #121212;
}

[data-theme="dark"] .form-control:disabled,
[data-theme="dark"] .form-control[readonly] {
  background-color: #1A1A1A;
  color: #717171;
  border-color: #282828;
}

/* Dark Mode Cards, Modals, Popovers (YouTube Surface #212121) */
[data-theme="dark"] .card,
[data-theme="dark"] .grid-card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .modal-card,
[data-theme="dark"] .type-card-option {
  background-color: #212121;
  border-color: #303030;
  color: #F1F1F1;
}

[data-theme="dark"] .dropdown-popover {
  background-color: #282828;
  border-color: #3F3F3F;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.8);
}

[data-theme="dark"] .type-card-option:hover {
  border-color: #3EA6FF;
  background-color: #282828;
}

[data-theme="dark"] .type-card-option.selected {
  background-color: #1B2A38;
  border-color: #3EA6FF;
  box-shadow: 0 0 0 1px #3EA6FF, var(--shadow-md);
}

[data-theme="dark"] .user-popover-profile-section {
  background: linear-gradient(180deg, #181818 0%, #282828 100%);
}

[data-theme="dark"] .user-popover-actions {
  background-color: #282828;
}

[data-theme="dark"] .popover-footer {
  background-color: #1E1E1E;
  border-top-color: #383838;
}

[data-theme="dark"] .btn-popover-full {
  color: #3EA6FF;
}

[data-theme="dark"] .btn-popover-full:hover {
  background-color: rgba(62, 166, 255, 0.12);
  color: #70BAFF;
}

/* Dark Mode Tables (YouTube Style) */
[data-theme="dark"] .data-table th {
  background-color: #181818;
  color: #F1F1F1;
  border-bottom-color: #303030;
}

[data-theme="dark"] .data-table td {
  border-bottom-color: #282828;
  color: #E1E1E1;
}

[data-theme="dark"] .data-table tbody tr:hover,
[data-theme="dark"] table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

/* Dark Mode Notifications (YouTube Dark Menu) */
[data-theme="dark"] .notif-item {
  border-bottom-color: #303030;
}

[data-theme="dark"] .notif-item:hover {
  background-color: #383838;
}

[data-theme="dark"] .notif-item.unread {
  background-color: #1C2633;
}

[data-theme="dark"] .notif-item-desc {
  color: #AAAAAA;
}

[data-theme="dark"] .user-profile-pill {
  background-color: #212121;
  border-color: #303030;
  color: #F1F1F1;
}

[data-theme="dark"] .user-profile-pill:hover {
  background-color: #282828;
  border-color: #3F3F3F;
}

[data-theme="dark"] .btn-secondary {
  background: #2D3748;
  border-color: #4A5568;
  color: #F1F5F9;
}

[data-theme="dark"] .btn-secondary:hover {
  background: #3B4758;
  border-color: #718096;
  color: #FFFFFF;
}

/* Dark Mode Action Buttons System — Distinct Paper Look & High Contrast */
[data-theme="dark"] .btn-a4,
[data-theme="dark"] a.btn-a4,
[data-theme="dark"] button.btn-a4,
[data-theme="dark"] a.btn-a4:visited {
  background: #1E293B !important;
  color: #F8FAFC !important;
  border: 1.5px solid #475569 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4) !important;
  font-size: 1.05rem !important;
  line-height: 1 !important;
}

[data-theme="dark"] .btn-a4:hover,
[data-theme="dark"] a.btn-a4:hover,
[data-theme="dark"] button.btn-a4:hover {
  background: #334155 !important;
  border-color: #64748B !important;
  color: #FFFFFF !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6) !important;
  transform: translateY(-1px);
}

[data-theme="dark"] .btn-track,
[data-theme="dark"] a.btn-track,
[data-theme="dark"] button.btn-track,
[data-theme="dark"] a.btn-track:visited {
  background: #0284C7 !important;
  border: 1px solid #38BDF8 !important;
  color: #FFFFFF !important;
}

[data-theme="dark"] .btn-track:hover,
[data-theme="dark"] a.btn-track:hover,
[data-theme="dark"] button.btn-track:hover {
  background: #0369A1 !important;
  border-color: #7DD3FC !important;
  color: #FFFFFF !important;
}

[data-theme="dark"] .btn-edit,
[data-theme="dark"] a.btn-edit,
[data-theme="dark"] button.btn-edit,
[data-theme="dark"] a.btn-edit:visited {
  background: #1E293B !important;
  border: 1px solid #475569 !important;
  color: #FFFFFF !important;
}

[data-theme="dark"] .btn-edit:hover,
[data-theme="dark"] a.btn-edit:hover,
[data-theme="dark"] button.btn-edit:hover {
  background: #334155 !important;
  border-color: #64748B !important;
  color: #FFFFFF !important;
}

[data-theme="dark"] .btn-studio,
[data-theme="dark"] a.btn-studio,
[data-theme="dark"] button.btn-studio,
[data-theme="dark"] a.btn-studio:visited {
  background: #047857 !important;
  border: 1px solid #34D399 !important;
  color: #FFFFFF !important;
}

[data-theme="dark"] .btn-studio:hover,
[data-theme="dark"] a.btn-studio:hover,
[data-theme="dark"] button.btn-studio:hover {
  background: #065F46 !important;
  border-color: #6EE7B7 !important;
  color: #FFFFFF !important;
}

[data-theme="dark"] .btn-report,
[data-theme="dark"] a.btn-report,
[data-theme="dark"] button.btn-report,
[data-theme="dark"] a.btn-report:visited,
[data-theme="dark"] .btn-gold,
[data-theme="dark"] a.btn-gold,
[data-theme="dark"] button.btn-gold,
[data-theme="dark"] a.btn-gold:visited {
  background: #D97706 !important;
  border: 1px solid #FBBF24 !important;
  color: #FFFFFF !important;
}

[data-theme="dark"] .btn-report:hover,
[data-theme="dark"] a.btn-report:hover,
[data-theme="dark"] button.btn-report:hover,
[data-theme="dark"] .btn-gold:hover,
[data-theme="dark"] a.btn-gold:hover,
[data-theme="dark"] button.btn-gold:hover {
  background: #B45309 !important;
  border-color: #FCD34D !important;
  color: #FFFFFF !important;
}

[data-theme="dark"] .btn-forward,
[data-theme="dark"] a.btn-forward,
[data-theme="dark"] button.btn-forward,
[data-theme="dark"] a.btn-forward:visited {
  background: #0284C7 !important;
  border: 1px solid #38BDF8 !important;
  color: #FFFFFF !important;
}

[data-theme="dark"] .btn-forward:hover,
[data-theme="dark"] a.btn-forward:hover,
[data-theme="dark"] button.btn-forward:hover {
  background: #0369A1 !important;
  border-color: #7DD3FC !important;
  color: #FFFFFF !important;
}

[data-theme="dark"] .btn-approve,
[data-theme="dark"] a.btn-approve,
[data-theme="dark"] button.btn-approve,
[data-theme="dark"] a.btn-approve:visited {
  background: #10B981 !important;
  border: 1px solid #34D399 !important;
  color: #FFFFFF !important;
}

[data-theme="dark"] .btn-approve:hover,
[data-theme="dark"] a.btn-approve:hover,
[data-theme="dark"] button.btn-approve:hover {
  background: #059669 !important;
  border-color: #6EE7B7 !important;
  color: #FFFFFF !important;
}

[data-theme="dark"] .btn-danger,
[data-theme="dark"] a.btn-danger,
[data-theme="dark"] button.btn-danger,
[data-theme="dark"] a.btn-danger:visited,
[data-theme="dark"] .btn-remove-goal-content {
  background: rgba(220, 38, 38, 0.22) !important;
  border: 1px solid rgba(248, 113, 113, 0.5) !important;
  color: #FCA5A5 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .btn-danger svg,
[data-theme="dark"] .btn-danger .lucide,
[data-theme="dark"] .btn-danger i[data-lucide],
[data-theme="dark"] button.btn-danger svg,
[data-theme="dark"] a.btn-danger svg,
[data-theme="dark"] .btn-remove-goal-content svg,
[data-theme="dark"] .btn-remove-goal-content .lucide,
[data-theme="dark"] .btn-remove-goal-content i[data-lucide] {
  color: #FCA5A5 !important;
  stroke: #FCA5A5 !important;
}

[data-theme="dark"] .btn-danger:hover,
[data-theme="dark"] a.btn-danger:hover,
[data-theme="dark"] button.btn-danger:hover,
[data-theme="dark"] .btn-remove-goal-content:hover {
  background: #DC2626 !important;
  border-color: #F87171 !important;
  color: #FFFFFF !important;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.5);
}

[data-theme="dark"] .btn-danger:hover svg,
[data-theme="dark"] .btn-danger:hover .lucide,
[data-theme="dark"] .btn-danger:hover i[data-lucide],
[data-theme="dark"] button.btn-danger:hover svg,
[data-theme="dark"] a.btn-danger:hover svg,
[data-theme="dark"] .btn-remove-goal-content:hover svg,
[data-theme="dark"] .btn-remove-goal-content:hover .lucide,
[data-theme="dark"] .btn-remove-goal-content:hover i[data-lucide] {
  color: #FFFFFF !important;
  stroke: #FFFFFF !important;
}

[data-theme="dark"] .btn-add-subcontent {
  background: #1E293B !important;
  border-color: #475569 !important;
  color: #E2E8F0 !important;
}

[data-theme="dark"] .btn-add-subcontent svg,
[data-theme="dark"] .btn-add-subcontent .lucide,
[data-theme="dark"] .btn-add-subcontent i[data-lucide] {
  color: #60A5FA !important;
  stroke: #60A5FA !important;
}

[data-theme="dark"] .btn-add-subcontent:hover {
  background: #334155 !important;
  border-color: #60A5FA !important;
  color: #93C5FD !important;
}

[data-theme="dark"] .btn-user-profile {
  background: #272727 !important;
  color: #F1F1F1 !important;
  border: 1px solid #383838 !important;
}

[data-theme="dark"] .btn-user-profile:hover {
  background: #383838 !important;
  color: #3EA6FF !important;
  border-color: #3EA6FF !important;
}

[data-theme="dark"] .btn-user-logout {
  background: rgba(239, 68, 68, 0.16) !important;
  color: #FCA5A5 !important;
  border: 1px solid rgba(239, 68, 68, 0.38) !important;
}

[data-theme="dark"] .btn-user-logout:hover {
  background: #EF4444 !important;
  color: #FFFFFF !important;
  border-color: #EF4444 !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35) !important;
}

[data-theme="dark"] .breadcrumb-current {
  color: #F1F1F1;
}

/* Dark Mode Chatbot Floating Widget (YouTube Dark Style) */
[data-theme="dark"] #chatbot-popup {
  background-color: #212121;
  border-color: #383838;
}

[data-theme="dark"] #chatbot-quick-topics {
  background-color: #181818;
  border-bottom-color: #303030;
}

[data-theme="dark"] .quick-topics-label {
  color: #AAAAAA;
}

[data-theme="dark"] .qt-pill {
  background-color: #272727;
  color: #F1F1F1;
  border-color: #383838;
}

[data-theme="dark"] .qt-pill:hover {
  background-color: #3F3F3F;
  color: #FFFFFF;
  border-color: #4F4F4F;
}

[data-theme="dark"] .chat-messages {
  background-color: #0F0F0F;
}

[data-theme="dark"] .chat-bubble-bot {
  background-color: #282828;
  color: #F1F1F1;
  border-color: #383838;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .chat-qr-btn {
  background-color: #272727;
  color: #F1F1F1;
  border-color: #383838;
}

[data-theme="dark"] .chat-qr-btn:hover {
  background-color: #730000;
  color: #FFFFFF;
  border-color: #730000;
}

[data-theme="dark"] .chat-input-wrap {
  background-color: #212121;
  border-top-color: #303030;
}

[data-theme="dark"] .chat-input {
  background-color: #121212;
  color: #F1F1F1;
  border-color: #303030;
}

[data-theme="dark"] .chat-input:focus {
  border-color: #3EA6FF;
}

[data-theme="dark"] .chat-handoff-btn {
  border-color: #383838;
  color: #3EA6FF;
}

[data-theme="dark"] .chat-handoff-btn:hover {
  background-color: #1B365D;
  color: #FFFFFF;
  border-color: #1B365D;
}

[data-theme="dark"] .chat-link-btn {
  background-color: rgba(62, 166, 255, 0.12);
  border-color: rgba(62, 166, 255, 0.4);
  color: #3EA6FF;
}

[data-theme="dark"] .chat-link-btn:hover {
  background-color: #3EA6FF;
  color: #0F0F0F;
}

[data-theme="dark"] .chat-avatar-small {
  background-color: #303030;
}

/* Dark Mode Safety Overrides for Inline Light & White Backgrounds */
[data-theme="dark"] div[style*="background: #FFFFFF"],
[data-theme="dark"] div[style*="background:#FFFFFF"],
[data-theme="dark"] div[style*="background: #fff"],
[data-theme="dark"] div[style*="background:#fff"],
[data-theme="dark"] div[style*="background: #FFF"],
[data-theme="dark"] div[style*="background:#FFF"],
[data-theme="dark"] div[style*="background: #F8FAFC"],
[data-theme="dark"] div[style*="background:#F8FAFC"],
[data-theme="dark"] div[style*="background: #f8fafc"],
[data-theme="dark"] div[style*="background:#f8fafc"],
[data-theme="dark"] div[style*="background: #F1F5F9"],
[data-theme="dark"] div[style*="background:#F1F5F9"],
[data-theme="dark"] div[style*="background: #f1f5f9"],
[data-theme="dark"] div[style*="background:#f1f5f9"],
[data-theme="dark"] div[style*="background: #FAFAFA"],
[data-theme="dark"] div[style*="background:#FAFAFA"],
[data-theme="dark"] div[style*="background: #fafafa"],
[data-theme="dark"] div[style*="background:#fafafa"],
[data-theme="dark"] div[style*="background: #F9FAFB"],
[data-theme="dark"] div[style*="background:#F9FAFB"],
[data-theme="dark"] div[style*="background: #f9fafb"],
[data-theme="dark"] div[style*="background:#f9fafb"],
[data-theme="dark"] div[style*="background: #FFFDF9"],
[data-theme="dark"] div[style*="background:#FFFDF9"],
[data-theme="dark"] div[style*="background: #FFFBEB"],
[data-theme="dark"] div[style*="background:#FFFBEB"],
[data-theme="dark"] div[style*="background: #EFF6FF"],
[data-theme="dark"] div[style*="background:#EFF6FF"],
[data-theme="dark"] div[style*="background: #EDF4FA"],
[data-theme="dark"] div[style*="background:#EDF4FA"],
[data-theme="dark"] div[style*="background: #EAEEF4"],
[data-theme="dark"] div[style*="background:#EAEEF4"],
[data-theme="dark"] form[style*="background: #F8FAFC"],
[data-theme="dark"] form[style*="background:#F8FAFC"],
[data-theme="dark"] form[style*="background: #FFF"],
[data-theme="dark"] form[style*="background:#FFF"],
[data-theme="dark"] tr[style*="background: #F8FAFC"],
[data-theme="dark"] tr[style*="background:#F8FAFC"],
[data-theme="dark"] tr[style*="background: #F1F5F9"],
[data-theme="dark"] tr[style*="background:#F1F5F9"] {
  background-color: #181818 !important;
  color: #F1F1F1 !important;
  border-color: #303030 !important;
}

/* Ensure Form Labels and Text inside inline containers stay high-contrast */
[data-theme="dark"] div[style*="background: #F8FAFC"] label,
[data-theme="dark"] div[style*="background:#F8FAFC"] label,
[data-theme="dark"] div[style*="background: #F8FAFC"] .form-label,
[data-theme="dark"] div[style*="background:#F8FAFC"] .form-label,
[data-theme="dark"] .settings-container label,
[data-theme="dark"] .settings-container .form-label {
  color: #F1F1F1 !important;
}

[data-theme="dark"] .settings-container small,
[data-theme="dark"] .settings-container p {
  color: #AAAAAA !important;
}

[data-theme="dark"] .settings-container .form-label.required::after,
[data-theme="dark"] .form-label.required::after {
  color: #FCA5A5 !important;
}

/* Preserve Paper White for A4 Print Previews */
[data-theme="dark"] .a4-page,
[data-theme="dark"] .a4-preview-page,
[data-theme="dark"] div[style*="width: 860px; min-width: 860px"] {
  background-color: #FFFFFF !important;
  color: #000000 !important;
}

/* ================================================================
   High-Contrast Dark Mode Readability Overhauls
   ================================================================ */

/* 1. Global Typography & Headings */
[data-theme="dark"] body {
  color: #F1F1F1;
}

[data-theme="dark"] h1, 
[data-theme="dark"] h2, 
[data-theme="dark"] h3, 
[data-theme="dark"] h4, 
[data-theme="dark"] h5, 
[data-theme="dark"] h6,
[data-theme="dark"] .card-title,
[data-theme="dark"] .page-title {
  color: #FFFFFF !important;
}

[data-theme="dark"] p,
[data-theme="dark"] span,
[data-theme="dark"] td {
  color: #F1F1F1;
}

[data-theme="dark"] .text-muted,
[data-theme="dark"] small,
[data-theme="dark"] .stat-label,
[data-theme="dark"] .form-text,
[data-theme="dark"] .help-block {
  color: #AAAAAA !important;
}

[data-theme="dark"] .form-label,
[data-theme="dark"] label {
  color: #E6E6E6 !important;
  font-weight: 500;
}

/* 2. Links & Anchor tags in Dark Mode */
[data-theme="dark"] a:not([class*="btn"]):not([class*="nav-"]):not(.logo-circle-frame):not(.report-card-item) {
  color: #3EA6FF;
}

[data-theme="dark"] a:not([class*="btn"]):not([class*="nav-"]):not(.logo-circle-frame):not(.report-card-item):hover {
  color: #70BAFF;
  text-decoration: underline;
}

[data-theme="dark"] .breadcrumb {
  color: #AAAAAA;
}

[data-theme="dark"] .breadcrumb a,
[data-theme="dark"] .breadcrumb .breadcrumb-link {
  color: #AAAAAA;
}

[data-theme="dark"] .breadcrumb a:hover,
[data-theme="dark"] .breadcrumb .breadcrumb-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #3EA6FF;
  text-decoration: none;
}

[data-theme="dark"] .breadcrumb-separator {
  color: #717171;
}

[data-theme="dark"] .breadcrumb-current {
  color: #FFFFFF !important;
  font-weight: 600;
}

[data-theme="dark"] .breadcrumb-current:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #3EA6FF !important;
  text-decoration: none;
}

/* 3. Stat Cards & Values in Dark Mode */
[data-theme="dark"] .stat-val {
  color: #FFFFFF !important;
}

[data-theme="dark"] .stat-val[style*="color: #065F46"],
[data-theme="dark"] .stat-val[style*="color:#065F46"],
[data-theme="dark"] [style*="color: #065F46"],
[data-theme="dark"] [style*="color:#065F46"],
[data-theme="dark"] [style*="color: #166534"],
[data-theme="dark"] [style*="color:#166534"] {
  color: #34D399 !important; /* Vibrant Light Emerald */
}

[data-theme="dark"] .stat-val[style*="color: #1E40AF"],
[data-theme="dark"] .stat-val[style*="color:#1E40AF"],
[data-theme="dark"] [style*="color: #1E40AF"],
[data-theme="dark"] [style*="color:#1E40AF"],
[data-theme="dark"] [style*="color: #0284C7"],
[data-theme="dark"] [style*="color:#0284C7"] {
  color: #60A5FA !important; /* Vibrant Light Blue */
}

[data-theme="dark"] [style*="color: #92400E"],
[data-theme="dark"] [style*="color:#92400E"],
[data-theme="dark"] [style*="color: #B45309"],
[data-theme="dark"] [style*="color:#B45309"],
[data-theme="dark"] [style*="color: #78350F"],
[data-theme="dark"] [style*="color:#78350F"],
[data-theme="dark"] [style*="color: #854D0E"],
[data-theme="dark"] [style*="color:#854D0E"] {
  color: #FDE68A !important; /* Bright Readable Amber/Gold */
}

[data-theme="dark"] [style*="color: #991B1B"],
[data-theme="dark"] [style*="color:#991B1B"],
[data-theme="dark"] [style*="color: #7F1D1D"],
[data-theme="dark"] [style*="color:#7F1D1D"],
[data-theme="dark"] [style*="color: #DC2626"],
[data-theme="dark"] [style*="color:#DC2626"] {
  color: #FCA5A5 !important; /* Bright Light Coral Red */
}

[data-theme="dark"] [style*="color: #0F172A"],
[data-theme="dark"] [style*="color:#0F172A"],
[data-theme="dark"] [style*="color: #1E293B"],
[data-theme="dark"] [style*="color:#1E293B"],
[data-theme="dark"] [style*="color: #334155"],
[data-theme="dark"] [style*="color:#334155"],
[data-theme="dark"] [style*="color: #475569"],
[data-theme="dark"] [style*="color:#475569"],
[data-theme="dark"] [style*="color: #64748B"],
[data-theme="dark"] [style*="color:#64748B"],
[data-theme="dark"] [style*="color: #374151"],
[data-theme="dark"] [style*="color:#374151"] {
  color: #E2E8F0 !important; /* Crisp Readable Light Slate */
}

/* 4. Badges & Status Pills in Dark Mode */
[data-theme="dark"] .badge,
[data-theme="dark"] span[class*="badge"] {
  font-weight: 600;
}

[data-theme="dark"] .badge[style*="#FEF3C7"],
[data-theme="dark"] span[style*="#FEF3C7"],
[data-theme="dark"] span[style*="#FEF9C3"],
[data-theme="dark"] .badge-warning {
  background: rgba(245, 158, 11, 0.22) !important;
  color: #FDE68A !important;
  border: 1px solid rgba(245, 158, 11, 0.45) !important;
}

[data-theme="dark"] .badge[style*="#D1FAE5"],
[data-theme="dark"] span[style*="#D1FAE5"],
[data-theme="dark"] .badge[style*="#DCFCE7"],
[data-theme="dark"] span[style*="#DCFCE7"],
[data-theme="dark"] .badge[style*="#ECFDF5"],
[data-theme="dark"] span[style*="#ECFDF5"],
[data-theme="dark"] .badge-success {
  background: rgba(16, 185, 129, 0.22) !important;
  color: #6EE7B7 !important;
  border: 1px solid rgba(16, 185, 129, 0.45) !important;
}

[data-theme="dark"] .badge[style*="#FEE2E2"],
[data-theme="dark"] span[style*="#FEE2E2"],
[data-theme="dark"] .badge[style*="#FFE4E6"],
[data-theme="dark"] span[style*="#FFE4E6"],
[data-theme="dark"] .badge[style*="#FEF2F2"],
[data-theme="dark"] span[style*="#FEF2F2"],
[data-theme="dark"] .badge-danger {
  background: rgba(239, 68, 68, 0.22) !important;
  color: #FCA5A5 !important;
  border: 1px solid rgba(239, 68, 68, 0.45) !important;
}

[data-theme="dark"] .badge[style*="#DBEAFE"],
[data-theme="dark"] span[style*="#DBEAFE"],
[data-theme="dark"] .badge[style*="#E0E7FF"],
[data-theme="dark"] span[style*="#E0E7FF"],
[data-theme="dark"] .badge[style*="#EFF6FF"],
[data-theme="dark"] span[style*="#EFF6FF"],
[data-theme="dark"] .badge-info {
  background: rgba(59, 130, 246, 0.22) !important;
  color: #93C5FD !important;
  border: 1px solid rgba(59, 130, 246, 0.45) !important;
}

[data-theme="dark"] .badge[style*="#F3E8FF"],
[data-theme="dark"] span[style*="#F3E8FF"] {
  background: rgba(168, 85, 247, 0.22) !important;
  color: #D8B4FE !important;
  border: 1px solid rgba(168, 85, 247, 0.45) !important;
}

[data-theme="dark"] .badge[style*="#F1F5F9"],
[data-theme="dark"] span[style*="#F1F5F9"],
[data-theme="dark"] .badge[style*="#F3F4F6"],
[data-theme="dark"] span[style*="#F3F4F6"],
[data-theme="dark"] .badge[style*="#F8FAFC"],
[data-theme="dark"] span[style*="#F8FAFC"] {
  background: rgba(148, 163, 184, 0.18) !important;
  color: #CBD5E1 !important;
  border: 1px solid rgba(148, 163, 184, 0.35) !important;
}

/* Project Code Badge & Accent text in Dark Mode */
.project-code-badge {
  font-family: 'Consolas', 'Courier New', monospace;
  font-weight: 700;
  font-size: 0.95rem;
  color: #1B365D;
  background: #EFF6FF;
  border: 1.5px solid #BFDBFE;
  padding: 3px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  letter-spacing: 0.5px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .project-code-badge {
  color: #38BDF8 !important; /* Sky Blue - clear and sharp */
  background: #0F172A !important; /* Deep Slate 900 - distinct from #212121 card */
  border: 1.5px solid #0284C7 !important; /* Strong clear frame */
  box-shadow: 0 0 0 1px rgba(2, 132, 199, 0.25), 0 2px 4px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] span[style*="var(--accent)"],
[data-theme="dark"] span[style*="color: var(--accent)"],
[data-theme="dark"] span[style*="color:var(--accent)"] {
  color: #38BDF8 !important;
}

[data-theme="dark"] span[style*="var(--accent-soft)"],
[data-theme="dark"] span[style*="background: var(--accent-soft)"],
[data-theme="dark"] span[style*="background:var(--accent-soft)"] {
  background: #0F172A !important;
  border: 1.5px solid #0284C7 !important;
}

.project-health-badge {
  font-size: 0.84rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  background: #F8FAFC;
  color: #334155;
  border: 1.5px solid #CBD5E1;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

[data-theme="dark"] .project-health-badge {
  background: #181818 !important;
  color: #E2E8F0 !important;
  border: 1.5px solid #475569 !important;
}

/* 5. Alerts & Announcement Callouts */
[data-theme="dark"] .alert-info {
  background: #102235 !important;
  color: #93C5FD !important;
  border-color: #2563EB !important;
}

[data-theme="dark"] .alert-warning {
  background: #2B1E0D !important;
  color: #FDE68A !important;
  border-color: #D97706 !important;
}

[data-theme="dark"] .alert-danger {
  background: #2D1414 !important;
  color: #FCA5A5 !important;
  border-color: #DC2626 !important;
}

[data-theme="dark"] .alert-success {
  background: #0F261B !important;
  color: #86EFAC !important;
  border-color: #16A34A !important;
}

/* 6. Form Controls & Inputs Contrast */
[data-theme="dark"] .form-control,
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  color: #FFFFFF !important;
  background-color: #121212 !important;
  border-color: #383838 !important;
}

[data-theme="dark"] select option {
  background-color: #212121;
  color: #FFFFFF;
}

/* 7. Tables High Contrast */
[data-theme="dark"] table th,
[data-theme="dark"] .data-table th {
  background-color: #181818 !important;
  color: #FFFFFF !important;
  border-bottom: 2px solid #383838 !important;
}

[data-theme="dark"] table td,
[data-theme="dark"] .data-table td {
  color: #EEEEEE !important;
  border-bottom: 1px solid #282828 !important;
}

[data-theme="dark"] table tr:hover,
[data-theme="dark"] .data-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.07) !important;
}

/* 8. Popovers & Notifications */
[data-theme="dark"] .popover-header div {
  color: #FFFFFF !important;
}

[data-theme="dark"] .notif-item-title {
  color: #FFFFFF !important;
}

[data-theme="dark"] .notif-item-desc {
  color: #CCCCCC !important;
}

[data-theme="dark"] .notif-item-comment {
  background-color: #2D2214 !important;
  color: #FCD34D !important;
  border: 1px solid #78350F !important;
}

[data-theme="dark"] .notif-item-time {
  color: #888888 !important;
}

[data-theme="dark"] .notif-card-item {
  background-color: #212121 !important;
  border-color: #383838 !important;
}

[data-theme="dark"] .notif-card-item.unread-card {
  background-color: #1A2230 !important;
}

[data-theme="dark"] #message-detail-modal div[style*="background: #F8FAFC"] {
  background-color: #1A1A1A !important;
  border-color: #383838 !important;
}

[data-theme="dark"] #modal-notif-proj-title {
  color: #FFFFFF !important;
}

[data-theme="dark"] #modal-notif-comment {
  background-color: #1A1A1A !important;
  color: #F1F1F1 !important;
  border-color: #383838 !important;
  border-left: 4px solid #3EA6FF !important;
}

/* 9. Highlighted Department Row & Table Badges in Dark Mode */
[data-theme="dark"] tr.my-dept-row,
[data-theme="dark"] tr[style*="background: #EFF6FF"],
[data-theme="dark"] tr[style*="background:#EFF6FF"],
[data-theme="dark"] tr[style*="background: #eff6ff"],
[data-theme="dark"] tr[style*="background:#eff6ff"] {
  background-color: #1A2838 !important; /* Elegant subtle dark blue highlight */
  border-bottom: 1px solid #2B425B !important;
}

[data-theme="dark"] tr.my-dept-row td,
[data-theme="dark"] tr[style*="background: #EFF6FF"] td,
[data-theme="dark"] tr.my-dept-row div,
[data-theme="dark"] tr[style*="background: #EFF6FF"] div {
  color: #F1F1F1 !important;
}

[data-theme="dark"] tr.my-dept-row:hover,
[data-theme="dark"] tr[style*="background: #EFF6FF"]:hover {
  background-color: #22374E !important;
}

/* Grey pill counters in tables (e.g. "ยังไม่ได้ดำเนินงาน" circle badge) */
[data-theme="dark"] span[style*="background: #F1F5F9"],
[data-theme="dark"] span[style*="background:#F1F5F9"] {
  background-color: #2D3748 !important;
  color: #E2E8F0 !important;
  border: 1px solid #4A5568 !important;
}

/* ================================================================
   10. Additional Dark Mode Fixes — Upload Forms, Profile Pill,
       Sidebar Footer Text, File Input
   ================================================================ */

/* Upload form boxes (admin/templates.php) — form with inline #F1F5F9 bg */
[data-theme="dark"] form[style*="background: #F1F5F9"],
[data-theme="dark"] form[style*="background:#F1F5F9"],
[data-theme="dark"] form[style*="background: #F8FAFC"],
[data-theme="dark"] form[style*="background:#F8FAFC"],
[data-theme="dark"] form[style*="background: #f8fafc"],
[data-theme="dark"] form[style*="background:#f8fafc"],
[data-theme="dark"] form[style*="background: #f1f5f9"],
[data-theme="dark"] form[style*="background:#f1f5f9"] {
  background-color: #1A1A1A !important;
  border: 1px solid #303030 !important;
  color: #F1F1F1 !important;
}

[data-theme="dark"] form[style*="background: #F1F5F9"] label,
[data-theme="dark"] form[style*="background:#F1F5F9"] label,
[data-theme="dark"] form[style*="background: #F8FAFC"] label,
[data-theme="dark"] form[style*="background:#F8FAFC"] label {
  color: #E6E6E6 !important;
}

/* File input (Choose File button) in Dark Mode */
[data-theme="dark"] input[type="file"] {
  background-color: #1A1A1A !important;
  color: #F1F1F1 !important;
  border-color: #383838 !important;
}

[data-theme="dark"] input[type="file"]::file-selector-button {
  background-color: #303030;
  color: #F1F1F1;
  border: 1px solid #4A4A4A;
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
  font-family: 'Prompt', sans-serif;
  font-size: 0.82rem;
  transition: background 0.15s;
}

[data-theme="dark"] input[type="file"]::file-selector-button:hover {
  background-color: #3EA6FF;
  color: #000000;
  border-color: #3EA6FF;
}

/* User Profile Pill in Header — Dark Mode fix */
[data-theme="dark"] .user-profile-pill {
  background-color: #1E1E1E !important;
  border-color: #3F3F3F !important;
  color: #F1F1F1 !important;
}

[data-theme="dark"] .user-profile-pill:hover {
  background-color: #2A2A2A !important;
  border-color: #3EA6FF !important;
}

[data-theme="dark"] .user-profile-pill .user-info-text div:first-child,
[data-theme="dark"] .user-profile-pill div[style*="font-weight: 600"],
[data-theme="dark"] .user-profile-pill div[style*="font-weight:600"] {
  color: #FFFFFF !important;
}

[data-theme="dark"] .user-profile-pill div[style*="color: var(--text-muted)"],
[data-theme="dark"] .user-profile-pill span[style*="color: var(--text-muted)"] {
  color: #94A3B8 !important;
}

/* Chatbot popup header user info area */
[data-theme="dark"] #chatbot-popup .chatbot-header {
  background: linear-gradient(135deg, #730000 0%, #4A0000 100%);
  color: #FFFFFF;
}

/* User popover name and meta text */
[data-theme="dark"] .user-popover-name {
  color: #FFFFFF !important;
}

[data-theme="dark"] .user-popover-meta {
  color: #94A3B8 !important;
}

[data-theme="dark"] .user-popover-meta div {
  color: #94A3B8 !important;
}

[data-theme="dark"] .user-popover-meta b {
  color: #F1F5F9 !important;
}

[data-theme="dark"] .user-popover-badge {
  background: rgba(245, 158, 11, 0.2) !important;
  color: #FDE68A !important;
  border: 1px solid rgba(245, 158, 11, 0.45) !important;
}

[data-theme="dark"] .user-popover-badge span {
  color: inherit !important;
}

[data-theme="dark"] .user-popover-badge.badge-role-super_admin {
  background: rgba(239, 68, 68, 0.22) !important;
  color: #FCA5A5 !important;
  border-color: rgba(239, 68, 68, 0.45) !important;
}

[data-theme="dark"] .user-popover-badge.badge-role-admin {
  background: rgba(245, 158, 11, 0.22) !important;
  color: #FDE68A !important;
  border-color: rgba(245, 158, 11, 0.45) !important;
}

[data-theme="dark"] .user-popover-badge.badge-role-user {
  background: rgba(59, 130, 246, 0.22) !important;
  color: #93C5FD !important;
  border-color: rgba(59, 130, 246, 0.45) !important;
}

/* Sidebar footer text visibility */
[data-theme="dark"] .sidebar-footer {
  background: #3A0000 !important;
  color: rgba(255, 255, 255, 0.9) !important;
  border-top-color: #D4AF37 !important;
}

[data-theme="dark"] .sidebar-footer span,
[data-theme="dark"] .sidebar-footer b {
  color: #FFFFFF !important;
}

/* Stat icon circles (emoji icon bg in stat cards) */
[data-theme="dark"] .stat-icon[style*="background: rgba(16, 185, 129"],
[data-theme="dark"] div[style*="background: rgba(16, 185, 129"],
[data-theme="dark"] div[style*="background: rgba(59, 130, 246"],
[data-theme="dark"] div[style*="background: rgba(239, 68, 68"],
[data-theme="dark"] div[style*="background: rgba(245, 158, 11"],
[data-theme="dark"] div[style*="background: rgba(168, 85, 247"] {
  filter: brightness(1.3);
}

/* Callout/announcement boxes in Dashboard & Reports */
[data-theme="dark"] div[style*="background: #FFFDF9"],
[data-theme="dark"] div[style*="background:#FFFDF9"] {
  background-color: #1C1810 !important;
  border-color: #4A3A10 !important;
  color: #F1F1F1 !important;
}

[data-theme="dark"] div[style*="background: #F0FDF4"],
[data-theme="dark"] div[style*="background:#F0FDF4"],
[data-theme="dark"] div[style*="background: #ECFDF5"],
[data-theme="dark"] div[style*="background:#ECFDF5"] {
  background-color: #062312 !important;
  border-color: #14532D !important;
  color: #D1FAE5 !important;
}

[data-theme="dark"] div[style*="background: #F0FDF4"] div,
[data-theme="dark"] div[style*="background:#F0FDF4"] div,
[data-theme="dark"] div[style*="background: #ECFDF5"] div,
[data-theme="dark"] div[style*="background:#ECFDF5"] div {
  color: #D1FAE5 !important;
}

[data-theme="dark"] div[style*="background: #F0FDF4"] div[style*="color: #166534"],
[data-theme="dark"] div[style*="background:#F0FDF4"] div[style*="color:#166534"],
[data-theme="dark"] div[style*="background: #ECFDF5"] div[style*="color: #065F46"],
[data-theme="dark"] div[style*="background:#ECFDF5"] div[style*="color:#065F46"] {
  color: #4ADE80 !important;
}

[data-theme="dark"] div[style*="background: #EFF6FF"],
[data-theme="dark"] div[style*="background:#EFF6FF"] {
  background-color: #0D1A2D !important;
  border-color: #1E3A5F !important;
  color: #F0F9FF !important;
}

[data-theme="dark"] div[style*="background: #EFF6FF"] div,
[data-theme="dark"] div[style*="background:#EFF6FF"] div {
  color: #F0F9FF !important;
}

[data-theme="dark"] div[style*="background: #EFF6FF"] div[style*="color: #1E40AF"],
[data-theme="dark"] div[style*="background:#EFF6FF"] div[style*="color:#1E40AF"] {
  color: #38BDF8 !important;
}

[data-theme="dark"] div[style*="background: #FFFBEB"],
[data-theme="dark"] div[style*="background:#FFFBEB"],
[data-theme="dark"] div[style*="background: #FEF3C7"],
[data-theme="dark"] div[style*="background:#FEF3C7"],
[data-theme="dark"] div[style*="background: #fef3c7"],
[data-theme="dark"] div[style*="background:#fef3c7"],
[data-theme="dark"] .user-reset-box {
  background-color: #241A06 !important;
  border: 1px solid #5C430B !important;
  color: #FDE68A !important;
}

[data-theme="dark"] div[style*="background: #FFFBEB"] div,
[data-theme="dark"] div[style*="background:#FFFBEB"] div,
[data-theme="dark"] div[style*="background: #FEF3C7"] div,
[data-theme="dark"] div[style*="background:#FEF3C7"] div,
[data-theme="dark"] .user-reset-box label,
[data-theme="dark"] div[style*="background: #FEF3C7"] label,
[data-theme="dark"] div[style*="background:#FEF3C7"] label {
  color: #FDE68A !important;
}

[data-theme="dark"] .user-reset-box .form-control,
[data-theme="dark"] div[style*="background: #FEF3C7"] .form-control,
[data-theme="dark"] div[style*="background:#FEF3C7"] .form-control {
  background-color: #181818 !important;
  border-color: #383838 !important;
  color: #FFFFFF !important;
}

/* Chrome & WebKit Autofill in Dark Mode */
[data-theme="dark"] input:-webkit-autofill,
[data-theme="dark"] input:-webkit-autofill:hover, 
[data-theme="dark"] input:-webkit-autofill:focus, 
[data-theme="dark"] textarea:-webkit-autofill,
[data-theme="dark"] select:-webkit-autofill {
  -webkit-text-fill-color: #FFFFFF !important;
  -webkit-box-shadow: 0 0 0px 1000px #181818 inset !important;
  box-shadow: 0 0 0px 1000px #181818 inset !important;
  transition: background-color 5000s ease-in-out 0s !important;
}

/* Report callout boxes */
[data-theme="dark"] div[style*="background: #D1FAE5"],
[data-theme="dark"] div[style*="background:#D1FAE5"] {
  background-color: #0A1F14 !important;
  border-color: #1A4D30 !important;
  color: #6EE7B7 !important;
}

[data-theme="dark"] tr[style*="border-bottom:1px solid #E2E8F0"],
[data-theme="dark"] tr[style*="border-bottom: 1px solid #E2E8F0"] {
  border-bottom: 1px solid #282828 !important;
}

/* Sub-panels, Section 5, and Form Group callouts with #F8FAFC background */
[data-theme="dark"] div[style*="background: #F8FAFC"],
[data-theme="dark"] div[style*="background:#F8FAFC"],
[data-theme="dark"] div[style*="background: #f8fafc"],
[data-theme="dark"] div[style*="background:#f8fafc"] {
  background-color: #1A1A1A !important;
  border-color: #333333 !important;
  color: #F1F1F1 !important;
}

[data-theme="dark"] #section-ovec-policies {
  background-color: #1A1A1A !important;
  border-color: #333333 !important;
}

[data-theme="dark"] .ovec-policy-row {
  background-color: #242424 !important;
  border-color: #383838 !important;
}

/* Alignment Comboboxes (Section 5.2 - 5.4) in Dark Mode */
[data-theme="dark"] .alignment-combobox {
  background-color: #212121 !important;
  border-color: #383838 !important;
}

[data-theme="dark"] .alignment-combobox-label {
  color: #F1F1F1 !important;
}

[data-theme="dark"] .alignment-selector-shell {
  background-color: #181818 !important;
  border-color: #383838 !important;
}

[data-theme="dark"] .alignment-selector.is-disabled .alignment-selector-shell {
  background-color: #141414 !important;
  border-color: #282828 !important;
}

[data-theme="dark"] .alignment-search-input {
  color: #F1F1F1 !important;
}

[data-theme="dark"] .alignment-dropdown {
  background-color: #212121 !important;
  border-color: #383838 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6) !important;
}

[data-theme="dark"] .alignment-option-group {
  background-color: #161616 !important;
  color: #FDE68A !important;
  border-color: #333333 !important;
}

[data-theme="dark"] .alignment-option {
  color: #E2E8F0 !important;
}

[data-theme="dark"] .alignment-option:hover,
[data-theme="dark"] .alignment-option:focus {
  background-color: #2D3748 !important;
  color: #FFFFFF !important;
}

[data-theme="dark"] .alignment-option-code {
  color: #38BDF8 !important;
}

[data-theme="dark"] .alignment-empty-option {
  color: #94A3B8 !important;
}

[data-theme="dark"] .alignment-summary-bar {
  background-color: #1E1E1E !important;
  color: #F1F1F1 !important;
  border-color: #383838 !important;
  border-left: 3px solid #38BDF8 !important;
}

/* ================================================================
   Timeline Banner & Modals in Dark Mode
   ================================================================ */
[data-theme="dark"] .timeline-banner {
  background: linear-gradient(135deg, #1C1917 0%, #291807 100%) !important;
  border: 2px solid #F59E0B !important;
  border-left: 6px solid #FBBF24 !important;
  box-shadow: 0 4px 22px rgba(245, 158, 11, 0.3) !important;
  color: #FFFFFF !important;
}

[data-theme="dark"] .timeline-banner:hover {
  background: linear-gradient(135deg, #24201C 0%, #341F0A 100%) !important;
  border-color: #FBBF24 !important;
  box-shadow: 0 6px 26px rgba(245, 158, 11, 0.45) !important;
}

[data-theme="dark"] .timeline-icon-box {
  background: #292524 !important;
  border: 1.5px solid #F59E0B !important;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25) !important;
}

[data-theme="dark"] .timeline-title {
  color: #FFFFFF !important;
  font-weight: 800 !important;
}

[data-theme="dark"] .timeline-desc {
  color: #FEF3C7 !important;
  font-size: 0.88rem !important;
}

[data-theme="dark"] .timeline-meta {
  color: #FDE68A !important;
}

[data-theme="dark"] .timeline-meta b {
  color: #FFFFFF !important;
}

/* Slider Controls in Dark Mode */
[data-theme="dark"] .timeline-slider-nav {
  background: #292524 !important;
  border: 1.5px solid #573E1E !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .btn-timeline-slider {
  color: #FCD34D !important;
}

[data-theme="dark"] .btn-timeline-slider:hover {
  background: #44321A !important;
  color: #FFFFFF !important;
}

/* Action Buttons in Dark Mode */
[data-theme="dark"] .btn-timeline-overall {
  background: #3B260C !important;
  color: #FDE68A !important;
  border: 1px solid #6B4315 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .btn-timeline-overall:hover {
  background: #543410 !important;
  color: #FFFFFF !important;
  border-color: #F59E0B !important;
}

[data-theme="dark"] .btn-timeline-detail {
  background: #172554 !important;
  color: #93C5FD !important;
  border: 1px solid #1E40AF !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .btn-timeline-detail:hover {
  background: #1E40AF !important;
  color: #FFFFFF !important;
  border-color: #60A5FA !important;
}

/* Badges in Dark Mode */
[data-theme="dark"] .timeline-badge-info {
  background: rgba(59, 130, 246, 0.22) !important;
  color: #93C5FD !important;
  border: 1px solid rgba(147, 197, 253, 0.4) !important;
}

[data-theme="dark"] .timeline-badge-warning {
  background: rgba(245, 158, 11, 0.22) !important;
  color: #FDE68A !important;
  border: 1px solid rgba(253, 230, 138, 0.4) !important;
}

[data-theme="dark"] .timeline-badge-success {
  background: rgba(16, 185, 129, 0.22) !important;
  color: #6EE7B7 !important;
  border: 1px solid rgba(110, 231, 183, 0.4) !important;
}

[data-theme="dark"] .timeline-badge-danger {
  background: rgba(239, 68, 68, 0.22) !important;
  color: #FCA5A5 !important;
  border: 1px solid rgba(252, 165, 165, 0.4) !important;
}

[data-theme="dark"] .timeline-badge-primary {
  background: rgba(99, 102, 241, 0.22) !important;
  color: #C7D2FE !important;
  border: 1px solid rgba(199, 210, 254, 0.4) !important;
}

[data-theme="dark"] .timeline-slider-counter {
  background: rgba(245, 158, 11, 0.22) !important;
  color: #FDE68A !important;
  border: 1px solid rgba(245, 158, 11, 0.45) !important;
}

/* Modals & Overviews in Dark Mode */
[data-theme="dark"] .overall-card-item {
  background: #212121 !important;
  border-color: #383838 !important;
  border-left: 5px solid #F59E0B !important;
}

[data-theme="dark"] .overall-desc-box {
  background: #181818 !important;
  border-color: #303030 !important;
  color: #E2E8F0 !important;
}

[data-theme="dark"] .timeline-detail-desc-box {
  background: #181818 !important;
  border-color: #303030 !important;
  border-left: 4px solid #3EA6FF !important;
  color: #E2E8F0 !important;
}

[data-theme="dark"] .timeline-detail-meta-box {
  background: #272727 !important;
  border-color: #383838 !important;
  color: #AAAAAA !important;
}

[data-theme="dark"] .timeline-detail-meta-box b {
  color: #F1F1F1 !important;
}

/* ================================================================
   11. Buttons in Dark Mode (High Contrast & Clear Typography)
   ================================================================ */
[data-theme="dark"] .btn-primary,
[data-theme="dark"] button.btn-primary,
[data-theme="dark"] a.btn-primary,
[data-theme="dark"] a.btn-primary:visited,
[data-theme="dark"] input[type="submit"].btn-primary,
[data-theme="dark"] .btn-primary:not(:disabled) {
  background: #1B365D !important;
  background-color: #1B365D !important;
  color: #FFFFFF !important;
  border: 1px solid #3B82F6 !important;
  box-shadow: 0 4px 12px rgba(27, 54, 93, 0.5) !important;
}

[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] .btn-primary:focus,
[data-theme="dark"] button.btn-primary:hover,
[data-theme="dark"] button.btn-primary:focus,
[data-theme="dark"] a.btn-primary:hover,
[data-theme="dark"] a.btn-primary:focus,
[data-theme="dark"] input[type="submit"].btn-primary:hover {
  background: #2563EB !important;
  background-color: #2563EB !important;
  border-color: #60A5FA !important;
  color: #FFFFFF !important;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.6) !important;
}

[data-theme="dark"] .btn-secondary,
[data-theme="dark"] button.btn-secondary,
[data-theme="dark"] a.btn-secondary {
  background: #272727 !important;
  background-color: #272727 !important;
  color: #E2E8F0 !important;
  border: 1px solid #444444 !important;
}

[data-theme="dark"] .btn-secondary:hover,
[data-theme="dark"] button.btn-secondary:hover,
[data-theme="dark"] a.btn-secondary:hover {
  background: #333333 !important;
  background-color: #333333 !important;
  color: #FFFFFF !important;
  border-color: #666666 !important;
}

/* All maroon / primary text in Dark Mode becomes White for high readability */
[data-theme="dark"] [style*="color: var(--primary)"],
[data-theme="dark"] [style*="color:var(--primary)"],
[data-theme="dark"] [style*="color: #730000"],
[data-theme="dark"] [style*="color:#730000"],
[data-theme="dark"] [style*="color: #8C0000"],
[data-theme="dark"] [style*="color:#8C0000"],
[data-theme="dark"] [style*="color: #5A0000"],
[data-theme="dark"] [style*="color:#5A0000"],
[data-theme="dark"] [style*="color: #4A0000"],
[data-theme="dark"] [style*="color:#4A0000"],
[data-theme="dark"] .text-primary,
[data-theme="dark"] .notif-card-item [style*="color: var(--primary)"] {
  color: #FFFFFF !important;
}

/* Chatbot Dark Mode Overrides */
[data-theme="dark"] #chatbot-popup {
  background: #111827 !important;
  border-color: #374151 !important;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 25px rgba(27, 54, 93, 0.4) !important;
}

[data-theme="dark"] #chatbot-quick-topics {
  background: #1F2937 !important;
  border-bottom-color: #374151 !important;
}

[data-theme="dark"] .quick-topics-label {
  color: #9CA3AF !important;
}

[data-theme="dark"] .qt-pill {
  background: #111827 !important;
  border-color: #374151 !important;
  color: #E5E7EB !important;
}

[data-theme="dark"] .qt-pill:hover {
  background: #1E3A8A !important;
  border-color: #3B82F6 !important;
  color: #FFFFFF !important;
}

[data-theme="dark"] .chat-messages {
  background: #0B0F19 !important;
}

[data-theme="dark"] .chat-bubble-bot {
  background: #1F2937 !important;
  border-color: #374151 !important;
  color: #F3F4F6 !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3) !important;
}

[data-theme="dark"] .chat-bubble-user {
  background: #881337 !important;
  color: #FFFFFF !important;
}

[data-theme="dark"] .chat-input-wrap {
  background: #111827 !important;
  border-top-color: #374151 !important;
}

[data-theme="dark"] .chat-input {
  background: #1F2937 !important;
  border-color: #374151 !important;
  color: #F9FAFB !important;
}

[data-theme="dark"] .chat-input:focus {
  border-color: #60A5FA !important;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2) !important;
}

[data-theme="dark"] .chat-link-btn {
  background: #1E3A8A !important;
  border-color: #3B82F6 !important;
  color: #DBEAFE !important;
}

[data-theme="dark"] .chat-link-btn:hover {
  background: #2563EB !important;
  color: #FFFFFF !important;
}

[data-theme="dark"] .chat-qr-btn {
  background: #1F2937 !important;
  border-color: #374151 !important;
  color: #E5E7EB !important;
}

[data-theme="dark"] .chat-qr-btn:hover {
  background: #881337 !important;
  border-color: #BE123C !important;
  color: #FFFFFF !important;
}

/* Checkpoint Stepper & Time Tags Dark Mode Readability */
.checkpoint-time-tag span {
  color: inherit !important;
}

[data-theme="dark"] .shopee-checkpoint-wrapper {
  background: #212121 !important;
  border-color: #383838 !important;
}

[data-theme="dark"] .checkpoint-step-title {
  color: #F1F1F1 !important;
}

[data-theme="dark"] .is-current .checkpoint-step-title {
  color: #60A5FA !important;
}

[data-theme="dark"] .checkpoint-signer-name {
  color: #CBD5E1 !important;
}

[data-theme="dark"] .checkpoint-time-tag.tag-signed,
[data-theme="dark"] .checkpoint-time-tag.tag-signed span {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #34D399 !important;
  border-color: rgba(52, 211, 153, 0.45) !important;
}

[data-theme="dark"] .checkpoint-time-tag.tag-current,
[data-theme="dark"] .checkpoint-time-tag.tag-current span {
  background: rgba(59, 130, 246, 0.2) !important;
  color: #60A5FA !important;
  border-color: rgba(96, 165, 250, 0.45) !important;
}

[data-theme="dark"] .checkpoint-time-tag.tag-returned,
[data-theme="dark"] .checkpoint-time-tag.tag-returned span {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #F87171 !important;
  border-color: rgba(248, 113, 113, 0.45) !important;
}

[data-theme="dark"] .checkpoint-time-tag.tag-waiting,
[data-theme="dark"] .checkpoint-time-tag.tag-waiting span {
  background: rgba(148, 163, 184, 0.15) !important;
  color: #94A3B8 !important;
  border-color: rgba(148, 163, 184, 0.3) !important;
}

/* Success Page Styling */
.success-project-info-card {
  background: linear-gradient(135deg, #EFF6FF 0%, #F0FDF4 100%);
  border: 1px solid #BFDBFE;
}

.status-pending-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #FEF3C7;
  border: 1px solid #F59E0B;
  padding: 10px 20px;
  border-radius: 99px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #92400E;
  margin-bottom: 28px;
}

[data-theme="dark"] .success-project-info-card {
  background: linear-gradient(135deg, #162436 0%, #152A20 100%) !important;
  border-color: #2D4868 !important;
  color: #F1F1F1 !important;
}

[data-theme="dark"] .status-pending-badge {
  background-color: #2D2214 !important;
  color: #FCD34D !important;
  border-color: #78350F !important;
}

[data-theme="dark"] .step-circle-inactive {
  background-color: #2D3748 !important;
  color: #A0AEC0 !important;
}

[data-theme="dark"] .step-text-inactive {
  color: #A0AEC0 !important;
}

/* Wizard stepper: สี primary ของ Dark mode เป็นขาว จึงต้องกำหนดสีขั้นที่ผ่านแล้ว
   แยกต่างหาก เพื่อให้ตัวเลขไม่กลืนกับพื้นวงกลม */
[data-theme="dark"] .step-node:not(.active):not(.completed) .step-circle {
  background: #303030;
  border-color: #6B7280;
  color: #E5E7EB;
}

[data-theme="dark"] .step-node.completed .step-circle {
  background: #2563EB;
  border-color: #60A5FA;
  color: #FFFFFF;
}

[data-theme="dark"] .step-node.active .step-circle {
  background: #0B78D0;
  border-color: #7DD3FC;
  color: #FFFFFF;
  box-shadow: 0 0 0 4px rgba(62, 166, 255, 0.24);
}

[data-theme="dark"] .step-node.active .step-label {
  color: #F1F5F9;
}

/* ฟอร์มเสนอโครงการ: ส่วนที่สร้างด้วย JavaScript ต้องใช้สี Dark mode โดยตรง
   เพราะ inline background จาก template จะเกิดขึ้นหลังโหลดหน้า */
[data-theme="dark"] #sub-stepper-container {
  background: #181818 !important;
  border-color: #383838 !important;
}

[data-theme="dark"] #sub-stepper-container > div:first-child,
[data-theme="dark"] #sub-stepper-container .step-label {
  color: #CBD5E1 !important;
}

[data-theme="dark"] .budget-group,
[data-theme="dark"] .signature-form-card {
  background: #181818 !important;
  border-color: #383838 !important;
  color: #F1F5F9 !important;
}

[data-theme="dark"] .signature-form-card label,
[data-theme="dark"] .signature-form-card .form-label,
[data-theme="dark"] .signature-form-card strong {
  color: #F1F5F9 !important;
}

[data-theme="dark"] .signature-form-card .signature-card-header {
  border-bottom-color: #383838 !important;
}

[data-theme="dark"] .signature-form-card .signature-seq-badge {
  background: #2563EB !important;
  color: #FFFFFF !important;
}

[data-theme="dark"] .signature-form-card .signature-seq-counter {
  background: #303030 !important;
  color: #CBD5E1 !important;
}

[data-theme="dark"] .roadmap-step-title-warn {
  color: #FBBF24 !important;
}

/* ================================================================
   KPI Summary Stat Cards & Tables (Light & Dark Mode)
   ================================================================ */

.kpi-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-stat-card .kpi-label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  display: block;
}

.kpi-stat-card .kpi-value {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.2;
}

.kpi-stat-card .kpi-value-unit {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-muted);
}

.kpi-stat-card .kpi-subtext {
  font-size: 0.78rem;
  margin-top: 5px;
  color: var(--text-muted);
}

/* Card Variants (Light Mode) */
.kpi-stat-card.kpi-total {
  border-left: 4px solid #3B82F6;
}
.kpi-stat-card.kpi-total .kpi-label {
  color: var(--text-muted);
}
.kpi-stat-card.kpi-total .kpi-value {
  color: #1E3A8A;
}

.kpi-stat-card.kpi-completed {
  border-left: 4px solid #10B981;
}
.kpi-stat-card.kpi-completed .kpi-label {
  color: #065F46;
}
.kpi-stat-card.kpi-completed .kpi-value {
  color: #059669;
}
.kpi-stat-card.kpi-completed .kpi-subtext {
  color: #059669;
  font-weight: 600;
}

.kpi-stat-card.kpi-inprogress {
  border-left: 4px solid #F59E0B;
}
.kpi-stat-card.kpi-inprogress .kpi-label {
  color: #92400E;
}
.kpi-stat-card.kpi-inprogress .kpi-value {
  color: #D97706;
}

.kpi-stat-card.kpi-notstarted {
  border-left: 4px solid #94A3B8;
}
.kpi-stat-card.kpi-notstarted .kpi-label {
  color: #475569;
}
.kpi-stat-card.kpi-notstarted .kpi-value {
  color: #64748B;
}

.kpi-stat-card.kpi-budget {
  border-left: 4px solid #8B5CF6;
}
.kpi-stat-card.kpi-budget .kpi-label {
  color: #5B21B6;
}
.kpi-stat-card.kpi-budget .kpi-value {
  color: #6D28D9;
}

/* KPI Cards (Dark Mode Overrides) */
[data-theme="dark"] .kpi-stat-card {
  background: #212121 !important;
  border-color: #383838 !important;
}

[data-theme="dark"] .kpi-stat-card.kpi-total {
  border-left-color: #60A5FA !important;
}
[data-theme="dark"] .kpi-stat-card.kpi-total .kpi-label {
  color: #93C5FD !important;
}
[data-theme="dark"] .kpi-stat-card.kpi-total .kpi-value {
  color: #60A5FA !important;
}
[data-theme="dark"] .kpi-stat-card.kpi-total .kpi-subtext,
[data-theme="dark"] .kpi-stat-card.kpi-total .kpi-value-unit {
  color: #94A3B8 !important;
}

[data-theme="dark"] .kpi-stat-card.kpi-completed {
  border-left-color: #34D399 !important;
}
[data-theme="dark"] .kpi-stat-card.kpi-completed .kpi-label {
  color: #6EE7B7 !important;
}
[data-theme="dark"] .kpi-stat-card.kpi-completed .kpi-value {
  color: #34D399 !important;
}
[data-theme="dark"] .kpi-stat-card.kpi-completed .kpi-subtext {
  color: #34D399 !important;
}
[data-theme="dark"] .kpi-stat-card.kpi-completed .kpi-value-unit {
  color: #94A3B8 !important;
}

[data-theme="dark"] .kpi-stat-card.kpi-inprogress {
  border-left-color: #FBBF24 !important;
}
[data-theme="dark"] .kpi-stat-card.kpi-inprogress .kpi-label {
  color: #FDE68A !important;
}
[data-theme="dark"] .kpi-stat-card.kpi-inprogress .kpi-value {
  color: #FBBF24 !important;
}
[data-theme="dark"] .kpi-stat-card.kpi-inprogress .kpi-subtext,
[data-theme="dark"] .kpi-stat-card.kpi-inprogress .kpi-value-unit {
  color: #94A3B8 !important;
}

[data-theme="dark"] .kpi-stat-card.kpi-notstarted {
  border-left-color: #94A3B8 !important;
}
[data-theme="dark"] .kpi-stat-card.kpi-notstarted .kpi-label {
  color: #E2E8F0 !important;
}
[data-theme="dark"] .kpi-stat-card.kpi-notstarted .kpi-value {
  color: #CBD5E1 !important;
}
[data-theme="dark"] .kpi-stat-card.kpi-notstarted .kpi-subtext,
[data-theme="dark"] .kpi-stat-card.kpi-notstarted .kpi-value-unit {
  color: #94A3B8 !important;
}

[data-theme="dark"] .kpi-stat-card.kpi-budget {
  border-left-color: #A78BFA !important;
}
[data-theme="dark"] .kpi-stat-card.kpi-budget .kpi-label {
  color: #DDD6FE !important;
}
[data-theme="dark"] .kpi-stat-card.kpi-budget .kpi-value {
  color: #C084FC !important;
}
[data-theme="dark"] .kpi-stat-card.kpi-budget .kpi-subtext,
[data-theme="dark"] .kpi-stat-card.kpi-budget .kpi-value-unit {
  color: #94A3B8 !important;
}

/* Summary Table Components */
.summary-table-header {
  padding: 16px 20px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.summary-count-badge {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--border);
  padding: 2px 8px;
  border-radius: 12px;
}

.summary-badge-completed {
  display: inline-block;
  background: #D1FAE5;
  color: #065F46;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.88rem;
}

.summary-badge-inprogress {
  display: inline-block;
  background: #FEF3C7;
  color: #92400E;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.88rem;
}

.summary-badge-notstarted {
  display: inline-block;
  background: #F1F5F9;
  color: #475569;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.88rem;
}

.my-dept-row {
  background: #EFF6FF;
}

.summary-tfoot-row {
  background: #F1F5F9;
  font-weight: 700;
  border-top: 2px solid #CBD5E1;
}

.table-proj-link {
  font-weight: 600;
  color: #1E40AF;
  text-decoration: none;
  display: block;
  max-width: 270px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.45;
}

.table-proj-link:hover {
  text-decoration: underline;
}

.table-note-cell {
  max-width: 180px;
}

.table-note-text {
  display: block;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: help;
}

.table-note-text:hover {
  opacity: 0.85;
}

/* Dark Mode Table Overrides */
[data-theme="dark"] .summary-table-header {
  background: #181818 !important;
  border-bottom-color: #303030 !important;
}

[data-theme="dark"] .summary-count-badge {
  background: #333333 !important;
  color: #AAAAAA !important;
}

[data-theme="dark"] .summary-badge-completed {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #34D399 !important;
  border: 1px solid rgba(52, 211, 153, 0.35);
}

[data-theme="dark"] .summary-badge-inprogress {
  background: rgba(245, 158, 11, 0.2) !important;
  color: #FBBF24 !important;
  border: 1px solid rgba(251, 191, 36, 0.35);
}

[data-theme="dark"] .summary-badge-notstarted {
  background: rgba(148, 163, 184, 0.15) !important;
  color: #CBD5E1 !important;
  border: 1px solid rgba(203, 213, 225, 0.25);
}

[data-theme="dark"] .my-dept-row {
  background: rgba(59, 130, 246, 0.12) !important;
}

[data-theme="dark"] .summary-tfoot-row {
  background: #181818 !important;
  border-top: 2px solid #383838 !important;
  color: #F1F1F1 !important;
}

[data-theme="dark"] .summary-tfoot-row td {
  color: #F1F1F1 !important;
}

[data-theme="dark"] .summary-tfoot-total {
  color: #60A5FA !important;
}

[data-theme="dark"] .summary-tfoot-completed {
  color: #34D399 !important;
}

[data-theme="dark"] .summary-tfoot-inprogress {
  color: #FBBF24 !important;
}

[data-theme="dark"] .summary-tfoot-notstarted {
  color: #CBD5E1 !important;
}

[data-theme="dark"] .summary-tfoot-budget {
  color: #F1F1F1 !important;
}

[data-theme="dark"] .table-proj-link {
  color: #60A5FA !important;
}

[data-theme="dark"] .budget-type-pill {
  background: #272727 !important;
  color: #CCCCCC !important;
  border: 1px solid #383838 !important;
}

[data-theme="dark"] .table-note-text {
  color: #FCD34D !important;
}

/* Stat Cards Dark Mode */
[data-theme="dark"] .stat-card {
  background: #212121 !important;
  border-color: #383838 !important;
}

[data-theme="dark"] .stat-val {
  color: #F1F1F1 !important;
}

[data-theme="dark"] .stat-label {
  color: #AAAAAA !important;
}

/* Uniform Status Badges in Tables (Compact Thai-only) */
.badge-status-pill {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0 !important;
  padding: 3px 8px !important;
  border-radius: 99px !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  min-width: 82px !important;
  width: auto !important;
  max-width: 105px !important;
  box-sizing: border-box !important;
  text-align: center !important;
  white-space: nowrap !important;
}

/* Stepper Mini Progress Bars */
.stepper-mini-bar {
  background: #E2E8F0;
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

.stepper-mini-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.3s ease;
  background: var(--primary, #1B365D);
}

[data-theme="dark"] .stepper-mini-bar {
  background: #333333 !important;
}

[data-theme="dark"] .stepper-mini-fill {
  background: #38BDF8 !important;
}

[data-theme="dark"] .stepper-mini-fill[style*="#10B981"],
[data-theme="dark"] .stepper-mini-fill[style*="#065F46"],
[data-theme="dark"] .stepper-mini-fill[style*="100%"] {
  background: #34D399 !important;
}

[data-theme="dark"] #notif-badge-in-popover {
  background: rgba(245, 158, 11, 0.18) !important;
  color: #FDE68A !important;
  border: 1px solid rgba(245, 158, 11, 0.4) !important;
}

[data-theme="dark"] .popover-header {
  background-color: #181818 !important;
  border-bottom-color: #383838 !important;
}

[data-theme="dark"] .btn-mark-all-read {
  color: #38BDF8 !important;
}

[data-theme="dark"] .btn-mark-all-read:hover {
  background-color: rgba(56, 189, 248, 0.15) !important;
  color: #7DD3FC !important;
}

/* ================================================================
   Advanced Search Panel (คลังโครงการ - Project Archive)
   ================================================================ */
.advanced-search-panel {
  background: var(--bg-subtle, #F8FAFC);
  border: 1px solid var(--border, #E2E8F0);
  border-left: 4px solid var(--accent, #1B365D);
  border-radius: var(--radius-md, 10px);
  padding: 18px 20px;
  margin: 14px 20px 20px 20px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .advanced-search-panel,
[data-theme="dark"] #advanced-search-panel {
  background: #181818 !important;
  background-color: #181818 !important;
  border: 1px solid #383838 !important;
  border-left: 4px solid #3EA6FF !important;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .advanced-search-panel .adv-title,
[data-theme="dark"] #advanced-search-panel .adv-title {
  color: #FFFFFF !important;
}

[data-theme="dark"] .advanced-search-panel label,
[data-theme="dark"] #advanced-search-panel label {
  color: #F1F1F1 !important;
}

[data-theme="dark"] .advanced-search-panel .adv-helper,
[data-theme="dark"] #advanced-search-panel .adv-helper {
  color: #AAAAAA !important;
}

[data-theme="dark"] .advanced-search-panel .adv-footer,
[data-theme="dark"] #advanced-search-panel .adv-footer {
  border-top-color: #383838 !important;
}

[data-theme="dark"] .advanced-search-panel .form-control,
[data-theme="dark"] #advanced-search-panel .form-control {
  background-color: #272727 !important;
  background: #272727 !important;
  border-color: #383838 !important;
  color: #F1F1F1 !important;
}

[data-theme="dark"] .advanced-search-panel .form-control:focus,
[data-theme="dark"] #advanced-search-panel .form-control:focus {
  border-color: #3EA6FF !important;
  box-shadow: 0 0 0 2px rgba(62, 166, 255, 0.25) !important;
}

[data-theme="dark"] .btn-search,
[data-theme="dark"] a.btn-search,
[data-theme="dark"] button.btn-search {
  background: #0284C7 !important;
  border: 1px solid #38BDF8 !important;
  color: #FFFFFF !important;
}

[data-theme="dark"] .btn-search:hover,
[data-theme="dark"] a.btn-search:hover,
[data-theme="dark"] button.btn-search:hover {
  background: #0369A1 !important;
  border-color: #7DD3FC !important;
  color: #FFFFFF !important;
}

/* ================================================================
   Responsible Person Combobox & Recommendation Dropdown
   ================================================================ */
.responsible-person-combobox,
.responsible-dept-combobox {
  position: relative;
  width: 100%;
}
.responsible-person-combobox .resp-person-input,
.responsible-dept-combobox .resp-dept-input {
  cursor: pointer;
}
.responsible-person-combobox .btn-combobox-toggle,
.responsible-dept-combobox .btn-combobox-toggle {
  transition: transform 0.2s ease, color 0.15s ease;
}
.responsible-person-combobox .btn-combobox-toggle:hover,
.responsible-dept-combobox .btn-combobox-toggle:hover {
  color: var(--accent, #0284c7) !important;
}
.resp-person-dropdown-menu,
.resp-dept-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: max-content;
  min-width: 100%;
  max-width: 460px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 99999;
  padding: 4px 0;
  display: none;
}
.resp-dropdown-header {
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.resp-dropdown-header.matched-header {
  background: #EEF2FF;
  color: #3730A3;
  border-bottom: 1px solid #E0E7FF;
}
.resp-dropdown-header.other-header {
  background: var(--bg-subtle, #F8FAFC);
  color: var(--text-muted, #64748B);
  border-top: 1px solid var(--border, #E2E8F0);
  border-bottom: 1px solid var(--border, #E2E8F0);
}
.resp-dropdown-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  transition: background 0.12s ease;
}
.resp-dropdown-item:hover,
.resp-dropdown-item.focused {
  background: var(--bg-subtle, #F1F5F9);
}
.resp-dropdown-item.active {
  background: rgba(2, 132, 199, 0.08);
}
.resp-dropdown-item .staff-name {
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--text-main, #1E293B);
}
.resp-dropdown-item .staff-meta {
  font-size: 0.74rem;
  color: var(--text-muted, #64748B);
  margin-top: 2px;
}
.resp-dropdown-item .staff-tag {
  font-size: 0.7rem;
  background: var(--bg-subtle, #E2E8F0);
  color: var(--text-muted, #475569);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.resp-dropdown-item.matched-item {
  border-left: 3px solid #6366F1;
}
.resp-dropdown-empty {
  padding: 12px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted, #64748B);
  font-style: italic;
}

/* Dark theme overrides */
[data-theme="dark"] .resp-person-dropdown-menu,
[data-theme="dark"] .resp-dept-dropdown-menu {
  background: #212121;
  border-color: #383838;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
}
[data-theme="dark"] .resp-dropdown-header.matched-header {
  background: #1E1B4B;
  color: #A5B4FC;
  border-bottom-color: #312E81;
}
[data-theme="dark"] .resp-dropdown-header.other-header {
  background: #181818;
  color: #AAAAAA;
  border-color: #333333;
}
[data-theme="dark"] .resp-dropdown-item {
  border-bottom-color: #2C2C2C;
}
[data-theme="dark"] .resp-dropdown-item:hover,
[data-theme="dark"] .resp-dropdown-item.focused {
  background: #2A2A2A;
}
[data-theme="dark"] .resp-dropdown-item.active {
  background: rgba(62, 166, 255, 0.15);
}
[data-theme="dark"] .resp-dropdown-item .staff-name {
  color: #F1F1F1;
}
[data-theme="dark"] .resp-dropdown-item .staff-meta {
  color: #AAAAAA;
}
[data-theme="dark"] .resp-dropdown-item .staff-tag {
  background: #303030;
  color: #AAAAAA;
}
[data-theme="dark"] .resp-dropdown-item.matched-item {
  border-left-color: #818CF8;
}

/* ================================================================
   Comprehensive Dark Mode Palette & Contrast Overrides (SRS-v4.2)
   Fixes for admin/projects, admin/budget, admin/logs, admin/settings,
   review/signatures, projects/summary, and excel-studio.
   ================================================================ */

/* 1. Red Alert & Warning Callout Boxes (e.g. 30-Day Trash Bin, Clear Data warning) */
[data-theme="dark"] div[style*="background: #FEF2F2"],
[data-theme="dark"] div[style*="background:#FEF2F2"],
[data-theme="dark"] div[style*="background: #FEE2E2"],
[data-theme="dark"] div[style*="background:#FEE2E2"],
[data-theme="dark"] div[style*="background: #FFF5F5"],
[data-theme="dark"] div[style*="background:#FFF5F5"],
[data-theme="dark"] label[style*="background: #FFF5F5"],
[data-theme="dark"] label[style*="background:#FFF5F5"] {
  background-color: #2D1414 !important;
  border-color: #7F1D1D !important;
  color: #FCA5A5 !important;
}

[data-theme="dark"] div[style*="background: #FEF2F2"] div,
[data-theme="dark"] div[style*="background:#FEF2F2"] div,
[data-theme="dark"] div[style*="background: #FEE2E2"] div,
[data-theme="dark"] div[style*="background:#FEE2E2"] div {
  color: #FCA5A5 !important;
}

[data-theme="dark"] div[style*="background: #FEF2F2"] b,
[data-theme="dark"] div[style*="background:#FEF2F2"] b,
[data-theme="dark"] div[style*="background: #FEE2E2"] b,
[data-theme="dark"] div[style*="background:#FEE2E2"] b {
  color: #FFFFFF !important;
}

/* 2. Elevated Card Headers & Containers with var(--bg-surface-secondary) */
[data-theme="dark"] div[style*="var(--bg-surface-secondary)"],
[data-theme="dark"] form[style*="var(--bg-surface-secondary)"] {
  background: var(--bg-surface-secondary) !important;
  border-color: var(--border-color) !important;
}

/* 3. Vibrant Green Accents (#059669, #15803D, #064E3B) in Dark Mode */
[data-theme="dark"] [style*="color: #059669"],
[data-theme="dark"] [style*="color:#059669"],
[data-theme="dark"] [style*="color: #15803D"],
[data-theme="dark"] [style*="color:#15803D"],
[data-theme="dark"] [style*="color: #064E3B"],
[data-theme="dark"] [style*="color:#064E3B"] {
  color: #34D399 !important; /* Crisp light emerald */
}

/* 4. Purple Accents (#7C3AED, #7E22CE, #6B21A8) in Dark Mode */
[data-theme="dark"] [style*="color: #7C3AED"],
[data-theme="dark"] [style*="color:#7C3AED"],
[data-theme="dark"] [style*="color: #7E22CE"],
[data-theme="dark"] [style*="color:#7E22CE"],
[data-theme="dark"] [style*="color: #6B21A8"],
[data-theme="dark"] [style*="color:#6B21A8"] {
  color: #C084FC !important; /* Bright soft purple */
}

/* 5. Blue & Indigo Accents (#1E3A8A, #1D4ED8, #3730A3) in Dark Mode */
[data-theme="dark"] [style*="color: #1E3A8A"],
[data-theme="dark"] [style*="color:#1E3A8A"],
[data-theme="dark"] [style*="color: #1D4ED8"],
[data-theme="dark"] [style*="color:#1D4ED8"],
[data-theme="dark"] [style*="color: #3730A3"],
[data-theme="dark"] [style*="color:#3730A3"] {
  color: #93C5FD !important; /* Clear sky blue */
}

/* 6. Dark Red Accents (#991B1B, #7F1D1D, #B91C1C) in Dark Mode */
[data-theme="dark"] [style*="color: #991B1B"],
[data-theme="dark"] [style*="color:#991B1B"],
[data-theme="dark"] [style*="color: #7F1D1D"],
[data-theme="dark"] [style*="color:#7F1D1D"],
[data-theme="dark"] [style*="color: #B91C1C"],
[data-theme="dark"] [style*="color:#B91C1C"] {
  color: #FCA5A5 !important; /* High contrast coral red */
}

/* 7. Third-party Brand Colors (LINE & Telegram) */
[data-theme="dark"] [style*="color: #06C755"],
[data-theme="dark"] [style*="color:#06C755"] {
  color: #4ADE80 !important; /* Bright LINE green */
}

[data-theme="dark"] [style*="color: #229ED9"],
[data-theme="dark"] [style*="color:#229ED9"] {
  color: #38BDF8 !important; /* Bright Telegram blue */
}

/* 8. Badge & Pill Overrides (Indigo, Purple, Green, Yellow in Audit Trail & Status) */
[data-theme="dark"] span[style*="background: #E0E7FF"],
[data-theme="dark"] span[style*="background:#E0E7FF"],
[data-theme="dark"] .badge[style*="#E0E7FF"] {
  background: rgba(99, 102, 241, 0.22) !important;
  color: #A5B4FC !important;
  border: 1px solid rgba(99, 102, 241, 0.45) !important;
}

[data-theme="dark"] span[style*="background: rgba(124, 58, 237"],
[data-theme="dark"] span[style*="background:rgba(124, 58, 237"],
[data-theme="dark"] span[style*="background: #F3E8FF"],
[data-theme="dark"] span[style*="background:#F3E8FF"] {
  background: rgba(124, 58, 237, 0.22) !important;
  color: #C084FC !important;
  border: 1px solid rgba(124, 58, 237, 0.45) !important;
}

[data-theme="dark"] span[style*="background: #DCFCE7"],
[data-theme="dark"] span[style*="background:#DCFCE7"] {
  background: rgba(16, 185, 129, 0.22) !important;
  color: #6EE7B7 !important;
  border: 1px solid rgba(16, 185, 129, 0.45) !important;
}

[data-theme="dark"] span[style*="background: rgba(5, 150, 105"],
[data-theme="dark"] span[style*="background:rgba(5, 150, 105"] {
  background: rgba(16, 185, 129, 0.22) !important;
  color: #6EE7B7 !important;
}

[data-theme="dark"] span[style*="background: rgba(2, 132, 199"],
[data-theme="dark"] span[style*="background:rgba(2, 132, 199"] {
  background: rgba(2, 132, 199, 0.22) !important;
  color: #60A5FA !important;
}

/* 9. Tab Navigation Active Border in Dark Mode */
[data-theme="dark"] a[style*="border-bottom: 3px solid #730000"],
[data-theme="dark"] a[style*="border-bottom:3px solid #730000"] {
  border-bottom-color: #3EA6FF !important;
  color: #FFFFFF !important;
}

/* 10. Table Headers & Footers with Inline Colors */
[data-theme="dark"] th[style*="color: #1E40AF"],
[data-theme="dark"] th[style*="color:#1E40AF"],
[data-theme="dark"] td[style*="color: #1E40AF"],
[data-theme="dark"] td[style*="color:#1E40AF"] {
  color: #60A5FA !important;
}

[data-theme="dark"] th[style*="color: #065F46"],
[data-theme="dark"] th[style*="color:#065F46"],
[data-theme="dark"] td[style*="color: #065F46"],
[data-theme="dark"] td[style*="color:#065F46"] {
  color: #34D399 !important;
}

[data-theme="dark"] th[style*="color: #B45309"],
[data-theme="dark"] th[style*="color:#B45309"],
[data-theme="dark"] td[style*="color: #B45309"],
[data-theme="dark"] td[style*="color:#B45309"] {
  color: #FDE68A !important;
}

/* 11. Modal Containers with Fallback Colors */
[data-theme="dark"] div[style*="background: var(--bg-surface, #FFF)"],
[data-theme="dark"] div[style*="background:var(--bg-surface, #FFF)"],
[data-theme="dark"] div[style*="background: var(--bg-surface, #FFFFFF)"],
[data-theme="dark"] div[style*="background:var(--bg-surface, #FFFFFF)"] {
  background-color: var(--bg-surface) !important;
  border-color: var(--border) !important;
  color: var(--text-main) !important;
}

[data-theme="dark"] div[style*="background: var(--bg-subtle, #F8FAFC)"],
[data-theme="dark"] div[style*="background:var(--bg-subtle, #F8FAFC)"] {
  background-color: var(--bg-subtle) !important;
  border-color: var(--border) !important;
  color: var(--text-main) !important;
}

/* Password visibility control: preserves each existing form field's layout. */
.password-field {
  position: relative;
  display: block;
  width: 100%;
}
.password-field > input {
  padding-right: 44px !important;
}
.password-visibility-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted, #64748B);
  cursor: pointer;
}
.password-visibility-toggle:hover,
.password-visibility-toggle:focus-visible {
  background: var(--bg-subtle, #E2E8F0);
  color: var(--primary, #1B365D);
  outline: none;
}
.password-visibility-toggle:focus-visible {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .35);
}
.password-visibility-toggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
[data-theme="dark"] .password-visibility-toggle:hover,
[data-theme="dark"] .password-visibility-toggle:focus-visible {
  background: #303030;
  color: #93C5FD;
}

/* ================================================================
   Admin Projects Management & Trash Bin Theme System (Light & Dark)
   ================================================================ */

/* 1. Top KPI Stat Cards */
.kpi-card-green {
  border-left: 4px solid #059669 !important;
}
.kpi-card-green .kpi-num {
  color: #059669;
}
.kpi-card-blue {
  border-left: 4px solid #2563EB !important;
}
.kpi-card-blue .kpi-num {
  color: #2563EB;
}
.kpi-card-purple {
  border-left: 4px solid #7C3AED !important;
}
.kpi-card-purple .kpi-num {
  color: #7C3AED;
}
.kpi-card-red {
  border-left: 4px solid #DC2626 !important;
}
.kpi-card-red .kpi-num {
  color: #DC2626;
}
.kpi-card-teal {
  border-left: 4px solid #0D9488 !important;
}
.kpi-card-teal .kpi-num {
  color: #0D9488;
}

[data-theme="dark"] .kpi-card-green {
  border-left-color: #10B981 !important;
}
[data-theme="dark"] .kpi-card-green .kpi-num {
  color: #34D399 !important;
}
[data-theme="dark"] .kpi-card-blue {
  border-left-color: #3B82F6 !important;
}
[data-theme="dark"] .kpi-card-blue .kpi-num {
  color: #60A5FA !important;
}
[data-theme="dark"] .kpi-card-purple {
  border-left-color: #8B5CF6 !important;
}
[data-theme="dark"] .kpi-card-purple .kpi-num {
  color: #C084FC !important;
}
[data-theme="dark"] .kpi-card-red {
  border-left-color: #F87171 !important;
}
[data-theme="dark"] .kpi-card-red .kpi-num {
  color: #F87171 !important;
}
[data-theme="dark"] .kpi-card-teal {
  border-left-color: #14B8A6 !important;
}
[data-theme="dark"] .kpi-card-teal .kpi-num {
  color: #2DD4BF !important;
}

/* 2. Main Admin Nav Tabs */
.admin-tab-nav {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.admin-tab-item {
  padding: 10px 18px;
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}
.admin-tab-item:hover {
  color: var(--primary);
  background: rgba(0, 0, 0, 0.02);
}
.admin-tab-item.active-active {
  border-bottom-color: #2563EB;
  color: #2563EB;
}
.admin-tab-item.active-allocated {
  border-bottom-color: #059669;
  color: #059669;
}
.admin-tab-item.active-summary {
  border-bottom-color: #D97706;
  color: #D97706;
}
.admin-tab-item.active-trash {
  border-bottom-color: #DC2626;
  color: #DC2626;
}

[data-theme="dark"] .admin-tab-item.active-active {
  border-bottom-color: #60A5FA;
  color: #93C5FD;
}
[data-theme="dark"] .admin-tab-item.active-allocated {
  border-bottom-color: #34D399;
  color: #6EE7B7;
}
[data-theme="dark"] .admin-tab-item.active-summary {
  border-bottom-color: #FBBF24;
  color: #FDE68A;
}
[data-theme="dark"] .admin-tab-item.active-trash {
  border-bottom-color: #F87171;
  color: #FCA5A5;
}

.admin-tab-badge {
  font-size: 0.76rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 700;
}
.admin-tab-badge-active {
  background: rgba(37, 99, 235, 0.1);
  color: #2563EB;
}
.admin-tab-badge-allocated {
  background: rgba(5, 150, 105, 0.12);
  color: #059669;
}
.admin-tab-badge-summary {
  background: rgba(217, 119, 6, 0.12);
  color: #D97706;
}
.admin-tab-badge-trash {
  background: rgba(239, 68, 68, 0.12);
  color: #DC2626;
}

[data-theme="dark"] .admin-tab-badge-active {
  background: rgba(59, 130, 246, 0.2);
  color: #93C5FD;
}
[data-theme="dark"] .admin-tab-badge-allocated {
  background: rgba(16, 185, 129, 0.2);
  color: #6EE7B7;
}
[data-theme="dark"] .admin-tab-badge-summary {
  background: rgba(245, 158, 11, 0.2);
  color: #FDE68A;
}
[data-theme="dark"] .admin-tab-badge-trash {
  background: rgba(239, 68, 68, 0.25);
  color: #FCA5A5;
}

/* Project Segmented Sliding View Switch */
.project-view-switch {
  display: inline-flex;
  background: var(--bg-subtle, #F1F5F9);
  padding: 5px;
  border-radius: 12px;
  gap: 6px;
  align-items: center;
  border: 1px solid var(--border, #E2E8F0);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}
.project-view-btn {
  border: none;
  background: transparent;
  padding: 8px 18px;
  border-radius: 9px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted, #475569);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}
.project-view-btn:hover {
  color: var(--text-main, #0F172A);
  background: rgba(0, 0, 0, 0.04);
}
.project-view-btn.active {
  background: #8B1D1D;
  color: #FFFFFF !important;
  box-shadow: 0 3px 10px rgba(139, 29, 29, 0.25);
}
.project-view-btn .seg-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-muted, #475569);
}
.project-view-btn.active .seg-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}
[data-theme="dark"] .project-view-switch {
  background: #1E293B;
  border-color: #334155;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .project-view-btn {
  color: #94A3B8;
}
[data-theme="dark"] .project-view-btn:hover {
  color: #F8FAFC;
  background: rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] .project-view-btn.active {
  background: #991B1B;
  color: #FFFFFF !important;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .project-view-btn .seg-badge {
  background: rgba(255, 255, 255, 0.1);
  color: #CBD5E1;
}
[data-theme="dark"] .project-view-btn.active .seg-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}

/* 3. 30-Day Trash Info Banner */
.trash-info-box {
  background: #FEF2F2;
  border: 1px solid #FCA5A5;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.trash-info-title {
  font-weight: 700;
  color: #991B1B;
  font-size: 0.95rem;
}
.trash-info-desc {
  font-size: 0.84rem;
  color: #7F1D1D;
  margin-top: 2px;
  line-height: 1.45;
}

[data-theme="dark"] .trash-info-box {
  background: #251214 !important;
  border: 1px solid #7F1D1D !important;
}
[data-theme="dark"] .trash-info-title {
  color: #F87171 !important;
}
[data-theme="dark"] .trash-info-desc {
  color: #E2E8F0 !important;
}

/* 4. Trash Table Badges */
.trash-badge-deleted {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.74rem;
  font-weight: 700;
  background: #FEE2E2;
  color: #991B1B;
}
[data-theme="dark"] .trash-badge-deleted {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #FCA5A5 !important;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.trash-badge-backup {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.74rem;
  font-weight: 700;
  background: #E0E7FF;
  color: #3730A3;
}
[data-theme="dark"] .trash-badge-backup {
  background: rgba(99, 102, 241, 0.2) !important;
  color: #C7D2FE !important;
  border: 1px solid rgba(99, 102, 241, 0.4);
}

.trash-days-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 700;
}
.trash-days-green {
  color: #059669;
  background: #D1FAE5;
}
[data-theme="dark"] .trash-days-green {
  color: #34D399 !important;
  background: rgba(16, 185, 129, 0.2) !important;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.trash-days-amber {
  color: #D97706;
  background: #FEF3C7;
}
[data-theme="dark"] .trash-days-amber {
  color: #FBBF24 !important;
  background: rgba(245, 158, 11, 0.2) !important;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.trash-days-red {
  color: #DC2626;
  background: #FEE2E2;
}
[data-theme="dark"] .trash-days-red {
  color: #F87171 !important;
  background: rgba(239, 68, 68, 0.2) !important;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

/* 5. Summary Tab Badges */
.summary-badge-academic {
  background: rgba(37, 99, 235, 0.1);
  color: #1E40AF;
  font-size: 0.74rem;
  padding: 3px 8px;
  border-radius: 4px;
}
[data-theme="dark"] .summary-badge-academic {
  background: rgba(59, 130, 246, 0.2) !important;
  color: #93C5FD !important;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.summary-badge-office {
  background: rgba(217, 119, 6, 0.1);
  color: #B45309;
  font-size: 0.74rem;
  padding: 3px 8px;
  border-radius: 4px;
}
[data-theme="dark"] .summary-badge-office {
  background: rgba(245, 158, 11, 0.2) !important;
  color: #FCD34D !important;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

/* ================================================================
   Admin Settings & Timeline Announcement Cards System (Light & Dark)
   ================================================================ */

.settings-section-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  margin-bottom: 24px;
}
[data-theme="dark"] .settings-section-card {
  background: #181818 !important;
  border-color: #303030 !important;
}

.timeline-form-card {
  background: linear-gradient(135deg, #FFFDF5 0%, #FEF9E7 100%);
  border: 2px solid #F59E0B;
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.12);
  position: relative;
  transition: all 0.2s ease;
}

[data-theme="dark"] .timeline-form-card {
  background: linear-gradient(135deg, #201810 0%, #17120C 100%) !important;
  border: 2px solid #F59E0B !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6), 0 0 16px rgba(245, 158, 11, 0.15) !important;
}

.timeline-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(245, 158, 11, 0.3);
  flex-wrap: wrap;
  gap: 10px;
}

[data-theme="dark"] .timeline-card-header {
  border-bottom-color: rgba(245, 158, 11, 0.35) !important;
}

.topic-badge-primary,
.topic-badge-sub {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%) !important;
  color: #FFFFFF !important;
  border: none !important;
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  padding: 5px 12px !important;
  border-radius: 6px !important;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.35) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

[data-theme="dark"] .topic-badge-primary,
[data-theme="dark"] .topic-badge-sub {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%) !important;
  color: #0F172A !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4) !important;
}

.btn-remove-item {
  background: #FEF2F2;
  border: 1px solid #FCA5A5;
  color: #DC2626;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-remove-item:hover {
  background: #DC2626;
  color: #FFFFFF;
  border-color: #DC2626;
}

[data-theme="dark"] .btn-remove-item {
  background: #2A1215 !important;
  border: 1px solid #7F1D1D !important;
  color: #F87171 !important;
}
[data-theme="dark"] .btn-remove-item:hover {
  background: #DC2626 !important;
  color: #FFFFFF !important;
  border-color: #DC2626 !important;
}

.btn-clear-all-topics {
  background: #FEF2F2;
  border: 1px solid #FCA5A5;
  color: #DC2626;
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}
.btn-clear-all-topics:hover {
  background: #DC2626;
  color: #FFFFFF;
  border-color: #DC2626;
}

[data-theme="dark"] .btn-clear-all-topics {
  background: #2A1215 !important;
  border: 1px solid #7F1D1D !important;
  color: #F87171 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}
[data-theme="dark"] .btn-clear-all-topics:hover {
  background: #DC2626 !important;
  color: #FFFFFF !important;
  border-color: #DC2626 !important;
}

/* Department Expand / Collapse Toggle Buttons */
.btn-dept-toggle-expand,
.btn-dept-toggle-collapse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
  line-height: 1.4;
  box-shadow: var(--shadow-sm);
}

.btn-dept-toggle-expand {
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}
.btn-dept-toggle-expand:hover {
  background: #2563EB;
  color: #FFFFFF;
  border-color: #2563EB;
  transform: translateY(-1px);
}

.btn-dept-toggle-collapse {
  background: #F8FAFC;
  color: #475569;
  border: 1px solid #CBD5E1;
}
.btn-dept-toggle-collapse:hover {
  background: #475569;
  color: #FFFFFF;
  border-color: #475569;
  transform: translateY(-1px);
}

[data-theme="dark"] .btn-dept-toggle-expand {
  background: rgba(59, 130, 246, 0.16) !important;
  color: #93C5FD !important;
  border: 1px solid rgba(59, 130, 246, 0.4) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
}
[data-theme="dark"] .btn-dept-toggle-expand:hover {
  background: #2563EB !important;
  color: #FFFFFF !important;
  border-color: #3B82F6 !important;
  transform: translateY(-1px);
}

[data-theme="dark"] .btn-dept-toggle-collapse {
  background: rgba(148, 163, 184, 0.14) !important;
  color: #E2E8F0 !important;
  border: 1px solid rgba(148, 163, 184, 0.3) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
}
[data-theme="dark"] .btn-dept-toggle-collapse:hover {
  background: #475569 !important;
  color: #FFFFFF !important;
  border-color: #64748B !important;
  transform: translateY(-1px);
}

/* ================================================================
   Flatpickr 24-Hour Time Picker Styling
   ================================================================ */
.flatpickr-calendar.hasTime.noCalendar {
  width: auto;
  border-radius: var(--radius-md, 10px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-strong, #CBD5E1);
  background: var(--bg-surface, #FFFFFF);
  padding: 6px 12px;
}

.flatpickr-time {
  max-height: 48px;
  line-height: 48px;
}

.flatpickr-time input {
  font-family: 'Prompt', 'Inter', sans-serif !important;
  font-weight: 700 !important;
  font-size: 1.15rem !important;
  color: var(--text-main, #0F172A) !important;
}

.flatpickr-time .flatpickr-time-separator {
  font-weight: 700 !important;
  font-size: 1.15rem !important;
  color: var(--primary, #730000) !important;
}

.flatpickr-time .numInputWrapper span {
  border-color: var(--border, #E2E8F0) !important;
}

.flatpickr-time .numInputWrapper:hover {
  background: rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .flatpickr-calendar.hasTime.noCalendar {
  background: #1E293B !important;
  border-color: #334155 !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .flatpickr-time input {
  color: #F8FAFC !important;
  background: transparent !important;
}

[data-theme="dark"] .flatpickr-time .flatpickr-time-separator {
  color: #F87171 !important;
}

[data-theme="dark"] .flatpickr-time .numInputWrapper span {
  border-color: #475569 !important;
}

[data-theme="dark"] .flatpickr-time .numInputWrapper span:hover {
  background: #334155 !important;
}

/* Colorful Save Draft Icon & Button (Day & Night Mode) */
.icon-save-draft,
.btn-save-draft i[data-lucide="save"],
.btn-save-draft .lucide,
.btn-save-draft svg {
  color: #10B981 !important;
  stroke: #10B981 !important;
  filter: drop-shadow(0 1px 3px rgba(16, 185, 129, 0.5));
  transition: transform 0.2s ease, filter 0.2s ease;
}
.btn-save-draft {
  border-color: rgba(16, 185, 129, 0.45) !important;
}
.btn-save-draft:hover {
  border-color: #059669 !important;
  background: #F0FDF4 !important;
}
.btn-save-draft:hover .icon-save-draft,
.btn-save-draft:hover i[data-lucide="save"],
.btn-save-draft:hover .lucide,
.btn-save-draft:hover svg {
  color: #059669 !important;
  stroke: #059669 !important;
  transform: scale(1.22);
  filter: drop-shadow(0 2px 5px rgba(5, 150, 105, 0.6));
}
[data-theme="dark"] .btn-save-draft {
  border-color: rgba(52, 211, 153, 0.45) !important;
}
[data-theme="dark"] .btn-save-draft:hover {
  border-color: #34D399 !important;
  background: rgba(6, 78, 59, 0.35) !important;
}
[data-theme="dark"] .icon-save-draft,
[data-theme="dark"] .btn-save-draft i[data-lucide="save"],
[data-theme="dark"] .btn-save-draft .lucide,
[data-theme="dark"] .btn-save-draft svg {
  color: #34D399 !important;
  stroke: #34D399 !important;
  filter: drop-shadow(0 0 6px rgba(52, 211, 153, 0.75));
}
[data-theme="dark"] .btn-save-draft:hover .icon-save-draft,
[data-theme="dark"] .btn-save-draft:hover i[data-lucide="save"],
[data-theme="dark"] .btn-save-draft:hover .lucide,
[data-theme="dark"] .btn-save-draft:hover svg {
  color: #6EE7B7 !important;
  stroke: #6EE7B7 !important;
  transform: scale(1.22);
  filter: drop-shadow(0 0 10px rgba(110, 231, 183, 0.9));
}

/* Procedure Row & Evaluation Method Validation Highlight */
tr.voc-procedure-row.wizard-validation-error td {
  background-color: #FEF2F2 !important;
  border-top: 2px solid #DC2626 !important;
  border-bottom: 2px solid #DC2626 !important;
}
tr.voc-procedure-row.wizard-validation-error td:first-child {
  border-left: 2px solid #DC2626 !important;
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}
tr.voc-procedure-row.wizard-validation-error td:last-child {
  border-right: 2px solid #DC2626 !important;
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}
.evaluation-method-row.wizard-validation-error {
  border: 2px solid #DC2626 !important;
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  background: #FEF2F2 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15) !important;
}

/* ================================================================
   Responsive Overrides for Sidebar & Horizontal Sub-Navbar
   ================================================================ */
@media (max-width: 1024px) {
  .app-sidebar {
    transform: translateX(-100%) !important;
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.45) !important;
  }

  .app-sidebar.sidebar-expanded,
  .app-sidebar.mobile-open {
    transform: translateX(0) !important;
  }

  .app-main {
    margin-left: 0 !important;
  }

  .app-subnavbar {
    padding: 0 14px;
  }
}

@media (max-width: 768px) {
  .app-header {
    padding: 0 14px;
  }
  .app-subnavbar {
    padding: 0 10px;
    height: auto;
    min-height: 68px;
  }
  .subnav-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 6px 0;
  }
  .subnav-tabs-wrapper {
    width: 100%;
  }
  .subnav-tab-pane.active {
    gap: 8px;
  }
  .subnav-tab {
    min-height: 54px;
    padding: 12px 14px;
    font-size: 0.98rem;
  }
}

/* ================================================================
   Dark Mode High-Contrast & Theme Uniformity Overrides (SRS-v4.3)
   Fixes Dashboard Overview White Container, Stat Cards, Banner Buttons
   ================================================================ */

/* 1. Dashboard Overview Main Container in Dark Mode */
[data-theme="dark"] .dashboard-project-overview {
  background: #181818 !important;
  border-color: #333333 !important;
  border-top-color: #3B82F6 !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .dashboard-summary-panel {
  background: transparent !important;
}

/* 2. Dashboard Headings & Labels in Dark Mode */
[data-theme="dark"] .dashboard-list-summary-heading h2,
[data-theme="dark"] .archive-page-heading h1 {
  color: #F8FAFC !important;
}

[data-theme="dark"] .dashboard-list-summary-heading span,
[data-theme="dark"] .archive-page-heading p {
  color: #94A3B8 !important;
}

[data-theme="dark"] .dashboard-summary-year {
  background: #262626 !important;
  color: #E2E8F0 !important;
  border: 1px solid #404040 !important;
}

/* 3. Stat Cards Background & High-Contrast Colors in Dark Mode */
[data-theme="dark"] .stat-card {
  background: #242424 !important;
  border: 1px solid #383838 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
}

[data-theme="dark"] .stat-card:hover {
  border-color: #525252 !important;
  background: #2A2A2A !important;
}

[data-theme="dark"] .stat-label {
  color: #CBD5E1 !important;
}

/* Override inline colors for stat values in Dark Mode */
[data-theme="dark"] .stat-val {
  color: #F8FAFC !important;
}

[data-theme="dark"] .stat-val[style*="#B45309"],
[data-theme="dark"] .stat-val[style*="rgb(180, 83, 9)"] {
  color: #FBBF24 !important; /* Bright Amber for Pending */
}

[data-theme="dark"] .stat-val[style*="#065F46"],
[data-theme="dark"] .stat-val[style*="rgb(6, 95, 70)"] {
  color: #34D399 !important; /* Bright Emerald Green for Approved */
}

[data-theme="dark"] .stat-val[style*="#0369A1"],
[data-theme="dark"] .stat-val[style*="rgb(3, 105, 161)"] {
  color: #38BDF8 !important; /* Bright Sky Blue for Executing */
}

[data-theme="dark"] .stat-val[style*="#4338CA"],
[data-theme="dark"] .stat-val[style*="rgb(67, 56, 202)"] {
  color: #A78BFA !important; /* Bright Violet for Completed */
}

/* Stat Card Icon Wrappers in Dark Mode */
[data-theme="dark"] .stat-card .stat-icon {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #F8FAFC !important;
}

[data-theme="dark"] .stat-card .stat-icon[style*="rgba(245, 158, 11"] {
  background: rgba(245, 158, 11, 0.25) !important;
  color: #FDE68A !important;
}

[data-theme="dark"] .stat-card .stat-icon[style*="rgba(16, 185, 129"] {
  background: rgba(16, 185, 129, 0.25) !important;
  color: #6EE7B7 !important;
}

[data-theme="dark"] .stat-card .stat-icon[style*="rgba(2, 132, 199"] {
  background: rgba(2, 132, 199, 0.25) !important;
  color: #7DD3FC !important;
}

[data-theme="dark"] .stat-card .stat-icon[style*="rgba(99, 102, 241"] {
  background: rgba(99, 102, 241, 0.25) !important;
  color: #C084FC !important;
}

/* 4. Top Red Banner Notification Box Styling in Light & Dark Modes */
.dashboard-message-box {
  background: rgba(255, 255, 255, 0.16) !important;
  color: #FFFFFF !important;
  border: 1px solid rgba(255, 255, 255, 0.32) !important;
  backdrop-filter: blur(4px);
  transition: all 0.2s ease !important;
}

.dashboard-message-box:hover,
.dashboard-message-box:focus-visible {
  background: rgba(255, 255, 255, 0.28) !important;
  color: #FFFFFF !important;
  border-color: #D4AF37 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
  transform: translateY(-1px) !important;
}

/* 5. Timeline Banner Buttons in Dark Mode */
[data-theme="dark"] .btn-timeline-detail {
  background: #1E3A8A !important;
  color: #FFFFFF !important;
  border: 1px solid #3B82F6 !important;
}

[data-theme="dark"] .btn-timeline-detail:hover {
  background: #2563EB !important;
  color: #FFFFFF !important;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4) !important;
}

/* 6. Form Controls and Filter Inputs in Dark Mode */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] select,
[data-theme="dark"] input[type="text"]:not(.dept-multi-input),
[data-theme="dark"] input[type="search"] {
  background-color: #242424 !important;
  color: #F1F5F9 !important;
  border-color: #404040 !important;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] input:focus:not(.dept-multi-input) {
  background-color: #1E1E1E !important;
  border-color: #38BDF8 !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25) !important;
}

/* Final dashboard announcement palette overrides: these follow the selected status colour. */
[data-theme="dark"] .timeline-banner.timeline-color-info, [data-theme="dark"] .timeline-banner.timeline-color-warning, [data-theme="dark"] .timeline-banner.timeline-color-danger, [data-theme="dark"] .timeline-banner.timeline-color-success, [data-theme="dark"] .timeline-banner.timeline-color-primary { background: linear-gradient(135deg, var(--timeline-bg-start), var(--timeline-bg-end)) !important; border-color: var(--timeline-border) !important; border-left-color: var(--timeline-accent) !important; }
[data-theme="dark"] .timeline-banner.timeline-color-info .timeline-title, [data-theme="dark"] .timeline-banner.timeline-color-warning .timeline-title, [data-theme="dark"] .timeline-banner.timeline-color-danger .timeline-title, [data-theme="dark"] .timeline-banner.timeline-color-success .timeline-title, [data-theme="dark"] .timeline-banner.timeline-color-primary .timeline-title { color: var(--timeline-title-color) !important; }
[data-theme="dark"] .timeline-banner.timeline-color-info .timeline-desc, [data-theme="dark"] .timeline-banner.timeline-color-warning .timeline-desc, [data-theme="dark"] .timeline-banner.timeline-color-danger .timeline-desc, [data-theme="dark"] .timeline-banner.timeline-color-success .timeline-desc, [data-theme="dark"] .timeline-banner.timeline-color-primary .timeline-desc, [data-theme="dark"] .timeline-banner.timeline-color-info .timeline-meta, [data-theme="dark"] .timeline-banner.timeline-color-warning .timeline-meta, [data-theme="dark"] .timeline-banner.timeline-color-danger .timeline-meta, [data-theme="dark"] .timeline-banner.timeline-color-success .timeline-meta, [data-theme="dark"] .timeline-banner.timeline-color-primary .timeline-meta { color: var(--timeline-text-color) !important; }

/* ==========================================================================
   Sticky / Floating Horizontal Scrollbar for Data Tables
   ========================================================================== */
.table-floating-scrollbar {
  position: fixed;
  bottom: 0;
  z-index: 95;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border, #E2E8F0);
  border-left: 1px solid var(--border, #E2E8F0);
  border-right: 1px solid var(--border, #E2E8F0);
  border-radius: 10px 10px 0 0;
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.1), 0 -1px 3px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  transform: translateY(100%);
  transition: opacity 0.2s ease, transform 0.2s ease;
  user-select: none;
}

.table-floating-scrollbar.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.floating-scroll-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.floating-scroll-hint {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted, #64748B);
  white-space: nowrap;
  letter-spacing: 0.2px;
}

.floating-scroll-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 24px;
  background: var(--bg-surface, #FFFFFF);
  border: 1px solid var(--border, #CBD5E1);
  border-radius: 6px;
  color: var(--text-main, #334155);
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.floating-scroll-btn:hover:not(:disabled) {
  background: var(--primary, #2563EB);
  color: #FFFFFF;
  border-color: var(--primary, #2563EB);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

.floating-scroll-btn:active:not(:disabled) {
  transform: scale(0.92);
}

.floating-scroll-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  box-shadow: none;
}

.floating-scroll-track {
  flex: 1;
  min-width: 60px;
  height: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.05);
}

/* Custom Scrollbar for Floating Track */
.floating-scroll-track::-webkit-scrollbar {
  height: 12px;
}

.floating-scroll-track::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 6px;
}

.floating-scroll-track::-webkit-scrollbar-thumb {
  background: #94A3B8;
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: content-box;
  transition: background 0.15s ease;
}

.floating-scroll-track::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

.floating-scroll-dummy {
  height: 1px;
}

/* Enhanced native .table-responsive scrollbars */
.table-responsive {
  scrollbar-width: thin;
  scrollbar-color: #94A3B8 rgba(0, 0, 0, 0.04);
}

.table-responsive::-webkit-scrollbar {
  height: 12px;
}

.table-responsive::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.03);
  border-radius: 6px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: #94A3B8;
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Lift scroll-to-top button slightly when floating scrollbar is visible */
body.has-floating-scrollbar .btn-scroll-top {
  bottom: 46px;
}

/* Dark Mode Overrides */
[data-theme="dark"] .table-floating-scrollbar {
  background: rgba(24, 24, 27, 0.95);
  border-color: rgba(63, 63, 70, 0.85);
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.45), 0 -1px 3px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .floating-scroll-btn {
  background: #27272A;
  border-color: rgba(255, 255, 255, 0.15);
  color: #E4E4E7;
}

[data-theme="dark"] .floating-scroll-btn:hover:not(:disabled) {
  background: var(--primary, #3B82F6);
  border-color: var(--primary, #3B82F6);
  color: #FFFFFF;
}

[data-theme="dark"] .floating-scroll-track {
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .floating-scroll-track::-webkit-scrollbar-track,
[data-theme="dark"] .table-responsive::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .floating-scroll-track::-webkit-scrollbar-thumb,
[data-theme="dark"] .table-responsive::-webkit-scrollbar-thumb {
  background: #64748B;
}

[data-theme="dark"] .floating-scroll-track::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .table-responsive::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

@media (max-width: 640px) {
  .floating-scroll-hint {
    display: none;
  }
}


