/* =====================================================================
   Admin Portal — Linear/Vercel-inspired SaaS UI
   All colour / radius / elevation flows from css/shared/design-tokens.css.
   Switch themes via data-theme on <html>; nothing here is hard-coded.
   ===================================================================== */

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Display face — Plus Jakarta Sans on headings, brand & titles */
h1, h2, h3,
.staff-brand-label,
.staff-topbar-title,
.staff-notify-title,
.dash-card-title,
.settings-section h2,
.settings-modal-section-title {
  font-family: var(--font-display);
}

/* Bootstrap focus override kept scoped so it doesn't fight our rings */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 3px var(--ring);
}

.app-container { width: 100%; }

/* Tabular figures for anything numeric-heavy */
.staff-table td,
.staff-metrics-grid strong,
.staff-stat-card strong,
.dash-kpi-value,
.staff-pagination-info,
.staff-table-info { font-variant-numeric: tabular-nums; }

/* =====================================================================
   Shell layout
   ===================================================================== */

.staff-layout-body {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  margin-bottom: 0;
  background: var(--bg);
  color: var(--text);
  transition: grid-template-columns var(--dur) var(--ease-out);
}

.staff-layout-body:has(.staff-sidebar.collapsed) {
  grid-template-columns: 68px minmax(0, 1fr);
}

.staff-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.85rem 0.75rem;
  color: var(--sidebar-fg);
  background: var(--sidebar-bg);
  width: 260px;
  /* Visible so the edge toggle can overhang; each child clips its own content. */
  overflow: visible;
  transition: width var(--dur) var(--ease-out);
  position: sticky;
  /* Above .staff-appbar (z-index 30) so the overhanging edge toggle stays visible. */
  z-index: 50;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  border-right: 1px solid var(--sidebar-border);
}

.staff-sidebar.collapsed { width: 68px; }

/* ── Sidebar header (brand + toggle) ── */

.staff-sidebar-header {
  display: flex;
  align-items: center;
  /* Toggle lives on the sidebar edge, so the brand owns the whole row. */
  justify-content: flex-start;
  min-height: 44px;
  gap: 0.5rem;
  padding: 0.15rem 0.35rem 0.5rem;
  position: relative;
  overflow: hidden;
}

.staff-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  /* Toggle now sits on the border line, so only a small gutter is needed. */
  padding-right: 10px;
  color: var(--sidebar-brand-fg);
  text-decoration: none;
  min-width: 0;
  flex-shrink: 1;
}

.staff-brand-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  transition: opacity var(--dur-fast);
}

.staff-brand-label {
  /* Sized to keep the full brand name on one line beside the edge toggle. */
  font-size: 15px;
  font-weight: var(--fw-semibold);
  letter-spacing: -0.015em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
}

.staff-sidebar.collapsed .staff-brand-label { display: none; }

.staff-sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Straddles the sidebar's outer edge, level with the brand row. */
  position: absolute;
  right: -13px;
  top: 32px;
  transform: translateY(-50%);
  z-index: 30;
  width: 26px;
  height: 26px;
  padding: 0;
  flex-shrink: 0;
  border: 2px solid var(--sidebar-bg);
  border-radius: 9999px;
  background: var(--primary);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  transition: background var(--dur-fast), color var(--dur-fast);
}

.staff-sidebar-toggle:hover {
  background: var(--primary-hover);
  color: #ffffff;
}

.staff-sidebar-toggle svg { width: 16px; height: 16px; }

.staff-toggle-icon-open { display: none; }
.staff-toggle-icon-close { display: block; }
.staff-sidebar.collapsed .staff-toggle-icon-open { display: block; }
.staff-sidebar.collapsed .staff-toggle-icon-close { display: none; }

/* Collapsed keeps the same half-out edge position — only the chevron flips. */

/* ── Nav links ── */

.staff-nav {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}

.staff-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 40px;
  padding: 0.55rem 0.6rem;
  border: 0;
  border-radius: var(--radius);
  color: var(--sidebar-fg);
  background: transparent;
  text-decoration: none;
  font-weight: var(--fw-medium);
  font-size: var(--text-base);
  transition: background var(--dur-fast), color var(--dur-fast);
  white-space: nowrap;
}

.staff-nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }

.staff-nav a:hover {
  color: var(--sidebar-active-fg);
  background: var(--sidebar-hover-bg);
}

.staff-nav a.active {
  color: var(--sidebar-active-fg);
  background: var(--sidebar-active-bg);
}

.staff-nav a.active svg { opacity: 1; }

/* accent bar on active top-level item */
.staff-nav > a.active::before {
  content: "";
  position: absolute;
  left: -0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
}

.staff-nav-label {
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  min-width: 0;
}

.staff-sidebar.collapsed .staff-nav-label { display: none; }

/* ── Nav group (collapsible parent) ── */

.staff-nav-group { display: flex; flex-direction: column; }

.staff-nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 40px;
  padding: 0.55rem 0.6rem;
  border: 0;
  border-radius: var(--radius);
  color: var(--sidebar-fg);
  background: transparent;
  font-weight: var(--fw-medium);
  font-size: var(--text-base);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background var(--dur-fast), color var(--dur-fast);
  white-space: nowrap;
}

.staff-nav-group-toggle svg:first-child { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.staff-nav-group-toggle:hover { color: var(--sidebar-active-fg); background: var(--sidebar-hover-bg); }
.staff-nav-group-toggle.active { color: var(--sidebar-active-fg); }

.staff-nav-group-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform var(--dur);
  margin-left: auto;
  opacity: 0.6;
}

.staff-nav-group-toggle[aria-expanded="true"] .staff-nav-group-chevron { transform: rotate(180deg); }

.staff-nav-group-children {
  display: none;
  flex-direction: column;
  gap: 0;
  margin-top: 2px;
  padding: 2px 0 2px 1.55rem;
  position: relative;
}

.staff-nav-group-children::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 1.05rem;
  width: 1px;
  background: var(--sidebar-border);
}

.staff-nav-group-children.open { display: flex; }

.staff-nav-child {
  padding-left: 0.6rem !important;
  font-size: var(--text-sm);
  color: var(--sidebar-fg-muted);
}

.staff-nav-child.active { color: var(--sidebar-active-fg); }

.staff-sidebar.collapsed .staff-nav-group-chevron { display: none; }
.staff-sidebar.collapsed .staff-nav-group-children { display: none !important; }

/* ── Footer / user menu ── */

.staff-sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--sidebar-border);
  padding-top: 0.6rem;
}

.staff-user-wrap { position: relative; }

.staff-user-trigger {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--dur-fast);
  user-select: none;
}

.staff-user-trigger:hover { background: var(--sidebar-hover-bg); }

.staff-user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-violet));
  color: #fff;
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  flex-shrink: 0;
  letter-spacing: 0.03em;
}

.staff-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.staff-sidebar.collapsed .staff-user-trigger .staff-user-info { display: none; }

.staff-user-name {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--sidebar-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.staff-user-role { font-size: 11.5px; color: var(--sidebar-fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.staff-user-chevron {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--sidebar-fg-muted);
  transition: transform var(--dur);
}

.staff-user-trigger.active .staff-user-chevron { transform: rotate(180deg); }
.staff-sidebar.collapsed .staff-user-chevron { display: none; }

.staff-user-menu {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.4rem;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  width: 232px;
}

.staff-user-menu-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem 0.75rem;
}

.staff-user-menu-header .staff-user-name { color: var(--text); }
.staff-user-menu-header .staff-user-role { color: var(--text-muted); }

.staff-user-menu-divider { height: 1px; background: var(--border); margin: 0.3rem 0; }

.staff-user-menu-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
  text-align: left;
  outline: none;
  box-shadow: none;
  font-family: inherit;
}

.staff-user-menu-item:hover { background: var(--surface-2); color: var(--text); }
.staff-user-menu-item:focus,
.staff-user-menu-item:focus-visible { outline: none; box-shadow: none; }
.staff-user-menu-item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.75; }

.staff-user-menu-item--danger { color: var(--danger-fg); }
.staff-user-menu-item--danger:hover { background: var(--danger-soft); color: var(--danger); }

/* =====================================================================
   Desktop app bar (topbar within the main column)
   ===================================================================== */

.staff-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.staff-appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 56px;
  padding: 0 2rem;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(150%) blur(10px);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.staff-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--text-base);
  min-width: 0;
}

.staff-breadcrumb a { color: var(--text-muted); text-decoration: none; transition: color var(--dur-fast); white-space: nowrap; flex-shrink: 0; }
.staff-breadcrumb a:hover { color: var(--text); }
.staff-breadcrumb-parent { color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.staff-breadcrumb-sep { color: var(--text-subtle); flex-shrink: 0; }
.staff-breadcrumb-current {
  color: var(--text);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.staff-appbar-spacer { flex: 1; }

.staff-appbar-actions { display: flex; align-items: center; gap: 0.4rem; }

.staff-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
  position: relative;
}

.staff-icon-btn:hover { background: var(--surface-2); color: var(--text); }
.staff-icon-btn svg { width: 18px; height: 18px; }

.staff-icon-btn-dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: var(--radius-pill);
  background: var(--danger);
  border: 2px solid var(--bg);
}

.staff-icon-btn-dot[hidden] { display: none; }

/* ── Notification bell dropdown ── */

.staff-notify-bell-wrap { position: relative; }

.staff-notify-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 340px;
  max-width: calc(100vw - 2rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg, 0 12px 32px rgba(0, 0, 0, 0.18));
  z-index: 60;
  overflow: hidden;
}

.staff-notify-panel[hidden] { display: none; }

.staff-notify-panel-header {
  padding: 0.7rem 0.9rem;
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--text);
  border-bottom: 1px solid var(--border-subtle);
}

.staff-notify-panel-list {
  max-height: 380px;
  overflow-y: auto;
}

.staff-notify-empty {
  padding: 1.25rem 0.9rem;
  margin: 0;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-subtle);
}

.staff-notify-item {
  display: block;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
  color: inherit;
  text-decoration: none;
  transition: background var(--dur-fast);
}

.staff-notify-item:last-child { border-bottom: 0; }
.staff-notify-item:hover { background: var(--surface-2); }
.staff-notify-item--unread { background: var(--primary-soft); }
.staff-notify-item--unread:hover { background: var(--primary-soft); }

.staff-notify-item-title {
  margin: 0 0 0.15rem;
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--text);
}

.staff-notify-item-message {
  margin: 0 0 0.25rem;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.staff-notify-item-time {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-subtle);
}

/* theme toggle icon crossfade */
.staff-theme-toggle .icon-sun { display: none; }
.staff-theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .staff-theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .staff-theme-toggle .icon-moon { display: none; }

/* form toggle switch (checkbox styled as a sliding switch) */
.staff-toggle-wrap {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1rem;
}

.staff-toggle-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
}

.staff-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.staff-toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s;
}

.staff-toggle-track::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #fff;
  transition: transform .2s;
}

.staff-toggle-switch input:checked + .staff-toggle-track {
  background: var(--primary);
}

.staff-toggle-switch input:checked + .staff-toggle-track::after {
  transform: translateX(16px);
}

.staff-toggle-label {
  font-size: .875rem;
  font-weight: 700;
  color: var(--text);
  line-height: 22px;
}

.staff-content { padding: 2rem; flex: 1; }

/* =====================================================================
   Page header + primitives
   ===================================================================== */

.staff-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.staff-page-header h1,
.staff-login-copy h1 {
  margin: 0;
  font-weight: var(--fw-bold);
  font-size: var(--text-2xl);
  letter-spacing: -0.02em;
  color: var(--text);
}

.staff-page-header p,
.staff-login-copy p,
.staff-action-grid small,
.staff-table-header p,
.staff-empty-state span {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: var(--text-md);
}

.staff-eyebrow {
  margin: 0 0 0.4rem;
  color: var(--primary);
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Buttons ── */

.staff-primary-button,
.staff-primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 38px;
  padding: 0 1rem;
  border: 0;
  border-radius: var(--radius);
  color: var(--text-on-primary);
  background: var(--primary);
  text-decoration: none;
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: background var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur-fast);
}

.staff-primary-button:hover,
.staff-primary-link:hover { background: var(--primary-hover); }
.staff-primary-button:active { transform: translateY(1px); }

.staff-primary-button svg,
.staff-primary-link svg,
.staff-secondary-button svg { width: 1rem; height: 1rem; flex-shrink: 0; }

.staff-secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 38px;
  padding: 0 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: var(--text-base);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}

.staff-secondary-button:hover { background: var(--surface-2); border-color: var(--text-subtle); }

.staff-danger-button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 38px;
  padding: 0 1rem;
  border: none;
  border-radius: var(--radius);
  background: var(--danger);
  color: #fff;
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: background var(--dur-fast);
}

.staff-danger-button:hover { background: var(--danger-hover); }
.staff-danger-button svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ── Metric / action grids ── */

.staff-metrics-grid,
.staff-action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.staff-metrics-grid article,
.staff-action-grid a,
.staff-upload-form,
.staff-table-panel,
.staff-login-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.staff-metrics-grid article { padding: 1.15rem 1.25rem; }
.staff-metrics-grid span { color: var(--text-muted); font-size: var(--text-base); font-weight: var(--fw-medium); }
.staff-metrics-grid strong { display: block; margin-top: 0.4rem; font-size: var(--text-3xl); font-weight: var(--fw-bold); letter-spacing: -0.02em; }

.staff-action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.staff-action-grid a {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1.25rem;
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast);
}

.staff-action-grid a:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.staff-action-grid span { color: var(--primary); font-size: var(--text-base); font-weight: var(--fw-bold); }

.staff-document-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 1.25rem;
}

.staff-upload-form,
.staff-table-panel { padding: 1.25rem; }

.staff-upload-form h2,
.staff-table-header h2 {
  margin: 0 0 1rem;
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  letter-spacing: -0.01em;
}

.staff-table-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}
.staff-table-panel-header h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  letter-spacing: -0.01em;
  color: var(--text);
}
.staff-table-panel-header h2 svg { width: 18px; height: 18px; color: var(--primary); }

/* ── Fields ── */

.staff-field { display: grid; gap: 0.4rem; margin-bottom: 1rem; }
.staff-field label { font-weight: var(--fw-semibold); font-size: var(--text-base); color: var(--text); }

.staff-field input,
.staff-field textarea {
  width: 100%;
  min-height: 42px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
  font-family: inherit;
  font-size: var(--text-base);
  outline: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}

.staff-field input:focus,
.staff-field textarea:focus,
.staff-field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

.staff-field select {
  width: 100%;
  min-height: 42px;
  padding: 0.6rem 2.5rem 0.6rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a909a' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
  font-family: inherit;
  font-size: var(--text-base);
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}

.staff-field span,
.staff-validation { color: var(--danger); font-weight: var(--fw-semibold); font-size: var(--text-sm); }

.staff-success {
  margin-bottom: 1rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--success);
  border-radius: var(--radius);
  color: var(--success-fg);
  background: var(--success-soft);
  font-weight: var(--fw-semibold);
}

/* ── Tables ── */

.staff-table-wrap { overflow-x: auto; }
.staff-table { width: 100%; border-collapse: collapse; }

.staff-table th,
.staff-table td {
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  vertical-align: middle;
  font-size: var(--text-base);
}

.staff-table th:last-child,
.staff-table td:last-child { text-align: right; }

.staff-table th {
  color: var(--text-subtle);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.staff-table tbody tr { transition: background var(--dur-fast); }
.staff-table tbody tr:hover { background: var(--surface-2); }
.staff-table td span { display: block; color: var(--text-muted); }

.staff-status {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  color: var(--info-fg) !important;
  background: var(--info-soft);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
}

.staff-empty-state {
  display: grid;
  gap: 0.25rem;
  padding: 2.5rem 2rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  text-align: center;
}

/* =====================================================================
   Account / Login layout (dark "AI" theme — self-contained, unchanged)
   ===================================================================== */

.auth-layout-body { margin: 0; overflow: hidden; }

.auth-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #070b16;
  padding: 2rem 1rem;
  overflow: hidden;
  color: #e6ebf5;
  font-family: var(--font-sans);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.auth-net-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }

.auth-aura {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  width: 760px;
  height: 760px;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -58%);
  background: radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.22), rgba(45, 212, 191, 0.1) 40%, transparent 68%);
  filter: blur(20px);
}

.auth-vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(circle at 50% 42%, transparent 30%, rgba(3, 6, 14, 0.72) 100%);
}

.auth-card {
  position: relative;
  z-index: 2;
  background: rgba(16, 22, 40, 0.72);
  border: 1px solid rgba(120, 140, 200, 0.18);
  border-radius: 22px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.02) inset, 0 1px 0 rgba(255, 255, 255, 0.06) inset;
  width: 100%;
  max-width: 418px;
  padding: 2.6rem 2.5rem 2.2rem;
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
}

.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 0.85rem; margin-bottom: 1.75rem; text-align: center; }
.auth-brand-logo { height: 52px; width: auto; }
.auth-brand-title { font-family: "Plus Jakarta Sans", var(--font-sans); font-size: 1.55rem; font-weight: 800; color: #f4f7ff; letter-spacing: -0.03em; margin: 0; }
.auth-brand-ai { background: linear-gradient(120deg, #2dd4bf, #a855f7); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-brand-subtitle { font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase; color: #8b94ad; font-weight: 600; margin: 0 0 1.5rem; }
.auth-form { display: flex; flex-direction: column; gap: 1.05rem; }
.auth-field { display: flex; flex-direction: column; gap: 0.45rem; }
.auth-field label { font-size: 0.78rem; font-weight: 600; color: #c4ccde; }
.auth-input-wrap { position: relative; display: flex; align-items: center; }
.auth-input-wrap > svg { position: absolute; left: 0.95rem; width: 18px; height: 18px; color: #8b94ad; pointer-events: none; }

.auth-field input[type="email"],
.auth-field input[type="password"] {
  width: 100%;
  padding: 0.78rem 1rem 0.78rem 2.7rem;
  border: 1px solid rgba(120, 140, 200, 0.22);
  border-radius: 12px;
  font-size: 0.93rem;
  color: #e6ebf5;
  background: rgba(10, 15, 30, 0.6);
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  outline: none;
}

.auth-field input::placeholder { color: #5d6680; }

.auth-field input:-webkit-autofill,
.auth-field input:-webkit-autofill:hover,
.auth-field input:-webkit-autofill:focus,
.auth-field input:-webkit-autofill:active {
  -webkit-text-fill-color: #e6ebf5;
  caret-color: #e6ebf5;
  -webkit-box-shadow: 0 0 0 1000px rgba(10, 15, 30, 0.6) inset;
  box-shadow: 0 0 0 1000px rgba(10, 15, 30, 0.6) inset;
  transition: background-color 600000s 0s, color 600000s 0s;
}

.auth-field input[type="email"]:focus,
.auth-field input[type="password"]:focus {
  border-color: rgba(99, 102, 241, 0.8);
  background: rgba(12, 18, 36, 0.85);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18), 0 0 22px -6px rgba(99, 102, 241, 0.5);
}

.auth-field .text-danger,
.auth-field span[data-valmsg-for] { font-size: 0.8rem; color: #fb7185; }

.auth-validation {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.83rem;
  font-weight: 500;
  line-height: 1.45;
  color: #fecdd3;
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.32);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
}

.auth-validation::before {
  content: '';
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  background-repeat: no-repeat;
  background-position: center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fb7185' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v4'/%3E%3Cpath d='M12 16h.01'/%3E%3C/svg%3E");
}

.auth-validation ul { margin: 0; padding: 0; list-style: none; }
.auth-validation li + li { margin-top: 0.25rem; }
.auth-validation:empty,
.auth-validation.validation-summary-valid { display: none; }

.auth-checkbox { display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; font-weight: 500; color: #c4ccde; cursor: pointer; margin-top: 0.1rem; }
.auth-checkbox input[type="checkbox"] { width: 16px; height: 16px; accent-color: #6366f1; cursor: pointer; }

.auth-submit {
  margin-top: 0.35rem;
  padding: 0.85rem 1rem;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  background: linear-gradient(120deg, #2dd4bf, #6366f1 52%, #a855f7);
  background-size: 180% 100%;
  background-position: 0 0;
  box-shadow: 0 14px 34px -10px rgba(99, 102, 241, 0.7);
  transition: background-position 0.5s, transform 0.12s, box-shadow 0.2s;
}

.auth-submit svg { width: 1.15rem; height: 1.15rem; flex-shrink: 0; }
.auth-submit:hover { background-position: 100% 0; box-shadow: 0 18px 40px -10px rgba(168, 85, 247, 0.65); }
.auth-submit:active { transform: translateY(1px); }

.auth-divider-label { display: flex; align-items: center; gap: 0.85rem; margin: 1.5rem 0 1.15rem; font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: #8b94ad; }
.auth-divider-label::before,
.auth-divider-label::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, rgba(140, 148, 173, 0.35), transparent); }

.auth-sso-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.82rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  color: #d6deef;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid rgba(120, 140, 200, 0.22);
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.18s, background 0.18s, color 0.18s;
}

.auth-sso-btn svg { width: 1.15rem; height: 1.15rem; flex-shrink: 0; }
.auth-sso-btn:hover { border-color: rgba(45, 212, 191, 0.55); background: rgba(45, 212, 191, 0.08); color: #eafffb; }
.auth-foot { margin-top: 1.6rem; text-align: center; font-size: 0.72rem; color: #566077; }

@media (prefers-reduced-motion: reduce) {
  .auth-submit { transition: none; }
}

.staff-checkbox { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 1rem; font-weight: 700; }
.staff-access-panel { grid-template-columns: 1fr; max-width: 640px; }

/* =====================================================================
   Settings page + modal
   ===================================================================== */

.settings-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
  max-width: 860px;
}

.settings-nav { display: flex; flex-direction: column; gap: 0.25rem; position: sticky; top: 1.5rem; }

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius);
  font-size: var(--text-base);
  color: var(--text-muted);
  text-decoration: none;
  transition: background var(--dur-fast), color var(--dur-fast);
  border: none;
  background: transparent;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.settings-nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.settings-nav-item:hover { background: var(--surface-2); color: var(--text); }
.settings-nav-item.active { background: var(--primary-soft); color: var(--primary-soft-fg); font-weight: var(--fw-medium); }
.settings-nav-item.active svg { color: var(--primary-soft-fg); }

.settings-section h2 { font-size: var(--text-lg); font-weight: var(--fw-semibold); color: var(--text); margin: 0 0 0.25rem; }
.settings-section-desc { font-size: var(--text-base); color: var(--text-muted); margin: 0 0 1.25rem; }

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  overflow: hidden;
}

.settings-card--danger { border-color: var(--danger-soft); }
.settings-field { padding: 1rem 1.25rem; }
.settings-field--action { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.settings-field-row { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; }
.settings-field-divider { height: 1px; background: var(--border-subtle); margin: 0 1.25rem; }
.settings-field-label { font-size: var(--text-base); font-weight: var(--fw-medium); color: var(--text); margin: 0 0 0.15rem; }
.settings-field-value { font-size: var(--text-base); color: var(--text-muted); margin: 0; }
.settings-field-hint { font-size: var(--text-sm); color: var(--text-subtle); margin: 0; }

.settings-avatar-large {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-violet));
  color: #fff;
  font-size: 16px;
  font-weight: var(--fw-bold);
  flex-shrink: 0;
  letter-spacing: 0.03em;
}

.settings-badge { display: inline-block; padding: 0.2rem 0.65rem; border-radius: var(--radius-pill); background: var(--primary-soft); color: var(--primary-soft-fg); font-size: 12.5px; font-weight: var(--fw-medium); }

.settings-btn-secondary {
  display: inline-block;
  padding: 0.45rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--dur-fast);
}

.settings-btn-secondary:hover { background: var(--surface-2); }

.settings-btn-danger {
  display: inline-block;
  padding: 0.45rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--danger-soft);
  background: var(--surface);
  color: var(--danger);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--dur-fast);
}

.settings-btn-danger:hover { background: var(--danger-soft); }

.settings-coming-soon { font-size: var(--text-xs); color: var(--text-subtle); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 0.2rem 0.65rem; white-space: nowrap; }
.settings-config-note { font-size: var(--text-sm); color: var(--text-subtle); margin-top: 0.5rem; }

/* theme segmented control */
.settings-theme-choices { display: inline-flex; gap: 0.4rem; }

.settings-theme-opt {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  font-family: inherit;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}

.settings-theme-opt svg { width: 15px; height: 15px; }
.settings-theme-opt:hover { background: var(--surface-2); }
.settings-theme-opt.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-soft-fg); }

/* ── Settings modal ── */

.settings-modal-overlay { position: fixed; inset: 0; z-index: 9000; display: flex; align-items: center; justify-content: center; }
.settings-modal-backdrop { position: absolute; inset: 0; background: var(--overlay); }

.settings-modal-dialog {
  position: relative;
  display: flex;
  width: min(820px, 96vw);
  height: min(580px, 92vh);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.settings-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
  padding: 0;
}

.settings-modal-close:hover { background: var(--surface-2); color: var(--text); }
.settings-modal-close svg { width: 16px; height: 16px; }

.settings-modal-sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.settings-modal-sidebar-label { font-size: 11px; font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-subtle); padding: 0 0.5rem; margin: 0 0 0.5rem; }

.settings-modal-nav-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: var(--text-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
  text-align: left;
  font-family: inherit;
}

.settings-modal-nav-item svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--text-subtle); }
.settings-modal-nav-item:hover { background: var(--surface-3); color: var(--text); }
.settings-modal-nav-item.active { background: var(--primary-soft); color: var(--primary-soft-fg); font-weight: var(--fw-medium); }
.settings-modal-nav-item.active svg { color: var(--primary-soft-fg); }

.settings-modal-content { flex: 1; overflow-y: auto; padding: 1.75rem 2rem; }
.settings-modal-pane { display: none; }
.settings-modal-section-title { font-size: var(--text-lg); font-weight: var(--fw-bold); color: var(--text); margin: 0 0 0.25rem; }
.settings-modal-section-desc { font-size: var(--text-sm); color: var(--text-muted); margin: 0 0 1.25rem; }

.settings-modal-back { display: inline-flex; align-items: center; gap: 0.35rem; border: none; background: transparent; font-size: var(--text-sm); color: var(--text-muted); cursor: pointer; padding: 0; font-family: inherit; transition: color var(--dur-fast); }
.settings-modal-back:hover { color: var(--primary); }

.settings-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  font-family: inherit;
}

.settings-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }

.settings-btn-primary {
  padding: 0.55rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--text-on-primary);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  font-family: inherit;
  transition: background var(--dur-fast);
}

.settings-btn-primary:hover { background: var(--primary-hover); }
.settings-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.settings-change-pwd-error { margin-top: 0.75rem; font-size: var(--text-sm); color: var(--danger); background: var(--danger-soft); border: 1px solid var(--danger-soft); border-radius: var(--radius-sm); padding: 0.45rem 0.7rem; }
.settings-change-pwd-success { margin-top: 0.75rem; font-size: var(--text-sm); color: var(--success-fg); background: var(--success-soft); border: 1px solid var(--success-soft); border-radius: var(--radius-sm); padding: 0.45rem 0.7rem; }
.settings-config-note code { background: var(--surface-2); border-radius: 4px; padding: 0.1rem 0.35rem; font-size: 12px; color: var(--text); font-family: var(--font-mono); }

/* ── Error toast ── */

.staff-error { margin-bottom: 1rem; padding: 0.8rem 1rem; border: 1px solid var(--danger-soft); border-radius: var(--radius); color: var(--danger-fg); background: var(--danger-soft); font-weight: var(--fw-semibold); }

/* =====================================================================
   Stat cards
   ===================================================================== */

.staff-stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }

.staff-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.staff-stat-card strong { display: block; font-size: 1.75rem; font-weight: var(--fw-bold); line-height: 1.1; letter-spacing: -0.02em; }
.staff-stat-card span { font-size: var(--text-base); color: var(--text-muted); font-weight: var(--fw-medium); margin-top: 0.25rem; display: block; }
.staff-stat-card--active strong { color: var(--success); }
.staff-stat-card--inactive strong { color: var(--text-subtle); }

/* ── Table panel header w/ search ── */

.staff-table-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; margin-bottom: 0; border-bottom: 1px solid var(--border); }
.staff-table-header h2 { margin: 0; font-size: var(--text-md); font-weight: var(--fw-bold); }

.staff-search-wrap { position: relative; display: flex; align-items: center; }
.staff-search-wrap svg { position: absolute; left: 0.65rem; width: 15px; height: 15px; color: var(--text-subtle); pointer-events: none; }

.staff-search-input {
  padding: 0.5rem 0.75rem 0.5rem 2.1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: var(--text-base);
  color: var(--text);
  background: var(--surface-2);
  width: 240px;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background var(--dur-fast);
  outline: none;
  font-family: inherit;
}

.staff-search-input:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px var(--ring); }

/* ── Avatar ── */

.staff-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-violet));
  color: #fff;
  font-size: 12px;
  font-weight: var(--fw-bold);
  flex-shrink: 0;
}

/* ── Status / role badges ── */

.staff-status--active { color: var(--success-fg) !important; background: var(--success-soft); }
.staff-status--inactive { color: var(--text-muted) !important; background: var(--surface-3); }

.staff-role-badge { display: inline-block; padding: 0.2rem 0.55rem; border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: var(--fw-semibold); background: var(--primary-soft); color: var(--primary-soft-fg); }

/* keep badges compact inside table cells — `.staff-table td span` sets display:block */
.staff-table td span.staff-status,
.staff-table td span.staff-role-badge {
  display: inline-flex;
  width: fit-content;
}

/* ── Action buttons ── */

.staff-table-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.4rem; }

.staff-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  background: var(--surface-2);
  color: var(--text);
  transition: background var(--dur-fast), border-color var(--dur-fast);
  white-space: nowrap;
}

.staff-action-btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.staff-action-btn svg { width: 13px; height: 13px; flex-shrink: 0; }
.staff-action-btn--danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.staff-action-btn--danger:hover { background: var(--danger-soft); border-color: var(--danger); }

/* dark surfaces sit too close together — lift the buttons off the row */
:root[data-theme="dark"] .staff-action-btn {
  background: var(--surface-3);
  border-color: var(--border-strong);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
:root[data-theme="dark"] .staff-action-btn:hover { background: #383d48; border-color: #4b525f; }
:root[data-theme="dark"] .staff-action-btn--danger {
  background: var(--danger-soft);
  border-color: rgba(239, 68, 68, 0.4);
}
:root[data-theme="dark"] .staff-action-btn--danger:hover { border-color: var(--danger); }

/* =====================================================================
   Modals
   ===================================================================== */

.staff-modal-overlay { position: fixed; inset: 0; z-index: 1050; display: flex; align-items: center; justify-content: center; }
.staff-modal-backdrop { position: absolute; inset: 0; background: var(--overlay); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }

.staff-modal-panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 440px;
  margin: 1rem;
  padding: 1.5rem;
}

.staff-modal-panel--sm { max-width: 380px; }
.staff-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.staff-modal-header h2 { margin: 0; font-size: var(--text-lg); font-weight: var(--fw-bold); }
.staff-modal-header h3 { margin: 0; font-size: var(--text-lg); font-weight: var(--fw-bold); }

.staff-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
  padding: 0;
}

.staff-modal-close:hover { background: var(--surface-2); color: var(--text); }
.staff-modal-close svg { width: 16px; height: 16px; }
.staff-modal-footer { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.5rem; }
.staff-modal-body { padding-top: 0.25rem; }
.staff-modal-panel--settings { max-width: 560px; }
.settings-section--placeholder { display: flex; align-items: center; justify-content: center; height: 200px; color: var(--text-subtle); font-size: var(--text-base); }

.staff-modal-icon-header { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }
.staff-modal-icon { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--radius-pill); background: var(--danger-soft); flex-shrink: 0; }
.staff-modal-icon svg { width: 18px; height: 18px; color: var(--danger); }
.staff-modal-icon-header h2 { margin: 0 0 0.25rem; font-size: var(--text-md); font-weight: var(--fw-bold); }
.staff-modal-icon-header p { margin: 0; font-size: var(--text-base); color: var(--text-muted); }

/* ── User cell ── */

.staff-user-cell { display: flex; align-items: center; gap: 0.65rem; }
.staff-user-cell-info strong { display: block; font-size: var(--text-base); }
.staff-user-cell-info span { font-size: var(--text-sm); color: var(--text-subtle); }

.staff-search-empty { display: none; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; padding: 3rem 2rem; color: var(--text-subtle); text-align: center; }
.staff-search-empty svg { width: 36px; height: 36px; margin-bottom: 0.5rem; }

/* =====================================================================
   Filter panel + toolbar + pagination
   ===================================================================== */

.staff-filter-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1.25rem; box-shadow: var(--shadow-sm); }
.staff-filter-panel-header { display: flex; align-items: center; gap: 0.5rem; font-size: var(--text-md); font-weight: var(--fw-semibold); color: var(--text); margin-bottom: 1rem; }
.staff-filter-panel-header svg { width: 16px; height: 16px; color: var(--primary); }
.staff-filter-row { display: flex; align-items: flex-end; gap: 0.75rem; flex-wrap: wrap; }
.staff-filter-group { display: flex; flex-direction: column; gap: 0.3rem; flex: 1; min-width: 160px; }
.staff-filter-group label { font-size: var(--text-xs); font-weight: var(--fw-semibold); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.staff-filter-actions { display: flex; justify-content: flex-end; align-items: center; gap: 0.5rem; margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--border-subtle); }

.staff-filter-group input {
  min-height: 38px;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: var(--text-base);
  color: var(--text);
  background: var(--surface-2);
  outline: none;
  font-family: inherit;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background var(--dur-fast);
}

.staff-filter-group select {
  min-height: 38px;
  padding: 0.45rem 2.25rem 0.45rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: var(--text-base);
  color: var(--text);
  background: var(--surface-2);
  outline: none;
  font-family: inherit;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background var(--dur-fast);
}

.staff-filter-group input:focus,
.staff-filter-group select:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px var(--ring); }

.staff-table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.staff-show-entries { display: flex; align-items: center; gap: 0.5rem; font-size: var(--text-base); color: var(--text-muted); }
.staff-show-entries select { padding: 0.25rem 2rem 0.25rem 0.5rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: var(--text-base); color: var(--text); background: var(--surface); cursor: pointer; }
.staff-table-info { font-size: var(--text-sm); color: var(--text-muted); }

.staff-pagination { display: flex; align-items: center; justify-content: space-between; padding-top: 0.85rem; border-top: 1px solid var(--border-subtle); margin-top: 0.5rem; flex-wrap: wrap; gap: 0.5rem; }
.staff-pagination-info { font-size: var(--text-sm); color: var(--text-muted); }
.staff-pagination-controls { display: flex; align-items: center; gap: 0.25rem; }

.staff-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}

.staff-page-btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.staff-page-btn--active { background: var(--primary); border-color: var(--primary); color: var(--text-on-primary); }
.staff-page-btn--active:hover { background: var(--primary-hover); }
.staff-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* =====================================================================
   Mobile topbar + sidebar overlay
   ===================================================================== */

.staff-topbar { display: none; }

.staff-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 40;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

@media (max-width: 768px) {
  .staff-sidebar-overlay:not([hidden]) { display: block; }
}

@media (max-width: 900px) {
  .staff-document-layout,
  .staff-login-panel,
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { flex-direction: row; flex-wrap: wrap; position: static; }
  .staff-content { padding: 1rem; }
  .staff-appbar { padding: 0 1rem; }
  .staff-page-header { flex-direction: column; }
}

@media (max-width: 768px) {
  .staff-layout-body { display: flex; flex-direction: column; grid-template-columns: unset; }

  .staff-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100dvh;
    width: 280px;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease-out);
    overflow-y: auto;
  }

  .staff-sidebar.mobile-open { transform: translateX(0); box-shadow: var(--shadow-xl); }
  .staff-sidebar-toggle { display: none; }
  .staff-appbar { display: none; }

  .staff-topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: 52px;
    padding: 0 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 30;
  }

  .staff-topbar-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
    outline: none;
    transition: background var(--dur-fast);
  }

  .staff-topbar-menu:hover { background: var(--surface-2); }
  .staff-topbar-menu svg { width: 20px; height: 20px; }
  .staff-topbar-title { font-size: var(--text-md); font-weight: var(--fw-bold); color: var(--text); }

  .staff-metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .staff-action-grid { grid-template-columns: 1fr; }
  .dash-kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .dash-grid-2,
  .dash-grid-a,
  .dash-grid-b,
  .dash-grid-c { grid-template-columns: 1fr !important; }
  .dash-pipe { grid-template-columns: repeat(2, 1fr); }
}

/* =====================================================================
   Notification modal
   ===================================================================== */

.staff-notify-overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 1100; display: flex; align-items: center; justify-content: center; }

.staff-notify-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

.staff-notify-icon { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.staff-notify-icon svg { width: 28px; height: 28px; }
.staff-notify-icon--success { background: var(--success-soft); }
.staff-notify-icon--success svg { stroke: var(--success); }
.staff-notify-icon--error { background: var(--danger-soft); }
.staff-notify-icon--error svg { stroke: var(--danger); }
.staff-notify-icon--warning { background: var(--warning-soft); }
.staff-notify-icon--warning svg { stroke: var(--warning); }
.staff-notify-title { font-size: var(--text-lg); font-weight: var(--fw-bold); color: var(--text); }
.staff-notify-message { font-size: var(--text-md); color: var(--text-muted); line-height: 1.5; }

.staff-notify-close {
  margin-top: 0.5rem;
  padding: 0.55rem 1.75rem;
  background: var(--primary);
  color: var(--text-on-primary);
  border: none;
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: background var(--dur-fast);
}

.staff-notify-close:hover { background: var(--primary-hover); }

/* =====================================================================
   Dashboard components
   ===================================================================== */

.dash-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }

.dash-kpi-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast);
}

.dash-kpi-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* Clickable KPI card: renders as an anchor but keeps the card's own typography. */
.dash-kpi-card--link { display: block; color: inherit; text-decoration: none; cursor: pointer; }
.dash-kpi-card--link:hover,
.dash-kpi-card--link:focus { color: inherit; text-decoration: none; }
.dash-kpi-card--link:hover .dash-kpi-label { color: var(--text); }
.dash-kpi-card--link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.dash-kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.9rem; }
.dash-kpi-label { font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-muted); }

.dash-kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary-soft-fg);
  flex-shrink: 0;
}

.dash-kpi-icon svg { width: 17px; height: 17px; }
.dash-kpi-icon--emerald { background: var(--success-soft); color: var(--success-fg); }
.dash-kpi-icon--violet { background: color-mix(in srgb, var(--accent-violet) 16%, transparent); color: var(--accent-violet); }
.dash-kpi-icon--amber { background: var(--warning-soft); color: var(--warning-fg); }

.dash-kpi-value { font-size: var(--text-3xl); font-weight: var(--fw-bold); letter-spacing: -0.02em; line-height: 1; color: var(--text); }
.dash-kpi-foot { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.65rem; font-size: var(--text-sm); color: var(--text-subtle); }

.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.35rem;
}

.dash-card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.dash-card-title { margin: 0; font-size: var(--text-md); font-weight: var(--fw-bold); color: var(--text); letter-spacing: -0.01em; }
.dash-card-sub { margin: 0.2rem 0 0; font-size: var(--text-sm); color: var(--text-muted); }

.dash-grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }

.dash-legend { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; margin-top: 0.5rem; }
.dash-legend-item { display: inline-flex; align-items: center; gap: 0.45rem; font-size: var(--text-sm); color: var(--text-muted); }
.dash-legend-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }

.dash-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; min-height: 200px; color: var(--text-subtle); text-align: center; }
.dash-empty svg { width: 34px; height: 34px; opacity: 0.7; }

/* ── page header + range picker ─────────────────────────────────── */
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.dash-range { display: inline-flex; padding: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-pill); }

.dash-range a {
  padding: 0.34rem 0.8rem;
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  text-decoration: none;
  transition: background var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}

.dash-range a:hover { color: var(--text); text-decoration: none; }
.dash-range a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

/* ── KPI extras: sparkline + delta chip ─────────────────────────── */
.dash-kpi-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 0.75rem; }
.dash-kpi-value { font-variant-numeric: tabular-nums; }
.dash-spark { flex-shrink: 0; min-height: 40px; }

.dash-delta {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.14rem 0.4rem;
  border-radius: var(--radius-xs);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
}

.dash-delta svg { width: 11px; height: 11px; }
.dash-delta--up { background: var(--success-soft); color: var(--success-fg); }
.dash-delta--down { background: var(--danger-soft); color: var(--danger-fg); }

/* ── layout grids ───────────────────────────────────────────────── */
.dash-grid-a { display: grid; grid-template-columns: 1.85fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.dash-grid-b { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.dash-grid-c { display: grid; grid-template-columns: 1fr 1.15fr; gap: 1rem; margin-bottom: 1.5rem; }

.dash-card-head { align-items: flex-start; }
.dash-card-link { font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--primary-soft-fg); white-space: nowrap; text-decoration: none; }
.dash-card-link:hover { text-decoration: underline; color: var(--primary-hover); }

.dash-legend-val { margin-left: auto; font-weight: var(--fw-semibold); color: var(--text); font-variant-numeric: tabular-nums; }
.dash-legend:has(.dash-legend-val) { flex-direction: column; gap: 0.5rem; }
.dash-legend:has(.dash-legend-val) .dash-legend-item { width: 100%; }

/* ── ingestion pipeline strip ───────────────────────────────────── */
.dash-pipe { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; }

.dash-pipe-cell {
  padding: 0.8rem 0.85rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.dash-pipe-num { font-size: var(--text-xl); font-weight: var(--fw-bold); line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
.dash-pipe-label { display: flex; align-items: center; gap: 0.35rem; margin-top: 0.4rem; font-size: var(--text-xs); color: var(--text-muted); }
.dash-pipe-cell--fail { background: var(--danger-soft); border-color: transparent; }
.dash-pipe-cell--fail .dash-pipe-num { color: var(--danger-fg); }

.dash-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* ── compact lists (gaps, health, activity feed) ────────────────── */
.dash-list { display: flex; flex-direction: column; }
.dash-list--spaced { margin-top: 1.1rem; }

.dash-list-item { display: flex; align-items: flex-start; gap: 0.7rem; padding: 0.7rem 0; border-bottom: 1px solid var(--border-subtle); }
.dash-list-item:last-child { border-bottom: 0; padding-bottom: 0; }
.dash-list:not(.dash-list--spaced) .dash-list-item:first-child { padding-top: 0; }

.dash-av {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-muted);
}

.dash-av svg { width: 13px; height: 13px; }

.dash-li-main { min-width: 0; flex: 1; }
.dash-li-title { font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-li-title--wrap { white-space: normal; }
.dash-li-sub { margin-top: 0.15rem; font-size: var(--text-xs); color: var(--text-subtle); }
.dash-li-right { flex-shrink: 0; font-size: var(--text-xs); color: var(--text-subtle); font-variant-numeric: tabular-nums; }

/* ── status pills ───────────────────────────────────────────────── */
.dash-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.16rem 0.48rem;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}

.dash-pill--ok { background: var(--success-soft); color: var(--success-fg); }
.dash-pill--warn { background: var(--warning-soft); color: var(--warning-fg); }
.dash-pill--danger { background: var(--danger-soft); color: var(--danger-fg); }
.dash-pill--info { background: var(--info-soft); color: var(--info-fg); }

/* =====================================================================
   Skeleton loading
   ===================================================================== */

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 60%, transparent), transparent);
  animation: skeleton-shimmer 1.4s infinite;
}

@keyframes skeleton-shimmer { 100% { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skeleton::after { animation: none; } }

/* =====================================================================
   DataTables responsive + flatpickr theming
   ===================================================================== */

.staff-table-panel { overflow-x: auto; }

@media (max-width: 640px) {
  .dt-layout-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
  .dt-layout-start,
  .dt-layout-end { flex: 1 1 100%; }
  .dt-layout-end .dt-paging { display: flex; justify-content: center; }
  .dataTables_scrollBody,
  .dataTables_scroll { min-width: 0 !important; }
}

/* DataTables text picks up theme */
.dataTables_wrapper,
.dt-container { color: var(--text-muted); }
table.dataTable tbody td { color: var(--text); }

/* Pagination — remap Bootstrap's pagination variables onto design tokens so
   the pager matches the admin theme (surface buttons, token borders, primary
   active) in both light and dark instead of Bootstrap's white/#0d6efd. */
.dt-container .pagination {
  --bs-pagination-color: var(--text-muted);
  --bs-pagination-bg: var(--surface);
  --bs-pagination-border-color: var(--border);
  --bs-pagination-border-radius: var(--radius-sm);
  --bs-pagination-hover-color: var(--text);
  --bs-pagination-hover-bg: var(--surface-2);
  --bs-pagination-hover-border-color: var(--border-strong);
  --bs-pagination-focus-color: var(--text);
  --bs-pagination-focus-bg: var(--surface-2);
  --bs-pagination-focus-box-shadow: 0 0 0 3px var(--ring);
  --bs-pagination-active-color: var(--text-on-primary);
  --bs-pagination-active-bg: var(--primary);
  --bs-pagination-active-border-color: var(--primary);
  --bs-pagination-disabled-color: var(--text-subtle);
  --bs-pagination-disabled-bg: var(--surface);
  --bs-pagination-disabled-border-color: var(--border-subtle);
  --bs-pagination-font-size: var(--text-sm);
  --bs-pagination-padding-x: 0.7rem;
  --bs-pagination-padding-y: 0.4rem;
  gap: 0;
}
.dt-container .pagination .page-link {
  font-weight: var(--fw-semibold);
  transition: color var(--dur-fast), background-color var(--dur-fast),
    border-color var(--dur-fast), box-shadow var(--dur-fast);
}

/* Processing / loading indicator — the Bootstrap5 integration renders this as a
   plain `.card` with Bootstrap's blue dots centred on the whole panel, which
   ignores the design tokens and floats over the toolbar and pager. We suppress
   it entirely; datatable-loading.js instead inserts a full-width row at the top
   of the tbody, so the loader reads as part of the table and the header and
   pager stay untouched. */
div.dt-processing {
  display: none !important;
}

/* The stale rows stay in the DOM (column widths depend on them) but are hidden
   for the duration of the draw. */
table.dataTable > tbody > tr.staff-dt-row-hidden {
  display: none;
}

table.dataTable > tbody > tr.staff-dt-loading-row > td {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.staff-dt-loading {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
}

.staff-dt-spinner {
  flex: none;
  width: 1rem;
  height: 1rem;
  border: 2px solid color-mix(in srgb, var(--primary) 25%, transparent);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: staff-dt-spin 0.6s linear infinite;
}

@keyframes staff-dt-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .staff-dt-spinner { animation-duration: 2s; }
}

[x-cloak] { display: none !important; }

/* ── Sidebar collapsed init (pre-CSS, prevents FOUC) ── */
.sidebar-collapsed-init .staff-layout-body { grid-template-columns: 68px minmax(0, 1fr); }
.sidebar-collapsed-init [data-staff-sidebar] { width: 68px; }
.sidebar-collapsed-init [data-staff-sidebar] .staff-nav-label,
.sidebar-collapsed-init [data-staff-sidebar] .staff-brand-label,
.sidebar-collapsed-init [data-staff-sidebar] .staff-user-info,
.sidebar-collapsed-init [data-staff-sidebar] .staff-user-chevron { display: none; }
.sidebar-collapsed-init [data-staff-toggle] { opacity: 0; pointer-events: none; }

/* ── flatpickr — theme-aware ── */
.flatpickr-calendar { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); color: var(--text); }
.flatpickr-day { color: var(--text); }
.flatpickr-day.flatpickr-disabled,
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay { color: var(--text-subtle); }
.flatpickr-day:hover { background: var(--surface-2); border-color: var(--surface-2); }
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.flatpickr-day.inRange { background: var(--primary-soft); border-color: var(--primary-soft); box-shadow: -5px 0 0 var(--primary-soft), 5px 0 0 var(--primary-soft); }
.flatpickr-day.today { border-color: var(--primary); }
.flatpickr-months .flatpickr-month,
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-weekday { color: var(--text); fill: var(--text); }
.flatpickr-months .flatpickr-prev-month svg,
.flatpickr-months .flatpickr-next-month svg { fill: var(--text-muted); }
span.flatpickr-weekday { color: var(--text-subtle); }
.flatpickr-calendar.arrowTop::before,
.flatpickr-calendar.arrowTop::after { border-bottom-color: var(--surface); }
