/* ============================================================
   PERM MIGRATION PROCESS — DASHBOARD
   ============================================================ */

/* ---------- Base reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: none; text-size-adjust: none;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility; scroll-behavior: smooth;
  scroll-padding-top: 84px;
}
body {
  min-height: 100dvh; line-height: 1.6;
  font-family: var(--font-body, sans-serif);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
}
img, svg { display: block; max-width: 100%; height: auto; }
ul[role="list"], ol[role="list"] { list-style: none; }
h1,h2,h3,h4,h5,h6 { text-wrap: balance; line-height: 1.15; font-family: var(--font-display); }
p, li, figcaption { text-wrap: pretty; }
::selection { background: color-mix(in oklab, var(--color-primary) 30%, transparent); }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; border-radius: var(--radius-sm); }
button { cursor: pointer; background: none; border: none; font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
a, button, [role="button"], input, select { transition: color .18s cubic-bezier(.16,1,.3,1), background .18s cubic-bezier(.16,1,.3,1), border-color .18s cubic-bezier(.16,1,.3,1), box-shadow .18s cubic-bezier(.16,1,.3,1), transform .18s cubic-bezier(.16,1,.3,1); }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border-width:0; }

/* ---------- Design tokens ---------- */
:root, [data-theme="light"] {
  --color-bg: #f4f6f9;
  --color-surface: #ffffff;
  --color-surface-2: #fbfcfd;
  --color-surface-offset: #ecf0f5;
  --color-surface-offset-2: #e3e9f0;
  --color-divider: #e1e6ec;
  --color-border: #d4dbe4;

  --color-text: #131c2b;
  --color-text-muted: #58657a;
  --color-text-faint: #97a3b4;
  --color-text-inverse: #f7f9fb;

  --color-primary: #1c5b8c;
  --color-primary-hover: #144568;
  --color-primary-active: #0d3049;
  --color-primary-highlight: #d7e4ee;

  --color-warning: #a86a10;
  --color-warning-hover: #8a5609;
  --color-warning-highlight: #f0e0c4;

  --color-error: #a63838;
  --color-error-hover: #862b2b;
  --color-error-highlight: #f0d9d9;

  --color-success: #1f7a5c;
  --color-success-hover: #15603f;
  --color-success-highlight: #d6ebe1;

  --color-gold: #b98a1f;
  --color-blue: #3d7ab8;
  --color-teal: #2c8a86;

  --radius-sm: 0.375rem; --radius-md: 0.6rem; --radius-lg: 0.9rem; --radius-xl: 1.25rem; --radius-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(19,28,43,0.06);
  --shadow-md: 0 6px 20px rgba(19,28,43,0.08);
  --shadow-lg: 0 18px 44px rgba(19,28,43,0.14);

  --content-wide: 1280px;
  --font-display: 'General Sans', 'Segoe UI', sans-serif;
  --font-body: 'Satoshi', 'Segoe UI', sans-serif;
}

[data-theme="dark"] {
  --color-bg: #0c1420;
  --color-surface: #101b29;
  --color-surface-2: #13202f;
  --color-surface-offset: #16273a;
  --color-surface-offset-2: #1b2f45;
  --color-divider: #1e3145;
  --color-border: #2a4159;

  --color-text: #e7edf4;
  --color-text-muted: #94a5bb;
  --color-text-faint: #5d7188;
  --color-text-inverse: #101b29;

  --color-primary: #5b9bd4;
  --color-primary-hover: #7fb2e0;
  --color-primary-active: #9cc4e8;
  --color-primary-highlight: #1c3550;

  --color-warning: #d9a441;
  --color-warning-hover: #e4b768;
  --color-warning-highlight: #3d3218;

  --color-error: #d97a7a;
  --color-error-hover: #e39898;
  --color-error-highlight: #3a2020;

  --color-success: #56b592;
  --color-success-hover: #79c7ab;
  --color-success-highlight: #17332a;

  --color-gold: #e0b657;
  --color-blue: #7fb2e0;
  --color-teal: #5fc2bd;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 6px 20px rgba(0,0,0,0.35);
  --shadow-lg: 0 18px 44px rgba(0,0,0,0.5);
}

/* ---------- Type scale ---------- */
:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.2vw, 0.8125rem);
  --text-sm: clamp(0.875rem, 0.84rem + 0.2vw, 0.9375rem);
  --text-base: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --text-lg: clamp(1.125rem, 1.05rem + 0.4vw, 1.375rem);
  --text-xl: clamp(1.375rem, 1.2rem + 0.9vw, 1.875rem);
  --text-2xl: clamp(1.75rem, 1.3rem + 2vw, 2.75rem);
  --text-3xl: clamp(2.1rem, 1.3rem + 3.4vw, 3.6rem);
}

/* ---------- Spacing ---------- */
:root {
  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
  --space-5: 1.25rem; --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem;
  --space-12: 3rem; --space-16: 4rem; --space-20: 5rem; --space-24: 6rem;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.wrap { max-width: var(--content-wide); margin-inline: auto; padding-inline: var(--space-6); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--color-surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-divider);
}
.header-row {
  display: flex; align-items: center; justify-content: space-between;
  padding-block: var(--space-3);
  gap: var(--space-4);
}
.brand { display: flex; align-items: center; gap: var(--space-3); }
.brand-mark { width: 34px; height: 34px; color: var(--color-primary); flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-title { font-family: var(--font-display); font-weight: 600; font-size: var(--text-base); letter-spacing: -0.01em; }
.brand-sub { font-size: var(--text-xs); color: var(--color-text-muted); }

.top-nav { display: flex; align-items: center; gap: var(--space-1); }
.top-nav a {
  font-size: var(--text-xs); font-weight: 500; color: var(--color-text-muted);
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-full);
  white-space: nowrap;
}
.top-nav a:hover { color: var(--color-text); background: var(--color-surface-offset); }
.theme-toggle {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: var(--radius-full); border: 1px solid var(--color-border);
  color: var(--color-text-muted); flex-shrink: 0;
}
.theme-toggle:hover { color: var(--color-text); border-color: var(--color-text-faint); }
.theme-toggle svg { width: 16px; height: 16px; }

@media (max-width: 860px) {
  .top-nav { display: none; }
}

/* ---------- Hero ---------- */
.hero { padding-block: var(--space-16) var(--space-10); }
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--color-primary); background: var(--color-primary-highlight);
  padding: var(--space-1) var(--space-3); border-radius: var(--radius-full);
  margin-bottom: var(--space-5);
}
.hero h1 {
  font-size: var(--text-2xl); font-weight: 600; letter-spacing: -0.01em;
  max-width: 20ch; margin-bottom: var(--space-4);
}
.hero p.lede {
  font-size: var(--text-lg); color: var(--color-text-muted); max-width: 62ch; margin-bottom: var(--space-8);
  font-weight: 400;
}
.hero-note {
  font-size: var(--text-xs); color: var(--color-text-faint); max-width: 62ch;
}
.hero-note a { color: var(--color-text-muted); text-decoration: underline; text-decoration-color: var(--color-border); }

/* ---------- KPI strip ---------- */
.kpi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4);
  margin-top: var(--space-2);
}
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .kpi-grid { grid-template-columns: 1fr; } }

.kpi-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}
.kpi-label { font-size: var(--text-xs); color: var(--color-text-muted); font-weight: 500; margin-bottom: var(--space-2); }
.kpi-value {
  font-family: var(--font-display); font-weight: 600; font-size: var(--text-xl);
  font-variant-numeric: tabular-nums lining-nums; letter-spacing: -0.01em;
  display: flex; align-items: baseline; gap: var(--space-2);
}
.kpi-value .unit { font-size: var(--text-sm); color: var(--color-text-muted); font-weight: 500; font-family: var(--font-body); }
.kpi-tag {
  display: inline-block; margin-top: var(--space-2); font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.kpi-card.warn .kpi-value { color: var(--color-warning); }
.kpi-card.err .kpi-value { color: var(--color-error); }

/* ---------- Section shell ---------- */
.section { padding-block: var(--space-16); border-top: 1px solid var(--color-divider); }
.section-head { margin-bottom: var(--space-8); max-width: 72ch; }
.section-kicker {
  font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--color-text-faint); margin-bottom: var(--space-3);
}
.section-head h2 { font-size: var(--text-xl); font-weight: 600; margin-bottom: var(--space-3); letter-spacing: -0.01em; }
.section-head p { color: var(--color-text-muted); font-size: var(--text-base); }

/* ---------- Panel (generic card) ---------- */
.panel {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  padding: var(--space-6);
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); }
.panel-title { font-family: var(--font-display); font-weight: 600; font-size: var(--text-lg); }
.panel-icon {
  width: 38px; height: 38px; border-radius: var(--radius-md); flex-shrink: 0;
  display: grid; place-items: center; background: var(--color-primary-highlight); color: var(--color-primary);
}
.panel-icon svg { width: 20px; height: 20px; }
.panel-source { font-size: var(--text-xs); color: var(--color-text-faint); margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px dashed var(--color-divider); }
.panel-source a { color: var(--color-text-muted); text-decoration: underline; text-decoration-color: var(--color-border); }
.panel-source a:hover { color: var(--color-primary); }

/* ---------- Timeline / stepper ---------- */
.stepper {
  display: grid; grid-template-columns: repeat(9, 1fr); gap: var(--space-3);
  position: relative;
}
@media (max-width: 1100px) { .stepper { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .stepper { grid-template-columns: 1fr; } }

.step {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-2);
  position: relative; min-height: 180px;
}
.step-num {
  width: 26px; height: 26px; border-radius: var(--radius-full);
  background: var(--color-primary); color: var(--color-text-inverse);
  display: grid; place-items: center; font-size: var(--text-xs); font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.step.audit .step-num { background: var(--color-warning); }
.step-title { font-family: var(--font-display); font-weight: 600; font-size: var(--text-sm); line-height: 1.3; }
.step-desc { font-size: var(--text-xs); color: var(--color-text-muted); line-height: 1.5; flex: 1; }
.step-dur {
  font-size: var(--text-xs); font-weight: 600; color: var(--color-primary);
  background: var(--color-primary-highlight); padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm); align-self: flex-start;
}
.step.audit .step-dur { color: var(--color-warning); background: var(--color-warning-highlight); }

/* ---------- Two/three column grids ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- Recruitment window bar ---------- */
.window-bar-wrap { margin: var(--space-6) 0 var(--space-3); }
.window-bar-track { position: relative; padding-top: 22px; }
.window-bar {
  position: relative; height: 40px; background: var(--color-surface-offset);
  border-radius: var(--radius-full); overflow: hidden; border: 1px solid var(--color-border);
}
.window-fill {
  position: absolute; top: 0; bottom: 0; left: 16.6%; width: 66.6%;
  background: linear-gradient(90deg, var(--color-primary-highlight), var(--color-primary));
  opacity: 0.85;
}
.window-marker {
  position: absolute; top: 0; font-size: var(--text-xs); color: var(--color-text-muted); font-weight: 600;
  transform: translateX(-50%); white-space: nowrap;
}
.window-marker.end { transform: translateX(-100%); }
.window-marker:first-child { transform: translateX(0); }
.window-labels { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--color-text-faint); margin-top: var(--space-8); }

/* ---------- Recruitment table ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.req-table { font-size: var(--text-sm); width: 100%; min-width: 480px; }
.req-table th, .req-table td { text-align: left; padding: var(--space-3) var(--space-2); border-bottom: 1px solid var(--color-divider); }
.req-table th { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-faint); font-weight: 600; }
.req-table td.check { color: var(--color-success); font-weight: 700; text-align: center; }
.req-table td.cross { color: var(--color-text-faint); text-align: center; }

.activity-chip-grid { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.activity-chip {
  font-size: var(--text-xs); padding: var(--space-1) var(--space-3); border-radius: var(--radius-full);
  background: var(--color-surface-offset); border: 1px solid var(--color-border); color: var(--color-text-muted);
}

/* ---------- Rejection reasons list ---------- */
.reason-list { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-3); }
.reason-item { display: flex; gap: var(--space-3); font-size: var(--text-sm); align-items: flex-start; }
.reason-item svg { width: 16px; height: 16px; color: var(--color-success); flex-shrink: 0; margin-top: 3px; }

/* ---------- Charts ---------- */
.chart-panel { padding: var(--space-6); min-width: 0; }
.grid-2, .grid-3 { min-width: 0; }
.grid-2 > *, .grid-3 > * { min-width: 0; }
.chart-box { position: relative; width: 100%; height: 260px; margin-top: var(--space-4); }
.chart-legend { display: flex; gap: var(--space-4); flex-wrap: wrap; margin-top: var(--space-4); font-size: var(--text-xs); color: var(--color-text-muted); }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: var(--radius-full); margin-right: var(--space-2); vertical-align: middle; }

/* ---------- Audit callout ---------- */
.callout {
  border-radius: var(--radius-lg); padding: var(--space-6);
  border: 1px solid var(--color-warning); background: var(--color-warning-highlight);
  display: flex; gap: var(--space-4); align-items: flex-start;
}
.callout.err { border-color: var(--color-error); background: var(--color-error-highlight); }
.callout-icon { width: 26px; height: 26px; color: var(--color-warning); flex-shrink: 0; }
.callout.err .callout-icon { color: var(--color-error); }
.callout h4 { font-family: var(--font-display); font-size: var(--text-base); font-weight: 600; margin-bottom: var(--space-2); }
.callout p { font-size: var(--text-sm); color: var(--color-text); }

/* ---------- Wage level cards ---------- */
.wage-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); margin-top: var(--space-4); }
@media (max-width: 760px) { .wage-grid { grid-template-columns: repeat(2, 1fr); } }
.wage-card { border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-4); background: var(--color-surface-2); }
.wage-level { font-family: var(--font-display); font-weight: 700; font-size: var(--text-lg); color: var(--color-primary); margin-bottom: var(--space-2); }
.wage-desc { font-size: var(--text-xs); color: var(--color-text-muted); line-height: 1.5; }

/* ---------- Flow / post-cert steps ---------- */
.flow-row { display: flex; align-items: stretch; gap: var(--space-3); overflow-x: auto; padding-bottom: var(--space-2); }
.flow-node {
  flex: 1 0 200px; border: 1px solid var(--color-border); border-radius: var(--radius-md);
  padding: var(--space-4); background: var(--color-surface-2);
}
.flow-node .tag { font-size: var(--text-xs); font-weight: 600; color: var(--color-primary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: var(--space-2); display: block; }
.flow-node h5 { font-family: var(--font-display); font-size: var(--text-sm); font-weight: 600; margin-bottom: var(--space-2); }
.flow-node p { font-size: var(--text-xs); color: var(--color-text-muted); }
.flow-arrow { display: flex; align-items: center; color: var(--color-text-faint); flex: 0 0 auto; }
.flow-arrow svg { width: 18px; height: 18px; }
@media (max-width: 760px) { .flow-row { flex-direction: column; } .flow-arrow { transform: rotate(90deg); align-self: center; } }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--color-divider); padding-block: var(--space-10);
  color: var(--color-text-muted); font-size: var(--text-xs);
}
.site-footer .sources { columns: 2; gap: var(--space-8); margin-top: var(--space-5); }
@media (max-width: 700px) { .site-footer .sources { columns: 1; } }
.site-footer .sources li { margin-bottom: var(--space-2); break-inside: avoid; }
.site-footer .sources a { color: var(--color-text-muted); text-decoration: underline; text-decoration-color: var(--color-border); }
.site-footer .sources a:hover { color: var(--color-primary); }
.disclaimer { margin-top: var(--space-8); padding-top: var(--space-6); border-top: 1px dashed var(--color-divider); max-width: 72ch; }

/* ---------- Utility ---------- */
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.text-muted { color: var(--color-text-muted); }
.small { font-size: var(--text-sm); }
