/* =========================================================
   School Staff HRMS — Design System
   Navy / academic-gold palette. Mobile-first, responsive.
   ========================================================= */

:root,
html[data-theme="blue"] {
  /* ---- Brand palette (Ocean Blue — default theme) ---- */
  --hrms-navy-950: #071633;
  --hrms-navy-900: #0b2a5c;
  --hrms-navy-800: #123f7a;
  --hrms-navy-700: #1a5296;
  --hrms-navy-600: #2568b0;
  --hrms-gold-500: #38bdf8;
  --hrms-gold-400: #7dd3fc;
  --hrms-gold-300: #bae6fd;
  --hrms-ink-900: #16233d;
  --hrms-ink-700: #3d4f6b;
  --hrms-ink-500: #64748b;
  --hrms-ink-300: #a3b3c9;
  --hrms-bg: #eaf2fb;
  --hrms-surface: #ffffff;
  --hrms-line: #d7e6f5;
  --hrms-success: #157a52;
  --hrms-success-bg: #e5f6ee;
  --hrms-warning: #92620a;
  --hrms-warning-bg: #fbf0dc;
  --hrms-danger: #b3273f;
  --hrms-danger-bg: #fbe7ea;
  --hrms-info: #1c6ea6;
  --hrms-info-bg: #e5f1fa;

  --hrms-radius-sm: 8px;
  --hrms-radius: 14px;
  --hrms-radius-lg: 20px;
  --hrms-shadow-sm: 0 1px 2px rgba(15, 27, 51, 0.06);
  --hrms-shadow: 0 4px 16px rgba(15, 27, 51, 0.08);
  --hrms-shadow-lg: 0 12px 32px rgba(15, 27, 51, 0.14);

  --sidebar-width: 268px;
  --sidebar-width-collapsed: 76px;
  --topbar-height: 64px;

  /* Re-point Bootstrap's own CSS variables at our palette so every
     Bootstrap component (buttons, badges, form focus rings, links…)
     inherits the brand without recompiling SCSS. */
  --bs-primary: var(--hrms-navy-800);
  --bs-primary-rgb: 18, 63, 122;
  --bs-link-color: var(--hrms-navy-800);
  --bs-link-color-rgb: 18, 63, 122;
  --bs-link-hover-color: var(--hrms-gold-500);
  --bs-body-color: var(--hrms-ink-900);
  --bs-body-bg: var(--hrms-bg);
  --bs-border-color: var(--hrms-line);
  --bs-font-sans-serif: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="orange"] {
  /* ---- Brand palette (Sunset Orange) ---- */
  --hrms-navy-950: #2a1205;
  --hrms-navy-900: #4a2007;
  --hrms-navy-800: #7c2d12;
  --hrms-navy-700: #9a3412;
  --hrms-navy-600: #c2410c;
  --hrms-gold-500: #fb923c;
  --hrms-gold-400: #fdba74;
  --hrms-gold-300: #fed7aa;
  --hrms-ink-900: #2b1c14;
  --hrms-ink-700: #5c4636;
  --hrms-ink-500: #8a7364;
  --hrms-ink-300: #c9b6a7;
  --hrms-bg: #fdf3ea;
  --hrms-surface: #ffffff;
  --hrms-line: #f3e0cb;
  --hrms-success: #157a52;
  --hrms-success-bg: #e5f6ee;
  --hrms-warning: #92620a;
  --hrms-warning-bg: #fbf0dc;
  --hrms-danger: #b3273f;
  --hrms-danger-bg: #fbe7ea;
  --hrms-info: #1c6ea6;
  --hrms-info-bg: #e5f1fa;

  --bs-primary: var(--hrms-navy-800);
  --bs-primary-rgb: 124, 45, 18;
  --bs-link-color: var(--hrms-navy-800);
  --bs-link-color-rgb: 124, 45, 18;
  --bs-link-hover-color: var(--hrms-gold-500);
  --bs-body-color: var(--hrms-ink-900);
  --bs-body-bg: var(--hrms-bg);
  --bs-border-color: var(--hrms-line);
}

html[data-theme="green"] {
  /* ---- Brand palette (Forest Green) ---- */
  --hrms-navy-950: #06281c;
  --hrms-navy-900: #0b4530;
  --hrms-navy-800: #10603f;
  --hrms-navy-700: #15794f;
  --hrms-navy-600: #1a9260;
  --hrms-gold-500: #34d399;
  --hrms-gold-400: #6ee7b7;
  --hrms-gold-300: #a7f3d0;
  --hrms-ink-900: #1a2e26;
  --hrms-ink-700: #3f5c50;
  --hrms-ink-500: #6b8a7d;
  --hrms-ink-300: #abc2b7;
  --hrms-bg: #eafbf3;
  --hrms-surface: #ffffff;
  --hrms-line: #d3f0e2;
  --hrms-success: #157a52;
  --hrms-success-bg: #e5f6ee;
  --hrms-warning: #92620a;
  --hrms-warning-bg: #fbf0dc;
  --hrms-danger: #b3273f;
  --hrms-danger-bg: #fbe7ea;
  --hrms-info: #1c6ea6;
  --hrms-info-bg: #e5f1fa;

  --bs-primary: var(--hrms-navy-800);
  --bs-primary-rgb: 16, 96, 63;
  --bs-link-color: var(--hrms-navy-800);
  --bs-link-color-rgb: 16, 96, 63;
  --bs-link-hover-color: var(--hrms-gold-500);
  --bs-body-color: var(--hrms-ink-900);
  --bs-body-bg: var(--hrms-bg);
  --bs-border-color: var(--hrms-line);
}

html[data-theme="purple"] {
  /* ---- Brand palette (Royal Violet) ---- */
  --hrms-navy-950: #1e1147;
  --hrms-navy-900: #321b6d;
  --hrms-navy-800: #4c2889;
  --hrms-navy-700: #5f35a3;
  --hrms-navy-600: #7345bd;
  --hrms-gold-500: #c084fc;
  --hrms-gold-400: #d8b4fe;
  --hrms-gold-300: #e9d5ff;
  --hrms-ink-900: #241a38;
  --hrms-ink-700: #4f4066;
  --hrms-ink-500: #7c6d94;
  --hrms-ink-300: #bcaed1;
  --hrms-bg: #f5eefc;
  --hrms-surface: #ffffff;
  --hrms-line: #e5d5f7;
  --hrms-success: #157a52;
  --hrms-success-bg: #e5f6ee;
  --hrms-warning: #92620a;
  --hrms-warning-bg: #fbf0dc;
  --hrms-danger: #b3273f;
  --hrms-danger-bg: #fbe7ea;
  --hrms-info: #1c6ea6;
  --hrms-info-bg: #e5f1fa;

  --bs-primary: var(--hrms-navy-800);
  --bs-primary-rgb: 76, 40, 137;
  --bs-link-color: var(--hrms-navy-800);
  --bs-link-color-rgb: 76, 40, 137;
  --bs-link-hover-color: var(--hrms-gold-500);
  --bs-body-color: var(--hrms-ink-900);
  --bs-body-bg: var(--hrms-bg);
  --bs-border-color: var(--hrms-line);
}

html[data-theme="teal"] {
  /* ---- Brand palette (Deep Teal) ---- */
  --hrms-navy-950: #042f2e;
  --hrms-navy-900: #0a4d4a;
  --hrms-navy-800: #0f6b66;
  --hrms-navy-700: #158983;
  --hrms-navy-600: #1aa79f;
  --hrms-gold-500: #2dd4bf;
  --hrms-gold-400: #5eead4;
  --hrms-gold-300: #99f6e4;
  --hrms-ink-900: #17302e;
  --hrms-ink-700: #3d5e5a;
  --hrms-ink-500: #6b928c;
  --hrms-ink-300: #a9c9c4;
  --hrms-bg: #e8fbf8;
  --hrms-surface: #ffffff;
  --hrms-line: #cdf0ea;
  --hrms-success: #157a52;
  --hrms-success-bg: #e5f6ee;
  --hrms-warning: #92620a;
  --hrms-warning-bg: #fbf0dc;
  --hrms-danger: #b3273f;
  --hrms-danger-bg: #fbe7ea;
  --hrms-info: #1c6ea6;
  --hrms-info-bg: #e5f1fa;

  --bs-primary: var(--hrms-navy-800);
  --bs-primary-rgb: 15, 107, 102;
  --bs-link-color: var(--hrms-navy-800);
  --bs-link-color-rgb: 15, 107, 102;
  --bs-link-hover-color: var(--hrms-gold-500);
  --bs-body-color: var(--hrms-ink-900);
  --bs-body-bg: var(--hrms-bg);
  --bs-border-color: var(--hrms-line);
}

html[data-theme="red"] {
  /* ---- Brand palette (Crimson) ---- */
  --hrms-navy-950: #350a0a;
  --hrms-navy-900: #5c1414;
  --hrms-navy-800: #82201f;
  --hrms-navy-700: #9e2a28;
  --hrms-navy-600: #bf3532;
  --hrms-gold-500: #f87171;
  --hrms-gold-400: #fca5a5;
  --hrms-gold-300: #fecaca;
  --hrms-ink-900: #331b1a;
  --hrms-ink-700: #5f403d;
  --hrms-ink-500: #8f6d69;
  --hrms-ink-300: #cbaaa6;
  --hrms-bg: #fdecec;
  --hrms-surface: #ffffff;
  --hrms-line: #f7d4d2;
  --hrms-success: #157a52;
  --hrms-success-bg: #e5f6ee;
  --hrms-warning: #92620a;
  --hrms-warning-bg: #fbf0dc;
  --hrms-danger: #b3273f;
  --hrms-danger-bg: #fbe7ea;
  --hrms-info: #1c6ea6;
  --hrms-info-bg: #e5f1fa;

  --bs-primary: var(--hrms-navy-800);
  --bs-primary-rgb: 130, 32, 31;
  --bs-link-color: var(--hrms-navy-800);
  --bs-link-color-rgb: 130, 32, 31;
  --bs-link-hover-color: var(--hrms-gold-500);
  --bs-body-color: var(--hrms-ink-900);
  --bs-body-bg: var(--hrms-bg);
  --bs-border-color: var(--hrms-line);
}

html, body { height: 100%; }

/* Safety net: nothing in the app should ever need the page itself to
   scroll sideways — any element that runs wide (a table, a long
   unbroken string, a fixed-width control cluster) should be responsible
   for its own scrolling, not the document. */
html, body { max-width: 100%; overflow-x: hidden; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--hrms-bg);
  color: var(--hrms-ink-900);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .brand-font {
  font-family: 'Manrope', 'Inter', sans-serif;
  letter-spacing: -0.01em;
}

a { text-decoration: none; }

/* Images should never be wider than their container by default — an
   accidental full-resolution upload (a logo, a photo) rendered without
   an explicit size is one of the more common causes of a page suddenly
   gaining a horizontal scrollbar. Elements that set their own width/
   height (avatars, icons) already win since those are more specific. */
img, svg { max-width: 100%; height: auto; }

/* ---------------------------------------------------------
   App shell layout
   --------------------------------------------------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

.app-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: linear-gradient(185deg, var(--hrms-navy-900) 0%, var(--hrms-navy-950) 100%);
  color: #cfd6e6;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  /* Animating "left" rather than "transform: translateX()" is deliberate:
     a translated position:fixed element can still get counted toward the
     page's horizontal scroll region on mobile Safari/Chrome even while
     visually off-canvas, which is what was causing the phantom
     horizontal scrollbar app-wide. Animating left avoids that class of
     bug entirely — the box is genuinely outside the viewport, not just
     visually shifted there. */
  transition: left .25s ease, width .22s ease;
  box-shadow: var(--hrms-shadow-lg);
}

.app-sidebar .brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}

.app-sidebar .brand-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--hrms-gold-400), var(--hrms-gold-500));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--hrms-navy-950);
  font-size: 1.15rem;
  flex-shrink: 0;
}

.app-sidebar .brand-text { line-height: 1.15; }
.app-sidebar .brand-text strong { color: #fff; font-family: 'Manrope', sans-serif; font-size: .98rem; display: block; }
.app-sidebar .brand-text span { color: var(--hrms-gold-300); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; }

.sidebar-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: .9rem .75rem 1.5rem;
}
.sidebar-scroll::-webkit-scrollbar { width: 6px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }

.app-sidebar .section-title {
  color: #6b7796;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 1rem .6rem .35rem;
}

/* Master / Transaction collapsible groups — a lightweight accordion so the
   sidebar can hold every module without becoming one long unbroken list. */
.app-sidebar .nav-group {
  margin: .35rem 0;
}
.app-sidebar .nav-group-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .06);
  color: #e7ebf7;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .02em;
  padding: .55rem .7rem;
  border-radius: var(--hrms-radius-sm);
  cursor: pointer;
  transition: background .15s ease;
}
.app-sidebar .nav-group-toggle:hover { background: rgba(255, 255, 255, .08); }
.app-sidebar .nav-group-toggle i:first-child { margin-right: .5rem; }
.app-sidebar .nav-group-arrow {
  transition: transform .2s ease;
  font-size: .8rem;
  color: #9aa4c4;
}
.app-sidebar .nav-group.is-open > .nav-group-toggle .nav-group-arrow {
  transform: rotate(180deg);
}
.app-sidebar .nav-group-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
}
.app-sidebar .nav-group.is-open > .nav-group-body {
  max-height: 1400px; /* generous cap — real content is always shorter, this just enables the transition */
}
/* Icon-only collapsed sidebar: skip the accordion chrome entirely and just
   show every link, same as before — there's no room for group headers at
   76px wide, and the flyout-on-hover pattern below already needs a flat list. */
.app-shell.sidebar-collapsed .app-sidebar .nav-group-toggle { display: none; }
.app-shell.sidebar-collapsed .app-sidebar .nav-group-body { max-height: none; }

.app-sidebar .nav-link {
  color: #c3cbe0;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .58rem .7rem;
  border-radius: var(--hrms-radius-sm);
  font-size: .89rem;
  font-weight: 500;
  margin-bottom: .1rem;
  transition: background .15s ease, color .15s ease;
}
.app-sidebar .nav-link i { font-size: 1rem; width: 1.1rem; text-align: center; opacity: .9; }
.app-sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.app-sidebar .nav-link.active {
  background: rgba(220, 174, 68, .14);
  color: var(--hrms-gold-300);
  font-weight: 600;
}
.app-sidebar .nav-link.active i { color: var(--hrms-gold-400); }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 18, 32, .55);
  z-index: 1035;
}

.app-main {
  flex: 1 1 auto;
  margin-left: var(--sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left .22s ease;
}

/* ---------------------------------------------------------
   Desktop sidebar collapse (icon-only rail)
   --------------------------------------------------------- */
.sidebar-collapse-btn {
  border: none;
  background: rgba(255,255,255,.08);
  color: #cfd6e6;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
  margin-left: auto;
  transition: background .15s ease;
}
.sidebar-collapse-btn:hover { background: rgba(255,255,255,.18); color: #fff; }

@media (min-width: 992px) {
  .sidebar-collapse-btn { display: inline-flex; }

  .app-shell.sidebar-collapsed .app-sidebar { width: var(--sidebar-width-collapsed); }
  .app-shell.sidebar-collapsed .app-main { margin-left: var(--sidebar-width-collapsed); }

  .app-shell.sidebar-collapsed .app-sidebar .brand-text,
  .app-shell.sidebar-collapsed .app-sidebar .section-title {
    display: none;
  }

  .app-shell.sidebar-collapsed .app-sidebar .brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .app-shell.sidebar-collapsed .app-sidebar .sidebar-collapse-btn { transform: rotate(180deg); margin-left: 0; }

  /* Icon-only nav links: shrinking the link's own font-size to 0 hides
     its plain-text label without needing to touch any blade markup,
     while the icon keeps its own explicit font-size (set below) and
     stays fully visible and centered. */
  .app-shell.sidebar-collapsed .app-sidebar .nav-link {
    font-size: 0;
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    gap: 0;
  }
  .app-shell.sidebar-collapsed .app-sidebar .nav-link i { font-size: 1.15rem; }
}

/* ---------------------------------------------------------
   Topbar
   --------------------------------------------------------- */
.app-topbar {
  height: var(--topbar-height);
  background: var(--hrms-surface);
  border-bottom: 1px solid var(--hrms-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}

/* Title block flexes and truncates; the control cluster on the right
   (theme switcher, quick menu, notifications, user chip) never shrinks
   and always keeps its natural size — this is what stops a long page
   title or a narrow viewport from pushing the whole topbar (and with it
   the whole page) wider than the screen. */
.topbar-title-block { flex: 1 1 auto; min-width: 0; }
.topbar-title-text { min-width: 0; }
.page-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-controls { flex: 0 0 auto; }

.sidebar-toggle-btn {
  display: none;
  border: none;
  background: var(--hrms-bg);
  width: 38px;
  height: 38px;
  border-radius: var(--hrms-radius-sm);
  align-items: center;
  justify-content: center;
  color: var(--hrms-navy-800);
  font-size: 1.15rem;
  flex-shrink: 0;
}

.page-title { font-family: 'Manrope', sans-serif; font-weight: 700; font-size: 1.05rem; color: var(--hrms-ink-900); margin: 0; }
.page-eyebrow { font-size: .72rem; color: var(--hrms-ink-500); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }

/* ---------------------------------------------------------
   Theme switcher (Blue / Orange)
   --------------------------------------------------------- */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem;
  background: var(--hrms-bg);
  border: 1px solid var(--hrms-line);
  border-radius: 999px;
}
.theme-toggle button {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  transition: transform .15s ease, border-color .15s ease;
}
.theme-toggle button:hover { transform: scale(1.08); }
.theme-toggle button.is-active {
  border-color: var(--hrms-ink-900);
}
.theme-toggle button[data-theme-option="blue"] { background: linear-gradient(135deg, #123f7a, #38bdf8); }
.theme-toggle button[data-theme-option="orange"] { background: linear-gradient(135deg, #7c2d12, #fb923c); }
.theme-toggle button[data-theme-option="green"] { background: linear-gradient(135deg, #10603f, #34d399); }
.theme-toggle button[data-theme-option="purple"] { background: linear-gradient(135deg, #4c2889, #c084fc); }
.theme-toggle button[data-theme-option="teal"] { background: linear-gradient(135deg, #0f6b66, #2dd4bf); }
.theme-toggle button[data-theme-option="red"] { background: linear-gradient(135deg, #82201f, #f87171); }

.user-chip {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .3rem .5rem .3rem .3rem;
  border-radius: 999px;
  background: var(--hrms-bg);
  border: 1px solid var(--hrms-line);
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--hrms-navy-700), var(--hrms-navy-900));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .82rem; flex-shrink: 0;
}
.user-chip .name { font-size: .82rem; font-weight: 600; color: var(--hrms-ink-900); line-height: 1.1; }
.user-chip .role { font-size: .7rem; color: var(--hrms-ink-500); line-height: 1.1; }

/* ---------------------------------------------------------
   Content area / cards
   --------------------------------------------------------- */
.app-content { padding: 1.5rem; flex: 1 1 auto; }

.card {
  border: 1px solid var(--hrms-line);
  border-radius: var(--hrms-radius);
  box-shadow: var(--hrms-shadow-sm);
}
.card .card-header { background: transparent; border-bottom: 1px solid var(--hrms-line); font-weight: 600; }

.stat-card {
  border-radius: var(--hrms-radius);
  border: 1px solid var(--hrms-line);
  background: var(--hrms-surface);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--hrms-shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease;
  position: relative;
  overflow: hidden;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--hrms-shadow); }
.stat-card .stat-icon {
  width: 42px; height: 42px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; margin-bottom: .6rem;
  background: var(--hrms-navy-900); color: var(--hrms-gold-300);
}
.stat-card h2 { font-family: 'Manrope', sans-serif; font-weight: 800; font-size: 1.7rem; margin: 0; }
.stat-card .stat-label { color: var(--hrms-ink-500); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* Clickable dashboard/report stat cards */
a.stat-card-link { text-decoration: none; display: block; }
a.stat-card-link .stat-card { cursor: pointer; }

/* Employee creation step wizard — modern connected-circle stepper */
.wizard-steps {
  display: flex; list-style: none; padding: 0; margin: 0 0 1.5rem;
}
.wizard-steps .nav-item { flex: 1; position: relative; text-align: center; }
.wizard-steps .nav-item:not(:last-child)::after {
  content: ''; position: absolute; top: 19px; left: 50%; width: 100%; height: 2px;
  background: var(--hrms-line); z-index: 0; transition: background .2s ease;
}
.wizard-steps .nav-item.is-done:not(:last-child)::after { background: var(--hrms-navy-900); }
.wizard-steps .nav-link {
  position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center;
  gap: .4rem; text-decoration: none; padding: 0; border: 0; background: none;
}
.wizard-steps .step-circle {
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: #fff; border: 2px solid var(--hrms-line); color: var(--hrms-ink-500); font-weight: 700; font-size: .85rem;
  transition: all .2s ease;
}
.wizard-steps .step-check { display: none; }
.wizard-steps .is-active .step-circle {
  border-color: var(--hrms-navy-900); background: var(--hrms-navy-900); color: #fff;
  box-shadow: 0 0 0 4px rgba(11, 42, 92, .12);
}
.wizard-steps .is-done .step-circle { border-color: var(--hrms-navy-900); background: var(--hrms-navy-900); color: #fff; }
.wizard-steps .is-done .step-num { display: none; }
.wizard-steps .is-done .step-check { display: inline; }
.wizard-steps .is-upcoming .step-circle { opacity: .55; }
.wizard-steps .step-label {
  font-size: .74rem; font-weight: 600; color: var(--hrms-ink-500);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.wizard-steps .step-label i { font-size: 1.05rem; }
.wizard-steps .is-active .step-label, .wizard-steps .is-done .step-label { color: var(--hrms-navy-900); }
.wizard-steps .nav-link.disabled { cursor: not-allowed; }
.wizard-steps .nav-link.disabled .step-circle { pointer-events: none; }

.wizard-body {
  background: #fff; border: 1px solid var(--hrms-line); border-radius: 14px;
  padding: 1.5rem; box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.wizard-nav .btn i { font-size: .85rem; }

@media (max-width: 575.98px) {
  .wizard-steps .step-label { font-size: .6rem; }
  .wizard-steps .step-label i { font-size: .95rem; }
  .wizard-body { padding: 1rem; }
}

/* Monthly attendance grid (dates 1–31 across, employees down) */
.attendance-grid-scroll { max-height: 520px; overflow: auto; }
.attendance-grid-table { font-size: .72rem; }
.attendance-grid-table th, .attendance-grid-table td { padding: .25rem .35rem; white-space: nowrap; }
.attendance-grid-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--hrms-navy-900); color: #fff;
}
.attendance-grid-table td:first-child, .attendance-grid-table th:first-child {
  position: sticky; left: 0; z-index: 1; background: #fff;
  min-width: 170px; text-align: left; box-shadow: 1px 0 0 var(--hrms-line);
}
.attendance-grid-table thead th:first-child { z-index: 3; }
.grid-code { font-weight: 700; }
.grid-code-P { color: #1a7f37; }
.grid-code-A { color: #c0362c; }
.grid-code-L { color: #b8860b; }
.grid-code-HD { color: #1d6fa5; }
.grid-code-PR { color: #8a4fd1; }
.grid-code-dash { color: #c3c9d4; font-weight: 400; }

/* Report header (title bar on screen) */
.report-header {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: .75rem;
  margin-bottom: 1rem; padding-bottom: .85rem;
  border-bottom: 1px solid var(--hrms-line);
}

/* Report letterhead — invisible on screen, shown only for browser Print
   (Ctrl+P / the on-screen Print button) so a paper copy carries the same
   school branding as the PDF export. */
.report-print-header { margin-bottom: 14px; }
.report-print-header img { max-height: 50px; max-width: 90px; }
.report-print-school { font-family: 'Manrope', sans-serif; font-weight: 800; font-size: 1.2rem; color: #16233f; }
.report-print-meta { font-size: .72rem; color: #555; margin-top: 1px; }
.report-print-title {
  margin-top: 10px; padding-top: 8px; border-top: 2px solid #16233f;
  font-weight: 700; font-size: .95rem; text-transform: uppercase; letter-spacing: .03em; color: #16233f;
}
.report-print-subtitle { font-weight: 500; text-transform: none; color: #555; margin-left: .35rem; }

/* ---------------------------------------------------------
   Tables
   --------------------------------------------------------- */
.table-responsive { border-radius: var(--hrms-radius-sm); }
.table { margin-bottom: 0; }
.table thead th {
  background: var(--hrms-bg);
  color: var(--hrms-ink-500);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 700;
  border-bottom: 1px solid var(--hrms-line);
  white-space: nowrap;
  padding: .7rem .85rem;
}
.table tbody td { padding: .65rem .85rem; vertical-align: middle; font-size: .88rem; }
.table tbody tr:hover { background: rgba(15, 27, 51, .025); }

/* ---------------------------------------------------------
   Buttons / forms / badges
   --------------------------------------------------------- */
.btn { border-radius: var(--hrms-radius-sm); font-weight: 600; font-size: .88rem; }
.btn-primary { --bs-btn-bg: var(--hrms-navy-800); --bs-btn-border-color: var(--hrms-navy-800); --bs-btn-hover-bg: var(--hrms-navy-700); --bs-btn-hover-border-color: var(--hrms-navy-700); --bs-btn-active-bg: var(--hrms-navy-900); }
.btn-gold { background: var(--hrms-gold-500); border-color: var(--hrms-gold-500); color: var(--hrms-navy-950); font-weight: 700; }
.btn-gold:hover { background: var(--hrms-gold-400); border-color: var(--hrms-gold-400); color: var(--hrms-navy-950); }

.form-control, .form-select {
  border-radius: var(--hrms-radius-sm);
  border-color: var(--hrms-line);
  font-size: .88rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--hrms-navy-700);
  box-shadow: 0 0 0 .2rem rgba(22, 35, 63, .12);
}
.form-label { font-size: .82rem; font-weight: 600; color: var(--hrms-ink-700); }

/* ---------------------------------------------------------
   Select2 ("pick by name" searchable dropdowns)
   --------------------------------------------------------- */
.select2-container--bootstrap-5 .select2-selection {
  border-radius: var(--hrms-radius-sm) !important;
  border-color: var(--hrms-line) !important;
  min-height: 38px !important;
}
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
  border-color: var(--hrms-navy-700) !important;
  box-shadow: 0 0 0 .2rem rgba(22, 35, 63, .12) !important;
}
.select2-container--bootstrap-5 .select2-results__option--highlighted[aria-selected] {
  background-color: var(--hrms-navy-800) !important;
}
.select2-container--bootstrap-5 .select2-selection__clear {
  margin-right: .35rem;
}

.badge { font-weight: 600; letter-spacing: .01em; }
.badge.bg-success { background: var(--hrms-success-bg) !important; color: var(--hrms-success) !important; }
.badge.bg-warning { background: var(--hrms-warning-bg) !important; color: var(--hrms-warning) !important; }
.badge.bg-danger  { background: var(--hrms-danger-bg) !important; color: var(--hrms-danger) !important; }
.badge.bg-info    { background: var(--hrms-info-bg) !important; color: var(--hrms-info) !important; }
.badge.bg-secondary { background: #eef0f5 !important; color: var(--hrms-ink-700) !important; }

/* ---------------------------------------------------------
   Auth / login screen
   --------------------------------------------------------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  background: radial-gradient(circle at 15% 20%, rgba(220,174,68,.14), transparent 45%), var(--hrms-navy-950);
}
.auth-panel {
  flex: 1 1 45%;
  display: none;
  flex-direction: column;
  justify-content: center;
  padding: 4rem;
  color: #dfe4f0;
}
.auth-panel .brand-badge-lg {
  width: 56px; height: 56px; border-radius: 14px;
  background: linear-gradient(135deg, var(--hrms-gold-400), var(--hrms-gold-500));
  display: flex; align-items: center; justify-content: center;
  color: var(--hrms-navy-950); font-size: 1.6rem; margin-bottom: 1.75rem;
}
.auth-panel h1 { color: #fff; font-size: 2.1rem; font-weight: 800; max-width: 460px; }
.auth-panel p { color: #97a1c2; max-width: 420px; }
.auth-form-side {
  flex: 1 1 55%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--hrms-bg);
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--hrms-surface);
  border-radius: var(--hrms-radius-lg);
  box-shadow: var(--hrms-shadow-lg);
  padding: 2.25rem 2rem;
}

/* ---------------------------------------------------------
   Responsive breakpoints
   --------------------------------------------------------- */
@media (min-width: 992px) {
  .auth-panel { display: flex; }
}

@media (max-width: 991.98px) {
  .app-sidebar { left: calc(var(--sidebar-width) * -1); }
  .app-sidebar.is-open { left: 0; }
  .app-main { margin-left: 0; }
  .sidebar-toggle-btn { display: inline-flex; }
  .sidebar-backdrop.is-open { display: block; }
  .app-content { padding: 1rem; }

  /* The 6-swatch color-theme switcher is a nice-to-have, not a control
     someone needs mid-task on a phone/tablet — dropping it below desktop
     widths frees up the topbar space that was forcing it (and the whole
     page) to scroll sideways. Still reachable at 992px+. */
  .theme-toggle { display: none; }
}

@media (max-width: 575.98px) {
  .app-topbar { padding: 0 .85rem; }
  .user-chip .name, .user-chip .role { display: none; }
  .user-chip { padding: .3rem; }
  .app-content { padding: .75rem; }
  .stat-card h2 { font-size: 1.4rem; }
  .page-title { max-width: 46vw; }
}

/* ---------------------------------------------------------
   Print (used by report pages' "Print" button / Ctrl+P)
   --------------------------------------------------------- */
@media print {
  .app-sidebar, .app-topbar, .sidebar-backdrop, .no-print, .pagination, nav[aria-label="pagination"] { display: none !important; }
  .app-main { margin-left: 0 !important; }
  .app-content { padding: 0 !important; }
  .card { border: none !important; box-shadow: none !important; padding: 0 !important; }
  body { background: #fff !important; font-size: 11px; }
  a[href]:after { content: none !important; }

  /* Table styling for a professional printed page */
  .table { font-size: 10.5px; }
  .table thead th {
    background: #16233f !important; color: #fff !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .table tbody tr:nth-child(even) td { background: #f7f9fc !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table tr { break-inside: avoid; }
  .badge { border: 1px solid #ccc; color: #222 !important; background: none !important; }

  /* Stat-card summary tiles print cleanly instead of as boxed cards */
  .stat-card { box-shadow: none !important; border: 1px solid #d7dde8 !important; break-inside: avoid; }
}

/* Floating scroll-to-top / scroll-to-bottom buttons — shown once the page
   has scrolled far enough that jumping is actually useful. */
.scroll-nav {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  z-index: 1040;
}
.scroll-nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--hrms-line);
  background: var(--hrms-surface);
  color: var(--hrms-navy-800);
  box-shadow: var(--hrms-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
}
.scroll-nav-btn.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.scroll-nav-btn:hover { background: var(--hrms-bg); }
@media print {
  .scroll-nav { display: none !important; }
}
