:root {
  --accent: #2563eb;
  --accent-rgb: 37, 99, 235;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --canvas: #e9eef5;
  --danger: #dc2626;
  --radius: 16px;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
  --cv-scale: 0.85;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Inter", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(var(--accent-rgb), 0.24);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 10px 22px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: var(--ink);
  color: white;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  line-height: 1.15;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.save-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 800;
  transition: 0.2s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--ink);
  color: white;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.17);
}

.button-primary:hover {
  background: #1e293b;
}

.button-secondary {
  border-color: #cbd5e1;
  background: white;
  color: var(--ink);
}

.button-danger {
  border-color: #fecaca;
  background: #fff7f7;
  color: var(--danger);
}

.grow {
  flex: 1;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(390px, 48%) minmax(520px, 52%);
  height: calc(100vh - 68px);
}

.editor-panel {
  overflow-y: auto;
  padding: 26px clamp(18px, 3vw, 42px) 90px;
  border-right: 1px solid #dbe3ee;
  background: #f8fafc;
}

.editor-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.editor-heading h1 {
  margin: 0;
  font-size: clamp(25px, 2.5vw, 34px);
  letter-spacing: -0.04em;
}

.text-button {
  padding: 4px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.danger-text {
  color: var(--danger);
}

.template-section,
.form-section {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.035);
}

.template-section {
  padding: 20px;
}

.section-title-row {
  margin-bottom: 16px;
}

.section-title-row > div,
.form-section summary > span:first-child {
  display: flex;
  align-items: center;
  gap: 9px;
}

.section-title-row h2 {
  margin: 0;
  font-size: 15px;
}

.step-number {
  display: inline-grid;
  min-width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 8px;
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.template-card {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  text-align: left;
  transition: 0.2s ease;
}

.template-card:hover {
  border-color: #94a3b8;
  transform: translateY(-2px);
}

.template-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.template-card strong,
.template-card small {
  display: block;
}

.template-card strong {
  margin-top: 8px;
  color: var(--ink);
  font-size: 12px;
}

.template-card small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.template-thumbnail {
  position: relative;
  display: block;
  overflow: hidden;
  height: 76px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: white;
}

.template-thumbnail i,
.template-thumbnail b,
.template-thumbnail em {
  position: absolute;
  display: block;
}

.modern-thumb i {
  inset: 0 auto 0 0;
  width: 34%;
  background: #172033;
}

.modern-thumb b {
  top: 12px;
  left: 42%;
  width: 42%;
  height: 6px;
  background: var(--accent);
}

.modern-thumb em {
  top: 27px;
  left: 42%;
  width: 48%;
  height: 28px;
  background: repeating-linear-gradient(#cbd5e1 0 3px, transparent 3px 7px);
}

.classic-thumb i {
  top: 10px;
  left: 25%;
  width: 50%;
  height: 6px;
  background: #334155;
}

.classic-thumb b {
  top: 24px;
  left: 10%;
  width: 80%;
  height: 2px;
  background: var(--accent);
}

.classic-thumb em {
  top: 35px;
  left: 10%;
  width: 80%;
  height: 27px;
  background:
    linear-gradient(90deg, transparent 48%, #e2e8f0 48%, #e2e8f0 51%, transparent 51%),
    repeating-linear-gradient(#cbd5e1 0 3px, transparent 3px 7px);
}

.minimal-thumb i {
  top: 0;
  left: 0;
  width: 100%;
  height: 7px;
  background: var(--accent);
}

.minimal-thumb b {
  top: 18px;
  left: 10%;
  width: 38%;
  height: 7px;
  background: #0f172a;
}

.minimal-thumb em {
  top: 34px;
  left: 10%;
  width: 78%;
  height: 29px;
  background: repeating-linear-gradient(#cbd5e1 0 3px, transparent 3px 7px);
}

.accent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.accent-row label {
  font-size: 12px;
  font-weight: 700;
}

.colour-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.colour-control input {
  width: 34px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.form-section summary {
  display: flex;
  list-style: none;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
}

.form-section summary::-webkit-details-marker {
  display: none;
}

.summary-icon {
  color: var(--muted);
  font-size: 18px;
  transition: 0.2s ease;
}

.form-section[open] .summary-icon {
  transform: rotate(45deg);
}

.section-content {
  padding: 2px 18px 20px;
}

.field-grid {
  display: grid;
  gap: 13px;
}

.field-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  position: relative;
  display: block;
  margin-top: 13px;
}

.field > span {
  display: block;
  margin-bottom: 7px;
  color: #334155;
  font-size: 11px;
  font-weight: 800;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  outline: 0;
  transition: 0.18s ease;
}

.field input {
  height: 43px;
  padding: 0 12px;
}

.field textarea {
  min-height: 82px;
  padding: 11px 12px;
  line-height: 1.55;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1);
}

.field small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.field .counter {
  text-align: right;
}

.photo-field {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface-soft);
}

.photo-preview-wrap {
  flex: 0 0 76px;
  width: 76px;
  height: 76px;
  overflow: hidden;
  border: 3px solid white;
  border-radius: 16px;
  box-shadow: 0 5px 15px rgba(15, 23, 42, 0.1);
}

.photo-preview-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 7px 11px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.photo-field p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 9px;
}

.repeat-list {
  display: grid;
  gap: 12px;
  margin-top: 13px;
}

.repeat-card {
  position: relative;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
}

.repeat-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.repeat-card-head strong {
  color: #475569;
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.remove-entry {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 15px;
  font-weight: 800;
}

.add-button {
  width: 100%;
  margin-top: 13px;
  padding: 11px;
  border: 1px dashed #94a3b8;
  border-radius: 10px;
  background: #f8fafc;
  color: #334155;
  font-size: 11px;
  font-weight: 800;
}

.add-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.editor-footer-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.preview-panel {
  min-width: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(var(--accent-rgb), 0.08), transparent 34%),
    #e6ebf2;
}

.preview-toolbar {
  display: flex;
  height: 58px;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(15px);
}

.preview-toolbar strong,
.preview-toolbar small {
  display: block;
}

.preview-toolbar strong {
  font-size: 12px;
}

.preview-toolbar small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.zoom-controls button {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: white;
  color: var(--ink);
  font-weight: 800;
}

.zoom-controls span {
  width: 40px;
  color: #475569;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.preview-stage {
  height: calc(100vh - 126px);
  overflow: auto;
  padding: 28px 22px 100px;
}

.cv-scale-wrapper {
  position: relative;
  width: calc(794px * var(--cv-scale));
  height: calc(1123px * var(--cv-scale));
  min-height: calc(1123px * var(--cv-scale));
  margin: 0 auto;
}

.cv-document {
  position: absolute;
  top: 0;
  left: 0;
  width: 794px;
  min-height: 1123px;
  overflow: hidden;
  background: white;
  color: #172033;
  box-shadow: var(--shadow);
  transform: scale(var(--cv-scale));
  transform-origin: top left;
}

/* =========================
   Shared CV typography
========================= */

.cv-document * {
  box-sizing: border-box;
}

.cv-document h1,
.cv-document h2,
.cv-document h3,
.cv-document p {
  margin-top: 0;
}

.cv-document p {
  white-space: pre-line;
}

.cv-photo {
  width: 130px;
  height: 130px;
  object-fit: cover;
}

.cv-contact-line {
  overflow-wrap: anywhere;
}

.cv-section {
  break-inside: avoid;
  page-break-inside: avoid;
}

.cv-section-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.cv-entry {
  break-inside: avoid;
  page-break-inside: avoid;
}

.cv-entry h3 {
  margin-bottom: 3px;
  font-size: 14px;
}

.cv-meta {
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
}

.cv-entry p {
  margin-bottom: 0;
  color: #475569;
  font-size: 10.5px;
  line-height: 1.55;
}

.cv-empty-note {
  color: #94a3b8;
  font-size: 11px;
  font-style: italic;
}

/* =========================
   Modern template
========================= */

.cv-modern {
  display: grid;
  grid-template-columns: 258px 1fr;
  min-height: 1123px;
  font-family: "Inter", Arial, sans-serif;
}

.cv-modern .modern-sidebar {
  padding: 48px 30px;
  background: #172033;
  color: white;
}

.cv-modern .cv-photo {
  display: block;
  margin: 0 auto 27px;
  border: 6px solid rgba(255, 255, 255, 0.13);
  border-radius: 50%;
}

.cv-modern .modern-sidebar .cv-section {
  margin-top: 28px;
}

.cv-modern .modern-sidebar .cv-section-title {
  margin-bottom: 13px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
  color: white;
}

.cv-modern .contact-list {
  display: grid;
  gap: 11px;
}

.cv-modern .contact-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: start;
  color: #e2e8f0;
  font-size: 9.6px;
  line-height: 1.45;
}

.cv-modern .contact-icon {
  color: var(--accent);
  font-weight: 800;
}

.cv-modern .skill-list,
.cv-modern .language-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.cv-modern .skill-pill {
  padding: 6px 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.09);
  color: #f8fafc;
  font-size: 9px;
  font-weight: 600;
}

.cv-modern .language-list {
  display: grid;
  gap: 7px;
  color: #e2e8f0;
  font-size: 9.7px;
}

.cv-modern .modern-main {
  padding: 59px 48px 48px;
}

.cv-modern .modern-header {
  margin-bottom: 31px;
}

.cv-modern .modern-header h1 {
  margin-bottom: 6px;
  color: #0f172a;
  font-size: 38px;
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.cv-modern .modern-header h2 {
  margin: 0;
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.cv-modern .modern-main .cv-section {
  margin-top: 25px;
}

.cv-modern .modern-main .cv-section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 15px;
  color: #0f172a;
}

.cv-modern .modern-main .cv-section-title::after {
  flex: 1;
  height: 2px;
  background: #e2e8f0;
  content: "";
}

.cv-modern .summary-copy {
  color: #475569;
  font-size: 11px;
  line-height: 1.72;
}

.cv-modern .cv-entry {
  position: relative;
  margin-bottom: 18px;
  padding-left: 20px;
  border-left: 2px solid #e2e8f0;
}

.cv-modern .cv-entry::before {
  position: absolute;
  top: 3px;
  left: -5px;
  width: 8px;
  height: 8px;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  content: "";
}

.cv-modern .entry-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 15px;
}

.cv-modern .entry-subtitle {
  margin-bottom: 7px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
}

.cv-modern .reference-copy {
  color: #475569;
  font-size: 10.5px;
  line-height: 1.6;
}

/* =========================
   Classic template
========================= */

.cv-classic {
  min-height: 1123px;
  padding: 50px 54px;
  font-family: Georgia, "Times New Roman", serif;
}

.cv-classic .classic-header {
  position: relative;
  min-height: 136px;
  padding: 18px 150px 22px 0;
  border-bottom: 3px double #1e293b;
}

.cv-classic .cv-photo {
  position: absolute;
  top: 0;
  right: 0;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
}

.cv-classic .classic-header h1 {
  margin-bottom: 8px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 36px;
  letter-spacing: -0.02em;
}

.cv-classic .classic-header h2 {
  margin: 0 0 15px;
  color: var(--accent);
  font-family: "Inter", Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.cv-classic .classic-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  color: #475569;
  font-family: "Inter", Arial, sans-serif;
  font-size: 9.3px;
}

.cv-classic .classic-summary {
  margin: 23px 0;
  color: #475569;
  font-size: 11.5px;
  line-height: 1.65;
  text-align: justify;
}

.cv-classic .classic-columns {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 36px;
}

.cv-classic .cv-section {
  margin-top: 23px;
}

.cv-classic .cv-section-title {
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #94a3b8;
  color: #0f172a;
  font-family: "Inter", Arial, sans-serif;
}

.cv-classic .classic-main .cv-entry {
  margin-bottom: 18px;
}

.cv-classic .entry-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.cv-classic .cv-entry h3 {
  font-size: 13.5px;
}

.cv-classic .entry-subtitle {
  margin-bottom: 5px;
  color: var(--accent);
  font-family: "Inter", Arial, sans-serif;
  font-size: 9.5px;
  font-weight: 700;
}

.cv-classic .cv-meta,
.cv-classic .cv-entry p,
.cv-classic .classic-side,
.cv-classic .reference-copy {
  font-family: "Inter", Arial, sans-serif;
}

.cv-classic .classic-side .skill-list {
  display: grid;
  gap: 8px;
}

.cv-classic .classic-side .skill-pill {
  padding-bottom: 6px;
  border-bottom: 1px dotted #cbd5e1;
  color: #334155;
  font-size: 9.8px;
  font-weight: 600;
}

.cv-classic .language-list,
.cv-classic .side-list {
  display: grid;
  gap: 8px;
  color: #475569;
  font-family: "Inter", Arial, sans-serif;
  font-size: 9.8px;
  line-height: 1.45;
}

/* =========================
   Minimal template
========================= */

.cv-minimal {
  min-height: 1123px;
  padding: 0 54px 50px;
  border-top: 13px solid var(--accent);
  font-family: "Inter", Arial, sans-serif;
}

.cv-minimal .minimal-header {
  display: grid;
  grid-template-columns: 1fr 118px;
  gap: 25px;
  align-items: center;
  padding: 43px 0 28px;
  border-bottom: 1px solid #d7dee8;
}

.cv-minimal .minimal-header h1 {
  margin-bottom: 7px;
  color: #0f172a;
  font-size: 39px;
  letter-spacing: -0.05em;
}

.cv-minimal .minimal-header h2 {
  margin: 0;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

.cv-minimal .cv-photo {
  width: 112px;
  height: 112px;
  border-radius: 14px;
  filter: saturate(0.85);
}

.cv-minimal .minimal-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 14px 0;
  border-bottom: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 9.5px;
}

.cv-minimal .minimal-grid {
  display: grid;
  grid-template-columns: 1fr 210px;
  gap: 42px;
}

.cv-minimal .cv-section {
  margin-top: 26px;
}

.cv-minimal .cv-section-title {
  margin-bottom: 14px;
  color: var(--accent);
}

.cv-minimal .summary-copy {
  color: #475569;
  font-size: 11px;
  line-height: 1.7;
}

.cv-minimal .cv-entry {
  margin-bottom: 20px;
}

.cv-minimal .entry-heading {
  display: flex;
  justify-content: space-between;
  gap: 15px;
}

.cv-minimal .entry-subtitle {
  margin-bottom: 6px;
  color: #334155;
  font-size: 10px;
  font-weight: 700;
}

.cv-minimal .minimal-side .skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.cv-minimal .minimal-side .skill-pill {
  padding: 6px 8px;
  border: 1px solid #dbe3ee;
  border-radius: 5px;
  color: #475569;
  font-size: 9px;
  font-weight: 600;
}

.cv-minimal .language-list,
.cv-minimal .side-list,
.cv-minimal .reference-copy {
  display: grid;
  gap: 8px;
  color: #475569;
  font-size: 9.7px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 100;
  max-width: 330px;
  padding: 12px 15px;
  border-radius: 10px;
  background: #0f172a;
  color: white;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translateY(15px);
  transition: 0.22s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: #991b1b;
}

.download-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-content: center;
  justify-items: center;
  background: rgba(15, 23, 42, 0.84);
  color: white;
  backdrop-filter: blur(8px);
}

.download-overlay[hidden] {
  display: none;
}

.download-overlay strong {
  margin-top: 16px;
  font-size: 17px;
}

.download-overlay span {
  margin-top: 5px;
  color: #cbd5e1;
  font-size: 11px;
}

.loader {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.mobile-only {
  display: none;
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: minmax(350px, 46%) minmax(480px, 54%);
  }

  .editor-panel {
    padding-inline: 18px;
  }
}

@media (max-width: 840px) {
  .save-status,
  .topbar .button-primary {
    display: none;
  }

  .mobile-only {
    display: inline-flex;
  }

  .workspace {
    display: block;
    height: auto;
  }

  .editor-panel {
    min-height: calc(100vh - 68px);
    overflow: visible;
    border-right: 0;
  }

  .preview-panel {
    position: fixed;
    inset: 68px 0 0;
    z-index: 80;
    display: none;
  }

  .preview-panel.mobile-open {
    display: block;
  }

  .preview-toolbar {
    height: 55px;
  }

  .preview-stage {
    height: calc(100vh - 123px);
    padding-inline: 12px;
  }

  .preview-close {
    border: 0;
    background: transparent;
    color: var(--danger);
    font-size: 12px;
    font-weight: 800;
  }

  .template-grid {
    gap: 7px;
  }
}

@media (max-width: 540px) {
  .topbar {
    padding-inline: 14px;
  }

  .brand small {
    display: none;
  }

  .editor-panel {
    padding: 19px 12px 80px;
  }

  .template-section {
    padding: 14px;
  }

  .field-grid.two {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .template-thumbnail {
    height: 63px;
  }

  .photo-field {
    align-items: flex-start;
  }

  .photo-preview-wrap {
    flex-basis: 68px;
    width: 68px;
    height: 68px;
  }

  .editor-footer-actions {
    flex-wrap: wrap;
  }

  .editor-footer-actions .button {
    flex: 1 1 42%;
  }

  .editor-footer-actions .grow {
    flex-basis: 100%;
  }
}

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

  html,
  body {
    width: 210mm;
    margin: 0;
    background: white;
  }

  .topbar,
  .editor-panel,
  .preview-toolbar,
  .toast,
  .download-overlay {
    display: none !important;
  }

  .workspace,
  .preview-panel,
  .preview-stage,
  .cv-scale-wrapper {
    display: block !important;
    width: 210mm !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: white !important;
  }

  .cv-document {
    position: static !important;
    width: 210mm !important;
    min-height: 297mm !important;
    box-shadow: none !important;
    transform: none !important;
  }
}
