/* ============================================================
   HRIS System — Global Stylesheet
   Reference design applied from hrm reference.
   HRIS-specific additions preserved below.
   ============================================================ */

/* ─── CSS Variables (Design Tokens) ─────────────────────── */
:root {
  /* Surfaces */
  --background:           #f6f7fb;
  --surface:              #ffffff;
  --foreground:           #0b1220;
  --card:                 #ffffff;
  --card-foreground:      #0b1220;
  --border:               #e6e8ee;
  --border-strong:        #d4d8e1;
  --input:                #d8dbe4;
  --ring:                 #6366f1;

  /* Brand */
  --primary:              #4f46e5;   /* indigo-600 */
  --primary-fg:           #ffffff;
  --primary-foreground:   #ffffff;   /* backward-compat alias */
  --primary-hover:        #4338ca;   /* indigo-700 */
  --primary-soft:         #eef2ff;   /* indigo-50  */
  --primary-soft-fg:      #3730a3;   /* indigo-800 */

  /* Neutrals */
  --secondary:            #eef0f5;
  --secondary-fg:         #1f2937;
  --muted:                #f3f4f9;
  --muted-fg:             #5b6478;
  --muted-foreground:     #5b6478;   /* backward-compat alias */
  --accent:               #eef2ff;
  --accent-fg:            #1e1b4b;

  /* Status */
  --destructive:          #ef4444;
  --destructive-fg:       #ffffff;
  --destructive-soft:     #fef2f2;
  --success:              #10b981;
  --success-fg:           #065f46;
  --success-soft:         #ecfdf5;
  --warning:              #f59e0b;
  --warning-soft:         #fffbeb;
  --warning-fg:           #92400e;
  --info:                 #0ea5e9;
  --info-soft:            #f0f9ff;
  --info-fg:              #075985;

  /* Sidebar (dark slate, refined) */
  --sidebar-bg:           #0f172a;
  --sidebar-bg-2:         #111c34;
  --sidebar-fg:           #e2e8f0;
  --sidebar-border:       rgba(148,163,184,.14);
  --sidebar-primary:      #818cf8;
  --sidebar-accent:       rgba(99,102,241,.12);
  --sidebar-accent-fg:    #ffffff;
  --sidebar-active:       linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  --sidebar-active-solid: #4f46e5;   /* fallback solid */
  --sidebar-hover:        rgba(255,255,255,.06);
  --sidebar-section:      rgba(226,232,240,.45);

  /* Radii */
  --radius-xs: 0.25rem;
  --radius-sm: 0.375rem;
  --radius:    0.625rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;
  --radius-pill: 9999px;

  /* Typography */
  --font-sans: "Inter", "Plus Jakarta Sans", ui-sans-serif, system-ui,
               -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
               Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Soft layered shadows */
  --shadow-xs: 0 1px 1px rgba(15,23,42,.04);
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 1px 1px rgba(15,23,42,.03);
  --shadow:    0 2px 4px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 6px 16px -4px rgba(15,23,42,.10), 0 2px 4px rgba(15,23,42,.05);
  --shadow-lg: 0 18px 38px -12px rgba(15,23,42,.18), 0 4px 10px rgba(15,23,42,.06);
  --shadow-xl: 0 28px 60px -18px rgba(15,23,42,.28), 0 8px 16px rgba(15,23,42,.08);
  --ring-shadow: 0 0 0 4px rgba(99,102,241,.18);

  /* Motion */
  --ease:        cubic-bezier(.4,0,.2,1);
  --ease-out:    cubic-bezier(.16,1,.3,1);
  --t-fast:      120ms;
  --t-base:      180ms;
  --t-slow:      280ms;
  --transition-base:  background-color var(--t-base) var(--ease),
                      border-color     var(--t-base) var(--ease),
                      color            var(--t-base) var(--ease),
                      box-shadow       var(--t-base) var(--ease),
                      transform        var(--t-base) var(--ease),
                      opacity          var(--t-base) var(--ease);

  /* Layout */
  --sidebar-width: 256px;
  --sidebar-width-collapsed: 72px;
  --topbar-height: 64px;
  --content-max:   1440px;
}

/* Optional dark-mode scaffold (no markup uses it yet — safe to leave dormant) */
[data-theme="dark"] {
  --background:        #0b1020;
  --surface:           #0f172a;
  --foreground:        #e6e8f0;
  --card:              #111a32;
  --card-foreground:   #e6e8f0;
  --border:            #1f2a44;
  --border-strong:     #2a3656;
  --input:             #2a3656;
  --secondary:         #18223d;
  --secondary-fg:      #e6e8f0;
  --muted:             #16203b;
  --muted-fg:          #94a3b8;
  --muted-foreground:  #94a3b8;
  --accent:            #1a2547;
  --accent-fg:         #e0e7ff;
  --primary-soft:      #1e1b4b;
  --primary-soft-fg:   #c7d2fe;
  --destructive-soft:  #2c1717;
  --success-soft:      #082b21;
  --warning-soft:      #2a1d05;
  --info-soft:         #07253a;
}

/* ─── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  line-height: 1.55;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; transition: color var(--t-fast) var(--ease); }
a:hover { text-decoration: none; color: var(--primary); }
img, svg { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--foreground);
  line-height: 1.25;
}
h1 { font-size: 1.75rem; letter-spacing: -0.02em; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }

/* Selection */
::selection { background: rgba(99,102,241,.22); color: var(--foreground); }

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

/* ─── App Layout (sidebar + main) ───────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background:
    radial-gradient(1100px 380px at -180px -140px, rgba(99,102,241,.18), transparent 60%),
    linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 40;
  overflow: hidden;
  transition: transform var(--t-slow) var(--ease), width var(--t-slow) var(--ease);
}

.sidebar-header {
  padding: 1.1rem 1rem 0.9rem;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.sidebar-logo {
  width: 100%;
  max-height: 64px;
  object-fit: contain;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.25));
}
.sidebar-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
}
.sidebar-title-row .icon {
  width: 20px; height: 20px;
  color: var(--sidebar-primary);
  stroke: var(--sidebar-primary);
  flex-shrink: 0;
}
.sidebar-title    { font-size: 0.9rem; font-weight: 700; color: #ffffff; line-height: 1.2; letter-spacing: -.01em; }
.sidebar-subtitle { font-size: 0.72rem; color: rgba(226,232,240,.65); margin-top: 2px; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.625rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(148,163,184,.18); border-radius: 999px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,.32); }

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius);
  color: rgba(226,232,240,.78);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition-base);
  cursor: pointer;
  margin-bottom: 1px;
  border: 1px solid transparent;
}
.nav-link:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
  text-decoration: none;
  transform: translateX(1px);
}
.nav-link.active {
  background: var(--sidebar-active), var(--sidebar-active-solid);
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 14px -4px rgba(99,102,241,.55), inset 0 0 0 1px rgba(255,255,255,.08);
}
.nav-link.active::before {
  content: "";
  position: absolute;
  left: -0.625rem;
  top: 18%;
  bottom: 18%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #c7d2fe;
}
.nav-icon { font-size: 0.95rem; width: 18px; text-align: center; flex-shrink: 0; opacity: .9; }
.nav-link.active .nav-icon { opacity: 1; }

.nav-section-label {
  padding: 0.95rem 0.85rem 0.35rem;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sidebar-section);
}

/* ── Sidebar Accordion Groups ────────────────────────────────────────────── */
.nav-group { margin-bottom: 1px; }

.nav-group-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: rgba(226,232,240,.78);
  font-size: 0.85rem;
  font-weight: 500;
  background: none;
  border: 1px solid transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-base);
  margin-bottom: 1px;
  outline: none;
}
.nav-group-btn:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
  transform: translateX(1px);
}
.nav-group-btn.has-active {
  color: #c7d2fe;
  background: rgba(99,102,241,.08);
  border-color: rgba(99,102,241,.15);
}
.nav-group-btn.has-active::before {
  content: "";
  position: absolute;
  left: -0.625rem;
  top: 18%; bottom: 18%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: rgba(199,210,254,.5);
}
.nav-group-label { flex: 1; }
.nav-group-chevron {
  font-size: 0.68rem;
  opacity: 0.42;
  transition: transform 0.22s ease, opacity 0.15s;
  flex-shrink: 0;
  line-height: 1;
}
.nav-group-btn.open .nav-group-chevron,
.nav-subgroup-btn.open .nav-group-chevron {
  transform: rotate(180deg);
  opacity: 0.72;
}
.nav-group-children {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.28s ease;
  margin-bottom: 1px;
}
/* First-level child links (indented) */
.nav-group-children > .nav-link {
  font-size: 0.82rem;
  padding: 0.42rem 0.65rem 0.42rem 2.15rem;
}
/* Sub-group (nested accordion inside a group) */
.nav-subgroup { margin-bottom: 1px; }
.nav-subgroup-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.38rem 0.65rem 0.38rem 2rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(226,232,240,.58);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius);
  transition: var(--transition-base);
  outline: none;
  letter-spacing: 0.01em;
}
.nav-subgroup-btn:hover {
  color: rgba(226,232,240,.9);
  background: var(--sidebar-hover);
}
.nav-subgroup-btn.has-active { color: #c7d2fe; }
.nav-subgroup-children {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.22s ease;
}
/* Second-level child links (double-indented) */
.nav-subgroup-children > .nav-link {
  font-size: 0.79rem;
  padding: 0.36rem 0.65rem 0.36rem 2.9rem;
}
/* Collapsed sidebar hides accordion labels */
body.sidebar-collapsed .nav-group-label,
body.sidebar-collapsed .nav-group-chevron { display: none; }

.sidebar-user {
  flex-shrink: 0;
  border-top: 1px solid var(--sidebar-border);
  padding: 0.75rem;
  background: rgba(15,23,42,.4);
  backdrop-filter: blur(6px);
}
.user-info {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius);
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  margin-bottom: 0.5rem;
}
.user-info .icon { width: 16px; height: 16px; color: var(--sidebar-fg); stroke: var(--sidebar-fg); flex-shrink: 0; }
.user-email { font-size: 0.78rem; font-weight: 600; color: #ffffff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; letter-spacing: -.005em; }
.user-role  { font-size: 0.68rem; color: rgba(226,232,240,.7); text-transform: capitalize; }

.btn-logout {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  color: rgba(226,232,240,.85);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-base);
}
.btn-logout:hover { background: var(--destructive); border-color: var(--destructive); color: #fff; box-shadow: 0 4px 14px -4px rgba(239,68,68,.55); }
.icon-sm { width: 12px; height: 12px; }

/* ─── Main Content Area ──────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--background);
}

/* ─── Main Header (top bar) ──────────────────────────────── */
.main-header {
  background: rgba(255,255,255,.78);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
          backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--topbar-height);
  box-shadow: 0 1px 0 rgba(15,23,42,.04);
  gap: 1rem;
}
.main-header h1,
.main-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--foreground);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -.005em;
}
.header-right { display: flex; align-items: center; gap: 0.625rem; flex-shrink: 0; }

/* ─── BIR Badge ──────────────────────────────────────────── */
.bir-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.325rem 0.75rem;
  border-radius: var(--radius-pill);
  background: var(--success-soft);
  border: 1px solid rgba(16,185,129,.22);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--success-fg);
  white-space: nowrap;
  letter-spacing: .01em;
}
.bir-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(16,185,129,.18);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1; transform:scale(1)} 50%{opacity:.55; transform:scale(.92)} }

/* ─── Page Content / Header ──────────────────────────────── */
.page-content { padding: 1.75rem 1.75rem 2.25rem; flex: 1; }
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 1.75rem 0;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-title       { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.page-subtitle,
.page-description { font-size: 0.875rem; color: var(--muted-fg); margin-top: 0.25rem; }

/* ─── Breadcrumb ─────────────────────────────────────────── */
.breadcrumb {
  display: flex; align-items: center; gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--muted-fg);
  margin-bottom: 1.25rem;
}
.breadcrumb a { color: var(--muted-fg); text-decoration: none; transition: color var(--t-fast) var(--ease); }
.breadcrumb a:hover { color: var(--primary); text-decoration: none; }
.breadcrumb-sep, .breadcrumb span.sep { color: var(--border-strong); }
.breadcrumb .current, .breadcrumb [aria-current="page"] { color: var(--foreground); font-weight: 600; }

/* ─── Card ───────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t-base) var(--ease), transform var(--t-base) var(--ease), border-color var(--t-base) var(--ease);
}
.card:hover { box-shadow: var(--shadow); }
.card-interactive { cursor: pointer; }
.card-interactive:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card-header  { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.card-content { padding: 1.5rem; }
.card-title   { font-size: 1rem; font-weight: 600; letter-spacing: -.005em; }
.card-desc    { font-size: 0.8125rem; color: var(--muted-fg); margin-top: 0.2rem; line-height: 1.45; }
.card-footer  { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: flex-end; gap: .5rem; }

/* ─── Stat cards (dashboard) ─────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow: hidden;
  isolation: isolate;
  transition: var(--transition-base);
}
.stat-card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #818cf8);
  opacity: 0;
  transition: opacity var(--t-base) var(--ease);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.stat-card:hover::after { opacity: 1; }
.stat-value  { font-size: 1.85rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; color: var(--foreground); }
.stat-label  { font-size: 0.75rem; color: var(--muted-fg); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-bottom: .35rem; }
.stat-change { font-size: 0.78rem; margin-top: 0.35rem; font-weight: 500; display: inline-flex; align-items: center; gap: .25rem; }
.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--destructive); }
.stat-icon {
  position: absolute; top: 1rem; right: 1rem;
  width: 38px; height: 38px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 1.05rem;
}

/* ─── Grid utilities ─────────────────────────────────────── */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.gap-2  { gap: 0.5rem; }
.gap-4  { gap: 1rem; }
.gap-6  { gap: 1.5rem; }
.gap-8  { gap: 2rem; }

/* Content grid (responsive) */
.content-grid   { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 768px) {
  .content-grid-2 { grid-template-columns: 1fr 1fr; }
  .content-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* ─── Badge ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
  line-height: 1.4;
  border: 1px solid transparent;
}
.badge-default     { background: var(--primary);              color: var(--primary-fg); }
.badge-primary     { background: var(--primary-soft);         color: var(--primary-soft-fg);   border-color: rgba(99,102,241,.18); }
.badge-secondary   { background: var(--secondary);            color: var(--secondary-fg);      border-color: var(--border); }
.badge-success     { background: var(--success-soft);         color: var(--success-fg);        border-color: rgba(16,185,129,.22); }
.badge-destructive { background: var(--destructive-soft);     color: #991b1b;                  border-color: rgba(239,68,68,.22); }
.badge-warning     { background: var(--warning-soft);         color: var(--warning-fg);        border-color: rgba(245,158,11,.25); }
.badge-info        { background: var(--info-soft);            color: var(--info-fg);           border-color: rgba(14,165,233,.22); }
.badge-outline     { border-color: var(--border);             background: transparent;         color: var(--foreground); }
.badge-dot         { padding-left: .45rem; }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }

/* ─── Table ──────────────────────────────────────────────── */
.table-wrapper,
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  box-shadow: var(--shadow-xs);
}
table  { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.875rem; }
thead  { background: var(--muted); }
th     { padding: 0.7rem 1rem; text-align: left; font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-fg); white-space: nowrap; border-bottom: 1px solid var(--border); }
td     { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--t-fast) var(--ease); }
tbody tr:hover td { background: rgba(99,102,241,.04); }

/* Sticky header support — opt-in via .table-sticky on the wrapper */
.table-sticky thead th {
  position: sticky;
  top: 0;
  background: var(--muted);
  z-index: 1;
  box-shadow: 0 1px 0 var(--border);
}

/* ─── Data Table (explicit class) ───────────────────────── */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.875rem; }
.data-table th {
  padding: 0.7rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted-fg);
  border-bottom: 1px solid var(--border);
  background: var(--muted);
  white-space: nowrap;
}
.data-table td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background var(--t-fast) var(--ease); }
.data-table tbody tr:hover td { background: rgba(99,102,241,.04); }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: -.005em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-base);
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
}
.btn:focus-visible { outline: none; box-shadow: var(--ring-shadow); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, #6366f1 0%, var(--primary) 100%);
  color: var(--primary-fg);
  border-color: var(--primary);
  box-shadow: 0 1px 2px rgba(79,70,229,.25), inset 0 1px 0 rgba(255,255,255,.16);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-hover) 100%);
  border-color: var(--primary-hover);
  color: var(--primary-fg);
  text-decoration: none;
  box-shadow: 0 6px 16px -6px rgba(79,70,229,.55), inset 0 1px 0 rgba(255,255,255,.16);
}

.btn-secondary  { background: var(--secondary);   color: var(--secondary-fg);    border-color: var(--border); }
.btn-secondary:hover:not(:disabled)  { background: #e6e8ee; text-decoration: none; }

.btn-outline    { background: var(--card); border-color: var(--border-strong); color: var(--foreground); box-shadow: var(--shadow-xs); }
.btn-outline:hover:not(:disabled)    { background: var(--accent); border-color: var(--primary); color: var(--primary-soft-fg); text-decoration: none; }

.btn-ghost      { background: transparent; border-color: transparent; color: var(--foreground); }
.btn-ghost:hover:not(:disabled)      { background: var(--accent); color: var(--primary-soft-fg); text-decoration: none; }

.btn-destructive{ background: var(--destructive); color: var(--destructive-fg);  border-color: var(--destructive); box-shadow: 0 1px 2px rgba(239,68,68,.25), inset 0 1px 0 rgba(255,255,255,.18); }
.btn-destructive:hover:not(:disabled){ background: #dc2626; border-color: #dc2626; box-shadow: 0 6px 16px -6px rgba(239,68,68,.55); }

.btn-success    { background: var(--success);     color: #fff; border-color: var(--success); box-shadow: 0 1px 2px rgba(16,185,129,.25), inset 0 1px 0 rgba(255,255,255,.18); }
.btn-success:hover:not(:disabled)    { background: #059669; border-color: #059669; box-shadow: 0 6px 16px -6px rgba(16,185,129,.55); }

.btn-sm         { padding: 0.4rem 0.75rem; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-lg         { padding: 0.75rem 1.4rem; font-size: 0.95rem; }
.btn-xl         { padding: 0.9rem 1.6rem; font-size: 1rem; border-radius: var(--radius-md); }
.btn-full       { width: 100%; }
.btn-icon       { padding: 0; width: 2.25rem; height: 2.25rem; }
.btn-icon.btn-sm { width: 2rem; height: 2rem; }

/* ─── Forms ──────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: .25rem; }
label, .form-label { font-size: 0.8rem; font-weight: 600; color: var(--foreground); letter-spacing: -.005em; }
.form-hint { font-size: 0.75rem; color: var(--muted-fg); }
.form-control,
.input,
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="tel"], input[type="date"], input[type="time"],
input[type="datetime-local"], input[type="search"], input[type="url"],
select, textarea {
  width: 100%;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  font-size: 0.875rem;
  background: var(--card);
  color: var(--foreground);
  transition: var(--transition-base);
  outline: none;
  box-shadow: 0 1px 0 rgba(15,23,42,.02);
}
.form-control:hover,
.input:hover, input:not(:focus):hover, select:not(:focus):hover, textarea:not(:focus):hover {
  border-color: var(--border-strong);
}
.form-control:focus,
.input:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--ring);
  box-shadow: var(--ring-shadow);
  background: var(--card);
}
input::placeholder, textarea::placeholder { color: var(--muted-fg); opacity: .85; }
.input-error { border-color: var(--destructive); }
.input-error:focus { box-shadow: 0 0 0 4px rgba(239,68,68,.18); }
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }

.input-wrapper { position: relative; display: flex; align-items: center; }
.input-wrapper input { padding-right: 2.75rem; }
.input-icon-right {
  position: absolute; right: 0.625rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--muted-fg);
  font-size: 1rem; padding: 0.25rem; line-height: 1;
  border-radius: var(--radius-sm);
  transition: var(--transition-base);
}
.input-icon-right:hover { background: var(--muted); color: var(--foreground); }

/* Search input variant */
.input-search {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235b6478' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.75rem center;
  padding-left: 2.25rem;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235b6478' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

/* Native checkbox / radio polish */
input[type="checkbox"], input[type="radio"] {
  width: 1rem; height: 1rem;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ─── Tabs ───────────────────────────────────────────────── */
.tabs { width: 100%; }
.tabs-list {
  display: grid;
  border-radius: var(--radius);
  background: var(--muted);
  padding: 0.3rem;
  gap: 0.25rem;
  border: 1px solid var(--border);
}
.tabs-list.cols-2, .cols-2 { grid-template-columns: repeat(2, 1fr); }
.tabs-list.cols-3, .cols-3 { grid-template-columns: repeat(3, 1fr); }
.tabs-list.cols-4, .cols-4 { grid-template-columns: repeat(4, 1fr); }
.tab-trigger {
  padding: 0.5rem 1rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.84rem;
  font-weight: 600;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted-fg);
  transition: var(--transition-base);
  text-align: center;
}
.tab-trigger:hover { color: var(--foreground); }
.tab-trigger.active,
.tab-trigger[aria-selected="true"] {
  background: var(--card);
  color: var(--primary-soft-fg);
  box-shadow: var(--shadow-sm);
}
.tab-content { display: none; padding-top: 1rem; }
.tab-content.active { display: block; animation: fade-in var(--t-base) var(--ease); }
@keyframes fade-in { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

/* ─── Dialog / Modal ─────────────────────────────────────── */
.dialog-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.45);
  -webkit-backdrop-filter: blur(2px);
          backdrop-filter: blur(2px);
  z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: fade-in var(--t-base) var(--ease);
}
.dialog-overlay.hidden { display: none; }
.dialog {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  box-shadow: var(--shadow-xl);
  position: relative;
  animation: dialog-pop var(--t-slow) var(--ease-out);
}
@keyframes dialog-pop { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.dialog-header { margin-bottom: 1rem; }
.dialog-title  { font-size: 1.125rem; font-weight: 600; letter-spacing: -.01em; }
.dialog-desc   { font-size: 0.875rem; color: var(--muted-fg); margin-top: 0.25rem; }
.dialog-close  {
  position: absolute; top: 1rem; right: 1rem;
  background: none; border: none; font-size: 1.25rem;
  cursor: pointer; color: var(--muted-fg);
  width: 2rem; height: 2rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  transition: var(--transition-base);
}
.dialog-close:hover { background: var(--muted); color: var(--foreground); }
.dialog-footer { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1.5rem; }

/* Legacy modal (backward-compat) */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.45);
  -webkit-backdrop-filter: blur(2px);
          backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 1rem;
  animation: fade-in var(--t-base) var(--ease);
}
.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  animation: dialog-pop var(--t-slow) var(--ease-out);
}
.modal-header {
  padding: 1.15rem 1.5rem; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-title  { font-size: 1rem; font-weight: 600; letter-spacing: -.005em; }
.modal-body   { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; gap: .5rem; justify-content: flex-end; background: var(--muted); border-bottom-left-radius: var(--radius-lg); border-bottom-right-radius: var(--radius-lg); }

/* Employee modal */
.emp-modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 1rem;
  animation: fade-in var(--t-base) var(--ease);
}
.emp-modal {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl); width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto;
  animation: dialog-pop var(--t-slow) var(--ease-out);
}

/* ─── Alert / Notice ─────────────────────────────────────── */
.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  border: 1px solid transparent;
  display: flex; align-items: flex-start; gap: 0.6rem;
  line-height: 1.5;
}
.alert-success    { background: var(--success-soft);     border-color: rgba(16,185,129,.22);  color: var(--success-fg); }
.alert-error,
.alert-destructive{ background: var(--destructive-soft); border-color: rgba(239,68,68,.22);   color: #991b1b; }
.alert-warning    { background: var(--warning-soft);     border-color: rgba(245,158,11,.25);  color: var(--warning-fg); }
.alert-info       { background: var(--info-soft);        border-color: rgba(14,165,233,.22);  color: var(--info-fg); }

/* ─── Toast Notifications ────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 0.6rem;
  max-width: 380px; width: 100%;
  pointer-events: none;
}
.toast {
  background: var(--card);
  color: var(--foreground);
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 0.2rem;
  pointer-events: all;
  cursor: pointer;
  animation: toast-in 0.3s var(--ease-out);
  border-left: 4px solid var(--muted-fg);
}
.toast-default     { border-left-color: var(--primary); }
.toast-destructive { border-left-color: var(--destructive); }
.toast-success     { border-left-color: var(--success); }
.toast-warning     { border-left-color: var(--warning); }
.toast-title   { font-weight: 600; font-size: 0.875rem; letter-spacing: -.005em; }
.toast-desc,
.toast-message { font-size: 0.8125rem; color: var(--muted-fg); }
.toast-fade-out { animation: toast-out 0.4s var(--ease) forwards; }
@keyframes toast-in  { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; transform: translateX(110%); } }

/* ─── Auth Page (login / register) ──────────────────────── */
.auth-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background:
    radial-gradient(800px 380px at 12% 8%, rgba(99,102,241,.18), transparent 60%),
    radial-gradient(700px 360px at 90% 95%, rgba(16,185,129,.14), transparent 60%),
    linear-gradient(135deg, #eef2ff 0%, #f6f7fb 50%, #eef2ff 100%);
}
.auth-page::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(15,23,42,.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15,23,42,.04) 1px, transparent 1px);
  background-size: 36px 36px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 50%, transparent 75%);
          mask-image: radial-gradient(ellipse at center, #000 50%, transparent 75%);
  pointer-events: none;
}
.auth-card {
  position: relative; z-index: 1;
  width: 100%;
  max-width: 460px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}
.auth-card .card-header { padding: 2rem 2rem 0; text-align: center; border-bottom: none; }
.auth-card .card-content { padding: 1.5rem 2rem 2rem; }
.auth-logo    { height: 80px; object-fit: contain; margin: 0 auto 1rem; filter: drop-shadow(0 4px 14px rgba(15,23,42,.08)); }
.auth-title   { font-size: 1.45rem; font-weight: 700; letter-spacing: -.02em; }
.auth-subtitle{ color: var(--muted-fg); font-size: 0.875rem; margin-top: 0.3rem; }

/* ─── Spinner ────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 1rem; height: 1rem;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Dropdown ───────────────────────────────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown-content {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  min-width: 220px; z-index: 200; padding: 0.35rem;
  animation: dropdown-in var(--t-base) var(--ease-out);
}
@keyframes dropdown-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.dropdown-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem; color: var(--foreground);
  cursor: pointer; border: none; background: none;
  width: 100%; text-decoration: none;
  transition: var(--transition-base);
  text-align: left;
}
.dropdown-item:hover { background: var(--accent); color: var(--primary-soft-fg); text-decoration: none; }
.dropdown-divider { height: 1px; background: var(--border); margin: 0.35rem 0; }
.dropdown-label { padding: 0.4rem 0.75rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-fg); font-weight: 700; }

/* ─── Empty / Loading States ─────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 3rem 1rem; text-align: center; color: var(--muted-fg);
}
.empty-state-icon  { font-size: 3rem; margin-bottom: 1rem; }
.empty-state-title { font-size: 1.1rem; font-weight: 600; color: var(--foreground); margin-bottom: 0.5rem; }
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 3rem; color: var(--muted-fg); gap: 0.75rem;
}

/* ─── Progress Bar ───────────────────────────────────────── */
.progress { height: 8px; background: var(--muted); border-radius: var(--radius-pill); overflow: hidden; border: 1px solid var(--border); }
.progress > * { height: 100%; border-radius: var(--radius-pill); background: linear-gradient(90deg, var(--primary), #818cf8); transition: width var(--t-slow) var(--ease); }
.progress-success > * { background: linear-gradient(90deg, var(--success), #34d399); }
.progress-warning > * { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.progress-danger  > * { background: linear-gradient(90deg, var(--destructive), #f87171); }

/* ─── Close button ───────────────────────────────────────── */
.close-x {
  background: none; border: none; cursor: pointer; font-size: 1.25rem;
  color: var(--muted-fg); line-height: 1; padding: 0.25rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
}
.close-x:hover { background: var(--muted); color: var(--foreground); }

/* ─── View toggle (grid / list) ──────────────────────────── */
.view-section { display: block; }
.view-grid    { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }

/* ─── Generic action row ─────────────────────────────────── */
.actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* ─── Sub text / helper ──────────────────────────────────── */
.sub   { font-size: 0.75rem; color: var(--muted-fg); }
.small { font-size: 0.8rem; }
.hint  { font-size: 0.78rem; color: var(--muted-fg); font-style: italic; }
.muted { color: var(--muted-fg); }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.error { color: var(--destructive); font-size: 0.8rem; margin-top: 0.25rem; }
.text-muted { color: var(--muted-fg); }

/* ─── Flash / inline alerts ──────────────────────────────── */
.emp-flash { padding: 0.75rem 1rem; border-radius: var(--radius); font-size: 0.875rem; margin-bottom: 1rem; }
.emp-flash.success { background: rgba(34,197,94,.1); color: #166534; border: 1px solid rgba(34,197,94,.2); }
.emp-flash.error   { background: rgba(239,68,68,.1);  color: #991b1b; border: 1px solid rgba(239,68,68,.2); }

/* ─── Bank upload helpers ────────────────────────────────── */
.bank-primary-hidden { display: none; }

/* ─── Notification bell ──────────────────────────────────── */
.notif-bell-wrap { position: relative; display: inline-flex; align-items: center; }
.notif-badge {
  position: absolute; top: -2px; right: -2px;
  background: var(--destructive); color: #fff;
  font-size: 0.62rem; font-weight: 700;
  min-width: 17px; height: 17px; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; pointer-events: none;
  box-shadow: 0 0 0 2px var(--card);
  letter-spacing: -.02em;
}
.notif-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 360px; max-height: 460px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-xl);
  z-index: 300; overflow: hidden; display: flex; flex-direction: column;
  animation: dropdown-in var(--t-base) var(--ease-out);
}
.notif-dropdown-header { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 0.875rem; background: var(--muted); }
.notif-item {
  display: flex; flex-direction: column; gap: 0.2rem;
  padding: 0.85rem 1rem; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: var(--transition-base);
  position: relative;
}
.notif-item:hover           { background: var(--accent); }
.notif-item.notif-unread    { background: var(--info-soft); }
.notif-item.notif-unread::before {
  content: "";
  position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
  width: 6px; height: 6px; border-radius: 50%; background: var(--primary);
}
.notif-item-title { font-size: 0.84rem; font-weight: 600; letter-spacing: -.005em; }
.notif-item-msg   { font-size: 0.78rem; color: var(--muted-fg); line-height: 1.45; }
.notif-item-time  { font-size: 0.7rem; color: var(--muted-fg); }
.notif-empty      { padding: 2.25rem 1rem; text-align: center; color: var(--muted-fg); font-size: 0.875rem; }
.notif-show-more  {
  padding: 0.75rem 1rem; text-align: center;
  font-size: 0.8rem; color: var(--primary); font-weight: 600;
  cursor: pointer; border-top: 1px solid var(--border);
  transition: var(--transition-base);
}
.notif-show-more:hover { background: var(--accent); }

/* ─── Old PascalCase layout compatibility ────────────────── */
.app { display: flex; min-height: 100vh; }
.app > .sidebar {
  width: 256px; min-width: 256px;
  background: var(--sidebar-bg); color: var(--sidebar-fg);
  display: flex; flex-direction: column;
  height: 100vh; position: sticky; top: 0; overflow-y: auto; padding: 1rem 0.5rem;
}
.app > .sidebar .brand {
  font-size: 0.9rem; font-weight: 700; color: #f1f5f9;
  padding: 0.5rem 0.75rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 0.5rem;
}
.app > .sidebar .brand small { display: block; font-size: 0.7rem; color: #64748b; font-weight: 400; margin-top: 0.2rem; }
.app > .sidebar .nav-section { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: #64748b; padding: 0.75rem 0.75rem 0.25rem; margin-top: 0.5rem; }
.app > .sidebar .nav a { display: block; padding: 0.45rem 0.75rem; border-radius: var(--radius); color: var(--sidebar-fg); font-size: 0.83rem; text-decoration: none; margin-bottom: 1px; transition: background .15s, color .15s; }
.app > .sidebar .nav a:hover  { background: var(--sidebar-hover); color: #f1f5f9; }
.app > .sidebar .nav a.active { background: var(--sidebar-active); color: #fff; }
.app > .main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-x: hidden; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.875rem 2rem; background: var(--card);
  border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm);
  position: sticky; top: 0; z-index: 50; min-height: 60px; gap: 1rem;
}
.topbar h1 { font-size: 1.1rem; font-weight: 700; margin: 0; color: var(--foreground); }
.topbar .muted  { font-size: 0.8rem; color: var(--muted-fg); margin-top: 0.15rem; }
.topbar .search { display: flex; align-items: center; gap: 0.5rem; }
.topbar .search input { padding: 0.4rem 0.75rem; border: 1px solid var(--input); border-radius: var(--radius); font-size: 0.85rem; outline: none; }
.topbar .search input:focus { border-color: var(--primary); }
.app > .main .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; padding: 1.5rem 2rem 0; }
.app > .main .card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; box-shadow: var(--shadow-sm); }
.app > .main .card .label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-fg); margin-bottom: 0.35rem; }
.app > .main .card .value { font-size: 1.75rem; font-weight: 700; line-height: 1; color: var(--foreground); }
.app > .main .section-title { padding: 1.25rem 2rem 0.5rem; font-size: 1rem; font-weight: 700; color: var(--foreground); }
.app > .main .table-wrap { padding: 0 2rem 1.5rem; overflow-x: auto; }
.app > .main .table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.app > .main .table th { padding: 0.65rem 1rem; text-align: left; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; color: var(--muted-fg); border-bottom: 1px solid var(--border); }
.app > .main .table td { padding: 0.65rem 1rem; border-bottom: 1px solid var(--border); }
.app > .main .table tbody tr:hover { background: var(--muted); }
.app > .main .panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin: 0 2rem 1.5rem; }
.app > .main .list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.app > .main .list li { font-size: 0.875rem; padding: 0.5rem 0.75rem; background: var(--muted); border-radius: var(--radius); }
.app > .main .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.app > .main .form-grid label.small { font-size: 0.8rem; color: var(--muted-fg); display: block; margin-bottom: 0.25rem; }
.app > .main .form-grid input { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--input); border-radius: var(--radius); font-size: 0.875rem; }

/* ─── Utility Spacing & Layout ───────────────────────────── */
.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}
.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}
.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}
.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}
.p-2{padding:.5rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}

.space-y-2 > * + * { margin-top:.5rem }
.space-y-3 > * + * { margin-top:.75rem }
.space-y-4 > * + * { margin-top:1rem }
.space-y-6 > * + * { margin-top:1.5rem }

.flex{display:flex}.flex-col{flex-direction:column}.flex-1{flex:1}.flex-wrap{flex-wrap:wrap}
.items-center{align-items:center}.justify-center{justify-content:center}
.justify-between{justify-content:space-between}.justify-end{justify-content:flex-end}
.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}

.text-xs{font-size:.75rem}.text-sm{font-size:.875rem}.text-lg{font-size:1.125rem}
.text-xl{font-size:1.25rem}.text-2xl{font-size:1.5rem}.text-3xl{font-size:1.875rem}
.font-medium{font-weight:500}.font-semibold{font-weight:600}.font-bold{font-weight:700}
.text-muted{color:var(--muted-fg)}.text-destructive{color:var(--destructive)}
.text-success{color:var(--success)}.text-primary{color:var(--primary)}
.text-center{text-align:center}.text-right{text-align:right}
.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.w-full{width:100%}.min-h-screen{min-height:100vh}
.overflow-hidden{overflow:hidden}.overflow-auto{overflow:auto}
.rounded{border-radius:var(--radius)}.rounded-full{border-radius:9999px}
.bg-muted{background:var(--muted)}.bg-card{background:var(--card)}
.border{border:1px solid var(--border)}.border-t{border-top:1px solid var(--border)}.border-b{border-bottom:1px solid var(--border)}
.hidden{display:none !important}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}

.icon    { width: 20px; height: 20px; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }

/* ─── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar         { width: 8px; height: 8px; }
::-webkit-scrollbar-track   { background: transparent; }
::-webkit-scrollbar-thumb   { background: rgba(15,23,42,.14); border-radius: var(--radius-pill); border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(15,23,42,.28); background-clip: padding-box; }
* { scrollbar-width: thin; scrollbar-color: rgba(15,23,42,.18) transparent; }

/* ─── Time & Attendance column helper ───────────────────── */
.col-time-att:first-child { width: 50%; }
.col-time-att:last-child  { width: 50%; text-align: right; }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-content { padding: 1rem; }
  .main-header { padding: 0.75rem 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .auth-card  { max-width: 100%; }
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 { grid-template-columns: 1fr; }
  .notif-dropdown { width: 290px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════════════════════════
   GEAR SETTINGS PANEL
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Gear button in header ──────────────────────────────────────────────── */
.gp-gear-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius, 8px);
  background: transparent;
  color: var(--muted-fg, #6b7280);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.gp-gear-btn:hover {
  background: var(--muted, #f3f4f6);
  color: var(--foreground, #111827);
}

/* ── Overlay ────────────────────────────────────────────────────────────── */
.gp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 1099;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.gp-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* ── Slide-in panel ─────────────────────────────────────────────────────── */
.gp-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  max-width: 100vw;
  height: 100dvh;
  background: var(--card, #fff);
  border-left: 1px solid var(--border, #e5e7eb);
  box-shadow: -4px 0 24px rgba(0,0,0,.12);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.gp-panel.open {
  transform: translateX(0);
}

/* ── Panel header ───────────────────────────────────────────────────────── */
.gp-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--border, #e5e7eb);
  flex-shrink: 0;
  background: var(--card, #fff);
}
.gp-panel-head h3 {
  margin: 0;
  font-size: .9375rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .4rem;
  color: var(--foreground, #111827);
}
.gp-panel-head .close-x {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: var(--muted-fg, #6b7280);
  line-height: 1;
  padding: .25rem .375rem;
  border-radius: 4px;
  transition: background 0.12s;
}
.gp-panel-head .close-x:hover {
  background: var(--muted, #f3f4f6);
  color: var(--foreground, #111827);
}

/* ── Scrollable body ────────────────────────────────────────────────────── */
.gp-body {
  flex: 1;
  overflow-y: auto;
  padding: .25rem 0 1.5rem;
}
.gp-body::-webkit-scrollbar { width: 4px; }
.gp-body::-webkit-scrollbar-thumb { background: var(--border, #e5e7eb); border-radius: 4px; }

/* ── Sections ───────────────────────────────────────────────────────────── */
.gp-section {
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.gp-section:last-child {
  border-bottom: none;
}
.gp-section-title {
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted-fg, #6b7280);
  margin-bottom: .625rem;
}

/* ── Links ──────────────────────────────────────────────────────────────── */
.gp-link {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .25rem;
  font-size: .875rem;
  color: var(--foreground, #111827);
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.12s;
}
.gp-link:hover {
  background: var(--muted, #f3f4f6);
  text-decoration: none;
}
.gp-icon {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}

/* ── Preference row ─────────────────────────────────────────────────────── */
.gp-pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .4rem 0;
}
.gp-pref-label {
  font-size: .875rem;
  color: var(--foreground, #111827);
  flex: 1;
}

/* ── Toggle switch ──────────────────────────────────────────────────────── */
.gp-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.gp-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.gp-toggle-track {
  display: block;
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: var(--border, #d1d5db);
  transition: background 0.2s;
  position: relative;
}
.gp-toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.gp-toggle input:checked + .gp-toggle-track {
  background: var(--primary, #2563eb);
}
.gp-toggle input:checked + .gp-toggle-track::after {
  transform: translateX(16px);
}

/* ── Selects ────────────────────────────────────────────────────────────── */
.gp-select {
  width: 100%;
  padding: .45rem .6rem;
  font-size: .875rem;
  border: 1px solid var(--border, #d1d5db);
  border-radius: var(--radius, 8px);
  background: var(--card, #fff);
  color: var(--foreground, #111827);
  margin-top: .375rem;
  cursor: pointer;
}
.gp-select-inline {
  padding: .3rem .5rem;
  font-size: .8125rem;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 6px;
  background: var(--card, #fff);
  color: var(--foreground, #111827);
  cursor: pointer;
  max-width: 130px;
}

/* ── Quick-actions grid ─────────────────────────────────────────────────── */
.gp-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .4rem;
}
.gp-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  padding: .6rem .25rem;
  font-size: .7rem;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  color: var(--foreground, #111827);
  background: var(--muted, #f3f4f6);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  line-height: 1.2;
  transition: background 0.12s, border-color 0.12s;
}
.gp-action-btn:hover {
  background: var(--primary-muted, #eff6ff);
  border-color: var(--primary, #2563eb);
  color: var(--primary, #2563eb);
  text-decoration: none;
}
.gp-action-icon {
  font-size: 1.1rem;
  line-height: 1;
}

/* ── Meta/info lines ────────────────────────────────────────────────────── */
.gp-meta {
  font-size: .75rem;
  color: var(--muted-fg, #6b7280);
  margin-bottom: .35rem;
  line-height: 1.5;
}

/* ════════════════════════════════════════════════════════════════════════════
   APPEARANCE OVERRIDES (applied via html[data-*] attributes)
   ════════════════════════════════════════════════════════════════════════════ */

/* Dark mode */
html[data-theme="dark"] {
  --foreground: #f9fafb;
  --background: #111827;
  --card:        #1f2937;
  --border:      #374151;
  --muted:       #1f2937;
  --muted-fg:    #9ca3af;
  --input:       #374151;
}
html[data-theme="dark"] body {
  background: var(--background, #111827);
  color: var(--foreground, #f9fafb);
}
html[data-theme="dark"] .card,
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .main-header,
html[data-theme="dark"] .gp-panel,
html[data-theme="dark"] .dropdown-content {
  background: var(--card, #1f2937);
  color: var(--foreground, #f9fafb);
}
html[data-theme="dark"] .sidebar-link,
html[data-theme="dark"] .nav-link {
  color: var(--foreground, #f9fafb);
}
html[data-theme="dark"] .sidebar-link:hover,
html[data-theme="dark"] .nav-link:hover {
  background: rgba(255,255,255,.07);
}
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: var(--input, #374151);
  color: var(--foreground, #f9fafb);
  border-color: var(--border, #4b5563);
}
html[data-theme="dark"] table thead tr {
  background: #374151;
}
html[data-theme="dark"] table tbody tr:hover {
  background: rgba(255,255,255,.04);
}
html[data-theme="dark"] .gp-action-btn {
  background: #374151;
  border-color: #4b5563;
  color: #f9fafb;
}
html[data-theme="dark"] .gp-action-btn:hover {
  background: #1e3a5f;
  border-color: #3b82f6;
  color: #93c5fd;
}

/* Compact layout */
html[data-layout="compact"] .page-content    { padding: .75rem; }
html[data-layout="compact"] .card            { padding: .75rem; }
html[data-layout="compact"] .stats-grid      { gap: .5rem; }
html[data-layout="compact"] .stat-card       { padding: .75rem; }
html[data-layout="compact"] .main-header     { padding: .5rem 1rem; }
html[data-layout="compact"] table td,
html[data-layout="compact"] table th         { padding: .4rem .6rem; }
html[data-layout="compact"] .sidebar-link    { padding: .45rem .875rem; }
html[data-layout="compact"] .btn             { padding: .3rem .7rem; font-size: .8125rem; }

/* Font sizes */
html[data-font="small"]  { font-size: 13px; }
html[data-font="normal"] { font-size: 15px; }
html[data-font="large"]  { font-size: 17px; }

/* Sidebar collapse */
body.gp-sidebar-collapsed .sidebar {
  width: 56px;
  overflow: hidden;
}
body.gp-sidebar-collapsed .sidebar .sidebar-logo span,
body.gp-sidebar-collapsed .sidebar .sidebar-label,
body.gp-sidebar-collapsed .sidebar .sidebar-section-title,
body.gp-sidebar-collapsed .sidebar .sidebar-link span:not(.sidebar-icon) {
  display: none !important;
}
body.gp-sidebar-collapsed .sidebar .sidebar-link {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}
body.gp-sidebar-collapsed .main-content {
  margin-left: 56px;
}

/* ── Responsive (mobile: full-width panel) ──────────────────────────────── */
@media (max-width: 480px) {
  .gp-panel { width: 100vw; }
}

/* ════════════════════════════════════════════════════════════════════════════
   MODERN UTILITIES — additive, opt-in. Existing classes are unchanged.
   ════════════════════════════════════════════════════════════════════════════ */

/* Universal accessible focus ring for interactive elements */
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
.btn:focus-visible,
.dropdown-item:focus-visible,
.tab-trigger:focus-visible {
  outline: none;
  box-shadow: var(--ring-shadow);
  border-radius: var(--radius);
}

/* Avatar */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-soft-fg);
  font-size: .8rem; font-weight: 700; letter-spacing: -.01em;
  overflow: hidden; flex-shrink: 0;
  border: 1px solid var(--border);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-sm { width: 28px; height: 28px; font-size: .7rem; }
.avatar-lg { width: 48px; height: 48px; font-size: .95rem; }
.avatar-xl { width: 72px; height: 72px; font-size: 1.4rem; }
.avatar-stack { display: inline-flex; }
.avatar-stack > .avatar { margin-left: -.5rem; box-shadow: 0 0 0 2px var(--card); }
.avatar-stack > .avatar:first-child { margin-left: 0; }

/* Keyboard hint */
.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.45rem; padding: 0 .35rem;
  height: 1.4rem;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: .72rem; color: var(--muted-fg);
  box-shadow: var(--shadow-xs);
}

/* Skeleton loader */
.skeleton {
  display: block;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg,
    rgba(15,23,42,.05) 0%,
    rgba(15,23,42,.10) 50%,
    rgba(15,23,42,.05) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s linear infinite;
}
.skeleton-line { height: .75rem; margin-bottom: .5rem; }
.skeleton-circle { border-radius: 50%; }
@keyframes skeleton-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* Section header (page-level) */
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; margin: 0 0 1rem;
  flex-wrap: wrap;
}
.section-title {
  font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; color: var(--foreground);
}
.section-subtitle { font-size: .82rem; color: var(--muted-fg); margin-top: .15rem; }
.section-actions { display: inline-flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* Toolbar (filter row above tables) */
.toolbar {
  display: flex; align-items: center; gap: .6rem;
  flex-wrap: wrap;
  padding: .85rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  margin-bottom: 1rem;
}
.toolbar > .toolbar-spacer { margin-left: auto; }
.toolbar input,
.toolbar select { height: 36px; padding-top: 0; padding-bottom: 0; }

/* Pagination */
.pagination {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.pagination button,
.pagination a {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px;
  padding: 0 .55rem;
  border: none; background: transparent; cursor: pointer;
  font-size: .8rem; font-weight: 600;
  color: var(--muted-fg);
  border-radius: var(--radius-sm);
  transition: var(--transition-base);
}
.pagination button:hover,
.pagination a:hover { background: var(--muted); color: var(--foreground); }
.pagination .active,
.pagination [aria-current="page"] { background: var(--primary); color: var(--primary-fg); }
.pagination [disabled], .pagination .disabled { opacity: .4; pointer-events: none; }

/* Filter chip */
.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .25rem .65rem .25rem .75rem;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-fg);
  font-size: .76rem; font-weight: 600;
  border: 1px solid rgba(99,102,241,.2);
  transition: var(--transition-base);
}
.chip-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: transparent; border: none; cursor: pointer;
  color: currentColor; font-size: .85rem; line-height: 1;
}
.chip-close:hover { background: rgba(15,23,42,.08); }

/* Divider */
.divider { height: 1px; width: 100%; background: var(--border); margin: 1rem 0; }
.divider-vertical { width: 1px; height: 100%; min-height: 1.25rem; background: var(--border); }

/* Empty state polish (additive — works alongside existing .empty-state) */
.empty-state-modern {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 3rem 1.5rem; text-align: center; gap: .75rem;
  background: var(--card);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
}
.empty-state-modern .empty-state-icon {
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 1.6rem;
}

/* Elevation helpers */
.elev-0 { box-shadow: none !important; }
.elev-1 { box-shadow: var(--shadow-xs) !important; }
.elev-2 { box-shadow: var(--shadow-sm) !important; }
.elev-3 { box-shadow: var(--shadow) !important; }
.elev-4 { box-shadow: var(--shadow-md) !important; }
.elev-5 { box-shadow: var(--shadow-lg) !important; }

/* Glass surface (use sparingly) */
.glass {
  background: rgba(255,255,255,.65);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
          backdrop-filter: saturate(180%) blur(14px);
  border: 1px solid rgba(255,255,255,.6);
}

/* Hover lift */
.hover-lift { transition: transform var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease); }
.hover-lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* Modern utility additions (these won't conflict with existing tokens) */
.text-muted-2 { color: rgba(91,100,120,.7); }
.rounded-md   { border-radius: var(--radius-md); }
.rounded-lg   { border-radius: var(--radius-lg); }
.rounded-xl   { border-radius: var(--radius-xl); }
.rounded-pill { border-radius: var(--radius-pill); }
.shadow-sm    { box-shadow: var(--shadow-sm); }
.shadow-md    { box-shadow: var(--shadow-md); }
.shadow-lg    { box-shadow: var(--shadow-lg); }

/* Mobile sidebar overlay (used by future toggle button) */
.sidebar-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.45);
  z-index: 38;
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-base) var(--ease);
}
body.sidebar-open .sidebar-backdrop {
  opacity: 1; pointer-events: auto;
}
@media (max-width: 768px) {
  body.sidebar-open .sidebar { transform: translateX(0); }
}

/* ════════════════════════════════════════════════════════════════════════════
   PHASE 3 — SHARED COMPONENTS (additive, opt-in)
   Forms · Tables · Modals · Tooltips
   ════════════════════════════════════════════════════════════════════════════ */

/* ─── Forms: input sizes ─────────────────────────────────── */
.form-control.sm,
.input.sm,
input.sm, select.sm, textarea.sm { padding: .35rem .65rem; font-size: .8rem; }

.form-control.lg,
.input.lg,
input.lg, select.lg, textarea.lg { padding: .7rem 1rem; font-size: .95rem; }

/* ─── Forms: input groups (prefix / suffix) ──────────────── */
.input-group {
  display: flex;
  width: 100%;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
  transition: var(--transition-base);
  box-shadow: 0 1px 0 rgba(15,23,42,.02);
}
.input-group:hover { border-color: var(--border-strong); }
.input-group:focus-within {
  border-color: var(--ring);
  box-shadow: var(--ring-shadow);
}
.input-group > input,
.input-group > select,
.input-group > textarea {
  flex: 1;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
  min-width: 0;
}
.input-group > input:focus,
.input-group > select:focus,
.input-group > textarea:focus {
  box-shadow: none;
  border: none;
}
.input-addon {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 .8rem;
  background: var(--muted);
  color: var(--muted-fg);
  font-size: .82rem; font-weight: 500;
  white-space: nowrap;
  border-right: 1px solid var(--border);
}
.input-group > .input-addon:last-child {
  border-right: none;
  border-left: 1px solid var(--border);
}

/* ─── Forms: validation states ────────────────────────────── */
.form-group.has-success input,
.form-group.has-success select,
.form-group.has-success textarea,
input.is-success, select.is-success, textarea.is-success { border-color: var(--success); }
.form-group.has-success input:focus,
.form-group.has-success select:focus,
.form-group.has-success textarea:focus,
input.is-success:focus, select.is-success:focus, textarea.is-success:focus {
  box-shadow: 0 0 0 4px rgba(16,185,129,.18);
}
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea,
input.is-error, select.is-error, textarea.is-error { border-color: var(--destructive); }
.form-group.has-error input:focus,
.form-group.has-error select:focus,
.form-group.has-error textarea:focus,
input.is-error:focus, select.is-error:focus, textarea.is-error:focus {
  box-shadow: 0 0 0 4px rgba(239,68,68,.18);
}
.form-message {
  display: inline-flex; align-items: center; gap: .35rem;
  margin-top: .35rem;
  font-size: .76rem; font-weight: 500;
}
.form-message.success { color: var(--success-fg); }
.form-message.error   { color: #991b1b; }
.form-message.warning { color: var(--warning-fg); }
.form-message::before {
  content: "•";
  font-weight: 900; font-size: 1rem; line-height: 1;
}
.form-message.success::before { content: "✓"; }
.form-message.error::before   { content: "!"; }
.form-message.warning::before { content: "!"; }

/* ─── Forms: switch (toggle) ──────────────────────────────── */
.switch {
  position: relative; display: inline-block;
  width: 36px; height: 20px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--muted); border: 1px solid var(--border);
  transition: var(--transition-base);
  border-radius: 9999px;
}
.switch-slider::before {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  left: 2px; top: 50%; transform: translateY(-50%);
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-base);
}
.switch input:checked + .switch-slider {
  background: var(--primary);
  border-color: var(--primary);
}
.switch input:checked + .switch-slider::before {
  transform: translate(16px, -50%);
}
.switch input:focus-visible + .switch-slider {
  box-shadow: var(--ring-shadow);
}
.switch input:disabled + .switch-slider { opacity: .5; cursor: not-allowed; }

.switch-row {
  display: inline-flex; align-items: center; gap: .55rem;
  cursor: pointer;
  font-size: .85rem;
}

/* ─── Forms: segmented control ────────────────────────────── */
.segmented {
  display: inline-flex;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
}
.segmented > * {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .4rem .85rem;
  font-size: .82rem; font-weight: 600;
  color: var(--muted-fg);
  background: transparent;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: var(--transition-base);
  text-decoration: none;
}
.segmented > *:hover { color: var(--foreground); }
.segmented > .active,
.segmented > [aria-selected="true"],
.segmented > input[type="radio"]:checked + label {
  background: var(--card);
  color: var(--primary-soft-fg);
  box-shadow: var(--shadow-sm);
}

/* ─── Forms: file input ──────────────────────────────────── */
.file-input {
  display: inline-flex; align-items: center; gap: .65rem;
  padding: .45rem .55rem .45rem .85rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--card);
  font-size: .82rem;
  color: var(--muted-fg);
  cursor: pointer;
  transition: var(--transition-base);
}
.file-input:hover { border-color: var(--primary); color: var(--primary-soft-fg); background: var(--accent); }
.file-input input[type="file"] { display: none; }
.file-input-button {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .7rem;
  background: var(--primary);
  color: #fff;
  border-radius: calc(var(--radius) - 2px);
  font-size: .76rem; font-weight: 600;
}

/* ─── Forms: fieldset / section ──────────────────────────── */
.form-section {
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr;
  gap: 1.5rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}
.form-section:last-of-type { border-bottom: none; }
.form-section-title {
  font-size: .9rem; font-weight: 600; letter-spacing: -.005em;
  color: var(--foreground);
}
.form-section-desc {
  font-size: .78rem; color: var(--muted-fg); margin-top: .2rem; line-height: 1.5;
}
.form-section-body { display: flex; flex-direction: column; gap: 1rem; }
@media (max-width: 768px) {
  .form-section { grid-template-columns: 1fr; gap: .75rem; }
}

/* Two-column form rows */
.form-row {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, 1fr);
}
.form-row-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) {
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

/* ═════════════════════════════════════════════════════════════
   TABLES — sortable headers, density, row selection, zebra
   ═════════════════════════════════════════════════════════════ */

.table-density-comfortable th { padding-top: .9rem; padding-bottom: .9rem; }
.table-density-comfortable td { padding-top: 1.05rem; padding-bottom: 1.05rem; }
.table-density-compact th     { padding-top: .45rem; padding-bottom: .45rem; }
.table-density-compact td     { padding-top: .55rem; padding-bottom: .55rem; font-size: .82rem; }

/* Zebra rows */
.table-zebra tbody tr:nth-child(even) td { background: rgba(15,23,42,.02); }
.table-zebra tbody tr:hover td             { background: rgba(99,102,241,.06); }

/* Sortable header */
th.sortable, .sortable th {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 1.5rem;
}
th.sortable::after {
  content: "";
  position: absolute;
  right: .65rem; top: 50%;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 5px solid currentColor;
  opacity: .25;
  transform: translateY(calc(-50% - 4px));
  transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease);
}
th.sortable.sorted-asc::after  { opacity: 1; transform: translateY(-50%); }
th.sortable.sorted-desc::after { opacity: 1; transform: translateY(-50%) rotate(180deg); }

/* Row selection */
tr.is-selected td { background: var(--primary-soft) !important; }
tr.is-selected td:first-child { box-shadow: inset 3px 0 0 var(--primary); }

/* Empty / loading body row */
.table-empty td,
.table-loading td {
  text-align: center;
  padding: 2.5rem 1rem !important;
  color: var(--muted-fg);
  font-size: .85rem;
}

/* Row click hint (interactive) */
tr.row-clickable { cursor: pointer; }
tr.row-clickable:hover td { background: rgba(99,102,241,.06); }

/* Action cell — usually the last column */
td.actions, .col-actions {
  text-align: right;
  white-space: nowrap;
}
td.actions .btn,
.col-actions .btn { padding: .3rem .55rem; font-size: .78rem; }

/* Checkbox column */
.col-check { width: 36px; padding-left: .85rem !important; padding-right: 0 !important; }

/* Table caption / above-table toolbar */
.table-caption {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.table-caption-title { font-size: .9rem; font-weight: 600; }
.table-caption-meta  { font-size: .76rem; color: var(--muted-fg); }

/* ═════════════════════════════════════════════════════════════
   MODALS / DIALOGS — sizes + drawer + confirm pattern
   ═════════════════════════════════════════════════════════════ */

.dialog.dialog-sm  { max-width: 380px; }
.dialog.dialog-md  { max-width: 520px; }
.dialog.dialog-lg  { max-width: 720px; }
.dialog.dialog-xl  { max-width: 960px; }
.modal.modal-sm    { max-width: 380px; }
.modal.modal-md    { max-width: 560px; }
.modal.modal-lg    { max-width: 760px; }
.modal.modal-xl    { max-width: 1024px; }

/* Destructive dialog header */
.dialog-destructive .dialog-header,
.modal-destructive .modal-header {
  background: var(--destructive-soft);
  color: #991b1b;
  border-color: rgba(239,68,68,.22);
}
.dialog-destructive .dialog-title,
.modal-destructive .modal-title {
  color: #991b1b;
}

/* Side drawer */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.45);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  z-index: 1100;
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-base) var(--ease);
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(520px, 92vw);
  background: var(--card);
  border-left: 1px solid var(--border);
  box-shadow: -16px 0 40px -12px rgba(15,23,42,.20);
  z-index: 1101;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--t-slow) var(--ease);
}
.drawer.open { transform: translateX(0); }
.drawer-left {
  right: auto; left: 0;
  border-left: none;
  border-right: 1px solid var(--border);
  box-shadow: 16px 0 40px -12px rgba(15,23,42,.20);
  transform: translateX(-100%);
}
.drawer-left.open { transform: translateX(0); }
.drawer-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem;
}
.drawer-title  { font-size: 1rem; font-weight: 600; letter-spacing: -.005em; }
.drawer-body   { padding: 1.25rem; overflow-y: auto; flex: 1; }
.drawer-footer {
  padding: .85rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex; gap: .5rem; justify-content: flex-end;
  background: var(--muted);
}

/* ═════════════════════════════════════════════════════════════
   TOOLTIPS — CSS-only, via [data-tooltip]
   ═════════════════════════════════════════════════════════════ */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%; top: calc(100% + 6px);
  transform: translateX(-50%) translateY(2px);
  background: #0b1020;
  color: #fff;
  font-size: .72rem; font-weight: 500;
  padding: .35rem .55rem;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  z-index: 10000;
  box-shadow: 0 8px 16px -4px rgba(0,0,0,.4);
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
[data-tooltip-pos="top"]::after    { top: auto; bottom: calc(100% + 6px); transform: translateX(-50%) translateY(-2px); }
[data-tooltip-pos="top"]:hover::after,
[data-tooltip-pos="top"]:focus-visible::after { transform: translateX(-50%) translateY(0); }
[data-tooltip-pos="left"]::after   { top: 50%; left: auto; right: calc(100% + 6px); transform: translateY(-50%) translateX(-2px); }
[data-tooltip-pos="left"]:hover::after,
[data-tooltip-pos="left"]:focus-visible::after { transform: translateY(-50%) translateX(0); }
[data-tooltip-pos="right"]::after  { top: 50%; left: calc(100% + 6px); transform: translateY(-50%) translateX(2px); }
[data-tooltip-pos="right"]:hover::after,
[data-tooltip-pos="right"]:focus-visible::after { transform: translateY(-50%) translateX(0); }

/* ═════════════════════════════════════════════════════════════
   POPOVER (light wrapper — show/hide via [aria-expanded])
   ═════════════════════════════════════════════════════════════ */
.popover {
  position: absolute;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: .85rem 1rem;
  font-size: .85rem;
  z-index: 200;
  min-width: 240px;
  max-width: 360px;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease);
}
.popover.open,
[aria-expanded="true"] + .popover {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Divider with centered label */
.divider-with-label {
  display: flex; align-items: center; gap: .75rem;
  margin: 1.25rem 0;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 700;
  color: var(--muted-fg);
}
.divider-with-label::before,
.divider-with-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ═════════════════════════════════════════════════════════════
   LOADING / SPINNER POLISH
   ═════════════════════════════════════════════════════════════ */
.spinner-lg { width: 1.5rem; height: 1.5rem; border-width: 3px; }
.spinner-primary { border-color: rgba(99,102,241,.25); border-top-color: var(--primary); }
.spinner-success { border-color: rgba(16,185,129,.25); border-top-color: var(--success); }

.is-loading {
  position: relative;
  pointer-events: none;
  color: transparent !important;
}
.is-loading::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 16px; height: 16px;
  margin-left: -8px; margin-top: -8px;
  border: 2px solid currentColor;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin .6s linear infinite;
  color: var(--muted-fg);
}
.btn.is-loading::after { color: currentColor; }

/* ═════════════════════════════════════════════════════════════
   STATUS DOTS (inline status indicator)
   ═════════════════════════════════════════════════════════════ */
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted-fg);
  margin-right: .35rem;
  vertical-align: middle;
}
.status-dot.success { background: var(--success); box-shadow: 0 0 0 3px rgba(16,185,129,.18); }
.status-dot.warning { background: var(--warning); box-shadow: 0 0 0 3px rgba(245,158,11,.20); }
.status-dot.danger  { background: var(--destructive); box-shadow: 0 0 0 3px rgba(239,68,68,.18); }
.status-dot.info    { background: var(--info); box-shadow: 0 0 0 3px rgba(14,165,233,.18); }
.status-dot.pulse   { animation: pulse 2s infinite; }
