/* ============================================================
   HRMIS Design System — "modern classic"
   Blue (primary) · Amber (accent) · Orange (secondary) · Slate neutrals.

   Every colour, size and shadow used by the UI comes from the tokens
   below. Do not hard-code hex values in views or component CSS.

   Contrast rules (all verified WCAG AA):
   - Text on blue-600 or darker: white.
   - Text on amber fills: --on-accent (dark). Never white on amber.
   - Text on orange fills: white only on orange-700 or darker.
   ============================================================ */

:root {
  /* ── Primary: blue (600 is the brand anchor, #1E40AF) ── */
  --brand-50: #EFF4FF;
  --brand-100: #DCE7FD;
  --brand-200: #BCD0FB;
  --brand-300: #8DADF6;
  --brand-400: #5A82EC;
  --brand-500: #3560D4;
  --brand-600: #1E40AF;
  --brand-700: #1A3591;
  --brand-800: #172C77;
  --brand-900: #12235E;
  --brand-950: #0B1640;

  /* ── Accent: amber/yellow — highlights, key stats, sparing use ── */
  --accent-50: #FFFBEB;
  --accent-100: #FEF3C7;
  --accent-200: #FDE68A;
  --accent-300: #FCD34D;
  --accent-400: #FBBF24;
  --accent-500: #F59E0B;
  --accent-600: #D97706;
  --accent-700: #B45309;
  --accent-800: #92400E;
  --accent-900: #78350F;
  --on-accent: #1C1917;

  /* ── Secondary: orange — secondary CTAs, important-but-not-error ── */
  --secondary-50: #FFF7ED;
  --secondary-100: #FFEDD5;
  --secondary-200: #FED7AA;
  --secondary-300: #FDBA74;
  --secondary-400: #FB923C;
  --secondary-500: #F97316;
  --secondary-600: #EA580C;
  --secondary-700: #C2410C;
  --secondary-800: #9A3412;
  --secondary-900: #7C2D12;

  /* ── Neutrals: slate ── */
  --neutral-50: #F8FAFC;
  --neutral-100: #F1F5F9;
  --neutral-200: #E2E8F0;
  --neutral-300: #CBD5E1;
  --neutral-400: #94A3B8;
  --neutral-500: #64748B;
  --neutral-600: #475569;
  --neutral-700: #334155;
  --neutral-800: #1E293B;
  --neutral-900: #0F172A;

  /* ── Semantic: always distinct from the brand colours ── */
  --success: #15803D;
  --success-bg: #F0FDF4;
  --success-border: #BBF7D0;
  --warning: #92400E;          /* text; pair with --warning-icon, an icon and a label */
  --warning-icon: #D97706;
  --warning-bg: #FFFBEB;
  --warning-border: #FDE68A;
  --danger: #B91C1C;
  --danger-dark: #991B1B;
  --danger-bg: #FEF2F2;
  --danger-border: #FECACA;
  --info: #1D4ED8;
  --info-bg: #EFF6FF;
  --info-border: #BFDBFE;

  /* ── Surfaces, text, borders ── */
  --background: var(--neutral-50);
  --surface: #FFFFFF;
  --white: #FFFFFF;
  --bg: var(--background);
  --bg-subtle: var(--neutral-100);
  --surface-muted: var(--background);
  --surface-sunken: var(--brand-50);
  --surface-tint: var(--brand-100);

  --text-primary: var(--neutral-800);
  --text-secondary: var(--neutral-600);
  --text-muted: #5A6678;       /* AA on white, background and bg-subtle */
  --text-faint: var(--neutral-400); /* decorative only (icons, disabled) — fails AA for text */
  --text: var(--text-primary);

  --border: var(--neutral-200);
  --border-light: #EEF2F7;
  --border-strong: var(--neutral-300);
  --border-focus: var(--brand-500);

  /* ── Legacy aliases (older CSS and views still read these) ── */
  --primary: var(--brand-600);
  --primary-dark: var(--brand-700);
  --primary-light: var(--brand-500);
  --primary-lighter: var(--brand-300);
  --accent: var(--accent-500);
  --accent-dark: var(--accent-600);
  --accent-light: var(--accent-300);
  --accent-lighter: var(--accent-200);

  /* ── Sidebar (deep blue) ── */
  --sidebar-bg: var(--brand-900);
  --sidebar-text: #E2E8F0;
  --sidebar-muted: #B6C3E0;
  --sidebar-hover: rgba(255, 255, 255, 0.07);
  --sidebar-active: rgba(255, 255, 255, 0.12);
  --sidebar-marker: var(--accent-400);

  /* ── Spacing scale ── */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* ── Radius scale ── */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: var(--radius);
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 999px;

  /* ── Shadow scale (soft, slate-tinted) ── */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.1);

  /* ── Layout ── */
  --sidebar-width: 264px;
  --header-height: 72px;
  --page-pad-x: 32px;
  --page-pad-y: 24px;
  --section-gap: 24px;
  --control-h: 40px;
  --control-h-sm: 32px;

  /* ── Typography: Inter for UI, a classic serif for large headings only ── */
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-md: 0.9375rem;
  --text-lg: 1.125rem;
  --text-xl: 1.35rem;
  --text-2xl: 1.65rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;

  /* ── Focus, motion, layering ── */
  --focus-ring: 0 0 0 3px rgba(53, 96, 212, 0.28);
  --dur-fast: 150ms;
  --dur: 200ms;
  --dur-slow: 250ms;
  --ease: 160ms ease;
  --z-dropdown: 1000;
  --z-header: 1020;
  --z-modal: 1050;
  --z-toast: 1100;
  --z-progress: 1200;

  /* ── Bootstrap bridge ── */
  --bs-primary: #1E40AF;
  --bs-primary-rgb: 30, 64, 175;
  --bs-link-color: #1E40AF;
  --bs-link-hover-color: #1A3591;
  --bs-border-radius: 8px;
  --bs-body-font-family: var(--font);
  --bs-body-color: var(--text);
  --bs-body-bg: var(--bg);

  --blue-50: var(--brand-50);
  --blue-100: var(--brand-100);
  --blue-200: var(--brand-300);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  letter-spacing: -0.011em;
  line-height: 1.5;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand-600);
  text-decoration: none;
}

a:hover {
  color: var(--brand-700);
}

img {
  max-width: 100%;
}

:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 2000;
  background: var(--brand-700);
  color: var(--white);
  padding: 8px 12px;
  border-radius: 8px;
}

.skip-link:focus {
  top: 12px;
}

/*--------------------------------------------------------------
   Layout
--------------------------------------------------------------*/
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.page-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--page-pad-y) var(--page-pad-x) var(--space-12);
  /* Opacity-only enter: a transform here makes position:fixed descendants
     (offcanvas, modals, backdrops) position against this box and clip badly. */
  animation: page-enter 280ms ease both;
}

@keyframes page-enter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.page-content > .container,
.page-content > .container-fluid,
.page-content > .container-lg {
  max-width: 100%;
  padding-left: 0;
  padding-right: 0;
}

.page-content > .container.mt-5,
.page-content > .container.mt-4,
.page-content > .mt-5,
.page-content > .mt-4,
.page-content > .mt-3,
.page-content > .py-8,
.page-content > .py-12 {
  margin-top: 0 !important;
}

.page-content > h5.text-center,
.page-content h5.text-center {
  text-align: left !important;
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  color: var(--text) !important;
  margin: 0 0 1rem !important;
}

/*--------------------------------------------------------------
   Page header
--------------------------------------------------------------*/
.ui-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}

.ui-page-heading,
.ui-page-header h1,
.ui-page-header h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.25;
}

.ui-kicker {
  margin: 0 0 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-600);
}

.ui-page-desc,
.page-subtitle {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 62ch;
  font-weight: 500;
}

.ui-page-header__actions,
.ui-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-left: auto;
}

.ui-page-header .form-control,
.ui-page-header .form-select {
  min-width: min(100%, 240px);
  max-width: 360px;
  height: var(--control-h);
}

.org-chrome {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.org-chrome .ui-tabs__list {
  margin-bottom: 0;
}

.org-chrome__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.dash-welcome {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.dash-welcome-date {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 12px;
}

.section-heading h2,
.section-heading h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.section-heading p {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/*--------------------------------------------------------------
   Sidebar
--------------------------------------------------------------*/
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border: 0 !important;
  border-right: 0 !important;
  border-radius: 0 !important;
  box-shadow: none;
  z-index: 1040;
}

.sidebar .sidebar-brand {
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 20px 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
}

.sidebar .sidebar-brand img {
  max-height: 36px;
  width: auto;
  max-width: 40px;
  object-fit: contain;
  background: var(--white);
  border-radius: 8px;
  padding: 4px;
}

.sidebar-brand__copy {
  text-align: left;
  min-width: 0;
}

.sidebar-brand__name {
  display: block;
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--white);
}

.sidebar-brand__tag {
  display: block;
  margin: 2px 0 0;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
}

.sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 12px 28px;
  display: flex;
  flex-direction: column;
}

.sidebar .nav-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 8px 6px;
  padding: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
}

.sidebar .nav-section-label:first-child {
  margin-top: 2px;
}

.sidebar .nav-group {
  width: 100%;
}

.sidebar .nav-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 16px 0 6px;
  padding: 4px 8px;
  border: 0;
  background: transparent;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  cursor: pointer;
  transition: color 160ms ease;
}

.sidebar .nav-group:first-of-type .nav-section-toggle {
  margin-top: 2px;
}

.sidebar .nav-section-toggle:hover,
.sidebar .nav-section-toggle:focus-visible {
  color: var(--white);
  outline: none;
}

.sidebar .nav-chevron {
  font-size: 0.66rem;
  color: var(--sidebar-muted);
  transition: transform 180ms ease;
}

.sidebar .nav-chevron.is-open {
  transform: rotate(90deg);
}

.sidebar .nav {
  gap: 1px;
}

.sidebar .nav-item {
  width: 100%;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--sidebar-text) !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  line-height: 1.3;
  padding: 9px 12px !important;
  margin: 1px 0;
  border-radius: 8px;
  border: 0;
  background: transparent;
  transition: background 160ms ease, color 160ms ease;
}

.sidebar .nav-link .nav-ico {
  width: 28px;
  height: 28px;
  min-width: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: transparent;
  font-size: 0.95rem;
  color: var(--sidebar-muted);
}

.sidebar .nav-link i {
  font-size: 0.95rem;
  line-height: 1;
}

.sidebar .nav-link:hover,
.sidebar .nav-link:focus {
  background: var(--sidebar-hover) !important;
  color: var(--white) !important;
}

.sidebar .nav-link:hover .nav-ico,
.sidebar .nav-link:focus .nav-ico {
  color: var(--primary-light);
}

.sidebar .nav-item:has(> .nav-link.active) {
  position: relative;
}

.sidebar .nav-link.active,
.sidebar .nav-link.bg-secondary {
  background: var(--sidebar-active) !important;
  color: var(--white) !important;
  border-radius: 8px;
  margin: 1px 0;
  padding: 9px 12px !important;
  width: 100%;
  box-shadow: none;
  font-weight: 600 !important;
  position: relative;
  z-index: 1;
}

.sidebar .nav-link.active::before,
.sidebar .nav-link.active::after {
  content: none;
}

.sidebar .nav-link.active:hover,
.sidebar .nav-link.active:focus,
.sidebar .nav-link.bg-secondary:hover,
.sidebar .nav-link.bg-secondary:focus {
  background: var(--sidebar-active) !important;
  color: var(--white) !important;
}

.sidebar .nav-link.active:hover .nav-ico,
.sidebar .nav-link.active:focus .nav-ico {
  color: var(--primary-lighter);
}

.sidebar .nav-link.active .nav-ico,
.sidebar .nav-link.bg-secondary .nav-ico {
  background: transparent;
  color: var(--primary-lighter);
}

.sidebar .nav.ms-4 {
  margin-left: 0.85rem !important;
  padding-left: 0.5rem;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  scrollbar-width: thin;
}

.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 99px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.32);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(23, 50, 77, 0.4);
  z-index: 1070;
}

/*--------------------------------------------------------------
   Header
--------------------------------------------------------------*/
.app-header,
.header {
  position: sticky;
  top: 0;
  z-index: 1020;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 32px 8px;
  background: var(--background);
  backdrop-filter: none;
  border-bottom: 0;
  box-shadow: none;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1 1 auto;
}

.app-header-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 1 auto;
  min-width: 0;
}

.app-header-center {
  display: none;
}

.header-breadcrumb.ui-breadcrumb {
  display: none;
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.header-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 220px;
  flex: 0 1 220px;
  min-width: 160px;
  height: 40px;
  margin: 0;
  padding: 0 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  box-shadow: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, width 200ms ease;
}

.header-search:focus-within {
  width: 280px;
  flex-basis: 280px;
  border-color: var(--border-focus);
  box-shadow: var(--focus-ring);
  background: var(--white);
}

.header-search i {
  font-size: 0.95rem;
  flex-shrink: 0;
}

.header-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}

.header-search input::placeholder {
  color: var(--text-faint);
}

.header-breadcrumb.ui-breadcrumb:not(:empty) {
  display: flex;
}

.header-breadcrumb .ui-breadcrumb__current {
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-title,
.app-header .page-title,
.header .text-primary.fw-bold.fs-4 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text) !important;
  letter-spacing: -0.04em;
  line-height: 1.2;
  max-width: min(70vw, 760px);
}

.header-subtitle {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
  line-height: 1.4;
  max-width: min(70vw, 760px);
}

.sidebar-toggle,
#sidebarToggle.navbar-toggler {
  position: static !important;
  margin: 0 !important;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--brand-700);
  min-width: 40px;
  min-height: 40px;
}

.header-nav {
  flex: 0 0 auto;
}

.header-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.header-nav > ul {
  gap: 8px;
}

.header-nav .nav-icon {
  width: 40px;
  height: 40px;
  margin-right: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 1.05rem;
  position: relative;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}

.header-nav .nav-icon:hover {
  background: var(--brand-50);
  border-color: var(--brand-200);
  color: var(--primary-dark);
}

.header-nav .badge-number {
  position: absolute;
  top: 4px;
  right: 4px;
  inset: auto;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-600) !important;
}

.header-nav .nav-profile {
  color: var(--text);
  gap: 10px;
  padding: 3px 10px 3px 3px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--white);
}

.header-nav .nav-profile:hover {
  background: var(--brand-50);
}

.header-nav .nav-profile img,
.header-avatar {
  width: 34px !important;
  height: 34px !important;
  max-height: 34px !important;
  object-fit: cover;
  border-radius: 50%;
}

.header-nav .nav-profile span,
.header-username {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-nav .dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 8px;
  margin-top: 10px !important;
}

.header-nav .notifications {
  min-width: 340px;
  max-width: min(92vw, 380px);
}

.header-nav .notifications .dropdown-header {
  font-weight: 600;
  color: var(--text-muted);
  padding: 10px 12px;
}

.header-nav .profile {
  min-width: 240px;
}

.header-nav .profile .dropdown-header h6 {
  font-size: 0.95rem;
  margin-bottom: 2px;
  font-weight: 700;
  color: var(--text);
}

.header-nav .profile .dropdown-header span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.header-nav .dropdown-item {
  font-size: 0.88rem;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text);
}

.header-nav .dropdown-item i {
  margin-right: 10px;
  color: var(--brand-600);
}

.header-nav .dropdown-item:hover {
  background: var(--brand-50);
  color: var(--brand-800);
}

/*--------------------------------------------------------------
   Cards
--------------------------------------------------------------*/
.card {
  margin-bottom: var(--space-6);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.card.vh-100 {
  height: auto !important;
  min-height: 0 !important;
}

.card-header,
.card-footer {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-muted);
  padding: 16px 24px;
}

.card-header {
  border-top-left-radius: var(--radius-lg) !important;
  border-top-right-radius: var(--radius-lg) !important;
}

.card-header h1,
.card-header h2,
.card-header h3,
.card-header h4,
.card-header h5 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text) !important;
  letter-spacing: -0.02em;
  margin: 0;
}

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

.card-title span {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.card-body {
  padding: 20px 24px;
}

.card-header.bg-dark,
.card-header.bg-secondary,
.text-white.card-header.bg-secondary {
  background: var(--primary) !important;
  color: var(--white) !important;
  border: 0;
}

/*--------------------------------------------------------------
   Tables
--------------------------------------------------------------*/
.table-wrapper {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  /* overflow-x for wide tables on small screens; overflow-y must stay visible
     or it clips the Actions dropdown menu whenever the table is short enough
     that the menu would extend past the wrapper's bottom edge. */
  overflow-x: auto;
  overflow-y: visible;
  margin-bottom: 1.25rem;
}

.table-wrapper table,
.card .table,
table.table {
  width: 100% !important;
  max-width: 100%;
  margin-bottom: 0;
}

.table {
  --bs-table-striped-bg: var(--neutral-50);
  --bs-table-hover-bg: var(--brand-50);
  color: var(--text);
  border-color: var(--border);
}

.table > :not(caption) > * > * {
  padding: 14px 16px;
  vertical-align: middle;
}

.table thead th,
.table thead td,
table thead th {
  background: var(--surface-muted) !important;
  color: var(--text-muted) !important;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border) !important;
  white-space: nowrap;
}

.table tbody td,
.table tbody th {
  border-color: var(--border-light) !important;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.table tbody tr:hover > * {
  background: var(--surface-tint);
}

.table-bordered > :not(caption) > * > * {
  border-color: var(--border);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-accent-bg: var(--blue-50);
}

.table thead.bg-primary,
.table thead.text-white.bg-primary,
thead.bg-primary {
  background: var(--surface-muted) !important;
  color: var(--text-muted) !important;
}

.page-content .mt-3:has(> table.table):not(.table-wrapper) {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: auto;
}

td .btn + .btn,
td .btn + form,
td form {
  margin-left: 0;
}

td .d-flex.gap-2 {
  flex-wrap: wrap;
}

.table .btn-sm,
td .btn-sm {
  min-height: 32px;
}

/*--------------------------------------------------------------
   Toolbars / filters
--------------------------------------------------------------*/
.page-toolbar,
form.page-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: none;
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-6);
}

.toolbar-primary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.toolbar-filters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-3) var(--space-4);
  align-items: end;
}

.page-toolbar .form-label {
  margin-bottom: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.page-toolbar .form-control,
.page-toolbar .form-select,
.page-toolbar input:not([type="hidden"]):not([type="radio"]):not([type="checkbox"]),
.page-toolbar select,
.page-toolbar [type="text"],
.page-toolbar [type="search"],
.page-toolbar [type="number"],
.page-toolbar [type="date"],
.page-toolbar [type="month"] {
  width: 100% !important;
  max-width: none;
  flex: 1 1 auto;
  min-width: 0;
}

.toolbar-search,
.page-toolbar .toolbar-search {
  flex: 1 1 280px;
  min-width: 220px;
  max-width: none !important;
}

.page-toolbar .btn-group {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.page-toolbar .col,
.page-toolbar [class*="col-"] {
  flex: 1 1 180px;
  max-width: none;
  width: auto;
  padding: 0;
}

.page-toolbar .row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-3) var(--space-4);
  margin: 0;
  --bs-gutter-x: 0;
  --bs-gutter-y: 0;
  align-items: end;
}

.page-toolbar .toolbar-actions {
  flex: 0 0 auto;
  margin-left: auto;
}

.toolbar-primary > .toolbar-actions:first-child,
.toolbar-filters .toolbar-actions {
  margin-left: 0;
}

.toolbar-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin: -4px 0 16px;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand-50);
  color: var(--brand-800);
  font-size: 0.75rem;
  font-weight: 600;
}

/*--------------------------------------------------------------
   Forms
--------------------------------------------------------------*/
label,
.form-label,
.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.form-control,
.form-select,
select.form-control,
textarea.form-control,
input.form-control,
.form-control-sm,
.form-select-sm {
  min-height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm) !important;
  background: var(--white);
  color: var(--text);
  font-size: 0.9rem;
  box-shadow: none !important;
  padding: 0.48rem 0.78rem;
}

textarea.form-control {
  min-height: 96px;
}

.form-control:focus,
.form-select:focus,
select.form-control:focus,
textarea:focus,
input:focus {
  border-color: var(--brand-400) !important;
  box-shadow: var(--focus-ring) !important;
}

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: var(--danger) !important;
}

.invalid-feedback,
.text-danger.small {
  font-size: 0.78rem;
}

.form-text,
.form-group small,
.help-text {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.page-content form .row {
  --bs-gutter-y: 0.9rem;
}

.page-content form.form-horizontal,
.page-content > .container > form:not(.page-toolbar),
.page-content > .m-3 > form.form-horizontal,
.page-content > .mt-3 > form.form-horizontal {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 22px 22px 24px;
}

.page-content .card form.form-horizontal {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

fieldset,
.form-section {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg);
  padding: var(--space-6) !important;
  margin-bottom: var(--space-6);
  background: var(--surface);
}

.ui-card fieldset,
.card fieldset,
.ui-card .form-section,
.card .form-section {
  background: transparent;
  border: 0 !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: 0;
  padding: 0 0 var(--space-6) !important;
  margin-bottom: var(--space-6);
}

.ui-card fieldset:last-of-type,
.card fieldset:last-of-type,
.ui-card .form-section:last-of-type,
.card .form-section:last-of-type {
  border-bottom: 0 !important;
  margin-bottom: 0;
  padding-bottom: 0 !important;
}

legend {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  padding: 0 8px;
  float: none;
  width: auto;
  margin-bottom: var(--space-4);
}

.form-check-input:checked {
  background-color: var(--brand-600);
  border-color: var(--brand-600);
}

.form-check-input:focus {
  box-shadow: var(--focus-ring);
}

.tokenfield {
  min-height: 42px;
  border: 1px solid var(--border-strong) !important;
  border-radius: 8px !important;
  padding: 4px 8px;
  background: var(--white);
}

.tokenfield.focus {
  border-color: var(--brand-400) !important;
  box-shadow: var(--focus-ring);
}

.sticky-bottom {
  background: rgba(255, 255, 255, 0.96) !important;
  border-top: 1px solid var(--border);
  backdrop-filter: blur(10px);
  padding: 12px 20px;
  box-shadow: 0 -6px 20px rgba(15, 28, 51, 0.05);
}

/*--------------------------------------------------------------
   Buttons
--------------------------------------------------------------*/
.btn {
  border-radius: var(--radius-sm) !important;
  font-weight: 600;
  letter-spacing: 0;
  padding: 0.48rem 0.95rem;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background var(--ease), border-color var(--ease), color var(--ease), box-shadow var(--ease);
}

.btn:hover {
  transform: none;
}

.btn:focus-visible {
  box-shadow: var(--focus-ring);
}

.btn-sm {
  padding: 0.28rem 0.65rem;
  font-size: 0.8rem;
  min-height: 32px;
}

.btn-lg {
  min-height: 46px;
  padding: 0.62rem 1.15rem;
}

.btn-primary,
.btn-primary:focus {
  background: var(--brand-600) !important;
  border-color: var(--brand-600) !important;
  color: var(--white) !important;
  box-shadow: none;
}

.btn-primary:hover {
  background: var(--brand-700) !important;
  border-color: var(--brand-700) !important;
}

.btn-outline-primary {
  color: var(--brand-700) !important;
  border-color: var(--border-strong) !important;
  background: var(--white);
}

.btn-outline-primary:hover,
.btn-check:checked + .btn-outline-primary {
  background: var(--brand-50) !important;
  border-color: var(--brand-200) !important;
  color: var(--brand-800) !important;
}

.btn-secondary,
.dropdown .btn-secondary {
  background: var(--white) !important;
  color: var(--text) !important;
  border: 1px solid var(--border-strong) !important;
  box-shadow: none;
}

.btn-secondary:hover,
.dropdown .btn-secondary:hover {
  background: var(--surface-muted) !important;
  color: var(--text) !important;
}

.btn-info {
  background: var(--info-bg) !important;
  border-color: var(--info-border) !important;
  color: var(--info) !important;
}

.btn-warning {
  background: var(--warning-bg) !important;
  border-color: var(--warning-border) !important;
  color: var(--warning) !important;
}

.btn-danger {
  background: var(--danger-bg) !important;
  border-color: var(--danger-border) !important;
  color: var(--danger) !important;
}

.btn-success {
  background: var(--success-bg) !important;
  border-color: var(--success-border) !important;
  color: var(--success) !important;
}

.btn-info:hover,
.btn-warning:hover,
.btn-danger:hover,
.btn-success:hover {
  filter: brightness(0.98);
}

.btn-link {
  color: var(--brand-600);
  min-height: auto;
  padding: 0.2rem 0.35rem;
}

table .btn,
td .btn {
  white-space: nowrap;
}

.btn:disabled,
.btn.disabled {
  opacity: 0.55;
  pointer-events: none;
}

/*--------------------------------------------------------------
   Badges / status
--------------------------------------------------------------*/
.badge {
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: 999px;
  padding: 0.38em 0.68em;
  font-size: 0.72rem;
}

.badge.bg-primary { background: var(--brand-100) !important; color: var(--brand-800) !important; }
.badge.bg-success,
.badge.text-bg-success { background: var(--success-bg) !important; color: var(--success) !important; }
.badge.bg-warning,
.badge.text-bg-warning { background: var(--warning-bg) !important; color: var(--warning) !important; }
.badge.bg-danger,
.badge.text-bg-danger { background: var(--danger-bg) !important; color: var(--danger) !important; }
.badge.bg-info,
.badge.text-bg-info { background: var(--info-bg) !important; color: var(--info) !important; }
.badge.bg-secondary,
.badge.text-bg-secondary { background: var(--blue-50) !important; color: var(--text-secondary) !important; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.2;
  background: var(--blue-50);
  color: var(--text-secondary);
}

.status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-badge.is-success { background: var(--success-bg); color: var(--success); }
.status-badge.is-warning { background: var(--warning-bg); color: var(--warning); }
.status-badge.is-danger { background: var(--danger-bg); color: var(--danger); }
.status-badge.is-info { background: var(--info-bg); color: var(--info); }
.status-badge.is-primary { background: var(--brand-50); color: var(--brand-700); }
.status span,
.status [class^="status-"] {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--brand-50);
  color: var(--brand-800);
  font-size: 0.72rem;
  font-weight: 600;
}

.page-content h5.mb-4 {
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  color: var(--text) !important;
  letter-spacing: -0.02em;
}

.page-content h5.mb-4 i {
  display: none;
}

/*--------------------------------------------------------------
   Feedback
--------------------------------------------------------------*/
.alert {
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 12px 14px;
}

.alert-success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.alert-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.alert-info { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
.alert-primary { background: var(--brand-50); color: var(--brand-800); border-color: var(--brand-200); }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 12px;
  background: var(--brand-50);
  color: var(--brand-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.empty-state h3 {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
}

.empty-state p {
  margin: 0 auto 16px;
  max-width: 42ch;
  font-size: 0.88rem;
}

.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, var(--neutral-50) 37%, var(--border-light) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s ease infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/*--------------------------------------------------------------
   Overlays
--------------------------------------------------------------*/
.modal-content {
  border: 0;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.modal-header,
.modal-footer {
  border-color: var(--border);
  padding: 16px 24px;
}

.modal-body {
  padding: 20px 24px;
}

.modal-footer .btn + .btn,
.modal-footer .ui-btn + .ui-btn {
  margin-left: 0;
}

.modal-footer {
  gap: 12px;
}

.modal-title {
  font-weight: 700;
  color: var(--text);
}

.modal-dialog-scrollable .modal-body {
  padding: 16px 18px;
}

.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
}

.dropdown-item {
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 0.86rem;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: var(--brand-50);
  color: var(--brand-800);
}

.dropdown-item.text-danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.page-link {
  color: var(--brand-600);
  border-radius: 8px !important;
  margin: 0 2px;
  border: 1px solid var(--border);
  min-width: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.page-item.active .page-link {
  background: var(--brand-600);
  border-color: var(--brand-600);
}

.pagination {
  gap: 2px;
}

.tooltip .tooltip-inner {
  background: var(--brand-950);
  border-radius: 8px;
  padding: 6px 10px;
}

.nav-tabs {
  border-bottom: 1px solid var(--border);
  gap: 4px;
}

.nav-tabs .nav-link {
  border: 0;
  color: var(--text-muted);
  font-weight: 600;
  border-radius: 8px 8px 0 0;
  padding: 10px 14px;
}

.nav-tabs .nav-link.active {
  color: var(--brand-700);
  background: transparent;
  box-shadow: inset 0 -2px 0 var(--brand-600);
}

.progress {
  height: 10px;
  background: var(--bg-subtle);
  border-radius: 99px;
}

.progress-bar {
  background: var(--brand-600);
}

.list-group {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border);
}

.list-group-item {
  border-color: var(--border);
  padding: 14px 16px;
}

.list-group-item + .list-group-item {
  border-top: 1px solid var(--border);
}

.notification-item {
  transition: background var(--ease);
}

.notification-item:hover {
  background: var(--brand-50);
}

/*--------------------------------------------------------------
   Dashboard
--------------------------------------------------------------*/
.dashboard .filter {
  position: absolute;
  right: 8px;
  top: 10px;
}

.dashboard a {
  text-decoration: none;
  color: inherit;
}

.stat-grid {
  --bs-gutter-x: 12px;
  --bs-gutter-y: 12px;
}

.stat-grid > [class*="col-"] {
  display: flex;
}

.dashboard a:has(.info-card) {
  display: flex;
  width: 100%;
}

.dashboard .info-card {
  width: 100%;
  min-height: 104px;
  height: 100%;
  margin-bottom: 0 !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-xs) !important;
  background: var(--white);
  transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}

.dashboard .info-card:hover {
  border-color: var(--brand-200) !important;
  box-shadow: var(--shadow-sm) !important;
  transform: translateY(-1px);
}

.dashboard .info-card .card-body {
  height: 100%;
  min-height: 104px;
  padding: 14px 16px !important;
  display: flex;
  flex-direction: column;
}

.dashboard .info-card .card-title {
  order: 0;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--text-secondary) !important;
  padding: 0 40px 0 0 !important;
  margin: 0 !important;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.05em;
}

.dashboard .info-card .card-title span {
  display: inline;
  margin-top: 0;
  font-size: inherit;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-faint);
}

.dashboard .info-card .d-flex.align-items-center {
  margin-top: auto;
  padding-top: 12px;
  align-items: flex-end !important;
}

.dashboard .info-card .card-icon {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px !important;
  height: 34px !important;
  border-radius: 9px !important;
  margin: 0 !important;
  font-size: 0.95rem;
}

.dashboard .info-card .card-body {
  position: relative;
}

.dashboard .info-card .ps-3 {
  padding-left: 0 !important;
}

.dashboard .info-card h6 {
  font-size: 1.55rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text) !important;
}

.dashboard .info-card .text-muted,
.dashboard .info-card .small {
  display: block;
  margin-top: 4px;
  font-size: 0.74rem !important;
  color: var(--text-muted) !important;
  padding: 0 !important;
  font-weight: 500;
}

.dashboard .sales-card .card-icon { color: var(--brand-600); background: var(--brand-100); }
.dashboard .revenue-card .card-icon { color: var(--success); background: var(--success-bg); }
.dashboard .customers-card .card-icon { color: var(--secondary-700); background: var(--secondary-50); }
.dashboard .appraisal-card .card-icon { color: var(--brand-700); background: var(--brand-100); }
.dashboard .success-card .card-icon { color: var(--success); background: var(--success-bg); }
.dashboard .warning-card .card-icon { color: var(--warning); background: var(--warning-bg); }
.dashboard .danger-card .card-icon { color: var(--danger); background: var(--danger-bg); }
.dashboard .info-alt-card .card-icon { color: var(--info); background: var(--info-bg); }
.dashboard .pink-card .card-icon { color: var(--brand-500); background: var(--brand-100); }

.dashboard .card .filter {
  display: none;
}

.dashboard #trafficChart,
.dashboard #budgetChart {
  min-height: 280px !important;
  height: 280px !important;
}

.dashboard #reportsChart {
  min-height: 220px;
}

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

.dashboard .news .post-item img {
  display: none;
}

.dashboard .activity {
  font-size: 14px;
}

.dashboard .news .post-item {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.dashboard .news .post-item img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  grid-row: span 3;
}

.dashboard .news .post-item h4 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
}

.dashboard .news .post-item p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/*--------------------------------------------------------------
   Detail pages
--------------------------------------------------------------*/
.page-content section.border,
.page-content section.p-3.mb-4.border {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  background: var(--surface);
  box-shadow: none;
  padding: 16px 18px !important;
}

.page-content section.border h1,
.page-content section.p-3 h1.text-dark,
.page-content section.p-3 h5 {
  font-size: 0.78rem !important;
  font-weight: 700;
  color: var(--text-muted) !important;
  margin: 0 0 12px !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-content section.border .row,
.page-content section.p-3 .row.mb-3 {
  margin-bottom: 0 !important;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.page-content section.border .row:last-child,
.page-content section.p-3 .row.mb-3:last-child {
  border-bottom: 0;
}

.detail-kicker {
  margin: 0 0 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-600);
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.page-content > .container.mt-5,
.page-content > .container.py-4,
.page-content > .container.py-5 {
  max-width: 1080px;
  margin-left: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px 26px 28px !important;
  box-shadow: var(--shadow-xs);
}

.page-content .form-group:has(> p) p,
.page-content p.p-2.border.rounded.bg-light,
.page-content p.border.p-2.rounded.bg-light {
  border: 0 !important;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
}

.page-content .container .form-group:has(> p),
.page-content .container .mb-3.form-group:has(> p) {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px !important;
  margin-bottom: 0 !important;
}

.page-content .container .form-group:has(> p) label,
.page-content .container .mb-3.form-group:has(> p) label {
  display: block;
  font-size: 0.68rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted) !important;
  margin-bottom: 6px;
}

/*--------------------------------------------------------------
   Plugins
--------------------------------------------------------------*/
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  padding: 10px 12px 12px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 6px 10px;
  margin-left: 8px;
  min-height: 36px;
}

.select2-container--bootstrap-5 .select2-selection,
.select2-container .select2-selection--single {
  min-height: 42px !important;
  border-radius: 8px !important;
  border-color: var(--border-strong) !important;
}

.bootstrap-table .fixed-table-toolbar {
  padding: 10px 12px 8px;
}

.fixed-table-toolbar .bs-bars,
.fixed-table-toolbar .search,
.fixed-table-toolbar .columns {
  margin-bottom: 8px;
}

.bootstrap-table .search input {
  min-height: 38px;
  border-radius: 8px !important;
}

.fc .fc-toolbar-title {
  font-size: 1.1rem !important;
  font-weight: 700;
}

.fc .fc-button-primary {
  background: var(--brand-600) !important;
  border-color: var(--brand-600) !important;
}

.fc .fc-daygrid-event {
  border-radius: 6px;
}

.bg-indigo-600 { background-color: var(--brand-600) !important; }
.hover\:bg-indigo-700:hover,
.focus\:bg-indigo-700:focus { background-color: var(--brand-700) !important; }
.focus\:ring-indigo-500:focus,
.focus\:border-indigo-500:focus {
  --tw-ring-color: rgba(26, 86, 219, 0.35);
  border-color: var(--brand-500) !important;
}

/* Tailwind screens that still exist should look like the product */
.bg-white.dark\:bg-gray-800,
.max-w-10xl,
.py-8 {
  font-family: var(--font);
}

/*--------------------------------------------------------------
   Auth
--------------------------------------------------------------*/
.auth-body {
  min-height: 100vh;
  background: var(--bg);
  font-family: var(--font);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
}

.auth-panel {
  background: var(--primary);
  color: var(--white);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px 72px;
  position: relative;
  overflow: hidden;
}

.auth-panel::after {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  right: -80px;
  bottom: -90px;
  background: rgba(165, 243, 252, 0.16);
}

.auth-panel img {
  width: 84px;
  height: auto;
  background: var(--white);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}

.auth-panel h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.auth-panel p {
  font-size: 1rem;
  max-width: 420px;
  color: rgba(255, 255, 255, 0.74);
  position: relative;
  z-index: 1;
}

.auth-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: var(--white);
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-card h2 {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 6px;
}

.auth-card .auth-sub {
  color: var(--text-muted);
  margin-bottom: 28px;
}

.auth-card button[type="submit"] {
  width: 100%;
  min-height: 44px;
  border-radius: 10px;
  background: var(--brand-600);
  color: var(--white);
  border: 0;
  font-weight: 700;
  cursor: pointer;
}

.auth-card button[type="submit"]:hover {
  background: var(--brand-700);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form__links {
  display: flex;
  justify-content: center;
}

/* While a sign-in is in flight, hide the previous attempt's error so it isn't read as the result. */
.auth-card form[data-ui-submitting] .ui-field__error {
  opacity: 0;
}

.auth-card form[data-ui-submitting] .ui-input.is-invalid {
  border-color: var(--border-strong);
  box-shadow: none;
}

/*--------------------------------------------------------------
   Scrollbars
--------------------------------------------------------------*/
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: var(--brand-300);
  border-radius: 99px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/*--------------------------------------------------------------
   Responsive
--------------------------------------------------------------*/
@media (max-width: 1199.98px) {
  .stat-grid > .col-xl-3 {
    flex: 0 0 50%;
    max-width: 50%;
  }
}

@media (max-width: 991.98px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-panel {
    padding: 32px 24px;
    min-height: 200px;
  }

  .auth-panel h1 {
    font-size: 1.45rem;
  }
}

@media (max-width: 767.98px) {
  .sidebar,
  .mobile-menu {
    position: fixed !important;
    left: -100%;
    top: 0;
    height: 100vh;
    transition: left 0.24s ease;
    z-index: 1080;
    width: min(88vw, 300px);
    min-width: min(88vw, 300px);
    max-width: min(88vw, 300px);
  }

  .mobile-menu.active {
    left: 0;
  }

  .page-content {
    padding: 14px 14px 36px;
  }

  .app-header,
  .header {
    padding: 8px 14px;
  }

  .page-title,
  .header .text-primary.fw-bold.fs-4 {
    font-size: 1.2rem;
    max-width: 58vw;
  }

  .header-search,
  .header-breadcrumb {
    display: none;
  }

  .header-subtitle {
    display: none;
  }

  #sidebarToggle.navbar-toggler {
    position: static !important;
  }

  .ui-page-header {
    flex-direction: column;
  }

  .ui-page-header__actions,
  .toolbar-actions {
    width: 100%;
  }

  .ui-page-header__actions .btn,
  .toolbar-actions .btn {
    flex: 1 1 auto;
  }

  .table-wrapper,
  .card .table-responsive,
  .dataTables_wrapper {
    overflow-x: auto;
  }

  .dashboard .info-card {
    min-height: 96px;
  }

  .page-content > .container.mt-5 > .row,
  .page-content > .container.py-4 > .row {
    display: block;
  }

  .btn {
    min-height: 42px;
  }
}

@media (min-width: 768px) {
  #main,
  .app-main {
    max-width: calc(100vw - var(--sidebar-width));
  }
}

@media (max-width: 767.98px) {
  #main,
  .app-main {
    max-width: 100vw;
  }
}

#main {
  min-width: 0;
}

/*--------------------------------------------------------------
   Print
--------------------------------------------------------------*/
@media print {
  .no-print,
  .btn,
  .navbar,
  .sidebar,
  .header,
  .app-header,
  .toast,
  .modal,
  .dropdown,
  .pagination,
  .alert,
  .skip-link {
    display: none !important;
  }

  #main,
  .app-main,
  .page-content {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible;
    height: auto !important;
  }

  body {
    background: white !important;
    color: black !important;
  }

  .card,
  .table-wrapper {
    box-shadow: none !important;
    border: 1px solid var(--border-strong) !important;
  }
}

.description {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
}

/*--------------------------------------------------------------
   Bridge leftover Tailwind screens into the design system
--------------------------------------------------------------*/
.text-gray-900, .text-gray-800, .dark\:text-white { color: var(--text) !important; }
.text-gray-700, .text-gray-600, .text-gray-500, .text-gray-400, .dark\:text-gray-400 { color: var(--text-muted) !important; }
.bg-gray-50, .dark\:bg-gray-700 { background: var(--surface-muted) !important; }
.bg-gray-100 { background: var(--bg-subtle) !important; }
.bg-white, .dark\:bg-gray-800 { background: var(--white) !important; }
.bg-blue-600, .bg-indigo-600 { background-color: var(--brand-600) !important; }
.hover\:bg-blue-800:hover, .hover\:bg-indigo-700:hover { background-color: var(--brand-700) !important; }
.text-blue-600, .text-blue-700, .hover\:text-blue-900:hover { color: var(--brand-700) !important; }
.text-red-600, .dark\:text-red-400 { color: var(--danger) !important; }
.text-green-600, .text-green-800, .dark\:text-green-400 { color: var(--success) !important; }
.bg-green-100 { background: var(--success-bg) !important; }
.bg-yellow-100 { background: var(--warning-bg) !important; }
.bg-red-100 { background: var(--danger-bg) !important; }
.border-gray-100, .border-gray-200, .divide-gray-200 { border-color: var(--border) !important; }
.rounded-xl, .rounded-lg, .sm\:rounded-lg { border-radius: var(--radius-lg) !important; }
.shadow, .shadow-sm, .shadow-lg { box-shadow: var(--shadow-xs) !important; }
.py-8.px-4, .py-12, .w-full.px-4.mx-auto.py-10 { padding: 0 !important; }
.max-w-10xl, .max-w-7xl { max-width: none !important; }
.bg-gradient-to-r.from-blue-600 { background: var(--brand-600) !important; }

/* ============================================================
   System lock — one product language, last-wins
   ============================================================ */

.app-header,
.header {
  padding: 0 var(--page-pad-x);
  min-height: var(--header-height);
}

.page-kicker {
  display: none;
}

.section.dashboard {
  margin: 0;
}

.dash-welcome {
  margin-bottom: var(--space-6);
  align-items: flex-end;
}

.dash-welcome .ui-page-heading {
  font-size: var(--text-xl);
}

.section-heading {
  margin: 0 0 var(--space-3);
}

.stat-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3) !important;
  margin: 0 0 var(--space-6);
}

.stat-grid > [class*="col-"] {
  width: 100%;
  max-width: none;
  flex: none;
  padding: 0;
  display: flex;
}

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

@media (min-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1500px) {
  .stat-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

.dash-body {
  --bs-gutter-x: 20px;
  --bs-gutter-y: 20px;
  align-items: start;
}

.dash-body > [class*="col-"] > .card,
.dash-body > [class*="col-"] > .col-12,
.dash-body > [class*="col-"] > .col-12.px-0 {
  width: 100%;
  max-width: 100%;
}

.dash-body .card {
  margin-bottom: var(--space-5);
}

.dashboard .info-card {
  min-height: 118px;
}

.dashboard .info-card .card-body {
  min-height: 118px;
  padding: var(--space-4) !important;
  gap: 8px;
}

.dashboard .info-card .card-title {
  font-size: var(--text-sm) !important;
  font-weight: 600 !important;
  color: var(--text-muted) !important;
  min-height: 0;
  -webkit-line-clamp: 2;
  padding-right: 40px !important;
}

.dashboard .info-card h6 {
  font-size: 1.75rem !important;
  font-weight: 700 !important;
}

.dashboard .info-card .card-icon {
  width: 32px !important;
  height: 32px !important;
  border-radius: var(--radius-sm) !important;
  font-size: 0.9rem;
}

.dashboard .info-card .text-muted,
.dashboard .info-card .small {
  font-size: var(--text-xs) !important;
}

.dashboard .card-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  font-size: 0.95rem;
  font-weight: 700;
}

.dashboard .card-title i {
  display: none;
}

.dashboard .card-title .badge {
  display: none;
}

.dashboard .card-title small,
.dashboard .card-title span {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.panel-head .card-title {
  padding-bottom: 0;
  margin: 0;
}

.dash-chart,
.dashboard #trafficChart,
.dashboard #budgetChart {
  min-height: 260px !important;
  height: 260px !important;
}

.dashboard #reportsChart {
  min-height: 248px;
}

.dashboard .table {
  --bs-table-bg: transparent;
}

.dashboard .table thead th {
  font-size: 0.68rem;
}

.dashboard .table tbody td {
  padding-top: 10px;
  padding-bottom: 10px;
}

.dashboard .avatar,
.page-content .avatar,
span.avatar {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px;
  border-radius: 50%;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--brand-100) !important;
  color: var(--brand-800) !important;
}

.feed-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.feed-item {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.feed-item:last-child {
  border-bottom: 0;
}

.feed-item:hover {
  background: transparent;
}

.feed-item.is-unread .feed-title {
  color: var(--text);
}

.feed-dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--border-strong);
}

.feed-item.is-unread .feed-dot {
  background: var(--brand-600);
}

.feed-title {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.4;
}

.feed-meta {
  margin: 4px 0 0;
  font-size: var(--text-xs);
  color: var(--text-faint);
}

.feed-item .btn-close {
  width: 8px;
  height: 8px;
  padding: 8px;
  opacity: 0.35;
  margin-top: 2px;
}

.feed-item .btn-close:hover {
  opacity: 0.8;
}

.dashboard .news {
  margin: 0;
}

.dashboard .news .post-item {
  display: block;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.dashboard .news .post-item:last-child {
  border-bottom: 0;
}

.dashboard .news .post-item img {
  display: none;
}

.dashboard .news .post-item h4 {
  font-size: var(--text-sm);
  font-weight: 600;
  margin: 0 0 4px;
}

.dashboard .news .post-item p {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.dashboard thead i {
  display: none;
}

.dashboard .btn-outline-primary.btn-sm {
  min-height: var(--control-h-sm);
}

.page-content table.min-w-full,
.page-content table.divide-y {
  width: 100% !important;
  margin: 0;
}

.page-content table.min-w-full thead th {
  background: var(--surface-muted) !important;
  color: var(--text-muted) !important;
  font-size: 0.7rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 11px 14px !important;
  border-bottom: 1px solid var(--border) !important;
}

.page-content table.min-w-full tbody td {
  padding: 11px 14px !important;
  font-size: 0.9rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light) !important;
  vertical-align: middle;
}

.table-wrapper > .p-3 {
  padding: 0 !important;
}

.card-header.bg-primary,
.card-header.bg-dark,
.card-header.bg-secondary,
.text-white.card-header.bg-primary,
.card-header.bg-primary.text-white {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-bottom: 1px solid var(--border) !important;
}

.card-header.bg-primary h5,
.card-header.bg-primary .mb-0,
.card-header.bg-primary i {
  color: var(--text) !important;
}

.btn,
.btn-sm,
.btn-lg {
  border-radius: var(--radius-sm) !important;
}

.btn {
  min-height: var(--control-h);
  font-size: var(--text-sm);
}

.btn-sm,
table .btn,
td .btn,
.dropdown-toggle.btn-sm {
  min-height: var(--control-h-sm);
  height: var(--control-h-sm);
  padding: 0 10px;
  font-size: var(--text-xs);
}

.form-control,
.form-select,
select.form-control,
input.form-control {
  min-height: var(--control-h);
  height: var(--control-h);
  border-radius: var(--radius-sm) !important;
  font-size: var(--text-sm);
}

textarea.form-control {
  height: auto;
  min-height: 96px;
}

.table > :not(caption) > * > * {
  padding: 11px 14px;
}

.table tbody td {
  font-size: var(--text-sm);
}

.page-content .list-group {
  border: 0;
  box-shadow: none;
  border-radius: 0;
}

.modal-content {
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow) !important;
}

.swal2-popup {
  border-radius: var(--radius-lg) !important;
}

.leave-approval-card > .card,
.leave-request-item > .card {
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
  margin-bottom: 12px;
}

.dashboard .top-selling,
.dashboard .recent-sales {
  overflow: hidden;
}

@media (max-width: 1199.98px) {
  .stat-grid > .col-xl-3 {
    flex: none;
    max-width: none;
  }
}

@media (max-width: 767.98px) {
  :root {
    --page-pad-x: 16px;
    --page-pad-y: 16px;
    --sidebar-width: 0px;
  }

  .page-content {
    padding: var(--page-pad-y) var(--page-pad-x) 36px;
  }

  .dash-welcome {
    flex-direction: column;
  }

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

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

.fixed-table-loading,
.bootstrap-table .fixed-table-loading {
  background: rgba(248, 250, 252, 0.86) !important;
  backdrop-filter: blur(4px);
}

.fixed-table-loading .loading-text,
.bootstrap-table .fixed-table-loading .loading-text,
.fixed-table-loading .loading-wrap .loading-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  font-size: 0 !important;
  color: transparent !important;
}

.fixed-table-loading .loading-wrap,
.bootstrap-table .fixed-table-loading .loading-wrap {
  display: flex !important;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  font-size: 0 !important;
  color: transparent !important;
}

.fixed-table-loading .loading-wrap::after,
.bootstrap-table .fixed-table-loading .loading-wrap::after {
  content: "";
  width: 22px;
  height: 22px;
  border: 2px solid var(--brand-200);
  border-top-color: var(--brand-600);
  border-radius: 50%;
  animation: hrmis-spin 0.65s linear infinite;
}

.dataTables_wrapper .dataTables_processing {
  background: rgba(248, 250, 252, 0.86) !important;
  border: 0 !important;
  box-shadow: none !important;
  color: transparent !important;
  font-size: 0 !important;
  height: 64px !important;
}

.dataTables_wrapper .dataTables_processing::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 2px solid var(--brand-200);
  border-top-color: var(--brand-600);
  border-radius: 50%;
  animation: hrmis-spin 0.65s linear infinite;
}

.echarts-loading-text {
  display: none !important;
}


/*--------------------------------------------------------------
   Serif display headings (large titles only — never in tables,
   forms, buttons or navigation)
--------------------------------------------------------------*/
.ui-page-heading,
.ui-page-header h1,
.ui-page-header h2,
.auth-card h2,
.auth-panel h1,
.ui-display,
.ui-error__title {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.ui-page-heading,
.ui-page-header h1,
.ui-page-header h2 {
  font-size: var(--text-2xl);
}

.auth-card h2 {
  font-size: var(--text-3xl);
}

.auth-panel h1 {
  font-size: var(--text-4xl);
  line-height: 1.15;
}

/* Sidebar active marker: a short amber bar on the left edge. */
.sidebar .nav-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--sidebar-marker);
}
