:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-brand: #eef2ff;
  --text: #172033;
  --muted: #667085;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --brand: #4f46e5;
  --brand-dark: #3730a3;
  --brand-soft: #eef2ff;
  --accent: #0f9f8f;
  --accent-soft: #e7f8f5;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --warning: #b54708;
  --warning-soft: #fffaeb;
  --success: #067647;
  --success-soft: #ecfdf3;
  --surface-input: #ffffff;
  --surface-overlay: rgba(255, 255, 255, 0.94);
  --topbar-bg: rgba(246, 247, 251, 0.92);
  --sidebar-bg: #111827;
  --sidebar-text: #cbd5e1;
  --sidebar-muted: #98a2b3;
  --on-brand: #ffffff;
  --brand-text: #4f46e5;
  --empty-bg: rgba(255, 255, 255, 0.68);
  --focus-inner: #ffffff;
  --focus-outer: #3730a3;
  --safe-inline: max(18px, env(safe-area-inset-left));
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 12px 32px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 24px 60px rgba(49, 46, 129, 0.14);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --sidebar: 264px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

html[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #111827;
  --surface-soft: #172033;
  --surface-brand: #1e1b4b;
  --surface-input: #0f172a;
  --surface-overlay: rgba(17, 24, 39, 0.94);
  --topbar-bg: rgba(11, 17, 32, 0.92);
  --text: #f8fafc;
  --muted: #cbd5e1;
  --line: #334155;
  --line-strong: #64748b;
  --brand-soft: #1e1b4b;
  --brand-text: #c7d2fe;
  --accent-soft: #0b3b35;
  --danger: #fda29b;
  --danger-soft: #4a1d1b;
  --warning: #fec84b;
  --warning-soft: #3d2a10;
  --success: #6ce9a6;
  --success-soft: #0b3324;
  --empty-bg: rgba(17, 24, 39, 0.78);
  --focus-inner: #0b1120;
  --focus-outer: #a5b4fc;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.34);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.42);
}

html[data-theme="contrast"] {
  --bg: #000000;
  --surface: #000000;
  --surface-soft: #111111;
  --surface-brand: #000000;
  --surface-input: #000000;
  --surface-overlay: #000000;
  --topbar-bg: #000000;
  --sidebar-bg: #000000;
  --sidebar-text: #ffffff;
  --sidebar-muted: #ffffff;
  --text: #ffffff;
  --muted: #ffffff;
  --line: #ffffff;
  --line-strong: #ffffff;
  --brand: #ffd400;
  --brand-dark: #ffe66d;
  --brand-soft: #000000;
  --brand-text: #ffd400;
  --on-brand: #000000;
  --accent: #00ffff;
  --accent-soft: #000000;
  --danger: #ff8a80;
  --danger-soft: #000000;
  --warning: #ffd400;
  --warning-soft: #000000;
  --success: #7cff9b;
  --success-soft: #000000;
  --empty-bg: #000000;
  --focus-inner: #000000;
  --focus-outer: #00ffff;
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--bg); }
button, input, textarea, select { font: inherit; }
button, a { touch-action: manipulation; }
a { color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 200;
  background: var(--text);
  color: white;
  padding: 10px 14px;
  border-radius: 10px;
  text-decoration: none;
}
.skip-link:focus { top: 16px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  background: #111827;
  color: white;
  z-index: 40;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
  margin-bottom: 28px;
  text-decoration: none;
}
.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #818cf8, #4f46e5);
  color: white;
  font-weight: 900;
  font-size: 22px;
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.35);
}
.brand-copy strong { display: block; font-size: 19px; letter-spacing: -0.02em; }
.brand-copy small { display: block; color: #98a2b3; margin-top: 2px; font-size: 11px; }
.main-nav { display: grid; gap: 6px; }
.main-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 11px 13px;
  border-radius: 12px;
  text-decoration: none;
  color: #cbd5e1;
  font-weight: 650;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}
.main-nav a > span:first-child { width: 22px; text-align: center; color: #94a3b8; font-size: 18px; }
.main-nav a:hover { background: rgba(255,255,255,.07); color: white; transform: translateX(2px); }
.main-nav a.active { background: linear-gradient(135deg, rgba(99,102,241,.30), rgba(79,70,229,.18)); color: white; }
.main-nav a.active > span:first-child { color: #a5b4fc; }
.sidebar-trust {
  margin-top: auto;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  background: rgba(255,255,255,.04);
}
.trust-dot { width: 10px; height: 10px; border-radius: 50%; background: #34d399; margin-top: 5px; box-shadow: 0 0 0 5px rgba(52,211,153,.12); }
.sidebar-trust strong { display: block; font-size: 12px; }
.sidebar-trust small { display: block; color: #98a2b3; line-height: 1.45; margin-top: 3px; font-size: 11px; }
.version { margin-top: 14px; text-align: center; color: #667085; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }

.main-column { min-width: 0; }
.topbar {
  height: 72px;
  padding: 0 30px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(246,247,251,.90);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(228,231,236,.85);
}
.topbar-copy { display: grid; margin-right: auto; }
.topbar-copy span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .09em; font-weight: 800; }
.topbar-copy strong { font-size: 15px; }
.connection-status { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.connection-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.12); }
.connection-status.offline::before { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245,158,11,.12); }
.offline-banner {
  position: fixed;
  z-index: 150;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  background: #7c2d12;
  color: white;
  border-radius: 999px;
  padding: 10px 16px;
  box-shadow: var(--shadow-md);
  font-size: 12px;
}

.page { max-width: 1280px; margin: 0 auto; padding: 34px 30px 76px; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-header h1 { margin: 2px 0 7px; font-size: clamp(28px, 4vw, 42px); letter-spacing: -0.04em; line-height: 1.08; }
.page-header p { margin: 0; color: var(--muted); max-width: 760px; line-height: 1.65; }
.eyebrow { display: block; color: var(--brand); font-size: 11px; font-weight: 850; text-transform: uppercase; letter-spacing: .13em; }
.eyebrow.inverse { color: #c7d2fe; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.actions.between { justify-content: space-between; }
.actions.compact { gap: 7px; }
.stack { display: grid; gap: 16px; }
.section { margin-top: 26px; }
.section-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-title h2 { margin: 0; font-size: 21px; letter-spacing: -.025em; }
.section-title p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.button {
  min-height: 42px;
  border: 0;
  border-radius: 11px;
  padding: 10px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--brand);
  color: white;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease;
}
.button:hover { background: var(--brand-dark); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(79,70,229,.20); }
.button:active { transform: translateY(0); }
.button.secondary { background: white; color: #344054; border: 1px solid var(--line-strong); }
.button.secondary:hover { background: var(--surface-soft); box-shadow: var(--shadow-sm); }
.button.ghost { background: transparent; color: var(--brand); box-shadow: none; }
.button.ghost:hover { background: var(--brand-soft); box-shadow: none; }
.button.danger { background: var(--danger-soft); color: var(--danger); border: 1px solid #fecdca; box-shadow: none; }
.button.warning { background: var(--warning-soft); color: var(--warning); border: 1px solid #fedf89; box-shadow: none; }
.button.small { min-height: 34px; padding: 7px 11px; font-size: 12px; border-radius: 9px; }
.button.full { width: 100%; }
.button[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.button[aria-busy="true"], select[aria-busy="true"], form[aria-busy="true"] { cursor: progress; }
form[aria-busy="true"] .button[disabled] { opacity: .68; }
.icon-button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 11px; background: white; cursor: pointer; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.card.subtle { background: var(--surface-soft); box-shadow: none; }
.card.brand-card { background: linear-gradient(135deg, #4f46e5, #4338ca); color: white; border-color: transparent; box-shadow: var(--shadow-lg); }
.card h2, .card h3 { margin-top: 0; }
.card p { line-height: 1.62; }

.hero {
  position: relative;
  overflow: hidden;
  padding: 34px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr);
  gap: 28px;
  border-radius: var(--radius-lg);
  color: white;
  background:
    radial-gradient(circle at 85% 15%, rgba(45,212,191,.32), transparent 28%),
    radial-gradient(circle at 5% 100%, rgba(129,140,248,.26), transparent 32%),
    linear-gradient(135deg, #1e1b4b 0%, #3730a3 55%, #4f46e5 100%);
  box-shadow: var(--shadow-lg);
}
.hero::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 28px 28px; pointer-events: none; }
.hero > * { position: relative; z-index: 1; }
.hero h1 { margin: 8px 0 16px; max-width: 720px; font-size: clamp(34px, 5vw, 58px); line-height: 1.02; letter-spacing: -.055em; }
.hero p { margin: 0; max-width: 680px; color: #dbeafe; font-size: 16px; line-height: 1.72; }
.hero .actions { margin-top: 24px; }
.hero .button { background: white; color: #3730a3; }
.hero .button:hover { background: #f8fafc; }
.hero .button.secondary { background: rgba(255,255,255,.08); color: white; border-color: rgba(255,255,255,.24); }
.hero-side { display: grid; align-content: center; }
.progress-panel { padding: 22px; border-radius: 18px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.16); backdrop-filter: blur(12px); }
.progress-panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.progress-panel-head strong { font-size: 30px; }
.progress-track { height: 8px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.15); }
.progress-track > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2dd4bf, #a5b4fc); }
.next-step { margin-top: 16px; display: flex; gap: 11px; align-items: flex-start; }
.next-step-icon { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 11px; background: rgba(255,255,255,.13); }
.next-step small { display: block; color: #c7d2fe; margin-top: 3px; line-height: 1.4; }

.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric-card { display: flex; gap: 14px; align-items: center; }
.metric-icon { width: 44px; height: 44px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 13px; color: var(--brand); background: var(--brand-soft); font-weight: 900; }
.metric-card strong { display: block; font-size: 27px; letter-spacing: -.04em; }
.metric-card span { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }

.checklist { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: 13px; }
.checklist li::before { content: "✓"; width: 21px; height: 21px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--success-soft); color: var(--success); font-size: 11px; font-weight: 900; }
.checklist li.missing::before { content: "•"; background: var(--warning-soft); color: var(--warning); }

.form-section { margin-bottom: 18px; padding: 0; overflow: hidden; }
.form-section > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 20px 22px; font-weight: 800; }
.form-section > summary::-webkit-details-marker { display: none; }
.form-section > summary::after { content: "+"; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; color: var(--brand); background: var(--brand-soft); }
.form-section[open] > summary::after { content: "−"; }
.form-section > summary small { display: block; color: var(--muted); font-weight: 500; margin-top: 4px; }
.form-section-body { padding: 0 22px 22px; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding-top: 20px; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { color: #344054; font-size: 12px; font-weight: 800; }
.field small { color: var(--muted); line-height: 1.45; font-size: 11px; }
.field input, .field textarea, .field select, .filters input, .filters select, .status-select {
  width: 100%;
  min-height: 43px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  background: white;
  outline: none;
}
.field textarea { min-height: 118px; resize: vertical; line-height: 1.55; }
.field input:focus, .field textarea:focus, .field select:focus, .filters input:focus, .filters select:focus, .status-select:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 4px rgba(99,102,241,.11);
}
.checkbox { display: flex; align-items: center; gap: 9px; min-height: 43px; color: #344054; font-weight: 650; }
.checkbox input { width: 18px; min-height: 18px; }
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.sticky-save { position: sticky; bottom: 14px; z-index: 12; padding: 12px; display: flex; justify-content: space-between; align-items: center; gap: 14px; background: rgba(255,255,255,.92); backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-md); }
.sticky-save small { color: var(--muted); }

.notice { padding: 13px 15px; border-radius: 11px; background: var(--brand-soft); color: #3730a3; border: 1px solid #c7d2fe; font-size: 12px; line-height: 1.55; }
.notice.warning { color: var(--warning); background: var(--warning-soft); border-color: #fedf89; }
.notice.danger { color: var(--danger); background: var(--danger-soft); border-color: #fecdca; }
.notice.success { color: var(--success); background: var(--success-soft); border-color: #abefc6; }
.notice + .notice { margin-top: 10px; }

.badge { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; border-radius: 999px; padding: 5px 9px; color: #475467; background: #f2f4f7; font-size: 11px; font-weight: 750; }
.badge.success { color: var(--success); background: var(--success-soft); }
.badge.warning { color: var(--warning); background: var(--warning-soft); }
.badge.danger { color: var(--danger); background: var(--danger-soft); }
.badge.brand { color: var(--brand-dark); background: var(--brand-soft); }

.filters { display: grid; grid-template-columns: minmax(230px, 1.5fr) repeat(4, minmax(135px, .7fr)); gap: 10px; margin-bottom: 16px; }
.job-list { display: grid; gap: 14px; }
.job-card { display: grid; grid-template-columns: 78px minmax(0, 1fr) 150px; gap: 18px; align-items: start; }
.match-score { width: 68px; height: 68px; position: relative; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--brand) var(--score), #eef2f6 0); }
.match-score::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: white; }
.match-score > div { position: relative; text-align: center; }
.match-score strong { display: block; font-size: 18px; line-height: 1; }
.match-score small { display: block; color: var(--muted); font-size: 8px; margin-top: 3px; }
.job-card h3 { margin: 6px 0 6px; font-size: 20px; letter-spacing: -.02em; }
.job-meta { display: flex; flex-wrap: wrap; gap: 7px 16px; color: var(--muted); font-size: 12px; }
.job-meta span { display: inline-flex; align-items: center; gap: 5px; }
.job-reasons { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.job-actions { display: grid; gap: 8px; min-width: 0; }
.saved-button.active { background: var(--warning-soft); color: var(--warning); border-color: #fedf89; }
.source-line { margin-top: 12px; color: var(--muted); font-size: 11px; }
.description-text, .pre-line { white-space: pre-line; }
.detail-section h2, .detail-quality h2 { margin-bottom: 10px; }
.detail-list { margin: 8px 0 0; padding-left: 20px; }
.detail-list li + li { margin-top: 6px; }
.detail-quality-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.detail-quality-heading h2 { margin: 0; }
.detail-quality details { margin-top: 10px; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, .6fr); gap: 20px; align-items: start; }
.detail-sidebar { display: grid; gap: 16px; position: sticky; top: 92px; }

.cv-layout { display: grid; grid-template-columns: minmax(0, 1fr) 470px; gap: 22px; align-items: start; }
.cv-tools { min-width: 0; }
.cv-preview-shell { position: sticky; top: 90px; }
.cv-preview-toolbar { margin-bottom: 10px; justify-content: space-between; }
.template-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.template-card { position: relative; display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 15px; padding: 16px; cursor: pointer; }
.template-card.active { border-color: #818cf8; box-shadow: 0 0 0 3px rgba(99,102,241,.10); }
.template-card h3 { margin: 7px 0 5px; font-size: 15px; }
.template-card p { margin: 0 0 12px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.mini-cv { height: 136px; border: 1px solid #d0d5dd; border-radius: 7px; background: white; padding: 10px; overflow: hidden; box-shadow: 0 8px 18px rgba(16,24,40,.08); }
.mini-cv-head { height: 12px; width: 70%; border-radius: 3px; background: #344054; margin-bottom: 8px; }
.mini-cv-sub { height: 4px; width: 48%; border-radius: 3px; background: #98a2b3; margin-bottom: 10px; }
.mini-cv-line { height: 4px; border-radius: 3px; background: #e4e7ec; margin: 6px 0; }
.mini-cv-line.short { width: 62%; }
.template-modern .mini-cv-head, .template-technical .mini-cv-head { background: #4f46e5; }
.template-corporate .mini-cv-head, .template-executive .mini-cv-head { width: 100%; background: #101828; }
.template-fresh-graduate .mini-cv-head { background: #0f766e; }
.template-operations .mini-cv-head { background: #b45309; }
.template-sales-results .mini-cv-head { background: #be123c; }
.template-administrative .mini-cv-head { background: #0369a1; }
.template-experienced .mini-cv-head { background: #5b21b6; }
.cv-paper { width: 100%; min-height: 650px; padding: 34px 36px; background: white; color: #111827; border: 1px solid #d0d5dd; border-radius: 6px; box-shadow: 0 22px 50px rgba(16,24,40,.13); font-family: Arial, Helvetica, sans-serif; font-size: 10.5px; line-height: 1.45; overflow: visible; }
.cv-paper header { padding-bottom: 15px; margin-bottom: 15px; border-bottom: 2px solid #111827; }
.cv-paper h1 { margin: 0; font-size: 25px; letter-spacing: -.04em; text-transform: uppercase; }
.cv-paper .role { margin-top: 4px; color: #374151; font-size: 12px; font-weight: 700; }
.cv-paper .contact { margin-top: 7px; color: #4b5563; font-size: 9px; font-style: normal; overflow-wrap: anywhere; }
.cv-paper .contact a { color: inherit; text-decoration: none; }
.cv-paper .contact-separator { white-space: pre; }
.cv-section { margin-top: 14px; }
.cv-section h2 { margin: 0 0 7px; padding-bottom: 4px; border-bottom: 1px solid #9ca3af; font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; }
.cv-section p { margin: 0; line-height: 1.5; }
.cv-section ul { margin: 5px 0 0; padding-left: 17px; }
.cv-section li { margin: 2px 0; }
.cv-entry strong, .cv-entry h3 { display: block; margin: 0; font-size: 10.5px; }
.cv-entry small { display: block; color: #4b5563; margin: 2px 0 5px; }
.cv-skills { display: flex; flex-wrap: wrap; gap: 5px 12px; margin: 0; padding: 0; list-style: none; }
.cv-skills li { margin: 0; font-weight: 600; }
.cv-text { white-space: pre-line; }
.template-modern header { border-color: #4f46e5; }
.template-modern .cv-section h2 { color: #3730a3; border-color: #c7d2fe; }
.template-corporate header { padding: 15px; color: white; background: #111827; border: 0; }
.template-corporate header .role, .template-corporate header .contact { color: #e5e7eb; }
.template-fresh-graduate header { border-color: #0f766e; text-align: center; }
.template-fresh-graduate .cv-section h2 { color: #0f766e; }
.template-executive header { border-bottom-width: 1px; }
.template-executive h1 { font-family: Georgia, serif; text-transform: none; }
.template-operations .cv-section h2 { color: #92400e; border-color: #fbbf24; }
.template-technical header { border-color: #1d4ed8; }
.template-technical .cv-section h2 { color: #1d4ed8; }
.template-sales-results .cv-section h2 { color: #9f1239; border-color: #fda4af; }
.template-administrative .cv-section h2 { color: #075985; border-color: #7dd3fc; }
.template-experienced h1 { color: #4c1d95; }
.template-experienced header { border-color: #7c3aed; }
.health-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: center; }
.health-score { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 50%; color: var(--brand-dark); background: var(--brand-soft); font-size: 20px; font-weight: 850; }


.repeater { display: grid; gap: 12px; }
.repeater + .repeater { margin-top: 20px; }
.repeater-list { display: grid; gap: 12px; }
.repeater-item { padding: 16px; border-left: 4px solid var(--brand-soft); box-shadow: none; }
.repeater-item h3 { margin: 0; font-size: 15px; }
.repeater-actions { display: flex; align-items: center; gap: 6px; }
.repeater-actions .icon-button { width: 34px; height: 34px; }
.compact-empty { padding: 18px; }
.parser-review { border: 2px solid var(--brand-soft); }
.parser-review .notice { margin: 12px 0; }
.cv-section { break-inside: auto; page-break-inside: auto; }
.cv-section h2 { break-after: avoid; page-break-after: avoid; }
.cv-entry { break-inside: auto; page-break-inside: auto; }
.cv-entry-heading { break-inside: avoid; page-break-inside: avoid; break-after: avoid; page-break-after: avoid; }
.cv-entry li, .cv-section > ul > li { break-inside: avoid; page-break-inside: avoid; }
.cv-entry + .cv-entry { margin-top: 10px; padding-top: 8px; border-top: 1px solid #d1d5db; }
.cv-achievements { margin-top: 6px; }
.cv-achievements b { display: block; margin-bottom: 3px; }
.onboarding-choice { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.backup-reminder { border-left: 4px solid #d97706; }
.application-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.application-card { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 18px; }
.application-card h3 { margin: 7px 0 5px; }
.application-controls { display: grid; align-content: start; gap: 9px; }
.application-editor { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.application-editor textarea { width: 100%; min-height: 150px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 12px; resize: vertical; line-height: 1.55; }
.status-pill { text-transform: capitalize; }

.empty { padding: 46px 22px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); background: rgba(255,255,255,.6); }
.empty-icon { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 12px; border-radius: 15px; background: var(--brand-soft); color: var(--brand); font-size: 22px; }
.empty h3 { margin: 0 0 7px; color: var(--text); }
.empty p { margin: 0 auto 16px; max-width: 500px; line-height: 1.55; }

.storage-meter { height: 10px; overflow: hidden; border-radius: 999px; background: #eaecf0; }
.storage-meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); }
.code-box { margin-top: 14px; padding: 12px 14px; overflow-wrap: anywhere; border-radius: 10px; color: #d1d5db; background: #111827; font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }
.advanced-box > summary { cursor: pointer; font-weight: 800; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 180; max-width: min(420px, calc(100vw - 44px)); padding: 13px 16px; border-radius: 12px; color: white; background: #101828; box-shadow: var(--shadow-md); font-size: 13px; }
.toast.error { background: #7a271a; }
.toast.warning { background: #7a2e0e; }

.dialog-backdrop { position: fixed; inset: 0; z-index: 170; display: grid; place-items: center; padding: 20px; background: rgba(15,23,42,.60); backdrop-filter: blur(4px); }
.dialog { width: min(520px, 100%); padding: 24px; border: 0; border-radius: 18px; background: white; box-shadow: var(--shadow-lg); }
.dialog h2 { margin: 0 0 8px; }
.dialog p { color: var(--muted); line-height: 1.6; }
.dialog .actions { justify-content: flex-end; margin-top: 22px; }

.mobile-only { display: none; }

:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 5px #3730a3; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@media (forced-colors: active) {
  :focus-visible { outline: 3px solid Highlight; box-shadow: none; }
  .button, .icon-button, input, textarea, select { border: 1px solid ButtonText; }
  .progress-track > span, .storage-meter > span { forced-color-adjust: none; background: Highlight; }
}

@media (max-width: 1120px) {
  .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters > :first-child { grid-column: 1 / -1; }
  .cv-layout { grid-template-columns: minmax(0, 1fr) 400px; }
  .template-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-105%); width: min(300px, 86vw); box-shadow: var(--shadow-lg); transition: transform 180ms ease; }
  .sidebar.open { transform: translateX(0); }
  .mobile-only { display: inline-grid; place-items: center; }
  .topbar { padding: 0 18px; }
  .page { padding: 28px 18px 66px; }
  .hero { grid-template-columns: 1fr; }
  .hero-side { max-width: 520px; }
  .grid.three { grid-template-columns: 1fr; }
  .cv-layout { grid-template-columns: 1fr; }
  .cv-preview-shell { position: static; }
  .cv-paper { max-width: 620px; margin: 0 auto; }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-sidebar { position: static; }
}

@media (max-width: 680px) {
  .connection-status { display: none; }
  .topbar-copy span { display: none; }
  .page-header { display: grid; }
  .page-header .actions { width: 100%; }
  .page-header .actions .button { flex: 1; }
  .hero { padding: 25px 21px; }
  .hero h1 { font-size: 36px; }
  .grid.two, .grid.four { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .filters { grid-template-columns: 1fr; }
  .filters > :first-child { grid-column: auto; }
  .job-card { grid-template-columns: 60px minmax(0, 1fr); }
  .match-score { width: 56px; height: 56px; }
  .job-actions { grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .job-actions .button { min-width: 0; padding-left: 8px; padding-right: 8px; }
  .template-card { grid-template-columns: 86px minmax(0, 1fr); }
  .application-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .application-card { grid-template-columns: 1fr; }
  .application-controls { grid-template-columns: 1fr 1fr; }
  .sticky-save { display: grid; }
  .sticky-save .actions { width: 100%; }
  .sticky-save .button { flex: 1; }
  .onboarding-choice { grid-template-columns: 1fr; }
}

@media print {
  html, body { width: 210mm; min-height: 297mm; background: white; }
  body { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .sidebar, .topbar, .page-header, .cv-tools, .no-print, .offline-banner, .toast { display: none !important; }
  .app-shell, .main-column, .page, .cv-layout, .cv-preview-shell { display: block; margin: 0; padding: 0; max-width: none; }
  .cv-paper { width: auto; min-height: auto; height: auto; overflow: visible; aspect-ratio: auto; margin: 0; padding: 14mm 15mm; border: 0; border-radius: 0; box-shadow: none; font-size: 10pt; line-height: 1.38; overflow-wrap: anywhere; word-break: normal; }
  .cv-paper header { break-inside: avoid; page-break-inside: avoid; break-after: avoid; page-break-after: avoid; }
  .template-corporate header { color: #111827; background: transparent; border-bottom: 2px solid #111827; }
  .template-corporate header .role, .template-corporate header .contact { color: #4b5563; }
  .cv-paper h1 { font-size: 20pt; }
  .cv-paper .role { font-size: 11pt; }
  .cv-paper .contact { font-size: 8.5pt; }
  .cv-section { break-inside: auto; page-break-inside: auto; }
  .cv-section h2 { break-after: avoid; page-break-after: avoid; font-size: 9.5pt; }
  .cv-section h2 + * { break-before: avoid; page-break-before: avoid; }
  .cv-entry { break-inside: auto; page-break-inside: auto; }
  .cv-entry-heading { break-inside: avoid; page-break-inside: avoid; break-after: avoid; page-break-after: avoid; }
  .cv-entry strong, .cv-entry h3 { font-size: 9.5pt; }
  .cv-entry small { font-size: 8.5pt; }
  .cv-entry p, .cv-section p, .cv-entry li, .cv-section > ul > li { widows: 2; orphans: 2; }
  .cv-entry li, .cv-section > ul > li { break-inside: avoid; page-break-inside: avoid; }
  .cv-section ul { padding-left: 0; list-style: none; }
  .cv-section li { padding-left: 1em; text-indent: -1em; }
  .cv-section li::before { content: "• "; }
  .cv-skills { display: block; }
  .cv-skills li { margin: 2px 0; font-weight: 600; }
  @page { size: A4; margin: 0; }
}
.progress-p0 { width: 0%; }
.progress-p10 { width: 10%; }
.progress-p20 { width: 20%; }
.progress-p30 { width: 30%; }
.progress-p40 { width: 40%; }
.progress-p50 { width: 50%; }
.progress-p60 { width: 60%; }
.progress-p70 { width: 70%; }
.progress-p80 { width: 80%; }
.progress-p90 { width: 90%; }
.progress-p100 { width: 100%; }
.score-p0 { --score: 0%; }
.score-p10 { --score: 10%; }
.score-p20 { --score: 20%; }
.score-p30 { --score: 30%; }
.score-p40 { --score: 40%; }
.score-p50 { --score: 50%; }
.score-p60 { --score: 60%; }
.score-p70 { --score: 70%; }
.score-p80 { --score: 80%; }
.score-p90 { --score: 90%; }
.score-p100 { --score: 100%; }
.clipboard-fallback { position: fixed; left: -9999px; top: -9999px; }

.load-more-row{display:flex;flex-wrap:wrap;gap:.75rem;align-items:center;justify-content:center;padding:1rem}.load-more-row small{color:var(--muted,#667085)}

.job-unavailable {
  opacity: 0.78;
}

.job-unavailable .match-score {
  filter: grayscale(1);
}

/* Profile form resilience */
.save-status { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.save-status[data-state="saving"] { color: var(--brand); }
.save-status[data-state="draft"] { color: var(--warning-text, #7a4b00); }
.save-status[data-state="error"] { color: var(--danger); font-weight: 700; }
.save-status[data-state="saved"] { color: var(--success-text, #176b3a); }
.field-error { display: block; margin-top: 6px; color: var(--danger); font-weight: 650; }
.field [aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(190, 45, 45, .12); }
.repeater-undo { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 12px; background: var(--surface-soft); }
.repeater-undo[hidden] { display: none; }
#profile-form[data-dirty] .sticky-save { border-color: var(--brand); }

/* Application tracker */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.application-filters { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(150px, 1fr) minmax(180px, 1fr) auto; gap: 12px; align-items: end; margin-bottom: 16px; }
.application-filters .field { margin: 0; }
.application-filters .field > span { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 750; color: var(--muted); }
.filter-count { align-self: center; min-width: 120px; color: var(--muted); font-size: 13px; text-align: right; }
.application-history { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.application-history > summary { cursor: pointer; }
.application-history ol { display: grid; gap: 8px; margin: 12px 0 6px; padding-left: 22px; }
.application-history li { padding-left: 4px; }
.application-history time { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
@media (max-width: 900px) {
  .application-filters { grid-template-columns: 1fr 1fr; }
  .application-filters .field:first-child { grid-column: 1 / -1; }
  .filter-count { text-align: left; }
}
@media (max-width: 560px) {
  .application-filters { grid-template-columns: 1fr; }
  .application-filters .field:first-child { grid-column: auto; }
}

/* Task 13 — responsive surfaces and appearance tokens */
@media screen {
  html { min-width: 0; color-scheme: light; }
  html[data-theme="dark"] { color-scheme: dark; }
  html[data-theme="contrast"] { color-scheme: light; }
  body { color: var(--text); overflow-wrap: break-word; }
  :where(.main-column, .page, .page-header, .page-header > *, .card, .field, .actions, .section-title, .job-card > *, .application-card > *, .template-card > *) { min-width: 0; }
  :where(h1, h2, h3, p, li, label, summary, .button, .badge, .job-meta, .source-line, .topbar-copy strong) { overflow-wrap: anywhere; }

  .sidebar {
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding-top: max(24px, env(safe-area-inset-top));
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    background: var(--sidebar-bg);
  }
  .main-nav a { color: var(--sidebar-text); }
  .brand-copy small, .sidebar-trust small { color: var(--sidebar-muted); }
  .topbar {
    height: auto;
    min-height: 72px;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-right: max(30px, env(safe-area-inset-right));
    padding-bottom: 10px;
    padding-left: max(30px, env(safe-area-inset-left));
    background: var(--topbar-bg);
  }
  .topbar-copy { min-width: 0; }
  .page {
    width: 100%;
    padding-right: max(30px, env(safe-area-inset-right));
    padding-left: max(30px, env(safe-area-inset-left));
  }
  .page-header { flex-wrap: wrap; }
  .button { max-width: 100%; background: var(--brand); color: var(--on-brand); }
  .button.secondary, .icon-button { color: var(--text); background: var(--surface-input); border-color: var(--line-strong); }
  .button.ghost { color: var(--brand-text); }
  .button.danger { border-color: var(--danger); }
  .button.warning { border-color: var(--warning); }
  .card, .dialog { color: var(--text); background: var(--surface); }
  .card.brand-card { color: #ffffff; }
  .field label, .checkbox { color: var(--text); }
  .field input, .field textarea, .field select, .filters input, .filters select, .status-select, .application-editor textarea {
    min-width: 0;
    color: var(--text);
    background: var(--surface-input);
  }
  .sticky-save { background: var(--surface-overlay); }
  .notice { color: var(--brand-text); background: var(--brand-soft); border-color: var(--brand-text); }
  .notice.warning { border-color: var(--warning); }
  .notice.danger { border-color: var(--danger); }
  .notice.success { border-color: var(--success); }
  .badge { color: var(--muted); background: var(--surface-soft); white-space: normal; }
  .badge.brand { color: var(--brand-text); }
  .eyebrow, .metric-icon, .form-section > summary::after, .empty-icon { color: var(--brand-text); }
  .match-score::before { background: var(--surface); }
  .empty { background: var(--empty-bg); }
  .storage-meter { background: var(--line); }
  .dialog-backdrop {
    padding-top: max(20px, env(safe-area-inset-top));
    padding-right: max(20px, env(safe-area-inset-right));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    padding-left: max(20px, env(safe-area-inset-left));
  }
  .dialog {
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .offline-banner {
    width: max-content;
    max-width: calc(100vw - 32px - env(safe-area-inset-left) - env(safe-area-inset-right));
    text-align: center;
  }
  .toast {
    right: max(22px, env(safe-area-inset-right));
    bottom: max(22px, env(safe-area-inset-bottom));
  }
  .description-text, .pre-line, .code-box { overflow-wrap: anywhere; word-break: break-word; }
  .form-section > summary, .section-title, .repeater-undo { flex-wrap: wrap; }
  :focus-visible { outline-color: var(--focus-inner); box-shadow: 0 0 0 5px var(--focus-outer); }

  html[data-theme="dark"] .hero,
  html[data-theme="dark"] .card.brand-card { box-shadow: var(--shadow-lg); }
  html[data-theme="dark"] .template-card.active { border-color: var(--brand-text); }
  html[data-theme="dark"] .mini-cv,
  html[data-theme="dark"] .cv-paper { color-scheme: light; }

  html[data-theme="contrast"] .hero {
    color: var(--text);
    background: #000000;
    border: 2px solid var(--line);
  }
  html[data-theme="contrast"] .hero p,
  html[data-theme="contrast"] .eyebrow.inverse,
  html[data-theme="contrast"] .next-step small { color: var(--text); }
  html[data-theme="contrast"] .hero .button { color: var(--on-brand); background: var(--brand); border: 2px solid var(--brand); }
  html[data-theme="contrast"] .hero .button.secondary { color: var(--text); background: #000000; border-color: var(--text); }
  html[data-theme="contrast"] .card,
  html[data-theme="contrast"] .button,
  html[data-theme="contrast"] .icon-button,
  html[data-theme="contrast"] input,
  html[data-theme="contrast"] textarea,
  html[data-theme="contrast"] select,
  html[data-theme="contrast"] .notice,
  html[data-theme="contrast"] .badge { border-width: 2px; }
  html[data-theme="contrast"] .main-nav a.active { outline: 2px solid var(--brand); background: #000000; }
  html[data-theme="contrast"] .progress-panel { border: 2px solid var(--text); background: #000000; }
  html[data-theme="contrast"] .match-score { background: conic-gradient(var(--brand) var(--score), #ffffff 0); }
  html[data-theme="contrast"] .match-score::before { background: #000000; }
}

@media screen and (max-width: 900px) {
  .sidebar { padding-left: max(16px, env(safe-area-inset-left)); }
  .topbar {
    padding-right: max(18px, env(safe-area-inset-right));
    padding-left: max(18px, env(safe-area-inset-left));
  }
  .page {
    padding-right: max(18px, env(safe-area-inset-right));
    padding-left: max(18px, env(safe-area-inset-left));
  }
}

@media screen and (max-width: 520px) {
  .topbar { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 12px; }
  .topbar > .button:not([hidden]) { grid-column: 1 / -1; width: 100%; }
  .page { padding-top: 22px; padding-bottom: max(76px, calc(58px + env(safe-area-inset-bottom))); }
  .page-header h1 { font-size: clamp(27px, 10vw, 36px); }
  .hero { padding: 22px 18px; }
  .hero h1 { font-size: clamp(30px, 11vw, 36px); }
  .section-title { align-items: flex-start; }
  .form-section > summary { padding: 17px 16px; }
  .form-section-body { padding: 0 16px 18px; }
  .card { padding: 18px; }
  .job-card { grid-template-columns: 52px minmax(0, 1fr); gap: 12px; }
  .match-score { width: 52px; height: 52px; }
  .job-actions { grid-template-columns: 1fr; }
  .template-card { grid-template-columns: 72px minmax(0, 1fr); gap: 12px; }
  .mini-cv { height: 110px; padding: 8px; }
  .application-controls { grid-template-columns: 1fr; }
  .application-summary { grid-template-columns: 1fr 1fr; }
  .sticky-save { position: static; }
  .sticky-save, .sticky-save .actions { grid-template-columns: 1fr; width: 100%; }
  .sticky-save .button, .form-actions .button { flex: 1 1 100%; }
  .repeater-undo { align-items: flex-start; }
  .dialog-backdrop { place-items: end center; padding: 0; }
  .dialog {
    width: 100%;
    max-height: calc(100dvh - env(safe-area-inset-top));
    padding: 22px max(18px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
    border-radius: 18px 18px 0 0;
  }
  .dialog .actions .button { flex: 1 1 100%; }
  .toast { left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); max-width: none; }
}

@media screen and (max-width: 380px) {
  .brand-copy small, .topbar-copy span { display: none; }
  .application-summary { grid-template-columns: 1fr; }
  .template-card { grid-template-columns: 1fr; }
  .mini-cv { width: 100px; }
  .actions, .form-actions { align-items: stretch; }
  .actions .button, .form-actions .button { width: 100%; }
}

@media screen and (max-height: 560px) and (max-width: 900px) {
  .brand { margin-bottom: 14px; }
  .main-nav { gap: 3px; }
  .main-nav a { min-height: 40px; padding-block: 8px; }
  .sidebar-trust { margin-top: 16px; }
}

.diagnostic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
  gap: var(--space-3, 0.75rem);
  margin: 0;
}
.diagnostic-grid > div {
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 0.75rem);
  background: var(--surface-subtle);
}
.diagnostic-grid dt { font-weight: 700; }
.diagnostic-grid dd { margin: 0.35rem 0 0; overflow-wrap: anywhere; }

/* Task 8 — behavioural accessibility feedback */
.profile-error-summary { margin-bottom: 18px; }
.profile-error-summary:focus { outline: 3px solid var(--focus-inner); box-shadow: 0 0 0 5px var(--focus-outer); }
.profile-error-summary h2 { margin: 0 0 8px; font-size: 1.05rem; }
.profile-error-summary p { margin: 0 0 8px; }
.profile-error-summary ul { display: grid; gap: 6px; margin: 0; padding-left: 22px; }
.profile-error-summary a { color: var(--danger); font-weight: 700; text-decoration-thickness: 2px; text-underline-offset: 2px; }
