/* =====================================================================
 * ATLAS HRMS — admin shell (loaded AFTER atlas-theme.css).
 *
 * Clean green shell, matching the employee portal (emp-portal.css): a white
 * LEFT SIDEBAR with the green ATLAS HR word-mark, grouped nav with a green
 * active pill, the user + sign-out pinned at the bottom, a slim white top bar
 * and a soft blue-grey ground with rounded, shadowed cards. The theme's slate
 * sidebar rules are overridden here; higher specificity + later load order
 * beats the theme's !important on .main-content.
 *
 * Palette tokens are shared with the portal (--emp-*), declared in
 * emp-portal.css which head.ejs loads on every page.
 * ===================================================================== */

/* ---- Shell ground ---- */
.app-container { background: var(--emp-ground, #eef2fb); color: var(--emp-ink, #2b2f42); }
.app-container .main-content { padding: 0 !important; background: var(--emp-ground, #eef2fb) !important; display: flex; flex-direction: column; }

/* ---- Sidebar (white) ---- */
.app-container .sidebar {
  width: 262px; background: #fff; color: var(--emp-ink, #2b2f42);
  border-right: 1px solid var(--emp-line, #eaedf5);
  box-shadow: none;
}
.app-container .sidebar.open { box-shadow: 0 0 40px rgba(0,0,0,0.25); }
.app-container .sidebar-header { padding: 16px 18px; gap: 10px; border-bottom: 1px solid var(--emp-line, #eaedf5); }
.app-container .sidebar-header .brand-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-decoration: none; border-radius: 9px; }
.app-container .sidebar-header .brand-link:hover, .app-container .sidebar-header .brand-link:focus { text-decoration: none; }
.app-container .sidebar-header .brand-link:hover .brand-word .n { color: var(--emp-teal-d, #0e9e6e); }
.app-container .sidebar-header .brand-mark { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; }
.app-container .sidebar-header .brand-word { flex: 1; font-size: 1.2rem; font-weight: 800; letter-spacing: 0.04em; white-space: nowrap; }
.app-container .sidebar-header .brand-word .g { color: var(--emp-teal-d, #0e9e6e); }
.app-container .sidebar-header .brand-word .n { color: var(--emp-navy, #2b2a6b); }
.app-container .sidebar-close { color: var(--emp-muted, #8890a6); }
.app-container .sidebar-close:hover { color: var(--emp-navy, #2b2a6b); }

.app-container .sidebar-nav { padding: 12px 10px; }
.app-container .nav-section { margin-bottom: 12px; }
.app-container .nav-section-title {
  padding: 6px 12px; font-size: 0.64rem; letter-spacing: 0.09em;
  color: var(--emp-muted, #8890a6); font-weight: 700;
}
.app-container .nav-tab {
  gap: 11px; padding: 9px 12px; margin: 1px 0; border-radius: 10px;
  color: var(--emp-ink, #2b2f42); font-size: 0.875rem; font-weight: 500;
}
.app-container .nav-tab svg { color: var(--emp-muted, #8890a6); }
.app-container .nav-tab:hover { background: var(--emp-ground, #eef2fb); color: var(--emp-ink, #2b2f42); }
.app-container .nav-tab.active {
  background: rgba(18,185,129,0.12); color: var(--emp-teal-d, #0e9e6e); font-weight: 600;
  border-radius: 10px; margin-right: 0;
  box-shadow: inset 3px 0 0 var(--emp-teal, #12b981);
}
.app-container .nav-tab.active svg { color: var(--emp-teal-d, #0e9e6e); }

.app-container .sidebar-footer { border-top: 1px solid var(--emp-line, #eaedf5); padding: 12px; }
.app-container .sidebar-user { gap: 10px; }
.app-container .sidebar-user-avatar {
  width: 38px; height: 38px; background: var(--emp-teal, #12b981);
  box-shadow: none; font-size: 0.85rem;
}
.app-container .sidebar-user-info { min-width: 0; }
.app-container .sidebar-user-name { font-size: 0.85rem; font-weight: 700; color: var(--emp-navy, #2b2a6b); }
.app-container .sidebar-user-role {
  display: block; background: none; color: var(--emp-muted, #8890a6);
  font-size: 0.7rem; font-weight: 500; padding: 0; margin-top: 0;
  text-transform: capitalize; border-radius: 0;
}
.app-container .sidebar-user form { margin: 0; }
.app-container .sidebar-signout {
  background: none; border: none; color: var(--emp-muted, #8890a6);
  cursor: pointer; padding: 6px; border-radius: 8px; display: flex;
}
.app-container .sidebar-signout:hover { color: #e05a5a; background: var(--emp-ground, #eef2fb); }

/* ---- Top bar (slim, white) ---- */
.app-container .main-header {
  height: 60px; padding: 0 22px; gap: 12px; justify-content: flex-start;
  border-bottom: 1px solid var(--emp-line, #eaedf5);
}
.app-container .hamburger-btn { display: flex; border: 1.5px solid var(--emp-ink, #2b2f42); padding: 4px; color: var(--emp-ink, #2b2f42); border-radius: 8px; }
.app-container .hamburger-btn:hover { background: var(--emp-ground, #eef2fb); color: var(--emp-navy, #2b2a6b); }
.app-container .hamburger-btn svg { width: 20px; height: 20px; }
/* Button shows ☰ while the menu is hidden / folded and ✕ while it is open (like the CRM). */
.app-container .hamburger-btn .ico-close { display: none; }
.app-container .hamburger-btn[aria-expanded="true"] .ico-menu { display: none; }
.app-container .hamburger-btn[aria-expanded="true"] .ico-close { display: block; }
.app-container .header-brand {
  display: none; align-items: center; gap: 8px; font-weight: 800;
  color: var(--emp-navy, #2b2a6b); letter-spacing: 0.04em; white-space: nowrap;
}
.app-container .header-brand img { width: 28px; height: 28px; border-radius: 7px; }
.app-container .header-left { min-width: 0; }
.app-container .header-left h1 {
  font-size: 1rem; font-weight: 700; color: var(--emp-navy, #2b2a6b); margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-container .header-left p { margin: 0; font-size: 0.72rem; color: var(--emp-muted, #8890a6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.app-container .header-right { margin-left: auto; }
.app-container .header-user { padding: 0; gap: 12px; cursor: default; }
.app-container .header-user:hover { background: none; }
.app-container .header-user-name { display: block; font-size: 0.85rem; color: var(--emp-ink, #2b2f42); }
.app-container .header-user-avatar {
  width: 38px; height: 38px; background: var(--emp-teal, #12b981);
  box-shadow: none; font-size: 0.85rem;
}

/* ---- Page area ---- */
.app-container .page-content { max-width: 1200px; margin: 0 auto; padding: 22px 22px 48px; flex: 1; }

/* Cards in the admin shell take the portal's soft, borderless look. */
.app-container .card, .app-container .stat-card {
  border: none; border-radius: 16px; box-shadow: 0 8px 24px rgba(20,25,60,0.06);
}
.app-container .stat-card:hover { box-shadow: 0 14px 28px rgba(20,25,60,0.12); }
.app-container .card-header { border-bottom: 1px solid var(--emp-line, #eaedf5); }
.app-container .card-title { color: var(--emp-navy, #2b2a6b); font-weight: 700; }
.app-container .stat-value { color: var(--emp-navy, #2b2a6b); }
.app-container .stat-icon { border-radius: 12px; }
/* Side-by-side cards in a grid must not inherit the stacked-card gap. */
.app-container .grid > .card + .card { margin-top: 0; }

/* ---- Responsive: sidebar pinned on wide screens, off-canvas below ---- */
@media (min-width: 1024px) {
  .app-container .sidebar { transform: none; transition: width var(--transition-normal); }
  .app-container .main-content { margin-left: 262px !important; transition: margin-left var(--transition-normal); }
  .sidebar-overlay { display: none !important; }
  .app-container .header-brand, .app-container .sidebar-close { display: none; }

  /* Collapsed icon rail — toggled by the menu button, remembered in localStorage. */
  html.nav-collapsed .app-container .sidebar { width: 60px; }
  html.nav-collapsed .app-container .main-content { margin-left: 60px !important; }
  html.nav-collapsed .app-container .sidebar-header { padding: 16px 0; justify-content: center; }
  html.nav-collapsed .app-container .sidebar-header .brand-word { display: none; }
  html.nav-collapsed .app-container .sidebar-header .brand-link { flex: 0 0 auto; justify-content: center; }
  html.nav-collapsed .app-container .sidebar-nav { padding: 12px 8px; }
  html.nav-collapsed .app-container .nav-section { margin-bottom: 6px; }
  html.nav-collapsed .app-container .nav-section-title { font-size: 0; padding: 0; margin: 6px 10px 8px; border-top: 1px solid var(--emp-line, #eaedf5); }
  html.nav-collapsed .app-container .nav-section:first-child .nav-section-title { border-top: 0; margin: 0 0 4px; }
  html.nav-collapsed .app-container .nav-tab { justify-content: center; padding: 11px 0; gap: 0; position: relative; }
  html.nav-collapsed .app-container .nav-tab > span:not(.nav-dot) { display: none; }
  html.nav-collapsed .app-container .nav-tab .nav-dot { position: absolute; top: 7px; right: 11px; margin: 0; }
  html.nav-collapsed .app-container .nav-tab.active { box-shadow: none; background: var(--emp-teal, #12b981); color: #fff; }
  html.nav-collapsed .app-container .nav-tab.active svg { color: #fff; }
  html.nav-collapsed .app-container .nav-tab { width: 44px; height: 44px; margin: 2px auto; padding: 0; }
  html.nav-collapsed .app-container .sidebar-nav { padding: 12px 0; }
  html.nav-collapsed .app-container .sidebar-footer { padding: 12px 8px; }
  html.nav-collapsed .app-container .sidebar-user { flex-direction: column; gap: 8px; }
  html.nav-collapsed .app-container .sidebar-user-info { display: none; }
}
@media (max-width: 1023px) {
  .app-container .hamburger-btn { display: flex; }
  .app-container .header-brand { display: flex; }
}
@media (max-width: 640px) {
  .app-container .header-left { display: none; }
  .app-container .header-user-name { display: none; }
  .app-container .page-content { padding: 16px 16px 40px; }
}
/* Small helpers for spacing rhythm used by the pages. */
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.section-title { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); margin: 0 0 8px; }

/* =====================================================================
 * Module Structure & Build Order — System Map, nav status dots, detail page.
 * ===================================================================== */

/* Sidebar build-status dot next to a nav label. */
.nav-tab .nav-dot { width: 7px; height: 7px; border-radius: 50%; margin-left: auto; flex-shrink: 0; }
.nav-dot-partial { background: var(--accent-warning); }
.nav-dot-planned { background: var(--text-sidebar-muted); box-shadow: inset 0 0 0 1.5px var(--text-sidebar-muted); background: transparent; }

/* Status pill (built / partial / planned), reused on map + detail. */
.mstatus { display: inline-flex; align-items: center; gap: 6px; font-size: 0.7rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
.mstatus::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.mstatus-built { color: var(--accent-primary); background: rgba(16, 185, 129, 0.12); }
.mstatus-partial { color: var(--accent-warning); background: rgba(245, 158, 11, 0.12); }
.mstatus-planned { color: var(--text-muted); background: var(--bg-tertiary); }

/* Layer block header. */
.layer-head { display: flex; align-items: baseline; gap: 12px; margin: 26px 0 12px; flex-wrap: wrap; }
.layer-badge { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700; color: var(--accent-primary); background: rgba(16, 185, 129, 0.1); border-radius: var(--radius-sm); padding: 3px 8px; }
.layer-head h2 { font-size: 1.05rem; margin: 0; }
.layer-head .layer-tag { color: var(--text-secondary); font-size: 0.82rem; }
.layer-head .layer-screens { margin-left: auto; color: var(--text-muted); font-size: 0.75rem; }

/* Module grid + card. */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.module-card { display: block; border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 14px; background: var(--bg-secondary); transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast); }
a.module-card:hover { border-color: var(--accent-primary); box-shadow: var(--shadow-sm); transform: translateY(-1px); text-decoration: none; }
.module-card .mc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.module-card .mc-code { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700; color: var(--text-muted); }
.module-card .mc-name { font-weight: 600; color: var(--text-primary); line-height: 1.25; margin: 0 0 6px; }
.module-card .mc-purpose { color: var(--text-secondary); font-size: 0.82rem; margin: 0 0 10px; }
.module-card .mc-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 0.72rem; color: var(--text-muted); }
.module-card .mc-meta b { color: var(--text-secondary); font-weight: 600; }

/* Mobile parity chip. */
.mobile-chip { font-size: 0.68rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border-color); }
.mobile-Full { color: var(--accent-primary); border-color: rgba(16,185,129,0.4); }
.mobile-Partial { color: var(--accent-secondary); border-color: var(--border-color); }
.mobile-None { color: var(--text-muted); }

/* Build-order timeline (stages). */
.stage-row { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--border-light); }
.stage-row:first-child { border-top: 0; }
.stage-key { flex-shrink: 0; width: 116px; }
.stage-key .sk-id { font-family: var(--font-mono); font-weight: 700; color: var(--accent-primary); }
.stage-key .sk-weeks { display: block; font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.stage-body h3 { margin: 0 0 4px; font-size: 0.95rem; }
.stage-body .stage-mods { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.stage-body .stage-exit { color: var(--text-secondary); font-size: 0.82rem; margin: 6px 0 0; }
.mtag { font-family: var(--font-mono); font-size: 0.7rem; font-weight: 600; padding: 2px 7px; border-radius: var(--radius-sm); border: 1px solid var(--border-color); color: var(--text-secondary); background: var(--bg-primary); }
.mtag.is-built { border-color: rgba(16,185,129,0.4); color: var(--accent-primary); }
.mtag.is-partial { border-color: rgba(245,158,11,0.4); color: var(--accent-warning); }

/* Progress meter on the System Map header. */
.progress-track { height: 8px; border-radius: 999px; background: var(--bg-tertiary); overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent-primary); border-radius: 999px; }

/* Module detail: screen list. */
.screen-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.screen-list li { display: flex; align-items: flex-start; gap: 8px; font-size: 0.85rem; color: var(--text-primary); padding: 8px 10px; border: 1px solid var(--border-light); border-radius: var(--radius-sm); background: var(--bg-primary); }
.screen-list li::before { content: ''; margin-top: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-primary); flex-shrink: 0; }
.kv-row { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border-light); font-size: 0.85rem; }
.kv-row:first-child { border-top: 0; }
.kv-row .kv-k { width: 130px; flex-shrink: 0; color: var(--text-muted); }
.dep-links { display: flex; flex-wrap: wrap; gap: 6px; }

/* =====================================================================
 * Compact density (admin shell) — dense, CRM-style spacing on every screen:
 * full-width page, tight cards, dense tables, small controls, slim chrome.
 * ===================================================================== */
.app-container .page-content { max-width: none; padding: 12px 16px 28px; }
.app-container .main-header { height: 48px; padding: 0 14px; }
.app-container .header-left h1 { font-size: 0.95rem; }
.app-container .header-user-avatar { width: 30px; height: 30px; font-size: 0.72rem; }
.app-container .header-user-name { font-size: 0.78rem; }

.app-container .sidebar { width: 232px; }
@media (min-width: 1024px) { .app-container .main-content { margin-left: 232px !important; } }
.app-container .sidebar-header { padding: 10px 14px; }
.app-container .sidebar-header .brand-mark { width: 28px; height: 28px; }
.app-container .sidebar-header .brand-word { font-size: 1.02rem; }
.app-container .sidebar-nav { padding: 6px 8px; }
.app-container .nav-section { margin-bottom: 6px; }
.app-container .nav-section-title { padding: 6px 10px 2px; font-size: 0.6rem; }
.app-container .nav-tab { padding: 5px 10px; font-size: 0.8rem; gap: 9px; border-radius: 8px; }
.app-container .nav-tab svg { width: 15px; height: 15px; }
.app-container .sidebar-footer { padding: 8px; }
.app-container .sidebar-user-avatar { width: 30px; height: 30px; font-size: 0.7rem; }
.app-container .sidebar-user-name { font-size: 0.78rem; }
.app-container .sidebar-user-role { font-size: 0.62rem; }

.app-container .card, .app-container .stat-card { border-radius: 10px; box-shadow: 0 1px 2px rgba(20,25,60,0.06), 0 0 0 1px rgba(20,25,60,0.04); }
.app-container .card:not(:has(> .card-header)):not(:has(> .card-body)) { padding: 10px 12px; }
.app-container .card-header { padding: 8px 12px; }
.app-container .card-title { font-size: 0.86rem; }
.app-container .card-body { padding: 10px 12px; }
.app-container .card + .card { margin-top: 10px; }
.app-container .mb-16 { margin-bottom: 10px; }
.app-container .mt-16 { margin-top: 10px; }
.app-container .grid { gap: 10px; }
.app-container .page-content > p.muted:first-child { margin: 0 0 8px; font-size: 0.76rem; }
.app-container p { margin: 0 0 6px; }
.app-container h3 { font-size: 0.9rem; margin: 0 0 4px; }

.app-container .stats-row { gap: 10px; margin-bottom: 10px; }
.app-container .stat-card { padding: 10px 12px; gap: 10px; align-items: center; }
.app-container .stat-icon { width: 34px; height: 34px; border-radius: 9px; }
.app-container .stat-icon svg { width: 17px; height: 17px; }
.app-container .stat-value { font-size: 1.15rem; line-height: 1.1; }
.app-container .stat-label { font-size: 0.66rem; margin-top: 1px; }

.app-container table { font-size: 0.8rem; }
.app-container th, .app-container .data-table th { padding: 6px 10px; font-size: 0.64rem; letter-spacing: 0.04em; }
.app-container td, .app-container .data-table td { padding: 5px 10px; font-size: 0.8rem; line-height: 1.35; }
.app-container tbody tr:hover td { background: #f7f9fd; }
.app-container .card > table { width: calc(100% + 24px); margin: -10px -12px; }
.app-container .card > table + * { margin-top: 16px; }
.app-container .card > table:last-child { margin-bottom: -10px; }

.app-container .btn { padding: 5px 10px; font-size: 0.78rem; gap: 6px; border-radius: 7px; line-height: 1.3; }
.app-container .btn-sm { padding: 3px 7px; font-size: 0.72rem; }
.app-container .btn-icon { padding: 4px; width: 26px; height: 26px; justify-content: center; }
.app-container .btn-icon svg { width: 14px; height: 14px; }
.app-container .btn svg { width: 14px; height: 14px; }
.app-container .badge { font-size: 0.64rem; padding: 2px 7px; }

.app-container .form-group { margin-bottom: 8px; }
.app-container .form-label, .app-container .label { font-size: 0.66rem; margin-bottom: 3px; }
.app-container .form-input, .app-container .form-select, .app-container .form-textarea,
.app-container .input, .app-container select.input, .app-container textarea.input { padding: 5px 9px; font-size: 0.8rem; border-radius: 7px; }
.app-container textarea.input, .app-container .form-textarea { min-height: 64px; }

/* Row action icon buttons. */
/* ---- Employee Master grid (CRM-style) ---- */
.table-scroll { overflow-x: auto; }
.staff-grid { display: table; }
.staff-grid th, .staff-grid td { white-space: nowrap; }
.staff-grid td.nowrap { white-space: nowrap; }
.user-cell { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.user-cell:hover strong { color: var(--emp-teal-d, #0e9e6e); }
.user-avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.66rem; font-weight: 700; flex-shrink: 0; }
.user-avatar[data-hue="0"] { background: #e0f2fe; color: #0369a1; }
.user-avatar[data-hue="1"] { background: #fef3c7; color: #b45309; }
.user-avatar[data-hue="2"] { background: #dcfce7; color: #15803d; }
.user-avatar[data-hue="3"] { background: #fce7f3; color: #be185d; }
.user-avatar[data-hue="4"] { background: #ede9fe; color: #6d28d9; }
.user-avatar[data-hue="5"] { background: #ffedd5; color: #c2410c; }
.user-meta { display: inline-flex; flex-direction: column; line-height: 1.2; }
.user-meta strong { font-size: 0.82rem; color: var(--emp-navy, #2b2a6b); }
.user-meta small { font-size: 0.68rem; color: var(--emp-muted, #8890a6); }
.chip { display: inline-block; font-size: 0.66rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; margin: 1px 4px 1px 0; white-space: nowrap; }
.chip-role { background: #e0ecff; color: #1d4ed8; }
.chip-team { background: var(--emp-ground, #eef2fb); color: var(--emp-ink, #2b2f42); }
.chip-access { background: #dcfce7; color: #15803d; }
.att { display: inline-block; font-size: 0.66rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.att-ok { background: #dcfce7; color: #15803d; }
.att-off { background: #fee2e2; color: #b91c1c; }
.att-leave { background: #ffedd5; color: #c2410c; }
.att-warn { background: #fef3c7; color: #b45309; }
.att-muted { background: var(--emp-ground, #eef2fb); color: var(--emp-muted, #8890a6); }
.att-legend { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.7rem; color: var(--emp-muted, #8890a6); align-items: center; }
.att-legend-item { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; color: inherit; text-decoration: none; padding: 2px 8px; border-radius: 999px; border: 1px solid transparent; }
a.att-legend-item:hover { border-color: var(--emp-line, #eaedf5); background: var(--emp-ground, #f6f8fc); }
.att-legend-item.is-active { border-color: var(--accent-primary, #10b981); background: rgba(16,185,129,0.10); color: var(--text-primary, #1f2937); font-weight: 600; }
.att-legend-clear { color: var(--accent-danger, #dc2626); }
.row-actions .btn-icon.ok { color: var(--emp-teal-d, #0e9e6e); }
.row-actions .btn-icon.ok:hover { color: #b91c1c; background: rgba(224,90,90,0.08); }

.row-actions { display: inline-flex; gap: 4px; align-items: center; flex-wrap: nowrap; white-space: nowrap; }
.row-actions form { margin: 0; display: inline-flex; gap: 4px; align-items: center; }
/* The action cell is never squeezed: it takes its own width and stays pinned
   to the right edge while the rest of the table scrolls inside
   .table-responsive / .table-scroll. */
.app-container td:has(> .row-actions) { width: 1%; white-space: nowrap; }
.app-container .table-responsive td:has(> .row-actions),
.app-container .table-responsive table:has(td > .row-actions) th:last-child {
  position: sticky; right: 0; z-index: 1; background: #fff; box-shadow: -8px 0 8px -8px rgba(15, 23, 42, 0.25);
}
.app-container .table-responsive table:has(td > .row-actions) th:last-child { background: var(--bg-tertiary, #f6f8fc); z-index: 11; }
.app-container .table-responsive tr:hover td:has(> .row-actions) { background: var(--bg-tertiary, #f8fafc); }
.row-actions .btn-icon { color: var(--emp-muted, #8890a6); background: transparent; border: 1px solid transparent; }
.row-actions .btn-icon:hover { color: var(--emp-navy, #2b2a6b); background: var(--emp-ground, #eef2fb); border-color: var(--emp-line, #eaedf5); }
.row-actions .btn-icon.danger:hover { color: #e05a5a; background: rgba(224,90,90,0.08); }
.row-actions .btn-icon.primary { color: var(--emp-teal-d, #0e9e6e); }
.row-actions select { height: 26px; padding: 0 6px; font-size: 0.72rem; width: auto; }

/* Collapsible "Add …" panels: closed by default, opened by their header toggle
   or a toolbar button (atlasToggleCard). */
.card.is-collapsed > .card-body { display: none; }
.card.is-collapsed > .card-header { border-bottom: 0; }
.card-toggle { margin-left: auto; }

/* Toolbar row above a list: count · filters · primary action. */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar form { display: flex; align-items: center; gap: 8px; margin: 0; flex-wrap: wrap; }
.toolbar .toolbar-count { font-size: 0.78rem; color: var(--emp-muted, #8890a6); margin-right: 4px; white-space: nowrap; }
.toolbar .toolbar-count b { color: var(--emp-navy, #2b2a6b); }
.toolbar .toolbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.toolbar .input, .toolbar .form-input, .toolbar .form-select, .toolbar select.input { width: auto; min-width: 150px; }
.toolbar .search { min-width: 240px; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 0.76rem; color: var(--emp-muted, #8890a6); }
.pager span { display: flex; gap: 6px; }

/* ---- Left menu: no hover underline; section headings as green labels ---- */
.app-container .nav-tab:hover, .app-container .nav-tab:focus, .app-container .user-cell:hover { text-decoration: none; }
.app-container .nav-section { margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--emp-line, #eaedf5); }
.app-container .nav-section:last-child { border-bottom: 0; }
.app-container .nav-section-title {
  display: inline-block; margin: 4px 0 4px 2px; padding: 3px 9px; border-radius: 6px;
  font-size: 0.6rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--emp-teal-d, #0e9e6e); background: rgba(18,185,129,0.10);
}
@media (min-width: 1024px) {
  html.nav-collapsed .app-container .nav-section { border-bottom: 0; padding-bottom: 0; margin-bottom: 6px; }
  html.nav-collapsed .app-container .nav-section-title { display: block; background: none; border-radius: 0; padding: 0; font-size: 0; margin: 6px 10px 8px; border-top: 1px solid var(--emp-line, #eaedf5); }
  html.nav-collapsed .app-container .nav-section:first-child .nav-section-title { border-top: 0; margin: 0 0 4px; }
}

/* ---- Left-menu module search (both shells) ---- */
.nav-search { position: relative; margin: 10px 10px 2px; }
.nav-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--emp-muted, #8890a6); pointer-events: none; }
.nav-search input { width: 100%; box-sizing: border-box; padding: 7px 10px 7px 30px; font-size: 0.78rem; border: 1px solid var(--emp-line, #eaedf5); border-radius: 8px; background: var(--emp-ground, #eef2fb); color: var(--emp-ink, #2b2f42); }
.nav-search input:focus { outline: none; border-color: var(--emp-teal, #12b981); background: #fff; box-shadow: 0 0 0 3px rgba(18,185,129,0.12); }
.nav-search input::-webkit-search-cancel-button { cursor: pointer; }
.nav-empty { padding: 10px 12px; font-size: 0.76rem; color: var(--emp-muted, #8890a6); }
.nav-tab[hidden], .emp-nav-item[hidden], .nav-section[hidden], .emp-nav-group[hidden] { display: none !important; }
html.nav-collapsed .nav-search { display: none; }

/* ---- Master "Add records" cards (admin/org): one tinted card per master ---- */
.master-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.master-card {
  --mc: var(--accent-primary); --mc-soft: rgba(16,185,129,0.08);
  position: relative; display: flex; flex-direction: column;
  background: var(--bg-secondary); border: 1px solid var(--border-color);
  border-top: 4px solid var(--mc); border-radius: var(--radius-lg); overflow: hidden;
  transition: box-shadow var(--transition-fast, .15s);
}
.master-card:hover, .master-card:focus-within { box-shadow: 0 8px 20px rgba(20,25,60,0.08); }
.master-card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--mc-soft); border-bottom: 1px solid var(--border-light);
}
.master-card-icon {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--mc); color: #fff;
}
.master-card-icon svg { width: 18px; height: 18px; }
.master-card-title { font-size: 0.9rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.master-card-sub { font-size: 0.72rem; color: var(--text-secondary); margin-top: 2px; }
.master-card-tag {
  margin-left: auto; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--mc); background: var(--bg-secondary); border: 1px solid var(--mc);
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}
.master-card-import { margin-left: 8px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--mc); text-decoration: none; border-bottom: 1px dotted var(--mc); white-space: nowrap; }
.master-card-import:hover { color: var(--text-primary); }
.master-card form { display: flex; flex-direction: column; flex: 1; padding: 16px; }
.master-card form .form-group:last-of-type { margin-bottom: 0; }
.master-card form > .btn { margin-top: 14px; align-self: flex-start; }
.master-card-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.master-grid-1 { grid-template-columns: 1fr; }
.master-card form .btn-primary { background: var(--mc); }
.master-card form .btn-primary:hover { filter: brightness(0.92); background: var(--mc); }
.master-card .form-input:focus, .master-card .form-select:focus { border-color: var(--mc); box-shadow: 0 0 0 3px var(--mc-soft); outline: none; }
/* Generic palette for any add-record card, plus the org-master aliases below. */
.mc-navy   { --mc: #2b2a6b; --mc-soft: rgba(43,42,107,0.07); }
.mc-blue   { --mc: var(--accent-secondary); --mc-soft: rgba(59,130,246,0.08); }
.mc-green  { --mc: var(--accent-primary); --mc-soft: rgba(16,185,129,0.08); }
.mc-purple { --mc: var(--accent-purple); --mc-soft: rgba(139,92,246,0.08); }
.mc-amber  { --mc: var(--accent-warning); --mc-soft: rgba(245,158,11,0.09); }
.mc-teal   { --mc: #0891b2; --mc-soft: rgba(8,145,178,0.08); }
/* Per-master palette — each master has its own hue so the blocks read as distinct. */
.mc-entity      { --mc: #2b2a6b; --mc-soft: rgba(43,42,107,0.07); }
.mc-school      { --mc: var(--accent-secondary); --mc-soft: rgba(59,130,246,0.08); }
.mc-department  { --mc: var(--accent-primary); --mc-soft: rgba(16,185,129,0.08); }
.mc-designation { --mc: var(--accent-purple); --mc-soft: rgba(139,92,246,0.08); }
.mc-emptype     { --mc: var(--accent-warning); --mc-soft: rgba(245,158,11,0.09); }
.mc-location    { --mc: #0891b2; --mc-soft: rgba(8,145,178,0.08); }
.master-card-note {
  font-size: 0.78rem; line-height: 1.45; color: #92400e; background: #fffbeb; border: 1px solid #fcd34d;
  border-radius: var(--radius-md); padding: 10px 12px; margin-bottom: 12px;
}
.master-card-note code { font-size: 0.72rem; background: rgba(0,0,0,0.05); padding: 1px 4px; border-radius: 4px; }
.master-card form .btn[disabled] { opacity: 0.5; cursor: not-allowed; filter: none; }

/* ---- In-portal confirm / alert dialog (views/partials/atlas-dialog.ejs) ---- */
.atlas-dialog-overlay {
  position: fixed; inset: 0; z-index: 10000; padding: 24px;
  background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  animation: atlas-dialog-fade .12s ease-out;
}
.atlas-dialog-overlay[hidden] { display: none; }
.atlas-dialog {
  width: 100%; max-width: 440px; background: var(--bg-secondary); color: var(--text-primary);
  border-radius: 16px; box-shadow: 0 24px 60px rgba(20,25,60,0.25); overflow: hidden;
  animation: atlas-dialog-pop .14s ease-out;
}
.atlas-dialog-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 0; }
.atlas-dialog-icon {
  width: 38px; height: 38px; flex-shrink: 0; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(16,185,129,0.12); color: var(--accent-primary);
}
.atlas-dialog-icon.danger { background: rgba(239,68,68,0.12); color: var(--accent-danger); }
.atlas-dialog-icon svg { width: 20px; height: 20px; }
.atlas-dialog-title { font-size: 1rem; font-weight: 700; color: var(--emp-navy, #2b2a6b); }
.atlas-dialog-body { padding: 10px 20px 4px 70px; font-size: 0.88rem; line-height: 1.5; color: var(--text-secondary); white-space: pre-line; }
.atlas-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px 18px; }
.atlas-dialog-foot .btn { min-width: 88px; justify-content: center; }
.atlas-dialog-foot .atlas-dialog-danger { background: var(--accent-danger); color: #fff; }
.atlas-dialog-foot .atlas-dialog-danger:hover { background: #dc2626; color: #fff; }
body.atlas-dialog-open { overflow: hidden; }
@keyframes atlas-dialog-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes atlas-dialog-pop { from { transform: translateY(8px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 480px) {
  .atlas-dialog-body { padding-left: 20px; }
  .atlas-dialog-foot { flex-direction: column-reverse; }
  .atlas-dialog-foot .btn { width: 100%; }
}

/* ---- Toast pop-ups for flash messages (views/partials/atlas-dialog.ejs) ---- */
.atlas-toast-host {
  position: fixed; top: 16px; right: 16px; z-index: 9000;
  display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.atlas-toast-host .atlas-toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 12px 12px 14px; border-radius: 14px;
  background: var(--bg-secondary); color: var(--text-primary);
  border: 1px solid var(--border-color); border-left: 4px solid var(--accent-primary);
  box-shadow: 0 14px 34px rgba(20,25,60,0.18);
  animation: atlas-toast-in .18s ease-out;
}
.atlas-toast-host .atlas-toast.is-leaving { animation: atlas-toast-out .2s ease-in forwards; }
.atlas-toast-host .atlas-toast-err { border-left-color: var(--accent-danger); }
.atlas-toast-icon { width: 30px; height: 30px; flex-shrink: 0; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: rgba(16,185,129,0.12); color: var(--accent-primary); }
.atlas-toast-err .atlas-toast-icon { background: rgba(239,68,68,0.12); color: var(--accent-danger); }
.atlas-toast-icon svg { width: 18px; height: 18px; }
.atlas-toast-body { flex: 1; min-width: 0; }
.atlas-toast-title { font-size: 0.82rem; font-weight: 700; color: var(--emp-navy, #2b2a6b); }
.atlas-toast-msg { font-size: 0.82rem; line-height: 1.45; color: var(--text-secondary); margin-top: 2px; overflow-wrap: anywhere; }
.atlas-toast-close { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 1.15rem; line-height: 1; padding: 0 2px; }
.atlas-toast-close:hover { color: var(--text-primary); }
@keyframes atlas-toast-in { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes atlas-toast-out { to { transform: translateX(16px); opacity: 0; } }

/* Status buttons in row actions (Activate / Lock / Disable …). The row itself
   keeps the original inline, non-wrapping layout defined above. */
.btn-warn { background: transparent; color: #b45309; border: 1px solid #f59e0b; }
.btn-warn:hover { background: #f59e0b; color: #fff; }
.row-actions .btn-sm.btn-primary { color: #fff; }

/* Notification template preview (View row on admin/notifications) */
.notif-body > td { background: var(--bg-primary); }
.notif-preview { border: 1px solid var(--border-color); border-left: 4px solid #2b2a6b; border-radius: 10px; padding: 12px 14px; background: var(--bg-secondary); }
.notif-preview-head { font-size: 0.85rem; margin-bottom: 8px; }
.notif-preview-body { margin: 0; white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; line-height: 1.55; color: var(--text-primary); background: var(--bg-primary); border-radius: 8px; padding: 10px 12px; }

/* ---- Employee Master: Rows / Cards views ------------------------------------
   One list, two layouts. `.staff-list[data-view]` picks which is shown; the
   choice is remembered per browser (views/pages/admin/employees.ejs). */
.view-switch { display: inline-flex; gap: 0; }
.view-switch .btn { border-radius: 0; margin-left: -1px; }
.view-switch .btn:first-child { border-radius: 7px 0 0 7px; margin-left: 0; }
.view-switch .btn:last-child { border-radius: 0 7px 7px 0; }
.view-switch .btn.is-active { background: var(--emp-navy, #2b2a6b); border-color: var(--emp-navy, #2b2a6b); color: #fff; }
.staff-list[data-view="rows"] .staff-cards { display: none; }
.staff-list[data-view="cards"] .staff-rows { display: none; }

/* Attendance state as a dot on the avatar (both views). */
.user-avatar { position: relative; }
.att-dot { position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid #fff; background: #cbd5e1; }
.att-dot-ok { background: #16a34a; }
.att-dot-off { background: #dc2626; }
.att-dot-leave { background: #f97316; }
.att-dot-warn { background: #f59e0b; }
.att-dot-muted { background: #cbd5e1; }

/* Row view — compact: tighter cells, e-mail and mobile stacked, long
   designations clipped, and the action column pinned to the right edge so
   the icons never scroll out of view. */
.staff-grid-compact th, .staff-grid-compact td { padding: 3px 8px; vertical-align: middle; font-size: 0.78rem; }
.staff-grid-compact .user-cell { gap: 8px; }
.staff-grid-compact .user-avatar { width: 24px; height: 24px; font-size: 0.58rem; }
.staff-grid-compact .user-meta { max-width: 240px; }
.staff-grid-compact .user-meta strong { font-size: 0.8rem; }
.staff-grid-compact .user-meta strong, .staff-grid-compact .user-meta small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
/* E-mail and Mobile columns: value + inline action icons on ONE line, normal text colour. */
.staff-grid-compact .staff-contact { line-height: 1.2; }
.staff-grid-compact .staff-contact .contact-line { flex-wrap: nowrap; gap: 4px; }
.staff-grid-compact .staff-contact .contact-text { color: var(--text-primary, #1f2937); text-decoration: none; max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }
.staff-grid-compact .staff-mobile .contact-text { max-width: 120px; }
/* The mobile number is plain text, never a link colour — even when a browser or
   click-to-call extension wraps the digits in its own <a>. */
.staff-contact .contact-text, .staff-contact .contact-text a, .staff-card-body .contact-line, .staff-card-body .contact-line a:not(.contact-ico) { color: var(--text-primary, #1f2937) !important; text-decoration: none; }
.staff-grid-compact .staff-contact .contact-ico { width: 18px; height: 18px; flex: 0 0 auto; }
.staff-grid-compact .staff-contact .contact-ico svg { width: 11px; height: 11px; }
.staff-grid-compact .chip, .staff-grid-compact .badge { margin: 0 3px 0 0; }
.staff-grid-compact .staff-status { white-space: normal; min-width: 96px; }
.staff-grid-compact .staff-status .badge { margin: 1px 3px 1px 0; }
.staff-grid-compact .staff-col-actions { position: sticky; right: 0; z-index: 1; background: #fff; box-shadow: -8px 0 8px -8px rgba(15, 23, 42, 0.25); }
.staff-grid-compact thead .staff-col-actions { background: var(--emp-ground, #f6f8fc); }
/* Sortable headers — click to sort, click again to flip; the arrow marks the active column. */
.staff-grid th[aria-sort] { padding: 0; }
.th-sort { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; color: inherit; text-decoration: none; font: inherit; letter-spacing: inherit; text-transform: inherit; white-space: nowrap; border-radius: 4px; }
.th-sort:hover, .th-sort:focus-visible { color: var(--emp-teal-d, #0e9e6e); background: #eef2f8; outline: none; }
.th-sort-arrow { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; opacity: 0.25; }
.th-sort-arrow, .th-sort.is-asc .th-sort-arrow { border-bottom: 5px solid currentColor; border-top: 0; }
.th-sort.is-desc .th-sort-arrow { border-top: 5px solid currentColor; border-bottom: 0; }
.th-sort:hover .th-sort-arrow { opacity: 0.6; }
.th-sort.is-sorted { color: var(--emp-teal-d, #0e9e6e); }
.th-sort.is-sorted .th-sort-arrow { opacity: 1; }
.staff-grid-compact tbody tr:hover td { background: var(--bg-tertiary, #f8fafc); }
.staff-grid-compact .row-actions { gap: 2px; }
.staff-grid-compact .row-actions .btn-icon { width: 24px; height: 24px; }

/* Card view — responsive tiles with the full detail set. */
.staff-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.staff-card { display: flex; flex-direction: column; border: 1px solid var(--emp-line, #eaedf5); border-radius: 12px; background: #fff; overflow: hidden; }
.staff-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 8px 12px 7px; background: var(--emp-ground, #f6f8fc); border-bottom: 1px solid var(--emp-line, #eaedf5); }
.staff-card-head .user-cell { align-items: center; min-width: 0; }
.staff-card-head .user-meta { min-width: 0; }
.staff-card-head .user-meta strong { font-size: 0.9rem; }
.staff-card-head .user-meta small { white-space: normal; }
.staff-card-status { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.user-avatar-lg { width: 38px; height: 38px; font-size: 0.8rem; }
.user-avatar-lg .att-dot { width: 11px; height: 11px; }
.staff-card-body { display: grid; grid-template-columns: 84px 1fr; gap: 3px 8px; margin: 0; padding: 8px 12px; font-size: 0.76rem; align-items: center; }
.staff-card-body dt { color: var(--emp-muted, #8890a6); font-size: 0.62rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.6; }
.staff-card-body .contact-line { flex-wrap: nowrap; }
.staff-card-body .contact-line > a:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staff-card-body .contact-ico { width: 18px; height: 18px; flex: 0 0 auto; }
.staff-card-body .contact-ico svg { width: 11px; height: 11px; }
.staff-card-body dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.staff-card-body dd a { text-decoration: none; color: inherit; }
.staff-card-body dd a:hover { text-decoration: underline; }
.staff-contact a.muted { color: var(--emp-muted, #8890a6); }
.contact-line { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.contact-ico { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 6px; color: var(--emp-muted, #8890a6) !important; border: 1px solid var(--emp-line, #eaedf5); background: #fff; }
.contact-ico svg { width: 12px; height: 12px; }
.contact-ico:hover { color: var(--text-primary, #1f2937) !important; border-color: var(--emp-muted, #8890a6); text-decoration: none !important; }
.contact-ico-wa:hover { color: #25d366 !important; border-color: #25d366; }
.staff-card-foot { margin-top: auto; display: flex; justify-content: flex-end; padding: 8px 10px; border-top: 1px solid var(--emp-line, #eaedf5); }
@media (max-width: 720px) {
  .staff-grid-compact .user-meta { max-width: 160px; }
  .staff-cards { grid-template-columns: 1fr; }
}

/* ---- Organization: one tab per master (same pills as Bulk Import) -------- */
.org-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.org-tab { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--emp-line, #eaedf5); background: #fff; color: var(--emp-ink, #2b2f42); font-size: 0.78rem; font-weight: 600; cursor: pointer; font-family: inherit; }
.org-tab:hover { border-color: var(--emp-teal, #12b981); }
.org-tab.on { background: var(--emp-teal, #12b981); border-color: var(--emp-teal, #12b981); color: #fff; }
.org-tab-count { font-size: 0.66rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--emp-ground, #eef2fb); color: var(--emp-muted, #8890a6); }
.org-tab.on .org-tab-count { background: rgba(255,255,255,0.25); color: #fff; }
.org-panel-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.org-panel-head .card-title { margin-right: auto; }
.org-panel-head .org-filter { width: 220px; max-width: 100%; height: 30px; font-size: 0.78rem; }
.org-panel-actions { display: inline-flex; gap: 6px; }
.org-table td:nth-child(2) { white-space: normal; min-width: 220px; }
@media (max-width: 720px) { .org-panel-head .org-filter { width: 100%; order: 3; } }

/* ---- Generic edit form: section headings (Employee edit) ---------------- */
.edit-section { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--emp-navy, #2b2a6b); border-bottom: 1px solid var(--emp-line, #eaedf5); padding: 10px 0 4px; margin-top: 4px; }
.edit-section:first-child { margin-top: 0; padding-top: 0; }

/* Employee Master multi-select filters (Attendance / Role / Team / Status). */
.emp-filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ms-filter { position: relative; }
.ms-filter > summary { list-style: none; cursor: pointer; white-space: nowrap; }
.ms-filter > summary::-webkit-details-marker { display: none; }
.ms-filter.has-sel > summary { border-color: var(--accent-primary, #10b981); background: rgba(16,185,129,0.10); font-weight: 600; }
.ms-menu { position: absolute; left: 0; top: calc(100% + 4px); z-index: 30; min-width: 240px; max-height: 320px; overflow: auto; background: #fff; border: 1px solid var(--emp-line, #eaedf5); border-radius: 10px; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12); padding: 6px; }
.ms-tools { display: flex; gap: 6px; padding: 2px 6px 6px; border-bottom: 1px solid var(--emp-line, #eaedf5); margin-bottom: 4px; }
.ms-tools button { background: none; border: 0; color: var(--accent-primary, #10b981); font-size: 0.74rem; cursor: pointer; padding: 0; }
.ms-opt { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 6px; font-size: 0.8rem; cursor: pointer; white-space: nowrap; }
.ms-opt:hover { background: var(--emp-ground, #f6f8fc); }
.ms-opt input { width: auto; margin: 0; }
/* Search box inside a multi-select filter menu */
.ms-search { display: block; width: calc(100% - 16px); margin: 4px 8px 6px; padding: 4px 8px; font-size: 0.76rem; border: 1px solid var(--emp-line, #eaedf5); border-radius: 6px; background: #fff; }
.ms-search:focus { outline: none; border-color: var(--accent-primary, #10b981); }
/* Inline status selector on the Employee Master (Super Admin / HR Admin) */
.status-inline { display: inline-block; margin: 0; }
.status-select { appearance: none; -webkit-appearance: none; cursor: pointer; border: 1px solid transparent; padding-right: 16px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='6' viewBox='0 0 8 6'><path d='M1 1l3 3 3-3' fill='none' stroke='%23475569' stroke-width='1.5'/></svg>"); background-repeat: no-repeat; background-position: right 5px center; font: inherit; font-size: 0.66rem; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; line-height: 1.4; }
.status-select:hover { border-color: currentColor; }
.status-select option { text-transform: none; font-weight: 400; color: var(--text-primary, #1f2937); background: #fff; }
/* Employee Master: tick boxes + the assign-shift bar */
.pick-col { width: 28px; padding-right: 0 !important; }
.pick-cell { display: inline-flex; align-items: center; cursor: pointer; }
.pick-cell input, #pick-all { width: 15px; height: 15px; margin: 0; cursor: pointer; }
.staff-card-head .pick-cell { margin-right: 6px; }
.assign-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; padding: 8px 12px; border: 1px solid var(--emp-line, #eaedf5); border-radius: 10px; background: #fff; font-size: 0.8rem; }
.assign-bar .form-select { width: auto; max-width: 320px; height: 30px; padding: 0 28px 0 8px; font-size: 0.78rem; }
.assign-count { font-weight: 600; min-width: 84px; }
.assign-scope { display: inline-flex; align-items: center; gap: 4px; color: var(--emp-muted, #8890a6); cursor: pointer; }
.assign-scope input { margin: 0; }
.chip-shift { background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.66rem; }
/* Profile photos: the avatar shows the stored picture when there is one */
.user-avatar img, .header-user-avatar img, .emp-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.header-user-avatar { overflow: hidden; }
/* Avatar = initials with the person's photo laid over them when one exists (the img removes itself on 404). */
.atlas-avatar { position: relative; overflow: hidden; }
.atlas-avatar > span { position: relative; z-index: 0; }
.atlas-avatar > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; z-index: 1; background: #fff; }
.user-avatar { overflow: visible; }
.user-avatar img { border-radius: 50%; }
.profile-photo { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.profile-photo .photo-form { margin: 0; }
.photo-pick { cursor: pointer; }
/* Category and reporting-line highlights on the profile header */
.badge-category { font-size: 0.7rem; letter-spacing: 0.03em; }
.chip-manager { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.chip-manager:hover { background: #d1fae5; text-decoration: none; }
.chip-manager svg { width: 12px; height: 12px; }
.chip-manager-none { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
/* One master's Add form as a pop-up (atlasCardModal) */
.atlas-modal-overlay { position: fixed; inset: 0; z-index: 9990; padding: 24px; background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(2px); display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; animation: atlas-dialog-fade .12s ease-out; }
.atlas-modal { position: relative; width: 100%; max-width: 760px; margin: 4vh auto; background: var(--bg-secondary, #fff); border-radius: 16px; box-shadow: 0 24px 60px rgba(20,25,60,0.25); animation: atlas-dialog-pop .14s ease-out; }
.atlas-modal-close { position: absolute; top: 10px; right: 12px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--emp-muted, #8890a6); font-size: 1.4rem; line-height: 1; cursor: pointer; z-index: 1; }
.atlas-modal-close:hover { background: var(--emp-ground, #f6f8fc); color: var(--text-primary, #1f2937); }
.atlas-modal-body { padding: 8px; }
.atlas-modal .master-card { box-shadow: none; margin: 0; }
.atlas-modal-open { overflow: hidden; }
.org-panel-head .org-panel-actions { margin-left: auto; }
/* Policy Configuration: the explanation panel */
.pc-help summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pc-help summary::-webkit-details-marker { display: none; }
.pc-toggle { width: 28px; height: 28px; flex: 0 0 auto; border-radius: 50%; border: 1px solid var(--emp-line, #eaedf5); background: #fff; color: var(--emp-muted, #8890a6); display: inline-flex; align-items: center; justify-content: center; transition: transform 0.18s ease, color 0.18s ease, border-color 0.18s ease; }
.pc-toggle svg { width: 14px; height: 14px; }
.pc-help summary:hover .pc-toggle { color: var(--accent-primary, #10b981); border-color: var(--accent-primary, #10b981); }
.pc-help[open] > summary .pc-toggle { transform: rotate(180deg); }
.pc-help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px 24px; }
.pc-help-grid h4 { margin: 0 0 6px; font-size: 0.86rem; color: var(--emp-navy, #1e2a4a); }
.pc-help-grid p { margin: 0 0 8px; font-size: 0.86rem; line-height: 1.6; }
.pc-mini { border-collapse: collapse; font-size: 0.82rem; width: 100%; }
.pc-mini td { padding: 3px 8px 3px 0; vertical-align: top; border-bottom: 1px dashed var(--emp-line, #eaedf5); }
.pc-hint { display: block; margin-top: 4px; font-size: 0.72rem; line-height: 1.45; color: var(--emp-muted, #8890a6); }
.pc-hint strong { color: var(--emp-ink, #2b2f42); }
.pc-preview { margin: 6px 0 12px; padding: 10px 14px; border-left: 4px solid var(--emp-teal, #12b981); background: rgba(18,185,129,0.07); border-radius: 0 10px 10px 0; font-size: 0.88rem; line-height: 1.55; }
.pc-fields td { white-space: normal; vertical-align: top; font-size: 0.84rem; }
.pc-fields td:first-child { font-weight: 600; white-space: nowrap; }

/* Compact numbered guide cards (Policy Configuration, Department Profiles): the same design on every configuration screen. */
.cg .card-body { padding-top: 12px; }
.cg h4 { margin: 0 0 8px; font-size: 0.88rem; color: var(--emp-navy, #1e2a4a); display: flex; align-items: center; gap: 8px; }
.cg-n { width: 20px; height: 20px; border-radius: 50%; background: var(--accent-primary, #10b981); color: #fff; font-size: 0.7rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.cg-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cg-card { border: 1px solid var(--emp-line, #eaedf5); border-radius: 10px; padding: 12px 14px; background: #fff; min-width: 0; }
.cg-card p { margin: 0 0 8px; font-size: 0.84rem; line-height: 1.55; }
.cg-lead { font-weight: 500; }
.cg-note { font-size: 0.78rem !important; }
.cg-example { display: grid; grid-template-columns: 2fr 1fr 1fr 1.2fr; gap: 6px; border: 1px dashed var(--emp-line, #d9dee8); border-radius: 8px; padding: 8px 10px; background: var(--emp-ground, #f6f8fc); font-size: 0.8rem; }
.cg-example span { display: flex; flex-direction: column; min-width: 0; font-weight: 600; }
.cg-example em { font-style: normal; font-weight: 600; font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--emp-muted, #8890a6); }
.cg-ladder { list-style: none; margin: 0 0 8px; padding: 0; counter-reset: ladder; }
.cg-ladder li { display: flex; align-items: baseline; gap: 8px; padding: 4px 8px; border-left: 3px solid var(--accent-primary, #10b981); margin: 0 0 3px; background: var(--emp-ground, #f6f8fc); border-radius: 0 6px 6px 0; font-size: 0.82rem; }
.cg-ladder li:nth-child(2) { border-color: #34c99a; } .cg-ladder li:nth-child(3) { border-color: #6fd6b3; } .cg-ladder li:nth-child(4) { border-color: #9be2c8; } .cg-ladder li:nth-child(5) { border-color: #c2ecdb; } .cg-ladder li:nth-child(6) { border-color: #dfe6ef; }
.cg-ladder li small { color: var(--emp-muted, #8890a6); font-size: 0.74rem; }
.cg-ladder li:first-child::after { content: 'wins'; margin-left: auto; font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent-primary, #10b981); }
.cg-assert { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cg-assert li { display: grid; grid-template-columns: 150px 1fr; gap: 8px; align-items: start; font-size: 0.82rem; line-height: 1.45; }
.cg-assert .badge { justify-self: start; white-space: nowrap; }
.cg-steps-wrap { margin-top: 12px; }
.cg-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.cg-steps li { counter-increment: step; border: 1px solid var(--emp-line, #eaedf5); border-radius: 8px; padding: 8px 10px 8px 34px; font-size: 0.82rem; line-height: 1.5; position: relative; background: #fff; }
.cg-steps li::before { content: counter(step); position: absolute; left: 10px; top: 8px; width: 18px; height: 18px; border-radius: 50%; background: var(--emp-ground, #eef2f7); color: var(--emp-navy, #1e2a4a); font-size: 0.68rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.cg-fields { margin-top: 12px; }
.cg-fields summary { cursor: pointer; font-size: 0.84rem; font-weight: 600; color: var(--emp-navy, #1e2a4a); }
.cg-fields .table-responsive { margin-top: 8px; }
@media (max-width: 1100px) { .cg-grid { grid-template-columns: 1fr; } .cg-steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .cg-steps { grid-template-columns: 1fr; } .cg-example { grid-template-columns: 1fr 1fr; } }
.cg-dl { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; font-size: 0.8rem; }
.cg-dl > div { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 2px 8px; align-items: start; padding: 4px 0; border-bottom: 1px dashed var(--emp-line, #eaedf5); }
.cg-dl dt { font-weight: 600; color: var(--emp-navy, #1e2a4a); }
.cg-dl dd { margin: 0; line-height: 1.5; color: var(--emp-ink, #2b2f42); }
.cg-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.cg-icon-card { border: 1px solid var(--emp-line, #eaedf5); border-radius: 10px; padding: 10px 12px; background: #fff; min-width: 0; }
.cg-icon-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.cg-icon-head strong { display: block; font-size: 0.86rem; }
.cg-icon-head small { color: var(--emp-muted, #8890a6); font-size: 0.72rem; }
.cg-icon-card .dp-ico-chip { --ico: var(--accent-primary, #10b981); width: 26px; height: 26px; flex: 0 0 auto; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; color: var(--ico); background: color-mix(in srgb, var(--ico) 13%, #fff); }
.cg-icon-card .dp-ico-chip svg { width: 13px; height: 13px; }
.cg-icon-card p { margin: 0 0 6px; font-size: 0.82rem; line-height: 1.5; }
.cg-icon-card dl { margin: 0; display: grid; grid-template-columns: 86px 1fr; gap: 2px 8px; font-size: 0.78rem; }
.cg-icon-card dt { font-weight: 700; color: var(--emp-muted, #8890a6); text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.62rem; padding-top: 3px; }
.cg-icon-card dd { margin: 0; line-height: 1.45; }
@media (max-width: 900px) { .cg-dl { grid-template-columns: 1fr; } }

