/* ============================================================================
 * Official Travel & Student Field Trip Management System (CMTC Travel)
 * Executive Thai E-Government Design System (PC & Mobile Responsive)
 * ============================================================================ */

:root {
  /* Tier 1 & 2: Brand & Semantic Tokens */
  --app-primary: #0f3d75;
  --app-primary-hover: #0a2d59;
  --app-primary-dark: #08203e;
  --app-primary-mid: #164e91;
  --app-accent: #d4a33b;
  --app-accent-soft: #fef7e6;

  --app-bg: #f3f6fb;
  --app-surface: #ffffff;
  --app-surface-subtle: #f8fafd;
  --app-border: #e2e8f0;
  --app-border-strong: #cbd5e1;
  --app-text: #0f172a;
  --app-text-secondary: #475569;
  --app-muted: #64748b;

  /* Soft Semantic Tints */
  --tint-blue-bg: #eff6ff;
  --tint-blue-fg: #1d4ed8;
  --tint-emerald-bg: #ecfdf5;
  --tint-emerald-fg: #047857;
  --tint-amber-bg: #fffbeb;
  --tint-amber-fg: #b45309;
  --tint-rose-bg: #fff1f2;
  --tint-rose-fg: #be123c;
  --tint-cyan-bg: #ecfeff;
  --tint-cyan-fg: #0e7490;

  /* Layout & Touch Ergonomics */
  --sidebar-width: 17.25rem;
  --sidebar-collapsed-width: 4.85rem;
  --navbar-height: 4.25rem;
  --bottom-nav-height: 4.5rem;
  --target-size: 24px;
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -14px rgba(15, 23, 42, 0.12);
  --shadow-card-hover: 0 4px 12px rgba(15, 23, 42, 0.06), 0 14px 30px -12px rgba(15, 23, 42, 0.16);

  /* Align Bootstrap 5.3 Variables with Brand Tokens */
  --bs-primary: #0f3d75;
  --bs-primary-rgb: 15, 61, 117;
  --bs-link-color: #0f3d75;
  --bs-link-hover-color: #0a2d59;
  --bs-body-font-family: 'Noto Sans Thai', 'Sarabun', system-ui, -apple-system, sans-serif;
  --bs-body-color: var(--app-text);
  --bs-body-bg: var(--app-bg);
  --bs-border-color: var(--app-border);
  --bs-border-radius: 0.625rem;
  --bs-border-radius-lg: 1rem;
}

@media (pointer: coarse) {
  :root {
    --target-size: 44px;
  }
}

html {
  min-block-size: 100dvh;
  scroll-padding-top: calc(var(--navbar-height) + 1rem);
  scroll-padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 1rem);
}

body {
  margin: 0;
  min-block-size: 100dvh;
  background-color: var(--app-bg);
  color: var(--app-text);
  font-family: var(--bs-body-font-family);
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

img,
video {
  max-inline-size: 100%;
  block-size: auto;
}

:where(a, code) {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

p,
li {
  text-wrap: pretty;
}

.tabular-nums,
table td.text-end,
.kpi-value {
  font-variant-numeric: tabular-nums;
}

/* Minimum touch target ergonomics */
:where(button, select, textarea, input:not([type="checkbox"], [type="radio"]), [role="button"], nav a) {
  min-block-size: var(--target-size);
}

/* Responsive fluid typography (max <= 2.5x min for WCAG 1.4.4) */
.app-page-title {
  font-size: clamp(1.125rem, 0.95rem + 0.85vw, 1.55rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--app-text);
  margin: 0;
}

/* Skip link for keyboard accessibility */
.skip-link {
  position: fixed;
  inset-block-start: -100%;
  inset-inline-start: 1rem;
  z-index: 2000;
  padding: 0.625rem 1rem;
  background: var(--app-primary);
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus-visible {
  inset-block-start: 1rem;
}

/* ============================================================================
 * App Shell (Desktop: Collapsible Sidebar + Main | Mobile: Sticky Top + Bottom Nav)
 * ============================================================================ */
.app-shell {
  display: grid;
  grid-template-columns: 1fr;
  min-block-size: 100dvh;
}

.min-w-0 {
  min-inline-size: 0;
}

/* Frosted Glass Top Navbar */
.app-navbar {
  position: sticky;
  inset-block-start: 0;
  z-index: 1020;
  min-block-size: var(--navbar-height);
  max-inline-size: 100%;
  padding-block: 0.5rem;
  padding-inline: max(1rem, env(safe-area-inset-left, 0px)) max(1rem, env(safe-area-inset-right, 0px));
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-block-end: 1px solid var(--app-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.app-navbar-left {
  flex: 1 1 0%;
  min-inline-size: 0;
  overflow: hidden;
}

.app-navbar-username {
  max-inline-size: 10.5rem;
}

.app-brand-mark {
  inline-size: 2.4rem;
  block-size: 2.4rem;
  border-radius: 0.7rem;
  background: linear-gradient(135deg, var(--app-accent) 0%, #b5821f 100%);
  color: #08203e;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 12px rgba(212, 163, 59, 0.3);
  flex-shrink: 0;
}

.user-avatar-chip {
  inline-size: 2rem;
  block-size: 2rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--app-primary) 0%, var(--app-primary-mid) 100%);
  color: #fff;
  display: inline-grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.navbar-icon-btn {
  inline-size: 2.5rem;
  block-size: 2.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--app-border);
  background: var(--app-surface);
  color: var(--app-text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.navbar-icon-btn:hover:not(:disabled) {
  background: var(--tint-blue-bg);
  color: var(--app-primary);
  border-color: #bfdbfe;
}

/* Desktop Collapsible Sidebar */
.app-sidebar {
  display: none;
}

@media (min-width: 992px) {
  .app-shell {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    transition: grid-template-columns 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .app-shell.is-sidebar-collapsed {
    grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
  }

  .app-sidebar {
    position: sticky;
    inset-block-start: 0;
    block-size: 100dvh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--app-primary-dark) 0%, var(--app-primary) 65%, var(--app-primary-mid) 100%);
    color: #e2e8f0;
    border-inline-end: 1px solid rgba(255, 255, 255, 0.08);
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
  }

  .app-shell.is-sidebar-collapsed .sidebar-label,
  .app-shell.is-sidebar-collapsed .nav-count-badge,
  .app-shell.is-sidebar-collapsed .sidebar-section-title,
  .app-shell.is-sidebar-collapsed .sidebar-brand-text,
  .app-shell.is-sidebar-collapsed .sidebar-user-card {
    display: none;
  }

  .app-shell.is-sidebar-collapsed .nav-link-item {
    justify-content: center;
    padding-inline: 0.75rem;
  }

  .app-navbar {
    padding-inline: 1.75rem;
  }
}

.sidebar-header {
  min-block-size: var(--navbar-height);
  padding-inline: 1.125rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-block-end: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.sidebar-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.85);
  padding: 1.15rem 1.25rem 0.35rem;
}

.nav-menu-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.nav-link-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-md);
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-inline-start: 3px solid transparent;
  transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.nav-link-item i {
  font-size: 1.125rem;
  opacity: 0.88;
  flex-shrink: 0;
}

.nav-count-badge {
  margin-inline-start: auto;
  min-inline-size: 1.4rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(226, 232, 240, 0.8);
  flex-shrink: 0;
}

.nav-count-badge.is-active {
  background: #f59e0b;
  color: #0f172a;
}

/* Executive Budget Breakdown Bars & Sticky Report Table */
.budget-bar-track {
  inline-size: 100%;
  block-size: 0.42rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.budget-bar-fill {
  block-size: 100%;
  border-radius: 999px;
  transition: inline-size 0.3s ease;
}

/* Executive SVG Donut Chart */
.donut-chart-wrap {
  inline-size: 100%;
  max-inline-size: 220px;
  aspect-ratio: 1;
}

.donut-chart-svg {
  inline-size: 100%;
  block-size: 100%;
  filter: drop-shadow(0 6px 14px rgba(15, 23, 42, 0.08));
}

.donut-slice {
  transition: stroke-width 0.18s ease, opacity 0.18s ease;
  cursor: pointer;
}

.donut-slice:hover {
  stroke-width: 30;
  opacity: 0.92;
}

.donut-center-value {
  font-size: 2rem;
  font-weight: 800;
  fill: #0f172a;
  font-variant-numeric: tabular-nums;
}

.donut-center-label {
  font-size: 0.76rem;
  font-weight: 600;
  fill: #64748b;
}

.donut-legend-item {
  background: #ffffff;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.donut-legend-item:hover {
  background: #f8fafc;
  border-color: #cbd5e1 !important;
}

.donut-legend-dot {
  inline-size: 0.75rem;
  block-size: 0.75rem;
  border-radius: 999px;
}

/* Executive Vertical Bar Chart (Travel Purpose Types) */
.vbar-chart-scroll {
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.vbar-chart-stage {
  position: relative;
  min-inline-size: 34rem;
  padding-inline-start: 2.6rem;
  padding-block-start: 0.75rem;
}

.vbar-gridlines {
  position: absolute;
  inset-block-start: 0.75rem;
  inset-inline: 0;
  block-size: 13rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}

.vbar-gridline {
  position: relative;
  border-block-start: 1px dashed rgba(148, 163, 184, 0.35);
}

.vbar-gridline.is-base {
  border-block-start: 1.5px solid #cbd5e1;
}

.vbar-gridline span {
  position: absolute;
  inset-inline-start: 0;
  inset-block-start: -0.6rem;
  inline-size: 2.1rem;
  text-align: end;
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

.vbar-columns {
  position: relative;
  z-index: 1;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(6.5rem, 1fr);
  gap: 0.9rem;
  align-items: end;
}

.vbar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.25rem 0.35rem 0.45rem;
  border-radius: var(--radius-md);
  transition: background-color 0.16s ease, transform 0.16s ease;
}

.vbar-col:hover,
.vbar-col.is-selected {
  background: rgba(37, 99, 235, 0.05);
}

.vbar-col.is-selected {
  outline: 1.5px solid rgba(37, 99, 235, 0.35);
}

.vbar-plot-area {
  inline-size: 100%;
  block-size: 13rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 0.35rem;
}

.vbar-value-pill {
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.vbar-pillar {
  inline-size: min(3.2rem, 68%);
  border-radius: 0.55rem 0.55rem 0.15rem 0.15rem;
  background: linear-gradient(180deg, var(--bar-color) 0%, color-mix(in srgb, var(--bar-color) 72%, #0f172a) 100%);
  box-shadow: 0 6px 14px -4px color-mix(in srgb, var(--bar-color) 45%, transparent);
  transition: transform 0.18s ease, filter 0.18s ease;
}

.vbar-pillar.is-zero {
  block-size: 4px !important;
  background: #e2e8f0;
  box-shadow: none;
}

.vbar-col:hover .vbar-pillar:not(.is-zero) {
  transform: translateY(-3px);
  filter: brightness(1.06);
}

.vbar-label {
  margin-block-start: 0.65rem;
  text-align: center;
  inline-size: 100%;
}

.vbar-label-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.vbar-label-sub {
  font-size: 0.7rem;
  color: #64748b;
  margin-block-start: 0.15rem;
}

.dashboard-report-table-wrap {
  max-block-size: min(560px, 75vh);
}

.dashboard-report-table {
  border-collapse: separate;
  border-spacing: 0;
}

.dashboard-report-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
}

@media (min-width: 768px) {
  .dashboard-report-table tbody th {
    position: sticky;
    inset-inline-start: 0;
    z-index: 1;
    background: var(--app-surface, #ffffff);
  }
}

@media print {
  .app-sidebar,
  .app-navbar,
  .app-header-wrap,
  .app-page-crumb,
  .mobile-bottom-nav {
    display: none !important;
  }

  .app-shell {
    display: block !important;
  }

  .app-content {
    padding: 0 !important;
  }
}

.nav-link-item:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
}

/* Current page indicator: gradient fill + gold border + bold (WCAG 1.4.1) */
.nav-link-item[aria-current="page"] {
  background: linear-gradient(90deg, rgba(212, 163, 59, 0.22) 0%, rgba(255, 255, 255, 0.08) 100%);
  color: #ffffff;
  font-weight: 700;
  border-inline-start-color: var(--app-accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.nav-link-item[aria-current="page"] i {
  color: var(--app-accent);
  opacity: 1;
}

.sidebar-user-card {
  margin: 0.75rem;
  padding: 0.85rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-link-item:focus-visible,
.mobile-bottom-nav-item:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--app-accent);
  outline-offset: 2px;
}

/* Main Content Area */
.app-main-column {
  display: flex;
  flex-direction: column;
  min-inline-size: 0;
}

.app-content {
  flex: 1 1 auto;
  padding: 1rem;
  padding-block-end: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 1.5rem);
  container: main-content / inline-size;
  max-inline-size: 1600px;
  inline-size: 100%;
  margin-inline: auto;
}

@media (min-width: 992px) {
  .app-content {
    padding: 1.75rem 2rem 2.5rem;
  }
}

/* ============================================================================
 * Executive Hero Banner & Container-Driven KPI Cards
 * ============================================================================ */
.hero-banner {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  background: linear-gradient(125deg, var(--app-primary-dark) 0%, var(--app-primary) 55%, var(--app-primary-mid) 100%);
  color: #ffffff;
  box-shadow: 0 12px 32px -12px rgba(var(--bs-primary-rgb), 0.45);
}

.hero-banner::after {
  content: "";
  position: absolute;
  inset-block-start: -40%;
  inset-inline-end: -10%;
  inline-size: 20rem;
  block-size: 20rem;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(212, 163, 59, 0.25) 0%, transparent 70%);
  pointer-events: none;
}

@container main-content (min-width: 720px) {
  .hero-banner {
    padding: 1.75rem 2rem;
  }
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@container main-content (min-width: 520px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@container main-content (min-width: 980px) {
  .kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .kpi-grid.is-5col,
  .kpi-grid.is-6col {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@container main-content (min-width: 1180px) {
  .kpi-grid.is-5col {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.85rem;
  }
  .kpi-grid.is-6col {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
  }
  .kpi-grid.is-5col .kpi-card,
  .kpi-grid.is-6col .kpi-card {
    padding: 1.05rem;
    gap: 0.65rem;
  }
  .kpi-grid.is-5col .kpi-icon-tile,
  .kpi-grid.is-6col .kpi-icon-tile {
    inline-size: 2.55rem;
    block-size: 2.55rem;
    font-size: 1.15rem;
  }
  .kpi-grid.is-5col .kpi-value,
  .kpi-grid.is-6col .kpi-value {
    font-size: clamp(1.25rem, 1.05rem + 0.65vw, 1.55rem);
  }
}

@container main-content (min-width: 1420px) {
  .kpi-grid.is-6col {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.75rem;
  }
}

.kpi-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.kpi-icon-tile {
  inline-size: 3rem;
  block-size: 3rem;
  border-radius: 0.875rem;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.kpi-icon-tile.is-cyan { background: #ecfeff; color: #0891b2; }
.kpi-icon-tile.is-indigo { background: #eef2ff; color: #4f46e5; }
.kpi-icon-tile.is-blue { background: var(--tint-blue-bg); color: var(--tint-blue-fg); }
.kpi-icon-tile.is-amber { background: var(--tint-amber-bg); color: var(--tint-amber-fg); }
.kpi-icon-tile.is-rose { background: var(--tint-rose-bg); color: var(--tint-rose-fg); }
.kpi-icon-tile.is-emerald { background: var(--tint-emerald-bg); color: var(--tint-emerald-fg); }
.kpi-icon-tile.is-teal { background: #f0fdfa; color: #0f766e; }

.kpi-value {
  font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.85rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

/* ============================================================================
 * Modern Card, Button, Badge & Alert Refinements
 * ============================================================================ */
.card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--app-border) !important;
  box-shadow: var(--shadow-card) !important;
  overflow: hidden;
}

.card-header {
  background-color: var(--app-surface) !important;
  border-block-end: 1px solid var(--app-border);
  padding: 1rem 1.25rem;
}

.btn {
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.btn-primary {
  --bs-btn-bg: var(--app-primary);
  --bs-btn-border-color: var(--app-primary);
  --bs-btn-hover-bg: var(--app-primary-hover);
  --bs-btn-hover-border-color: var(--app-primary-hover);
  --bs-btn-active-bg: var(--app-primary-dark);
  --bs-btn-active-border-color: var(--app-primary-dark);
  background-color: var(--app-primary);
  border-color: var(--app-primary);
  box-shadow: 0 2px 6px rgba(var(--bs-primary-rgb), 0.22);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--app-primary-hover);
  border-color: var(--app-primary-hover);
  box-shadow: 0 4px 12px rgba(var(--bs-primary-rgb), 0.28);
}

.btn-outline-primary {
  --bs-btn-color: var(--app-primary);
  --bs-btn-border-color: var(--app-primary);
  --bs-btn-hover-bg: var(--app-primary);
  --bs-btn-hover-border-color: var(--app-primary);
  --bs-btn-active-bg: var(--app-primary-dark);
  --bs-btn-active-border-color: var(--app-primary-dark);
}

.badge {
  font-weight: 600;
  padding: 0.38em 0.7em;
  border-radius: 999px;
  letter-spacing: 0.01em;
}

.alert {
  border-radius: var(--radius-md);
  border-width: 1px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

/* Radio Option Cards powered natively by :has(:checked) */
.form-check.border.rounded {
  border-radius: var(--radius-md) !important;
  border: 1.5px solid var(--app-border) !important;
  background: var(--app-surface);
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
  cursor: pointer;
}

.form-check.border.rounded:has(:checked) {
  border-color: var(--app-primary) !important;
  background: var(--tint-blue-bg);
  box-shadow: 0 0 0 3px rgba(15, 61, 117, 0.1);
}

/* ============================================================================
 * Accessible Form Controls & Validation (:user-invalid, iOS 16px zoom guard)
 * ============================================================================ */
input.form-control,
select.form-select,
textarea.form-control {
  font-size: max(1rem, 1em);
  min-block-size: 44px;
  border-color: var(--app-border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--app-surface);
}

input.form-control-sm,
select.form-select-sm {
  font-size: 0.9rem;
  min-block-size: 38px;
}

input.form-control:focus,
select.form-select:focus,
textarea.form-control:focus {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 3px rgba(15, 61, 117, 0.14);
}

.form-control:is(:user-invalid, .user-invalid-fallback),
.form-select:is(:user-invalid, .user-invalid-fallback) {
  border-color: #dc2626;
  background-color: #fef2f2;
}

.field-error-msg {
  display: none;
  color: #b91c1c;
  font-size: 0.82rem;
  font-weight: 500;
  margin-block-start: 0.3rem;
}

:is(:user-invalid, .user-invalid-fallback) + .field-error-msg {
  display: block;
}

.field-hint {
  display: block;
  color: var(--app-muted);
  font-size: 0.8rem;
  margin-block-end: 0.3rem;
}

/* ============================================================================
 * 5-Step Modern Executive Official Travel Workflow Stepper
 * ============================================================================ */
.workflow-stepper-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 1.15rem;
  padding: 1.2rem 1.4rem 1.3rem;
  box-shadow: 0 8px 24px -10px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}

.wf-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.wf-head-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.wf-head-icon {
  inline-size: 2.35rem;
  block-size: 2.35rem;
  border-radius: 0.72rem;
  background: linear-gradient(135deg, var(--app-primary) 0%, #2563eb 100%);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
  box-shadow: 0 6px 14px -4px rgba(37, 99, 235, 0.4);
}

.wf-head-title {
  font-size: 0.94rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
}

.wf-head-sub {
  font-size: 0.76rem;
  color: #64748b;
  margin-top: 0.05rem;
}

.wf-progress-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  font-size: 0.77rem;
  font-weight: 700;
  color: var(--app-primary);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font-variant-numeric: tabular-nums;
}

.wf-progress-pill.is-complete {
  color: #047857;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.wf-bar-track {
  height: 5px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  margin-bottom: 1.15rem;
}

.wf-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #10b981 0%, var(--app-primary) 65%, #3b82f6 100%);
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.wf-bar-fill.is-complete {
  background: linear-gradient(90deg, #059669 0%, #10b981 100%);
}

.workflow-stepper {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.55rem;
}

.workflow-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.9rem 0.65rem 0.85rem;
  border-radius: 0.9rem;
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  color: #64748b;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

/* เส้นเชื่อมระหว่าง Badge บน Desktop */
.workflow-step::after {
  content: '';
  position: absolute;
  top: 2.05rem;
  left: calc(50% + 1.55rem);
  width: calc(100% + 0.65rem - 3.1rem);
  height: 2px;
  background: #e2e8f0;
  z-index: 1;
  pointer-events: none;
}

.workflow-step:last-child::after {
  display: none;
}

.workflow-step.is-done::after {
  background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
}

.workflow-step.is-active::after {
  background: linear-gradient(90deg, var(--app-primary) 0%, #cbd5e1 100%);
}

.workflow-step-node {
  position: relative;
  z-index: 2;
  margin-bottom: 0.6rem;
}

.workflow-step-badge {
  inline-size: 2.4rem;
  block-size: 2.4rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
  background: #f1f5f9;
  color: #64748b;
  border: 2px solid #cbd5e1;
  transition: all 0.2s ease;
}

.workflow-step-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.18rem;
  min-width: 0;
  width: 100%;
}

.workflow-step-kicker {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #94a3b8;
}

.wf-now-tag {
  padding: 0.08rem 0.45rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(37, 99, 235, 0.14);
  color: var(--app-primary);
}

.wf-done-tag {
  padding: 0.08rem 0.45rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  background: #dcfce7;
  color: #15803d;
}

.workflow-step-title {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.28;
  color: #334155;
}

.workflow-step-desc {
  font-size: 0.72rem;
  line-height: 1.32;
  color: #64748b;
}

.workflow-step.is-done {
  border-color: #a7f3d0;
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);
  color: #166534;
}

.workflow-step.is-done .workflow-step-badge {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  border-color: #10b981;
  color: #ffffff;
  box-shadow: 0 6px 14px -4px rgba(16, 185, 129, 0.42);
}

.workflow-step.is-done .workflow-step-kicker {
  color: #059669;
}

.workflow-step.is-done .workflow-step-title {
  color: #065f46;
}

.workflow-step.is-active {
  border-color: var(--app-primary);
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
  color: var(--app-primary);
  box-shadow: 0 10px 24px -10px rgba(37, 99, 235, 0.28), 0 0 0 3px rgba(37, 99, 235, 0.09);
  transform: translateY(-2px);
}

.workflow-step.is-active .workflow-step-badge {
  background: linear-gradient(135deg, var(--app-primary) 0%, #2563eb 100%);
  border-color: var(--app-primary);
  color: #ffffff;
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.16), 0 8px 16px -4px rgba(37, 99, 235, 0.45);
}

.workflow-step.is-active .workflow-step-kicker,
.workflow-step.is-active .workflow-step-title {
  color: var(--app-primary);
}

.workflow-step.is-upcoming {
  opacity: 0.86;
}

@media (max-width: 1199.98px) {
  .workflow-stepper {
    grid-template-columns: repeat(6, minmax(145px, 1fr));
    overflow-x: auto;
    padding-bottom: 0.35rem;
    scroll-snap-type: x proximity;
  }
  .workflow-step {
    scroll-snap-align: start;
  }
}

@media (max-width: 639.98px) {
  .workflow-stepper-card {
    padding: 1rem;
  }
  .workflow-stepper {
    grid-template-columns: 1fr;
    overflow-x: visible;
    gap: 0.55rem;
  }
  .workflow-step {
    flex-direction: row;
    align-items: center;
    text-align: left;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
  }
  .workflow-step::after {
    display: none;
  }
  .workflow-step-node {
    margin-bottom: 0;
  }
  .workflow-step-badge {
    inline-size: 2.15rem;
    block-size: 2.15rem;
    font-size: 0.92rem;
  }
  .workflow-step-body {
    align-items: flex-start;
  }
  .workflow-step-kicker {
    justify-content: flex-start;
  }
}

.form-check-input {
  accent-color: var(--app-primary);
}

/* ============================================================================
 * Login Split-Screen Layout
 * ============================================================================ */
.auth-page {
  min-block-size: 100dvh;
  background: radial-gradient(circle at 15% 20%, var(--app-primary-mid) 0%, var(--app-primary) 48%, var(--app-primary-dark) 100%);
  display: grid;
  place-items: center;
  padding: max(0.85rem, env(safe-area-inset-top)) 0.85rem max(1.25rem, env(safe-area-inset-bottom));
}

@media (max-width: 899.98px) {
  .auth-page {
    align-content: start;
  }
}

.auth-shell {
  inline-size: min(60rem, 100%);
  background: var(--app-surface);
  border-radius: 1.35rem;
  overflow: hidden;
  box-shadow: 0 28px 60px -16px rgba(2, 6, 23, 0.55);
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .auth-shell {
    grid-template-columns: 1.05fr 1fr;
  }
}

.auth-showcase {
  background: linear-gradient(155deg, var(--app-primary-dark) 0%, var(--app-primary) 58%, var(--app-primary-mid) 100%);
  color: #f8fafc;
  padding: 1.35rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.auth-showcase::before {
  content: "";
  position: absolute;
  inset-block-end: -25%;
  inset-inline-end: -20%;
  inline-size: 22rem;
  block-size: 22rem;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(212, 163, 59, 0.24) 0%, transparent 70%);
}

.auth-features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

@media (min-width: 480px) and (max-width: 899.98px) {
  .auth-features-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .auth-showcase {
    padding: 2.5rem;
  }
  .auth-features-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
}

.auth-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.13);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

a.auth-feature-item:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.26);
}

.auth-form-pane {
  padding: 1.5rem 1.25rem 1.5rem;
}

@media (max-width: 899.98px) {
  .auth-form-pane .form-control {
    min-block-size: 2.75rem;
    font-size: 1rem;
  }
  .auth-form-pane .btn[type="submit"] {
    min-block-size: 2.85rem;
  }
}

@media (min-width: 576px) {
  .auth-form-pane {
    padding: 2.75rem;
  }
}

/* ============================================================================
 * Mobile Swipeable Navigation Drawer (Native <dialog> + Scroll-Snap)
 * ============================================================================ */
.Drawer {
  --drawer-width: min(20rem, 84dvw, 100dvw - 24px);
  --drawer-backdrop: 0;

  inset: 0;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  overflow: visible;
}

.Drawer::backdrop {
  background: #020617;
  opacity: calc(var(--drawer-backdrop) * 0.6);
}

.Drawer-scroller {
  position: relative;
  display: grid;
  grid-template-columns: var(--drawer-width) 100%;
  overflow-x: scroll;
  overscroll-behavior: none;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
}

@media (prefers-reduced-motion: no-preference) {
  .Drawer-scroller {
    scroll-behavior: smooth;
  }
}

.Drawer-scroller::after {
  content: '';
  scroll-snap-align: end;
  scroll-initial-target: nearest;
}

.Drawer-sheet {
  display: flex;
  flex-direction: column;
  height: 100svh;
  background: linear-gradient(180deg, var(--app-primary-dark) 0%, var(--app-primary) 100%);
  color: #f8fafc;
  overflow-y: auto;
  scroll-snap-align: start;
  scrollbar-width: none;
}

@supports (animation-timeline: scroll()) {
  .Drawer {
    timeline-scope: --drawer-fade;
    animation: fade-drawer-backdrop linear both;
    animation-timeline: --drawer-fade;
  }

  .Drawer-scroller {
    scroll-timeline: --drawer-fade x;
  }

  @property --drawer-backdrop {
    syntax: '<number>';
    inherits: true;
    initial-value: 0;
  }

  @keyframes fade-drawer-backdrop {
    0% { --drawer-backdrop: 1; }
    100% { --drawer-backdrop: 0; }
  }
}

/* ============================================================================
 * Mobile Bottom Navigation Bar (< 992px)
 * ============================================================================ */
.mobile-bottom-nav {
  position: fixed;
  inset-block-end: 0;
  inset-inline: 0;
  z-index: 1030;
  min-block-size: var(--bottom-nav-height);
  padding-block-end: max(0.35rem, env(safe-area-inset-bottom, 0px));
  padding-inline: max(0.5rem, env(safe-area-inset-left, 0px)) max(0.5rem, env(safe-area-inset-right, 0px));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-block-start: 1px solid var(--app-border);
  box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

@media (min-width: 992px) {
  .mobile-bottom-nav {
    display: none;
  }
}

.mobile-bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding-block: 0.45rem;
  color: var(--app-muted);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 600;
  background: transparent;
  border: 0;
  border-block-start: 2.5px solid transparent;
  transition: color 0.15s ease;
}

.mobile-bottom-nav-item[aria-current="page"] {
  color: var(--app-primary);
  font-weight: 700;
  border-block-start-color: var(--app-primary);
}

/* ============================================================================
 * Responsive Container-Driven Table (.table-wrapper + Sticky Headers)
 * ============================================================================ */
.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  container-type: inline-size;
}

.table > thead > tr > th {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--app-text-secondary);
  background-color: var(--app-surface-subtle);
  border-block-end: 1px solid var(--app-border);
  padding-block: 0.85rem;
  white-space: nowrap;
}

.table > tbody > tr > td,
.table > tbody > tr > th {
  padding-block: 0.8rem;
  border-color: #eef2f7;
}

.responsive-stacked-table {
  border-collapse: separate;
  border-spacing: 0;
}

.responsive-stacked-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
}

.responsive-stacked-table tbody th {
  position: static;
  background: transparent;
}

@container (width < 620px) {
  .responsive-stacked-table,
  .responsive-stacked-table thead,
  .responsive-stacked-table tbody,
  .responsive-stacked-table tr,
  .responsive-stacked-table th,
  .responsive-stacked-table td {
    display: block;
    inline-size: 100%;
  }

  .responsive-stacked-table thead {
    display: none;
  }

  .responsive-stacked-table tr {
    margin: 0.75rem;
    inline-size: auto;
    border: 1px solid var(--app-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--app-surface);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  }

  .responsive-stacked-table tbody th {
    position: static;
    background: var(--app-surface-subtle);
    border-block-end: 1px solid var(--app-border);
    padding: 0.75rem 0.9rem;
  }

  .responsive-stacked-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    text-align: end !important;
    padding: 0.6rem 0.9rem;
    border-block-end: 1px solid #f1f5f9;
  }

  .responsive-stacked-table td:last-child {
    border-block-end: 0;
  }

  .responsive-stacked-table td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--app-muted);
    text-align: start;
    flex-shrink: 0;
  }
}

/* ============================================================================
 * Native Modal Dialogs (.app-modal)
 * ============================================================================ */
dialog.app-modal {
  inline-size: min(42rem, 94dvw);
  max-block-size: 90dvh;
  padding: 0;
  border: 1px solid var(--app-border);
  border-radius: var(--radius-lg);
  background: var(--app-surface);
  color: var(--app-text);
  box-shadow: 0 24px 56px -12px rgba(15, 23, 42, 0.32);
  overflow: auto;
}

dialog.app-modal.app-modal-sm {
  inline-size: min(28rem, 92dvw);
}

dialog.app-modal:modal {
  overscroll-behavior: contain;
}

dialog.app-modal::backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  overflow: hidden;
  overscroll-behavior: contain;
}

@media (forced-colors: active) {
  .nav-link-item[aria-current="page"],
  .mobile-bottom-nav-item[aria-current="page"] {
    outline: 2px solid Highlight;
  }
}

/* ============================================================================
 * Thai Buddhist Calendar Date-Time Picker (Popover API + Anchor Positioning)
 * ============================================================================ */
.thai-dt-field {
  position: relative;
}

.thai-dt-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  inline-size: 100%;
  min-block-size: 44px;
  padding: 0.5rem 0.85rem;
  font: inherit;
  font-size: max(1rem, 1em);
  color: var(--app-text);
  background-color: var(--app-surface);
  border: 1px solid var(--app-border-strong);
  border-radius: var(--radius-sm);
  text-align: start;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.thai-dt-trigger.form-control-sm {
  min-block-size: 31px;
  padding: 0.25rem 0.55rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

@media (pointer: coarse) {
  .thai-dt-trigger {
    min-block-size: 48px;
  }
}

.thai-dt-trigger:hover {
  border-color: var(--app-primary);
  background-color: #fafcff;
}

.thai-dt-trigger:focus-visible {
  outline: 2px solid var(--app-primary);
  outline-offset: 2px;
  border-color: var(--app-primary);
}

.thai-dt-trigger-main {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-inline-size: 0;
  flex: 1;
}

.thai-dt-trigger-date {
  font-weight: 600;
  color: var(--app-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thai-dt-trigger-time {
  flex-shrink: 0;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: var(--tint-blue-bg);
  color: var(--app-primary);
  font-variant-numeric: tabular-nums;
}

[popover].thai-cal-popover:is(:popover-open, .\:popover-open) {
  display: block;
}

[popover].thai-cal-popover.is-fallback-open {
  display: block;
  position: absolute;
  inset-block-start: calc(100% + 0.35rem);
  inset-inline-start: 0;
  z-index: 1080;
}

[popover].thai-cal-popover {
  inline-size: min(21.5rem, 94dvw);
  padding: 0.9rem;
  border: 1px solid var(--app-border-strong);
  border-radius: var(--radius-lg);
  background: var(--app-surface);
  color: var(--app-text);
  box-shadow: 0 20px 44px -12px rgba(15, 23, 42, 0.28), 0 4px 12px rgba(15, 23, 42, 0.08);
  overflow: visible;
}

@supports (position-area: block-end) {
  [popover].thai-cal-popover {
    inset: auto;
    margin: 0.35rem 0 0 0;
    position-area: block-end span-inline-end;
    position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
  }
}

.thai-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-block-end: 0.65rem;
}

.thai-cal-nav-btn {
  inline-size: 2.15rem;
  block-size: 2.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--app-border);
  border-radius: var(--radius-sm);
  background: var(--app-surface-subtle);
  color: var(--app-text);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.thai-cal-nav-btn:hover {
  background: var(--tint-blue-bg);
  border-color: var(--app-primary);
  color: var(--app-primary);
}

.thai-cal-selects {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  min-inline-size: 0;
}

.thai-cal-select {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.3rem 0.45rem;
  min-block-size: 2.15rem;
  border: 1px solid var(--app-border-strong);
  border-radius: var(--radius-sm);
  background: var(--app-surface);
  color: var(--app-text);
  cursor: pointer;
}

.thai-cal-select.is-month {
  flex: 1.25;
  min-inline-size: 0;
}

.thai-cal-select.is-year {
  flex: 1;
  min-inline-size: 0;
}

.thai-cal-weekdays,
.thai-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.2rem;
}

.thai-cal-weekdays {
  margin-block-end: 0.3rem;
}

.thai-cal-weekday {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--app-muted);
  padding-block: 0.2rem;
}

.thai-cal-weekday.is-sun {
  color: #dc2626;
}

.thai-cal-weekday.is-sat {
  color: #4f46e5;
}

.thai-cal-day {
  block-size: 2.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--app-text);
  font-size: 0.9rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.thai-cal-day.is-sun {
  color: #b91c1c;
}

.thai-cal-day.is-sat {
  color: #4338ca;
}

.thai-cal-day:hover {
  background: var(--tint-blue-bg);
  color: var(--app-primary);
}

.thai-cal-day:focus-visible {
  outline: 2px solid var(--app-primary);
  outline-offset: 1px;
}

.thai-cal-day.is-today {
  border-color: var(--app-gold, #d4a33b);
  font-weight: 700;
}

.thai-cal-day.is-selected {
  background: var(--app-primary);
  border-color: var(--app-primary);
  color: #fff;
  font-weight: 700;
}

.thai-cal-time-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-block-start: 0.75rem;
  padding-block-start: 0.65rem;
  border-block-start: 1px solid var(--app-border);
}

.thai-cal-time-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.thai-cal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-block-start: 0.65rem;
  padding-block-start: 0.55rem;
  border-block-start: 1px solid var(--app-border);
}

/* ============================================================================
 * Travel Request Detail Page (views/travel/show.php)
 * ============================================================================ */
.detail-hero-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-top: 3px solid var(--app-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.25rem 1.5rem;
}

.detail-hero-title {
  font-size: clamp(1.05rem, 0.96rem + 0.45vw, 1.3rem);
  font-weight: 700;
  line-height: 1.45;
  color: var(--app-text);
  margin: 0.5rem 0 0.75rem;
  text-wrap: balance;
}

.detail-meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-size: 0.875rem;
  color: var(--app-text-secondary);
}

.detail-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.detail-meta-item i {
  color: var(--app-primary);
  font-size: 0.95rem;
}

.detail-action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--app-border);
}

.detail-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 0.875rem;
}

.detail-kpi-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-md);
  padding: 0.95rem 1.1rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.detail-kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--app-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.detail-kpi-value {
  font-size: clamp(1.05rem, 0.95rem + 0.4vw, 1.32rem);
  font-weight: 700;
  color: var(--app-text);
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.detail-kpi-sub {
  font-size: 0.78rem;
  color: var(--app-muted);
}

.detail-section-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.detail-section-header {
  padding: 0.95rem 1.25rem;
  background: var(--app-surface-subtle);
  border-bottom: 1px solid var(--app-border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.detail-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--app-text);
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.detail-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem 1.5rem;
}

.detail-info-item.is-full {
  grid-column: 1 / -1;
}

.detail-info-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--app-muted);
  margin-bottom: 0.2rem;
}

.detail-info-value {
  font-size: 0.9375rem;
  color: var(--app-text);
  line-height: 1.5;
}

.detail-doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.5rem 1rem;
  margin-top: 1.1rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  background: var(--app-surface-subtle);
  border: 1px solid var(--app-border);
}

.detail-doc-item {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--app-text-secondary);
}

.detail-seq-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.65rem;
  height: 1.65rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--tint-blue-bg);
  color: var(--tint-blue-fg);
  font-variant-numeric: tabular-nums;
}

.detail-seq-badge.is-student {
  background: var(--tint-cyan-bg);
  color: var(--tint-cyan-fg);
}

.detail-table {
  font-size: 0.9rem;
}

.detail-table thead th {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--app-muted);
  background: var(--app-surface-subtle);
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--app-border);
  white-space: nowrap;
}

.detail-table tbody th,
.detail-table tbody td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--app-border);
}

.detail-table tfoot td {
  padding: 0.75rem 0.9rem;
  background: var(--app-surface-subtle);
  font-size: 0.9rem;
}

.detail-timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}

.detail-timeline::before {
  content: "";
  position: absolute;
  inset-inline-start: 0.45rem;
  inset-block-start: 0.35rem;
  inset-block-end: 0.35rem;
  width: 2px;
  background: var(--app-border);
}

.detail-timeline-item {
  position: relative;
  padding-inline-start: 1.65rem;
  padding-block-end: 1rem;
}

.detail-timeline-item:last-child {
  padding-block-end: 0;
}

.detail-timeline-dot {
  position: absolute;
  inset-inline-start: 0.14rem;
  inset-block-start: 0.3rem;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--app-primary);
  border: 2px solid var(--app-surface);
  box-shadow: 0 0 0 2px var(--tint-blue-bg);
}

.detail-file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--app-surface-subtle);
  border: 1px solid var(--app-border);
  font-size: 0.85rem;
}

/* ============================================================================
 * Multi-Theme Palette Overrides (Admin Theme Settings)
 * ============================================================================ */
html[data-theme="emerald-gov"] {
  --app-primary: #065f46;
  --app-primary-hover: #044e39;
  --app-primary-dark: #022c22;
  --app-primary-mid: #047857;
  --app-accent: #d97706;
  --app-accent-soft: #fffbeb;
  --app-bg: #f2f8f5;
  --bs-primary: #065f46;
  --bs-primary-rgb: 6, 95, 70;
  --bs-link-color: #065f46;
  --bs-link-hover-color: #044e39;
}

html[data-theme="royal-indigo"] {
  --app-primary: #3730a3;
  --app-primary-hover: #2e288a;
  --app-primary-dark: #1e1b4b;
  --app-primary-mid: #4338ca;
  --app-accent: #0ea5e9;
  --app-accent-soft: #f0f9ff;
  --app-bg: #f4f5fc;
  --bs-primary: #3730a3;
  --bs-primary-rgb: 55, 48, 163;
  --bs-link-color: #3730a3;
  --bs-link-hover-color: #2e288a;
}

html[data-theme="crimson-classic"] {
  --app-primary: #881337;
  --app-primary-hover: #70102d;
  --app-primary-dark: #4c0519;
  --app-primary-mid: #9f1239;
  --app-accent: #ca8a04;
  --app-accent-soft: #fefce8;
  --app-bg: #faf5f6;
  --bs-primary: #881337;
  --bs-primary-rgb: 136, 19, 55;
  --bs-link-color: #881337;
  --bs-link-hover-color: #70102d;
}

html[data-theme="ocean-teal"] {
  --app-primary: #0f766e;
  --app-primary-hover: #115e59;
  --app-primary-dark: #042f2e;
  --app-primary-mid: #0d9488;
  --app-accent: #f59e0b;
  --app-accent-soft: #fffbeb;
  --app-bg: #f2f9f8;
  --bs-primary: #0f766e;
  --bs-primary-rgb: 15, 118, 110;
  --bs-link-color: #0f766e;
  --bs-link-hover-color: #115e59;
}

html[data-theme="obsidian-pro"] {
  --app-primary: #1e293b;
  --app-primary-hover: #0f172a;
  --app-primary-dark: #0f172a;
  --app-primary-mid: #334155;
  --app-accent: #3b82f6;
  --app-accent-soft: #eff6ff;
  --app-bg: #f4f6f8;
  --bs-primary: #1e293b;
  --bs-primary-rgb: 30, 41, 59;
  --bs-link-color: #1e293b;
  --bs-link-hover-color: #0f172a;
}

/* Theme Picker Cards */
.theme-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.theme-choice-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 2px solid var(--app-border);
  border-radius: var(--radius-md);
  background: var(--app-surface);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.theme-choice-card:hover {
  border-color: var(--app-border-strong);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.theme-choice-card.is-selected {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 4px rgba(var(--bs-primary-rgb), 0.18), 0 14px 28px -12px rgba(var(--bs-primary-rgb), 0.36);
  transform: translateY(-2px);
}

.theme-choice-card:focus-within {
  outline: 2px solid var(--app-primary);
  outline-offset: 2px;
}

.theme-choice-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-preview-check {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 2;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 999px;
  background: var(--app-primary);
  color: #ffffff;
  border: 2.5px solid #ffffff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.28);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  opacity: 0;
  transform: scale(0.65);
  transition: opacity 0.18s ease, transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.theme-choice-card.is-selected .theme-preview-check {
  opacity: 1;
  transform: scale(1);
}

.theme-selected-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  background: var(--app-primary);
  color: #ffffff;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.16s ease, transform 0.16s ease, background-color 0.16s ease;
}

.theme-choice-card.is-selected .theme-selected-indicator {
  opacity: 1;
  transform: translateY(0);
}

.theme-live-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.8rem;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  color: var(--app-text-secondary);
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.theme-live-status.is-unsaved {
  background: var(--tint-amber-bg);
  border-color: #fcd34d;
  color: var(--tint-amber-fg);
}

.theme-live-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
}

/* Native Modal Dialog Scroll Containment */
dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
}

/* Sidebar Logout Button */
.nav-link-item.is-logout {
  background: transparent;
  color: #fecdd3;
}

.nav-link-item.is-logout:hover {
  background: rgba(244, 63, 94, 0.2);
  color: #ffffff;
}

.theme-preview-frame {
  display: flex;
  height: 92px;
  border-bottom: 1px solid var(--app-border);
  overflow: hidden;
}

.theme-preview-sidebar {
  width: 30%;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.theme-preview-dot {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: block;
}

.theme-preview-line {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  width: 85%;
}

.theme-preview-line.is-short {
  width: 55%;
}

.theme-preview-body {
  flex: 1;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.theme-preview-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.theme-preview-pill {
  height: 9px;
  width: 48%;
  border-radius: 999px;
  display: inline-block;
}

.theme-preview-pill.is-accent {
  width: 24%;
}

.theme-preview-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  flex: 1;
}

.theme-preview-cards > span {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 6px;
}

.theme-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.15);
  display: inline-block;
}

/* =====================================================================
   Dashboard Official Travel Calendar & Gantt Timeline (.tcal-*)
   ===================================================================== */
.tcal-card {
  overflow: hidden;
  border-radius: var(--app-radius, 1rem);
}

.tcal-header {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  padding: 1rem 1.25rem;
}

.tcal-heading-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.6rem;
  background: color-mix(in srgb, var(--app-primary, #0b294f) 11%, transparent);
  color: var(--app-primary, #0b294f);
  font-size: 1rem;
}

.tcal-nav-group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.tcal-month-select {
  inline-size: auto;
  min-inline-size: 10.5rem;
  font-weight: 600;
}

.tcal-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.28rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.tcal-filter-pill:hover {
  border-color: var(--app-primary, #0b294f);
  color: var(--app-primary, #0b294f);
}

.tcal-filter-pill.is-active {
  background: var(--app-primary, #0b294f);
  border-color: var(--app-primary, #0b294f);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.14);
}

.tcal-filter-pill.is-active .tcal-dot {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.65);
}

.tcal-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.tcal-dot.is-step-1 { background: #0891b2; }
.tcal-dot.is-step-2 { background: #6366f1; }
.tcal-dot.is-step-3 { background: #2563eb; }
.tcal-dot.is-step-4 { background: #059669; }
.tcal-dot.is-step-5 { background: #d97706; }
.tcal-dot.is-step-6 { background: #0f766e; }

/* Month Calendar Grid */
.tcal-month-view {
  overflow-x: auto;
  background: #ffffff;
}

.tcal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.tcal-weekday {
  padding: 0.55rem 0.65rem;
  font-size: 0.76rem;
  font-weight: 700;
  text-align: center;
  color: #475569;
  letter-spacing: 0.01em;
}

.tcal-weekday.is-weekend {
  color: #dc2626;
}

.tcal-week-row {
  position: relative;
  border-bottom: 1px solid #e2e8f0;
}

.tcal-week-row:last-child {
  border-bottom: 0;
}

.tcal-week-cells {
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
  min-height: 7.4rem;
}

.tcal-day-cell {
  border-right: 1px solid #f1f5f9;
  padding: 0.4rem 0.45rem 0.45rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #ffffff;
  transition: background-color 0.15s ease;
}

.tcal-day-cell:last-child {
  border-right: 0;
}

.tcal-day-cell.is-weekend {
  background: #fafbfe;
}

.tcal-day-cell.is-outside {
  background: #f8fafc;
}

.tcal-day-cell.is-outside .tcal-day-num {
  color: #94a3b8;
  font-weight: 500;
}

.tcal-day-cell.is-today {
  background: color-mix(in srgb, var(--app-primary, #0b294f) 5%, #ffffff);
}

.tcal-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.tcal-day-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.65rem;
  height: 1.65rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #1e293b;
  font-variant-numeric: tabular-nums;
}

.tcal-day-cell.is-today .tcal-day-num {
  background: var(--app-primary, #0b294f);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.22);
}

.tcal-more-btn {
  align-self: flex-start;
  margin-top: auto;
  padding: 0.1rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--app-primary, #0b294f);
  background: color-mix(in srgb, var(--app-primary, #0b294f) 10%, #ffffff);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  position: relative;
  z-index: 3;
}

.tcal-more-btn:hover {
  background: var(--app-primary, #0b294f);
  color: #ffffff;
}

/* Multi-day spanning bars overlay inside each week row */
.tcal-week-events {
  position: absolute;
  inset: 2.15rem 0 0.3rem 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
  grid-auto-rows: 1.5rem;
  row-gap: 0.22rem;
  pointer-events: none;
  z-index: 2;
}

.tcal-event-bar {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0.22rem;
  padding: 0 0.5rem;
  height: 1.48rem;
  border: 1px solid transparent;
  border-left-width: 3px;
  border-radius: 0.38rem;
  font-size: 0.74rem;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.tcal-event-bar:hover,
.tcal-event-bar:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.14);
  z-index: 5;
  outline: 2px solid var(--app-primary, #0b294f);
  outline-offset: 1px;
}

.tcal-event-bar.is-cont-left {
  margin-left: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left-width: 1px;
}

.tcal-event-bar.is-cont-right {
  margin-right: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.tcal-event-bar.is-step-1,
.tcal-gantt-bar.is-step-1 {
  background: #ecfeff;
  border-color: #a5f3fc;
  border-left-color: #0891b2;
  color: #155e75;
}

.tcal-event-bar.is-step-2,
.tcal-gantt-bar.is-step-2 {
  background: #eef2ff;
  border-color: #c7d2fe;
  border-left-color: #6366f1;
  color: #3730a3;
}

.tcal-event-bar.is-step-3,
.tcal-gantt-bar.is-step-3 {
  background: #eff6ff;
  border-color: #bfdbfe;
  border-left-color: #2563eb;
  color: #1e40af;
}

.tcal-event-bar.is-step-4,
.tcal-gantt-bar.is-step-4 {
  background: #ecfdf5;
  border-color: #a7f3d0;
  border-left-color: #059669;
  color: #065f46;
}

.tcal-event-bar.is-step-5,
.tcal-gantt-bar.is-step-5 {
  background: #fffbeb;
  border-color: #fde68a;
  border-left-color: #d97706;
  color: #92400e;
}

.tcal-event-bar.is-step-6,
.tcal-gantt-bar.is-step-6 {
  background: #f0fdfa;
  border-color: #99f6e4;
  border-left-color: #0f766e;
  color: #115e59;
}

.tcal-event-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tcal-event-meta {
  font-weight: 500;
  opacity: 0.78;
  flex-shrink: 0;
  font-size: 0.7rem;
}

/* Gantt Timeline View */
.tcal-timeline-view {
  overflow-x: auto;
  background: #ffffff;
}

.tcal-gantt-grid {
  min-width: 920px;
}

.tcal-gantt-head,
.tcal-gantt-row {
  display: grid;
  grid-template-columns: 240px repeat(var(--tcal-days, 30), minmax(26px, 1fr));
  align-items: stretch;
  border-bottom: 1px solid #e2e8f0;
}

.tcal-gantt-head {
  background: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 4;
}

.tcal-gantt-label-col {
  position: sticky;
  left: 0;
  z-index: 3;
  background: inherit;
  border-right: 1px solid #e2e8f0;
  padding: 0.55rem 0.85rem;
  min-width: 0;
}

.tcal-gantt-row {
  background: #ffffff;
  transition: background-color 0.14s ease;
}

.tcal-gantt-row:hover {
  background: #f8fafc;
}

.tcal-gantt-row:last-child {
  border-bottom: 0;
}

.tcal-gantt-day-head {
  text-align: center;
  padding: 0.4rem 0.1rem;
  font-size: 0.7rem;
  border-right: 1px solid #f1f5f9;
  color: #475569;
  font-variant-numeric: tabular-nums;
}

.tcal-gantt-day-head.is-weekend {
  background: #fef2f2;
  color: #dc2626;
}

.tcal-gantt-day-head.is-today {
  background: var(--app-primary, #0b294f);
  color: #ffffff;
  font-weight: 700;
}

.tcal-gantt-dow {
  display: block;
  font-size: 0.62rem;
  opacity: 0.78;
}

.tcal-gantt-track {
  grid-column: 2 / -1;
  display: grid;
  grid-template-columns: repeat(var(--tcal-days, 30), minmax(26px, 1fr));
  align-items: center;
  position: relative;
  min-height: 3.15rem;
  background-image: linear-gradient(to right, #f1f5f9 1px, transparent 1px);
  background-size: calc(100% / var(--tcal-days, 30)) 100%;
}

.tcal-gantt-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin: 0 2px;
  padding: 0.25rem 0.55rem;
  height: 1.95rem;
  border: 1px solid transparent;
  border-left-width: 4px;
  border-radius: 0.45rem;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.tcal-gantt-bar:hover,
.tcal-gantt-bar:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
  outline: 2px solid var(--app-primary, #0b294f);
  outline-offset: 1px;
}

.tcal-gantt-today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: color-mix(in srgb, var(--app-primary, #0b294f) 55%, transparent);
  pointer-events: none;
  z-index: 1;
}

/* Detail Dialog */
dialog.tcal-dialog:modal {
  max-width: 36rem;
  width: calc(100% - 2rem);
  overscroll-behavior: contain;
}

dialog.tcal-dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
}

.tcal-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.tcal-detail-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.65rem;
  padding: 0.65rem 0.8rem;
}

.tcal-detail-box.is-full {
  grid-column: 1 / -1;
}

.tcal-detail-label {
  font-size: 0.73rem;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.tcal-detail-value {
  font-size: 0.88rem;
  color: #0f172a;
  font-weight: 600;
}

.tcal-agenda-item {
  width: 100%;
  text-align: left;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left-width: 4px;
  border-radius: 0.65rem;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
  transition: border-color 0.14s ease, box-shadow 0.14s ease, transform 0.12s ease;
}

.tcal-agenda-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.tcal-agenda-item.is-step-1 { border-left-color: #0891b2; }
.tcal-agenda-item.is-step-2 { border-left-color: #6366f1; }
.tcal-agenda-item.is-step-3 { border-left-color: #2563eb; }
.tcal-agenda-item.is-step-4 { border-left-color: #059669; }
.tcal-agenda-item.is-step-5 { border-left-color: #d97706; }
.tcal-agenda-item.is-step-6 { border-left-color: #0f766e; }

@media (max-width: 575.98px) {
  .tcal-detail-grid {
    grid-template-columns: 1fr;
  }
  .tcal-gantt-head,
  .tcal-gantt-row {
    grid-template-columns: 180px repeat(var(--tcal-days, 30), minmax(24px, 1fr));
  }
}

/* ============================================================================
 * Step 1 Permission Memo: Expense Claim Mode Cards & Split-Funding Builder
 * ============================================================================ */
.memo-claim-card {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 0.95rem;
  border-radius: 0.85rem;
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  cursor: pointer;
  height: 100%;
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease, transform 0.14s ease;
}

.memo-claim-card:hover {
  border-color: #93c5fd;
  background: #f8fafc;
}

.memo-claim-card-icon {
  inline-size: 2.1rem;
  block-size: 2.1rem;
  border-radius: 0.65rem;
  display: grid;
  place-items: center;
  font-size: 1rem;
  flex-shrink: 0;
  background: #f1f5f9;
  color: #475569;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.memo-claim-card.is-blue.is-selected {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
}
.memo-claim-card.is-blue.is-selected .memo-claim-card-icon {
  background: #2563eb;
  color: #ffffff;
}

.memo-claim-card.is-emerald.is-selected {
  border-color: #059669;
  background: #ecfdf5;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.12);
}
.memo-claim-card.is-emerald.is-selected .memo-claim-card-icon {
  background: #059669;
  color: #ffffff;
}

.memo-claim-card.is-amber.is-selected {
  border-color: #d97706;
  background: #fffbeb;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.14);
}
.memo-claim-card.is-amber.is-selected .memo-claim-card-icon {
  background: #d97706;
  color: #ffffff;
}

.memo-claim-card.is-slate.is-selected {
  border-color: #475569;
  background: #f8fafc;
  box-shadow: 0 4px 14px rgba(71, 85, 105, 0.12);
}
.memo-claim-card.is-slate.is-selected .memo-claim-card-icon {
  background: #475569;
  color: #ffffff;
}

.memo-split-panel {
  border-radius: 0.95rem;
  border: 1.5px solid #fde68a;
  background: linear-gradient(180deg, #fffdf5 0%, #ffffff 100%);
  padding: 1.1rem;
  box-shadow: 0 6px 18px rgba(217, 119, 6, 0.08);
}

.memo-preset-btn {
  appearance: none;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.memo-preset-btn:hover {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.memo-split-col {
  border-radius: 0.8rem;
  padding: 0.95rem;
  border: 1px solid #e2e8f0;
}

.memo-split-col.is-college {
  background: #f8fbff;
  border-color: #bfdbfe;
}

.memo-split-col.is-project {
  background: #f6fef9;
  border-color: #a7f3d0;
}

.memo-split-col-head {
  margin-bottom: 0.75rem;
}

.memo-split-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
}

.memo-split-badge.is-college {
  background: #dbeafe;
  color: #1e40af;
}

.memo-split-badge.is-project {
  background: #d1fae5;
  color: #065f46;
}

.memo-pill-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.68rem;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font-size: 0.78rem;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.memo-pill-check input {
  margin: 0;
  accent-color: #2563eb;
}

.memo-pill-check:has(input:checked) {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1e40af;
  font-weight: 600;
}

.memo-pill-check.is-emerald input {
  accent-color: #059669;
}

.memo-pill-check.is-emerald:has(input:checked) {
  background: #ecfdf5;
  border-color: #059669;
  color: #065f46;
  font-weight: 600;
}

.memo-claim-preview-box {
  background: #f8fafc;
  border: 1px dashed #94a3b8;
  border-radius: 0.75rem;
  padding: 0.75rem 0.95rem;
}

/* =====================================================================
   User Profile Avatar Upload & Camera Capture (.user-avatar-img, .avatar-*)
   ===================================================================== */
.user-avatar-chip {
  overflow: hidden;
  padding: 0;
}

.user-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}

.avatar-upload-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 0.85rem;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
}

.avatar-preview-lg {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--app-primary, #0b294f), var(--app-primary-mid, #1d4ed8));
  color: #ffffff;
  font-size: 1.65rem;
  font-weight: 700;
  border: 3px solid #ffffff;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.14);
}

.avatar-camera-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 320px;
  margin-inline: auto;
  border-radius: 0.85rem;
  overflow: hidden;
  background: #0f172a;
}

.avatar-camera-stage video,
.avatar-camera-stage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-camera-guide {
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 0 999px rgba(15, 23, 42, 0.35);
  pointer-events: none;
}

/* Modern Profile Page Layout & Cards */
.profile-hero-shell {
  background: var(--app-surface, #ffffff);
  border: 1px solid var(--app-border, #e2e8f0);
  border-radius: 1.15rem;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}

.profile-hero-banner {
  position: relative;
  min-block-size: 6.25rem;
  background:
    radial-gradient(circle at 85% 20%, rgba(255, 255, 255, 0.16) 0%, transparent 45%),
    radial-gradient(circle at 12% 85%, rgba(56, 189, 248, 0.22) 0%, transparent 50%),
    linear-gradient(135deg, var(--app-primary-dark, #0b294f) 0%, var(--app-primary, #0f3d75) 55%, var(--app-primary-mid, #1d4ed8) 100%);
}

.profile-hero-body {
  padding: 1rem 1.75rem 1.65rem;
}

.profile-hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  position: relative;
  z-index: 2;
}

.profile-identity-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.2rem;
  min-inline-size: 0;
}

.profile-avatar-frame {
  position: relative;
  flex-shrink: 0;
  margin-block-start: -3.5rem;
}

.profile-avatar-xl {
  width: 6.25rem;
  height: 6.25rem;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--app-primary, #0f3d75), var(--app-primary-mid, #1d4ed8));
  color: #ffffff;
  font-size: 2.2rem;
  font-weight: 700;
  border: 4px solid #ffffff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

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

.profile-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  padding-block-end: 0.25rem;
}

.profile-photo-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-block-start: 1rem;
  padding-block-start: 0.9rem;
  border-top: 1px solid #f1f5f9;
}

.profile-card {
  background: var(--app-surface, #ffffff);
  border: 1px solid var(--app-border, #e2e8f0);
  border-radius: 1rem;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.row > [class*="col-"] > .profile-card {
  height: 100%;
}

.profile-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid #f1f5f9;
  background: #fafcff;
}

.profile-card-title {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.profile-card-body {
  padding: 1.35rem 1.4rem;
  flex: 1;
}

.profile-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.profile-info-tile {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  border-radius: 0.8rem;
  background: #f8fafc;
  border: 1px solid #edf2f7;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.profile-info-tile:hover {
  border-color: #cbd5e1;
  background: #ffffff;
}

.profile-info-icon {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.05rem;
  background: rgba(15, 61, 117, 0.09);
  color: var(--app-primary, #0f3d75);
}

.profile-info-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.01em;
  margin-bottom: 0.15rem;
}

.profile-info-value {
  font-size: 0.92rem;
  font-weight: 600;
  color: #0f172a;
  word-break: break-word;
}

.profile-rate-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.profile-rate-box {
  padding: 0.9rem 1rem;
  border-radius: 0.85rem;
  border: 1px solid #dbeafe;
  background: linear-gradient(180deg, #f8fbff 0%, #eff6ff 100%);
}

.profile-rate-box .rate-val {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--app-primary, #0f3d75);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.profile-meta-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.profile-meta-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.84rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px dashed #e2e8f0;
}

.profile-meta-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

/* Native <dialog> scroll containment & post-interaction validation for Profile Modals */
dialog.profile-modal {
  max-inline-size: 38rem;
  inline-size: min(38rem, 94vw);
  padding: 0;
  border: 0;
  border-radius: 1rem;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
}

dialog.profile-modal.is-compact {
  max-inline-size: 31rem;
  inline-size: min(31rem, 94vw);
}

dialog.profile-modal:modal {
  overscroll-behavior: contain;
}

dialog.profile-modal::backdrop {
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(3px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.profile-modal-form :is(input:user-invalid, select:user-invalid) {
  border-color: #dc2626;
  background-color: #fef2f2;
}

.profile-modal-form :is(input:user-valid, select:user-valid) {
  border-color: #16a34a;
}

.profile-modal-form .field-error-msg {
  display: none;
  font-size: 0.78rem;
  color: #dc2626;
  margin-top: 0.25rem;
}

.profile-modal-form :is(input:user-invalid, select:user-invalid) + .field-error-msg {
  display: block;
}

@media (max-width: 575.98px) {
  .profile-hero-body {
    padding: 0 1.15rem 1.25rem;
  }
  .profile-rate-strip {
    grid-template-columns: 1fr;
  }
}

/* Modern Loan Tracking (Form 8500) UI */
.loan-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
}

.loan-kpi-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.1rem 1.25rem;
  border-radius: 1rem;
  background: var(--app-surface, #ffffff);
  border: 1px solid var(--app-border, #e2e8f0);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.loan-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.loan-kpi-card.is-active {
  border-color: var(--app-primary, #0f3d75);
  box-shadow: 0 0 0 3px rgba(15, 61, 117, 0.12);
}

.loan-kpi-card.tone-danger {
  border-inline-start: 4px solid #dc2626;
}

.loan-kpi-card.tone-warning {
  border-inline-start: 4px solid #f59e0b;
}

.loan-kpi-card.tone-primary {
  border-inline-start: 4px solid #2563eb;
}

.loan-kpi-card.tone-success {
  border-inline-start: 4px solid #16a34a;
}

.loan-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.loan-kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
}

.loan-kpi-icon {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.loan-kpi-icon.is-danger { background: #fef2f2; color: #dc2626; }
.loan-kpi-icon.is-warning { background: #fffbeb; color: #d97706; }
.loan-kpi-icon.is-primary { background: #eff6ff; color: #2563eb; }
.loan-kpi-icon.is-success { background: #f0fdf4; color: #16a34a; }

.loan-kpi-value {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
}

.loan-kpi-sub {
  font-size: 0.76rem;
  color: #64748b;
  font-variant-numeric: tabular-nums;
}

.loan-alert-banner {
  border-radius: 1rem;
  padding: 0.95rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid #fde68a;
  background: linear-gradient(90deg, #fffbeb 0%, #fef3c7 100%);
  color: #78350f;
}

.loan-alert-banner.is-overdue {
  border-color: #fecaca;
  background: linear-gradient(90deg, #fef2f2 0%, #fee2e2 100%);
  color: #7f1d1d;
}

.loan-countdown-cell {
  min-inline-size: 11.5rem;
}

.loan-countdown-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.loan-countdown-pill.is-normal {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.loan-countdown-pill.is-near-due {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fcd34d;
}

.loan-countdown-pill.is-overdue {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.loan-countdown-pill.is-settled {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.loan-countdown-track {
  height: 6px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  margin-top: 0.4rem;
}

.loan-countdown-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

.loan-countdown-bar.is-normal { background: linear-gradient(90deg, #3b82f6, #2563eb); }
.loan-countdown-bar.is-near-due { background: linear-gradient(90deg, #f59e0b, #ea580c); }
.loan-countdown-bar.is-overdue { background: linear-gradient(90deg, #ef4444, #b91c1c); }
.loan-countdown-bar.is-settled { background: linear-gradient(90deg, #22c55e, #16a34a); }

.loan-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.75rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.loan-status-dot {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.loan-status-pill.is-normal { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.loan-status-pill.is-normal .loan-status-dot { background: #2563eb; }

.loan-status-pill.is-near-due { background: #fef3c7; color: #92400e; border: 1px solid #f59e0b; }
.loan-status-pill.is-near-due .loan-status-dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25); }

.loan-status-pill.is-overdue { background: #fee2e2; color: #991b1b; border: 1px solid #ef4444; }
.loan-status-pill.is-overdue .loan-status-dot { background: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.25); }

.loan-status-pill.is-settled { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.loan-status-pill.is-settled .loan-status-dot { background: #16a34a; }

.loan-row-near-due {
  background-color: rgba(254, 243, 199, 0.28) !important;
}

.loan-row-overdue {
  background-color: rgba(254, 226, 226, 0.32) !important;
}

.loan-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.loan-filter-pill {
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.loan-filter-pill:hover {
  border-color: #94a3b8;
  color: #0f172a;
}

.loan-filter-pill.is-active {
  background: var(--app-primary, #0f3d75);
  border-color: var(--app-primary, #0f3d75);
  color: #ffffff;
}

/* =====================================================================
   User Manual Infographic Frame (.manual-infographic-*)
   ===================================================================== */
.manual-infographic-frame {
  margin: 0;
  padding: 0.75rem;
  border-radius: 1rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
}

.manual-infographic-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.65rem;
}

.manual-infographic-caption {
  margin-top: 0.6rem;
  font-size: 0.78rem;
  color: #64748b;
  text-align: center;
}

/* =====================================================================
   Official Vehicle Fleet Statistics & Live Status (.vstat-*)
   ===================================================================== */
.vstat-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 1279.98px) {
  .vstat-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .vstat-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

.vstat-vehicle-card {
  border-radius: 1rem;
  border-top: 4px solid #cbd5e1 !important;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.vstat-vehicle-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08) !important;
}

.vstat-vehicle-card.is-available { border-top-color: #10b981 !important; }
.vstat-vehicle-card.is-busy { border-top-color: #ef4444 !important; }
.vstat-vehicle-card.is-maint { border-top-color: #f59e0b !important; }
.vstat-vehicle-card.is-retired { border-top-color: #64748b !important; }

.vstat-code-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  height: 2.35rem;
  padding: 0 0.45rem;
  border-radius: 0.65rem;
  border: 1px solid transparent;
  font-weight: 800;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.vstat-pulse-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  display: inline-block;
}

.vstat-free-badge {
  grid-column: 1 / -1;
  justify-self: center;
  font-size: 0.74rem;
  font-weight: 600;
  color: #059669;
  background: #ecfdf5;
  border: 1px dashed #a7f3d0;
  border-radius: 999px;
  padding: 0.18rem 0.75rem;
}


/* ==========================================================================
   AI PDF Processing & Confirmation Modal (Native <dialog>)
   ========================================================================== */
dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
}

.aip-dialog {
  width: min(680px, calc(100vw - 1.5rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 0;
  border-radius: 1.25rem;
  background: transparent;
  box-shadow: 0 28px 64px -16px rgba(15, 23, 42, 0.38);
  overflow: visible;
}

.aip-dialog::backdrop {
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.aip-dialog[open] {
  display: flex;
  flex-direction: column;
  animation: aipPopIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes aipPopIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.aip-shell {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 2rem);
  background: #ffffff;
  border-radius: 1.25rem;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.aip-header {
  padding: 1.25rem 1.5rem 1rem;
  color: #ffffff;
  position: relative;
  transition: background 0.3s ease;
}

.aip-header.is-loading {
  background: linear-gradient(135deg, #1d4ed8 0%, #4338ca 55%, #6366f1 100%);
}

.aip-header.is-success {
  background: linear-gradient(135deg, #047857 0%, #059669 55%, #10b981 100%);
}

.aip-header.is-error {
  background: linear-gradient(135deg, #b91c1c 0%, #dc2626 55%, #ef4444 100%);
}

.aip-header-main {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.aip-emblem {
  width: 2.85rem;
  height: 2.85rem;
  flex-shrink: 0;
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.aip-header.is-loading .aip-emblem {
  animation: aipPulse 1.6s ease-in-out infinite;
}

@keyframes aipPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.35); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
}

.aip-title {
  font-size: 1.08rem;
  font-weight: 700;
  margin: 0 0 0.15rem;
  line-height: 1.3;
  color: #ffffff;
}

.aip-subtitle {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.86);
}

.aip-header-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.aip-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 0.76rem;
  max-width: 72%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aip-timer {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.24);
}

.aip-progress-track {
  margin-top: 0.75rem;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
}

.aip-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: #ffffff;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.aip-stepper {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.aip-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  transition: all 0.22s ease;
}

.aip-step-icon {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  border-radius: 999px;
  background: #e2e8f0;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.aip-step-title {
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.25;
}

.aip-step-desc {
  font-size: 0.74rem;
  opacity: 0.85;
}

.aip-step.is-active {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1e3a8a;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.aip-step.is-active .aip-step-icon {
  background: #2563eb;
  color: #ffffff;
}

.aip-step.is-done {
  border-color: #a7f3d0;
  background: #ecfdf5;
  color: #065f46;
}

.aip-step.is-done .aip-step-icon {
  background: #10b981;
  color: #ffffff;
}

.aip-step.is-error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.aip-step.is-error .aip-step-icon {
  background: #ef4444;
  color: #ffffff;
}

.aip-stepper.is-compact {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}

.aip-stepper.is-compact .aip-step {
  flex-direction: column;
  text-align: center;
  padding: 0.45rem 0.35rem;
  gap: 0.3rem;
}

.aip-stepper.is-compact .aip-step-icon {
  width: 1.55rem;
  height: 1.55rem;
  font-size: 0.76rem;
}

.aip-stepper.is-compact .aip-step-title {
  font-size: 0.7rem;
}

.aip-stepper.is-compact .aip-step-desc {
  display: none;
}

.aip-engine-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  margin-bottom: 0.85rem;
  font-size: 0.78rem;
}

.aip-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.aip-preview-item {
  padding: 0.65rem 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: #ffffff;
}

.aip-preview-item.aip-span-2 {
  grid-column: 1 / -1;
}

.aip-preview-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.2rem;
}

.aip-preview-val {
  font-size: 0.86rem;
  font-weight: 600;
  color: #0f172a;
  word-break: break-word;
}

.aip-people-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.aip-person-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.aip-person-chip.is-student {
  background: #ecfeff;
  color: #0e7490;
  border-color: #a5f3fc;
}

.aip-error-box {
  padding: 0.9rem 1rem;
  border-radius: 0.85rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  margin-bottom: 0.85rem;
}

.aip-error-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #b91c1c;
  margin-bottom: 0.3rem;
}

.aip-error-msg {
  font-size: 0.82rem;
  color: #7f1d1d;
  word-break: break-word;
}

.aip-error-question {
  padding: 0.8rem 1rem;
  border-radius: 0.85rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 0.84rem;
  color: #334155;
}

.aip-footer {
  padding: 0.9rem 1.5rem;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.aip-footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.aip-footer-row[hidden] {
  display: none !important;
}

@media (max-width: 576px) {
  .aip-header,
  .aip-body,
  .aip-footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .aip-preview-grid {
    grid-template-columns: 1fr;
  }
  .aip-stepper.is-compact {
    grid-template-columns: repeat(2, 1fr);
  }
}



/* =========================================================================
   Executive Budget Overview Panel (Summary All — Above 6-Step KPI Grid)
   ========================================================================= */
.exec-budget-panel {
  border-radius: 1.15rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #ffffff;
  box-shadow: 0 10px 30px -18px rgba(15, 23, 42, 0.2);
  overflow: hidden;
}

.exec-budget-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 58%, #1d4ed8 100%);
  color: #ffffff;
  padding: 1.15rem 1.4rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.85rem;
}

.exec-budget-header-icon {
  inline-size: 2.6rem;
  block-size: 2.6rem;
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #93c5fd;
  flex-shrink: 0;
}

.exec-budget-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  padding: 1.15rem 1.4rem 0.9rem;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border-bottom: 1px solid #e2e8f0;
}

@media (max-width: 991.98px) {
  .exec-budget-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .exec-budget-kpis {
    grid-template-columns: 1fr;
  }
}

.exec-budget-kpi {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.85rem;
  padding: 0.85rem 1rem;
  position: relative;
  overflow: hidden;
}

.exec-budget-kpi::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  inline-size: 4px;
  background: #2563eb;
}

.exec-budget-kpi.tone-indigo::before { background: #4f46e5; }
.exec-budget-kpi.tone-amber::before { background: #d97706; }
.exec-budget-kpi.tone-emerald::before { background: #059669; }

.exec-budget-kpi-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.2rem;
}

.exec-budget-kpi-val {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
}

.exec-budget-kpi-sub {
  font-size: 0.73rem;
  color: #64748b;
  margin-top: 0.25rem;
}

.exec-project-card {
  border: 1px solid #e2e8f0;
  border-radius: 0.9rem;
  background: #ffffff;
  padding: 1rem 1.1rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.exec-project-card:hover {
  transform: translateY(-2px);
  border-color: #93c5fd;
  box-shadow: 0 10px 22px -14px rgba(37, 99, 235, 0.32);
}

.exec-project-card.is-inactive {
  opacity: 0.65;
  background: #f8fafc;
}

.exec-project-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  padding-top: 0.65rem;
  border-top: 1px dashed #e2e8f0;
}

.exec-project-metric-lbl {
  font-size: 0.7rem;
  color: #64748b;
}

.exec-project-metric-val {
  font-size: 0.84rem;
  font-weight: 700;
  color: #0f172a;
}


/* =========================================================================
   Role-Based Interactive User Manual (views/manual/index.php)
   ========================================================================= */
.manual-hero {
  border-radius: 1.25rem;
  padding: 1.75rem 1.85rem;
  color: #ffffff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 16px 36px -20px rgba(15, 23, 42, 0.45);
}

.manual-hero::after {
  content: "";
  position: absolute;
  inset-block-start: -40%;
  inset-inline-end: -8%;
  inline-size: 20rem;
  block-size: 20rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16) 0%, transparent 70%);
  pointer-events: none;
}

.manual-hero.tone-admin { background: linear-gradient(135deg, #0f172a 0%, #312e81 55%, #4338ca 100%); }
.manual-hero.tone-executive { background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 55%, #0369a1 100%); }
.manual-hero.tone-finance { background: linear-gradient(135deg, #064e3b 0%, #047857 55%, #0f766e 100%); }
.manual-hero.tone-hr { background: linear-gradient(135deg, #2e1065 0%, #5b21b6 55%, #4f46e5 100%); }
.manual-hero.tone-staff { background: linear-gradient(135deg, #0c4a6e 0%, #1d4ed8 55%, #0284c7 100%); }
.manual-hero.tone-guest { background: linear-gradient(135deg, #0f172a 0%, #1d4ed8 52%, #0891b2 100%); }

.manual-role-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 0.5rem;
  box-shadow: 0 6px 20px -16px rgba(15, 23, 42, 0.2);
}

.manual-role-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  border-radius: 0.7rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: #475569;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.manual-role-tab:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.manual-role-tab.is-active {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
  box-shadow: 0 2px 8px -4px rgba(37, 99, 235, 0.35);
}

.manual-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 991.98px) {
  .manual-feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .manual-feature-grid {
    grid-template-columns: 1fr;
  }
}

.manual-feature-card {
  border: 1px solid #e2e8f0;
  border-radius: 0.95rem;
  background: #ffffff;
  padding: 1.15rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.manual-feature-card:hover {
  transform: translateY(-2px);
  border-color: #93c5fd;
  box-shadow: 0 12px 24px -16px rgba(37, 99, 235, 0.3);
}

.manual-feature-icon {
  inline-size: 2.5rem;
  block-size: 2.5rem;
  border-radius: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.manual-step-card {
  border: 1px solid #e2e8f0;
  border-radius: 0.95rem;
  background: #ffffff;
  padding: 1.2rem 1.25rem;
  height: 100%;
  box-shadow: 0 4px 14px -10px rgba(15, 23, 42, 0.12);
}

.manual-cta-box {
  border-radius: 1.1rem;
  background: linear-gradient(135deg, #eff6ff 0%, #ecfeff 100%);
  border: 1px solid #bae6fd;
  padding: 1.4rem 1.5rem;
}


/* =========================================================================
   User Management Analytics Cards (Role & Position Breakdown)
   ========================================================================= */
.user-stat-card {
  border-radius: 1rem;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  box-shadow: 0 8px 24px -18px rgba(15, 23, 42, 0.18);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-stat-card-header {
  padding: 0.95rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(180deg, #fafcff 0%, #ffffff 100%);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.user-role-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.8rem;
  border: 1px solid #eef2f6;
  background: #ffffff;
  text-decoration: none;
  color: inherit;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, background-color 0.14s ease;
}

.user-role-row:hover {
  transform: translateY(-1px);
  border-color: #93c5fd;
  background: #f8fbff;
  box-shadow: 0 6px 16px -12px rgba(37, 99, 235, 0.3);
}

.user-role-row.is-active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.14);
}

.user-role-icon {
  inline-size: 2.3rem;
  block-size: 2.3rem;
  border-radius: 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.user-pos-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

@media (max-width: 575.98px) {
  .user-pos-grid {
    grid-template-columns: 1fr;
  }
}

.user-pos-tile {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid #eef2f6;
  background: #fcfdff;
  text-decoration: none;
  color: inherit;
  transition: transform 0.14s ease, border-color 0.14s ease, background-color 0.14s ease;
}

.user-pos-tile:hover {
  transform: translateY(-1px);
  border-color: #93c5fd;
  background: #f0f7ff;
}

.user-pos-tile.is-active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.14);
}

.user-stat-bar-track {
  inline-size: 100%;
  block-size: 6px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.user-stat-bar-fill {
  block-size: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* ============================================================================
 * Report Print Group Modal (แบบ 8708 — แยก/รวมชุดพิมพ์ตามโครงการ)
 * ============================================================================ */
dialog.app-modal.report-print-modal {
  inline-size: min(46rem, 94dvw);
  border-radius: 1rem;
  border: 1px solid rgba(15, 23, 42, 0.1);
}

.report-print-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 1.1rem 1.35rem;
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  border-block-end: 1px solid #e2e8f0;
}

.report-print-modal-head-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-inline-size: 0;
}

.report-print-modal-icon {
  inline-size: 2.5rem;
  block-size: 2.5rem;
  border-radius: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  font-size: 1.15rem;
  flex-shrink: 0;
  box-shadow: 0 6px 14px -4px rgba(5, 150, 105, 0.4);
}

.report-print-modal-body {
  padding: 1.25rem 1.35rem;
  container: report-modal / inline-size;
}

.report-print-modal-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.75rem 0.95rem;
  border-radius: 0.75rem;
  font-size: 0.84rem;
  line-height: 1.5;
  margin-block-end: 1rem;
}

.report-print-modal-banner.is-multi {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #78350f;
}

.report-print-modal-banner.is-single {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.report-print-set-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  row-gap: 0.85rem;
  margin-block-end: 1rem;
}

.report-print-set-card {
  grid-column: 1 / -1;
  display: grid;
  /* Same-cascade fallback when subgrid is unsupported */
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-columns: subgrid;
  align-items: center;
  column-gap: 1rem;
  row-gap: 0.7rem;
  padding: 1rem 1.1rem;
  border-radius: 0.85rem;
  border: 1px solid #dbe4f0;
  border-inline-start: 4px solid #2563eb;
  background: #fff;
  box-shadow: 0 2px 8px -2px rgba(15, 23, 42, 0.06);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.report-print-set-card.is-single-proj {
  border-color: #bbf7d0;
  border-inline-start-color: #059669;
  background: linear-gradient(180deg, #ffffff 0%, #f8fffb 100%);
}

.report-print-set-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 10px 22px -10px rgba(37, 99, 235, 0.24);
  transform: translateY(-1px);
}

.report-print-set-card.is-single-proj:hover {
  border-color: #6ee7b7;
  box-shadow: 0 10px 22px -10px rgba(5, 150, 105, 0.24);
}

.report-print-set-info {
  min-inline-size: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.report-print-set-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.report-print-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.58rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.25;
}

.report-print-pill.is-index {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.report-print-pill.is-index.is-single {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.report-print-pill.is-count {
  background: #f8fafc;
  color: #334155;
  border: 1px solid #e2e8f0;
}

.report-print-pill.is-amount {
  background: #f0f9ff;
  color: #0369a1;
  border: 1px solid #bae6fd;
  font-variant-numeric: tabular-nums;
}

.report-print-project-title {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.report-print-project-title i {
  margin-block-start: 0.15rem;
  flex-shrink: 0;
}

.report-print-set-action {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  align-self: center;
}

.report-print-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-inline-size: 10.75rem;
  padding: 0.52rem 0.95rem;
  border-radius: 0.65rem;
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 10px -3px rgba(37, 99, 235, 0.35);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.report-print-cta-btn.btn-success {
  box-shadow: 0 4px 10px -3px rgba(5, 150, 105, 0.35);
}

.report-print-cta-btn:hover {
  transform: translateY(-1px);
}

.report-print-set-groups {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  flex-wrap: balance;
  align-items: center;
  gap: 0.4rem;
  padding-block-start: 0.65rem;
  border-block-start: 1px dashed #e2e8f0;
}

.report-print-group-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.6rem;
  border-radius: 0.5rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 0.77rem;
  color: #334155;
  font-variant-numeric: tabular-nums;
}

.report-print-group-chip strong {
  color: #0f172a;
  font-weight: 600;
}

.report-print-advanced {
  border: 1px solid #e2e8f0;
  border-radius: 0.8rem;
  background: #f8fafc;
  padding: 0.75rem 0.95rem;
  margin-block-end: 1rem;
}

.report-print-advanced > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.83rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  list-style: none;
}

.report-print-advanced > summary::-webkit-details-marker {
  display: none;
}

.report-print-advanced > summary .bi-chevron-down {
  transition: transform 0.18s ease;
}

.report-print-advanced[open] > summary .bi-chevron-down {
  transform: rotate(180deg);
}

.report-print-check-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: 0.65rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.report-print-check-row:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}

.report-print-check-row:has(input:checked) {
  border-color: #3b82f6;
  background: #eff6ff;
}

.report-print-modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.85rem 1.35rem;
  background: #f8fafc;
  border-block-start: 1px solid #e2e8f0;
}

@container report-modal (inline-size < 32rem) {
  .report-print-set-list {
    grid-template-columns: 1fr;
  }

  .report-print-set-card {
    grid-template-columns: 1fr;
  }

  .report-print-set-action {
    justify-content: stretch;
  }

  .report-print-cta-btn {
    inline-size: 100%;
  }
}

/* ============================================================================
 * Excel Report Center Modal (ศูนย์ดาวน์โหลดรายงาน Excel 6 ชุด แยกตามปีงบประมาณ)
 * ============================================================================ */
.excel-center-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.5rem;
  background: linear-gradient(135deg, #064e3b 0%, #047857 55%, #059669 100%);
  color: #fff;
}

.excel-center-head-icon {
  inline-size: 2.75rem;
  block-size: 2.75rem;
  border-radius: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.excel-fy-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  border-radius: 0.85rem;
  background: #fff;
  border: 1px solid #e2e8f0;
}

.excel-fy-pill {
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  font-weight: 600;
  padding: 0.3rem 0.85rem;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.excel-fy-pill:hover {
  border-color: #10b981;
  background: #ecfdf5;
  color: #065f46;
}

.excel-fy-pill.is-active {
  border-color: #059669;
  background: #059669;
  color: #fff;
  box-shadow: 0 4px 10px -3px rgba(5, 150, 105, 0.45);
}

.excel-bundle-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem 1.35rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, #0f294a 0%, #1e3a8a 55%, #047857 100%);
  box-shadow: 0 12px 24px -12px rgba(15, 41, 74, 0.45);
}

.excel-bundle-cta {
  border-radius: 0.7rem;
  white-space: nowrap;
  box-shadow: 0 6px 14px -4px rgba(15, 23, 42, 0.3);
}

@media (max-width: 767.98px) {
  .excel-bundle-hero {
    grid-template-columns: 1fr;
  }

  .excel-bundle-cta {
    inline-size: 100%;
  }
}

.excel-report-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  border-radius: 0.9rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 6px -2px rgba(15, 23, 42, 0.05);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.excel-report-card:hover {
  transform: translateY(-2px);
  border-color: #6ee7b7;
  box-shadow: 0 10px 22px -12px rgba(5, 150, 105, 0.25);
}

.excel-report-card-top {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.excel-report-icon {
  inline-size: 2.65rem;
  block-size: 2.65rem;
  border-radius: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.excel-report-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-block-start: 0.65rem;
  border-block-start: 1px dashed #e2e8f0;
}

/* ============================================================================
 * Step 6 Settlements Table (.settlement-table — กะทัดรัด อ่านง่าย ปุ่มเรียงแนวเดียวกัน)
 * ============================================================================ */
.settlement-table {
  font-size: 0.8125rem;
  line-height: 1.4;
}

.settlement-table thead th {
  font-size: 0.74rem;
  font-weight: 700;
  color: #475569;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.65rem 0.7rem;
  white-space: nowrap;
}

.settlement-table tbody th,
.settlement-table tbody td {
  padding: 0.65rem 0.7rem;
  vertical-align: middle;
  border-bottom-color: #eef2f6;
}

.settlement-contract-no {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #1d4ed8;
  line-height: 1.3;
}

.settlement-req-no {
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 500;
  margin-top: 0.1rem;
}

.settlement-subject {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.38;
}

.settlement-meta {
  font-size: 0.72rem;
  margin-top: 0.18rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.settlement-money {
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.settlement-diff-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.settlement-diff-pill.is-refund {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.settlement-diff-pill.is-extra {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.settlement-diff-pill.is-even {
  background: #f0f9ff;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.settlement-status-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.settlement-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.24rem 0.6rem;
  border-radius: 999px;
  font-size: 0.71rem;
  font-weight: 600;
  white-space: nowrap;
}

.settlement-ack-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  background: #f8fafc;
  color: #059669;
  border: 1px solid #bbf7d0;
  white-space: nowrap;
}

.settlement-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
}

.settlement-actions .btn-settle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  block-size: 1.9rem;
  padding: 0 0.6rem;
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: 0.45rem;
  white-space: nowrap;
  line-height: 1;
}

.settlement-actions .btn-settle.is-icon {
  inline-size: 1.9rem;
  padding: 0;
}

.settlement-actions .btn-settle.is-ack {
  min-inline-size: 4.9rem;
}

.settlement-actions .btn-settle.is-detail {
  min-inline-size: 5.5rem;
}

@media (max-width: 767.98px) {
  .settlement-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

/* ============================================================================
 * Dashboard Cards & Compact Readable Tables (.dash-section-card)
 * ============================================================================ */
.dash-section-card {
  background: #fff;
  border: 1px solid #d8e2ef;
  border-radius: 0.95rem;
  box-shadow: 0 4px 14px -6px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  border-block-start: 3px solid #2563eb;
}

.dash-section-card.accent-navy { border-block-start-color: #0f3566; }
.dash-section-card.accent-indigo { border-block-start-color: #4f46e5; }
.dash-section-card.accent-rose { border-block-start-color: #e11d48; }
.dash-section-card.accent-emerald { border-block-start-color: #059669; }

.dash-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.85rem 1.15rem;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border-block-end: 1px solid #e2e8f0;
}

.dash-card-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-inline-size: 0;
}

.dash-card-icon {
  inline-size: 2rem;
  block-size: 2rem;
  border-radius: 0.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  background: #eff6ff;
  color: #1d4ed8;
}

.dash-card-icon.is-indigo { background: #eef2ff; color: #4338ca; }
.dash-card-icon.is-rose { background: #fff1f2; color: #be123c; }
.dash-card-icon.is-emerald { background: #ecfdf5; color: #047857; }

.dash-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  line-height: 1.3;
}

.dash-card-sub {
  font-size: 0.74rem;
  color: #64748b;
  margin-top: 0.1rem;
}

/* Compact Table: รายการที่ได้ไปราชการและรายละเอียดงบประมาณทั้งหมด */
.dashboard-report-table {
  font-size: 0.78rem;
  line-height: 1.38;
}

.dashboard-report-table thead th {
  font-size: 0.72rem;
  font-weight: 700;
  color: #334155;
  background: #f1f5f9;
  padding: 0.55rem 0.55rem;
  white-space: nowrap;
  border-bottom: 2px solid #cbd5e1;
}

.dashboard-report-table tbody th,
.dashboard-report-table tbody td {
  padding: 0.55rem 0.55rem;
  vertical-align: middle;
  border-bottom: 1px solid #e2e8f0;
}

.dashboard-report-table tbody tr:nth-child(even) > th,
.dashboard-report-table tbody tr:nth-child(even) > td {
  background-color: #f8fafc;
}

.dashboard-report-table tbody tr:hover > th,
.dashboard-report-table tbody tr:hover > td {
  background-color: #eff6ff;
}

.dashboard-report-table .dash-req-no,
.dash-loan-table .dash-req-no {
  font-size: 0.78rem;
  font-weight: 700;
  color: #1d4ed8;
}

.dashboard-report-table .dash-meta,
.dash-loan-table .dash-meta {
  font-size: 0.7rem;
  color: #64748b;
  line-height: 1.35;
}

.dashboard-report-table .dash-subject,
.dash-loan-table .dash-subject {
  font-size: 0.79rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.35;
}

.dashboard-report-table .dash-badge,
.dash-loan-table .dash-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.24rem 0.5rem;
  white-space: nowrap;
}

.dashboard-report-table .dash-btn-detail,
.dash-loan-table .dash-btn-detail {
  font-size: 0.72rem;
  padding: 0.22rem 0.55rem;
  white-space: nowrap;
  border-radius: 0.45rem;
}

.dashboard-report-table tfoot td {
  font-size: 0.78rem;
  background: #eff6ff;
  border-top: 2px solid #93c5fd;
  padding: 0.6rem 0.55rem;
}

/* Step Filter Pills + Distinct Step Sub-Cards: รายการไปราชการแยกตามขั้นตอน */
.dash-step-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.dash-step-filter-btn {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
}

.dash-steps-container {
  padding: 0.9rem 1rem;
  background: #f4f7fb;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.dash-step-group {
  background: #fff;
  border: 1px solid #dbe4f0;
  border-inline-start: 4px solid #2563eb;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

.dash-step-group.step-1 { border-inline-start-color: #0891b2; }
.dash-step-group.step-2 { border-inline-start-color: #6366f1; }
.dash-step-group.step-3 { border-inline-start-color: #2563eb; }
.dash-step-group.step-4 { border-inline-start-color: #059669; }
.dash-step-group.step-5 { border-inline-start-color: #d97706; }
.dash-step-group.step-6 { border-inline-start-color: #0f766e; }

.dash-step-group-head {
  padding: 0.55rem 0.9rem;
  background: #f8fafc;
  border-block-end: 1px solid #e2e8f0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.45rem;
}

.dash-step-group-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #0f172a;
}

.dash-step-group-sub {
  font-size: 0.7rem;
  color: #64748b;
}

.dash-step-group-link {
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.dash-step-empty {
  padding: 0.55rem 0.9rem;
  font-size: 0.74rem;
  color: #94a3b8;
}

.dash-step-item {
  padding: 0.65rem 0.9rem;
  border-block-start: 1px solid #eef2f6;
  transition: background-color 0.14s ease;
}

.dash-step-item:first-child {
  border-block-start: 0;
}

.dash-step-item:hover {
  background: #f8fbff;
}

.dash-step-item-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #0f172a;
  text-decoration: none;
  line-height: 1.38;
  display: block;
  margin-bottom: 0.2rem;
}

.dash-step-item-title:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

.dash-step-item-meta {
  font-size: 0.72rem;
  color: #64748b;
  line-height: 1.4;
}

.dash-step-item-amt {
  font-size: 0.82rem;
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dash-step-item-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.22rem 0.5rem;
}

.dash-loan-table {
  font-size: 0.78rem;
}

.dash-loan-table thead th {
  font-size: 0.72rem;
  font-weight: 700;
  color: #334155;
  background: #f8fafc;
  padding: 0.55rem 0.65rem;
  white-space: nowrap;
}

.dash-loan-table tbody th,
.dash-loan-table tbody td {
  padding: 0.55rem 0.65rem;
  vertical-align: middle;
}

/* ============================================================================
 * Manual: All-Roles Overview Matrix (.manual-roles-*)
 * ============================================================================ */
.manual-roles-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.85rem;
}

@media (max-width: 1199.98px) {
  .manual-roles-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .manual-roles-grid {
    grid-template-columns: 1fr;
  }
}

.manual-role-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1rem;
  border-radius: 0.95rem;
  border: 1px solid #e2e8f0;
  border-block-start: 3.5px solid var(--role-accent, #2563eb);
  background: #ffffff;
  box-shadow: 0 2px 8px -4px rgba(15, 23, 42, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.manual-role-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -14px rgba(15, 23, 42, 0.22);
}

.manual-role-card.is-current {
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
  border-color: var(--role-accent, #2563eb);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--role-accent, #2563eb) 18%, transparent), 0 8px 20px -12px rgba(15, 23, 42, 0.2);
}

.manual-role-icon {
  inline-size: 2.3rem;
  block-size: 2.3rem;
  border-radius: 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
  color: var(--role-accent, #2563eb);
  background: color-mix(in srgb, var(--role-accent, #2563eb) 12%, #ffffff);
}

.manual-role-tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--role-accent, #2563eb);
  background: color-mix(in srgb, var(--role-accent, #2563eb) 10%, #ffffff);
}

.manual-role-duties {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #334155;
}

.manual-role-duties li {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
}

.manual-role-duties li i {
  color: var(--role-accent, #2563eb);
  margin-block-start: 0.12rem;
  flex-shrink: 0;
}

.manual-role-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 0.95rem;
  border-radius: 0.8rem;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  font-size: 0.75rem;
}

.manual-flow-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #dbe4f0;
  color: #0f172a;
  font-weight: 600;
}

.manual-flow-chip em {
  font-style: normal;
  font-weight: 600;
  color: var(--chip-color, #2563eb);
}

/* ไฮไลต์แถวผู้ใช้งานที่เพิ่งบันทึก/แก้ไข/ระงับสิทธิ์ (index.php?page=users) */
tr.user-row-focused > th,
tr.user-row-focused > td {
  background-color: #eff6ff !important;
  animation: userRowFocusPulse 2.4s ease-out 1;
}

tr.user-row-focused > td:first-child {
  box-shadow: inset 4px 0 0 #2563eb;
}

@keyframes userRowFocusPulse {
  0%   { background-color: #dbeafe; }
  45%  { background-color: #dbeafe; }
  100% { background-color: #eff6ff; }
}

/* ปุ่มจัดการผู้ใช้งานให้อยู่แถวเดียวเป็นระเบียบ (.user-row-actions) */
.user-row-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.3rem;
  white-space: nowrap;
}

.user-row-actions .btn-user-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  block-size: 1.9rem;
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: 0.45rem;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
}

.user-row-actions .btn-user-act.is-save {
  padding: 0 0.65rem;
}

.user-row-actions .btn-user-act.is-icon {
  inline-size: 1.9rem;
  padding: 0;
}

/* ============================================================================
 * Dashboard Top Panel: สิทธิ์การเบิกจ่ายและบัญชี (.dash-entitlement-*)
 * ============================================================================ */
.dash-entitlement-panel {
  background: #ffffff;
  border: 1px solid #d8e2ef;
  border-block-start: 3px solid #0ea5e9;
  border-radius: 1rem;
  box-shadow: 0 6px 18px -10px rgba(15, 23, 42, 0.14);
  overflow: hidden;
}

.dash-entitlement-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.15rem;
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  border-block-end: 1px solid #e2e8f0;
}

.dash-entitlement-icon {
  inline-size: 2.25rem;
  block-size: 2.25rem;
  border-radius: 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  color: #ffffff;
  font-size: 1.05rem;
  flex-shrink: 0;
  box-shadow: 0 6px 14px -5px rgba(37, 99, 235, 0.45);
}

.dash-entitlement-body {
  padding: 0.95rem 1.15rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(15.5rem, 19rem);
  gap: 0.9rem;
  align-items: stretch;
}

@media (max-width: 1199.98px) {
  .dash-entitlement-body {
    grid-template-columns: 1fr;
  }
}

.dash-rate-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
}

@media (max-width: 767.98px) {
  .dash-rate-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.dash-rate-tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.25rem;
  padding: 0.75rem 0.85rem;
  border-radius: 0.8rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.dash-rate-tile:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px -10px rgba(15, 23, 42, 0.2);
}

.dash-rate-tile.tone-blue { background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%); border-color: #bfdbfe; }
.dash-rate-tile.tone-emerald { background: linear-gradient(180deg, #ecfdf5 0%, #ffffff 100%); border-color: #a7f3d0; }
.dash-rate-tile.tone-indigo { background: linear-gradient(180deg, #eef2ff 0%, #ffffff 100%); border-color: #c7d2fe; }
.dash-rate-tile.tone-amber { background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%); border-color: #fde68a; }

.dash-rate-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  font-size: 0.74rem;
}

.dash-rate-lbl {
  font-weight: 700;
  color: #334155;
}

.dash-rate-num {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
}

.dash-rate-num span {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
}

.dash-rate-tile.tone-blue .dash-rate-num { color: #1d4ed8; }
.dash-rate-tile.tone-emerald .dash-rate-num { color: #047857; }
.dash-rate-tile.tone-indigo .dash-rate-num { color: #4338ca; }
.dash-rate-tile.tone-amber .dash-rate-num { color: #b45309; }

.dash-rate-note {
  font-size: 0.7rem;
  color: #64748b;
}

.dash-account-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.42rem;
  padding: 0.75rem 0.95rem;
  border-radius: 0.8rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 0.76rem;
}

.dash-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-block-end: 0.32rem;
  border-block-end: 1px dashed #e2e8f0;
}

.dash-account-row:last-child {
  padding-block-end: 0;
  border-block-end: 0;
}

/* =====================================================================
   Notification Center Popover, Post-Travel Reminder Banner & Dashboard
   ===================================================================== */
.app-notif-anchor-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.app-notif-trigger {
  anchor-name: --app-notif-trigger;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-inline-size: 2.5rem;
  min-block-size: 2.5rem;
  padding: 0.45rem;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 1.05rem;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.14s ease, box-shadow 0.16s ease;
  cursor: pointer;
}

.app-notif-trigger:hover {
  background: #f8fafc;
  border-color: var(--cmtc-primary, #1d4ed8);
  color: var(--cmtc-primary, #1d4ed8);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.app-notif-trigger:focus-visible {
  outline: 3px solid var(--cmtc-primary, #1d4ed8);
  outline-offset: 2px;
}

.app-notif-trigger.has-info {
  border-color: rgba(37, 99, 235, 0.45);
  background: #eff6ff;
  color: #1d4ed8;
}

.app-notif-trigger.has-alerts {
  border-color: rgba(245, 158, 11, 0.55);
  background: #fffbeb;
  color: #b45309;
}

.app-notif-trigger.has-post-travel {
  border-color: rgba(217, 119, 6, 0.7);
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  color: #92400e;
}

.app-notif-badge {
  position: absolute;
  inset-block-start: -0.24rem;
  inset-inline-end: -0.26rem;
  min-inline-size: 1.3rem;
  min-block-size: 1.3rem;
  padding-inline: 0.32rem;
  border-radius: 999px;
  background: #dc2626;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.25rem;
  text-align: center;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.48);
}

.app-notif-badge.is-info {
  background: #dc2626;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.48);
}

.app-notif-badge.is-urgent {
  background: #dc2626;
  box-shadow: 0 2px 10px rgba(220, 38, 38, 0.55);
  animation: notif-pulse 2.2s ease-in-out infinite;
}

@keyframes notif-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.09); }
}

@supports not selector(:popover-open) {
  [popover]:not(.\:popover-open) {
    display: none;
  }
}

.app-notif-popover {
  position-anchor: --app-notif-trigger;
  inline-size: min(26.5rem, calc(100vw - 1.5rem));
  max-block-size: min(38rem, calc(100vh - 5rem));
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 1.05rem;
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.18), 0 4px 14px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.app-notif-popover:is(:popover-open, .\:popover-open) {
  display: flex;
  flex-direction: column;
}

@supports (position-area: block-end) {
  .app-notif-popover {
    inset: auto;
    margin: 0;
    margin-block-start: 0.55rem;
    position-area: block-end span-inline-start;
    position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
  }
}

@supports not (position-area: block-end) {
  .app-notif-popover {
    position: fixed;
    inset-block-start: 4.35rem;
    inset-inline-end: 1rem;
    inset-block-end: auto;
    inset-inline-start: auto;
    margin: 0;
  }
}

.app-notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  border-block-end: 1px solid #e2e8f0;
}

.app-notif-head-icon {
  inline-size: 2.2rem;
  block-size: 2.2rem;
  border-radius: 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  font-size: 1rem;
  flex-shrink: 0;
}

.app-notif-head-icon.is-amber {
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
}

.app-notif-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: #0f172a;
}

.app-notif-subtitle {
  font-size: 0.74rem;
  color: #64748b;
}

.app-notif-post-callout {
  padding: 0.72rem 1rem;
  background: linear-gradient(90deg, #fffbeb 0%, #fef3c7 100%);
  border-block-end: 1px solid #fde68a;
}

.app-notif-post-callout.is-overdue {
  background: linear-gradient(90deg, #fef2f2 0%, #fee2e2 100%);
  border-block-end-color: #fecaca;
}

.app-notif-filters {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  padding: 0.55rem 0.9rem;
  background: #ffffff;
  border-block-end: 1px solid #f1f5f9;
  overflow-x: auto;
}

.app-notif-filter-btn {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  border-radius: 999px;
  padding: 0.28rem 0.68rem;
  min-block-size: 1.85rem;
  font-size: 0.73rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.app-notif-filter-btn:hover {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.app-notif-filter-btn.is-active {
  background: #1d4ed8;
  color: #ffffff;
  border-color: #1d4ed8;
}

.app-notif-filter-btn:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: 2px;
}

.app-notif-body {
  overflow-y: auto;
  flex: 1 1 auto;
  max-block-size: 22rem;
  background: #f8fafc;
}

.app-notif-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.app-notif-item {
  border-radius: 0.8rem;
  border: 1px solid #e2e8f0;
  border-inline-start: 4px solid #94a3b8;
  background: #ffffff;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.app-notif-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.app-notif-item.is-urgent { border-inline-start-color: #dc2626; background: #fffafa; }
.app-notif-item.is-warning { border-inline-start-color: #d97706; background: #fffdf5; }
.app-notif-item.is-action { border-inline-start-color: #2563eb; }
.app-notif-item.is-success { border-inline-start-color: #059669; background: #f6fef9; }
.app-notif-item.is-info { border-inline-start-color: #0284c7; }

.app-notif-link {
  display: flex;
  align-items: flex-start;
  gap: 0.68rem;
  padding: 0.72rem 0.78rem;
  text-decoration: none;
  color: inherit;
  border-radius: 0.75rem;
}

.app-notif-link:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: -2px;
}

.app-notif-item-icon {
  inline-size: 2.1rem;
  block-size: 2.1rem;
  border-radius: 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.app-notif-item-icon.is-urgent { background: #fee2e2; color: #b91c1c; }
.app-notif-item-icon.is-warning { background: #fef3c7; color: #b45309; }
.app-notif-item-icon.is-action { background: #dbeafe; color: #1d4ed8; }
.app-notif-item-icon.is-success { background: #d1fae5; color: #047857; }
.app-notif-item-icon.is-info { background: #e0f2fe; color: #0369a1; }

.app-notif-step-pill {
  font-size: 0.66rem;
  font-weight: 700;
  color: #475569;
  background: #f1f5f9;
  padding: 0.14rem 0.48rem;
  border-radius: 999px;
}

.app-notif-status-pill {
  font-size: 0.66rem;
  font-weight: 700;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
}

.app-notif-status-pill.is-urgent { background: #fee2e2; color: #b91c1c; }
.app-notif-status-pill.is-warning { background: #fef3c7; color: #92400e; }
.app-notif-status-pill.is-action { background: #dbeafe; color: #1e40af; }
.app-notif-status-pill.is-success { background: #d1fae5; color: #065f46; }
.app-notif-status-pill.is-info { background: #e0f2fe; color: #075985; }

.app-notif-item-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
}

.app-notif-item-sub {
  font-size: 0.75rem;
  font-weight: 500;
  color: #334155;
  margin-block-start: 0.14rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.app-notif-item-meta {
  font-size: 0.7rem;
  color: #64748b;
  margin-block-start: 0.2rem;
}

.app-notif-item-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #1d4ed8;
  margin-block-start: 0.3rem;
}

.app-notif-empty {
  padding: 2rem 1.25rem;
  text-align: center;
}

.app-notif-foot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.72rem 0.9rem;
  background: #ffffff;
  border-block-start: 1px solid #e2e8f0;
}

/* Post-Travel Reminder Banner (top of main content) */
.post-travel-reminder-banner {
  border-radius: 1rem;
  border: 1px solid #fcd34d;
  border-inline-start: 5px solid #d97706;
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 55%, #fef3c7 100%);
  box-shadow: 0 10px 26px rgba(180, 83, 9, 0.1);
  padding: 1rem 1.15rem;
}

.post-travel-reminder-banner.is-overdue {
  border-color: #fca5a5;
  border-inline-start-color: #dc2626;
  background: linear-gradient(135deg, #fef2f2 0%, #ffffff 55%, #fee2e2 100%);
  box-shadow: 0 10px 26px rgba(220, 38, 38, 0.12);
}

.post-travel-banner-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
}

.post-travel-banner-icon {
  inline-size: 2.75rem;
  block-size: 2.75rem;
  border-radius: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  font-size: 1.3rem;
  flex-shrink: 0;
  box-shadow: 0 6px 14px rgba(217, 119, 6, 0.28);
}

.post-travel-banner-icon.is-overdue {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  box-shadow: 0 6px 14px rgba(185, 28, 28, 0.3);
}

.post-travel-banner-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  background: rgba(217, 119, 6, 0.14);
  color: #92400e;
}

.post-travel-banner-pill.is-overdue {
  background: rgba(220, 38, 38, 0.14);
  color: #991b1b;
}

.post-travel-banner-title {
  font-size: 0.96rem;
  font-weight: 800;
  color: #0f172a;
}

.post-travel-banner-desc {
  font-size: 0.78rem;
  color: #475569;
}

.post-travel-dismiss-btn {
  min-inline-size: 2rem;
  min-block-size: 2rem;
  border-radius: 0.55rem;
}

.post-travel-trip-list {
  list-style: none;
  margin: 0.85rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.post-travel-trip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.68rem 0.85rem;
  border-radius: 0.78rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(203, 213, 225, 0.9);
}

.post-travel-countdown {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.16rem 0.55rem;
  border-radius: 999px;
}

.post-travel-countdown.is-urgent { background: #fee2e2; color: #b91c1c; }
.post-travel-countdown.is-warning { background: #fef3c7; color: #92400e; }
.post-travel-countdown.is-normal { background: #dbeafe; color: #1e40af; }

/* Dashboard Step-by-Step Notification Panel (Modern Crimson-Rose Gradient Command Center) */
.dash-notif-panel {
  border-radius: 1.15rem;
  border: 1.5px solid rgba(220, 38, 38, 0.28);
  background: #ffffff;
  box-shadow:
    0 14px 34px -12px rgba(185, 28, 28, 0.22),
    0 4px 12px -4px rgba(220, 38, 38, 0.1);
  overflow: hidden;
}

.dash-notif-panel.is-urgent,
.dash-notif-panel.is-amber,
.dash-notif-panel.is-active {
  border-color: rgba(220, 38, 38, 0.32);
}

.dash-notif-panel.is-calm {
  border-color: rgba(2, 132, 199, 0.32);
  box-shadow:
    0 14px 34px -12px rgba(2, 132, 199, 0.18),
    0 4px 12px -4px rgba(6, 182, 212, 0.1);
}

.dash-notif-head,
.dash-notif-head.is-urgent,
.dash-notif-head.is-amber,
.dash-notif-head.is-active {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  padding: 1.15rem 1.35rem;
  background: linear-gradient(135deg, #7f1d1d 0%, #b91c1c 42%, #dc2626 78%, #f43f5e 100%);
  color: #ffffff;
  border-block-end: 1px solid rgba(255, 255, 255, 0.16);
}

.dash-notif-head.is-calm {
  background: linear-gradient(135deg, #0c4a6e 0%, #0369a1 44%, #0284c7 78%, #06b6d4 100%);
}

.dash-notif-panel.is-calm .dash-notif-head-btn.is-light {
  color: #0369a1;
}

.dash-notif-panel.is-calm .dash-notif-stepper {
  background: linear-gradient(180deg, #f0f9ff 0%, #f8fdff 100%);
  border-block-end-color: #bae6fd;
}

.dash-notif-panel.is-calm .dash-notif-step-num {
  background: #e0f2fe;
  color: #0369a1;
}

.dash-notif-panel.is-calm .dash-notif-step-chip:hover {
  border-color: #0284c7;
  color: #0369a1;
  box-shadow: 0 10px 22px -10px rgba(2, 132, 199, 0.28);
}

.dash-notif-panel.is-calm .dash-notif-step-chip:focus-visible {
  outline-color: #0284c7;
}

.dash-notif-panel.is-calm .dash-notif-calm-bar {
  background: linear-gradient(90deg, #f0f9ff 0%, #ffffff 100%);
}

.dash-notif-panel.is-calm .dash-notif-calm-ico {
  background: #e0f2fe;
  color: #0284c7;
}

.dash-notif-heading {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.dash-notif-sub {
  font-size: 0.78rem;
  color: rgba(241, 245, 249, 0.88);
  line-height: 1.4;
}

.dash-notif-icon {
  position: relative;
  inline-size: 2.85rem;
  block-size: 2.85rem;
  border-radius: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.dash-notif-pulse-dot {
  position: absolute;
  inset-block-start: -3px;
  inset-inline-end: -3px;
  inline-size: 0.72rem;
  block-size: 0.72rem;
  border-radius: 999px;
  background: #fbbf24;
  border: 2px solid #ffffff;
}

@media (prefers-reduced-motion: no-preference) {
  .dash-notif-pulse-dot {
    animation: dashNotifBeacon 1.8s ease-out infinite;
  }
}

@keyframes dashNotifBeacon {
  0% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.75); }
  70% { box-shadow: 0 0 0 8px rgba(251, 191, 36, 0); }
  100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
}

.dash-notif-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.62rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.25;
}

.dash-notif-stat-pill.is-urgent { background: #fef2f2; color: #b91c1c; }
.dash-notif-stat-pill.is-warning { background: #fef3c7; color: #92400e; }
.dash-notif-stat-pill.is-action { background: rgba(255, 255, 255, 0.2); color: #ffffff; border: 1px solid rgba(255, 255, 255, 0.3); }
.dash-notif-stat-pill.is-calm { background: #d1fae5; color: #065f46; }

.dash-notif-head-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 0.65rem;
  padding: 0.42rem 0.85rem;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background-color 0.14s ease, scale 0.12s ease;
}

.dash-notif-head-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.22);
}

.dash-notif-head-btn:active {
  scale: 0.97;
}

.dash-notif-head-btn.is-amber {
  background: #fbbf24;
  color: #0f172a;
  border: 0;
}

.dash-notif-head-btn.is-light {
  background: #ffffff;
  color: #991b1b;
  border: 0;
}

.dash-notif-head-btn.is-glass {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.32);
}

.dash-notif-head-btn.is-glass:hover {
  background: rgba(255, 255, 255, 0.26);
  color: #ffffff;
}

/* 6-Step Interactive Visual Pipeline */
.dash-notif-stepper {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.6rem;
  padding: 0.95rem 1.25rem;
  background: linear-gradient(180deg, #fff1f2 0%, #fff7f7 100%);
  border-block-end: 1px solid #fecdd3;
}

@media (max-width: 1199.98px) {
  .dash-notif-stepper {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 639.98px) {
  .dash-notif-stepper {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-inline: 1rem;
    scrollbar-width: thin;
  }

  .dash-notif-step-chip {
    flex: 0 0 11.5rem;
    scroll-snap-align: start;
  }
}

.dash-notif-step-chip {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.7rem 0.8rem;
  border-radius: 0.85rem;
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  color: #334155;
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease, scale 0.12s ease;
}

.dash-notif-step-chip:hover {
  border-color: #dc2626;
  background: #ffffff;
  color: #b91c1c;
  transform: translateY(-2px);
  box-shadow: 0 10px 22px -10px rgba(220, 38, 38, 0.3);
}

.dash-notif-step-chip:active {
  scale: 0.98;
}

.dash-notif-step-chip:focus-visible {
  outline: 2.5px solid #dc2626;
  outline-offset: 2px;
}

.dash-notif-step-chip.is-active {
  border-color: #fca5a5;
  background: linear-gradient(180deg, #ffffff 0%, #fef2f2 100%);
  color: #991b1b;
  box-shadow: 0 4px 12px -6px rgba(220, 38, 38, 0.28);
}

.dash-notif-step-chip.is-highlight {
  border-color: #ef4444;
  background: linear-gradient(180deg, #fff5f5 0%, #fee2e2 100%);
  color: #7f1d1d;
  box-shadow: 0 6px 16px -6px rgba(220, 38, 38, 0.38);
}

.dash-notif-step-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.dash-notif-step-num {
  display: inline-grid;
  place-items: center;
  inline-size: 1.55rem;
  block-size: 1.55rem;
  border-radius: 0.45rem;
  background: #ffe4e6;
  color: #9f1239;
  font-size: 0.7rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.dash-notif-step-chip.is-active .dash-notif-step-num {
  background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
  color: #ffffff;
}

.dash-notif-step-chip.is-highlight .dash-notif-step-num {
  background: linear-gradient(135deg, #991b1b 0%, #ef4444 100%);
  color: #ffffff;
}

.dash-notif-step-count {
  min-inline-size: 1.65rem;
  padding: 0.1rem 0.48rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.dash-notif-step-chip.is-active .dash-notif-step-count {
  background: linear-gradient(135deg, #b91c1c 0%, #ef4444 100%);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.35);
}

.dash-notif-step-chip.is-highlight .dash-notif-step-count {
  background: linear-gradient(135deg, #991b1b 0%, #dc2626 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.45);
}

.dash-notif-step-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: inherit;
  line-height: 1.25;
}

.dash-notif-step-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
  font-size: 0.7rem;
  color: #64748b;
  margin-block-start: 0.12rem;
}

.dash-notif-step-arrow {
  font-size: 0.72rem;
  opacity: 0.45;
  flex-shrink: 0;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.dash-notif-step-chip:hover .dash-notif-step-arrow,
.dash-notif-step-chip:focus-visible .dash-notif-step-arrow {
  opacity: 1;
  transform: translate(2px, -2px);
}

/* Interactive Filter Toolbar */
.dash-notif-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.75rem 1.25rem 0;
}

.dash-notif-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.dash-notif-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.34rem 0.75rem;
  border-radius: 999px;
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease, scale 0.12s ease;
}

.dash-notif-filter-pill:hover {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #b91c1c;
}

.dash-notif-filter-pill:active {
  scale: 0.96;
}

.dash-notif-filter-pill.is-active,
.dash-notif-filter-pill[aria-pressed="true"] {
  background: linear-gradient(135deg, #991b1b 0%, #dc2626 100%);
  border-color: #b91c1c;
  color: #ffffff;
}

.dash-notif-filter-pill.is-amber[aria-pressed="true"] {
  background: #d97706;
  border-color: #d97706;
  color: #ffffff;
}

.dash-notif-filter-cnt {
  padding: 0.04rem 0.4rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  font-size: 0.68rem;
  font-weight: 800;
}

.dash-notif-filter-pill[aria-pressed="true"] .dash-notif-filter-cnt {
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

.dash-notif-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19.5rem, 1fr));
  gap: 0.85rem;
  padding: 0.9rem 1.25rem 1.15rem;
}

.dash-notif-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.95rem 1.05rem;
  border-radius: 0.95rem;
  border: 1px solid #dbe4f0;
  border-inline-start: 5px solid #94a3b8;
  background: #ffffff;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.dash-notif-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -12px rgba(15, 23, 42, 0.2);
}

.dash-notif-card:focus-within {
  box-shadow: 0 0 0 3px rgba(15, 61, 117, 0.14);
}

.dash-notif-card.is-urgent { border-inline-start-color: #dc2626; background: linear-gradient(135deg, #fff5f5 0%, #ffffff 55%); border-color: #fecaca; }
.dash-notif-card.is-warning { border-inline-start-color: #d97706; background: linear-gradient(135deg, #fffbeb 0%, #ffffff 55%); border-color: #fde68a; }
.dash-notif-card.is-action { border-inline-start-color: #2563eb; background: linear-gradient(135deg, #eff6ff 0%, #ffffff 55%); border-color: #bfdbfe; }
.dash-notif-card.is-success { border-inline-start-color: #059669; background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 55%); border-color: #a7f3d0; }
.dash-notif-card.is-info { border-inline-start-color: #0284c7; background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 55%); border-color: #bae6fd; }

.dash-notif-card-title {
  font-size: 0.87rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.35;
}

.dash-notif-card-sub {
  font-size: 0.78rem;
  color: #334155;
  font-weight: 500;
}

.dash-notif-card-meta {
  font-size: 0.72rem;
  color: #64748b;
}

.dash-notif-card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  padding-block-start: 0.55rem;
  border-block-start: 1px dashed rgba(148, 163, 184, 0.45);
}

.dash-notif-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.76rem;
  border-radius: 0.55rem;
  transition: transform 0.14s ease, scale 0.12s ease;
}

.dash-notif-cta:active {
  scale: 0.97;
}

.dash-notif-cta-arrow {
  transition: transform 0.14s ease;
}

.dash-notif-cta:hover .dash-notif-cta-arrow {
  transform: translateX(3px);
}

.dash-notif-filter-empty {
  text-align: center;
  padding: 1.5rem 1rem;
}

.dash-notif-more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.75rem 1.25rem;
  background: #f8fafc;
  border-block-start: 1px solid #e2e8f0;
  font-size: 0.78rem;
  color: #475569;
}

.dash-notif-calm-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 1.05rem 1.25rem;
  background: linear-gradient(90deg, #ecfdf5 0%, #ffffff 100%);
}

.dash-notif-calm-ico {
  inline-size: 2.5rem;
  block-size: 2.5rem;
  border-radius: 0.8rem;
  background: #d1fae5;
  color: #059669;
  display: inline-grid;
  place-items: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.mobile-nav-dot {
  position: absolute;
  inset-block-start: 0.2rem;
  inset-inline-end: calc(50% - 1.35rem);
  min-inline-size: 1.1rem;
  min-block-size: 1.1rem;
  padding-inline: 0.25rem;
  border-radius: 999px;
  background: #dc2626;
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1.1rem;
  text-align: center;
  border: 2px solid #ffffff;
}

/* Floating Go to Top Button */
.app-go-top-btn {
  position: fixed;
  inset-inline-end: 1.35rem;
  inset-block-end: 1.5rem;
  z-index: 1030;
  inline-size: 3rem;
  block-size: 3rem;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  background: var(--app-primary);
  color: #ffffff;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.24);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px) scale(0.94);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.app-go-top-btn .bi {
  font-size: 1.05rem;
  line-height: 1;
}

.app-go-top-label {
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
  margin-top: 1px;
}

.app-go-top-btn.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.app-go-top-btn:hover {
  background: var(--app-primary-hover);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.32);
  transform: translateY(-2px) scale(1.03);
}

.app-go-top-btn:focus-visible {
  outline: 3px solid var(--app-accent);
  outline-offset: 2px;
}

@media (max-width: 991.98px) {
  .app-go-top-btn {
    inset-inline-end: 1rem;
    inset-block-end: calc(4.85rem + env(safe-area-inset-bottom, 0px));
    inline-size: 2.75rem;
    block-size: 2.75rem;
  }
}

@media print {
  .app-go-top-btn {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-notif-badge.is-urgent {
    animation: none;
  }
  .app-notif-item,
  .app-notif-trigger,
  .dash-notif-step-chip,
  .app-go-top-btn,
  .app-meganav-caret,
  .drawer-acc-caret,
  .app-mega-card,
  .app-mega-link {
    transition: none;
  }
}

/* ============================================================================
 * Executive Topbar + Horizontal Dropdown / Mega Menu Navigation
 * ============================================================================ */
@media (min-width: 992px) {
  html {
    scroll-padding-top: 7.75rem;
  }

  .app-shell.app-shell-topnav {
    grid-template-columns: 1fr;
  }
}

.app-header-wrap {
  position: sticky;
  inset-block-start: 0;
  z-index: 1020;
  box-shadow: 0 2px 14px -4px rgba(15, 23, 42, 0.1);
}

/* Tier 1: Brand & Utility Topbar */
.app-topbar {
  background: linear-gradient(135deg, var(--app-primary-dark) 0%, var(--app-primary) 58%, var(--app-primary-mid) 100%);
  color: #f8fafc;
  border-block-end: 1px solid rgba(255, 255, 255, 0.12);
}

.app-topbar-inner {
  max-inline-size: 1600px;
  margin-inline: auto;
  min-block-size: 3.75rem;
  padding-block: 0.45rem;
  padding-inline: max(1rem, env(safe-area-inset-left, 0px)) max(1rem, env(safe-area-inset-right, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

@media (min-width: 992px) {
  .app-topbar-inner {
    padding-inline: 2rem;
  }
}

.app-topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: #ffffff;
  border-radius: var(--radius-md);
  padding-inline-end: 0.35rem;
  transition: opacity 0.15s ease;
}

.app-topbar-brand:hover {
  opacity: 0.94;
  color: #ffffff;
}

.app-topbar-brand-name {
  font-weight: 800;
  font-size: 0.98rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: #ffffff;
  max-inline-size: 24rem;
}

.app-topbar-brand-org {
  font-size: 0.73rem;
  color: rgba(226, 232, 240, 0.82);
  max-inline-size: 26rem;
}

.topbar-icon-btn {
  inline-size: 2.45rem;
  block-size: 2.45rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.topbar-icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.34);
}

.btn-topbar-cta {
  background: linear-gradient(135deg, var(--app-accent) 0%, #e0b24b 100%);
  color: #0b1f3a;
  font-weight: 700;
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(212, 163, 59, 0.28);
  transition: transform 0.14s ease, filter 0.14s ease, box-shadow 0.14s ease;
}

.btn-topbar-cta:hover,
.btn-topbar-cta:focus-visible {
  color: #08182e;
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(212, 163, 59, 0.36);
}

.btn-topbar-ghost {
  background: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-topbar-ghost:hover,
.btn-topbar-ghost.is-active {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.36);
  color: #ffffff;
}

.btn-topbar-user {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-topbar-user:hover,
.btn-topbar-user:focus-visible,
.btn-topbar-user[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.38);
  color: #ffffff;
}

.app-topbar .app-notif-trigger {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.app-topbar .app-notif-trigger:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.38);
  color: #ffffff;
}

.app-topbar .app-notif-trigger.has-alerts {
  background: rgba(254, 243, 199, 0.18);
  border-color: rgba(251, 191, 36, 0.55);
  color: #fde68a;
}

/* Tier 2: Desktop Horizontal Mega-Menu Navigation Bar */
.app-meganav {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-block-end: 1px solid var(--app-border);
}

.app-meganav-inner {
  max-inline-size: 1600px;
  margin-inline: auto;
  padding-inline: 2rem;
  min-block-size: 3.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.app-meganav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.app-meganav-item {
  position: relative;
}

.app-meganav-link,
.app-meganav-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--app-text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.app-meganav-link i,
.app-meganav-trigger > i:first-child {
  font-size: 0.98rem;
  color: var(--app-muted);
  transition: color 0.15s ease;
}

.app-meganav-link:hover,
.app-meganav-trigger:hover,
.app-meganav-trigger[aria-expanded="true"] {
  background: var(--tint-blue-bg);
  color: var(--app-primary);
}

.app-meganav-link:hover i,
.app-meganav-trigger:hover > i:first-child,
.app-meganav-trigger[aria-expanded="true"] > i:first-child {
  color: var(--app-primary);
}

/* Active state: tinted pill + bottom accent bar + bold (WCAG 1.4.1 non-color indicator) */
.app-meganav-link[aria-current="page"],
.app-meganav-trigger.is-group-active {
  background: var(--tint-blue-bg);
  color: var(--app-primary);
  font-weight: 700;
  border-color: rgba(15, 61, 117, 0.14);
}

.app-meganav-link[aria-current="page"]::after,
.app-meganav-trigger.is-group-active::after {
  content: "";
  position: absolute;
  inset-inline: 0.75rem;
  inset-block-end: -0.35rem;
  block-size: 3px;
  border-radius: 999px;
  background: var(--app-primary);
}

.app-meganav-link[aria-current="page"] i,
.app-meganav-trigger.is-group-active > i:first-child {
  color: var(--app-primary);
}

.app-meganav-caret {
  font-size: 0.7rem;
  opacity: 0.7;
  margin-inline-start: 0.1rem;
  transition: transform 0.18s ease, opacity 0.15s ease;
}

.app-meganav-trigger[aria-expanded="true"] .app-meganav-caret {
  transform: rotate(180deg);
  opacity: 1;
}

.app-meganav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-inline-size: 1.25rem;
  block-size: 1.25rem;
  padding-inline: 0.35rem;
  border-radius: 999px;
  background: #f59e0b;
  color: #0f172a;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
}

.app-meganav-role-pill {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--app-primary);
  background: var(--tint-blue-bg);
  border: 1px solid rgba(15, 61, 117, 0.14);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  white-space: nowrap;
}

/* Popover Polyfill Guard */
@supports not selector(:popover-open) {
  .app-mega-panel[popover]:not(.\:popover-open) {
    display: none;
  }
}

/* Floating Mega Menu / Dropdown Panel (Native Popover API) */
.app-mega-panel[popover] {
  padding: 0;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 1rem;
  background: var(--app-surface);
  color: var(--app-text);
  box-shadow:
    0 22px 48px -12px rgba(15, 23, 42, 0.22),
    0 4px 16px -4px rgba(15, 23, 42, 0.08);
  overflow: visible;
  max-inline-size: calc(100dvw - 1.5rem);
  max-block-size: calc(100dvh - 8.5rem);
}

.app-mega-panel.is-dropdown[popover] {
  inline-size: min(23.5rem, calc(100dvw - 1.5rem));
}

.app-mega-panel.is-mega[popover] {
  inline-size: min(44rem, calc(100dvw - 1.5rem));
}

/* Invisible hover bridge between trigger and popover panel */
.app-mega-panel[popover]::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  inset-block-end: 100%;
  block-size: 0.65rem;
}

/* CSS Anchor Positioning (Gated behind @supports so unsupported browsers never strand at 0,0) */
@supports (position-area: block-end) {
  .app-mega-panel[popover] {
    position: fixed;
    inset: auto;
    margin: 0;
    margin-block-start: 0.55rem;
    height: auto;
    position-area: block-end span-inline-end;
    position-try-fallbacks: flip-inline, flip-block, flip-block flip-inline;
  }
}

@supports not (position-area: block-end) {
  .app-mega-panel[popover] {
    position: fixed;
    inset: auto;
    margin: 0;
    height: auto;
  }
}

/* Smooth Entry / Exit Animation (Modern @starting-style + discrete transition) */
@media (prefers-reduced-motion: no-preference) {
  .app-mega-panel[popover] {
    opacity: 0;
    transition: opacity 0.14s ease, translate 0.14s ease, display 0.14s ease, overlay 0.14s ease;
    transition-behavior: allow-discrete;
  }

  @supports selector(:popover-open) {
    .app-mega-panel[popover] {
      translate: 0 -0.3rem;
    }
  }

  .app-mega-panel[popover]:is(:popover-open, .\:popover-open) {
    opacity: 1;
    translate: 0 0;
    transition-duration: 0.16s;
  }

  @starting-style {
    .app-mega-panel[popover]:is(:popover-open, .\:popover-open) {
      opacity: 0;
      translate: 0 -0.3rem;
    }
  }
}

.app-mega-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.15rem;
  background: linear-gradient(180deg, var(--app-surface-subtle) 0%, #ffffff 100%);
  border-block-end: 1px solid var(--app-border);
  border-start-start-radius: 1rem;
  border-start-end-radius: 1rem;
}

.app-mega-head-icon {
  inline-size: 2.25rem;
  block-size: 2.25rem;
  border-radius: 0.65rem;
  display: inline-grid;
  place-items: center;
  font-size: 1.05rem;
  flex-shrink: 0;
  background: var(--tint-blue-bg);
  color: var(--app-primary);
}

.app-mega-head-icon.is-indigo {
  background: #eef2ff;
  color: #4338ca;
}

.app-mega-head-icon.is-emerald {
  background: var(--tint-emerald-bg);
  color: var(--tint-emerald-fg);
}

.app-mega-head-icon.is-amber {
  background: var(--tint-amber-bg);
  color: var(--tint-amber-fg);
}

.app-mega-head-icon.is-slate {
  background: #f1f5f9;
  color: #334155;
}

.app-mega-head-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--app-text);
  line-height: 1.25;
}

.app-mega-head-sub {
  font-size: 0.74rem;
  color: var(--app-muted);
  line-height: 1.35;
}

.app-mega-head-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
}

/* 6-Step Mega Grid */
.app-mega-steps-grid {
  list-style: none;
  margin: 0;
  padding: 0.85rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.app-mega-card {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.72rem 0.82rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--app-border);
  background: var(--app-surface);
  color: var(--app-text);
  text-decoration: none;
  transition: background-color 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}

.app-mega-card:hover {
  background: var(--tint-blue-bg);
  border-color: rgba(15, 61, 117, 0.28);
  box-shadow: 0 6px 16px -8px rgba(15, 61, 117, 0.25);
  transform: translateY(-1px);
  color: var(--app-text);
}

.app-mega-card[aria-current="page"] {
  background: var(--tint-blue-bg);
  border-color: var(--app-primary);
  box-shadow: inset 3px 0 0 var(--app-primary);
}

.app-mega-step-chip {
  inline-size: 1.95rem;
  block-size: 1.95rem;
  border-radius: 0.55rem;
  background: linear-gradient(135deg, var(--app-primary) 0%, var(--app-primary-mid) 100%);
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  margin-block-start: 0.08rem;
}

.app-mega-card[aria-current="page"] .app-mega-step-chip {
  background: linear-gradient(135deg, var(--app-accent) 0%, #c08c27 100%);
  color: #08203e;
}

.app-mega-card-ico {
  font-size: 1rem;
  color: var(--app-muted);
  opacity: 0.55;
  flex-shrink: 0;
  margin-block-start: 0.15rem;
}

.app-mega-card:hover .app-mega-card-ico,
.app-mega-card[aria-current="page"] .app-mega-card-ico {
  color: var(--app-primary);
  opacity: 1;
}

/* Standard & 2-Column Mega Menu Lists */
.app-mega-cols {
  padding: 0.65rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.app-mega-cols.is-two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  padding: 0.85rem 1rem;
}

.app-mega-cols.is-two-col .app-mega-col + .app-mega-col {
  border-inline-start: 1px solid var(--app-border);
  padding-inline-start: 0.85rem;
}

.app-mega-col-title {
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--app-muted);
  padding: 0.15rem 0.6rem 0.45rem;
}

.app-mega-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.app-mega-link {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.6rem 0.72rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  color: var(--app-text);
  text-decoration: none;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.app-mega-link:hover {
  background: var(--tint-blue-bg);
  border-color: rgba(15, 61, 117, 0.14);
  color: var(--app-text);
}

.app-mega-link[aria-current="page"] {
  background: var(--tint-blue-bg);
  border-color: rgba(15, 61, 117, 0.3);
  box-shadow: inset 3px 0 0 var(--app-primary);
}

.app-mega-link-ico {
  inline-size: 2rem;
  block-size: 2rem;
  border-radius: 0.55rem;
  background: var(--app-surface-subtle);
  border: 1px solid var(--app-border);
  color: var(--app-primary);
  display: inline-grid;
  place-items: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  margin-block-start: 0.05rem;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.app-mega-link:hover .app-mega-link-ico,
.app-mega-link[aria-current="page"] .app-mega-link-ico {
  background: var(--app-primary);
  border-color: var(--app-primary);
  color: #ffffff;
}

.app-mega-item-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--app-text);
  line-height: 1.3;
}

.app-mega-item-desc {
  font-size: 0.74rem;
  color: var(--app-muted);
  line-height: 1.35;
  margin-block-start: 0.12rem;
}

.app-mega-item-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-inline-size: 1.3rem;
  padding: 0.08rem 0.42rem;
  border-radius: 999px;
  background: #f59e0b;
  color: #0f172a;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.25;
  flex-shrink: 0;
}

/* Compact Page Title & Breadcrumb Bar */
.app-page-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  margin-block-end: 1.15rem;
  padding-block-end: 0.75rem;
  border-block-end: 1px solid var(--app-border);
}

.app-page-crumb {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--app-muted);
  margin-block-end: 0.2rem;
}

.app-page-crumb a {
  color: var(--app-primary);
  text-decoration: none;
}

.app-page-crumb a:hover {
  text-decoration: underline;
}

.app-page-crumb i {
  font-size: 0.64rem;
  opacity: 0.7;
}

/* Mobile Drawer Collapsible Accordion Groups */
.drawer-acc-group {
  margin-inline: 0.5rem;
  margin-block-end: 0.25rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.drawer-acc-trigger {
  inline-size: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: #e2e8f0;
  font-size: 0.88rem;
  font-weight: 700;
  text-align: start;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.drawer-acc-trigger:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.drawer-acc-trigger.is-group-active {
  color: #ffffff;
}

.drawer-acc-trigger.is-group-active > i:first-child {
  color: var(--app-accent);
}

.drawer-acc-title {
  flex: 1 1 auto;
  min-inline-size: 0;
}

.drawer-acc-caret {
  font-size: 0.75rem;
  opacity: 0.75;
  transition: transform 0.18s ease;
}

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

.drawer-acc-panel {
  padding-block-end: 0.35rem;
}

.drawer-acc-subhead {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.85);
  padding: 0.45rem 1rem 0.15rem;
}

.drawer-acc-list {
  padding-inline: 0.4rem;
}

.drawer-step-num {
  display: inline-grid;
  place-items: center;
  min-inline-size: 1.4rem;
  block-size: 1.3rem;
  border-radius: 0.35rem;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

@media (forced-colors: active) {
  .app-meganav-link[aria-current="page"],
  .app-meganav-trigger.is-group-active,
  .sidebar-mega-trigger.is-group-active,
  .app-mega-card[aria-current="page"],
  .app-mega-link[aria-current="page"] {
    outline: 2px solid Highlight;
  }
}

/* ============================================================================
 * Desktop Sidebar Flyout Dropdown / Mega Menu
 * ============================================================================ */
.sidebar-mega-item {
  position: relative;
}

.sidebar-mega-trigger {
  inline-size: 100%;
  border: 0;
  border-inline-start: 3px solid transparent;
  background: transparent;
  text-align: start;
  cursor: pointer;
}

.sidebar-mega-trigger:hover,
.sidebar-mega-trigger[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.11);
  color: #ffffff;
}

.sidebar-mega-trigger.is-group-active {
  background: linear-gradient(90deg, rgba(212, 163, 59, 0.22) 0%, rgba(255, 255, 255, 0.08) 100%);
  color: #ffffff;
  font-weight: 700;
  border-inline-start-color: var(--app-accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.sidebar-mega-trigger.is-group-active > i:first-child {
  color: var(--app-accent);
  opacity: 1;
}

.sidebar-mega-caret {
  margin-inline-start: auto;
  font-size: 0.72rem;
  opacity: 0.65;
  flex-shrink: 0;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.sidebar-mega-trigger .nav-count-badge + .sidebar-mega-caret {
  margin-inline-start: 0.25rem;
}

.sidebar-mega-trigger[aria-expanded="true"] .sidebar-mega-caret {
  transform: translateX(3px);
  opacity: 1;
}

@media (min-width: 992px) {
  .app-shell.is-sidebar-collapsed .sidebar-mega-caret {
    display: none;
  }
}

/* Flyout Panel anchored to the right of Desktop Sidebar */
.app-mega-panel.is-sidebar-flyout[popover] {
  max-block-size: calc(100dvh - 2rem);
}

/* Vertical hover bridge along the inline-start edge (between sidebar and flyout) */
.app-mega-panel.is-sidebar-flyout[popover]::before {
  inset-block: 0;
  inset-inline-start: auto;
  inset-inline-end: 100%;
  inline-size: 0.75rem;
  block-size: auto;
}

@supports (position-area: block-end) {
  .app-mega-panel.is-sidebar-flyout[popover] {
    margin-block-start: 0;
    margin-inline-start: 0.6rem;
    position-area: inline-end span-block-end;
    position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
  }
}

@media (prefers-reduced-motion: no-preference) {
  @supports selector(:popover-open) {
    .app-mega-panel.is-sidebar-flyout[popover] {
      translate: -0.35rem 0;
    }

    .app-mega-panel.is-sidebar-flyout[popover]:is(:popover-open, .\:popover-open) {
      translate: 0 0;
    }

    @starting-style {
      .app-mega-panel.is-sidebar-flyout[popover]:is(:popover-open, .\:popover-open) {
        opacity: 0;
        translate: -0.35rem 0;
      }
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar-mega-caret {
    transition: none;
  }
}

/* ============================================================================
 * Searchable Province Combobox (Database-Backed 77 Thai Provinces)
 * ============================================================================ */
.province-combobox {
  position: relative;
}

.province-combobox-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.province-combobox-lead-ico {
  position: absolute;
  inset-inline-start: 0.78rem;
  color: var(--app-primary);
  font-size: 0.92rem;
  pointer-events: none;
  z-index: 1;
}

.province-combobox-input {
  padding-inline-start: 2.25rem;
  padding-inline-end: 3.6rem;
}

.province-combobox-clear,
.province-combobox-toggle {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 1.75rem;
  block-size: 1.75rem;
  min-block-size: 1.75rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--app-muted);
  font-size: 0.78rem;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease, transform 0.16s ease;
}

.province-combobox-clear {
  inset-inline-end: 2.05rem;
}

.province-combobox-toggle {
  inset-inline-end: 0.45rem;
}

.province-combobox-clear:hover,
.province-combobox-toggle:hover {
  background: var(--tint-blue-bg);
  color: var(--app-primary);
}

.province-combobox.is-open .province-combobox-toggle i {
  transform: rotate(180deg);
}

.province-combobox-list {
  position: absolute;
  inset-block-start: calc(100% + 0.35rem);
  inset-inline: 0;
  z-index: 1050;
  max-block-size: 16.5rem;
  overflow-y: auto;
  padding: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--app-border-strong);
  background: var(--app-surface);
  box-shadow: 0 16px 36px -10px rgba(15, 23, 42, 0.22), 0 4px 12px -4px rgba(15, 23, 42, 0.08);
}

.province-combobox-option {
  inline-size: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.48rem 0.7rem;
  min-block-size: 2.25rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--app-text);
  font-size: 0.88rem;
  font-weight: 500;
  text-align: start;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.province-combobox-option:hover,
.province-combobox-option.is-highlighted {
  background: var(--tint-blue-bg);
  color: var(--app-primary);
}

.province-combobox-option.is-selected {
  background: rgba(15, 61, 117, 0.1);
  color: var(--app-primary);
  font-weight: 700;
}

.province-combobox-region {
  font-size: 0.71rem;
  font-weight: 600;
  color: var(--app-muted);
  background: var(--app-surface-subtle);
  border: 1px solid var(--app-border);
  border-radius: 999px;
  padding: 0.06rem 0.48rem;
  flex-shrink: 0;
}

.province-combobox-option.is-selected .province-combobox-region {
  background: #ffffff;
  border-color: rgba(15, 61, 117, 0.25);
  color: var(--app-primary);
}

.province-combobox-empty {
  padding: 0.85rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--app-muted);
}

/* ============================================================================
 * Dashboard Notification Native Modal <dialog>
 * ============================================================================ */
dialog.dash-notif-modal {
  padding: 0;
  border: 0;
  border-radius: 1.2rem;
  background: transparent;
  inline-size: min(64rem, calc(100dvw - 1.5rem));
  max-inline-size: calc(100dvw - 1.5rem);
  max-block-size: min(90dvh, 52rem);
  overflow: visible;
  box-shadow: 0 28px 64px -16px rgba(15, 23, 42, 0.38);
}

dialog.dash-notif-modal:modal {
  overscroll-behavior: contain;
}

dialog.dash-notif-modal::backdrop {
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  overflow: hidden;
  overscroll-behavior: contain;
}

dialog.dash-notif-modal[open] {
  display: flex;
  flex-direction: column;
}

.dash-notif-modal-shell {
  display: flex;
  flex-direction: column;
  max-block-size: min(90dvh, 52rem);
  border-radius: 1.2rem;
}

.dash-notif-modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.dash-notif-modal-close {
  inline-size: 2.25rem;
  block-size: 2.25rem;
  min-block-size: 2.25rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  display: inline-grid;
  place-items: center;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.14s ease, scale 0.12s ease;
}

.dash-notif-modal-close:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: rotate(90deg);
}

.dash-notif-modal-close:active {
  scale: 0.94;
}

.dash-notif-modal-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.8rem 1.25rem;
  background: #f8fafc;
  border-block-start: 1px solid #e2e8f0;
  margin: 0;
}

@media (prefers-reduced-motion: no-preference) {
  dialog.dash-notif-modal {
    opacity: 0;
    translate: 0 0.75rem;
    scale: 0.97;
    transition: opacity 0.2s ease, translate 0.22s cubic-bezier(0.22, 1, 0.36, 1), scale 0.22s cubic-bezier(0.22, 1, 0.36, 1), display 0.2s ease, overlay 0.2s ease;
    transition-behavior: allow-discrete;
  }

  dialog.dash-notif-modal[open] {
    opacity: 1;
    translate: 0 0;
    scale: 1;
  }

  @starting-style {
    dialog.dash-notif-modal[open] {
      opacity: 0;
      translate: 0 0.75rem;
      scale: 0.97;
    }
  }
}

/* ============================================================================
 * Profile Electronic Signature Pad & Document Preview
 * ============================================================================ */
.sig-doc-preview-box {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--app-border);
  background: var(--app-surface-subtle);
}

.sig-doc-preview-paper {
  position: relative;
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 2.75rem 1.25rem 1.4rem;
  text-align: center;
  overflow: hidden;
  user-select: none;
}

.sig-doc-preview-slot {
  position: relative;
  block-size: 44px;
  overflow: visible;
}

.sig-doc-preview-img {
  position: absolute;
  inset-inline-start: 50%;
  inset-block-end: 0;
  width: auto;
  max-inline-size: none;
  object-fit: contain;
  mix-blend-mode: multiply;
  z-index: 2;
  touch-action: none;
}

.sig-doc-preview-img.is-draggable {
  cursor: grab;
}

.sig-doc-preview-img.is-dragging {
  cursor: grabbing;
  outline: 1.5px dashed rgba(37, 99, 235, 0.55);
  outline-offset: 2px;
}

.sig-doc-preview-empty {
  position: relative;
  top: 0.75rem;
  font-size: 0.78rem;
  color: #94a3b8;
  font-style: italic;
}

.sig-doc-preview-name {
  position: relative;
  z-index: 1;
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.3;
}

.sig-doc-preview-pos {
  position: relative;
  z-index: 1;
  font-size: 0.9rem;
  color: #1e293b;
  line-height: 1.3;
}

.sig-canvas-wrap {
  border-radius: var(--radius-sm);
  border: 1.5px dashed #94a3b8;
  background: #ffffff;
  overflow: hidden;
}

.sig-canvas {
  display: block;
  inline-size: 100%;
  block-size: 11rem;
  touch-action: none;
  cursor: crosshair;
}

.sig-ink-btn {
  inline-size: 1.4rem;
  block-size: 1.4rem;
  min-block-size: 1.4rem;
  border-radius: 999px;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px #cbd5e1;
  cursor: pointer;
  padding: 0;
}

.sig-ink-btn.is-active {
  box-shadow: 0 0 0 2.5px var(--app-primary);
}

