:root {
  --brand-green: #036c34;
  --brand-green-dark: #1b5e20;
  --brand-green-darker: #1b441e;
  --brand-green-mid: #2e7d32;
  --brand-green-active: #216b32;
  --state-warn: #f5b100;
  --state-info: #3f90f5;
  --state-danger: #ef4444;
  --state-success: #4caf50;
  --bg-page: #ebebeb;
  --bg-page-mobile: #f6f6f6;
  --surface-card: #ffffff;
  --surface-soft: #e0e0e0;
  --text-strong: #333843;
  --text-body: #222222;
  --text-muted: #667085;
  --text-muted-2: #9e9e9e;
  --border-soft: #f0f1f3;
  --border-subtle: #e0e2e7;
  --border-input: rgba(0, 0, 0, 0.26);
  --radius-card: 9px;
  --radius-card-mob: 14px;
  --radius-input: 5px;
  --radius-pill: 20px;
  --shadow-card: 1px 4px 9.3px 0 rgba(0, 0, 0, 0.12);
  --shadow-card-mob: 0 2px 10px 0 rgba(34, 34, 34, 0.07);
  --shadow-topbar: 0 4px 4px 0 rgba(0, 0, 0, 0.25);
  --shadow-sidebar: 2px 0 10.4px 0 rgba(0, 0, 0, 0.25);
  --sidebar-width: 264px;
  --topbar-height: 72px;
  --mobile-topbar-height: 62px;
  --mobile-bottomnav-height: 60px;
  --font-sans: Inter, Noto Sans Thai, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --font-display: Kanit, Inter, Noto Sans Thai, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

html,
body {
  height: 100%;
}

body {
  background: var(--bg-page);
  color: var(--text-body);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  height: var(--topbar-height);
  background: var(--brand-green);
  box-shadow: var(--shadow-topbar);
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  padding: 0 24px;
  color: #fff;
}

.app-topbar .app-topbar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}

.app-topbar .app-topbar__brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.app-topbar .app-topbar__spacer {
  flex: 1 1 auto;
}

.app-topbar .app-topbar__profile {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  background: transparent;
  border: 0;
}

/* Profile image / icon in topbar — circular, 32×32 */
.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

/* Fallback circle with person icon when no image is set */
.topbar-avatar--icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 1rem;
}

/* Notification bell — gentle pulse on the badge when count > 0 */
.app-topbar__bell {
  position: relative;
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 20px;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s ease;
}

.app-topbar__bell:hover,
.app-topbar__bell[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.14);
}

.app-topbar__bell-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: #ff4d4f;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 0 0 2px #036c34, 0 1px 3px rgba(0, 0, 0, 0.3);
  animation: bell-badge-pulse 2.4s ease-in-out infinite;
}

@keyframes bell-badge-pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.18);
  }
}

.notification-menu {
  width: 380px;
  max-height: 70vh;
  overflow-y: auto;
  border: 0;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
  padding: 0.5rem 0;
  margin-top: 0.5rem !important;
}

@media (max-width: 575.98px) {
  .notification-menu {
    width: 290px;
  }
}

.notification-menu__header {
  padding: 0.5rem 1rem 0.6rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  font-weight: 600;
  font-size: 0.95rem;
  color: #1f1f1f;
}

.notification-menu__empty {
  padding: 2rem 1rem !important;
  text-align: center;
  color: #999;
}

.notification-menu__empty i {
  display: block;
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: #d0d0d0;
}

.notification-menu .notification-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.notification-menu .notification-item:last-child {
  border-bottom: 0;
}

.notification-menu .notification-item:hover {
  background: rgba(3, 108, 52, 0.06);
}

.notification-item__icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.notification-item__icon--pending {
  background: rgba(255, 193, 7, 0.18);
  color: #b08800;
}

.notification-item__icon--rejected {
  background: rgba(220, 53, 69, 0.18);
  color: #dc3545;
}

/* Operator-side good-news colors:
     approved (slip cleared review) → brand green
     paid     (money received)      → success green w/ stronger tint */
.notification-item__icon--approved {
  background: rgba(3, 108, 52, 0.15);
  color: #036c34;
}

.notification-item__icon--paid {
  background: rgba(25, 135, 84, 0.20);
  color: #146c43;
}

.notification-item__body {
  flex: 1 1 auto;
  min-width: 0;
}

.notification-item__title {
  font-weight: 600;
  font-size: 0.9rem;
  color: #1f1f1f;
  margin-bottom: 1px;
}

.notification-item__project {
  color: #555;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-item__when {
  color: #999;
  font-size: 0.78rem;
  margin-top: 2px;
}

.notification-item__comment {
  color: #555;
  font-size: 0.82rem;
  margin-top: 0.3rem;
  padding: 0.3rem 0.5rem;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 4px;
  font-style: italic;
}

.app-topbar .app-topbar__sidebar-toggle,
.app-topbar .app-topbar__sidebar-toggle--desktop {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 20px;
  margin-right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
}

.app-topbar .app-topbar__sidebar-toggle:hover,
.app-topbar .app-topbar__sidebar-toggle--desktop:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Mobile hamburger shows <lg only; desktop collapse toggle shows >=lg only. */
@media (min-width: 992px) {
  .app-topbar .app-topbar__sidebar-toggle {
    display: none;
  }
}

@media (max-width: 991.98px) {
  .app-topbar .app-topbar__sidebar-toggle--desktop {
    display: none;
  }
}

/* .app-body fills the vertical space between topbar and footer inside
   the flex-column .app-shell. It no longer needs to be a flex row — the
   desktop sidebar is taken out of flow (position: fixed) and the content
   gets a matching left margin. */
.app-body {
  flex: 1 1 auto;
  width: 100%;
}

/* Sidebar baseline (both desktop + mobile offcanvas use these visuals). */
.app-sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(to bottom, #036330 0%, #2f992f 100%);
  /* Gorgeous dark-to-light forest green gradient */
  border-right: 0;
  box-shadow: var(--shadow-sidebar);
  transition: width 0.18s ease;
  display: flex;
  flex-direction: column;
}

.app-sidebar nav,
.app-sidebar--offcanvas nav {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

/* Desktop (>=lg): fixed sidebar, content + footer shifted to the right. */
@media (min-width: 992px) {
  .app-sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    height: calc(100vh - var(--topbar-height));
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1020;
  }

  .app-content,
  .app-footer {
    margin-left: var(--sidebar-width);
    transition: margin-left 0.18s ease;
  }

  html.sidebar-collapsed .app-content,
  html.sidebar-collapsed .app-footer {
    margin-left: var(--sidebar-width-collapsed);
  }
}

.app-sidebar .nav-link,
.app-sidebar--offcanvas .nav-link,
.app-sidebar .nav-group__toggle,
.app-sidebar--offcanvas .nav-group__toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 58px;
  padding: 12px 24px;
  color: #ffffff;
  /* Bright white text */
  font-weight: 500;
  font-size: 16px;
  border-bottom: 0;
  /* Clean look without standard line separator */
  background: transparent;
  text-decoration: none;
  width: 100%;
  text-align: left;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  line-height: 1.4;
  transition: background 0.2s ease, color 0.2s ease;
}

.app-sidebar .nav-link:hover,
.app-sidebar--offcanvas .nav-link:hover,
.app-sidebar .nav-group__toggle:hover,
.app-sidebar--offcanvas .nav-group__toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  /* Transparent hover overlay to respect gradient */
  color: #fff;
}

.app-sidebar .nav-link .nav-link__label,
.app-sidebar--offcanvas .nav-link .nav-link__label,
.app-sidebar .nav-link .nav-group__label,
.app-sidebar--offcanvas .nav-link .nav-group__label,
.app-sidebar .nav-group__toggle .nav-link__label,
.app-sidebar--offcanvas .nav-group__toggle .nav-link__label,
.app-sidebar .nav-group__toggle .nav-group__label,
.app-sidebar--offcanvas .nav-group__toggle .nav-group__label {
  flex: 1 1 auto;
  min-width: 0;
}

.app-sidebar .nav-link__chevron-indicator,
.app-sidebar--offcanvas .nav-link__chevron-indicator {
  color: #ffffff;
  font-size: 18px;
  font-weight: 500;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-sidebar .nav-link__chevron-indicator::before,
.app-sidebar--offcanvas .nav-link__chevron-indicator::before {
  content: '+';
}

.app-sidebar .nav-group__toggle[aria-expanded="true"] .nav-link__chevron-indicator::before,
.app-sidebar--offcanvas .nav-group__toggle[aria-expanded="true"] .nav-link__chevron-indicator::before {
  content: '−';
  /* proper minus sign */
}

.app-sidebar .nav-link.active,
.app-sidebar--offcanvas .nav-link.active,
.app-sidebar .nav-group__toggle.has-active-child,
.app-sidebar--offcanvas .nav-group__toggle.has-active-child {
  background: #2b9348;
  /* Premium medium forest green matching 'โครงการ' in the mockup */
  color: #fff;
}

.app-sidebar .nav-group__items,
.app-sidebar--offcanvas .nav-group__items {
  /* background: rgba(0, 0, 0, 0.15); */
  /* Transparent dark overlay so the gradient shows through */
  position: relative;
  padding: 8px 0;
  /* Symmetric padding to easily calculate timeline start/end */
}

/* Timeline vertical line */
.app-sidebar .nav-group__items::before,
.app-sidebar--offcanvas .nav-group__items::before {
  content: '';
  position: absolute;
  left: 31px;
  top: 28px;
  /* Starts exactly at the center of the first dot */
  bottom: 28px;
  /* Ends exactly at the center of the last dot */
  width: 2px;
  background: rgba(255, 255, 255, 0.4);
}

.app-sidebar .nav-group__items .nav-link,
.app-sidebar--offcanvas .nav-group__items .nav-link {
  position: relative;
  height: 40px;
  padding-left: 56px;
  font-size: 14.5px;
  border-bottom: none;
  background: transparent;
  color: #c8e6c9;
  /* Soft light-green tint matching the mockup's inactive items */
}

.app-sidebar .nav-group__items .nav-link:hover,
.app-sidebar--offcanvas .nav-group__items .nav-link:hover {
  background: transparent;
  color: #fff;
}

/* Timeline dots */
.app-sidebar .nav-group__items .nav-link::before,
.app-sidebar--offcanvas .nav-group__items .nav-link::before {
  content: '';
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transition: all 0.2s ease;
  z-index: 2;
}

/* Timeline dot - active item */
.app-sidebar .nav-group__items .nav-link.active,
.app-sidebar--offcanvas .nav-group__items .nav-link.active {
  background: transparent;
  color: #fff;
  font-weight: 600;
}

.app-sidebar .nav-group__items .nav-link.active::before,
.app-sidebar--offcanvas .nav-group__items .nav-link.active::before {
  background: #fff;
  width: 12px;
  height: 12px;
  left: 26px;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

@media (max-width: 991.98px) {
  .app-sidebar {
    display: none;
  }
}

.offcanvas.app-sidebar--offcanvas {
  width: var(--sidebar-width);
  /* background: linear-gradient(to bottom, #083216 0%, #146a30 100%) !important; */
  background: linear-gradient(to bottom, rgb(26, 92, 33) 10.57%, rgb(56, 140, 61) 91.87%);

  border-right: 0 !important;
}

.offcanvas.app-sidebar--offcanvas .offcanvas-header {
  background: transparent !important;
  border-bottom: 0 !important;
}

.offcanvas.app-sidebar--offcanvas .btn-close {
  filter: invert(1) !important;
  opacity: 0.9 !important;
  transition: opacity 0.15s ease;
}

.offcanvas.app-sidebar--offcanvas .btn-close:hover {
  opacity: 1 !important;
}

.offcanvas.app-sidebar--offcanvas .offcanvas-body {
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* =====================================================================
   Sidebar collapsed state (desktop only — driven by html.sidebar-collapsed
   which is toggled by the desktop topbar button via app.js).
   The mobile sidebar already uses Bootstrap offcanvas and is hidden at
   <lg, so these rules don't apply there.
   ===================================================================== */
:root {
  --sidebar-width-collapsed: 72px;
}

@media (min-width: 992px) {
  html.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-width-collapsed);
    overflow: visible !important;
    /* Prevents the floating popover from being clipped and hidden */
  }

  html.sidebar-collapsed .app-sidebar .nav-link__label,
  html.sidebar-collapsed .app-sidebar .nav-group__label,
  html.sidebar-collapsed .app-sidebar .nav-link__chevron,
  html.sidebar-collapsed .app-sidebar .nav-link__chevron-indicator {
    display: none;
  }

  /* Position the floating popover relative to each specific menu group container */
  html.sidebar-collapsed .app-sidebar .nav-group-container {
    position: relative;
  }

  /* Any open group collapses back to icon-only when the sidebar folds. */
  html.sidebar-collapsed .app-sidebar .nav-group__items {
    display: none;
  }

  /* On hover of the specific menu group, show the submenu next to it */
  html.sidebar-collapsed .app-sidebar .nav-group-container:hover .nav-group__items {
    display: block !important;
    position: absolute;
    left: 72px;
    top: 0;
    width: 220px;
    background: #0f4a26;
    /* Deep organic forest green matching theme */
    border-radius: 0 8px 8px 0;
    box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.25);
    z-index: 1050;
    padding: 8px 0;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
  }

  /* Remove timeline structures inside the floating popover */
  html.sidebar-collapsed .app-sidebar .nav-group__items::before {
    display: none !important;
  }

  html.sidebar-collapsed .app-sidebar .nav-group__items .nav-link {
    height: 40px;
    padding-left: 20px !important;
    font-size: 14.5px;
    background: transparent !important;
    color: #c8e6c9 !important;
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
  }

  html.sidebar-collapsed .app-sidebar .nav-group__items .nav-link .nav-link__label {
    display: inline-block !important;
    /* Force show the text labels inside popover */
  }

  html.sidebar-collapsed .app-sidebar .nav-group__items .nav-link:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #fff !important;
  }

  html.sidebar-collapsed .app-sidebar .nav-group__items .nav-link::before {
    display: none !important;
    /* Hide dots inside popover */
  }

  html.sidebar-collapsed .app-sidebar .nav-group__items .nav-link.active {
    color: #fff !important;
    font-weight: 600;
  }

  html.sidebar-collapsed .app-sidebar .nav-link,
  html.sidebar-collapsed .app-sidebar .nav-group__toggle {
    padding: 12px 0;
    justify-content: center;
    gap: 0;
  }

  html.sidebar-collapsed .app-sidebar .nav-link i,
  html.sidebar-collapsed .app-sidebar .nav-group__toggle i {
    font-size: 22px;
  }
}

.app-content {
  padding: 24px;
  background: var(--bg-page);
  min-height: calc(100vh - var(--topbar-height));
}

@media (max-width: 991.98px) {
  .app-content {
    padding: 16px;
    background: var(--bg-page-mobile);
    padding-bottom: calc(var(--mobile-bottomnav-height) + 24px);
  }
}

.app-footer {
  padding: 16px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

@media (max-width: 991.98px) {
  .app-footer {
    display: none;
  }
}

.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}

.page-header .page-header__title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-strong);
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.page-header .page-header__back {
  background: transparent;
  border: 0;
  color: var(--text-strong);
  font-size: 22px;
  line-height: 1;
  padding: 4px 8px;
}

.page-header .page-header__actions {
  display: flex;
  gap: 8px;
}

.card-panel {
  background: var(--surface-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  border: 0.5px solid rgba(0, 0, 0, 0);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.card-panel+.card-panel {
  margin-top: 16px;
}

.card-panel .card-panel__title {
  font-size: 20px;
  font-weight: 500;
  color: var(--text-body);
  margin: 0 0 16px 0;
}

@media (max-width: 991.98px) {
  .card-panel {
    border-radius: var(--radius-card-mob);
    box-shadow: var(--shadow-card-mob);
    padding: 16px;
  }
}

.kpi-card {
  background: var(--kpi-bg, rgba(0, 0, 0, 0.04));
  padding: 16px;
  text-align: center;
  border-radius: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
}

.kpi-card .kpi-card__label {
  font-size: 20px;
  color: rgba(0, 0, 0, 0.76);
  font-weight: 500;
}

.kpi-card .kpi-card__value {
  font-size: 36px;
  font-weight: 500;
  color: var(--kpi-color, var(--text-strong));
  line-height: 1.1;
}

.kpi-card .kpi-card__unit {
  font-size: 15px;
  color: rgba(0, 0, 0, 0.76);
}

.kpi-card--warn {
  --kpi-bg: rgba(255, 193, 7, 0.25);
  --kpi-color: var(--state-warn);
}

.kpi-card--info {
  --kpi-bg: rgba(13, 110, 253, 0.21);
  --kpi-color: var(--state-info-2, var(--state-info));
}

.kpi-card--danger {
  --kpi-bg: rgba(255, 0, 0, 0.23);
  --kpi-color: var(--state-danger);
}

.kpi-card--success {
  --kpi-bg: rgba(0, 128, 0, 0.18);
  --kpi-color: var(--state-success);
}

@media (max-width: 575.98px) {
  .kpi-card .kpi-card__value {
    font-size: 28px;
  }

  .kpi-card .kpi-card__label {
    font-size: 16px;
  }
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
}

@media (max-width: 767.98px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-body);
}

.status-badge--warn {
  background: #fff3e0;
  color: #f5941e;
}

.status-badge--info {
  background: #e0edff;
  color: var(--state-info);
}

.status-badge--danger {
  background: #fde2e2;
  color: var(--state-danger);
}

.status-badge--success {
  background: #e7f5e9;
  color: var(--state-success);
}

/* Phase ZJ — additional variants + sizes for the shared
   <x-status-badge> component. */
.status-badge--muted {
  background: #f1f3f5;
  color: #6c757d;
}
.status-badge i {
  margin-right: 4px;
  font-size: 0.95em;
}
.status-badge--sm {
  padding: 2px 8px;
  font-size: 11px;
}
.status-badge--md {
  padding: 4px 10px;
  font-size: 12px;
}
.status-badge--lg {
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 600;
}

/* Section block primitives — used across many pages (project show,
   project create form, withdrawal detail, etc.) to wrap a heading +
   table/content group. Defined globally so adding `.section-block`
   on any new page Just Works without each page importing its own
   copy. Per-page overrides (e.g. extra margin-top) live in the
   page's own CSS file.

   Title size deliberately kept on the small side (1.05rem ≈ 17px)
   so it never visually competes with the page H1 in the page header.
   Without this rule a fresh page would fall back to browser default
   h3 (~1.73rem ≈ 28px) — much larger than the page title. */
.section-block {
  margin-top: 1.75rem;
}

.section-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.section-block__title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  color: #000;
}

/* Site-wide button rounding — keeps brand buttons (3px) consistent
   with raw Bootstrap variants (btn-success / btn-danger / btn-warning
   etc.) which default to a larger radius. Scoped to .btn so it doesn't
   affect Bootstrap's pill / floating action variants.
   `!important` because some Bootstrap-modifier classes (btn-close,
   btn-group items, btn variants pulled in via CDN) ship their own
   border-radius via CSS variables that win the cascade. */
.btn,
.btn-sm,
.btn-lg,
.btn-brand,
.btn-brand-outline,
.btn-brand-add {
  border-radius: 3px !important;
}

.btn-brand {
  background: var(--brand-green);
  color: #fff;
  border: 1px solid var(--brand-green);
  border-radius: 3px;
  font-weight: 500;
  padding: 6px 18px;
}

.btn-brand:hover,
.btn-brand:focus {
  background: var(--brand-green-dark);
  border-color: var(--brand-green-dark);
  color: #fff;
}

.btn-brand-outline {
  background: transparent;
  color: var(--brand-green);
  border: 1px solid var(--brand-green);
  border-radius: 3px;
  font-weight: 500;
  padding: 6px 18px;
}

.btn-brand-outline:hover,
.btn-brand-outline:focus {
  background: var(--brand-green);
  color: #fff;
}

.btn-brand-gradient {
  background: linear-gradient(to right, #217026, #4CAF50, #217026);
  color: #fff;
  border: none;
  border-radius: 3px;
  font-weight: 500;
  padding: 6px 18px;
  transition: all 0.3s ease;
}

.btn-brand-gradient:hover,
.btn-brand-gradient:focus {
  background: linear-gradient(to right, #154c1a, #43a047, #154c1a);
  color: #fff;
  box-shadow: 0 4px 12px rgba(27, 94, 32, 0.2);
}

.progress-line {
  height: 6px;
  width: 100%;
  background: #efefef;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.progress-line__fill {
  height: 100%;
  background: var(--progress-color, var(--state-info));
  border-radius: 10px;
  transition: width 0.3s ease;
}

.progress-line--success {
  --progress-color: var(--state-success);
}

.progress-line--warn {
  --progress-color: var(--state-warn);
}

.progress-line--danger {
  --progress-color: var(--state-danger);
}

.progress-line--info {
  --progress-color: var(--state-info);
}

.form-label--brand {
  color: #686967;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.form-control--brand,
.form-select--brand {
  border: 1px solid var(--border-input);
  border-radius: var(--radius-input);
  height: 39px;
  box-shadow: 0 0.25px 0 0 rgba(0, 0, 0, 0.25);
  background: #fff;
  color: var(--text-body);
}

.form-control--brand:focus,
.form-select--brand:focus {
  border-color: var(--brand-green);
  box-shadow: 0 0 0 0.15rem rgba(3, 108, 52, 0.18);
}

/* =====================================================================
   .data-table — system-wide elegant table style.

   Color direction: SLATE NEUTRAL — intentionally NOT brand green.
   The top bar + sidebar are already brand green, so adding a third
   green surface on the data table makes the whole page read busy.
   Slate keeps the page calm and lets badges/buttons (which ARE
   green) actually pop.

   Palette:
     header bg      #f3f4f6 (slate-100)
     header text    #1f2937 (slate-800)
     border         #e5e7eb (slate-200)
     row bg         #fff
     row striping   #fafafa
     row hover      #f5f7fa (very pale slate)
   ===================================================================== */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface-card);
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.data-table thead th {
  background: #f3f4f6;
  color: #1f2937;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  padding: 12px 16px;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.data-table tbody td {
  padding: 12px 16px;
  font-size: 15px;
  color: var(--text-body);
  border-bottom: 1px solid #eef0f3;
  background: #fff;
}

/* Subtle zebra — kept very pale so it's perceived as "calm",
   not "loud". On dense data tables (boq-material etc.) this also
   helps row tracking without distracting from numbers. */
.data-table tbody tr:nth-child(even) td {
  background: #fafafa;
}

.data-table tbody tr:hover td {
  background: #f5f7fa;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table .data-table__num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 575.98px) {
  .data-table--stack thead {
    display: none;
  }

  .data-table--stack tbody,
  .data-table--stack tr,
  .data-table--stack td {
    display: block;
    width: 100%;
  }

  .data-table--stack tr {
    background: #fff;
    border-radius: var(--radius-card-mob);
    box-shadow: var(--shadow-card-mob);
    margin-bottom: 12px;
    padding: 12px 16px;
  }

  .data-table--stack td {
    background: transparent !important;
    border: 0;
    padding: 6px 0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
  }

  .data-table--stack td.wd-cell-stack {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 4px;
    text-align: left !important;
  }

  .data-table--stack td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
  }
}

.mobile-topbar {
  height: var(--mobile-topbar-height);
  background: var(--brand-green-dark);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.mobile-topbar__back {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  padding: 4px 6px;
}

.mobile-topbar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
  color: #fff;
  text-decoration: none;
}

.mobile-topbar__brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.mobile-topbar__title {
  font-weight: 700;
  font-size: 18px;
  line-height: 1.2;
}

.mobile-topbar__subtitle {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
}

.mobile-topbar__actions {
  display: flex;
  gap: 8px;
}

.mobile-hero {
  background-image: linear-gradient(45.93deg, rgb(26, 92, 33) 10.57%, rgb(56, 140, 61) 91.87%);
  color: #fff;
  border-radius: 0;
  padding: 16px 20px;
  margin: 0 -16px 16px -16px;
  position: relative;
  overflow: hidden;
}

.mobile-hero__greeting {
  font-size: 13px;
  opacity: 0.82;
}

.mobile-hero__title {
  font-size: 22px;
  font-weight: 700;
  margin: 4px 0 12px;
}

.mobile-hero__year-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  border: 0;
}

.mobile-hero__total {
  position: absolute;
  right: 16px;
  top: 16px;
  background: rgba(255, 255, 255, 0.13);
  border-radius: 14px;
  padding: 12px 18px;
  text-align: center;
  min-width: 104px;
}

.mobile-hero__total .label {
  font-size: 10px;
  opacity: 0.78;
  display: block;
}

.mobile-hero__total .value {
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
}

.mobile-hero__total .unit {
  font-size: 11px;
  opacity: 0.7;
  display: block;
  margin-top: 2px;
}

.mobile-project-card {
  display: block;
  background: #fff;
  border-radius: var(--radius-card-mob);
  box-shadow: var(--shadow-card-mob);
  padding: 14px 16px 14px 20px;
  margin-bottom: 12px;
  position: relative;
  text-decoration: none;
  color: var(--text-body);
  overflow: hidden;
}

.mobile-project-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--brand-green-mid);
  border-top-left-radius: var(--radius-card-mob);
  border-bottom-left-radius: var(--radius-card-mob);
}

.mobile-project-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.mobile-project-card__head .title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-body);
}

.mobile-project-card__amount-label {
  font-size: 10px;
  color: var(--text-muted-2);
  margin-top: 6px;
}

.mobile-project-card__amount {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-body);
}

.mobile-project-card__progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.mobile-project-card__percent {
  font-size: 12px;
  font-weight: 700;
  color: var(--state-success);
  min-width: 36px;
  text-align: right;
}

.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-bottomnav-height);
  background: #fff;
  border-top: 1px solid #e0e0e0;
  z-index: 1030;
  display: flex;
}

.mobile-bottom-nav__item {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: #a9a9a9;
  font-size: 9px;
  font-weight: 500;
  position: relative;
}

.mobile-bottom-nav__item i,
.mobile-bottom-nav__item .icon {
  font-size: 22px;
}

.mobile-bottom-nav__item.active {
  color: var(--brand-green-active);
  font-weight: 700;
}

.mobile-bottom-nav__item.active::before {
  content: "";
  position: absolute;
  top: 0;
  width: 20px;
  height: 3px;
  border-radius: 2px;
  background: var(--brand-green-active);
}

@media (min-width: 992px) {
  .show-mobile-only {
    display: none !important;
  }
}

@media (max-width: 991.98px) {
  .show-desktop-only {
    display: none !important;
  }
}

/* =====================================================================
   Shared utility classes
   Promote anything used on >=2 pages here. One-off page styles belong
   in public/dist/css/pages/<page>.css instead.
   ===================================================================== */

/* "<label> <big number> <unit>" inline heading (KPI total summary) */
.kpi-heading {
  text-align: center;
  margin-bottom: 12px;
}

.kpi-heading__label {
  font-size: 20px;
  color: rgba(0, 0, 0, 0.76);
  font-weight: 500;
}

.kpi-heading__value {
  font-size: 36px;
  font-weight: 600;
  margin: 0 6px;
}

/* Mobile / sidebar section header — the "รายงานงบประมาณ" pattern */
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-body);
  margin: 0;
}

/* Inline brand link — "ดูทั้งหมด →" / secondary brand-colored link */
.link-brand {
  color: var(--brand-green-mid);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
}

.link-brand:hover {
  color: var(--brand-green-dark);
  text-decoration: underline;
}

/* Narrow form control (filter row dropdowns) */
.input-narrow {
  width: 196px;
  max-width: 100%;
}

/* =====================================================================
   List-page patterns (User Management module — extend for future CRUD)
   ===================================================================== */

/* "+ เพิ่ม..." button — bordered green pill (page header action) */
.btn-brand-add {
  background: transparent;
  color: var(--brand-green);
  border: 1px solid var(--brand-green);
  border-radius: 9px;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
  text-decoration: none;
}

.btn-brand-add:hover,
.btn-brand-add:focus {
  background: var(--brand-green);
  color: #fff;
}

.btn-brand-add i {
  font-size: 14px;
}

/* Filter bar — grey wrapper above list tables */
.filter-bar {
  background: #e5e5e5;
  border-radius: 5px;
  padding: 18px 20px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-bar__fields {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  min-width: 0;
}

.filter-bar__fields .form-field {
  flex: 1 1 200px;
  max-width: 320px;
  min-width: 150px;
}

/* Make date range field wider than standard filter fields */
.filter-bar__fields .form-field-date-range {
  flex: 2 1 340px;
  max-width: 440px;
  min-width: 320px;
}

@media (max-width: 480px) {
  .filter-bar__fields .form-field-date-range {
    min-width: 0;
  }
}

.filter-bar__fields .form-field-date-range .d-flex input {
  flex: 1;
  min-width: 0;
}

/* Make project select dropdown wider to show full job_no + project name */
.filter-bar__fields .form-field-project-select {
  flex: 1.8 1 280px;
  max-width: 450px;
  min-width: 220px;
}

.filter-bar__actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

/* Inline submit button sitting amongst the filter fields (e.g. the
   "ค้นหา" button beside the date input on the report screens).
   The wrapper imitates a `.form-field` (label + control stacked
   vertically) so the button lands on the same baseline as the
   inputs to its left. */
.filter-bar__fields .filter-bar__inline-submit.form-field {
  flex: 0 0 auto;
  /* don't stretch to 240px like real fields */
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  /* button sits at the bottom edge */
}

/* List count "X รายการ" line */
.list-count {
  font-size: 18px;
  color: var(--text-body);
  margin: 16px 0 12px;
}

.list-count strong {
  font-weight: 700;
}

/* Row actions — yellow edit + red delete circles in list rows */
.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.row-actions__form {
  display: inline-block;
  margin: 0;
}

.row-actions__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 33px;
  height: 33px;
  border-radius: 50%;
  border: 0;
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  transition: filter .15s ease;
}

.row-actions__btn:hover,
.row-actions__btn:focus {
  filter: brightness(0.92);
  color: #fff;
}

.row-actions__btn--edit {
  background: #ffc107;
}

.row-actions__btn--delete {
  background: #dc3545;
}

/* Empty state */
.empty-state {
  background: var(--surface-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state__icon {
  font-size: 48px;
  color: var(--text-muted-2);
  margin-bottom: 12px;
}

.empty-state__title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-body);
  margin: 0 0 4px;
}

.empty-state__description {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 20px;
}

.empty-state__action {
  display: inline-flex;
  gap: 8px;
}

/* =====================================================================
   Form-page patterns (Create / Edit screens)
   ===================================================================== */

.form-page {
  background: var(--surface-card);
  border-radius: var(--radius-card);
  padding: 24px 28px 32px;
  margin-bottom: 24px;
}

/* form-row: responsive grid of fields. Defaults to 3 columns on >=md, 1 on mobile. */
.form-row {
  display: grid;
  gap: 16px 24px;
  margin-bottom: 16px;
}

.form-row--1 {
  grid-template-columns: 1fr;
}

.form-row--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-row--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-row--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 767.98px) {

  .form-row--2,
  .form-row--3,
  .form-row--4 {
    grid-template-columns: 1fr;
  }
}

.form-field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.form-field .form-label--brand,
.form-field .form-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-body);
  margin-bottom: 6px;
}

.form-field__required {
  color: var(--state-danger);
  margin-left: 2px;
}

.form-field__hint {
  color: var(--text-muted);
  margin-top: 4px;
  font-size: 12px;
}

.form-field__error {
  color: var(--state-danger);
  margin-top: 4px;
  font-size: 12px;
}

/* Larger input style for create/edit forms (taller than filter inputs) */
.form-page .form-control--brand,
.form-page .form-select--brand {
  height: 49px;
  font-size: 16px;
  border-radius: 4px;
}

.form-actions {
  margin-top: 24px;
  padding-top: 8px;
}

@media (max-width: 575.98px) {
  .form-actions {
    flex-direction: column !important;
    gap: 10px !important;
  }
  .form-actions .btn {
    width: 100% !important;
    font-size: 15px !important;
    padding: 10px 16px !important;
    text-align: center;
  }
}

/* Modal-CRUD adjustments — when forms live inside Bootstrap modals
   (e.g. categories), inputs should match the form-page sizing and the
   row spacing should breathe a bit less than full pages. */
.modal-body .form-row {
  margin-bottom: 8px;
}

.modal-body .form-control--brand,
.modal-body .form-select--brand {
  height: 44px;
  font-size: 15px;
}

.modal-footer .btn {
  min-width: 88px;
}

/* =====================================================================
   Breadcrumb trail (sits inline with page header, right side)
   ===================================================================== */

/* Phase I4 — uniform breadcrumb size across the app.
   Bumped from 14px → 16px (1rem) so it reads at the same scale as
   body text instead of looking like fine print. Forced via !important
   so per-page CSS can't drift back to smaller values inconsistently.
   Weight stays normal — the green link color carries enough emphasis. */
.breadcrumb-trail {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem !important;
  line-height: 1.4;
  color: var(--text-body);
}

.breadcrumb-trail a {
  color: var(--brand-green);
  text-decoration: none;
  font-weight: 500;
}

.breadcrumb-trail a:hover {
  text-decoration: underline;
}

.breadcrumb-trail__sep {
  color: var(--text-muted-2);
  font-size: 0.85em;
  /* slightly tone down the chevron */
}

.breadcrumb-trail__current {
  color: var(--text-body);
  font-weight: 500;
}

@media (max-width: 575.98px) {

  /* On phones, breadcrumb wraps below title — page-header already wraps via flex */
  .page-header__breadcrumb {
    order: 99;
    flex-basis: 100%;
  }
}

/* =====================================================================
   Page-header layout tweaks for new actions/breadcrumb slots
   ===================================================================== */

.page-header {
  flex-wrap: wrap;
}

.page-header__breadcrumb {
  margin-left: auto;
}

.page-header__actions {
  margin-left: auto;
}

.page-header__breadcrumb+.page-header__actions {
  margin-left: 12px;
}

/* =====================================================================
   Auth screens (login / register / pending-approval / change-password)
   Shared by layouts/auth.blade.php and every view under resources/views/auth/.
   ===================================================================== */

.auth-shell {
  min-height: 100vh;
  height: auto;
  background: url('/images/login_bg.png') no-repeat center center / cover;
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 16px;
  font-family: var(--font-sans);
}

.auth-shell__center {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  margin-top: auto;
  margin-bottom: auto;
}

.auth-shell__footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted-2);
  margin: 0;
}

/* ---- The white card ---------------------------------------------- */
.auth-card {
  background: var(--surface-card);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.10);
  padding: 24px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-card__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.auth-card__brand img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.auth-card__brand-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--brand-green);
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.auth-card__brand-logo-small {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.auth-card__brand-tagline {
  font-size: 30px;
  font-weight: 900;
  color: var(--brand-green-darker);
  margin-top: 2px;
}

.auth-card__heading {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-strong);
  margin: 8px 0 0;
}

.auth-card__subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0;
  line-height: 1;
  margin-bottom: 8px;
}

.auth-card__alert {
  margin: 4px 0 0;
  font-size: 14px;
}

.auth-card__footer-link {
  margin: 12px 0 0;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}

.auth-card__footer-link a {
  margin-left: 4px;
}

.auth-card__logout {
  text-align: center;
  margin-top: 4px;
}

.auth-card__logout .btn-link {
  font-size: 13px;
  padding: 4px 8px;
}

/* ---- Form inside the card --------------------------------------- */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

.auth-form .form-field {
  margin: 0;
}

.auth-form .form-control--brand,
.auth-form .form-select--brand {
  height: 40px;
  font-size: 14px;
}

.auth-form__remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-body);
  margin: -2px 0 2px;
  cursor: pointer;
}

.auth-form__remember .form-check-input {
  margin: 0;
}

@media (max-width: 575.98px) {
  .auth-shell {
    padding: 24px 12px;
  }

  .auth-card {
    padding: 24px 16px 20px;
  }

  .auth-card__brand-name {
    font-size: 16px;
  }

  .auth-card__brand-tagline {
    font-size: 20px;
  }

  .auth-card__heading {
    font-size: 18px;
  }

  .auth-card__subtitle {
    font-size: 13px;
  }

  .auth-form .form-label--brand {
    font-size: 14px;
    margin-bottom: 4px;
  }

  .auth-form .form-control--brand,
  .auth-form .form-select--brand {
    font-size: 13px;
    height: 38px;
  }
}

/* ---- Password show/hide control --------------------------------- */
/* ---- Input with leading icon ------------------------------------- */
.input-icon-wrap {
  position: relative;
}

.input-icon-wrap .input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--brand-green);
  pointer-events: none;
  z-index: 2;
}

.input-icon-wrap .form-control--brand {
  padding-left: 42px;
}

.input-group-password {
  position: relative;
}

.input-group-password .form-control--brand {
  padding-right: 44px;
}

/* When password field is also inside an icon wrap, keep left padding */
.input-icon-wrap .input-group-password .form-control--brand {
  padding-left: 42px;
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.password-toggle:hover {
  color: var(--text-body);
  background: #f4f4f4;
}

/* ---- Status block (pending-approval icon + text) ---------------- */
.auth-status {
  text-align: center;
  padding: 8px 0 4px;
}

.auth-status__icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}

.auth-status--pending .auth-status__icon {
  background: #fff4cf;
  color: #b9770e;
}

.auth-status__body {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-body);
  margin: 0 0 8px;
}

.auth-status__meta {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

/* ---- Small-screen tweaks ---------------------------------------- */
@media (max-width: 575.98px) {
  .auth-card {
    padding: 24px 20px;
    border-radius: 12px;
  }

  .auth-card__heading {
    font-size: 20px;
  }

  .auth-card__brand-tagline {
    font-size: 24px;
  }
}

/* =====================================================================
   Permission matrix (role create / edit form)
   Grouped checkbox grid. One .permission-matrix__group per module.
   ===================================================================== */

.permission-matrix {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 767.98px) {
  .permission-matrix {
    grid-template-columns: 1fr;
  }
}

.permission-matrix__group {
  background: #fafafa;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  padding: 14px 16px;
}

.permission-matrix__group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.permission-matrix__group-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-strong);
  margin: 0;
}

.permission-matrix__group-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  margin: 0;
}

.permission-matrix__items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.permission-matrix__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s ease;
  margin: 0;
}

.permission-matrix__item:hover {
  background: #f1f3f0;
}

.permission-matrix__item .form-check-input {
  margin-top: 3px;
  flex: 0 0 auto;
}

.permission-matrix__item-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.permission-matrix__item-key {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--brand-green);
  font-weight: 600;
}

.permission-matrix__item-desc {
  font-size: 14px;
  color: var(--text-body);
  line-height: 1.4;
}

/* =====================================================================
   Tiny button sizing reused by in-row approve/deactivate actions
   ===================================================================== */
.data-table .btn-sm {
  padding: 4px 10px;
  font-size: 13px;
}

.data-table .btn-sm i {
  font-size: 13px;
}

/* =====================================================================
   Sidebar logout button — same visual as .nav-link, tinted red.
   Pushed to the bottom via mt-auto on desktop (app-sidebar flex column).
   ===================================================================== */
.app-sidebar nav {
  min-height: 100%;
}

.nav-link--logout {
  color: var(--state-danger);
  cursor: pointer;
}

.nav-link--logout:hover,
.nav-link--logout:focus {
  background: #fff5f5;
  color: var(--state-danger);
}

/* =====================================================================
   Panatas alerts (flash messages + validation summary)
   Derived from the nearest Figma language: same 9px card radius, same
   status-badge color tokens, left accent bar inspired by mobile project
   cards' status stripe.
   ===================================================================== */
.panatas-alert {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px 14px 20px;
  border-radius: var(--radius-card);
  background: #fff;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card-mob);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-body);
  margin: 0 0 16px 0;
  overflow: hidden;
}

.panatas-alert::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--alert-accent, var(--state-info));
}

.panatas-alert__icon {
  flex: 0 0 auto;
  font-size: 20px;
  line-height: 1;
  color: var(--alert-accent, var(--state-info));
  margin-top: 1px;
}

.panatas-alert__body {
  flex: 1 1 auto;
  min-width: 0;
}

.panatas-alert__list {
  padding-left: 18px;
}

.panatas-alert__close {
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  padding: 4px;
  color: var(--text-muted);
  line-height: 1;
  font-size: 14px;
  border-radius: 4px;
  cursor: pointer;
}

.panatas-alert__close:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-body);
}

.panatas-alert--success {
  --alert-accent: var(--state-success);
  background: #e7f5e9;
  border-color: #c6e7cc;
}

.panatas-alert--error {
  --alert-accent: var(--state-danger);
  background: #fde2e2;
  border-color: #f6c2c2;
}

.panatas-alert--warning {
  --alert-accent: var(--state-warn);
  background: #fff3e0;
  border-color: #ffe2b5;
}

.panatas-alert--info {
  --alert-accent: var(--state-info);
  background: #e0edff;
  border-color: #c6d9f5;
}

/* Flash banners render at the top of .app-content — keep a consistent
   gap between stacked alerts and the page header below. */
.app-content>.panatas-alert+.panatas-alert {
  margin-top: -4px;
}




/* ===================================================================
   Global confirm/alert modal — driven by PanatasModal.confirm/alert.
   Single instance lives in layouts/app.blade.php; JS swaps title /
   body / buttons per call.
   =================================================================== */
.panatas-modal .modal-content {
  border: 0;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.panatas-modal .modal-header {
  border-bottom: 0;
  padding: 1rem 1.25rem 0;
  position: relative;
  z-index: 1;
}

.panatas-modal .modal-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: #1f1f1f;
  width: 100%;
  text-align: center;
}

.panatas-modal .modal-body {
  text-align: center;
  padding: 0.5rem 2rem 1.25rem;
}

.panatas-modal__icon {
  width: 88px;
  height: 88px;
  margin: 0.25rem auto 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 2.6rem;
  line-height: 1;
  /* color + background-color set inline by JS via tintColor() */
}

.panatas-modal__msg {
  color: #333;
  font-size: 1rem;
  line-height: 1.65;
  max-width: 100%;
}

.panatas-modal .modal-footer {
  border-top: 0;
  padding: 0.5rem 1.5rem 1.5rem;
  gap: 0.6rem;
}

.panatas-modal .modal-footer .btn {
  min-width: 130px;
  padding: 0.55rem 1rem;
  font-weight: 500;
  border-radius: 8px;
}

/* In-flight form (mid-AJAX) — disable + dim so the user knows
   something's happening. */
form.is-submitting {
  opacity: 0.6;
  pointer-events: none;
}

/* =====================================================================
   Real-time Password Strength Checker Styles
   ===================================================================== */
.password-strength-checker {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 14px;
}

.strength-meter__bar {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.strength-rules {
  margin-top: 10px;
  border-top: 1px solid #e9ecef;
  padding-top: 10px !important;
}

.rule-item {
  display: flex;
  align-items: center;
  transition: color 0.25s ease;
  font-size: 13px !important;
  line-height: 1.4;
}

.rule-item i {
  font-size: 15px !important;
  transition: transform 0.2s ease;
}

.rule-item.text-success i {
  transform: scale(1.1);
}

/* =====================================================================
   Select2 styling overrides to match Panatas design system
   ===================================================================== */
.select2-container--default .select2-selection--single {
  height: 38px !important;
  background-color: #fff !important;
  border: 1px solid var(--border-input, rgba(0, 0, 0, 0.26)) !important;
  border-radius: var(--radius-input, 5px) !important;
  display: flex !important;
  align-items: center !important;
  padding: 0 4px !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--text-body, #222) !important;
  font-family: var(--font-sans) !important;
  font-size: 14px !important;
  padding-left: 8px !important;
  padding-right: 20px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 36px !important;
  right: 8px !important;
}

.select2-container {
  width: 100% !important;
  max-width: 100% !important;
  flex: 1 1 auto;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
  border: 1px solid var(--border-subtle, #e0e2e7) !important;
  border-radius: 4px !important;
  padding: 6px 10px !important;
  outline: none !important;
}

.select2-dropdown {
  border: 1px solid var(--border-subtle, #e0e2e7) !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
  overflow: hidden !important;
  z-index: 1060 !important;
}

.select2-results__option {
  font-family: var(--font-sans) !important;
  font-size: 13.5px !important;
  padding: 8px 12px !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: var(--brand-green, #036c34) !important;
  color: #fff !important;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--text-muted-2, #9e9e9e) !important;
  font-size: 14px !important;
}

/* Multi-select variant (e.g. รายงานค่าแรงตามงวด project picker) — same
   height/border/radius as the single-select + native .form-select--brand
   so filter-bar fields line up regardless of which control type is used. */
.select2-container--default .select2-selection--multiple {
  min-height: 38px !important;
  background-color: #fff !important;
  border: 1px solid var(--border-input, rgba(0, 0, 0, 0.26)) !important;
  border-radius: var(--radius-input, 5px) !important;
  display: flex !important;
  align-items: center !important;
  padding: 0 4px !important;
}

.select2-container--default.select2-container--focus .select2-selection--multiple {
  border-color: var(--brand-green, #036c34) !important;
  box-shadow: 0 0 0 0.15rem rgba(3, 108, 52, 0.18) !important;
}

/* Empty (no chips) most of the time — must NOT stretch to full width,
   or it starves the search/placeholder field next to it (that was the
   bug: 100% width here squeezed the textarea into a sliver, making the
   placeholder look centered/truncated). flex-shrink to fit only the
   chips it actually holds; the search field below takes the rest. */
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
  display: flex !important;
  flex: 0 1 auto !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 4px !important;
  padding: 0 !important;
  margin: 0 !important;
  min-width: 0 !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
  background-color: rgba(3, 108, 52, 0.08) !important;
  border: 1px solid var(--brand-green, #036c34) !important;
  border-radius: 4px !important;
  color: var(--brand-green, #036c34) !important;
  font-family: var(--font-sans) !important;
  font-size: 13px !important;
  padding: 1px 6px !important;
  margin: 0 !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
  color: var(--brand-green, #036c34) !important;
  border: none !important;
  margin-right: 4px !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
  color: var(--brand-green-dark, #1b5e20) !important;
  background: transparent !important;
}

/* The search/placeholder box (select2 4.1 renders it as a <textarea>
   wrapped in a sibling <span>, NOT inside .select2-selection__rendered)
   — give IT the remaining row width so the placeholder reads left-
   aligned across the full field, same as the single-select variant. */
.select2-container--default .select2-selection--multiple .select2-search--inline {
  flex: 1 1 auto !important;
  display: flex !important;
  align-items: center !important;
  min-width: 40px !important;
  margin: 0 !important;
}

.select2-container--default .select2-selection--multiple .select2-search__field {
  width: 100% !important;
  min-height: 0 !important;
  text-align: left !important;
  font-family: var(--font-sans) !important;
  font-size: 14px !important;
  line-height: 1.4 !important;
  margin: 0 !important;
  padding: 0 4px !important;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  resize: none !important;
}

.select2-container--default .select2-selection--multiple .select2-search__field::placeholder {
  color: var(--text-muted-2, #9e9e9e) !important;
  font-size: 14px !important;
}