:root {
  color-scheme: light dark;
  --ink: #102129;
  --ink-soft: #51636c;
  --paper: #edf1ef;
  --paper-strong: #fbfcfb;
  --card: rgba(251, 252, 251, 0.9);
  --panel: rgba(255, 255, 255, 0.78);
  --field-bg: rgba(255, 255, 255, 0.76);
  --field-readonly: rgba(16, 33, 41, 0.05);
  --badge-bg: rgba(16, 33, 41, 0.06);
  --line: rgba(16, 33, 41, 0.1);
  --accent: #0f766e;
  --accent-deep: #0b5d56;
  --glow: #9fd7cf;
  --mint: #d9f2ea;
  --rank-ink: #0b5d56;
  --page-top-glow: rgba(159, 215, 207, 0.45);
  --page-right-glow: rgba(209, 230, 238, 0.7);
  --page-start: #f8fbfa;
  --page-end: #e8eef0;
  --avatar-start: #ffe6b3;
  --avatar-end: #ffd8d8;
  --shadow: 0 24px 70px rgba(16, 33, 41, 0.1);
  --radius-xl: 30px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e9f1ef;
  --ink-soft: #9cb0b6;
  --paper: #081319;
  --paper-strong: #0d1a21;
  --card: rgba(13, 26, 33, 0.88);
  --panel: rgba(11, 24, 31, 0.88);
  --field-bg: rgba(10, 24, 31, 0.92);
  --field-readonly: rgba(233, 241, 239, 0.08);
  --badge-bg: rgba(233, 241, 239, 0.08);
  --line: rgba(233, 241, 239, 0.12);
  --accent: #4bc7bc;
  --accent-deep: #a7f4eb;
  --glow: #12463f;
  --mint: rgba(75, 199, 188, 0.15);
  --rank-ink: #a7f4eb;
  --page-top-glow: rgba(28, 121, 111, 0.25);
  --page-right-glow: rgba(12, 54, 66, 0.4);
  --page-start: #050d12;
  --page-end: #0d1b22;
  --avatar-start: #103946;
  --avatar-end: #2e5562;
  --shadow: 0 26px 80px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, var(--page-top-glow), transparent 30%),
    radial-gradient(circle at top right, var(--page-right-glow), transparent 32%),
    linear-gradient(180deg, var(--page-start) 0%, var(--paper) 44%, var(--page-end) 100%);
  transition:
    background-color 220ms ease,
    color 220ms ease,
    background 220ms ease;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.page-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 420px);
  gap: 24px;
  align-items: stretch;
}

.hero-single {
  grid-template-columns: 1fr;
}

.hero-copy,
.form-card,
.profile-panel,
.status-card,
.job-card,
.info-card {
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero-copy {
  border-radius: var(--radius-xl);
  padding: 34px;
}

.hero-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero-auth {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 320px);
  gap: 18px;
  margin-top: 28px;
}

.auth-card,
.session-card,
.history-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 22px;
}

.auth-card h2,
.session-card h2 {
  margin: 8px 0 10px;
  font-size: clamp(1.35rem, 2vw, 1.9rem);
}

.auth-card p,
.session-card p {
  margin-bottom: 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 420px);
  gap: 24px;
  align-items: start;
}

.form-card {
  border-radius: var(--radius-xl);
  padding: 28px;
}

.section-head h2 {
  margin: 6px 0 8px;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.section-head p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.65;
}

.profile-form {
  margin-top: 22px;
}

.field,
.field-row {
  display: block;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  margin-bottom: 14px;
}

.field span {
  display: block;
  margin-bottom: 8px;
  font-size: 0.95rem;
  font-weight: 700;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font: inherit;
  color: var(--ink);
  background: var(--field-bg);
}

.readonly-field {
  background: var(--field-readonly) !important;
}

.field input:focus,
.field textarea:focus {
  outline: 2px solid rgba(15, 118, 110, 0.18);
  border-color: rgba(15, 118, 110, 0.35);
}

.eyebrow,
.status-kicker,
.job-category,
.microcopy {
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

h1 {
  margin: 12px 0 16px;
  max-width: 11ch;
  font-size: clamp(2.8rem, 5.5vw, 5.4rem);
  line-height: 0.92;
  letter-spacing: -0.05em;
}

.lede {
  max-width: 56ch;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--ink-soft);
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button,
.theme-toggle,
.apply-link,
.source-link {
  border-radius: 999px;
  padding: 14px 20px;
  font-weight: 700;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease;
}

.primary-button,
.apply-link {
  background: var(--accent);
  color: white;
  box-shadow: 0 12px 26px rgba(15, 118, 110, 0.22);
}

.ghost-button,
.theme-toggle,
.source-link {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.primary-button:hover,
.ghost-button:hover,
.theme-toggle:hover,
.apply-link:hover,
.source-link:hover {
  transform: translateY(-2px);
}

.theme-toggle {
  padding: 10px 14px;
  font-size: 0.9rem;
  backdrop-filter: blur(18px);
}

.profile-panel {
  border-radius: var(--radius-xl);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.profile-panel::before {
  content: "";
  position: absolute;
  inset: auto -40px -40px auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(159, 215, 207, 0.9), rgba(159, 215, 207, 0));
  pointer-events: none;
}

.profile-placeholder,
.profile-card {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.profile-placeholder {
  align-items: flex-start;
  gap: 16px;
  color: var(--ink-soft);
}

.placeholder-orb {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, white 0%, rgba(255, 255, 255, 0.2) 34%, transparent 35%),
    linear-gradient(135deg, var(--glow), var(--accent));
}

.profile-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(135deg, var(--avatar-start), var(--avatar-end));
}

.profile-name {
  margin: 0;
  font-size: 1.5rem;
}

.profile-email,
.profile-headline {
  margin: 6px 0 0;
  color: var(--ink-soft);
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.badge {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--badge-bg);
  font-size: 0.9rem;
}

.content {
  margin-top: 24px;
}

.cv-intake-step {
  margin-bottom: 24px;
}

.cv-intake-card,
.cv-summary-bar {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--card);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.cv-intake-card {
  padding: 28px;
}

.cv-intake-layout {
  margin-top: 22px;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(320px, 1fr);
  gap: 20px;
}

.upload-stack {
  display: flex;
  flex-direction: column;
}

.upload-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px dashed rgba(15, 118, 110, 0.35);
  border-radius: var(--radius-lg);
  padding: 22px;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.05), transparent);
  cursor: pointer;
}

.upload-card strong {
  font-size: 1.2rem;
}

.upload-card span:last-child {
  color: var(--ink-soft);
  line-height: 1.6;
}

.upload-kicker {
  color: var(--accent-deep);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.78rem;
  font-weight: 700;
}

#cv-file {
  margin-top: 14px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font: inherit;
  color: var(--ink);
  background: var(--field-bg);
}

.cv-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  background: var(--panel);
}

.preview-head h3 {
  margin: 8px 0 10px;
  font-size: 1.4rem;
}

.preview-head p:last-child {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

.extraction-grid {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.extraction-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.extraction-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.extraction-card-top p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.extraction-card h3 {
  margin: 12px 0 0;
  font-size: 1rem;
  line-height: 1.45;
}

.confidence-pill {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.confidence-pill.high {
  background: rgba(15, 118, 110, 0.16);
  color: var(--accent-deep);
}

.confidence-pill.mid {
  background: rgba(210, 146, 18, 0.18);
  color: #b26c00;
}

.confidence-pill.low {
  background: rgba(184, 31, 74, 0.16);
  color: #b81f4a;
}

.profile-workspace {
  display: block;
}

.workspace-nav,
.workspace-switcher,
.results-stage-head {
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.workspace-nav {
  margin-bottom: 18px;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  border-radius: var(--radius-xl);
}

.step-chip {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    transform 180ms ease;
}

.step-chip span {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--badge-bg);
  font-weight: 700;
}

.step-chip strong {
  display: block;
  margin-bottom: 4px;
}

.step-chip p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.45;
  font-size: 0.92rem;
}

.step-chip.active {
  border-color: rgba(15, 118, 110, 0.35);
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.1), transparent);
  transform: translateY(-1px);
}

.step-chip.active span,
.step-chip.complete span {
  background: var(--mint);
  color: var(--rank-ink);
}

.step-chip.complete {
  border-color: rgba(15, 118, 110, 0.2);
}

.workspace-switcher {
  position: sticky;
  top: 14px;
  z-index: 4;
  margin-bottom: 18px;
  padding: 10px;
  display: inline-flex;
  gap: 10px;
  border-radius: 999px;
}

.switch-pill {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  color: var(--ink-soft);
  background: transparent;
  transition:
    color 180ms ease,
    background-color 180ms ease,
    transform 180ms ease;
}

.switch-pill.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 12px 26px rgba(15, 118, 110, 0.18);
}

.switch-pill:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.results-stage {
  display: block;
}

.results-stage-head {
  margin-bottom: 18px;
  padding: 22px 24px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.cv-summary-bar {
  margin-bottom: 24px;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.cv-summary-bar h2 {
  margin: 8px 0 8px;
  font-size: 1.55rem;
}

.cv-summary-bar p:last-child {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

.compact-actions {
  margin-top: 0;
}

.status-card {
  border-radius: var(--radius-lg);
  padding: 24px;
}

.status-card h2 {
  margin: 8px 0 10px;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
}

.status-card p:last-child {
  margin-bottom: 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

.status-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.status-count {
  margin: 0;
  font-weight: 700;
}

.status-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.results-block {
  margin-top: 20px;
}

.results-head h2 {
  margin: 6px 0 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.results-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.history-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.job-card {
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-height: 330px;
}

.history-card {
  min-height: 220px;
}

.history-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.history-date,
.history-role,
.history-market,
.history-summary {
  color: var(--ink-soft);
  line-height: 1.6;
}

.history-role {
  margin: 0;
  font-weight: 700;
  color: var(--ink);
}

.history-market {
  margin: 12px 0 8px;
  font-weight: 700;
  color: var(--accent-deep);
}

.history-summary {
  margin: 0;
}

.history-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.job-rank {
  width: fit-content;
  border-radius: 999px;
  background: var(--mint);
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--rank-ink);
}

.job-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.job-company {
  margin: 0;
  font-weight: 700;
}

.job-title {
  margin: 10px 0;
  font-size: 1.35rem;
  line-height: 1.15;
}

.job-location,
.job-reason {
  color: var(--ink-soft);
  line-height: 1.6;
}

.job-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 14px;
}

.tag {
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--badge-bg);
  font-size: 0.84rem;
}

.job-actions {
  margin-top: auto;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.info-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.info-card {
  border-radius: var(--radius-lg);
  padding: 20px;
}

.info-card h3 {
  margin-top: 0;
}

.info-card p {
  margin-bottom: 0;
  color: var(--ink-soft);
  line-height: 1.65;
}

@media (max-width: 980px) {
  .hero,
  .hero-auth,
  .workspace-nav,
  .cv-intake-layout,
  .split-layout,
  .results-grid,
  .history-grid,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .profile-panel {
    min-height: 240px;
  }

  .cv-summary-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .results-stage-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100vw - 20px, 1180px);
    padding-top: 12px;
  }

  .hero-copy,
  .form-card,
  .profile-panel,
  .status-card,
  .job-card,
  .info-card {
    padding: 18px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  h1 {
    max-width: none;
    font-size: clamp(2.4rem, 11vw, 3.6rem);
  }

  .hero-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace-switcher {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .switch-pill {
    text-align: center;
  }
}
