/* ══════════════════════════════════════════════════════════════
   ClearPath Suite — MAIN STYLESHEET
   Production-ready enterprise UI
   Primary: #E8192C (WFS Red) | Dark: #1A0A0B | White: #FFFFFF
══════════════════════════════════════════════════════════════ */

/* ── RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #F5F5F6;
  color: #1A0A0B;
  line-height: 1.5;
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; cursor: pointer; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
img { max-width: 100%; }
ul, ol { list-style: none; }
hr { border: none; border-top: 1px solid #E2E8F0; margin: 12px 0; }

/* ── CSS VARIABLES ─────────────────────────────────────────── */
:root {
  /* ── WFS BRAND REDS ── */
  --wfs-900: #6B0010;
  --wfs-800: #A0001A;
  --wfs-700: #C8001F;
  --wfs-600: #E8192C;
  --wfs-500: #E8192C;
  --wfs-400: #F24A5A;
  --wfs-300: #F47C88;
  --wfs-200: #F8B0B7;
  --wfs-100: #FFE4E7;
  --wfs-50:  #FFF5F6;

  /* Keep --blue-* as aliases so all existing JS-generated inline styles work */
  --blue-900: #6B0010;
  --blue-800: #A0001A;
  --blue-700: #E8192C;
  --blue-600: #E8192C;
  --blue-500: #FF3347;
  --blue-400: #FF6677;
  --blue-200: #FFBBC2;
  --blue-100: #FFE4E7;
  --blue-50:  #FFF5F6;

  --gold-500: #FFD700;
  --gold-600: #F5C800;
  --gold-400: #FFE033;
  --gold-100: #FFF9D9;

  --green-700: #155724;
  --green-600: #1B6B2E;
  --green-500: #2E7D32;
  --green-400: #43A047;
  --green-300: #81C784;
  --green-200: #C8E6C9;
  --green-100: #E8F5E9;
  --green-800: #1B5E20;

  /* Purple palette (used by KPI forecast, inbox, admin, CAPA) */
  --purple-900: #311B92;
  --purple-800: #4527A0;
  --purple-700: #512DA8;
  --purple-600: #673AB7;
  --purple-500: #7C4DFF;
  --purple-400: #9C6FFF;
  --purple-300: #B39DDB;
  --purple-200: #D1C4E9;
  --purple-100: #EDE7F6;
  --purple-50:  #F3E5F5;

  --red-700: #7F0000;
  --red-600: #B71C1C;
  --red-500: #C62828;
  --red-400: #D32F2F;
  --red-100: #FFEBEE;
  --red-50:  #FFF5F5;

  --amber-700: #BF360C;
  --amber-600: #E65100;
  --amber-500: #F57C00;
  --amber-400: #FB8C00;
  --amber-300: #FFCC80;
  --amber-200: #FFE0B2;
  --amber-100: #FFF3E0;
  --amber-50:  #FFF8E1;

  --grey-900: #1A0A0B;
  --grey-800: #2B1417;
  --grey-700: #3D1D21;
  --grey-600: #5C3038;
  --grey-500: #7A5860;
  --grey-400: #9E8388;
  --grey-300: #C4AEB2;
  --grey-200: #DDD0D2;
  --grey-150: #EADFE0;
  --grey-100: #F2ECED;
  --grey-50:  #F8F4F5;

  --nav-h: 56px;
  --sidebar-w: 230px;
  --sidebar-collapsed: 60px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 3px rgba(232,25,44,.08);
  --shadow:    0 2px 8px rgba(232,25,44,.12);
  --shadow-md: 0 4px 16px rgba(232,25,44,.12);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.16);
  --transition: all .18s cubic-bezier(.4,0,.2,1);

  /* Surface / background tokens — overridden in dark mode */
  --surface-bg:      #F5F5F6;
  --surface-card:    #FFFFFF;
  --surface-sidebar: #FFFFFF;
  --surface-nav:     #1A0A0B;
  --surface-input:   #FFFFFF;
  --text-primary:    #1A0A0B;
  --text-secondary:  #5C3038;
  --text-muted-var:  #9E8388;
  --border-color:    #E2E8F0;
  --border-light:    var(--grey-150);
}

/* ══════════════════════════════════════════════════════════════
   DARK MODE — applied when html.dark-mode class is present
   Palette: neutral slate (not maroon). WFS red is accent only.
   ─────────────────────────────────────────────────────────────
   Layer scale (light → dark):
     dm-1  #0F1117  page background
     dm-2  #161B22  sidebar / top-nav
     dm-3  #1C2128  card / modal / kanban col
     dm-4  #22272E  card header / table header / filter bar
     dm-5  #2D333B  input / textarea / select
     dm-6  #373E47  hover / active row
     dm-7  #444C56  border (default)
     dm-8  #768390  muted text
     dm-9  #ADBAC7  secondary text
     dm-10 #CDD9E5  primary text
     dm-11 #E6EDF3  headings
══════════════════════════════════════════════════════════════ */

html.dark-mode {
  /* ── Surface tokens ── */
  --surface-bg:      #0F1117;
  --surface-card:    #1C2128;
  --surface-sidebar: #161B22;
  --surface-nav:     #161B22;
  --surface-input:   #2D333B;
  --surface-raised:  #22272E;   /* card headers, table heads */

  /* ── Text tokens ── */
  --text-primary:    #CDD9E5;
  --text-secondary:  #ADBAC7;
  --text-muted-var:  #768390;

  /* ── Border tokens ── */
  --border-color:    #373E47;
  --border-light:    #2D333B;

  /* ── Remap grey scale to neutral dark slate ── */
  --grey-900: #E6EDF3;
  --grey-800: #CDD9E5;
  --grey-700: #ADBAC7;
  --grey-600: #768390;
  --grey-500: #636E7B;
  --grey-400: #545D68;
  --grey-300: #444C56;
  --grey-200: #373E47;
  --grey-150: #2D333B;
  --grey-100: #22272E;
  --grey-50:  #1C2128;

  /* ── Shadow tokens — softer for dark ── */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --shadow:    0 2px 8px rgba(0,0,0,.45);
  --shadow-md: 0 4px 16px rgba(0,0,0,.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.6);

  color-scheme: dark;
}

/* ── Base ───────────────────────────────────────────────────── */
html.dark-mode body {
  background: var(--surface-bg);
  color: var(--text-primary);
}

/* ── Typography ─────────────────────────────────────────────── */
html.dark-mode h1,
html.dark-mode h2,
html.dark-mode h3,
html.dark-mode h4,
html.dark-mode h5,
html.dark-mode h6          { color: #E6EDF3; }
html.dark-mode p           { color: var(--text-primary); }
html.dark-mode .text-muted { color: var(--text-muted-var); }
html.dark-mode .text-sm    { color: var(--text-secondary); }

/* ── Navigation ─────────────────────────────────────────────── */
html.dark-mode .top-nav {
  background: var(--surface-nav);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 1px 0 rgba(0,0,0,.3);
}
html.dark-mode .sidebar {
  background: var(--surface-sidebar);
  border-right: 1px solid var(--border-color);
}
html.dark-mode .nav-section-label { color: var(--text-muted-var); }
html.dark-mode .nav-label         { color: var(--text-secondary); }
html.dark-mode .nav-item {
  color: var(--text-secondary);
}
html.dark-mode .nav-item:hover {
  background: rgba(232,25,44,.10);
  color: var(--text-primary);
}
html.dark-mode .nav-item.active {
  background: rgba(232,25,44,.14);
  color: #E8192C;
}
html.dark-mode .nav-item.active .nav-label { color: #E8192C; }
html.dark-mode .brand-sub { color: rgba(255,255,255,.55); }

/* ── Cards & surfaces ───────────────────────────────────────── */
html.dark-mode .card,
html.dark-mode .modal-box,
html.dark-mode .stat-card,
html.dark-mode .kanban-col,
html.dark-mode .task-card,
html.dark-mode .project-card,
html.dark-mode .kpi-card,
html.dark-mode .doc-card,
html.dark-mode .report-template-card,
html.dark-mode .a3-cell,
html.dark-mode .alert-item {
  background: var(--surface-card);
  border-color: var(--border-color);
  box-shadow: var(--shadow-sm);
}
html.dark-mode .auth-card {
  background: var(--surface-card);
  border-color: var(--border-color);
  box-shadow: 0 24px 64px rgba(0,0,0,.6), 0 4px 20px rgba(0,0,0,.4);
}
html.dark-mode .card-header {
  background: var(--surface-raised);
  border-bottom-color: var(--border-color);
}
html.dark-mode .card-footer {
  background: var(--surface-raised);
  border-top-color: var(--border-color);
}
html.dark-mode .card-body     { background: var(--surface-card); }

/* ── Modal ───────────────────────────────────────────────────── */
html.dark-mode .modal-header {
  background: var(--surface-raised);
  border-bottom-color: var(--border-color);
}
html.dark-mode .modal-header h3 { color: #E6EDF3; }
html.dark-mode .modal-footer {
  background: var(--surface-raised);
  border-top-color: var(--border-color);
}
html.dark-mode .modal-overlay { background: rgba(0,0,0,.65); }

/* ── Page titles ─────────────────────────────────────────────── */
html.dark-mode .page-title    { color: #E6EDF3; }
html.dark-mode .page-subtitle { color: var(--text-secondary); }
html.dark-mode .module-header h1 { color: #E6EDF3; }
html.dark-mode .module-header p  { color: var(--text-secondary); }

/* ── Stat cards ──────────────────────────────────────────────── */
html.dark-mode .stat-label { color: var(--text-muted-var); }
html.dark-mode .stat-value { color: #E6EDF3; }
html.dark-mode .stat-delta { color: var(--text-secondary); }

/* ── Tables ──────────────────────────────────────────────────── */
html.dark-mode .table-wrap table thead tr {
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border-color);
}
html.dark-mode .table-wrap table th {
  color: var(--text-muted-var);
  border-bottom-color: var(--border-color);
  font-weight: 600;
  letter-spacing: .03em;
}
html.dark-mode .table-wrap table td {
  color: var(--text-primary);
  border-bottom-color: var(--border-light);
}
html.dark-mode .table-wrap table tbody tr:hover {
  background: var(--surface-raised);
}
html.dark-mode .data-table th  { color: var(--text-muted-var); background: var(--surface-raised); }
html.dark-mode .data-table td  { color: var(--text-primary); border-bottom-color: var(--border-light); }
html.dark-mode .data-table tbody tr:hover { background: var(--surface-raised); }

/* ── Filter bar ──────────────────────────────────────────────── */
html.dark-mode .filter-bar {
  background: var(--surface-card);
  border-color: var(--border-color);
}
html.dark-mode .filter-bar select,
html.dark-mode .filter-bar input,
html.dark-mode .table-search-input {
  background: var(--surface-input);
  color: var(--text-primary);
  border-color: var(--border-color);
}

/* ── Form inputs ─────────────────────────────────────────────── */
html.dark-mode input,
html.dark-mode textarea,
html.dark-mode select {
  background: var(--surface-input);
  color: var(--text-primary);
  border-color: var(--border-color);
}
html.dark-mode input:focus,
html.dark-mode textarea:focus,
html.dark-mode select:focus {
  border-color: #E8192C;
  box-shadow: 0 0 0 3px rgba(232,25,44,.18);
  outline: none;
}
html.dark-mode input::placeholder,
html.dark-mode textarea::placeholder {
  color: var(--text-muted-var);
}
html.dark-mode input[disabled],
html.dark-mode textarea[disabled],
html.dark-mode select[disabled] {
  background: var(--surface-raised);
  color: var(--text-muted-var);
  opacity: .7;
}
html.dark-mode .field-group label { color: var(--text-secondary); font-weight: 500; }
html.dark-mode .form-section      { color: var(--text-secondary); }

/* ── Tabs ────────────────────────────────────────────────────── */
html.dark-mode .tabs         { border-bottom-color: var(--border-color); }
html.dark-mode .tab-btn      { color: var(--text-muted-var); }
html.dark-mode .tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,.05);
}
html.dark-mode .tab-btn.active {
  color: #E8192C;
  border-bottom-color: #E8192C;
  background: rgba(232,25,44,.06);
}

/* ── Buttons ─────────────────────────────────────────────────── */
html.dark-mode .btn-secondary,
html.dark-mode .btn-ghost {
  background: var(--surface-input);
  color: var(--text-primary);
  border-color: var(--border-color);
}
html.dark-mode .btn-secondary:hover,
html.dark-mode .btn-ghost:hover {
  background: var(--border-color);
  color: #E6EDF3;
}
html.dark-mode .tbl-btn {
  background: var(--surface-raised);
  color: var(--text-secondary);
  border-color: var(--border-color);
}
html.dark-mode .tbl-btn:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

/* ── Badges & pills ──────────────────────────────────────────── */
html.dark-mode .badge,
html.dark-mode .status-pill { opacity: 0.92; }

/* info-box variants */
html.dark-mode .info-box        { background: rgba(255,255,255,.04); border-color: var(--border-color); color: var(--text-secondary); }
html.dark-mode .info-box.blue   { background: rgba(232,25,44,.08);  border-color: rgba(232,25,44,.3);  color: #F47C88; }
html.dark-mode .info-box.green  { background: rgba(46,125,50,.12);  border-color: rgba(46,125,50,.35); color: #81C784; }
html.dark-mode .info-box.amber  { background: rgba(245,124,0,.10);  border-color: rgba(245,124,0,.3);  color: #FFCC80; }
html.dark-mode .info-box.red    { background: rgba(198,40,40,.12);  border-color: rgba(198,40,40,.35); color: #EF9A9A; }
html.dark-mode .info-box.purple { background: rgba(124,77,255,.10); border-color: rgba(124,77,255,.3); color: #B39DDB; }
html.dark-mode .info-box.orange { background: rgba(230,81,0,.10);   border-color: rgba(230,81,0,.3);   color: #FFCC80; }

/* ── Kanban ───────────────────────────────────────────────────── */
html.dark-mode .kanban-col        { background: var(--surface-card); border-color: var(--border-color); }
html.dark-mode .kanban-col-header { color: var(--text-secondary); background: var(--surface-raised); }
html.dark-mode .kanban-count      { background: var(--border-color); color: var(--text-secondary); }

/* ── Progress ────────────────────────────────────────────────── */
html.dark-mode .progress-track { background: var(--border-color); }

/* ── Pagination ──────────────────────────────────────────────── */
html.dark-mode .page-btn           { color: var(--text-secondary); border-color: var(--border-color); background: var(--surface-card); }
html.dark-mode .page-btn:hover     { background: var(--surface-raised); color: var(--text-primary); }
html.dark-mode .page-btn.active    { background: #E8192C; color: #fff; border-color: #E8192C; }

/* ── Dropdown / user menu ────────────────────────────────────── */
html.dark-mode .user-dropdown    { background: var(--surface-card); border: 1px solid var(--border-color); box-shadow: var(--shadow-lg); }
html.dark-mode .dd-name          { color: #E6EDF3; }
html.dark-mode .dd-email         { color: var(--text-muted-var); }
html.dark-mode .dd-role          { color: var(--text-secondary); }
html.dark-mode .dd-item          { color: var(--text-secondary); }
html.dark-mode .dd-item:hover    { background: var(--surface-raised); color: var(--text-primary); }
html.dark-mode .dd-divider       { border-color: var(--border-color); }
html.dark-mode .search-dropdown  { background: var(--surface-card); border: 1px solid var(--border-color); box-shadow: var(--shadow-lg); }

/* ── Card text ───────────────────────────────────────────────── */
html.dark-mode .card-title        { color: #E6EDF3; }
html.dark-mode .ranking-site      { color: var(--text-primary); }
html.dark-mode .alert-title       { color: #E6EDF3; }
html.dark-mode .alert-desc,
html.dark-mode .alert-meta        { color: var(--text-secondary); }
html.dark-mode .activity-text     { color: var(--text-primary); }
html.dark-mode .project-name      { color: #E6EDF3; }
html.dark-mode .project-meta-label,
html.dark-mode .project-meta-value { color: var(--text-secondary); }
html.dark-mode .kpi-name          { color: #E6EDF3; }
html.dark-mode .kpi-val-num       { color: #E6EDF3; }
html.dark-mode .kpi-val-label,
html.dark-mode .kpi-formula       { color: var(--text-muted-var); }
html.dark-mode .task-title        { color: #E6EDF3; }
html.dark-mode .task-assignee,
html.dark-mode .task-due          { color: var(--text-secondary); }

/* ── Activity & alert rows ───────────────────────────────────── */
html.dark-mode .activity-item,
html.dark-mode .alert-item { border-bottom-color: var(--border-light); }

/* ── Priority actions (dashboard) ───────────────────────────── */
html.dark-mode .priority-action          { background: var(--surface-card);         border-color: var(--border-color); }
html.dark-mode .priority-action.critical { background: rgba(198,40,40,.13);          border-color: rgba(198,40,40,.35); }
html.dark-mode .priority-action.warning  { background: rgba(245,124,0,.10);          border-color: rgba(245,124,0,.3);  }
html.dark-mode .priority-action.info     { background: rgba(29,78,216,.10);          border-color: rgba(59,130,246,.25); }

/* ── Dashboard UI ────────────────────────────────────────────── */
html.dark-mode .dash-date-bar     { background: var(--surface-card); border-color: var(--border-color); }
html.dark-mode .dash-date-pill    { background: var(--surface-input); border-color: var(--border-color); color: var(--text-secondary); }
html.dark-mode .dash-date-pill:hover { background: var(--border-color); color: var(--text-primary); }
html.dark-mode .dash-date-pill.active { background: #E8192C; color: #fff; border-color: #E8192C; }
html.dark-mode .dash-fav-bar      { background: var(--surface-card); border-color: var(--border-color); }
html.dark-mode .dash-fav-chip     { background: var(--surface-input); border-color: var(--border-color); color: var(--text-primary); }
html.dark-mode .dash-fav-chip:hover { background: var(--border-color); }
html.dark-mode .health-score-ring { border-color: var(--border-color); }

/* ── Misc UI ─────────────────────────────────────────────────── */
html.dark-mode .bulk-action-bar   { background: var(--surface-raised); border-color: var(--border-color); }
html.dark-mode kbd                { background: var(--surface-input) !important; border-color: var(--border-color) !important; color: var(--text-primary) !important; }
html.dark-mode .empty-state h3    { color: var(--text-secondary); }
html.dark-mode .empty-state p     { color: var(--text-muted-var); }
html.dark-mode .bench-matrix table th:first-child,
html.dark-mode .bench-matrix table td:first-child { background: var(--surface-card); }
html.dark-mode .section-divider   { border-color: var(--border-color); }
html.dark-mode .spinner           { border-top-color: #E8192C; border-color: var(--border-color); }
html.dark-mode code,
html.dark-mode pre                { background: var(--surface-raised); color: #CDD9E5; border-color: var(--border-color); }
html.dark-mode .tooltip           { background: #22272E; color: #CDD9E5; border-color: var(--border-color); }

/* ── Settings page ───────────────────────────────────────────── */
html.dark-mode .settings-section  { border-color: var(--border-color); }
html.dark-mode .settings-label    { color: var(--text-secondary); }
html.dark-mode .settings-row      { border-bottom-color: var(--border-light); }

/* ── User row (settings / admin) ────────────────────────────── */
html.dark-mode .user-row          { background: var(--surface-card); border-color: var(--border-color); }
html.dark-mode .user-row:hover    { background: var(--surface-raised); }
html.dark-mode .user-name         { color: #E6EDF3; }
html.dark-mode .user-email,
html.dark-mode .user-role         { color: var(--text-secondary); }

/* Transition for smooth dark mode switch */
body, .card, .modal-box, .sidebar, .top-nav, .stat-card, .filter-bar, .table-wrap, input, textarea, select, .kanban-col, .task-card {
  transition: background-color .25s ease, border-color .25s ease, color .2s ease;
}

/* ── UTILITY ───────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--grey-400); }
.text-sm { font-size: .82rem; }
.text-xs { font-size: .74rem; }
.text-lg { font-size: 1.1rem; }
.text-xl { font-size: 1.25rem; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }

/* ── AUTH SCREEN ───────────────────────────────────────────── */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #8B0010 0%, #C8001F 35%, #E8192C 65%, #B0001C 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.auth-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(255,255,255,.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(0,0,0,.15) 0%, transparent 60%);
  pointer-events: none;
}
.auth-screen::after {
  content: '';
  position: absolute;
  top: -200px; right: -200px;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  pointer-events: none;
}
.auth-card {
  background: #fff;
  border-radius: var(--radius-xl);
  padding: 40px 44px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 24px 64px rgba(0,0,0,.35), 0 4px 20px rgba(0,0,0,.2);
  position: relative;
  z-index: 1;
  border-top: 4px solid var(--wfs-600);
}
.setup-card { max-width: 560px; }
.auth-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--grey-150);
}
.logo-img { height: 44px; width: auto; }
.auth-logo-text { display: flex; flex-direction: column; line-height: 1.25; }
.logo-wordmark { font-size: 1.6rem; font-weight: 900; color: var(--wfs-600); letter-spacing: 1px; text-transform: uppercase; }
.logo-tagline { font-size: .68rem; font-weight: 700; color: var(--grey-400); letter-spacing: 2px; text-transform: uppercase; }
.logo-text {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--wfs-600);
  letter-spacing: .5px;
}
.auth-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--grey-900);
  margin-bottom: 6px;
}
.auth-subtitle { color: var(--grey-500); font-size: .9rem; margin-bottom: 24px; line-height: 1.5; }
.setup-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--wfs-100);
  color: var(--wfs-700);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: .78rem;
  font-weight: 700;
  margin-bottom: 14px;
  letter-spacing: .3px;
}

/* ── FORCE PASSWORD RESET CARD ───────────────────────────── */
.force-reset-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #FFF7ED;
  border: 1.5px solid #FED7AA;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 22px;
}
.force-reset-banner-icon {
  font-size: 1.3rem;
  color: #EA580C;
  margin-top: 2px;
  flex-shrink: 0;
}
.force-reset-banner-title {
  font-size: .9rem;
  font-weight: 700;
  color: #9A3412;
  margin-bottom: 4px;
}
.force-reset-banner-sub {
  font-size: .8rem;
  color: #C2410C;
  line-height: 1.5;
}

html.dark-mode .force-reset-banner {
  background: rgba(234, 88, 12, .12);
  border-color: rgba(234, 88, 12, .35);
}
html.dark-mode .force-reset-banner-title { color: #FB923C; }
html.dark-mode .force-reset-banner-sub   { color: #FDBA74; }

/* ── APP SHELL LAYOUT ─────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── TOP NAV ───────────────────────────────────────────────── */
.top-nav {
  height: var(--nav-h);
  background: linear-gradient(90deg, #C8001F 0%, #E8192C 60%, #D41025 100%);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(200,0,31,.4), 0 1px 4px rgba(0,0,0,.2);
}
.nav-left { display: flex; align-items: center; gap: 12px; min-width: var(--sidebar-w); }
.sidebar-toggle {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.75);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.sidebar-toggle:hover { background: rgba(255,255,255,.1); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { height: 34px; width: auto; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 1rem; font-weight: 900; color: #fff; line-height: 1; letter-spacing: 1px; text-transform: uppercase; }
.brand-sub { font-size: .62rem; color: rgba(255,255,255,.75); letter-spacing: 1.5px; text-transform: uppercase; font-weight: 600; }

.nav-center { flex: 1; display: flex; justify-content: center; align-items: center; gap: 10px; }
.global-search-wrap { position: relative; width: 100%; max-width: 480px; }
.cmd-k-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 20px;
  color: rgba(255,255,255,.8);
  padding: 5px 12px;
  font-size: .78rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.cmd-k-btn:hover { background: rgba(255,255,255,.18); color: #fff; }
.cmd-k-btn kbd { font-family: 'Inter', sans-serif; font-size: .7rem; font-weight: 600; background: rgba(255,255,255,.15); border-radius: 4px; padding: 1px 5px; border: 1px solid rgba(255,255,255,.2); }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,.5); font-size: .85rem; pointer-events: none; }
.global-search {
  width: 100%;
  padding: 8px 14px 8px 36px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 20px;
  color: #fff;
  font-size: .88rem;
  transition: var(--transition);
}
.global-search::placeholder { color: rgba(255,255,255,.45); }
.global-search:focus {
  outline: none;
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.4);
}
.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 360px;
  overflow-y: auto;
  z-index: 2000;
}

.nav-right { display: flex; align-items: center; gap: 6px; }
.nav-icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.75);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  position: relative;
}
.nav-icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-icon-btn .badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 16px; height: 16px;
  background: var(--gold-500);
  color: #000;
  border-radius: 8px;
  font-size: .65rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px;
  border-radius: 20px;
  color: rgba(255,255,255,.85);
  transition: var(--transition);
}
.user-chip:hover { background: rgba(255,255,255,.1); color: #fff; }
.user-chip .fa-chevron-down { font-size: .7rem; opacity: .7; }

/* Site chip in top-nav */
.site-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.9);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .02em;
  border: 1px solid rgba(255,255,255,.2);
  transition: var(--transition);
  white-space: nowrap;
}
.site-chip:hover { background: rgba(255,255,255,.2); }
.site-chip .fa-map-marker-alt { font-size: .68rem; opacity: .8; }
@media (max-width: 600px) { .site-chip { display: none !important; } }
.user-avatar {
  width: 30px; height: 30px;
  background: rgba(255,255,255,.2);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
  border: 1.5px solid rgba(255,255,255,.35);
}
.user-avatar.lg { width: 40px; height: 40px; font-size: 1rem; background: var(--wfs-100); color: var(--wfs-600); border: none; }
.user-name { font-size: .88rem; font-weight: 500; }
.user-menu-wrap { position: relative; }
.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 240px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  padding: 8px 0;
}
.user-dropdown-header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.dd-name { font-weight: 600; font-size: .9rem; color: var(--grey-900); }
.dd-role { font-size: .75rem; color: var(--wfs-600); font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.dd-email { font-size: .75rem; color: var(--grey-400); }
.dd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  font-size: .88rem;
  color: var(--grey-800);
  transition: var(--transition);
}
.dd-item:hover { background: var(--grey-50); color: var(--wfs-600); }
.dd-item.danger:hover { color: var(--red-500); background: var(--red-100); }
.dd-item i { width: 16px; text-align: center; color: var(--grey-400); }
.dd-item:hover i { color: inherit; }

/* ── SIDEBAR ───────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--nav-h));
  background: #fff;
  border-right: 1px solid var(--grey-150);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width .22s cubic-bezier(.4,0,.2,1);
  z-index: 900;
  box-shadow: 2px 0 12px rgba(0,0,0,.06);
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 0; }
.nav-section { margin-bottom: 4px; }
.nav-section-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--grey-300);
  padding: 8px 16px 4px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity .15s;
}
.sidebar.collapsed .nav-section-label { opacity: 0; pointer-events: none; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--grey-600);
  font-size: .88rem;
  font-weight: 500;
  border-radius: 0;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  white-space: nowrap;
}
.nav-item:hover { background: var(--wfs-50); color: var(--wfs-600); }
.nav-item.active {
  background: var(--wfs-50);
  color: var(--wfs-600);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--wfs-600);
  border-radius: 0 2px 2px 0;
}
.nav-item i { width: 18px; text-align: center; font-size: .9rem; flex-shrink: 0; }
.nav-item span { transition: opacity .15s; }
.sidebar.collapsed .nav-item span { opacity: 0; pointer-events: none; width: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--gold-500);
  color: #000;
  border-radius: 10px;
  padding: 2px 7px;
  font-size: .65rem;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}
.sidebar.collapsed .nav-badge { display: none; }
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--grey-150);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.system-health { display: flex; align-items: center; gap: 6px; font-size: .75rem; color: var(--grey-500); }
.health-dot { width: 8px; height: 8px; border-radius: 50%; }
.health-dot.online { background: var(--green-400); box-shadow: 0 0 6px rgba(67,160,71,.6); }
.sidebar-version { font-size: .7rem; color: var(--grey-300); }
.sidebar.collapsed .sidebar-footer { justify-content: center; }
.sidebar.collapsed .system-health span,
.sidebar.collapsed .sidebar-version { display: none; }

/* ── MAIN CONTENT ─────────────────────────────────────────── */
.main-content {
  margin-top: var(--nav-h);
  margin-left: var(--sidebar-w);
  min-height: calc(100vh - var(--nav-h));
  transition: margin-left .22s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
}
.main-content.sidebar-collapsed { margin-left: var(--sidebar-collapsed); }
.module-container { padding: 24px; min-height: calc(100vh - var(--nav-h)); }

/* ── PAGE HEADER ───────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

/* ── MODULE HEADER (used by inline JS modules) ─────────────── */
.module-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}
.module-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--grey-900);
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}
.module-header p {
  font-size: .88rem;
  color: var(--grey-500);
  margin-top: 2px;
}
.module-header > div:first-child {
  flex: 1;
}
.page-title-wrap { display: flex; flex-direction: column; }
.page-title { font-size: 1.4rem; font-weight: 700; color: var(--grey-900); }
.page-subtitle { font-size: .85rem; color: var(--grey-500); margin-top: 2px; }
.page-actions { display: flex; align-items: center; gap: 8px; }

/* ── LOADING STATES ─────────────────────────────────────────── */
.loading-full {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 300px;
  gap: 12px;
  color: var(--grey-400);
}
.spinner-lg {
  width: 44px; height: 44px;
  border: 4px solid var(--grey-150);
  border-top-color: var(--wfs-600);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── EMPTY STATE ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--grey-400);
}
.empty-icon { font-size: 3rem; margin-bottom: 16px; opacity: .4; }
.empty-state h3 { font-size: 1.1rem; color: var(--grey-600); margin-bottom: 6px; }
.empty-state p { font-size: .88rem; max-width: 360px; margin: 0 auto 20px; }

/* ── MODAL ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,20,50,.55);
  backdrop-filter: blur(3px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modal-in .18s ease;
}
.modal-box.modal-lg { max-width: 860px; }
.modal-box.modal-xl { max-width: 1100px; }
@keyframes modal-in { from { opacity:0; transform:translateY(-16px) scale(.98); } to { opacity:1; transform:none; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--grey-150);
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; color: var(--grey-900); }
.modal-close {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  color: var(--grey-400);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.modal-close:hover { background: var(--grey-100); color: var(--grey-900); }
.modal-body { flex: 1; overflow-y: auto; padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--grey-150);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Toolkit Export Buttons ─────────────────────────────────── */
.tk-export-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}
.tk-export-group .export-label {
  font-size: .7rem;
  font-weight: 700;
  color: var(--grey-400);
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
}
.btn-export-pdf   { background: #FEF2F2 !important; color: #DC2626 !important; border: 1px solid #DC262640 !important; }
.btn-export-excel { background: #F0FDF4 !important; color: #16A34A !important; border: 1px solid #16A34A40 !important; }
.btn-export-ppt   { background: #FFF7ED !important; color: #EA580C !important; border: 1px solid #EA580C40 !important; }
.btn-export-pdf:hover   { background: #FEE2E2 !important; }
.btn-export-excel:hover { background: #DCFCE7 !important; }
.btn-export-ppt:hover   { background: #FFEDD5 !important; }

/* ── TOAST ─────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  background: var(--grey-900);
  color: #fff;
  border-radius: var(--radius);
  font-size: .88rem;
  box-shadow: var(--shadow-md);
  animation: toast-in .22s ease;
  min-width: 280px;
  max-width: 380px;
}
.toast.success { background: var(--green-600); }
.toast.error { background: var(--red-600); }
.toast.warning { background: var(--amber-500); color: #000; }
.toast.info { background: #1D4ED8; }
@keyframes toast-in { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:none; } }

/* ── CARDS ─────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--grey-150);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--grey-150);
}
.card-title { font-size: .95rem; font-weight: 700; color: var(--grey-900); }
.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--grey-150);
  background: var(--grey-50);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── KPI STAT CARDS ─────────────────────────────────────────── */
.stat-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--grey-150);
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); border-color: var(--wfs-100); }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.stat-icon.blue   { background: #DBEAFE; color: #1D4ED8; }
.stat-icon.gold   { background: var(--gold-100); color: var(--amber-600); }
.stat-icon.green  { background: var(--green-100); color: var(--green-600); }
.stat-icon.red    { background: var(--red-100); color: var(--red-600); }
.stat-icon.amber  { background: var(--amber-100); color: var(--amber-600); }
.stat-icon.orange { background: #FFF3E0; color: #E65100; }
.stat-icon.purple { background: #EDE7F6; color: #6A1B9A; }
/* stat-body AND stat-content are both used — keep in sync */
.stat-body, .stat-content { flex: 1; }
.stat-label { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--grey-400); margin-bottom: 4px; }
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--grey-900); line-height: 1; }
.stat-delta { font-size: .78rem; margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.delta-up { color: var(--green-500); }
.delta-down { color: var(--red-500); }

/* ── TABLES ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--grey-150); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
thead { background: var(--grey-50); }
th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--grey-500);
  border-bottom: 1px solid var(--grey-150);
  white-space: nowrap;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--grey-100);
  color: var(--grey-800);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--grey-50); }
.table-actions { display: flex; gap: 6px; }
.tbl-btn {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: .78rem;
  font-weight: 500;
  transition: var(--transition);
}
.tbl-btn.edit { background: var(--wfs-100); color: var(--wfs-700); }
.tbl-btn.edit:hover { background: var(--wfs-600); color: #fff; }
.tbl-btn.del { background: var(--red-100); color: var(--red-600); }
.tbl-btn.del:hover { background: var(--red-500); color: #fff; }
.tbl-btn.view { background: var(--grey-100); color: var(--grey-700); }
.tbl-btn.view:hover { background: var(--grey-700); color: #fff; }

/* ── STATUS PILLS ───────────────────────────────────────────── */
.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-green { background: var(--green-100); color: var(--green-600); }
.pill-red { background: var(--red-100); color: var(--red-600); }
.pill-amber { background: var(--amber-100); color: var(--amber-600); }
.pill-blue { background: var(--wfs-100); color: var(--wfs-700); }
.pill-grey { background: var(--grey-100); color: var(--grey-600); }

/* ── PRIORITY PILLS ─────────────────────────────────────────── */
.priority-critical { background: #B71C1C; color: #fff; padding: 2px 8px; border-radius: 10px; font-size: .72rem; font-weight: 700; }
.priority-high { background: var(--red-100); color: var(--red-600); padding: 2px 8px; border-radius: 10px; font-size: .72rem; font-weight: 700; }
.priority-medium { background: var(--amber-100); color: var(--amber-600); padding: 2px 8px; border-radius: 10px; font-size: .72rem; font-weight: 700; }
.priority-low { background: var(--green-100); color: var(--green-600); padding: 2px 8px; border-radius: 10px; font-size: .72rem; font-weight: 700; }

/* ── PROGRESS BARS ──────────────────────────────────────────── */
.progress-track { background: var(--grey-150); border-radius: 8px; height: 8px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 8px; transition: width .4s ease; }
.progress-fill.green { background: var(--green-400); }
.progress-fill.amber { background: var(--amber-400); }
.progress-fill.red { background: var(--red-400); }
.progress-fill.blue { background: var(--blue-500); }

/* ── FORMS ─────────────────────────────────────────────────── */
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.field-group { display: flex; flex-direction: column; gap: 5px; }
.field-group label { font-size: .82rem; font-weight: 600; color: var(--grey-700); }
.req { color: var(--red-500); }
.field-group input,
.field-group select,
.field-group textarea {
  padding: 9px 13px;
  border: 1.5px solid var(--grey-200);
  border-radius: var(--radius);
  font-size: .88rem;
  color: var(--grey-900);
  transition: var(--transition);
  background: #fff;
}
.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
  outline: none;
  border-color: var(--wfs-600);
  box-shadow: 0 0 0 3px rgba(232,25,44,.1);
}
.field-group textarea { resize: vertical; min-height: 80px; }
.input-icon-wrap { position: relative; }
.input-icon-wrap input { padding-right: 40px; width: 100%; }
.toggle-pw {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--grey-400);
  cursor: pointer;
  font-size: .9rem;
  transition: var(--transition);
}
.toggle-pw:hover { color: var(--grey-700); }
.form-row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error {
  background: var(--red-100);
  color: var(--red-600);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .84rem;
  display: flex; align-items: center; gap: 8px;
}
.pw-strength {
  height: 4px;
  border-radius: 4px;
  margin-top: 4px;
  transition: all .3s;
}
.pw-strength.weak { background: var(--red-400); width: 30%; }
.pw-strength.fair { background: var(--amber-400); width: 60%; }
.pw-strength.strong { background: var(--green-400); width: 100%; }

/* ── BUTTONS ───────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px;
  background: var(--blue-700);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .88rem;
  transition: var(--transition);
}
.btn-primary:hover { background: var(--blue-800); box-shadow: var(--shadow); }
.btn-primary:active { background: var(--blue-900); }
.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px;
  background: #fff;
  color: var(--blue-700);
  border: 1.5px solid var(--blue-700);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .88rem;
  transition: var(--transition);
}
.btn-secondary:hover { background: var(--blue-50); }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px;
  background: transparent;
  color: var(--grey-700);
  border-radius: var(--radius);
  font-weight: 500;
  font-size: .88rem;
  transition: var(--transition);
}
.btn-ghost:hover { background: var(--grey-100); }
.btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px;
  background: var(--red-500);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .88rem;
  transition: var(--transition);
}
.btn-danger:hover { background: var(--red-600); }
.btn-gold {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px;
  background: var(--gold-500);
  color: #000;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: .88rem;
  transition: var(--transition);
}
.btn-gold:hover { background: var(--gold-600); }
.btn-full { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-xs { padding: 4px 9px; font-size: .75rem; }
.btn-icon {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  color: var(--grey-500);
}
.btn-icon:hover { background: var(--grey-100); color: var(--grey-900); }
button:disabled, .btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── CHART CONTAINERS ───────────────────────────────────────── */
.chart-wrap { position: relative; }
.chart-wrap canvas { display: block; }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .sidebar { width: var(--sidebar-collapsed); }
  .sidebar .nav-item span, .sidebar .nav-section-label, .sidebar .nav-badge,
  .sidebar .sidebar-footer span, .sidebar .sidebar-version { opacity:0; width:0; overflow:hidden; pointer-events:none; }
  .main-content { margin-left: var(--sidebar-collapsed); }
}
@media (max-width: 768px) {
  .module-container { padding: 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .form-row.two-col { grid-template-columns: 1fr; }
  .nav-center { display: none; }
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w); }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar .nav-item span, .sidebar .nav-section-label { opacity:1; width:auto; }
  .main-content { margin-left: 0; }
}

/* ── TABS ───────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--grey-150); margin-bottom: 20px; }
.tab-btn {
  padding: 9px 18px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: .88rem;
  font-weight: 500;
  color: var(--grey-500);
  transition: var(--transition);
  position: relative;
}
.tab-btn:hover { color: var(--wfs-600); background: var(--wfs-50); }
.tab-btn.active {
  color: var(--wfs-600);
  font-weight: 700;
  background: var(--wfs-50);
}
.tab-btn.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--wfs-600);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── DROPDOWN SELECT CUSTOM ─────────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-bar select, .filter-bar input {
  padding: 7px 12px;
  border: 1.5px solid var(--grey-200);
  border-radius: var(--radius);
  font-size: .85rem;
  color: var(--grey-800);
  background: #fff;
}
.filter-bar select:focus, .filter-bar input:focus { outline: none; border-color: var(--wfs-600); }

/* ── TIMELINE / ACTIVITY — canonical styles in components.css ── */
/* Duplicate removed; see .activity-list / .activity-item there. */

/* ── AUTH FOOTER NOTE ───────────────────────────────────────── */
.auth-footer-note {
  text-align: center;
  font-size: .76rem;
  color: var(--grey-400);
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--grey-150);
}

/* ── ALERT ITEMS (Alerts module card style) ──────────────────── */
/* Components.css has the simpler feed version; this adds the card variant */
#module-container .alert-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border-left: 4px solid transparent;
  background: var(--surface-card, #fff);
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  border-bottom: none;
  cursor: default;
}
#module-container .alert-item:hover { box-shadow: var(--shadow); opacity: 1; }
#module-container .alert-item.critical { border-color: var(--red-600); background: #FFF5F5; }
#module-container .alert-item.high { border-color: var(--red-400); background: var(--red-100); }
#module-container .alert-item.medium { border-color: var(--amber-400); background: var(--amber-100); }
#module-container .alert-item.low { border-color: var(--wfs-100); background: var(--wfs-50); }
html.dark-mode #module-container .alert-item { background: var(--surface-card); }
html.dark-mode #module-container .alert-item.critical { background: rgba(183,28,28,.15); }
html.dark-mode #module-container .alert-item.high     { background: rgba(211,47,47,.12); }
html.dark-mode #module-container .alert-item.medium   { background: rgba(251,140,0,.1); }
html.dark-mode #module-container .alert-item.low      { background: rgba(232,25,44,.08); }
.alert-icon { font-size: 1rem; flex-shrink: 0; margin-top: 2px; }
.alert-body { flex: 1; }
.alert-title { font-weight: 600; font-size: .88rem; color: var(--grey-900); }
.alert-desc { font-size: .8rem; color: var(--grey-600); margin-top: 2px; }
.alert-meta { font-size: .73rem; color: var(--grey-400); margin-top: 4px; }

/* ── TASK CARDS ─────────────────────────────────────────────── */
.task-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  border-left: 3px solid var(--grey-300);
  transition: var(--transition);
}
.task-card:hover { box-shadow: var(--shadow); }
.task-card.high { border-color: var(--red-400); }
.task-card.critical { border-color: var(--red-700); }
.task-card.medium { border-color: var(--amber-400); }
.task-card.low { border-color: var(--green-400); }
/* Dependency-blocked task styling */
.task-card.task-dep-blocked { border-color: #E65100; background: #FFF8E1; opacity: .9; }
.task-dep-warn {
  display: flex; align-items: flex-start; gap: 6px;
  font-size: .76rem; color: #BF360C;
  background: #FFF3E0; border: 1px solid #FFCCBC;
  border-radius: 4px; padding: 5px 8px; margin-top: 5px; margin-bottom: 2px;
  flex-wrap: wrap; line-height: 1.4;
}
/* Recurring task badge */
.task-recur-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: .66rem; font-weight: 600;
  background: #E8F5E9; color: #2E7D32;
  border-radius: 10px; padding: 1px 7px;
  white-space: nowrap;
}
/* Dependency-blocked row in list view */
tr.task-dep-blocked-row td { background: #FFFDE7; }
.task-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.task-title { font-weight: 600; font-size: .9rem; color: var(--grey-900); }
.task-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.task-assignee { font-size: .78rem; color: var(--grey-500); }
.task-due { font-size: .75rem; color: var(--grey-400); }
.task-due.overdue { color: var(--red-500); font-weight: 600; }
/* Dark mode overrides */
html.dark-mode .task-card.task-dep-blocked { background: rgba(230,81,0,.12); border-color: #E65100; }
html.dark-mode .task-dep-warn { background: rgba(230,81,0,.1); border-color: rgba(230,81,0,.25); color: #FFAB91; }
html.dark-mode .task-recur-badge { background: rgba(46,125,50,.15); color: #81C784; }
html.dark-mode tr.task-dep-blocked-row td { background: rgba(255,253,231,.04); }

/* ── CI TOOLKIT CARDS ───────────────────────────────────────── */
.toolkit-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--grey-150);
  transition: var(--transition);
  cursor: pointer;
  display: flex; flex-direction: column; gap: 10px;
}
.toolkit-card:hover { border-color: var(--wfs-100); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.toolkit-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  background: var(--wfs-100);
  color: var(--wfs-600);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}
.toolkit-card h3 { font-size: .95rem; font-weight: 700; color: var(--grey-900); }
.toolkit-card p { font-size: .82rem; color: var(--grey-500); line-height: 1.4; }

/* ── SEARCH RESULTS ─────────────────────────────────────────── */
.search-result-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  transition: var(--transition);
  cursor: pointer;
}
.search-result-item:hover { background: var(--grey-50); }
.search-result-icon { width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--wfs-100); color: var(--wfs-600); display: flex; align-items: center; justify-content: center; font-size: .8rem; flex-shrink: 0; }
.search-result-text { flex: 1; }
.search-result-title { font-size: .88rem; font-weight: 500; color: var(--grey-900); }
.search-result-sub { font-size: .75rem; color: var(--grey-400); }
.search-result-type { font-size: .7rem; color: var(--wfs-600); font-weight: 600; text-transform: uppercase; }
.search-group-label { padding: 8px 14px; font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--grey-400); letter-spacing: .5px; background: var(--grey-50); }

/* ── KANBAN BOARD ───────────────────────────────────────────── */
.kanban-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 16px; }
.kanban-col { min-width: 260px; flex: 1; background: var(--grey-50); border-radius: var(--radius-lg); padding: 12px; }
.kanban-col-header { font-weight: 700; font-size: .88rem; color: var(--grey-700); margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.kanban-count { background: var(--grey-200); color: var(--grey-600); border-radius: 10px; padding: 2px 8px; font-size: .75rem; }

/* ── PRINT STYLES ───────────────────────────────────────────── */
@media print {
  .top-nav, .sidebar, .page-actions, .filter-bar, .tabs,
  .table-toolbar, .pagination, .toast-container, .modal-overlay,
  #dash-refresh-btn, .tbl-btn, .btn-primary, .btn-secondary, .btn-ghost { display: none !important; }
  .main-content { margin: 0 !important; }
  .module-container { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; }
  body { background: #fff !important; }
  .report-preview { padding: 0 !important; }
}

/* ── SCROLLBARS ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--grey-200); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--grey-300); }

/* ── RAG STATUS ─────────────────────────────────────────────── */
.rag-green { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--green-400); }
.rag-amber { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--amber-400); }
.rag-red { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--red-400); }

/* ── WFS BRAND ACCENTS ──────────────────────────────────────── */
/* Red bar at top of key cards */
.card-primary {
  border-top: 3px solid var(--wfs-600);
}
/* Gradient hero header for module pages */
.module-hero {
  background: linear-gradient(135deg, var(--wfs-900) 0%, var(--wfs-600) 100%);
  color: #fff;
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}
.module-hero .page-title { color: #fff; }
.module-hero .page-subtitle { color: rgba(255,255,255,.75); }

/* ── INLINE ICON COLOUR UTILITY ─────────────────────────────── */
.icon-wfs { color: var(--wfs-600); }
.icon-gold { color: var(--gold-500); }
.icon-green { color: var(--green-500); }
.icon-amber { color: var(--amber-500); }
.icon-red { color: var(--red-500); }

/* ── TEMP PASSWORD INFO BOX ─────────────────────────────────── */
.temp-pw-box {
  background: var(--gold-100);
  border: 1px solid var(--gold-400);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: .85rem;
  color: var(--grey-800);
}
.temp-pw-box strong { color: var(--amber-600); font-family: monospace; font-size: 1rem; letter-spacing: 1px; }

/* ── KPI HEAT CLASSES ────────────────────────────────────────── */
.kpi-on-target { color: var(--green-600); font-weight: 700; }
.kpi-at-risk   { color: var(--amber-600); font-weight: 700; }
.kpi-breached  { color: var(--red-600);   font-weight: 700; }

/* ── RESPONSIVE FINE-TUNING ─────────────────────────────────── */
@media (max-width: 640px) {
  .auth-card { padding: 28px 22px; }
  .auth-logo { gap: 10px; }
  .logo-img { height: 36px; }
  .logo-wordmark { font-size: 1.3rem; }
}

/* ── ANIMATION UTILITIES ────────────────────────────────────── */
@keyframes fadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }
.fade-in { animation: fadeIn .25s ease forwards; }
@keyframes pulse-red { 0%,100% { box-shadow: 0 0 0 0 rgba(232,25,44,.3); } 50% { box-shadow: 0 0 0 6px rgba(232,25,44,0); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.pulse-wfs { animation: pulse-red 2s infinite; }
