/* =============================================================
   APGAP — AP Gap Analyzer
   Design System: YYC taxPOD Design Library (verbatim tokens)
   Fonts: Inter (primary) + Lato (secondary)
   ============================================================= */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Lato:wght@300;400;700;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=block');

/* ─────────────────────────────────────────────────────────────
   1. DESIGN TOKENS  (mirrors taxpod-design-library/styles.css)
   ───────────────────────────────────────────────────────────── */
:root {
  --primary-50:  #F0F9FF;
  --primary-100: #E0F2FE;
  --primary-200: #B9E6FE;
  --primary-300: #7CD4FD;
  --primary-500: #00AFED;
  --primary-600: #007DA9;
  --primary-700: #004B65;

  --secondary-50:  #FFF6ED;
  --secondary-100: #FFE7DA;
  --secondary-200: #FFCFB3;
  --secondary-300: #FFAF82;
  --secondary-400: #FF8C4A;
  --secondary-500: #F7752C;
  --secondary-600: #E05F17;
  --secondary-700: #BE4312;

  --tertiary-200: #FFF6E0;
  --tertiary-300: #FFF0CB;
  --tertiary-400: #FFD97D;
  --tertiary-500: #FFCE54;
  --tertiary-600: #ECCA22;
  --tertiary-700: #D1B00C;
  --tertiary-800: #998210;
  --tertiary-secondary-800: #5E510D;

  --grey-50:  #F8F8F8;
  --grey-100: #F5F5F5;
  --grey-150: #EBF0F4;
  --grey-200: #E4E3F0;
  --grey-300: #CFD9DD;
  --grey-400: #A4A7AE;
  --grey-500: #83858A;
  --grey-600: #5F5B5B;
  --grey-700: #4B4848;
  --grey-800: #231F20;

  --neutral-black: #000000;
  --neutral-white: #FFFFFF;

  --error-50:  #FFE7EA;
  --error-100: #FF6174;
  --error-200: #E73A3A;
  --error-300: #B41F1F;
  --error-tertiary-50:  #FFFAEB;
  --error-tertiary-100: #FFF6E0;

  --success-50:  #ECFDF3;
  --success-100: #DFFBEF;
  --success-200: #C6F0DD;
  --success-300: #2CC47E;
  --success-400: #1A8B57;
  --success-500: #155D3C;

  --border-dark:    #CAD3D7;
  --border-light:   #CFD9DD;
  --border-lighter: #DCE9EF;
  --card-bg:        #FFFFFF;
  --card-header-bg: #EBF0F4;
  --link-color:     #0B8EBB;

  --shadow-xs:  0px 1px 2px rgba(16,24,40,0.05);
  --shadow-sm:  0px 1px 3px rgba(16,24,40,0.10), 0px 1px 2px rgba(16,24,40,0.06);
  --shadow-md:  0px 4px 8px rgba(16,24,40,0.08), 0px 2px 4px rgba(16,24,40,0.06);
  --shadow-lg:  0px 12px 16px rgba(16,24,40,0.08), 0px 4px 6px rgba(16,24,40,0.03);
  --shadow-xl:  0px 20px 24px rgba(16,24,40,0.08), 0px 8px 10px rgba(16,24,40,0.03);
  --shadow-2xl: 0px 24px 48px rgba(16,24,40,0.18);

  --radius-sm:     4px;
  --radius-md:     6px;
  --radius-lg:     8px;
  --radius-full:   100px;
  --radius-toggle: 12px;

  --font-primary:   'Inter', sans-serif;
  --font-secondary: 'Lato', sans-serif;

  --fs-11: 11px; --fs-12: 12px; --fs-13: 13px; --fs-14: 14px;
  --fs-16: 16px; --fs-20: 20px; --fs-24: 24px; --fs-32: 32px;

  --space-2: 2px; --space-4: 4px; --space-6: 6px; --space-8: 8px;
  --space-10: 10px; --space-12: 12px; --space-14: 14px; --space-16: 16px;
  --space-18: 18px; --space-20: 20px; --space-24: 24px; --space-32: 32px;
  --space-40: 40px; --space-48: 48px;

  --sidebar-width: 240px;

  --input-bg:              #FFFFFF;
  --input-border:          #C1CBCE;
  --input-text:            #231F20;
  --input-placeholder:     #8793B2;
  --input-focus-border:    #00AFED;
  --input-focus-ring:      rgba(0,175,237,0.1);
  --input-hover-border:    #7CD4FD;
  --input-error-border:    #E73A3A;
  --input-disabled-bg:     #E4E3F0;
  --input-disabled-border: #C1CBCE;
  --input-disabled-text:   #83858A;

  --checkbox-enabled-bg:    #00AFED;
  --checkbox-enabled-check: #FFFFFF;
  --checkbox-disabled-bg:   #E4E3F0;

  --btn-disabled-border: #D5D7DA;
  --tooltip-bg:          #FFFFFF;
  --tooltip-text:        #4B4848;
  --progress-bar-color:  #1A8B57;
  --overlay-bg:          rgba(0,0,0,0.5);
  --content-tag-border:  #688AAA;
  --content-tag-text:    #688AAA;
  --progress-green:      #69D2A2;
}

[data-theme="dark"] {
  --primary-50:  #0A1A23;
  --primary-100: #12212D;
  --primary-200: #19425E;
  --primary-300: #1992D4;
  --primary-500: #52B7FF;
  --primary-600: #3FB9F6;
  --primary-700: #73CDFF;
  --grey-50:  #1A1A1A; --grey-100: #1E1E1E; --grey-150: #2C3237;
  --grey-200: #303539; --grey-300: #3B4246; --grey-400: #55575B;
  --grey-500: #666A70; --grey-600: #CFD3D9; --grey-700: #F9F9F9; --grey-800: #FFFFFF;
  --neutral-black: #FEFEFE; --neutral-white: #1E1E1E;
  --error-50: #D40D0D; --error-100: #FB2C36; --error-200: #FF4145;
  --success-50: #0B3122; --success-100: #0B6330; --success-200: #117F4C;
  --success-300: #23A56D; --success-400: #62ECAA;
  --border-dark: #7B888C; --border-light: #444749; --border-lighter: #343638;
  --card-bg: #1D2330; --card-header-bg: #2C3547; --link-color: #44CFFF;
  --input-bg: #313747; --input-border: #1D2330; --input-text: #FFFFFF;
  --input-focus-border: #52B7FF; --input-focus-ring: rgba(82,183,255,0.15);
  --input-hover-border: #1992D4; --input-error-border: #FF4145;
  --input-disabled-bg: #2C313F; --input-disabled-border: #31353E; --input-disabled-text: #81889F;
  --checkbox-enabled-bg: #52B7FF; --checkbox-enabled-check: #2F2F2F;
  --tooltip-bg: #1D2330; --tooltip-text: #E0E4EB;
  --shadow-xs:  0px 1px 2px rgba(0,0,0,0.20);
  --shadow-sm:  0px 1px 3px rgba(0,0,0,0.30), 0px 1px 2px rgba(0,0,0,0.25);
  --shadow-md:  0px 4px 8px rgba(0,0,0,0.50), 0px 2px 4px rgba(0,0,0,0.40);
  --shadow-lg:  0px 12px 16px rgba(0,0,0,0.50), 0px 4px 6px rgba(0,0,0,0.30);
  --shadow-xl:  0px 20px 24px rgba(0,0,0,0.50), 0px 8px 10px rgba(0,0,0,0.30);
  --overlay-bg: rgba(0,0,0,0.7);
  --content-tag-border: #52676E; --content-tag-text: #879BB7;
  --tertiary-200: #8A7834; --tertiary-400: #BB8313; --tertiary-500: #C18B30;
  --tertiary-600: #BA952C; --tertiary-700: #D5B03F; --tertiary-800: #E5C937;
  --tertiary-secondary-800: #F9E072;
}

html.theme-transition,
html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
  transition: background-color 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.3s !important;
}

/* ─────────────────────────────────────────────────────────────
   2. RESET & BASE
   ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-x: hidden; }
body {
  font-family: var(--font-primary);
  color: var(--grey-800);
  background: var(--grey-50);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--link-color); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─────────────────────────────────────────────────────────────
   3. SIDEBAR  (verbatim from design library)
   ───────────────────────────────────────────────────────────── */
aside {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: #000000;
  border-right: none;
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 10;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: width 0.2s ease;
}
aside:hover { scrollbar-color: rgba(255,255,255,0.3) transparent; }
aside::-webkit-scrollbar { width: 6px; }
aside::-webkit-scrollbar-track { background: transparent; }
aside::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; }
aside:hover::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); }

.sidebar-header {
  padding: var(--space-24) var(--space-20);
  border-bottom: 1px solid rgba(255,255,255,0.15);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}
.sidebar-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  transition: opacity 0.15s ease;
  overflow: hidden;
}
.sidebar-logo-text {
  font-family: var(--font-primary);
  font-size: var(--fs-20);
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: 2px;
}
.sidebar-logo-sub {
  font-family: var(--font-secondary);
  font-size: var(--fs-11);
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: var(--space-2);
  display: block;
}
.sidebar-subtitle {
  font-family: var(--font-secondary);
  font-size: var(--fs-11);
  color: rgba(255,255,255,0.85);
  margin-top: var(--space-4);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.theme-toggle {
  width: 32px; height: 32px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.1);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.85);
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.theme-toggle:hover { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.4); color: #fff; }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun  { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }

.sidebar-toggle {
  width: 28px; height: 28px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.1);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.85);
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.4); color: #fff; }
.sidebar-toggle svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-toggle .icon-close  { display: block; }
.sidebar-toggle .icon-burger { display: none; }

nav { flex: 1; padding: var(--space-16) 0; }
.nav-group { margin-bottom: var(--space-16); }
.nav-group-title {
  font-family: var(--font-secondary);
  font-size: var(--fs-11);
  font-weight: 700;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 2px;
  padding: var(--space-4) var(--space-20);
  margin-bottom: var(--space-4);
  transition: opacity 0.15s ease;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  padding: var(--space-8) var(--space-20);
  font-family: var(--font-secondary);
  font-size: var(--fs-13);
  font-weight: 500;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.nav-link span { white-space: nowrap; overflow: hidden; transition: opacity 0.15s ease, width 0.2s ease; }
.nav-link:hover { background: rgba(255,255,255,0.1); color: #FFFFFF; text-decoration: none; }
.nav-link.active {
  background: rgba(0,175,237,0.15);
  color: var(--primary-500);
  font-weight: 600;
  border-right: 3px solid var(--primary-500);
}

/* Sidebar footer */
.sidebar-footer {
  padding: var(--space-16) var(--space-20);
  border-top: 1px solid rgba(255,255,255,0.15);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-10);
}
.sidebar-user-name {
  font-family: var(--font-secondary);
  font-size: var(--fs-13);
  color: rgba(255,255,255,0.85);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-email {
  font-family: var(--font-secondary);
  font-size: var(--fs-11);
  color: rgba(255,255,255,0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Collapsed sidebar */
aside.sidebar-collapsed,
body.sidebar-collapsed aside { width: 64px; }
aside.sidebar-collapsed + main,
body.sidebar-collapsed main { margin-left: 64px; width: calc(100vw - 64px); }
aside.sidebar-collapsed .sidebar-header { padding: var(--space-12) 0; align-items: center; justify-content: center; }
aside.sidebar-collapsed .sidebar-header-row { flex-direction: column; gap: 6px; justify-content: center; }
aside.sidebar-collapsed .sidebar-logo { opacity: 0; width: 0; height: 0; overflow: hidden; position: absolute; }
aside.sidebar-collapsed .sidebar-header-row > div:last-child { flex-direction: column; gap: 4px; }
aside.sidebar-collapsed .nav-group-title { opacity: 0; height: 0; padding: 0; margin: 0; overflow: hidden; }
aside.sidebar-collapsed .nav-link { justify-content: center; padding: var(--space-10) 0; width: 64px; }
aside.sidebar-collapsed .nav-link span { opacity: 0; width: 0; overflow: hidden; position: absolute; }
aside.sidebar-collapsed .nav-link.active { border-right: none; background: rgba(0,175,237,0.15); border-radius: 0; }
aside.sidebar-collapsed .sidebar-toggle .icon-close  { display: none; }
aside.sidebar-collapsed .sidebar-toggle .icon-burger { display: block; }
aside.sidebar-collapsed .sidebar-footer { padding: var(--space-12) 0; display: flex; flex-direction: column; align-items: center; }
aside.sidebar-collapsed .sidebar-footer .sidebar-user { justify-content: center; }
aside.sidebar-collapsed .sidebar-footer .sidebar-user > div { display: none; }
aside.sidebar-collapsed .sidebar-footer .sidebar-user-name,
aside.sidebar-collapsed .sidebar-footer .sidebar-user-email { display: none; }
aside.sidebar-collapsed .sidebar-footer .btn { width: 36px !important; height: 36px !important; padding: 0 !important; min-width: 0; justify-content: center !important; overflow: hidden; border-radius: var(--radius-md); font-size: 0 !important; color: transparent !important; margin-top: var(--space-8) !important; }
aside.sidebar-collapsed .sidebar-footer .btn svg { margin: 0; flex-shrink: 0; color: rgba(255,255,255,0.55) !important; }

/* Sidebar tooltip (JS-injected) */
.sidebar-tooltip {
  position: fixed;
  background: #231F20;
  color: #FFFFFF;
  font-family: var(--font-secondary);
  font-size: var(--fs-12);
  font-weight: 500;
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.sidebar-tooltip.visible { opacity: 1; }
.sidebar-tooltip::before {
  content: '';
  position: absolute;
  right: 100%; top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-right-color: #231F20;
}

/* ─────────────────────────────────────────────────────────────
   4. MAIN CONTENT AREA
   ───────────────────────────────────────────────────────────── */
main {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: var(--space-40) var(--space-48);
  width: calc(100vw - var(--sidebar-width));
  box-sizing: border-box;
  overflow-x: clip;
  transition: margin-left 0.2s ease, width 0.2s ease;
}

.page-header {
  margin-bottom: var(--space-32);
}
.page-title {
  font-family: var(--font-primary);
  font-size: var(--fs-32);
  font-weight: 700;
  color: var(--grey-800);
  margin: 0 0 var(--space-4) 0;
  line-height: 1.2;
}
.page-subtitle {
  font-family: var(--font-secondary);
  font-size: var(--fs-14);
  color: var(--grey-500);
}
.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-16);
}

/* ─────────────────────────────────────────────────────────────
   5. BUTTONS  (verbatim from design library)
   ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  font-family: var(--font-primary);
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-sm  { font-size: var(--fs-12); padding: var(--space-6) var(--space-14); border-radius: var(--radius-md); }
.btn-md  { font-size: var(--fs-14); padding: var(--space-8) var(--space-18); border-radius: var(--radius-md); }
.btn-lg  { font-size: var(--fs-16); padding: var(--space-12) var(--space-24); border-radius: var(--radius-lg); gap: var(--space-8); }

.btn-primary { background: var(--primary-500); color: var(--neutral-white); }
.btn-primary:hover { background: var(--primary-600); text-decoration: none; color: var(--neutral-white); }
.btn-primary:active { background: var(--primary-700); }
.btn-primary:disabled, .btn-primary.disabled { background: var(--grey-200); color: var(--grey-500); cursor: not-allowed; pointer-events: none; }

.btn-secondary { background: transparent; color: var(--primary-500); box-shadow: inset 0 0 0 1.5px var(--primary-500); }
.btn-secondary:hover { background: var(--primary-50); color: var(--primary-600); box-shadow: inset 0 0 0 1.5px var(--primary-600); text-decoration: none; }
.btn-secondary:disabled, .btn-secondary.disabled { background: transparent; color: var(--grey-400); box-shadow: inset 0 0 0 1.5px var(--btn-disabled-border); cursor: not-allowed; pointer-events: none; }

.btn-outline { background: transparent; color: var(--primary-500); box-shadow: inset 0 0 0 1.5px var(--border-light); }
.btn-outline:hover { background: var(--primary-50); color: var(--primary-600); box-shadow: inset 0 0 0 1.5px var(--primary-500); text-decoration: none; }
.btn-outline:disabled { color: var(--grey-400); box-shadow: inset 0 0 0 1.5px var(--grey-200); cursor: not-allowed; pointer-events: none; }

.btn-ghost { background: transparent; color: var(--primary-500); }
.btn-ghost:hover { color: var(--primary-600); text-decoration: none; }
.btn-ghost:disabled { color: var(--grey-500); cursor: not-allowed; pointer-events: none; }

.btn-danger { background: var(--error-200); color: var(--neutral-white); }
.btn-danger:hover { background: var(--error-300); text-decoration: none; color: var(--neutral-white); }

/* ─────────────────────────────────────────────────────────────
   6. CARDS
   ───────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-lighter);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  background: var(--card-header-bg);
  padding: var(--space-16) var(--space-20);
  border-bottom: 1px solid var(--border-lighter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
}
.card-header-title {
  font-family: var(--font-primary);
  font-size: var(--fs-16);
  font-weight: 700;
  color: var(--grey-800);
}
.card-header-subtitle {
  font-family: var(--font-secondary);
  font-size: var(--fs-13);
  color: var(--grey-500);
  margin-top: var(--space-2);
}
.card-body { padding: var(--space-20); }
.card-footer {
  padding: var(--space-12) var(--space-20);
  border-top: 1px solid var(--border-lighter);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-8);
}

/* ─────────────────────────────────────────────────────────────
   7. STAT CARDS (dashboard metrics)
   ───────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-16);
  margin-bottom: var(--space-32);
}
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-lighter);
  border-radius: var(--radius-lg);
  padding: var(--space-20);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.15s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center; justify-content: center;
  margin-bottom: var(--space-12);
}
.stat-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.stat-icon.si-primary { background: var(--primary-100); color: var(--primary-500); }
.stat-icon.si-success { background: var(--success-100); color: var(--success-400); }
.stat-icon.si-warning { background: var(--tertiary-200); color: var(--tertiary-700); }
.stat-icon.si-error   { background: var(--error-50);    color: var(--error-200);  }
.stat-icon.si-grey    { background: var(--grey-150);    color: var(--grey-600);   }
.stat-number {
  font-family: var(--font-primary);
  font-size: 28px;
  font-weight: 700;
  color: var(--grey-800);
  line-height: 1;
}
.stat-label {
  font-family: var(--font-secondary);
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--grey-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: var(--space-6);
}

/* ─────────────────────────────────────────────────────────────
   7b. ADMIN SUMMARY BAR (inline horizontal metrics)
   ───────────────────────────────────────────────────────────── */
.admin-summary-bar {
  display: flex;
  align-items: center;
  gap: var(--space-20);
  background: var(--card-bg);
  border: 1px solid var(--border-lighter);
  border-radius: var(--radius-lg);
  padding: var(--space-16) var(--space-24);
  margin-bottom: var(--space-20);
  box-shadow: var(--shadow-sm);
}
.admin-summary-item {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}
.admin-summary-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.admin-summary-dot.dot-neutral  { background: var(--grey-400); }
.admin-summary-dot.dot-success  { background: var(--success-400); }
.admin-summary-dot.dot-error    { background: var(--error-200); }
.admin-summary-dot.dot-warning  { background: var(--tertiary-700); }
.admin-summary-value {
  font-family: var(--font-primary);
  font-size: 20px;
  font-weight: 700;
  color: var(--grey-800);
  line-height: 1;
}
.admin-summary-label {
  font-family: var(--font-secondary);
  font-size: var(--fs-13);
  color: var(--grey-500);
  font-weight: 500;
}
.admin-summary-divider {
  width: 1px;
  height: 28px;
  background: var(--border-lighter);
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .admin-summary-bar {
    flex-wrap: wrap;
    gap: var(--space-12);
    padding: var(--space-12) var(--space-16);
  }
  .admin-summary-divider { display: none; }
}

/* ─────────────────────────────────────────────────────────────
   8. TABLES
   ───────────────────────────────────────────────────────────── */
.table-wrap {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.ds-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-secondary);
  font-size: var(--fs-14);
  background: var(--neutral-white);
}
.ds-table th {
  text-align: left;
  font-family: var(--font-primary);
  font-weight: 700;
  font-size: var(--fs-12);
  color: var(--grey-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: var(--space-12) var(--space-16);
  background: var(--grey-150);
  border-bottom: 2px solid var(--border-lighter);
  white-space: nowrap;
}
.ds-table td {
  padding: var(--space-12) var(--space-16);
  color: var(--grey-700);
  border-bottom: 1px solid var(--border-lighter);
  vertical-align: middle;
}
.ds-table tr:last-child td { border-bottom: none; }
.ds-table.table-hover tbody tr { transition: background 0.1s; }
.ds-table.table-hover tbody tr:hover td { background: var(--primary-50); }
.ds-table tbody tr.row-selected td { background: var(--primary-50, #eff6ff); }
[data-theme="dark"] .ds-table { background: var(--card-bg); }

/* Table controls toolbar */
.dt-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-16) var(--space-20);
  gap: var(--space-16);
  flex-wrap: wrap;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-lighter);
}
.dt-controls-left, .dt-controls-right {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

/* Sort arrows */
.th-sort { cursor: pointer; user-select: none; }
.th-sort:hover { color: var(--primary-600); }
.sort-icon { display: inline-block; margin-left: 4px; opacity: 0.4; font-size: 10px; vertical-align: middle; }
.sort-icon.active { opacity: 1; color: var(--primary-500); }

/* ─────────────────────────────────────────────────────────────
   9. BADGES
   ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  font-family: var(--font-primary);
  font-weight: 500;
  white-space: nowrap;
  line-height: 1;
  box-sizing: border-box;
}
.badge-sm { font-size: var(--fs-11); padding: 2px var(--space-8) 3px; }
.badge-md { font-size: var(--fs-12); padding: 4px var(--space-12) 5px; }
.badge-pill   { border-radius: var(--radius-full); }
.badge-square { border-radius: var(--radius-sm); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

.badge-success-subtle  { background: var(--success-200); color: var(--success-400); }
.badge-error-subtle    { background: var(--error-50);    color: var(--error-200);   }
.badge-warning-subtle  { background: var(--error-tertiary-50); color: var(--tertiary-800); }
.badge-info-subtle     { background: var(--primary-100); color: var(--primary-600); }
.badge-neutral-subtle  { background: var(--grey-200);    color: var(--grey-600);    }
.badge-success-solid   { background: var(--success-300); color: var(--neutral-white); }
.badge-error-solid     { background: var(--error-100);   color: var(--neutral-white); }
.badge-warning-solid   { background: var(--tertiary-500); color: var(--tertiary-secondary-800); }
.badge-info-solid      { background: var(--primary-500); color: var(--neutral-white); }
.badge-neutral-solid   { background: var(--grey-800);    color: var(--neutral-white); }
.badge-success-outline { background: var(--success-200); color: var(--success-400); border: 1px solid var(--success-300); }
.badge-error-outline   { background: var(--error-50);    color: var(--error-200);   border: 1px solid var(--error-200); }
.badge-warning-outline { background: var(--error-tertiary-50); color: var(--tertiary-800); border: 1px solid var(--tertiary-600); }
.badge-info-outline    { background: var(--primary-100); color: var(--primary-600); border: 1px solid var(--primary-500); }

[data-theme="dark"] .badge-success-subtle { background: #162A20; color: #1CE07D; }
[data-theme="dark"] .badge-error-subtle   { background: #2A1617; color: #F18A8D; }
[data-theme="dark"] .badge-warning-subtle { background: #453C0F; color: #E5C937; }
[data-theme="dark"] .badge-info-subtle    { background: #12212D; color: #3FB9F6; }
[data-theme="dark"] .badge-neutral-subtle { background: #303539; color: #CFD3D9; }

/* Company/job status badges */
.status-badge { display: inline-flex; align-items: center; gap: 5px; }

/* ─────────────────────────────────────────────────────────────
   10. ALERTS
   ───────────────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-10);
  padding: var(--space-10) var(--space-16);
  border-radius: var(--radius-lg);
  font-family: var(--font-primary);
  font-size: var(--fs-14);
  width: 100%;
}
.alert-icon { flex-shrink: 0; width: 18px; height: 18px; margin-top: 2px; }
.alert-content { flex: 1; }
.alert-title { font-weight: 700; font-size: var(--fs-14); margin-bottom: var(--space-4); }
.alert-message { font-weight: 400; font-size: var(--fs-13); }
.alert-close { flex-shrink: 0; width: 16px; height: 16px; cursor: pointer; opacity: 0.7; margin-top: 3px; }
.alert-close:hover { opacity: 1; }
.alert-success { background: var(--success-50); border: 1px solid var(--success-300); color: var(--success-400); }
.alert-error   { background: var(--error-50);   border: 1px solid var(--error-100);   color: var(--error-200); }
.alert-warning { background: var(--error-tertiary-50); border: 1px solid var(--tertiary-600); color: var(--tertiary-800); }
.alert-info    { background: var(--primary-50); border: 1px solid var(--primary-500); color: var(--primary-600); }

/* ─────────────────────────────────────────────────────────────
   11. FORM INPUTS
   ───────────────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-24); max-width: 640px; }
.form-grid-1 { display: grid; grid-template-columns: 1fr; gap: var(--space-16); max-width: 640px; }
.form-field { display: flex; flex-direction: column; gap: var(--space-6); }
.form-label { font-family: var(--font-primary); font-size: var(--fs-14); font-weight: 700; color: var(--grey-800); }
.form-input {
  font-family: var(--font-primary);
  font-size: var(--fs-14);
  color: var(--input-text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: var(--space-8) var(--space-12);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.form-input::placeholder { color: var(--input-placeholder); }
.form-input:focus { border-color: var(--input-focus-border); border-width: 1.5px; box-shadow: 0 0 0 3px var(--input-focus-ring); }
.form-input:hover:not(:focus):not(:disabled) { border-color: var(--input-hover-border); }
.form-input:disabled { background: var(--input-disabled-bg); border-color: var(--input-disabled-border); color: var(--input-disabled-text); cursor: not-allowed; }
.form-input.input-error { border-color: var(--input-error-border); }
textarea.form-input { resize: vertical; min-height: 80px; }
select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2383858A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 36px;
}
.form-error { font-family: var(--font-secondary); font-size: var(--fs-12); color: var(--error-200); margin-top: 2px; }
.form-hint  { font-family: var(--font-secondary); font-size: var(--fs-12); color: var(--grey-500); margin-top: 2px; }

/* Search input */
.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-input-wrap svg {
  position: absolute;
  left: var(--space-10);
  width: 16px; height: 16px;
  stroke: var(--grey-400);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.search-input-wrap .form-input { padding-left: 34px; }

/* ─────────────────────────────────────────────────────────────
   12. MODALS
   ───────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}
.modal-overlay.modal-open { opacity: 1; visibility: visible; }
.modal {
  background: var(--neutral-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 520px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
}
.modal-lg { width: 760px; }
.modal-xl { width: 960px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-20) var(--space-24);
  border-bottom: 1px solid var(--border-lighter);
}
.modal-title { font-family: var(--font-primary); font-size: var(--fs-16); font-weight: 700; color: var(--grey-800); }
.modal-close {
  width: 32px; height: 32px;
  border: none; background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--grey-500);
  transition: background 0.15s;
}
.modal-close:hover { background: var(--grey-100); }
.modal-close svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.modal-body {
  padding: var(--space-24);
  font-family: var(--font-secondary);
  font-size: var(--fs-14);
  color: var(--grey-600);
  line-height: 1.6;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-8);
  padding: var(--space-16) var(--space-24);
  border-top: 1px solid var(--border-lighter);
}

/* ─────────────────────────────────────────────────────────────
   13. TOASTS
   ───────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: var(--space-20);
  right: var(--space-20);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  z-index: 2000;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-10);
  padding: var(--space-12) var(--space-16);
  border-radius: var(--radius-lg);
  background: var(--neutral-white);
  border: 1px solid var(--border-lighter);
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 400px;
  pointer-events: auto;
  animation: toast-in 0.25s ease-out;
}
@keyframes toast-in  { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { to   { opacity: 0; transform: translateX(40px); } }
.toast-hiding { animation: toast-out 0.2s ease-in forwards; }
.toast-icon  { flex-shrink: 0; margin-top: 1px; }
.toast-content { flex: 1; }
.toast-title   { font-family: var(--font-primary); font-size: var(--fs-14); font-weight: 700; margin-bottom: var(--space-2); }
.toast-message { font-family: var(--font-secondary); font-size: var(--fs-13); color: var(--grey-600); }
.toast-close   { flex-shrink: 0; width: 20px; height: 20px; border: none; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--grey-400); border-radius: var(--radius-sm); margin-top: 1px; }
.toast-close:hover { background: var(--grey-100); color: var(--grey-600); }
.toast-success { border-left: 3px solid var(--success-300); }
.toast-success .toast-icon { color: var(--success-300); }
.toast-success .toast-title { color: var(--success-400); }
.toast-error   { border-left: 3px solid var(--error-200); }
.toast-error .toast-icon { color: var(--error-200); }
.toast-error .toast-title { color: var(--error-200); }
.toast-warning { border-left: 3px solid var(--tertiary-600); }
.toast-warning .toast-icon { color: var(--tertiary-600); }
.toast-warning .toast-title { color: var(--tertiary-800); }
.toast-info    { border-left: 3px solid var(--primary-500); }
.toast-info .toast-icon { color: var(--primary-500); }
.toast-info .toast-title { color: var(--primary-600); }

/* ─────────────────────────────────────────────────────────────
   14. PROGRESS BARS
   ───────────────────────────────────────────────────────────── */
.progress-bar-wrap { width: 100%; height: 8px; background: var(--grey-200); border-radius: var(--radius-full); overflow: hidden; }
.progress-bar-wrap.progress-lg { height: 16px; }
.progress-bar-fill { height: 100%; border-radius: var(--radius-full); background: var(--progress-bar-color); transition: width 0.4s ease; }
.progress-bar-fill.progress-primary { background: var(--primary-500); }
.progress-bar-fill.progress-striped {
  background-image: linear-gradient(45deg, rgba(255,255,255,0.2) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.2) 75%, transparent 75%, transparent);
  background-size: 16px 16px;
}
.progress-label { display: flex; justify-content: space-between; font-family: var(--font-secondary); font-size: var(--fs-12); color: var(--grey-600); margin-bottom: var(--space-6); }
.progress-label span:last-child { font-weight: 600; }

/* ─────────────────────────────────────────────────────────────
   15. FILE UPLOAD DROPZONE  (verbatim from design library)
   ───────────────────────────────────────────────────────────── */
.fu-dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  padding: var(--space-24) var(--space-16);
  border: 2px dashed var(--grey-300);
  border-radius: var(--radius-lg);
  background: var(--neutral-white);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-align: center;
}
.fu-dropzone:hover { border-color: var(--primary-300); background: var(--primary-50); }
.fu-dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.fu-dropzone.fu-dragover { border-color: var(--primary-500); background: var(--primary-50); }
.fu-dropzone.fu-error { border-color: var(--error-200); }
.fu-dropzone-icon { font-size: 36px; color: var(--grey-400); margin-bottom: var(--space-10); }
.fu-dragover .fu-dropzone-icon { color: var(--primary-500); }
.fu-dropzone-text { font-family: var(--font-secondary); font-size: var(--fs-14); color: var(--grey-600); line-height: 1.5; }
.fu-dropzone-text .fu-browse { color: var(--primary-500); font-weight: 600; text-decoration: underline; cursor: pointer; }
.fu-dropzone-hint { font-family: var(--font-secondary); font-size: var(--fs-12); color: var(--grey-500); margin-top: var(--space-4); }
.fu-file-item { display: flex; align-items: center; gap: var(--space-10); margin-top: var(--space-12); padding: var(--space-10) var(--space-12); background: var(--primary-50); border-radius: var(--radius-md); }
.fu-file-icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--primary-500); }
.fu-file-name { font-family: var(--font-secondary); font-size: var(--fs-14); color: var(--grey-700); font-weight: 500; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fu-file-size { font-family: var(--font-secondary); font-size: var(--fs-13); color: var(--grey-400); margin-left: var(--space-4); white-space: nowrap; }
.fu-file-delete { background: none; border: none; color: var(--grey-500); cursor: pointer; padding: var(--space-4); margin-left: auto; transition: color 0.15s; flex-shrink: 0; }
.fu-file-delete:hover { color: var(--error-100); }
.fu-file-delete svg { width: 16px; height: 16px; }
.fu-error-msg { font-family: var(--font-secondary); font-size: var(--fs-13); color: var(--error-200); margin-top: var(--space-8); display: none; }
.fu-error-msg.fu-visible { display: block; }
[data-theme="dark"] .fu-dropzone { background: var(--grey-100); border-color: var(--grey-500); }
[data-theme="dark"] .fu-dropzone:hover { border-color: var(--primary-400); background: rgba(0,175,237,0.08); }

/* ─────────────────────────────────────────────────────────────
   16. PAGINATION
   ───────────────────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: var(--space-4); }
.page-item { font-family: var(--font-secondary); font-size: var(--fs-14); font-weight: 500; color: var(--grey-700); min-width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-md); cursor: pointer; border: 1px solid transparent; background: transparent; transition: background 0.15s, color 0.15s; text-decoration: none; }
.page-item:hover { background: var(--primary-50); color: var(--primary-600); text-decoration: none; }
.page-item.page-active { background: var(--primary-500); color: var(--neutral-white); font-weight: 600; }
.page-item.page-disabled { color: var(--grey-300); cursor: not-allowed; pointer-events: none; }
.page-item.page-nav { border: 1px solid var(--border-lighter); background: var(--neutral-white); }
.page-item.page-nav:hover { background: var(--primary-50); border-color: var(--primary-200); }
.page-item svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ─────────────────────────────────────────────────────────────
   17. TABS
   ───────────────────────────────────────────────────────────── */
.tab-bar { display: flex; gap: 0; border-bottom: 1px solid var(--border-lighter); }
.tab-item { font-family: var(--font-secondary); font-size: var(--fs-14); font-weight: 500; color: var(--grey-600); padding: var(--space-8) var(--space-16) 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: var(--space-8); transition: color 0.15s; text-decoration: none; }
.tab-item:hover { color: var(--primary-600); text-decoration: none; }
.tab-indicator { width: 100%; height: 3px; border-radius: 2px; background: transparent; }
.tab-item.tab-active { color: var(--primary-600); font-weight: 600; }
.tab-item.tab-active .tab-indicator { background: var(--primary-600); }
.tab-content { display: none; }
.tab-content.tab-active { display: block; }

/* ─────────────────────────────────────────────────────────────
   18. DROPDOWNS
   ───────────────────────────────────────────────────────────── */
.dropdown-wrap { position: relative; display: inline-block; }
.dropdown-trigger { font-family: var(--font-secondary); font-size: var(--fs-14); font-weight: 400; color: var(--grey-800); background: var(--neutral-white); border: 1px solid var(--input-border); border-radius: var(--radius-md); padding: var(--space-8) var(--space-12); cursor: pointer; display: inline-flex; align-items: center; gap: var(--space-8); transition: border-color 0.15s; white-space: nowrap; }
.dropdown-trigger:hover { border-color: var(--primary-500); }
.dropdown-menu { position: absolute; top: calc(100% + 4px); left: 0; min-width: 200px; background: var(--neutral-white); border: 1px solid var(--border-lighter); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); z-index: 200; display: none; padding: var(--space-4) 0; }
.dropdown-wrap.dd-open .dropdown-menu { display: block; }
.dropdown-item { display: flex; align-items: center; gap: var(--space-8); padding: var(--space-8) var(--space-16); font-family: var(--font-secondary); font-size: var(--fs-14); color: var(--grey-700); cursor: pointer; transition: background 0.1s; text-decoration: none; }
.dropdown-item:hover { background: var(--primary-50); color: var(--primary-500); text-decoration: none; }
.dropdown-item.dd-active { background: var(--primary-50); color: var(--primary-500); font-weight: 600; }
.dropdown-item--danger { color: var(--error-200); }
.dropdown-item--danger:hover { background: var(--error-50); color: var(--error-200); }
.dropdown-divider { height: 1px; background: var(--border-lighter); margin: var(--space-4) 0; }

/* ─────────────────────────────────────────────────────────────
   19. LOGIN PAGE
   ───────────────────────────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  background: linear-gradient(135deg, var(--primary-700) 0%, var(--primary-600) 50%, var(--primary-500) 100%);
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  top: -20%;  right: -10%;
  width: 500px; height: 500px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
}
.login-page::after {
  content: '';
  position: absolute;
  bottom: -20%; left: -10%;
  width: 400px; height: 400px;
  background: rgba(255,255,255,0.03);
  border-radius: 50%;
}
.login-card {
  background: var(--neutral-white);
  border-radius: 16px;
  padding: 48px 40px 40px;
  width: 420px;
  max-width: 92vw;
  box-shadow: var(--shadow-2xl);
  position: relative;
  z-index: 1;
}
.login-logo { text-align: center; margin-bottom: var(--space-8); }
.login-logo-text { font-family: var(--font-primary); font-size: 32px; font-weight: 700; color: var(--primary-500); letter-spacing: 3px; display: block; }
.login-logo-sub { font-family: var(--font-secondary); font-size: var(--fs-11); color: var(--grey-500); text-transform: uppercase; letter-spacing: 2px; display: block; margin-top: 4px; }
.login-tagline { text-align: center; font-family: var(--font-secondary); font-size: var(--fs-14); color: var(--grey-600); line-height: 1.5; margin-bottom: var(--space-32); }
.login-divider { text-align: center; font-family: var(--font-secondary); font-size: var(--fs-12); color: var(--grey-400); margin: var(--space-20) 0; display: flex; align-items: center; gap: var(--space-12); }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border-lighter); }
.login-footer { text-align: center; margin-top: var(--space-24); font-family: var(--font-secondary); font-size: var(--fs-12); color: var(--grey-500); line-height: 1.6; }

/* Microsoft sign-in button */
.btn-microsoft {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-12);
  width: 100%;
  padding: var(--space-12) var(--space-20);
  background: #2F2F2F;
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-primary);
  font-size: var(--fs-14);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-microsoft:hover { background: #1a1a1a; }
.btn-microsoft:disabled { background: var(--grey-300); cursor: not-allowed; }
.btn-microsoft svg { flex-shrink: 0; }

/* ─────────────────────────────────────────────────────────────
   20. HERO BANNER (inside main pages)
   ───────────────────────────────────────────────────────────── */
.hero-banner {
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-700) 100%);
  border-radius: var(--radius-lg);
  padding: var(--space-32) var(--space-40);
  margin-bottom: var(--space-32);
  position: relative;
  overflow: hidden;
  color: #fff;
}
.hero-banner::before { content: ''; position: absolute; top: -40%; right: -5%; width: 240px; height: 240px; background: rgba(255,255,255,0.05); border-radius: 50%; }
.hero-banner::after  { content: ''; position: absolute; bottom: -30%; right: 18%; width: 180px; height: 180px; background: rgba(255,255,255,0.04); border-radius: 50%; }
.hero-banner h2 { font-family: var(--font-primary); font-size: var(--fs-24); font-weight: 700; color: #fff; margin: 0 0 var(--space-8); position: relative; z-index: 1; }
.hero-banner p  { font-family: var(--font-secondary); font-size: var(--fs-14); color: rgba(255,255,255,0.85); margin: 0; max-width: 560px; position: relative; z-index: 1; }
[data-theme="dark"] .hero-banner { background: linear-gradient(135deg, #0B5E8A 0%, #1273A8 100%); }

/* ─────────────────────────────────────────────────────────────
   21. COLUMN MAPPING TABLE (upload page)
   ───────────────────────────────────────────────────────────── */
.mapping-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 80px;
  gap: var(--space-8) var(--space-16);
  align-items: center;
}
.mapping-grid .col-header {
  font-family: var(--font-primary);
  font-size: var(--fs-12);
  font-weight: 700;
  color: var(--grey-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--border-lighter);
}
.mapping-field-label {
  font-family: var(--font-secondary);
  font-size: var(--fs-14);
  font-weight: 600;
  color: var(--grey-700);
}
.mapping-required-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--error-200);
  margin-left: 4px;
  vertical-align: middle;
}
.mapping-confidence {
  font-family: var(--font-secondary);
  font-size: var(--fs-12);
  font-weight: 600;
  text-align: center;
}
.mapping-confidence.high   { color: var(--success-400); }
.mapping-confidence.medium { color: var(--tertiary-700); }
.mapping-confidence.low    { color: var(--error-200); }

/* ─────────────────────────────────────────────────────────────
   22. CONFIDENCE BAND ROW COLOURS (results table)
   ───────────────────────────────────────────────────────────── */
.row-band-high         td { background: #F0FDF4 !important; }
.row-band-medium       td { background: #FEFCE8 !important; }
.row-band-low          td { background: #FFF7ED !important; }
.row-band-unclassified td { background: #FFF1F1 !important; }
[data-theme="dark"] .row-band-high         td { background: rgba(28,224,125,0.07) !important; }
[data-theme="dark"] .row-band-medium       td { background: rgba(229,201,55,0.07) !important; }
[data-theme="dark"] .row-band-low          td { background: rgba(247,117,44,0.07) !important; }
[data-theme="dark"] .row-band-unclassified td { background: rgba(241,138,141,0.08) !important; }

/* ─────────────────────────────────────────────────────────────
   23. AVATAR
   ───────────────────────────────────────────────────────────── */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-primary); font-weight: 700;
  color: var(--neutral-white); background: var(--primary-500); flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: var(--fs-11); }
.avatar-md { width: 36px; height: 36px; font-size: var(--fs-13); }
.avatar-circle  { border-radius: 50%; }
.avatar-rounded { border-radius: var(--radius-md); }

/* ─────────────────────────────────────────────────────────────
   24. EMPTY STATE
   ───────────────────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: var(--space-48) var(--space-24);
}
.empty-state-icon {
  width: 64px; height: 64px;
  border-radius: 16px;
  background: var(--primary-50);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--space-16);
}
.empty-state-icon svg { width: 28px; height: 28px; stroke: var(--primary-500); fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.empty-state-title { font-family: var(--font-primary); font-size: var(--fs-16); font-weight: 700; color: var(--grey-700); margin-bottom: var(--space-8); }
.empty-state-desc  { font-family: var(--font-secondary); font-size: var(--fs-14); color: var(--grey-500); max-width: 360px; line-height: 1.6; margin-bottom: var(--space-20); }

/* ─────────────────────────────────────────────────────────────
   25. MISCELLANEOUS UTILITIES
   ───────────────────────────────────────────────────────────── */
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: var(--space-8); }
.gap-12 { gap: var(--space-12); }
.gap-16 { gap: var(--space-16); }
.gap-24 { gap: var(--space-24); }
.mt-8  { margin-top: var(--space-8); }
.mt-16 { margin-top: var(--space-16); }
.mt-24 { margin-top: var(--space-24); }
.mt-32 { margin-top: var(--space-32); }
.mb-16 { margin-bottom: var(--space-16); }
.mb-24 { margin-bottom: var(--space-24); }
.mb-32 { margin-bottom: var(--space-32); }
.text-muted { color: var(--grey-500); font-size: var(--fs-13); }
.text-sm    { font-size: var(--fs-13); }
.text-xs    { font-size: var(--fs-12); }
.text-right { text-align: right; }
.font-mono  { font-family: 'Courier New', monospace; }
.truncate   { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-full     { width: 100%; }
.divider    { height: 1px; background: var(--border-lighter); margin: var(--space-24) 0; }

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--grey-200);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-lg { width: 40px; height: 40px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Loading overlay on cards */
.card-loading {
  position: relative;
  pointer-events: none;
}
.card-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.7);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
}
[data-theme="dark"] .card-loading::after { background: rgba(30,30,30,0.7); }

/* Tooltips */
[data-tooltip] { position: relative; cursor: pointer; }
[data-tooltip]::before, [data-tooltip]::after { position: absolute; opacity: 0; visibility: hidden; transition: opacity 0.15s, visibility 0.15s; pointer-events: none; z-index: 50; }
[data-tooltip]::after { content: attr(data-tooltip); background: var(--tooltip-bg); color: var(--tooltip-text); font-family: var(--font-secondary); font-size: var(--fs-12); font-weight: 500; padding: var(--space-6) var(--space-12); border-radius: var(--radius-md); white-space: nowrap; line-height: 1.4; box-shadow: var(--shadow-md); bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); }
[data-tooltip]::before { content: ''; border: 5px solid transparent; border-top-color: var(--tooltip-bg); bottom: calc(100% + -2px); left: 50%; transform: translateX(-50%); }
[data-tooltip]:hover::before, [data-tooltip]:hover::after { opacity: 1; visibility: visible; }

/* Scrollable table wrapper */
.table-scroll { overflow-x: auto; }

/* Section divider */
.section-title {
  font-family: var(--font-primary);
  font-size: var(--fs-16);
  font-weight: 700;
  color: var(--grey-800);
  margin-bottom: var(--space-16);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--border-lighter);
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

/* Two-column layout for wider pages */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-24);
}
.three-col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-24);
}

/* ─────────────────────────────────────────────────────────────
   26. RESPONSIVE
   ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  main { padding: var(--space-24) var(--space-20); }
  .form-grid { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .three-col { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  main { padding: var(--space-20) var(--space-16); }
  .mapping-grid { grid-template-columns: 1fr 1fr; }
  .mapping-grid .mapping-confidence { display: none; }
  .three-col { grid-template-columns: 1fr; }
  .page-header-row { flex-direction: column; align-items: flex-start; }
}

/* ─────────────────────────────────────────────────────────────
   27. TABLE ACTION DROPDOWN  (dashboard row menu)
   ───────────────────────────────────────────────────────────── */
.table-action-wrap {
  position: relative;
  display: inline-block;
}
.table-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border: 1px solid var(--border-lighter);
  border-radius: var(--radius-md);
  background: var(--neutral-white);
  color: var(--grey-500);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  padding: 0;
}
.table-action-btn:hover { background: var(--grey-100); border-color: var(--grey-300); color: var(--grey-700); }
.table-action-btn svg  { width: 16px; height: 16px; flex-shrink: 0; }
.table-action-menu {
  display: none;
  position: fixed;
  min-width: 170px;
  background: var(--neutral-white);
  border: 1px solid var(--border-lighter);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 400;
  padding: var(--space-4) 0;
}
.table-action-wrap.ta-open .table-action-menu { display: block; }
.table-action-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-8) var(--space-14);
  font-family: var(--font-secondary);
  font-size: var(--fs-13);
  color: var(--grey-700);
  cursor: pointer;
  transition: background 0.1s;
  white-space: nowrap;
}
.table-action-menu-item:hover { background: var(--primary-50); color: var(--primary-600); }
.table-action-menu-item svg  { width: 15px; height: 15px; flex-shrink: 0; }
.table-action-menu-item--danger { color: var(--error-200); }
.table-action-menu-item--danger:hover { background: var(--error-50); color: var(--error-200); }
.table-action-menu-divider { height: 1px; background: var(--border-lighter); margin: var(--space-4) 0; }
[data-theme="dark"] .table-action-btn  { background: var(--grey-100); border-color: var(--grey-500); }
[data-theme="dark"] .table-action-menu { background: #1e2124; border-color: var(--grey-600); }
[data-theme="dark"] .table-action-menu-item { color: var(--grey-300); }
[data-theme="dark"] .table-action-menu-item:hover { background: rgba(0,175,237,0.1); color: var(--primary-300); }

/* ─────────────────────────────────────────────────────────────
   28. FILE UPLOAD DROPZONE — fu-icon / fu-title / fu-hint
   ───────────────────────────────────────────────────────────── */
.fu-icon {
  width: 40px; height: 40px;
  flex-shrink: 0;
  color: var(--grey-400);
  margin-bottom: var(--space-8);
}
.fu-title {
  font-family: var(--font-secondary);
  font-size: var(--fs-14);
  font-weight: 600;
  color: var(--grey-600);
  line-height: 1.4;
}
.fu-hint {
  font-family: var(--font-secondary);
  font-size: var(--fs-13);
  color: var(--grey-500);
  margin-top: var(--space-4);
}
.fu-browse { color: var(--primary-500); font-weight: 600; text-decoration: underline; cursor: pointer; }
.fu-dropzone { min-height: 140px; }
.fu-dragover .fu-icon { color: var(--primary-500); }

/* ─────────────────────────────────────────────────────────────
   29. STEP INDICATOR  (upload wizard)
   ───────────────────────────────────────────────────────────── */
.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
  flex-shrink: 0;
}
.step-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--grey-300);
  background: var(--neutral-white);
  color: var(--grey-400);
  font-family: var(--font-primary);
  font-size: var(--fs-12);
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.step-dot.active   { border-color: var(--primary-500); background: var(--primary-500); color: #fff; }
.step-dot.complete { border-color: var(--success-400); background: var(--success-400); color: #fff; }
.step-label {
  font-family: var(--font-secondary);
  font-size: var(--fs-12);
  color: var(--grey-500);
  white-space: nowrap;
}
.step-item .step-dot.active ~ .step-label,
.step-item:has(.step-dot.active) .step-label { color: var(--primary-600); font-weight: 600; }
.step-line {
  flex: 1;
  height: 2px;
  background: var(--grey-200);
  margin-bottom: 22px; /* align with dot centre */
  min-width: 24px;
}

/* ─────────────────────────────────────────────────────────────
   22. RESULT PAGE — HEALTH BAR & TOTALS STRIP
   ───────────────────────────────────────────────────────────── */
.result-health-strip {
  background: var(--card-bg);
  border: 1px solid var(--border-lighter);
  border-radius: var(--radius-lg);
  padding: var(--space-14) var(--space-20);
  margin-bottom: var(--space-8);
  display: flex;
  align-items: center;
  gap: var(--space-20);
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
.rhs-left {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  flex-shrink: 0;
}
.rhs-count {
  font-family: var(--font-primary);
  font-size: var(--fs-18);
  font-weight: 700;
  color: var(--grey-800);
}
.rhs-unit {
  font-family: var(--font-secondary);
  font-size: var(--fs-13);
  color: var(--grey-500);
  white-space: nowrap;
}
.rhs-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  width: 140px;
  background: var(--grey-150);
  flex-shrink: 0;
}
.rhs-seg { height: 100%; transition: width 0.6s ease; }
.rhs-seg.rhs-high { background: #22c55e; }
.rhs-seg.rhs-med  { background: #eab308; }
.rhs-seg.rhs-low  { background: #f97316; }
.rhs-seg.rhs-unc  { background: #d1d5db; }
.rhs-stats {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  flex-wrap: wrap;
  font-family: var(--font-secondary);
  font-size: var(--fs-13);
}
.rhs-stat { display: flex; align-items: center; gap: var(--space-5); }
.rhs-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.rhs-stat-high .rhs-dot { background: #22c55e; }
.rhs-stat-med  .rhs-dot { background: #eab308; }
.rhs-stat-unc  .rhs-dot { background: #d1d5db; }
.rhs-stat-high { color: #15803d; }
.rhs-stat-med  { color: var(--grey-700); }
.rhs-stat-unc  { color: var(--grey-500); }
.rhs-divider { color: var(--grey-300); padding: 0 var(--space-2); }
.rhs-flagged {
  color: #ef4444;
  font-weight: 600;
  text-decoration: none;
  font-size: var(--fs-13);
}
.rhs-flagged:hover { text-decoration: underline; color: #dc2626; }
[data-theme="dark"] .rhs-stat-high { color: #4ade80; }
[data-theme="dark"] .rhs-stat-med  { color: #facc15; }

.result-totals-strip {
  background: var(--card-bg);
  border: 1px solid var(--border-lighter);
  border-radius: var(--radius-lg);
  padding: var(--space-10) var(--space-20);
  margin-bottom: var(--space-24);
  display: flex;
  align-items: center;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: var(--space-4);
}
.rts-item {
  display: flex;
  align-items: baseline;
  gap: var(--space-8);
  padding: var(--space-6) var(--space-16);
}
.rts-item:first-child { padding-left: 0; }
.rts-label {
  font-family: var(--font-secondary);
  font-size: var(--fs-11);
  font-weight: 600;
  color: var(--grey-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.rts-value {
  font-family: var(--font-primary);
  font-size: var(--fs-15);
  font-weight: 700;
  color: var(--grey-800);
  white-space: nowrap;
}
.rts-warn {
  font-size: var(--fs-13);
  color: #ef4444;
  cursor: default;
  margin-left: var(--space-4);
}
.rts-div {
  width: 1px;
  height: 24px;
  background: var(--border-lighter);
  flex-shrink: 0;
  align-self: center;
}

/* ─────────────────────────────────────────────────────────────
   26. UPLOAD — STEP 2 REVIEW (column decisions, hierarchy tree)
   ───────────────────────────────────────────────────────────── */

/* Compact form-input for inline table controls */
.form-input.form-input-sm {
  font-size: var(--fs-13);
  padding: var(--space-6) var(--space-10);
  padding-right: 30px;
}
select.form-input.form-input-sm {
  background-position: right 8px center;
  background-size: 14px 14px;
}

/* Excluded column row — muted appearance */
.ds-table tbody tr.col-row-excluded td {
  color: var(--grey-500);
  background: var(--grey-50);
}
.ds-table tbody tr.col-row-excluded td:first-child { text-decoration: line-through; }
.ds-table.table-hover tbody tr.col-row-excluded:hover td { background: var(--grey-100); }

/* Role badge trigger button — inline, keyboard-focusable */
.role-badge-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-6);
  background: transparent;
  border: 1px dashed transparent;
  border-radius: var(--radius-md);
  padding: 3px var(--space-6);
  cursor: pointer;
  font-family: var(--font-primary);
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.role-badge-btn:hover {
  border-color: var(--primary-300);
  background: var(--primary-50);
}
.role-badge-btn:focus-visible {
  outline: none;
  border-color: var(--primary-500);
  background: var(--primary-50);
  box-shadow: 0 0 0 3px var(--input-focus-ring);
}
.role-badge-caret {
  flex-shrink: 0;
  color: var(--grey-500);
}

/* Role popover (reassign role) */
.role-popover {
  position: absolute;
  z-index: 300;
  min-width: 200px;
  background: var(--neutral-white);
  border: 1px solid var(--border-lighter);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.role-popover-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  padding: var(--space-6) var(--space-10);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-secondary);
  font-size: var(--fs-13);
  color: var(--grey-700);
  transition: background 0.1s;
}
.role-popover-item:hover,
.role-popover-item:focus-visible {
  outline: none;
  background: var(--primary-50);
  color: var(--primary-600);
}
.role-popover-item.is-active {
  background: var(--primary-50);
  color: var(--primary-600);
  font-weight: 600;
}
[data-theme="dark"] .role-popover { background: var(--card-bg); }

/* Flatten toggle (switch) */
.flatten-toggle {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--space-12);
  cursor: pointer;
  user-select: none;
}
.flatten-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
  pointer-events: none;
}
.flatten-toggle-track {
  position: relative;
  flex-shrink: 0;
  width: 36px;
  height: 20px;
  background: var(--grey-300);
  border-radius: var(--radius-full);
  transition: background 0.15s;
  margin-top: 2px;
}
.flatten-toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: var(--neutral-white);
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: transform 0.15s;
}
.flatten-toggle input[type="checkbox"]:checked ~ .flatten-toggle-track {
  background: var(--primary-500);
}
.flatten-toggle input[type="checkbox"]:checked ~ .flatten-toggle-track .flatten-toggle-thumb {
  transform: translateX(16px);
}
.flatten-toggle input[type="checkbox"]:focus-visible ~ .flatten-toggle-track {
  box-shadow: 0 0 0 3px var(--input-focus-ring);
}

/* Hierarchy preview tree */
.hierarchy-tree {
  font-family: var(--font-secondary);
  font-size: var(--fs-13);
  line-height: 1.5;
  color: var(--grey-700);
  background: var(--grey-50);
  border: 1px solid var(--border-lighter);
  border-radius: var(--radius-md);
  padding: var(--space-12) var(--space-16);
  max-height: 360px;
  overflow-y: auto;
}
.hier-row {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  padding: 3px 0;
  white-space: nowrap;
}
.hier-glyph {
  font-family: 'Consolas', 'Menlo', monospace;
  color: var(--grey-400);
  flex-shrink: 0;
  min-width: 20px;
}
.hier-name {
  color: var(--grey-800);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hier-count {
  color: var(--grey-500);
  font-size: var(--fs-12);
  flex-shrink: 0;
}
.hier-badges {
  display: inline-flex;
  align-items: center;
  gap: var(--space-6);
  flex-shrink: 0;
}
[data-theme="dark"] .hierarchy-tree { background: var(--grey-100); }
