:root {
  --bg: #f5f8fc;
  --surface: #ffffff;
  --surface-soft: #edf5ff;
  --text: #0f172a;
  --muted: #52627a;
  --line: rgba(15, 23, 42, 0.09);
  --accent: #1a56db;
  --accent-rgb: 26, 86, 219;
  --accent-deep: #0f3f91;
  --navy: #0b1f3a;
  --marine: #123a63;
  --wolf-amber: #f59e0b;
  --shadow-lg: 0 28px 70px rgba(11, 31, 58, 0.16);
  --shadow-md: 0 14px 34px rgba(11, 31, 58, 0.1);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --paper-shadow: 0 34px 90px rgba(11, 31, 58, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(26, 86, 219, 0.12), transparent 24rem),
    radial-gradient(circle at bottom right, rgba(11, 31, 58, 0.08), transparent 25rem),
    var(--bg);
}

html {
  scroll-behavior: smooth;
}

button, input, textarea { font: inherit; }
select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(26, 86, 219, 0.22);
  outline-offset: 3px;
}

.editor-page { min-height: 100vh; display: flex; flex-direction: column; }

.editor-topbar {
  position: sticky;
  top: 10px;
  z-index: 50;
  display: grid;
  grid-template-columns: auto minmax(150px, 0.34fr) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  padding: 7px 9px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(26, 86, 219, 0.12);
  border-radius: 999px;
  box-shadow: 0 20px 52px rgba(11, 31, 58, 0.14);
}

.topbar-left, .topbar-right, .history-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-right {
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 5px;
  min-width: 0;
}

.logo-link { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: white;
  font-family: "Outfit", sans-serif;
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(26, 86, 219, 0.2);
}

.logo-copy strong, .logo-copy small { display: block; }
.logo-copy strong { font-family: "Outfit", sans-serif; font-size: 0.95rem; }
.logo-copy small,
.mini-label,
.preview-section h3 {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 800;
}

.history-actions button,
.ghost-button,
.preview-switch button,
.template-button,
.swatch,
.tab-button,
.quick-actions button {
  border: 1px solid rgba(23, 23, 23, 0.08);
  background: rgba(255, 255, 255, 0.75);
  color: var(--marine);
  border-radius: 14px;
  padding: 9px 12px;
  transition: background-color 160ms ease, transform 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.history-actions button,
.topbar-right .ghost-button,
.topbar-right .primary-button {
  min-width: 36px;
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.history-actions button {
  background: rgba(237, 245, 255, 0.68);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.topbar-right .ghost-button {
  background: rgba(255, 255, 255, 0.58);
  color: #24415f;
  font-size: 0.78rem;
  font-weight: 800;
  box-shadow: none;
}

.topbar-right .primary-button {
  min-width: 78px;
  padding-inline: 14px;
  font-size: 0.84rem;
  box-shadow: 0 14px 30px rgba(26, 86, 219, 0.26);
}

.history-actions button:hover,
.ghost-button:hover,
.preview-switch button:hover,
.template-button:hover,
.tab-button:hover,
.quick-actions button:hover {
  background: rgba(23, 23, 23, 0.05);
  border-color: rgba(26, 86, 219, 0.18);
  color: var(--accent-deep);
}

.primary-button,
.section-header button,
.inline-add button {
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: white;
  padding: 12px 16px;
  border-radius: 16px;
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(26, 86, 219, 0.22);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.primary-button:hover,
.section-header button:hover,
.inline-add button:hover {
  transform: translateY(-1px);
  filter: saturate(1.08);
  box-shadow: 0 18px 34px rgba(26, 86, 219, 0.28);
}

.topbar-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.completion-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(26, 86, 219, 0.1);
  box-shadow: 0 8px 20px rgba(11, 31, 58, 0.06);
}

.completion-pill span {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--muted);
}

.completion-pill strong {
  font-size: 0.9rem;
}

.completion-track,
.ats-meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 23, 23, 0.08);
}

.completion-track { width: clamp(76px, 9vw, 118px); }
.completion-track div, .ats-meter div {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--wolf-amber));
  border-radius: inherit;
  transition: width 260ms ease;
}

.editor-shell {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(390px, 0.95fr);
  min-height: 0;
  margin-top: 10px;
  height: calc(100vh - 80px);
}

.editor-pane { min-width: 0; min-height: 0; }
.form-pane {
  border-right: 1px solid rgba(26, 86, 219, 0.08);
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.9), rgba(238, 244, 251, 0.88));
  overflow: auto;
}

.pane-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 20px 24px;
}

.form-intro, .section-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.form-intro {
  align-items: center;
  padding: 16px 18px;
  border: 1px solid rgba(37, 99, 235, 0.1);
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(237, 245, 255, 0.82)),
    rgba(239, 246, 255, 0.72);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.07);
}

.form-intro h1,
.section-header h2,
.preview-toolbar h2,
.resume-header h1,
.letter-header h1 {
  margin: 4px 0 6px;
  font-family: "Outfit", sans-serif;
  letter-spacing: -0.04em;
}

.form-intro h1 { font-size: clamp(1.45rem, 2.4vw, 2rem); }

.form-intro p,
.section-header p,
.finish-card p,
.preview-section .body-copy,
.preview-item p,
.letter-body,
.preview-toolbar p {
  color: var(--muted);
  line-height: 1.55;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.quick-actions button {
  padding: 8px 11px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 800;
}
.tab-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 14px 0;
  margin: 4px 0 16px;
  scrollbar-width: thin;
}

.tab-button.active,
.template-button.active,
.preview-switch button.active,
.ghost-button.active {
  background: linear-gradient(135deg, var(--navy), var(--accent));
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-md);
}

.form-card,
.finish-card,
.ats-card,
.document-preview {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(15, 23, 42, 0.07);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-xl);
}

.form-card {
  padding: 26px;
  border-radius: 24px;
}
.step-panel { display: none; }
.step-panel.active { display: block; }

.form-grid,
.entry-grid,
.finish-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

label { display: grid; gap: 8px; }
label span {
  color: var(--marine);
  font-size: 0.9rem;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(15, 23, 42, 0.11);
  border-radius: 16px;
  background: white;
  padding: 14px 15px;
  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(26, 86, 219, 0.12);
  background: #fbfdff;
}

textarea { resize: vertical; min-height: 110px; }
.full-span { grid-column: 1 / -1; }

.stack-list { display: grid; gap: 16px; }
.entry-card {
  padding: 20px;
  border-radius: 20px;
  background: rgba(248, 251, 255, 0.92);
  border: 1px solid rgba(26, 86, 219, 0.1);
}

.entry-card-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.entry-card-header strong { font-family: "Outfit", sans-serif; font-size: 1.05rem; }
.entry-card-header button {
  border: 0;
  background: rgba(220, 38, 38, 0.1);
  color: #b42318;
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 800;
}

.skill-input-wrap { margin-bottom: 18px; }
.inline-add { display: flex; gap: 10px; }
.inline-add input { flex: 1; }

.chips-wrap,
.skill-chip-preview,
.template-buttons,
.color-row,
.finish-actions,
.language-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.language-button {
  border: 1px solid rgba(23, 23, 23, 0.08);
  background: white;
  color: var(--marine);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 800;
}

.language-button.active {
  background: linear-gradient(135deg, var(--navy), var(--accent));
  color: white;
  border-color: transparent;
}

.template-library-inline {
  max-height: 220px;
  overflow: auto;
  padding-right: 4px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(26, 86, 219, 0.08);
  color: #0f172a;
  font-size: 0.9rem;
}

.chip button {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(26, 86, 219, 0.18);
  color: inherit;
}

.finish-card { padding: 22px; }
.swatch {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--swatch);
  border: 3px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 0 1px rgba(23, 23, 23, 0.08);
  padding: 0;
}

.swatch.active { box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.2), 0 10px 18px rgba(11, 31, 58, 0.12); }

.audit-list {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.audit-list li {
  position: relative;
  padding-left: 22px;
  color: var(--muted);
}

.audit-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

.preview-pane {
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at top right, rgba(26, 86, 219, 0.12), transparent 18rem),
    linear-gradient(180deg, rgba(239, 246, 255, 0.86), rgba(226, 232, 240, 0.95));
  min-height: 0;
}

.preview-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid rgba(26, 86, 219, 0.1);
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(14px);
}

.preview-scroll {
  flex: 1;
  overflow: auto;
  padding: 22px 24px 28px;
  scroll-padding: 24px;
}
.ats-card {
  padding: 18px 20px;
  margin-bottom: 18px;
  background: rgba(255, 255, 255, 0.9);
}

.ats-summary-line {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.ats-card strong {
  display: block;
  margin-top: 6px;
  font-family: "Outfit", sans-serif;
  font-size: 1.8rem;
}

.document-preview {
  width: min(100%, 840px);
  margin: 0 auto;
  overflow: hidden;
  box-shadow: var(--paper-shadow);
  border: 1px solid rgba(255, 255, 255, 0.82);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14.5px;
  line-height: 1.4;
}

.resume-preview,
.letter-preview {
  background: white;
  min-height: 1120px;
  padding: 52px 54px;
}

.document-preview .resume-preview {
  font-family: Arial, Helvetica, sans-serif;
  color: #111827;
  font-size: 14.5px;
  line-height: 1.4;
}

.document-preview.template-modern {
  --template-accent-block: rgba(var(--accent-rgb), 0.08);
}

.document-preview.template-classic {
  --template-accent-block: rgba(var(--accent-rgb), 0.06);
}

.document-preview.template-bold {
  --template-accent-block: rgba(var(--accent-rgb), 0.12);
}

.document-preview.template-creative,
.document-preview.template-elegant {
  --template-accent-block: rgba(var(--accent-rgb), 0.1);
}

.document-preview.template-minimal,
.document-preview.template-professional,
.document-preview.template-legal,
.document-preview.template-finance {
  --template-accent-block: rgba(var(--accent-rgb), 0.07);
}

.document-preview.template-tech,
.document-preview.template-engineering,
.document-preview.template-medical,
.document-preview.template-arabic,
.document-preview.template-executive,
.document-preview.template-academic {
  --template-accent-block: rgba(var(--accent-rgb), 0.09);
}

.document-preview.template-classic .resume-preview {
  font-family: Georgia, "Times New Roman", serif;
}

.document-preview.template-classic .resume-header {
  text-align: center;
  border-top: 3px double var(--accent);
  padding-top: 22px;
}

.document-preview.template-creative .resume-preview {
  background:
    radial-gradient(circle at 92% 4%, rgba(var(--accent-rgb), 0.13), transparent 10rem),
    #fff;
}

.document-preview.template-creative .preview-section {
  padding: 18px;
  border-radius: 18px;
  background: rgba(var(--accent-rgb), 0.045);
}

.document-preview.template-minimal .resume-preview {
  padding-left: 70px;
  padding-right: 70px;
}

.document-preview.template-minimal .preview-section h3 {
  border-bottom: 0;
  padding-bottom: 0;
}

.document-preview.template-tech .resume-preview,
.document-preview.template-engineering .resume-preview {
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.08) 0 16px, transparent 16px),
    #fff;
}

.document-preview.template-tech .preview-section h3,
.document-preview.template-engineering .preview-section h3 {
  font-family: "Courier New", monospace;
}

.document-preview.template-medical .resume-header {
  border-left-color: var(--accent);
}

.document-preview.template-medical .preview-section h3 {
  color: var(--accent);
}

.document-preview.template-academic .resume-preview {
  font-family: Georgia, "Times New Roman", serif;
}

.document-preview.template-academic .preview-section h3 {
  color: var(--accent);
  border-bottom-style: double;
}

.document-preview.template-legal .resume-preview {
  font-family: Georgia, "Times New Roman", serif;
}

.document-preview.template-legal .resume-header {
  border-bottom: 3px solid var(--accent);
}

.document-preview.template-professional .resume-header {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  border-bottom-color: var(--accent);
}

.document-preview.template-modern .resume-preview,
.document-preview.template-professional .resume-preview {
  display: grid;
  grid-template-columns: 0.9fr 1.35fr;
  gap: 0 30px;
}

.document-preview.template-modern .resume-header,
.document-preview.template-professional .resume-header,
.document-preview.template-modern .resume-layout,
.document-preview.template-professional .resume-layout,
.document-preview.template-modern #previewSummarySection,
.document-preview.template-professional #previewSummarySection,
.document-preview.template-modern #previewExperienceSection,
.document-preview.template-professional #previewExperienceSection {
  grid-column: 1 / -1;
}

.document-preview.template-tech .resume-preview,
.document-preview.template-engineering .resume-preview,
.document-preview.template-finance .resume-preview {
  display: grid;
  grid-template-columns: 1.25fr 0.85fr;
  gap: 0 28px;
}

.document-preview.template-tech .resume-header,
.document-preview.template-engineering .resume-header,
.document-preview.template-finance .resume-header,
.document-preview.template-tech .resume-layout,
.document-preview.template-engineering .resume-layout,
.document-preview.template-finance .resume-layout,
.document-preview.template-tech #previewSummarySection,
.document-preview.template-engineering #previewSummarySection,
.document-preview.template-finance #previewSummarySection,
.document-preview.template-tech #previewExperienceSection,
.document-preview.template-engineering #previewExperienceSection,
.document-preview.template-finance #previewExperienceSection {
  grid-column: 1 / -1;
}

.document-preview.template-executive .preview-section h3 {
  color: var(--accent);
  letter-spacing: 0.14em;
}

.document-preview.template-medical .skill-chip-preview span {
  border-radius: 12px;
  color: var(--accent);
}

.document-preview.template-elegant .resume-preview {
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.08), transparent 26%),
    #fff;
}

.document-preview.template-elegant .preview-section h3 {
  border-bottom-color: rgba(var(--accent-rgb), 0.22);
}

.document-preview.template-finance .resume-header {
  border-bottom-color: var(--accent);
}

.document-preview.template-finance .preview-item strong::before {
  content: "▪ ";
  color: var(--accent);
}

.resume-header { padding-bottom: 22px; border-bottom: 2px solid rgba(23, 23, 23, 0.08); }
.template-bold .resume-header {
  border-bottom-color: rgba(255, 255, 255, 0.18);
  margin: -52px -54px 32px;
  padding: 52px 54px 28px;
  background: #151515;
}

.template-creative .resume-header,
.template-elegant .resume-header {
  border-bottom: 0;
  text-align: center;
}

.template-creative .resume-header h1,
.template-elegant .resume-header h1 {
  color: var(--accent);
}

.template-minimal .resume-header,
.template-professional .resume-header,
.template-legal .resume-header,
.template-finance .resume-header {
  border-bottom-color: var(--accent);
}

.template-tech .resume-header,
.template-engineering .resume-header,
.template-medical .resume-header {
  border-left: 8px solid var(--accent);
  padding-left: 22px;
}

.template-arabic .resume-preview {
  direction: rtl;
  text-align: right;
}

.template-executive .resume-header {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: white;
  margin: -52px -54px 32px;
  padding: 52px 54px 28px;
}

.document-preview.template-executive .resume-header h1,
.template-executive .resume-header p,
.template-executive .resume-header .meta-line {
  color: white;
}

.resume-header h1,
.letter-header h1 { margin: 0; font-size: clamp(2rem, 3.1vw, 2.2rem); }
.document-preview .resume-header h1 {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 32px;
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--accent);
}
.document-preview.template-classic .resume-header h1,
.document-preview.template-academic .resume-header h1,
.document-preview.template-legal .resume-header h1 {
  font-family: Georgia, "Times New Roman", serif;
}
.resume-header p,
.letter-header p { margin: 10px 0 0; }
.document-preview .resume-header p {
  font-size: 16px;
  line-height: 1.35;
}

.template-modern .resume-header h1,
.template-modern .preview-section h3 { color: var(--accent); }
.template-classic .resume-header h1,
.template-classic .preview-section h3 { color: var(--accent); }
.template-bold .resume-header h1,
.template-bold .resume-header p,
.template-bold .resume-header .meta-line { color: white; }
.template-bold .preview-section h3,
.template-bold .letter-header h1,
.template-bold .letter-header p { color: #111827; }

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.preview-section { margin-top: 26px; }
.preview-section h3 {
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(23, 23, 23, 0.08);
}

.document-preview .preview-section h3 {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15.5px;
  line-height: 1.25;
  letter-spacing: 0.08em;
}

.document-preview.template-classic .preview-section h3,
.document-preview.template-academic .preview-section h3,
.document-preview.template-legal .preview-section h3 {
  font-family: Georgia, "Times New Roman", serif;
}

.document-preview.template-tech .preview-section h3,
.document-preview.template-engineering .preview-section h3 {
  font-family: "Courier New", monospace;
}

.document-preview .executive-snapshot strong {
  font-family: Arial, Helvetica, sans-serif;
}

.resume-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(210px, 0.75fr);
  gap: 0 30px;
}

.resume-main-column,
.resume-side-column {
  min-width: 0;
}

.resume-side-column .preview-section {
  padding: 16px;
  border-radius: 18px;
  background: var(--template-accent-block);
}

.resume-side-column .preview-section h3 {
  border-bottom-color: rgba(23, 23, 23, 0.06);
}

.classic-centered {
  text-align: center;
}

.executive-snapshot {
  display: grid;
  gap: 8px;
  margin: 26px 0 10px;
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: white;
}

.executive-snapshot span,
.executive-snapshot small {
  color: rgba(255, 255, 255, 0.72);
}

.executive-snapshot strong {
  font-family: "Outfit", sans-serif;
  font-size: 1.45rem;
}

.clinical-layout {
  grid-template-columns: minmax(190px, 0.72fr) minmax(0, 1.28fr);
}

.clinical-sidebar {
  margin-top: 30px;
}

.clinical-sidebar .preview-section,
.contact-panel {
  background: rgba(var(--accent-rgb), 0.08);
}

.academic-layout,
.legal-layout,
.technical-layout,
.executive-layout {
  align-items: start;
}

.legal-rule {
  margin: 18px 0 4px;
  padding: 10px 0;
  border-top: 2px solid var(--accent);
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.22);
  color: #4b5563;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.creative-feature-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  margin-top: 8px;
}

.creative-feature-grid .preview-section {
  padding: 18px;
  border-radius: 22px;
  background: rgba(var(--accent-rgb), 0.055);
}

.technical-header .meta-line,
.medical-header .meta-line,
.academic-header .meta-line,
.legal-header .meta-line {
  justify-content: flex-start;
}

.preview-stack { display: grid; gap: 16px; }
.preview-item strong {
  display: block;
  font-size: 14.8px;
  line-height: 1.3;
}
.preview-item .item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.document-preview .preview-item p,
.document-preview .preview-section .body-copy {
  font-size: 14.5px;
  line-height: 1.42;
}

.skill-chip-preview span {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--template-accent-block);
  font-size: 13px;
  line-height: 1.25;
}

.letter-header { margin-bottom: 26px; }
.letter-body { white-space: pre-wrap; line-height: 1.9; }

.mobile-only { display: none; }
.preview-close-mobile { display: none; }

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(11, 31, 58, 0.48);
  backdrop-filter: blur(12px);
}

.modal-card {
  position: relative;
  width: min(680px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  padding: 30px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 34px 90px rgba(11, 31, 58, 0.28);
}

.modal-card h2 {
  margin: 8px 0 10px;
  font-family: "Outfit", sans-serif;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.04em;
}

.modal-card p {
  color: var(--muted);
  line-height: 1.7;
}

.modal-close {
  position: absolute;
  right: 18px;
  top: 18px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(11, 31, 58, 0.08);
  color: var(--navy);
  font-size: 1.4rem;
}

.modal-close:hover {
  background: rgba(26, 86, 219, 0.12);
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.section-visibility,
.resume-library {
  margin-top: 24px;
  padding: 22px;
  border: 1px solid rgba(26, 86, 219, 0.1);
  border-radius: 22px;
  background: rgba(248, 251, 255, 0.86);
}

.section-visibility h3,
.resume-library h3 {
  margin: 0 0 8px;
  font-family: "Outfit", sans-serif;
  font-size: 1.2rem;
}

.resume-library {
  display: grid;
  gap: 12px;
}

.resume-library label {
  display: grid;
  gap: 8px;
  font-weight: 800;
}

.library-current,
.library-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.library-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.library-actions button {
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 999px;
  background: white;
  padding: 9px 12px;
  font-weight: 900;
  color: var(--marine);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.library-actions button:hover,
.export-options button:hover,
.visibility-grid label:hover {
  border-color: rgba(26, 86, 219, 0.24);
  box-shadow: 0 12px 26px rgba(11, 31, 58, 0.08);
  transform: translateY(-1px);
}

.library-status {
  min-height: 1.3em;
  color: var(--accent);
  font-weight: 800;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(26, 86, 219, 0.08);
}

.visibility-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.visibility-grid label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(23, 23, 23, 0.08);
  border-radius: 16px;
  background: white;
  font-weight: 800;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.visibility-grid input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.checker-score {
  display: grid;
  gap: 8px;
  margin: 20px 0;
  padding: 22px;
  border-radius: 22px;
  background: rgba(26, 86, 219, 0.08);
}

.checker-score span {
  font-family: "Outfit", sans-serif;
  font-size: 3rem;
  font-weight: 800;
  color: var(--accent);
}

.checker-score small {
  color: var(--muted);
}

.ats-job-description {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.ats-job-description span {
  color: var(--ink);
  font-weight: 800;
}

.ats-score-result span {
  font-size: clamp(1.5rem, 5vw, 3rem);
}

.checker-score-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.checker-score-card,
.score-breakdown-item {
  padding: 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.86);
}

.checker-score-card span,
.score-breakdown-item span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.checker-score-card strong {
  display: block;
  margin-top: 6px;
  color: var(--accent);
  font-family: "Outfit", sans-serif;
  font-size: 1.7rem;
}

.checker-score-card p,
.score-breakdown-item p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.score-breakdown {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.score-breakdown-bar {
  height: 8px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
}

.score-breakdown-bar div {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.checker-privacy {
  margin: 10px 0 0;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--muted);
  font-size: 0.92rem;
}

.checker-grid {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.checker-grid h3 {
  margin: 0;
  font-size: 1rem;
}

.keyword-match {
  display: grid;
  gap: 10px;
}

.keyword-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.keyword-row strong {
  color: var(--ink);
}

.keyword-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent-deep);
  font-size: 0.84rem;
  font-weight: 700;
}

.warning-list li::before {
  background: #f59e0b;
}

@media (max-width: 720px) {
  .checker-score-cards {
    grid-template-columns: 1fr;
  }
}

.export-options {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.export-options button {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 18px;
  text-align: left;
  border: 1px solid rgba(23, 23, 23, 0.08);
  border-radius: 20px;
  background: white;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.export-options button strong {
  font-family: "Outfit", sans-serif;
  font-size: 1.2rem;
}

.export-options button span {
  color: var(--muted);
}

.export-note,
.export-status {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.export-status {
  min-height: 1.4em;
  font-weight: 800;
  color: var(--accent);
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(26, 86, 219, 0.08);
}

.library-status:empty,
.export-status:empty {
  display: none;
}

.welcome-card {
  background:
    radial-gradient(circle at 92% 8%, rgba(26, 86, 219, 0.13), transparent 12rem),
    rgba(255, 255, 255, 0.97);
}

.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.progress-list {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.progress-item {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid rgba(23, 23, 23, 0.08);
  border-radius: 18px;
  background: white;
}

.progress-item span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(23, 23, 23, 0.07);
  color: var(--muted);
  font-weight: 900;
}

.progress-item strong {
  font-family: "Outfit", sans-serif;
  font-size: 1.05rem;
}

.progress-item small {
  color: var(--muted);
  font-weight: 800;
}

.progress-item.complete {
  border-color: rgba(5, 150, 105, 0.18);
  background: rgba(5, 150, 105, 0.06);
}

.progress-item.complete span {
  background: #059669;
  color: white;
}

.bottom-step-dock {
  position: fixed;
  left: 50%;
  bottom: 14px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100% - 28px);
  padding: 6px;
  border: 1px solid rgba(23, 23, 23, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 34px rgba(17, 17, 17, 0.13);
  transform: translateX(-50%);
}

.bottom-step-dock .tab-button {
  min-width: 48px;
  min-height: 42px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
}

.dock-export {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  padding: 0 16px;
  background: var(--accent);
  color: white;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(26, 86, 219, 0.22);
}

@media (max-width: 1180px) {
  .editor-shell {
    grid-template-columns: 1fr;
    height: auto;
  }
  .preview-pane {
    border-top: 1px solid rgba(26, 86, 219, 0.08);
    max-height: none;
  }
  .mobile-only { display: inline-flex; }
  .preview-pane.hidden-mobile { display: none; }
  .form-pane { overflow: visible; }
}

@media (max-width: 1020px) and (min-width: 841px) {
  .editor-topbar {
    grid-template-columns: auto minmax(120px, 0.26fr) minmax(0, 1fr);
    width: min(100% - 16px, 1000px);
    gap: 6px;
  }

  .topbar-center {
    justify-content: center;
  }

  .topbar-right {
    grid-column: auto;
    justify-content: flex-end;
    gap: 4px;
  }

  .topbar-right .ghost-button,
  .topbar-right .primary-button {
    min-height: 32px;
    padding: 5px 7px;
    font-size: 0.72rem;
  }

  .topbar-right .primary-button {
    min-width: 70px;
    padding-inline: 10px;
  }

  .completion-pill {
    padding: 6px 8px;
  }

  .completion-pill span {
    display: none;
  }

  .completion-track {
    width: clamp(58px, 7vw, 78px);
  }
}

@media (max-width: 840px) {
  .editor-page {
    padding-bottom: 88px;
  }

  .editor-topbar {
    top: 8px;
    grid-template-columns: 1fr;
    gap: 8px;
    width: min(420px, calc(100% - 16px));
    padding: 9px;
    border-radius: 28px;
    box-shadow: 0 18px 42px rgba(11, 31, 58, 0.16);
  }

  .topbar-left {
    justify-content: space-between;
  }

  .logo-link {
    gap: 9px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 13px;
  }

  .logo-copy strong {
    font-size: 0.92rem;
  }

  .logo-copy small {
    font-size: 0.66rem;
  }

  .history-actions {
    gap: 6px;
  }

  .history-actions button {
    min-width: 38px;
    min-height: 38px;
    padding: 0 10px;
    font-size: 0.82rem;
  }

  .topbar-center {
    justify-content: flex-start;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
  }

  .completion-pill {
    padding: 8px 10px;
    font-size: 0.85rem;
  }

  .topbar-right {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .topbar-right .ghost-button,
  .topbar-right .primary-button {
    min-height: 38px;
    min-width: 0;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  #checkerButton {
    grid-column: span 2;
  }

  #printButton {
    grid-column: span 1;
  }

  .pane-inner {
    padding: 16px;
  }

  .form-card {
    padding: 18px;
  }

  .tab-row {
    margin-bottom: 16px;
    padding-bottom: 14px;
  }

  .form-grid, .entry-grid, .finish-grid { grid-template-columns: 1fr; }
  .preview-toolbar, .form-intro, .section-header {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
  }

  .form-intro {
    padding: 16px;
    gap: 12px;
  }

  .form-intro h1 {
    font-size: clamp(1.55rem, 8vw, 2.25rem);
  }

  .preview-pane {
    position: fixed;
    inset: 8px;
    z-index: 80;
    border: 1px solid rgba(26, 86, 219, 0.12);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 34px 90px rgba(11, 31, 58, 0.28);
  }

  .preview-pane::before {
    content: "Live mobile preview";
    position: absolute;
    right: 18px;
    top: 18px;
    z-index: 2;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(11, 31, 58, 0.82);
    color: white;
    font-size: 0.68rem;
    font-weight: 800;
  }

  .preview-scroll {
    padding: 16px;
  }

  .preview-close-mobile {
    display: inline-flex;
  }

  .resume-preview, .letter-preview { padding: 36px 26px; }
  .document-preview.template-modern .resume-preview,
  .document-preview.template-professional .resume-preview,
  .document-preview.template-tech .resume-preview,
  .document-preview.template-engineering .resume-preview,
  .document-preview.template-finance .resume-preview {
    display: block;
  }
  .resume-layout,
  .clinical-layout,
  .creative-feature-grid {
    grid-template-columns: 1fr;
  }
  .resume-side-column .preview-section,
  .creative-feature-grid .preview-section {
    padding: 0;
    background: transparent;
  }
  .document-preview.template-minimal .resume-preview {
    padding-left: 26px;
    padding-right: 26px;
  }
  .template-bold .resume-header {
    margin: -36px -26px 24px;
    padding: 36px 26px 24px;
  }
  .completion-track { width: 100%; }
  .modal-grid { grid-template-columns: 1fr; }
  .visibility-grid { grid-template-columns: 1fr; }

  .modal-card {
    padding: 26px;
    border-radius: 26px;
  }

  .section-visibility,
  .resume-library {
    padding: 18px;
  }

  .library-actions button {
    flex: 1 1 auto;
  }

  .progress-item {
    grid-template-columns: 34px 1fr;
  }

  .progress-item small {
    grid-column: 2;
  }

  .bottom-step-dock {
    overflow-x: auto;
    justify-content: flex-start;
    bottom: 12px;
    max-width: calc(100% - 16px);
    padding: 6px;
  }

  .bottom-step-dock .tab-button {
    min-width: 48px;
    min-height: 44px;
    padding: 0 11px;
  }

  .dock-export {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 76px;
  }
}

@media print {
  @page {
    size: A4;
    margin: 0;
  }

  * {
    box-shadow: none !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  html,
  body {
    width: 210mm !important;
    min-height: 297mm !important;
    margin: 0 !important;
    padding: 0 !important;
    background: white !important;
    overflow: visible !important;
  }

  body:not(.export-document) > *:not(.editor-page) {
    display: none !important;
  }

  .editor-topbar,
  .form-pane,
  .preview-toolbar,
  .ats-card,
  .bottom-step-dock,
  .modal-layer,
  .modal-backdrop,
  button,
  .ghost-button,
  .primary-button,
  .preview-close-mobile {
    display: none !important;
  }

  .editor-page,
  .editor-shell,
  .preview-pane,
  .preview-pane.hidden-mobile,
  .preview-scroll,
  .document-preview,
  .resume-preview {
    display: block !important;
    visibility: visible !important;
    position: static !important;
    inset: auto !important;
    width: 210mm !important;
    max-width: 210mm !important;
    height: auto !important;
    min-height: 297mm !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: white !important;
    border: 0 !important;
  }

  .preview-pane::before,
  .letter-preview {
    display: none !important;
  }

  .resume-preview.hidden {
    display: block !important;
  }

  .resume-preview {
    padding: 14mm !important;
    color: #111827 !important;
    font-family: Arial, Helvetica, sans-serif !important;
    font-size: 10.8pt !important;
    line-height: 1.4 !important;
  }

  .document-preview.template-classic .resume-preview,
  .document-preview.template-academic .resume-preview,
  .document-preview.template-legal .resume-preview {
    font-family: Georgia, "Times New Roman", serif !important;
  }

  .resume-header h1 {
    font-size: 24pt !important;
    line-height: 1.08 !important;
  }

  .resume-header p {
    font-size: 12pt !important;
    line-height: 1.35 !important;
  }

  .meta-line,
  .preview-item .item-meta,
  .skill-chip-preview span {
    font-size: 9.8pt !important;
    line-height: 1.35 !important;
  }

  .preview-section h3 {
    font-size: 11.8pt !important;
    line-height: 1.25 !important;
  }

  .preview-item p,
  .preview-section .body-copy {
    font-size: 10.8pt !important;
    line-height: 1.4 !important;
  }

  .template-bold .resume-header,
  .template-executive .resume-header {
    margin: -14mm -14mm 32px !important;
    padding: 14mm 14mm 28px !important;
  }

  .document-preview.template-minimal .resume-preview {
    padding-left: 18mm !important;
    padding-right: 18mm !important;
  }

  .resume-header,
  .preview-section,
  .preview-item,
  .executive-snapshot,
  .resume-side-column .preview-section,
  .creative-feature-grid .preview-section {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .preview-section {
    margin-top: 18px !important;
  }

  .resume-layout,
  .clinical-layout,
  .technical-layout,
  .creative-feature-grid {
    gap: 0 18px !important;
  }
}
