/* HRM design system — shared by every page that extends base.html.
   Overrides Bootstrap 5.3 globally so the ~160 templates pick up the new
   look without per-page edits. */

:root {
  --hrm-sidebar-width: 260px;
  --hrm-topbar-height: 60px;

  --hrm-bg: #f4f6fb;
  --hrm-surface: #ffffff;
  --hrm-surface-2: #f8fafc;
  --hrm-border: #e6e9f0;
  --hrm-ink: #0f172a;
  --hrm-ink-2: #334155;
  --hrm-muted: #64748b;

  --hrm-primary: #4f46e5;
  --hrm-primary-600: #4338ca;
  --hrm-primary-50: #eef2ff;
  --hrm-primary-100: #e0e7ff;

  --hrm-radius: 14px;
  --hrm-radius-sm: 10px;
  --hrm-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
  --hrm-shadow-lg: 0 12px 32px rgba(15, 23, 42, .10);

  /* accent palette (card / module colors) */
  --c-indigo: #4f46e5;  --c-indigo-bg: #eef2ff;
  --c-blue:   #2563eb;  --c-blue-bg:   #e8f0fe;
  --c-sky:    #0284c7;  --c-sky-bg:    #e0f2fe;
  --c-teal:   #0d9488;  --c-teal-bg:   #ddf6f2;
  --c-green:  #16a34a;  --c-green-bg:  #e3f7ea;
  --c-amber:  #d97706;  --c-amber-bg:  #fef3c7;
  --c-orange: #ea580c;  --c-orange-bg: #ffedd5;
  --c-rose:   #e11d48;  --c-rose-bg:   #ffe4e9;
  --c-violet: #7c3aed;  --c-violet-bg: #f1e9ff;
  --c-slate:  #475569;  --c-slate-bg:  #eef1f5;
  --card-accent: var(--c-indigo); --card-accent-bg: var(--c-indigo-bg);

  --bs-body-bg: var(--hrm-bg);
  --bs-body-color: var(--hrm-ink-2);
  --bs-primary: var(--hrm-primary);
  --bs-primary-rgb: 79, 70, 229;
  --bs-link-color: var(--hrm-primary);
  --bs-link-color-rgb: 79, 70, 229;
  --bs-link-hover-color: var(--hrm-primary-600);
  --bs-link-hover-color-rgb: 67, 56, 202;
  --bs-border-color: var(--hrm-border);
  --bs-border-radius: .6rem;
  --bs-font-sans-serif: "Segoe UI", "PingFang TC", "Microsoft JhengHei UI", "Microsoft JhengHei", "Noto Sans TC", system-ui, -apple-system, sans-serif;
}

html { scroll-padding-top: calc(var(--hrm-topbar-height) + 12px); }
/* Font size: html font-size drives every rem; users pick via the topbar "Aa" menu. */
html { font-size: 16px; }
html[data-fs="sm"] { font-size: 15px; }
html[data-fs="lg"] { font-size: 17.5px; }
html[data-fs="xl"] { font-size: 19px; }
body {
  background: var(--hrm-bg);
  color: var(--hrm-ink-2);
  font-size: 1rem; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
.btn:hover, .nav-link:hover, .dropdown-item:hover, .list-group-item:hover,
.hrm-sidebar a:hover, .stat-card:hover, .hrm-quick a:hover { text-decoration: none; }
h1, h2, h3, h4, h5, h6 { color: var(--hrm-ink); font-weight: 700; letter-spacing: -.01em; }
::selection { background: var(--hrm-primary-100); }

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.hrm-sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 1040;
  width: var(--hrm-sidebar-width);
  display: flex; flex-direction: column;
  background: var(--hrm-surface);
  border-right: 1px solid var(--hrm-border);
}
.hrm-brand {
  display: flex; align-items: center; gap: .7rem;
  height: var(--hrm-topbar-height); padding: 0 1.1rem;
  border-bottom: 1px solid var(--hrm-border);
  flex-shrink: 0;
}
.hrm-brand-mark {
  width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0;
  display: grid; place-items: center; color: #fff; font-size: 1.15rem;
  background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
  box-shadow: 0 6px 14px rgba(79, 70, 229, .32);
}
.hrm-brand-logo { width: 36px; height: 36px; flex-shrink: 0; border-radius: 11px; box-shadow: 0 6px 14px rgba(79, 70, 229, .3); }
.hrm-brand-name { font-weight: 800; color: var(--hrm-ink); font-size: 1.12rem; line-height: 1.15; letter-spacing: -.01em; }
.hrm-ai { background: linear-gradient(90deg, #6366f1, #8b5cf6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hrm-brand-sub { font-size: .72rem; color: var(--hrm-muted); }

.hrm-sidebar-search { padding: .85rem .9rem .5rem; flex-shrink: 0; }
.hrm-search-box { position: relative; }
.hrm-search-box > .bi-search {
  position: absolute; left: .75rem; top: 50%; transform: translateY(-50%);
  color: var(--hrm-muted); font-size: .85rem; pointer-events: none;
}
.hrm-search-box input {
  width: 100%; height: 38px; padding: 0 2.4rem 0 2.1rem;
  border: 1px solid var(--hrm-border); border-radius: 10px;
  background: var(--hrm-surface-2); color: var(--hrm-ink); font-size: .9rem;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.hrm-search-box input:focus {
  outline: 0; background: #fff; border-color: var(--hrm-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}
.hrm-search-box input::-webkit-search-cancel-button { display: none; }
.hrm-search-box kbd, .hrm-search-box .hrm-search-clear {
  position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
}
.hrm-search-box kbd {
  font-size: .68rem; padding: .1rem .4rem; border-radius: 5px;
  background: #fff; color: var(--hrm-muted); border: 1px solid var(--hrm-border); box-shadow: none;
}
.hrm-search-clear { border: 0; background: transparent; color: var(--hrm-muted); padding: 0 .25rem; line-height: 1; }
.hrm-sidebar-tools {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 1.1rem .35rem; font-size: .7rem; color: var(--hrm-muted);
}
.hrm-sidebar-tools button {
  border: 0; background: transparent; color: var(--hrm-muted); font-size: .7rem; padding: .1rem .3rem; border-radius: 5px;
}
.hrm-sidebar-tools button:hover { color: var(--hrm-primary); background: var(--hrm-primary-50); }

.hrm-nav {
  flex: 1 1 auto; overflow-y: auto; padding: .25rem .7rem 1rem;
  scrollbar-width: thin; scrollbar-color: #d5dae3 transparent;
}
.hrm-nav a {
  display: flex; align-items: center; gap: .6rem;
  min-height: 36px; padding: .4rem .7rem; margin: 1px 0;
  border-radius: 9px; color: var(--hrm-ink-2); font-size: .94rem;
  transition: background .12s, color .12s;
}
.hrm-nav a:hover { background: var(--hrm-surface-2); color: var(--hrm-ink); }
.hrm-nav a.active {
  background: var(--hrm-primary-50); color: var(--hrm-primary-600); font-weight: 650;
}
.hrm-nav a.hrm-home { font-weight: 650; color: var(--hrm-ink); margin-bottom: .35rem; }
.hrm-nav a.hrm-home.active { background: var(--hrm-primary); color: #fff; box-shadow: 0 6px 14px rgba(79, 70, 229, .28); }
.hrm-nav a.hrm-home .bi { font-size: 1.05rem; }

.hrm-nav details { --g: var(--c-slate); --g-bg: var(--c-slate-bg); margin-top: 2px; }
.hrm-nav summary {
  display: flex; align-items: center; gap: .6rem;
  min-height: 40px; padding: .4rem .6rem; border-radius: 9px;
  font-size: .94rem; font-weight: 650; color: var(--hrm-ink);
  cursor: pointer; list-style: none; user-select: none;
}
.hrm-nav summary::-webkit-details-marker { display: none; }
.hrm-nav summary:hover { background: var(--hrm-surface-2); }
.hrm-nav summary .hrm-gi {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center; font-size: .92rem;
  background: var(--g-bg); color: var(--g);
}
.hrm-nav summary .hrm-chev { margin-left: auto; color: #a3adbd; font-size: .75rem; transition: transform .18s; }
.hrm-nav details[open] > summary .hrm-chev { transform: rotate(90deg); }
.hrm-nav details > a {
  margin-left: 1.4rem; padding-left: .95rem; border-left: 1.5px solid var(--hrm-border);
  border-radius: 0 9px 9px 0; font-size: .9rem; color: #475569;
}
.hrm-nav details > a:hover { color: var(--hrm-ink); }
.hrm-nav details > a.active { color: var(--g); background: var(--g-bg); border-left-color: var(--g); }
.hrm-nav .hrm-admin-tag {
  margin-left: .1rem; font-size: .6rem; font-weight: 700; color: var(--c-rose);
  background: var(--c-rose-bg); padding: .05rem .35rem; border-radius: 5px;
}
.hrm-nav-sep {
  margin: 1rem .6rem .35rem; font-size: .68rem; font-weight: 700; letter-spacing: .08em;
  color: #9aa4b5; text-transform: uppercase;
}
.hrm-no-results { padding: 1rem .7rem; font-size: .82rem; color: var(--hrm-muted); }

/* module colors */
.hrm-nav .g-org     { --g: var(--c-blue);   --g-bg: var(--c-blue-bg); }
.hrm-nav .g-attend  { --g: var(--c-teal);   --g-bg: var(--c-teal-bg); }
.hrm-nav .g-forms   { --g: var(--c-amber);  --g-bg: var(--c-amber-bg); }
.hrm-nav .g-payroll { --g: var(--c-green);  --g-bg: var(--c-green-bg); }
.hrm-nav .g-paycfg  { --g: var(--c-violet); --g-bg: var(--c-violet-bg); }
.hrm-nav .g-bank    { --g: var(--c-sky);    --g-bg: var(--c-sky-bg); }
.hrm-nav .g-report  { --g: var(--c-indigo); --g-bg: var(--c-indigo-bg); }
.hrm-nav .g-info    { --g: var(--c-orange); --g-bg: var(--c-orange-bg); }
.hrm-nav .g-self    { --g: var(--c-rose);   --g-bg: var(--c-rose-bg); }
.hrm-nav .g-admin   { --g: var(--c-slate);  --g-bg: var(--c-slate-bg); }

/* ── Topbar ──────────────────────────────────────────────────────────── */
.hrm-topbar {
  position: sticky; top: 0; z-index: 1020;
  height: var(--hrm-topbar-height);
  display: flex; align-items: center; gap: .75rem;
  padding: 0 clamp(1rem, 2.2vw, 2rem);
  background: rgba(244, 246, 251, .85);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .15s, background .15s;
}
.hrm-topbar.is-scrolled { border-bottom-color: var(--hrm-border); background: rgba(255, 255, 255, .9); }
.hrm-menu-btn {
  display: none; width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--hrm-border); background: #fff; color: var(--hrm-ink);
  place-items: center; font-size: 1.2rem; flex-shrink: 0;
}
.hrm-crumbs { display: flex; align-items: center; gap: .4rem; min-width: 0; font-size: .92rem; color: var(--hrm-muted); }
.hrm-crumbs .bi { font-size: .7rem; }
.hrm-crumbs strong { color: var(--hrm-ink); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hrm-crumbs span { white-space: nowrap; }
.hrm-topbar-right { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.hrm-date { font-size: .8rem; color: var(--hrm-muted); white-space: nowrap; }
.hrm-user-btn {
  display: flex; align-items: center; gap: .55rem;
  border: 1px solid var(--hrm-border); background: #fff; border-radius: 999px;
  padding: .22rem .7rem .22rem .25rem; color: var(--hrm-ink); font-size: .84rem;
}
.hrm-user-btn:hover { border-color: #cfd5e0; box-shadow: var(--hrm-shadow); }
.hrm-avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, #818cf8, #4f46e5); color: #fff; font-weight: 700; font-size: .8rem;
}
.hrm-role {
  font-size: .68rem; font-weight: 700; padding: .12rem .45rem; border-radius: 6px;
  background: var(--hrm-primary-50); color: var(--hrm-primary-600);
}

/* ── Main area ───────────────────────────────────────────────────────── */
.hrm-main { margin-left: var(--hrm-sidebar-width); min-height: 100vh; }
.hrm-content { padding: 1.25rem clamp(1rem, 2.2vw, 2rem) 3rem; max-width: 1680px; }
.hrm-content > h3:first-child, .hrm-content > h4:first-child,
.hrm-content > .d-flex:first-child h3, .hrm-content > .d-flex:first-child h4 {
  font-size: 1.6rem; font-weight: 750; margin-bottom: 1.1rem;
}
.hrm-content > h4:first-child small, .hrm-content > h3:first-child small { font-size: .85rem; font-weight: 500; }
.hrm-content h5 { font-size: 1.15rem; }
.hrm-content h6 { font-size: 1rem; }
/* Section headings sitting directly on the page get an accent bar. */
.hrm-content > h5, .hrm-content > h6, .hrm-content > .row > [class*="col"] > h5 {
  display: flex; align-items: center; gap: .55rem; margin: 1.6rem 0 .75rem;
}
.hrm-content > h5::before, .hrm-content > h6::before, .hrm-content > .row > [class*="col"] > h5::before {
  content: ""; width: 4px; height: 1.05em; border-radius: 4px; background: var(--hrm-primary); flex-shrink: 0;
}
.hrm-content > p.text-muted, .hrm-content > .text-muted.small { font-size: .9rem; }

/* ── Cards ───────────────────────────────────────────────────────────── */
.card {
  --bs-card-border-color: var(--hrm-border);
  --bs-card-border-radius: var(--hrm-radius);
  --bs-card-inner-border-radius: calc(var(--hrm-radius) - 1px);
  --bs-card-cap-bg: #fff;
  box-shadow: var(--hrm-shadow);
}
.card-header {
  display: flex; align-items: center; flex-wrap: wrap; gap: .5rem;
  padding: .85rem 1.1rem; border-bottom-color: var(--hrm-border);
  font-weight: 650; color: var(--hrm-ink);
  background: linear-gradient(180deg, #fff 0%, #fafbff 100%) !important;
}
.card-header::before {
  content: ""; width: 4px; height: 1.05em; border-radius: 4px;
  background: var(--card-accent, var(--hrm-primary)); flex-shrink: 0;
}
.card-header.bg-primary, .card-header.bg-success, .card-header.bg-danger,
.card-header.bg-warning, .card-header.bg-info, .card-header.bg-dark { background-image: none !important; }
.card-header.bg-primary::before, .card-header.bg-success::before, .card-header.bg-danger::before,
.card-header.bg-dark::before { background: rgba(255, 255, 255, .7); }
.card-body { padding: 1.1rem; }
.card-footer { background: var(--hrm-surface-2); border-top-color: var(--hrm-border); }
.row > [class*="col"]:nth-child(8n+2) { --card-accent: var(--c-teal);   --card-accent-bg: var(--c-teal-bg); }
.row > [class*="col"]:nth-child(8n+3) { --card-accent: var(--c-amber);  --card-accent-bg: var(--c-amber-bg); }
.row > [class*="col"]:nth-child(8n+4) { --card-accent: var(--c-rose);   --card-accent-bg: var(--c-rose-bg); }
.row > [class*="col"]:nth-child(8n+5) { --card-accent: var(--c-violet); --card-accent-bg: var(--c-violet-bg); }
.row > [class*="col"]:nth-child(8n+6) { --card-accent: var(--c-sky);    --card-accent-bg: var(--c-sky-bg); }
.row > [class*="col"]:nth-child(8n+7) { --card-accent: var(--c-green);  --card-accent-bg: var(--c-green-bg); }
.row > [class*="col"]:nth-child(8n+8) { --card-accent: var(--c-orange); --card-accent-bg: var(--c-orange-bg); }

/* Link tiles (<a class="card">): colored, tinted, lift on hover, arrow cue. */
a.card {
  position: relative; overflow: hidden; color: var(--hrm-ink) !important;
  border-left: 4px solid var(--card-accent);
  background: linear-gradient(135deg, #fff 55%, var(--card-accent-bg) 100%);
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
a.card:hover { transform: translateY(-2px); box-shadow: var(--hrm-shadow-lg); border-color: color-mix(in srgb, var(--card-accent) 40%, var(--hrm-border)); border-left-color: var(--card-accent); }
a.card::after {
  content: "\F138"; font-family: "bootstrap-icons"; position: absolute; right: .9rem; bottom: .7rem;
  color: var(--card-accent); opacity: .35; font-size: 1.05rem; transition: opacity .16s, transform .16s;
}
a.card:hover::after { opacity: 1; transform: translateX(2px); }
a.card h5, a.card h6, a.card strong, a.card .fw-bold { color: var(--hrm-ink); }
a.card:hover h5, a.card:hover h6, a.card:hover strong { color: var(--card-accent); }
a.card.text-center { padding-top: 1.1rem !important; padding-bottom: 1.1rem !important; }
a.card.text-center::after { display: none; }
a.card.disabled { opacity: .55; pointer-events: none; filter: grayscale(.6); }
.card-icon {
  width: 42px; height: 42px; border-radius: 12px; display: inline-grid; place-items: center;
  background: var(--card-accent); color: #fff; font-size: 1.2rem; margin-bottom: .7rem;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--card-accent) 30%, transparent);
}
/* Report-center style inner tiles */
.hrm-tile {
  position: relative; height: 100%; padding: .85rem .9rem; border-radius: 12px;
  border: 1px solid var(--hrm-border); border-top: 3px solid var(--card-accent);
  background: linear-gradient(180deg, var(--card-accent-bg) 0%, #fff 70%);
}
.hrm-tile .hrm-tile-title { font-weight: 700; color: var(--hrm-ink); font-size: .98rem; }
.hrm-tile .hrm-tile-desc { color: var(--hrm-muted); font-size: .85rem; }
.card.border-danger { --card-accent: var(--c-rose); }
.card.border-warning { --card-accent: var(--c-amber); }
.card.border-success { --card-accent: var(--c-green); }
.card.border-info { --card-accent: var(--c-sky); }

/* ── Stat cards (colored) ────────────────────────────────────────────── */
.stat-card {
  --a: var(--c-indigo); --a-bg: var(--c-indigo-bg);
  position: relative; overflow: hidden; display: block;
  background: #fff; border: 1px solid var(--hrm-border); border-radius: var(--hrm-radius);
  padding: 1rem 1.1rem; min-height: 104px; color: var(--hrm-ink-2) !important;
  box-shadow: var(--hrm-shadow);
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
.stat-card::after {
  content: ""; position: absolute; right: -28px; top: -28px; width: 110px; height: 110px;
  border-radius: 50%; background: var(--a-bg); opacity: .8; pointer-events: none;
}
.stat-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--a);
}
a.stat-card:hover { transform: translateY(-2px); box-shadow: var(--hrm-shadow-lg); border-color: color-mix(in srgb, var(--a) 35%, var(--hrm-border)); }
.stat-card > * { position: relative; z-index: 1; }
.stat-card .label { color: var(--hrm-muted); font-size: .9rem; font-weight: 600; }
.stat-card .num { font-size: 1.85rem; font-weight: 800; line-height: 1.15; color: var(--a); margin-top: .2rem; letter-spacing: -.02em; }
.stat-card .num.text-danger { color: var(--c-rose) !important; }
.stat-card .num.text-warning { color: var(--c-amber) !important; }
.stat-card .num.text-success { color: var(--c-green) !important; }
.stat-card .num.text-info { color: var(--c-sky) !important; }
.stat-card .stat-icon {
  position: absolute; right: .95rem; top: .95rem; z-index: 1;
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--a); color: #fff; font-size: 1.15rem;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--a) 35%, transparent);
}
.stat-card .stat-hint { font-size: .82rem; color: var(--hrm-muted); margin-top: .15rem; }
.stat-card.is-alert { border-color: color-mix(in srgb, var(--a) 45%, var(--hrm-border)); background: linear-gradient(135deg, #fff 55%, var(--a-bg) 100%); }
/* auto colors when a page does not pick one */
.row > [class*="col"]:nth-child(8n+2) .stat-card:not([class*="sc-"]) { --a: var(--c-rose);   --a-bg: var(--c-rose-bg); }
.row > [class*="col"]:nth-child(8n+3) .stat-card:not([class*="sc-"]) { --a: var(--c-amber);  --a-bg: var(--c-amber-bg); }
.row > [class*="col"]:nth-child(8n+4) .stat-card:not([class*="sc-"]) { --a: var(--c-teal);   --a-bg: var(--c-teal-bg); }
.row > [class*="col"]:nth-child(8n+5) .stat-card:not([class*="sc-"]) { --a: var(--c-green);  --a-bg: var(--c-green-bg); }
.row > [class*="col"]:nth-child(8n+6) .stat-card:not([class*="sc-"]) { --a: var(--c-violet); --a-bg: var(--c-violet-bg); }
.row > [class*="col"]:nth-child(8n+7) .stat-card:not([class*="sc-"]) { --a: var(--c-sky);    --a-bg: var(--c-sky-bg); }
.row > [class*="col"]:nth-child(8n+8) .stat-card:not([class*="sc-"]) { --a: var(--c-orange); --a-bg: var(--c-orange-bg); }
.sc-indigo { --a: var(--c-indigo) !important; --a-bg: var(--c-indigo-bg) !important; }
.sc-blue   { --a: var(--c-blue)   !important; --a-bg: var(--c-blue-bg)   !important; }
.sc-sky    { --a: var(--c-sky)    !important; --a-bg: var(--c-sky-bg)    !important; }
.sc-teal   { --a: var(--c-teal)   !important; --a-bg: var(--c-teal-bg)   !important; }
.sc-green  { --a: var(--c-green)  !important; --a-bg: var(--c-green-bg)  !important; }
.sc-amber  { --a: var(--c-amber)  !important; --a-bg: var(--c-amber-bg)  !important; }
.sc-orange { --a: var(--c-orange) !important; --a-bg: var(--c-orange-bg) !important; }
.sc-rose   { --a: var(--c-rose)   !important; --a-bg: var(--c-rose-bg)   !important; }
.sc-violet { --a: var(--c-violet) !important; --a-bg: var(--c-violet-bg) !important; }
.sc-slate  { --a: var(--c-slate)  !important; --a-bg: var(--c-slate-bg)  !important; }

/* ── Tables ──────────────────────────────────────────────────────────── */
.table {
  --bs-table-bg: #fff;
  --bs-table-hover-bg: #f6f7fe;
  --bs-table-striped-bg: #fafbfd;
  --bs-table-border-color: #eef0f5;
  margin-bottom: 0; font-size: .95rem; color: var(--hrm-ink-2);
}
.table small, .table .small { font-size: .9em; }
.table tbody tr:nth-child(even) > * { background: #fbfcfe; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .hrm-enum { white-space: nowrap; }
/* Tall tables scroll inside their card so the header row stays visible. */
.hrm-table-tall { max-height: calc(100vh - var(--hrm-topbar-height) - 7rem); overflow: auto; }
.hrm-table-tall thead th { position: sticky; top: 0; z-index: 2; box-shadow: inset 0 -1px 0 var(--hrm-border); }
.hrm-table-meta { display: flex; justify-content: space-between; align-items: center; font-size: .85rem; color: var(--hrm-muted); margin: -.4rem .2rem 1rem; }
.table > :not(caption) > * > * { padding: .7rem .8rem; vertical-align: middle; }
.table-sm > :not(caption) > * > * { padding: .5rem .7rem; }
.table thead th, .table > thead > tr > th {
  background: var(--hrm-surface-2) !important; color: var(--hrm-muted) !important;
  font-size: .84rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
  border-bottom: 1px solid var(--hrm-border);
}
.table-dark thead th, thead.table-dark th { background: #1e293b !important; color: #e2e8f0 !important; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover > * { background: #f6f7fe; }
.table tbody tr:last-child > * { border-bottom: 0; }
.table a { font-weight: 600; }
.hrm-table-card {
  background: #fff; border: 1px solid var(--hrm-border); border-radius: var(--hrm-radius);
  box-shadow: var(--hrm-shadow); margin-bottom: 1rem;
}
.hrm-table-card > .table thead tr:first-child th:first-child { border-top-left-radius: calc(var(--hrm-radius) - 1px); }
.hrm-table-card > .table thead tr:first-child th:last-child { border-top-right-radius: calc(var(--hrm-radius) - 1px); }
.card .table-responsive, .card > .table { margin-bottom: 0; }
.card-body.p-0 .table thead th:first-child, .card-body.p-0 .table td:first-child { padding-left: 1.1rem; }

/* ── Badges: soft tinted pills ───────────────────────────────────────── */
.badge {
  font-weight: 650; font-size: .8rem; padding: .34em .62em; border-radius: 6px; letter-spacing: .01em;
}
.badge.bg-success   { background: var(--c-green-bg)  !important; color: #15803d !important; }
.badge.bg-danger    { background: var(--c-rose-bg)   !important; color: #be123c !important; }
.badge.bg-warning   { background: var(--c-amber-bg)  !important; color: #b45309 !important; }
.badge.bg-info      { background: var(--c-sky-bg)    !important; color: #0369a1 !important; }
.badge.bg-primary   { background: var(--c-indigo-bg) !important; color: var(--hrm-primary-600) !important; }
.badge.bg-secondary { background: var(--c-slate-bg)  !important; color: #475569 !important; }
.badge.bg-dark      { background: #1e293b !important; color: #fff !important; }
.badge.bg-light     { background: #f1f5f9 !important; color: #475569 !important; border: 1px solid var(--hrm-border); }
.badge-status-pending  { background: var(--c-amber-bg) !important; color: #b45309 !important; }
.badge-status-approved { background: var(--c-green-bg) !important; color: #15803d !important; }
.badge-status-rejected { background: var(--c-rose-bg) !important; color: #be123c !important; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn { --bs-btn-border-radius: 9px; --bs-btn-font-weight: 600; --bs-btn-padding-x: .95rem; white-space: nowrap; }
.btn-sm { --bs-btn-border-radius: 8px; --bs-btn-padding-x: .65rem; --bs-btn-font-size: .875rem; }
.btn-lg { --bs-btn-border-radius: 12px; }
.btn-primary {
  --bs-btn-bg: var(--hrm-primary); --bs-btn-border-color: var(--hrm-primary);
  --bs-btn-hover-bg: var(--hrm-primary-600); --bs-btn-hover-border-color: var(--hrm-primary-600);
  --bs-btn-active-bg: #3730a3; --bs-btn-active-border-color: #3730a3;
  --bs-btn-disabled-bg: #a5b4fc; --bs-btn-disabled-border-color: #a5b4fc;
  box-shadow: 0 4px 12px rgba(79, 70, 229, .22);
}
.btn-outline-primary {
  --bs-btn-color: var(--hrm-primary); --bs-btn-border-color: #c7d2fe;
  --bs-btn-hover-bg: var(--hrm-primary-50); --bs-btn-hover-color: var(--hrm-primary-600); --bs-btn-hover-border-color: #a5b4fc;
  --bs-btn-active-bg: var(--hrm-primary-100); --bs-btn-active-color: var(--hrm-primary-600); --bs-btn-active-border-color: #a5b4fc;
}
.btn-outline-secondary {
  --bs-btn-color: var(--hrm-ink-2); --bs-btn-border-color: #d7dce5; --bs-btn-bg: #fff;
  --bs-btn-hover-bg: var(--hrm-surface-2); --bs-btn-hover-color: var(--hrm-ink); --bs-btn-hover-border-color: #c3cad6;
  --bs-btn-active-bg: #eef1f5; --bs-btn-active-color: var(--hrm-ink); --bs-btn-active-border-color: #c3cad6;
}
.btn-success { --bs-btn-bg: #16a34a; --bs-btn-border-color: #16a34a; --bs-btn-hover-bg: #15803d; --bs-btn-hover-border-color: #15803d; }
.btn-danger  { --bs-btn-bg: #e11d48; --bs-btn-border-color: #e11d48; --bs-btn-hover-bg: #be123c; --bs-btn-hover-border-color: #be123c; }
.btn-warning { --bs-btn-bg: #f59e0b; --bs-btn-border-color: #f59e0b; --bs-btn-hover-bg: #d97706; --bs-btn-hover-border-color: #d97706; --bs-btn-color: #fff; --bs-btn-hover-color: #fff; }
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--hrm-border); }

/* ── Forms ───────────────────────────────────────────────────────────── */
.form-control, .form-select {
  border-color: #d9dee7; border-radius: 9px; color: var(--hrm-ink);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:hover, .form-select:hover { border-color: #c3cad6; }
.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: var(--hrm-primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}
.form-control-sm, .form-select-sm { border-radius: 8px; font-size: .9rem; min-height: calc(1.6em + .6rem); }
.form-label { font-weight: 600; font-size: .9rem; color: var(--hrm-ink-2); margin-bottom: .35rem; }
.form-text { color: var(--hrm-muted); }
.form-check-input:checked { background-color: var(--hrm-primary); border-color: var(--hrm-primary); }
.input-group-text { background: var(--hrm-surface-2); border-color: #d9dee7; color: var(--hrm-muted); }
.input-group > .form-control, .input-group > .form-select { border-radius: 9px; }
.input-group > :not(:first-child):not(.dropdown-menu) { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; }
.input-group > :not(:last-child):not(.dropdown-toggle):not(.dropdown-menu) { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; }
.hrm-content > form:not(.d-inline):not(.hrm-plain):not(:has(table, .card)) {
  background: #fff; border: 1px solid var(--hrm-border); border-radius: var(--hrm-radius);
  padding: 1.25rem; box-shadow: var(--hrm-shadow); margin-bottom: 1rem;
}
.hrm-content > form.row, .hrm-content > form.d-flex, .hrm-content > form.row.g-2 {
  margin-left: 0; margin-right: 0; padding: .9rem .75rem;
}

/* ── Alerts / flashes ────────────────────────────────────────────────── */
.alert { border-radius: 12px; border-width: 1px; font-size: .94rem; }
.alert-success { background: #effaf3; border-color: #bfe9cf; color: #166534; }
.alert-danger  { background: #fff1f3; border-color: #fecdd6; color: #9f1239; }
.alert-warning { background: #fffaeb; border-color: #fde6a8; color: #92400e; }
.alert-info    { background: #eff8ff; border-color: #c4e3fb; color: #075985; }
.alert-secondary, .alert-light { background: #f8fafc; border-color: var(--hrm-border); color: var(--hrm-ink-2); }
.hrm-flash-stack .alert { box-shadow: var(--hrm-shadow); display: flex; align-items: flex-start; gap: .6rem; }
.hrm-flash-stack .alert > .bi { font-size: 1.05rem; line-height: 1.3; }

/* ── Misc components ─────────────────────────────────────────────────── */
.nav-tabs { border-bottom-color: var(--hrm-border); gap: .25rem; }
.nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--hrm-muted); font-weight: 600; border-radius: 0; }
.nav-tabs .nav-link:hover { color: var(--hrm-ink); border-bottom-color: #cbd5e1; }
.nav-tabs .nav-link.active { color: var(--hrm-primary); border-bottom-color: var(--hrm-primary); background: transparent; }
.nav-pills .nav-link { border-radius: 9px; font-weight: 600; color: var(--hrm-ink-2); }
.nav-pills .nav-link.active { background: var(--hrm-primary); }
.list-group { --bs-list-group-border-color: var(--hrm-border); --bs-list-group-border-radius: var(--hrm-radius-sm); }
.list-group-item-action:hover { background: #f6f7fe; }
.dropdown-menu {
  --bs-dropdown-border-color: var(--hrm-border); --bs-dropdown-border-radius: 12px;
  --bs-dropdown-link-active-bg: var(--hrm-primary);
  box-shadow: var(--hrm-shadow-lg); padding: .4rem;
}
.dropdown-item { border-radius: 8px; padding: .45rem .7rem; font-size: .92rem; }
.pagination { --bs-pagination-border-radius: 9px; --bs-pagination-active-bg: var(--hrm-primary); --bs-pagination-active-border-color: var(--hrm-primary); --bs-pagination-color: var(--hrm-ink-2); }
.modal-content { border: 0; border-radius: 16px; box-shadow: 0 24px 60px rgba(15, 23, 42, .25); }
.progress { border-radius: 99px; background: #eef1f5; }
.progress-bar { background-color: var(--hrm-primary); }
code { color: #be185d; background: #fdf2f8; padding: .1em .35em; border-radius: 5px; font-size: .84em; }
pre code { background: none; padding: 0; }
.text-muted { color: var(--hrm-muted) !important; }
.text-primary { color: var(--hrm-primary) !important; }
.bg-primary { background-color: var(--hrm-primary) !important; }
.border-primary { border-color: var(--hrm-primary) !important; }
hr { border-color: var(--hrm-border); opacity: 1; }

.hrm-to-top {
  position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 1010;
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--hrm-border);
  background: #fff; color: var(--hrm-primary); box-shadow: var(--hrm-shadow-lg);
  display: grid; place-items: center; font-size: 1.1rem;
  opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .2s, transform .2s;
}
.hrm-to-top.show { opacity: 1; pointer-events: auto; transform: none; }

/* ── Dashboard helpers ───────────────────────────────────────────────── */
.hrm-hero {
  position: relative; overflow: hidden; border-radius: 18px; padding: 1.4rem 1.6rem; margin-bottom: 1.25rem; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #818cf8 0%, #4f46e5 45%, #3730a3 100%);
  box-shadow: 0 14px 34px rgba(79, 70, 229, .28);
}
.hrm-hero::after {
  content: ""; position: absolute; right: -60px; bottom: -90px; width: 260px; height: 260px; border-radius: 50%;
  background: rgba(255, 255, 255, .08);
}
.hrm-hero h1 { color: #fff; font-size: 1.45rem; margin: 0 0 .25rem; }
.hrm-hero p { margin: 0; opacity: .85; font-size: .9rem; }
.hrm-quick { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; position: relative; z-index: 1; }
.hrm-quick a {
  display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .85rem; border-radius: 10px;
  background: rgba(255, 255, 255, .14); color: #fff; font-size: .84rem; font-weight: 600;
  border: 1px solid rgba(255, 255, 255, .22); transition: background .15s;
}
.hrm-quick a:hover { background: rgba(255, 255, 255, .26); color: #fff; }
.hrm-empty { text-align: center; color: var(--hrm-muted); padding: 1.6rem 1rem !important; }
.hrm-empty .bi { display: block; font-size: 1.6rem; color: #cbd5e1; margin-bottom: .3rem; }

/* ── Responsive ──────────────────────────────────────────────────────── */
.hrm-backdrop { display: none; }
@media (max-width: 991.98px) {
  .hrm-sidebar {
    width: min(300px, 86vw); transform: translateX(-105%);
    transition: transform .22s ease; box-shadow: var(--hrm-shadow-lg);
  }
  body.sidebar-open { overflow: hidden; }
  body.sidebar-open .hrm-sidebar { transform: none; }
  .hrm-backdrop { position: fixed; inset: 0; z-index: 1030; background: rgba(15, 23, 42, .45); }
  body.sidebar-open .hrm-backdrop { display: block; }
  .hrm-main { margin-left: 0; }
  .hrm-menu-btn { display: inline-grid; }
  .hrm-date { display: none; }
}
@media (max-width: 575.98px) {
  body { font-size: .97rem; }
  .hrm-content { padding: 1rem .85rem 2.5rem; }
  .hrm-user-btn .hrm-user-name, .hrm-user-btn .hrm-role { display: none; }
  .hrm-user-btn { padding: .2rem; }
  .hrm-crumbs span, .hrm-crumbs .bi { display: none; }
  .stat-card { padding: .85rem .9rem; min-height: 92px; }
  .stat-card .num { font-size: 1.45rem; }
  .stat-card .stat-icon { width: 32px; height: 32px; font-size: .95rem; border-radius: 10px; right: .7rem; top: .7rem; }
  .stat-card .label { padding-right: 2.2rem; }
  .hrm-hero { padding: 1.1rem 1.1rem; border-radius: 14px; }
  .hrm-hero h1 { font-size: 1.25rem; }
  .hrm-quick { flex-wrap: nowrap; overflow-x: auto; margin-right: -1.1rem; padding-right: 1.1rem; scrollbar-width: none; }
  .hrm-quick a { flex-shrink: 0; }
  .hrm-content > form:not(.d-inline):not(.hrm-plain):not(:has(table, .card)) { padding: .9rem; }
  .table > :not(caption) > * > * { white-space: nowrap; }
}
@media print {
  .hrm-sidebar, .hrm-topbar, .hrm-to-top, .hrm-backdrop { display: none !important; }
  .hrm-main { margin-left: 0; }
  .card, .stat-card, .hrm-table-card { box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Page-header action buttons shouldn't stretch to the title's height. */
.hrm-content > .d-flex:first-child > .btn,
.hrm-content > .d-flex:first-child > div > .btn { align-self: center; }

/* Font-size switcher in the topbar */
.hrm-fs-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--hrm-border); background: #fff;
  color: var(--hrm-ink); font-weight: 700; font-size: .9rem; display: grid; place-items: center;
}
.hrm-fs-btn:hover { border-color: #cfd5e0; box-shadow: var(--hrm-shadow); }
.hrm-fs-menu .dropdown-item { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.hrm-fs-menu .dropdown-item.active { background: var(--hrm-primary-50); color: var(--hrm-primary-600); }
.hrm-fs-menu .dropdown-item.active::after { content: "\F26E"; font-family: "bootstrap-icons"; }

/* ── Ai assistant ────────────────────────────────────────────────────── */
.hrm-ai-btn {
  display: inline-flex; align-items: center; gap: .4rem; height: 38px; padding: 0 .9rem;
  border: 0; border-radius: 10px; color: #fff; font-weight: 700; font-size: .9rem;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  box-shadow: 0 6px 16px rgba(99, 102, 241, .35); transition: transform .15s, box-shadow .15s;
}
.hrm-ai-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(99, 102, 241, .42); }
.hrm-ai-btn .bi { color: #fde68a; }
.hrm-ai-panel { --bs-offcanvas-width: 420px; }
.hrm-ai-panel .offcanvas-header { border-bottom: 1px solid var(--hrm-border); }
.hrm-ai-panel .offcanvas-body { background: var(--hrm-bg); display: flex; flex-direction: column; gap: .65rem; }
.hrm-ai-msg {
  max-width: 88%; padding: .65rem .85rem; border-radius: 14px; font-size: .95rem; line-height: 1.65;
  background: #fff; border: 1px solid var(--hrm-border); box-shadow: var(--hrm-shadow); align-self: flex-start;
  border-bottom-left-radius: 4px; word-break: break-word;
}
.hrm-ai-msg.me {
  align-self: flex-end; background: var(--hrm-primary); color: #fff; border-color: var(--hrm-primary);
  border-bottom-left-radius: 14px; border-bottom-right-radius: 4px;
}
.hrm-ai-msg.bot strong { color: var(--hrm-primary-600); }
.hrm-ai-msg.err { background: #fff1f3; color: #9f1239; border-color: #fecdd6; }
.hrm-ai-msg.typing { display: inline-flex; gap: 4px; padding: .8rem .9rem; }
.hrm-ai-msg.typing span { width: 7px; height: 7px; border-radius: 50%; background: #a5b4fc; animation: hrm-dot 1s infinite ease-in-out; }
.hrm-ai-msg.typing span:nth-child(2) { animation-delay: .15s; }
.hrm-ai-msg.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes hrm-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.hrm-ai-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.hrm-ai-chip {
  border: 1px solid #c7d2fe; background: #fff; color: var(--hrm-primary-600); border-radius: 999px;
  padding: .35rem .8rem; font-size: .86rem; font-weight: 600;
}
.hrm-ai-chip:hover { background: var(--hrm-primary-50); }
.hrm-ai-input { display: flex; gap: .5rem; padding: .75rem; border-top: 1px solid var(--hrm-border); background: #fff; }
.hrm-ai-input input {
  flex: 1; min-width: 0; height: 42px; border: 1px solid #d9dee7; border-radius: 10px; padding: 0 .8rem; font-size: .95rem;
}
.hrm-ai-input input:focus { outline: 0; border-color: var(--hrm-primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
.hrm-ai-foot { padding: 0 .9rem .7rem; font-size: .74rem; color: var(--hrm-muted); background: #fff; }
@media (max-width: 575.98px) {
  .hrm-ai-btn { padding: 0 .65rem; }
  .hrm-ai-btn span { display: none; }
  .hrm-ai-panel { --bs-offcanvas-width: 100vw; }
}

/* Payslip explanation card */
.hrm-explain { border-left: 4px solid var(--c-violet); background: linear-gradient(135deg, #fff 60%, var(--c-violet-bg) 100%); }
.hrm-explain .card-body::before { display: none; }
.hrm-explain-text { line-height: 1.8; }
.hrm-explain-text strong { color: var(--hrm-primary-600); }
