/* Studio shares the website palette. Document colours belong to the CV engine
   and the inline colour swatches, so they remain independent of this theme. */
.builder-body {
  --studio-bg: var(--apple-bg, #f5f5f7);
  --studio-surface: var(--apple-surface, #fff);
  --studio-ink: var(--apple-ink, #1d1d1f);
  --studio-muted: var(--apple-secondary, #6e6e73);
  --studio-border: var(--apple-line, #d2d2d7);
  --studio-blue: var(--apple-blue, #0071e3);
  --studio-blue-hover: var(--apple-blue-hover, #0068d1);
  --studio-link: var(--apple-link, #0066cc);
  --studio-selection: var(--apple-selection, #e8f2ff);
  --studio-divider: #e5e5ea;
  --studio-shadow: 0 2px 6px rgb(0 0 0 / 2%), 0 12px 36px rgb(0 0 0 / 3%);
  margin: 0;
  background: var(--studio-bg);
  color: var(--studio-ink);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  color-scheme: light;
}

.builder-body input,
.builder-body button,
.builder-body select,
.builder-body textarea { font-family: var(--font-ui); }

.builder-body strong,
.builder-body h1,
.builder-body h2,
.builder-body h3,
.builder-body .button { font-weight: 600; }

.builder-body :focus-visible { outline: 3px solid var(--studio-blue); outline-offset: 4px; }
.builder-body ::selection { background: var(--studio-selection); color: var(--studio-ink); }

.builder-body .button {
  min-height: 44px;
  padding: 11px 23px;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.5;
  transition: background .18s ease, box-shadow .18s ease;
}

.builder-body .button-dark { background: var(--studio-blue); color: #fff; }
.builder-body .button-dark:hover { background: var(--studio-blue-hover); transform: none; }
.builder-body .button-outline { border-color: var(--studio-border); background: var(--studio-surface); color: var(--studio-ink); }
.builder-body .button-outline:hover { background: var(--studio-bg); }
.builder-body .button:disabled { cursor: wait; opacity: .5; }

.quiet-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 7px 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--studio-link);
  font-size: 12px;
  line-height: 1.5;
}

.quiet-button:hover { color: var(--studio-link); text-decoration: underline; text-underline-offset: 3px; }
.quiet-button svg, .button svg { width: 16px; height: 16px; flex-shrink: 0; }

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  padding: 9px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--studio-muted);
  transition: background .18s ease, color .18s ease;
}

.icon-button:hover { background: var(--studio-bg); color: var(--studio-ink); }
.icon-button svg { width: 18px; height: 18px; stroke-width: 1.7; }
.icon-button:disabled { opacity: .3; cursor: default; }
.icon-button:disabled:hover { background: transparent; }
.icon-button[data-action^='remove']:hover { background: #fff1f0; color: #b42318; }



/* Library and editing are full-height views of the same local documents. */
.builder-body[data-studio-view] { height: 100vh; height: 100dvh; overflow: hidden; }
.builder-body [hidden] { display: none !important; }
.builder-body h2 { font-size: 18px; line-height: 1.4; letter-spacing: -.35px; }
.builder-body h3 { font-size: 14px; line-height: 1.5; letter-spacing: -.15px; }
.studio-main, #workspace { width: 100%; height: 100%; min-width: 0; min-height: 0; }
#workspace:focus { outline: none; }
.library-shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.library-sidebar { display: flex; flex-direction: column; gap: 32px; min-width: 0; padding: 32px 20px 22px; border-right: 1px solid var(--studio-divider); background: #fbfbfd; }
.library-sidebar .brand { padding: 2px 12px; min-height: 44px; font-size: 22px; }
.library-sidebar .studio-name { margin: -29px 0 -7px 53px; color: var(--studio-muted); font-size: 10px; }
.library-new-button { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; min-height: 46px; padding: 10px 16px; border: 1px solid var(--studio-border); border-radius: 13px; background: #fff; font-size: 13px; font-weight: 600; box-shadow: 0 1px 3px rgb(0 0 0 / 2%); }
.library-new-button:hover { border-color: var(--studio-blue); color: var(--studio-link); background: var(--studio-selection); }
.library-new-button svg { width: 19px; height: 19px; }
.library-nav { display: flex; flex-direction: column; gap: 6px; margin-top: -14px; }
.library-nav a, .library-nav button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 12px 14px; border: 0; border-radius: 12px; background: transparent; color: var(--studio-muted); font-size: 13px; text-align: left; }
.library-nav svg { width: 20px; height: 20px; flex-shrink: 0; }
.library-nav a:hover, .library-nav button:hover { background: #eeeef2; color: var(--studio-ink); }
.library-nav [aria-current='page'], .library-nav [aria-pressed='true'] { background: var(--studio-selection); color: var(--studio-link); font-weight: 600; }
.library-sidebar-footer { display: flex; flex-direction: column; gap: 14px; margin-top: auto; padding: 18px 0 0; border-top: 1px solid var(--studio-divider); }
.library-sidebar-footer p, .library-sidebar-footer small { max-width: 34ch; color: var(--studio-muted); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.library-sidebar-footer a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--studio-muted); font-size: 12px; }
.library-sidebar-footer a:hover { color: var(--studio-link); }
.library-sidebar-footer svg { width: 18px; height: 18px; }
.studio-language-picker { position: relative; width: 100%; max-width: 220px; border: 0; }
.studio-language-picker > summary { display: flex; align-items: center; justify-content: flex-start; gap: 8px; min-height: 44px; padding: 10px 12px; border: 1px solid var(--studio-border); border-radius: 10px; background: var(--studio-surface); font-size: 12px; font-weight: 400; letter-spacing: 0; }
.studio-language-picker > summary > .studio-language-label { flex: 1; min-width: 0; }
.studio-language-picker > summary svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--studio-muted); }
.studio-language-options { position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 30; display: flex; flex-direction: column; width: 100%; max-height: min(406px, calc(100dvh - 190px)); overflow-y: auto; overscroll-behavior: contain; padding: 5px; border: 1px solid var(--studio-border); border-radius: 12px; background: var(--studio-surface); box-shadow: 0 8px 24px rgb(0 0 0 / 10%); }
.studio-language-options button { display: flex; align-items: center; gap: 8px; flex-shrink: 0; width: 100%; min-height: 44px; padding: 10px; border: 0; border-radius: 8px; background: transparent; font-size: 12px; text-align: left; }
.studio-language-options button:hover { background: var(--studio-bg); }
.studio-language-options button[aria-pressed='true'] { background: var(--studio-selection); color: var(--studio-link); }
.studio-language-code { display: none; flex: 0 0 22px; font-size: 12px; font-weight: 600; line-height: 1; text-align: center; }
.studio-language-label { white-space: nowrap; }
.library-main { min-width: 0; overflow: auto; overscroll-behavior: contain; padding: 48px clamp(28px, 4vw, 76px) 64px; }
.library-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; max-width: 1380px; margin: 0 auto 36px; }
.library-heading h1 { font-size: 32px; line-height: 1.2; letter-spacing: -1.05px; }
.library-heading p { margin-top: 9px; color: var(--studio-muted); font-size: 13px; line-height: 1.7; }
.library-heading .step-eyebrow { margin: 0 0 8px; color: var(--studio-muted); font-size: 11px; }
.library-heading-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
.library-heading-actions > .button { flex-shrink: 0; }
.library-view-switch { display: inline-flex; flex-shrink: 0; gap: 2px; padding: 3px; border: 1px solid #e3e3e8; border-radius: 13px; background: #ededf1; }
.library-view-switch button { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 12px; border: 0; border-radius: 9px; background: transparent; color: var(--studio-muted); }
.library-view-switch button[aria-pressed='true'] { background: #fff; color: var(--studio-ink); box-shadow: 0 1px 5px rgb(0 0 0 / 8%); }
.library-view-switch svg { width: 19px; height: 19px; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); align-items: start; gap: 32px 26px; max-width: 1380px; margin: 0 auto; }
.library-create-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 15px; width: 100%; min-width: 0; aspect-ratio: 595.28 / 841.89; padding: 24px; border: 1px dashed #bcbcc4; border-radius: 14px; background: rgb(255 255 255 / 38%); color: var(--studio-muted); font-size: 14px; transition: background .16s ease, border-color .16s ease; }
.library-create-card:hover { border-color: var(--studio-blue); background: #edf5ff; color: var(--studio-link); }
.library-create-card svg { width: 28px; height: 28px; stroke-width: 1.3; }
.library-create-card > span { display: flex; align-items: center; justify-content: center; width: 54px; height: 54px; border-radius: 50%; background: #fff; box-shadow: 0 1px 5px rgb(0 0 0 / 4%); }
.library-create-card small { font-size: 11px; line-height: 1.6; }
.cv-library-card { position: relative; min-width: 0; }
.cv-card-preview { display: block; width: 100%; min-width: 0; padding: 0; overflow: hidden; border: 1px solid #e2e2e7; border-radius: 14px; background: #fff; box-shadow: 0 2px 4px rgb(0 0 0 / 3%), 0 10px 24px rgb(0 0 0 / 4%); transition: border-color .16s ease, box-shadow .16s ease; }
.cv-card-preview:hover { border-color: #b8d6f8; box-shadow: 0 4px 8px rgb(0 0 0 / 4%), 0 15px 32px rgb(0 0 0 / 7%); }
.cv-card-paper { display: block; width: 100%; aspect-ratio: 595.28 / 841.89; overflow: hidden; background: #fff; }
.cv-card-paper svg { display: block; width: 100%; height: auto; }
.cv-card-info { min-width: 0; padding: 15px 4px 0; }
.cv-card-title { display: block; max-width: 100%; min-height: 44px; padding: 0; overflow: hidden; border: 0; border-radius: 4px; background: transparent; color: var(--studio-ink); font-size: 14px; font-weight: 600; line-height: 1.5; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.cv-card-title:hover { color: var(--studio-link); }
.cv-card-meta { display: block; margin-top: 1px; color: var(--studio-muted); font-size: 11px; line-height: 1.6; }
.cv-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1px; margin: 9px 0 0 -7px; }
.cv-card-actions .quiet-button { padding: 8px 10px; font-size: 11px; }
.library-grid[data-layout='list'] { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.library-grid[data-layout='list'] .library-create-card { flex-direction: row; justify-content: flex-start; gap: 14px; min-height: 72px; aspect-ratio: auto; padding: 16px 24px; }
.library-grid[data-layout='list'] .library-create-card svg { width: 22px; height: 22px; }
.library-grid[data-layout='list'] .cv-library-card { display: grid; grid-template-columns: 66px minmax(0, 1fr) auto; align-items: center; gap: 22px; padding: 16px 22px; border: 1px solid var(--studio-divider); border-radius: 15px; background: #fff; }
.library-grid[data-layout='list'] .cv-card-preview { border-radius: 4px; box-shadow: 0 1px 4px rgb(0 0 0 / 5%); }
.library-grid[data-layout='list'] .cv-card-info { padding: 0; }
.library-grid[data-layout='list'] .cv-card-actions { margin: 0; }

/* Compact controls and two independently scrolling panes. */
.studio-workspace { display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-width: 0; min-height: 0; }
.workspace-topbar { position: relative; z-index: 10; display: grid; grid-template-columns: minmax(100px, 1fr) minmax(120px, 340px) auto; align-items: center; gap: 20px; height: 72px; min-height: 72px; padding: 0 24px; border-bottom: 1px solid var(--studio-divider); background: rgb(255 255 255 / 94%); }
.workspace-back { display: inline-flex; align-items: center; justify-content: center; gap: 8px; justify-self: start; min-height: 44px; padding: 10px 14px; border: 1px solid var(--studio-border); border-radius: 12px; background: #fff; color: var(--studio-ink); font-size: 12px; }
.workspace-back:hover { background: var(--studio-bg); }
.workspace-back svg { width: 18px; height: 18px; }
.workspace-title { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; gap: 1px; }
.workspace-title input { width: 100%; min-width: 0; height: 44px; padding: 4px 10px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--studio-ink); font-size: 14px; font-weight: 600; line-height: 1.5; text-align: center; text-overflow: ellipsis; }
.workspace-title input:hover { background: var(--studio-bg); }
.workspace-title input:focus { border-color: var(--studio-blue); outline: 0; background: #fff; box-shadow: 0 0 0 3px rgb(0 113 227 / 10%); }
#save-status { display: block; overflow: hidden; max-width: 100%; color: var(--studio-muted); font-size: 10px; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.save-dot { display: inline-block; width: 5px; height: 5px; margin-right: 6px; border-radius: 50%; background: #86868b; vertical-align: middle; }
.workspace-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; min-width: 0; }
.workspace-actions > .button { flex-shrink: 0; }
.workspace-actions .icon-button { border-radius: 10px; }
.history-buttons { display: flex; align-items: center; flex-shrink: 0; gap: 0; margin-right: 5px; padding-right: 7px; border-right: 1px solid var(--studio-divider); }
.document-menu .menu-history-mobile { display: none; }
.language-menu, .document-menu { position: relative; flex-shrink: 0; border: 0; }
.workspace-actions > .studio-language-picker { width: auto; max-width: none; }
.language-menu > .studio-language-options { bottom: auto; width: 200px; max-height: min(420px, calc(100dvh - 96px)); }
.language-menu > summary, .document-menu > summary { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 11px; border: 1px solid var(--studio-divider); border-radius: 11px; color: var(--studio-ink); font-size: 12px; font-weight: 400; letter-spacing: 0; }
.document-menu > summary { width: 44px; padding: 11px; }
.language-menu > summary svg, .document-menu > summary svg { width: 18px; height: 18px; }
.language-menu > summary:hover, .document-menu > summary:hover { background: var(--studio-bg); }
.language-menu > div, .document-menu > div, .menu-popover { position: absolute; top: calc(100% + 9px); right: 0; z-index: 30; display: flex; flex-direction: column; gap: 3px; min-width: 190px; max-width: calc(100vw - 28px); padding: 7px; border: 1px solid var(--studio-divider); border-radius: 14px; background: #fff; box-shadow: 0 10px 36px rgb(0 0 0 / 12%); }
.language-menu > div > button, .document-menu > div > button, .menu-popover > button { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 11px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--studio-ink); font-size: 12px; text-align: left; }
.language-menu > div > button:hover, .document-menu > div > button:hover, .menu-popover > button:hover { background: var(--studio-bg); }
.language-menu > div > button[aria-pressed='true'] { background: var(--studio-selection); color: var(--studio-link); }
.menu-popover svg { width: 18px; height: 18px; }
.menu-popover > p { padding: 7px 9px 3px; color: var(--studio-muted); font-size: 11px; }
.menu-popover { max-height: calc(100dvh - 96px); overflow-y: auto; overscroll-behavior: contain; }
.menu-popover > .field { padding: 7px 8px 9px; }
.menu-popover > a { display: flex; align-items: center; min-height: 44px; padding: 11px 12px; border-radius: 8px; font-size: 12px; }
.menu-popover > a:hover { background: var(--studio-bg); }
.workspace-mobile-tabs { display: none; }
.studio-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); flex: 1; min-height: 0; min-width: 0; overflow: hidden; }
.studio-editor { min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; border-right: 1px solid var(--studio-divider); background: #fff; scrollbar-width: thin; scrollbar-color: #c1c1c7 transparent; scroll-behavior: auto; }
.editor-content { max-width: 776px; margin: 0 auto; padding: 28px clamp(28px, 4vw, 68px) 64px; }
.editor-section { border-bottom: 1px solid var(--studio-divider); }
.editor-section > summary { display: flex; align-items: center; justify-content: flex-start; gap: 12px; min-height: 82px; padding: 22px 0; font-size: 17px; font-weight: 600; letter-spacing: -.3px; }
.editor-section > summary h2 { margin-right: auto; font-size: 17px; line-height: 1.4; letter-spacing: -.3px; }
.editor-section > summary:hover { color: var(--studio-link); }
.section-count { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 2px 7px; border-radius: 7px; background: var(--studio-bg); color: var(--studio-muted); font-size: 11px; font-weight: 400; letter-spacing: 0; }
.section-chevron { position: relative; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex-shrink: 0; border: 1px solid var(--studio-border); border-radius: 50%; color: var(--studio-muted); }
.section-chevron svg { display: none; }
.section-chevron::before, .section-chevron::after { content: ''; position: absolute; width: 12px; height: 1.5px; border-radius: 1px; background: currentColor; }
.section-chevron::after { transform: rotate(90deg); transition: transform .16s ease; }
.editor-section[open] > summary .section-chevron::after { transform: rotate(0); }
.editor-section[open] > summary { color: var(--studio-ink); }
.editor-section-body { padding: 3px 0 28px; }
.editor-section-body > .form-intro:first-child { margin-top: 0; }
.editor-section.is-preview-selected > summary h2 { color: var(--studio-link); }
.personal-intro { display: grid; grid-template-columns: 106px minmax(0, 1fr); align-items: start; gap: 20px; margin-bottom: 22px; }
.personal-intro .photo-row { flex-direction: column; align-items: flex-start; gap: 4px; margin: 0; }
.personal-intro .photo-holder { width: 106px; height: 120px; }
.personal-intro .photo-info { width: 100%; }
.personal-intro .photo-info p { font-size: 10px; line-height: 1.65; }
.personal-intro .check-label { margin: -7px 0; min-height: 44px; font-size: 11px; }
.custom-fields:not(:empty) { padding-top: 22px; }
.editor-bottom { display: flex; flex-direction: column; align-items: flex-end; gap: 20px; padding-top: 26px; }
.editor-bottom .data-note { align-self: stretch; margin: 0; }
.studio-boot { display: flex; align-items: center; justify-content: center; gap: 10px; height: 100vh; height: 100dvh; color: var(--studio-muted); font-size: 14px; }
.studio-boot img { filter: brightness(0); }
.editor-content > .button, #cv-form > .button { float: right; margin-top: 30px; }
.optional-field-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.optional-field-chips button { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 9px 12px; border: 1px solid var(--studio-border); border-radius: 999px; background: #fff; font-size: 12px; line-height: 1.5; text-align: left; }
.optional-field-chips button:hover { border-color: var(--studio-blue); background: var(--studio-selection); color: var(--studio-link); }
.optional-field-chips svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--studio-muted); }
.studio-preview-pane { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: #f0f0f3; }
.section-hit-layer { position: absolute; inset: 0; pointer-events: none; }
.section-zone { position: absolute; pointer-events: none; }
.section-zone:hover, .section-zone:focus-within, .section-zone[data-selected='true'] { z-index: 2; }
.section-hit, .section-edit-hit { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: auto; padding: 0; border: 1px solid transparent; border-radius: 3px; background: transparent; cursor: grab; color: var(--studio-blue); touch-action: none; user-select: none; -webkit-user-select: none; }
.section-edit-hit { cursor: pointer; touch-action: manipulation; }
.section-grip { position: absolute; right: 3px; top: 3px; display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--studio-divider); border-radius: 5px; background: #fff; color: var(--studio-muted); font-size: 18px; opacity: 0; }
.section-hit:hover, .section-hit:focus-visible, .section-edit-hit:hover, .section-edit-hit:focus-visible, .section-hit[aria-pressed='true'], .section-edit-hit[aria-pressed='true'] { z-index: 1; border-color: var(--studio-blue); background: rgb(0 113 227 / 3%); outline: none; }
.section-hit:hover .section-grip, .section-hit:focus-visible .section-grip { opacity: 1; }
.section-hit.section-drag-source { border: 1px dashed var(--studio-blue); background: rgb(0 113 227 / 6%); }
.dragging-cv-section, .dragging-cv-section * { cursor: grabbing !important; user-select: none !important; }
.dragging-cv-section .section-hit:not(.section-drag-source) { border-color: transparent; background: transparent; }
.section-drop-indicator { position: absolute; z-index: 2; pointer-events: none; border: 2px solid var(--studio-blue); border-radius: 4px; background: rgb(0 113 227 / 9%); }
.section-drop-indicator.is-insertion { min-height: 3px; border: 0; background: var(--studio-blue); }
.section-drop-indicator span { position: absolute; top: -24px; left: 0; padding: 4px 8px; border-radius: 5px; background: var(--studio-blue); color: #fff; font: 400 11px var(--font-ui); line-height: 1.4; white-space: nowrap; }

.preview-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 30px 32px 132px; scrollbar-width: thin; scrollbar-color: #bcbcc4 transparent; }
.preview-pages { width: 100%; max-width: 760px; margin: 0 auto; }
.paper-wrap { position: relative; margin-bottom: 22px; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 4%), 0 8px 24px rgb(0 0 0 / 6%); }
.paper-wrap:last-child { margin-bottom: 0; }
.preview-skeleton { display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 595.28 / 841.89; padding: 24px; background: #fff; color: var(--studio-muted); font-size: 12px; text-align: center; }
.preview-skeleton > svg { width: 44px; height: 44px; color: #c1c1c7; }
.preview-load-error { max-width: 330px; padding: 12px; line-height: 1.7; }
.preview-load-error p { margin: 0 0 12px; font-size: 12px; }
.preview-status { position: absolute; left: 30px; right: 30px; bottom: 103px; z-index: 1; color: var(--studio-muted); font-size: 10px; text-align: center; pointer-events: none; }
.preview-status > span { display: inline; padding: 4px 6px; background: rgb(240 240 243 / 94%); }
.design-toolbar { position: absolute; left: 20px; right: 20px; bottom: 20px; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 2px; min-height: 66px; padding: 7px; border: 1px solid rgb(210 210 215 / 80%); border-radius: 17px; background: rgb(255 255 255 / 94%); box-shadow: 0 2px 8px rgb(0 0 0 / 4%), 0 10px 26px rgb(0 0 0 / 7%); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.design-toolbar > button { display: flex; align-items: center; justify-content: center; gap: 7px; flex: 1; min-width: 0; min-height: 48px; padding: 9px 8px; border: 0; border-radius: 10px; background: transparent; color: var(--studio-ink); font-size: 11px; line-height: 1.4; white-space: nowrap; }
.design-toolbar > button:hover { background: var(--studio-bg); color: var(--studio-link); }
.design-toolbar > button svg { width: 18px; height: 18px; flex-shrink: 0; }
.design-toolbar > button svg:last-child:not(:first-child) { width: 12px; height: 12px; color: var(--studio-muted); }
.design-toolbar > button:last-child { flex: 0 0 44px; padding: 10px; }
.studio-dialog.template-dialog { width: min(1080px, calc(100% - 48px)); max-height: calc(100dvh - 48px); background: var(--studio-bg); }
.template-dialog .studio-dialog-body { padding: 30px; }
.wizard-heading { max-width: 800px; margin: 6px auto 32px; text-align: center; }
.wizard-heading .step-eyebrow { margin-bottom: 11px; color: var(--studio-muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; }
.wizard-heading h1 { font-size: 34px; line-height: 1.15; letter-spacing: -1.2px; }
.wizard-heading > p:last-child { margin: 14px auto 0; color: var(--studio-muted); font-size: 13px; line-height: 1.7; }

.form-panel h1 { margin: 0; font-size: 30px; line-height: 1.16; letter-spacing: -1.1px; text-wrap: balance; }
.form-step-label { margin-bottom: 11px; color: var(--studio-muted); font-size: 11px; }
.form-intro { margin: 13px 0 29px; color: var(--studio-muted); font-size: 12px; line-height: 1.8; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 21px 16px; }
.form-grid > .full { grid-column: 1 / -1; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 400; line-height: 1.5; }
.field em { color: var(--studio-muted); font-style: normal; font-weight: 400; }
.field input,
.field textarea,
.field select {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 12px 13px;
  border: 1px solid var(--studio-border);
  border-radius: 12px;
  outline-offset: 2px;
  background: var(--studio-surface);
  color: var(--studio-ink);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.field input:hover, .field textarea:hover, .field select:hover { border-color: #a1a1a6; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--studio-blue); outline: none; background: #fff; box-shadow: 0 0 0 3px rgb(0 113 227 / 14%); }
.field input::placeholder, .field textarea::placeholder { color: var(--studio-muted); opacity: 1; }
.field input:disabled { border-color: var(--studio-divider); background: var(--studio-bg); color: var(--studio-muted); }
.field textarea { min-height: 110px; resize: vertical; }
.download-filename { margin: 20px 0; overflow-wrap: anywhere; font-size: 14px; }
.file-save-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.file-save-actions > a, .file-save-actions > button { min-height: 44px; }
.field small { color: var(--studio-muted); font-size: 11px; line-height: 1.65; }
.native-select { appearance: auto; }
.required-star { color: var(--studio-muted); }

.photo-row { display: flex; align-items: center; gap: 18px; margin-bottom: 24px; }
.photo-holder { display: flex; align-items: center; justify-content: center; width: 84px; height: 100px; flex-shrink: 0; overflow: hidden; border-radius: 13px; background: var(--studio-bg); }
.photo-holder img { width: 100%; height: 100%; object-fit: cover; }
.photo-holder svg { width: 28px; height: 28px; color: #86868b; }
.photo-info { flex: 1; min-width: 0; }
.photo-info p { margin-top: 7px; color: var(--studio-muted); font-size: 11px; line-height: 1.65; }
.photo-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 17px; }
.upload-button { display: inline-flex; align-items: center; min-height: 44px; border-radius: 5px; color: var(--studio-link); font-size: 12px; font-weight: 600; cursor: pointer; }
.upload-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.photo-actions:focus-within .upload-button, .photo-info:focus-within .upload-button { outline: 3px solid var(--studio-blue); outline-offset: 4px; }
.photo-remove { min-height: 44px; padding: 3px 0; border: 0; background: transparent; color: #b42318; font-size: 11px; }

.optional-details { padding: 0; border-top: 1px solid var(--studio-divider); border-bottom: 1px solid var(--studio-divider); }
.optional-details summary { gap: 16px; padding: 19px 0; color: var(--studio-ink); font-size: 12px; font-weight: 600; line-height: 1.6; letter-spacing: 0; }
.optional-details summary::after { content: ''; width: 7px; height: 7px; flex-shrink: 0; margin: 0 3px 3px 0; border-right: 1.5px solid var(--studio-muted); border-bottom: 1.5px solid var(--studio-muted); transform: rotate(45deg); transition: transform .18s ease; }
.optional-details[open] summary::after { transform: rotate(225deg); }
.optional-details > .form-grid { padding: 4px 0 23px; }
.custom-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 11px; margin-bottom: 17px; }
.custom-row .icon-button { margin-bottom: 5px; }
.section-form-title { margin: 32px 0 18px; font-size: 19px; font-weight: 600; letter-spacing: -.5px; line-height: 1.3; }
.entry-card, .language-entry { margin-bottom: 18px; padding: 20px; border: 1px solid var(--studio-divider); border-radius: 14px; background: var(--studio-surface); }
.entry-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.entry-top h2 { font-size: 14px; line-height: 1.4; letter-spacing: -.2px; }
.entry-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.entry-card > .field + .field { margin-top: 18px; }
.add-button { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 46px; padding: 12px 16px; border: 1px solid transparent; border-radius: 12px; background: var(--studio-selection); color: var(--studio-link); font-size: 12px; font-weight: 600; transition: background .18s ease; }
.add-button:hover { background: #dcecff; }
.add-button svg { width: 16px; height: 16px; flex-shrink: 0; }
.check-label { display: flex; align-items: center; gap: 9px; margin: 17px 0 22px; font-size: 12px; }
.check-label input { width: 16px; height: 16px; flex-shrink: 0; margin: 0; accent-color: var(--studio-blue); }
.check-label.full { margin: 0 0 3px; }
.empty-state { margin-bottom: 18px; padding: 32px 22px; border: 1px solid var(--studio-divider); border-radius: 14px; background: var(--studio-bg); text-align: center; }
.empty-state svg { width: 31px; height: 31px; margin-bottom: 12px; color: var(--studio-muted); }
.empty-state p { color: var(--studio-muted); font-size: 12px; line-height: 1.8; }
.language-entry .form-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 12px; }
.language-entry .icon-button { margin-bottom: 5px; }
.section-picker { margin-top: 27px; }
.section-picker h2 { margin: 0 0 17px; font-size: 14px; line-height: 1.4; letter-spacing: -.2px; }
.section-chips { display: flex; flex-wrap: wrap; gap: 9px; }
.section-chips button { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 9px 12px; border: 1px solid var(--studio-border); border-radius: 999px; background: var(--studio-surface); color: var(--studio-ink); font-size: 11px; text-align: left; }
.section-chips button:hover { border-color: var(--studio-blue); background: var(--studio-selection); color: var(--studio-link); }
.section-chips svg { width: 13px; height: 13px; flex-shrink: 0; color: var(--studio-link); }
.data-note { margin-top: 27px; color: var(--studio-muted); font-size: 11px; line-height: 1.8; }


.design-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 16px 20px; }
.design-group { min-width: 0; }
.design-group h3 { margin: 0 0 11px; color: var(--studio-ink); font-size: 12px; line-height: 1.4; letter-spacing: -.1px; }
.design-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.design-fields .field { display: flex; gap: 8px; }
.design-controls .field > span { color: var(--studio-muted); font-size: 11px; font-weight: 400; line-height: 1.4; }
.design-controls select { min-height: 46px; padding: 8px; border-radius: 9px; font-size: 11px; }
.font-choice { display: flex; flex-direction: column; gap: 6px; }
.font-choice > span, .font-choice small { color: var(--studio-muted); font-size: 11px; }
.font-choice strong { font-size: 14px; }
.design-group.colour-group { display: flex; align-items: center; gap: 18px; grid-column: 1 / -1; padding-top: 15px; border-top: 1px solid var(--studio-border); }
.colour-group h3 { margin: 0; color: var(--studio-muted); font-size: 11px; font-weight: 600; }
.swatches { display: grid; grid-template-columns: repeat(auto-fit, 44px); gap: 2px; width: 100%; }
.swatch {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  padding: 0;
  border: 8px solid #fff;
  border-radius: 50%;
  outline: 1px solid transparent;
  outline-offset: -3px;
}
.swatch svg { width: 16px; height: 16px; stroke: #fff; stroke-width: 2.2; opacity: 0; }
.swatch[aria-pressed='true'] svg { opacity: 1; }
.swatch[aria-pressed='true'] { outline: 2px solid var(--studio-blue); outline-offset: -3px; }
.swatch:focus-visible { outline-offset: 1px; }
.preview-hint { margin: 15px 0 0; color: var(--studio-muted); font-size: 11px; line-height: 1.65; text-align: center; }

/* Readable document cards in a single, focused template gallery. */
.gallery-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; margin: 0 0 24px; }
.gallery-colours { display: flex; align-items: flex-start; gap: 12px; flex: 1 1 620px; min-width: 0; max-width: 680px; }
.gallery-colours > span { padding-top: 13px; color: var(--studio-muted); font-size: 12px; }
.gallery-content-toggle { display: flex; align-self: center; gap: 2px; flex-shrink: 0; margin-left: auto; padding: 3px; border: 1px solid var(--studio-divider); border-radius: 12px; background: #eaeaee; }
.gallery-content-toggle button { min-height: 44px; padding: 8px 15px; border: 0; border-radius: 9px; background: transparent; color: var(--studio-muted); font-size: 12px; white-space: nowrap; }
.gallery-content-toggle button[aria-pressed='true'] { background: var(--studio-surface); color: var(--studio-ink); font-weight: 600; box-shadow: 0 1px 5px rgb(0 0 0 / 8%); }
.template-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
.template-option { display: block; min-width: 0; padding: 10px 10px 14px; border: 2px solid transparent; border-radius: 16px; background: var(--studio-surface); text-align: left; box-shadow: var(--studio-shadow); transition: border-color .16s ease, box-shadow .16s ease; }
.template-option:hover { border-color: var(--studio-border); box-shadow: 0 8px 24px rgb(0 0 0 / 8%); }
.template-option[aria-pressed='true'] { border-color: var(--studio-blue); box-shadow: 0 0 0 3px rgb(0 113 227 / 9%); }
.template-thumb { position: relative; overflow: hidden; aspect-ratio: 595.28 / 841.89; border: 1px solid var(--studio-divider); border-radius: 5px; background: #fff; }
.template-thumb svg { display: block; width: 100%; height: auto; }
.cv-page { display: block; width: 100%; height: auto; background: #fff; stroke: none; fill: none; stroke-width: 0; }
.template-info { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 14px 3px 0; }
.template-name { min-width: 0; font-size: 14px; font-weight: 600; letter-spacing: -.2px; }
.template-check { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex-shrink: 0; border: 1px solid var(--studio-border); border-radius: 50%; color: transparent; font-size: 11px; }
.template-option[aria-pressed='true'] .template-check { border-color: var(--studio-blue); background: var(--studio-blue); color: #fff; }
.template-note { margin: 4px 3px 0; color: var(--studio-muted); font-size: 11px; line-height: 1.6; }
.gallery-note { margin: 24px auto 0; color: var(--studio-muted); font-size: 12px; line-height: 1.7; text-align: center; }


.form-error { margin-bottom: 22px; padding: 13px 15px; border: 1px solid #f7d5d1; border-radius: 12px; background: #fff2f1; color: #b42318; font-size: 12px; line-height: 1.7; }
.toast { position: fixed; bottom: calc(28px + env(safe-area-inset-bottom, 0px)); left: 50%; z-index: 60; max-width: calc(100% - 32px); padding: 14px 22px; border-radius: 16px; background: var(--studio-ink); color: #fff; font-size: 12px; line-height: 1.6; text-align: center; box-shadow: 0 8px 32px rgb(0 0 0 / 15%); transform: translateX(-50%); }
.toast[hidden] { display: none; }

.preview-dialog, .studio-dialog {
  max-height: 90vh;
  max-height: 90dvh;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid rgb(0 0 0 / 7%);
  border-radius: 24px;
  color: var(--studio-ink);
  box-shadow: 0 24px 100px rgb(0 0 0 / 22%);
}
.preview-dialog { width: min(780px, calc(100% - 32px)); background: var(--studio-bg); }
.studio-dialog { width: min(640px, calc(100% - 32px)); background: var(--studio-surface); }
.preview-dialog::backdrop, .studio-dialog::backdrop { background: rgb(0 0 0 / 30%); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.dialog-toolbar { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 24px; border-bottom: 1px solid var(--studio-divider); background: rgb(255 255 255 / 92%); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.dialog-toolbar strong { font-size: 14px; line-height: 1.6; letter-spacing: -.2px; }
.dialog-toolbar .icon-button { background: var(--studio-bg); }
.dialog-toolbar .icon-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.dialog-pages { max-width: 660px; margin: 0 auto; padding: 28px; }
.studio-dialog-body { padding: 28px; }
/* Design controls stay beside the toolbar as small, nonmodal option panels. */
#studio-dialog.design-options { position: fixed; inset: auto; z-index: 40; display: flex; flex-direction: column; width: 300px; max-width: calc(100vw - 24px); max-height: min(360px, calc(100dvh - 24px)); margin: 0; padding: 0; overflow: hidden; border: 1px solid var(--studio-border); border-radius: 16px; background: var(--studio-surface); box-shadow: 0 8px 32px rgb(0 0 0 / 14%); }
#studio-dialog.design-options:not([open]) { display: none; }
#studio-dialog.design-options .dialog-toolbar strong { margin-right: auto; }
#studio-dialog.design-options .dialog-toolbar { flex-shrink: 0; min-height: 44px; padding: 6px 10px 6px 16px; gap: 12px; }
#studio-dialog.design-options .dialog-toolbar strong { font-size: 13px; }
#studio-dialog.design-options .dialog-toolbar .icon-button { width: 44px; min-height: 44px; height: 44px; padding: 12px; }
#studio-dialog.design-options .studio-dialog-body { min-height: 0; padding: 12px; overflow: auto; overscroll-behavior: contain; }
#studio-dialog.design-options .studio-dialog-body > .field { margin: 0 0 12px; }
#studio-dialog.design-options .studio-dialog-body > .field:last-child { margin-bottom: 0; }
#studio-dialog.design-options .form-intro, #studio-dialog.design-options .field small { display: none; }
#studio-dialog.design-options .swatches { margin: 0; }
.design-toolbar > button[aria-expanded='true'] { background: var(--studio-selection); color: var(--studio-link); }
.dialog-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.studio-dialog-body > .form-intro:first-child { margin-top: 0; }
.studio-dialog-body > .field { margin: 23px 0; }
.editor-tools { display: flex; justify-content: flex-end; margin: -6px 0 10px; }
.editor-tools .quiet-button { gap: 7px; min-height: 44px; }
.editor-tools svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.studio-dialog.paste-dialog { width: min(760px, calc(100% - 32px)); }
.paste-workflow { min-width: 0; }
.paste-workflow h2 { margin: 0 0 18px; font-size: 17px; font-weight: 600; line-height: 1.5; letter-spacing: -.3px; }
.paste-workflow h3 { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.5; }
.paste-workflow > .form-intro:first-child { margin-top: 0; }
.paste-workflow [data-paste-review-title]:focus { outline: none; }
.paste-workflow .field { min-width: 0; margin: 0; }
.paste-workflow > .field { margin-top: 23px; }
.paste-workflow [aria-invalid='true'] { border-color: #b42318; }
#paste-text-input { min-height: 240px; }
.paste-review-group { padding: 25px 0; border-top: 1px solid var(--studio-divider); }
.paste-review-group > .field + .field { margin-top: 18px; }
.paste-entry { margin-bottom: 14px; padding: 18px; border: 1px solid var(--studio-divider); border-radius: 16px; background: var(--studio-bg); }
.paste-entry-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.paste-entry-heading .quiet-button { flex-shrink: 0; }
.paste-current { align-self: center; margin-top: 15px; font-size: 12px; line-height: 1.6; }
.paste-language-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 14px; margin-bottom: 16px; }
.paste-review-notice { margin: 24px 0; padding: 18px 20px; border: 1px solid var(--studio-divider); border-radius: 16px; background: var(--studio-bg); font-size: 12px; line-height: 1.7; }
.paste-review-notice ul { margin: 10px 0 14px; padding-left: 19px; }
.paste-review-notice li + li { margin-top: 6px; }
.paste-workflow details summary { min-height: 44px; padding: 11px 0; color: var(--studio-link); cursor: pointer; font-size: 12px; font-weight: 600; line-height: 1.7; }
.paste-workflow pre { max-height: 260px; margin: 10px 0 0; padding: 16px; overflow: auto; border: 1px solid var(--studio-divider); border-radius: 12px; background: var(--studio-surface); font: 400 12px/1.8 var(--font-ui); white-space: pre-wrap; overflow-wrap: anywhere; }
.paste-source { padding: 10px 0; border-top: 1px solid var(--studio-divider); }
.paste-unassigned [data-paste-custom-title] { margin-top: 18px; }
.paste-workflow .form-error { margin-top: 22px; }
.library-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.library-item { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 19px 0; border-top: 1px solid var(--studio-divider); }
.library-item > div { min-width: 0; }
.library-item strong { font-size: 13px; overflow-wrap: anywhere; }
.library-item small { display: block; margin-top: 6px; color: var(--studio-muted); font-size: 11px; overflow-wrap: anywhere; }
.library-item > .quiet-button { flex-shrink: 0; }
.resume-notice { display: flex; align-items: center; justify-content: space-between; gap: 20px; max-width: 920px; margin: 0 auto 28px; padding: 17px 21px; border: 1px solid #d6e7fb; border-radius: 16px; background: var(--studio-selection); font-size: 12px; line-height: 1.7; }
.resume-notice button { flex-shrink: 0; min-height: 44px; padding: 5px 0; border: 0; background: transparent; color: var(--studio-link); font-size: 11px; text-decoration: underline; text-underline-offset: 3px; }
.noscript-note { padding: 30px; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; white-space: nowrap; }



@media (min-width: 1700px) {
  .library-main { padding-top: 56px; }
  .library-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .editor-content { padding-top: 32px; }
  .preview-scroll { padding: 28px 40px 135px; }
  .design-toolbar { left: 28px; right: 28px; bottom: 24px; }
  .design-toolbar > button { font-size: 12px; }
}
@media (max-width: 1600px) {
  .design-toolbar > button svg:last-child:not(:first-child) { display: none; }
}
@media (max-width: 1250px) {
  .library-shell { grid-template-columns: 210px minmax(0, 1fr); }
  .library-sidebar { padding-right: 16px; padding-left: 16px; }
  .library-main { padding: 38px 32px 48px; }
  .library-grid { grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 27px 22px; }
  .workspace-topbar { grid-template-columns: auto minmax(150px, 1fr) auto; gap: 12px; padding: 0 18px; }
  .workspace-actions { gap: 3px; }
  .workspace-actions > .button { padding-right: 16px; padding-left: 16px; }
  .editor-content { padding-right: 30px; padding-left: 30px; }
  .preview-scroll { padding: 24px 24px 130px; }
  .design-toolbar { left: 14px; right: 14px; bottom: 16px; padding: 6px; }
  .design-toolbar > button { flex-direction: column; gap: 5px; padding: 6px; font-size: 10px; }
  .gallery-toolbar { flex-wrap: wrap; gap: 18px; }
  .template-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
}
/* Small screens switch between editing and the same live document. */
@media (max-width: 900px) {
  .library-shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .library-sidebar { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; padding: 14px 22px; border-right: 0; border-bottom: 1px solid var(--studio-divider); background: #fff; }
  .library-sidebar .brand { padding: 0; }
  .library-new-button { width: auto; min-width: 115px; padding-right: 17px; padding-left: 17px; }
  .library-nav { display: none; }
  .library-sidebar-footer { grid-column: 1 / -1; gap: 10px; margin: 0; padding-top: 12px; }
  .library-sidebar-footer p { max-width: 65ch; font-size: 11px; line-height: 1.6; }
  .library-sidebar-footer .studio-language-picker { max-width: 180px; }
  .library-sidebar-footer .studio-language-options { top: calc(100% + 8px); bottom: auto; }
  .library-sidebar .studio-name { display: none; }
  .library-main { padding: 30px 24px 40px; }
  .library-heading { gap: 15px; margin-bottom: 25px; }
  .library-heading h1 { font-size: 28px; }
  .library-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 27px 21px; }
  .workspace-topbar { height: 68px; min-height: 68px; gap: 12px; padding: 0 16px; }
  .workspace-back { padding: 10px; }
  .workspace-title input { font-size: 13px; }
  .workspace-actions { gap: 4px; }
  .workspace-actions > .icon-button { display: none; }
  .workspace-actions > .button { min-width: 44px; padding: 10px 13px; font-size: 12px; }
  .language-menu > summary { gap: 0; min-width: 44px; padding: 10px 8px; }
  .language-menu > summary svg { display: none; }
  .language-menu .studio-language-label { display: none; }
  .language-menu .studio-language-code { display: block; }
  .workspace-mobile-tabs { display: flex; justify-content: center; gap: 3px; flex-shrink: 0; min-height: 58px; padding: 7px 20px; border-bottom: 1px solid var(--studio-divider); background: #fff; }
  .workspace-mobile-tabs button { display: flex; align-items: center; justify-content: center; gap: 8px; flex: 1; max-width: 220px; min-height: 44px; padding: 10px 15px; border: 0; border-radius: 10px; background: transparent; color: var(--studio-muted); font-size: 12px; }
  .workspace-mobile-tabs button[aria-selected='true'], .workspace-mobile-tabs button[aria-pressed='true'] { background: var(--studio-selection); color: var(--studio-link); font-weight: 600; }
  .workspace-mobile-tabs svg { width: 18px; height: 18px; }
  .studio-split { display: flex; }
  .studio-editor, .studio-preview-pane { width: 100%; height: 100%; border: 0; }
  .studio-workspace[data-mobile-panel='edit'] .studio-preview-pane { display: none; }
  .studio-workspace[data-mobile-panel='preview'] .studio-editor { display: none; }
  .editor-content { max-width: 650px; padding: 24px 30px 40px; }
  .editor-section > summary { min-height: 78px; }
  .field input, .field textarea, .field select, .gallery-type-controls select, .design-controls select { font-size: 16px; }
  .entry-card, .language-entry { padding: 20px; }
  .entry-top { align-items: center; }
  .entry-top h2 { font-size: 13px; }
  .preview-scroll { padding: 22px 24px 130px; }
  .preview-pages { max-width: 650px; }
  .design-toolbar { left: max(16px, calc((100% - 680px) / 2)); right: max(16px, calc((100% - 680px) / 2)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); }
  .design-toolbar > button { gap: 6px; font-size: 10px; }
  .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
  .studio-dialog-body, .template-dialog .studio-dialog-body { padding: 24px; }
  .gallery-toolbar { gap: 16px; }
  .gallery-content-toggle { margin-left: 0; }
  .preview-status { bottom: 102px; }
}
@media (max-width: 650px) {
  .history-buttons { display: none; }
  .document-menu .menu-history-mobile { display: flex; align-items: center; gap: 8px; padding: 2px 5px 7px; border-bottom: 1px solid var(--studio-divider); }
}
@media (max-width: 520px) {
  .library-sidebar { padding: 12px 18px; }
  .library-sidebar .brand { font-size: 21px; }
  .library-new-button { min-width: 100px; font-size: 12px; }
  .library-main { padding: 27px 18px 35px; }
  .library-heading { flex-wrap: wrap; }
  .library-heading-actions { width: 100%; justify-content: space-between; }
  .library-heading h1 { font-size: 26px; }
  .library-heading p { max-width: 205px; margin-top: 6px; font-size: 11px; }
  .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
  .library-create-card { gap: 12px; padding: 14px; border-radius: 10px; font-size: 12px; }
  .cv-card-preview { border-radius: 10px; }
  .cv-card-info { padding-top: 10px; }
  .cv-card-title { font-size: 12px; }
  .cv-card-meta { font-size: 10px; }
  .cv-card-actions { gap: 0; margin-left: -6px; }
  .library-grid[data-layout='list'] .cv-library-card { grid-template-columns: 52px minmax(0, 1fr); gap: 15px; padding: 14px; }
  .library-grid[data-layout='list'] .cv-card-actions { grid-column: 2; margin-top: -9px; }
  .library-grid[data-layout='list'] .library-create-card { min-height: 66px; padding: 14px 18px; }
  .workspace-topbar { gap: 7px; grid-template-columns: 44px minmax(0, 1fr) auto; padding: 0 12px; }
  .workspace-back { width: 44px; padding: 11px; font-size: 0; gap: 0; }
  .workspace-back span { display: none; }
  .workspace-title input { padding-right: 4px; padding-left: 4px; font-size: 12px; }
  #save-status { font-size: 9px; }
  .workspace-actions { gap: 3px; }
  .workspace-actions > .button { width: 44px; padding: 11px; font-size: 0; gap: 0; }
  .workspace-actions > .button span { display: none; }
  .workspace-actions > .button svg { width: 19px; height: 19px; }
  .language-menu > summary { padding-right: 7px; padding-left: 7px; }
  .workspace-mobile-tabs { padding: 6px 16px; min-height: 57px; }
  .editor-content { padding: 20px 20px 34px; }
  .editor-section > summary { min-height: 74px; padding-top: 18px; padding-bottom: 18px; }
  .editor-section > summary h2 { font-size: 16px; }
  .editor-section-body { padding-bottom: 24px; }
  .form-grid { gap: 18px 12px; }
  .field > span { font-size: 11px; }
  .field input, .field textarea, .field select { padding: 11px; }
  .photo-row { gap: 15px; margin-bottom: 22px; }
  .photo-holder { width: 77px; height: 92px; }
  .photo-actions { gap: 3px 13px; }
  .personal-intro { grid-template-columns: 80px minmax(0, 1fr); gap: 14px; }
  .personal-intro .photo-holder { width: 80px; height: 102px; }
  .personal-name-fields { grid-template-columns: minmax(0, 1fr); }
  .personal-intro .photo-info p { font-size: 10px; }
  .optional-field-chips, .section-chips { gap: 7px; }
  .optional-field-chips button, .section-chips button { padding: 9px 10px; font-size: 11px; }
  .entry-card, .language-entry { padding: 16px 14px; }
  .entry-card .form-grid, .optional-details .form-grid { grid-template-columns: minmax(0, 1fr); }
  .entry-top { gap: 6px; }
  .entry-top h2 { font-size: 12px; }
  .language-entry .form-grid { grid-template-columns: minmax(0, 1fr) auto; }
  .language-entry .field { grid-column: 1; }
  .language-entry .icon-button { grid-column: 2; grid-row: 1 / 3; }
  .custom-row { grid-template-columns: minmax(0, 1fr) auto; gap: 15px 8px; }
  .custom-row .field { grid-column: 1; }
  .custom-row .icon-button { grid-column: 2; grid-row: 1 / 3; align-self: center; }
  .preview-scroll { padding: 18px 16px 124px; }
  .design-toolbar { left: 10px; right: 10px; bottom: max(12px, env(safe-area-inset-bottom, 0px)); padding: 5px; border-radius: 15px; }
  .design-toolbar > button { min-height: 48px; padding: 6px 3px; font-size: 9px; }
  .design-toolbar > button svg { width: 17px; height: 17px; }
  .preview-status { bottom: 98px; }
  .preview-dialog, .studio-dialog, .studio-dialog.template-dialog { width: calc(100% - 20px); max-height: calc(100dvh - 20px); border-radius: 18px; }
  .studio-dialog.template-dialog { max-width: calc(100vw - 20px); }
  .dialog-toolbar { gap: 14px; padding: 10px 16px; }
  .dialog-toolbar strong { font-size: 14px; }
  .dialog-pages { padding: 16px; }
  .studio-dialog-body, .template-dialog .studio-dialog-body { padding: 21px 17px; }
  .studio-dialog.paste-dialog { width: calc(100% - 20px); }
  .paste-workflow .form-grid { grid-template-columns: minmax(0, 1fr); }
  .paste-workflow .field input, .paste-workflow .field textarea, .paste-workflow .field select { font-size: 16px; }
  .paste-entry { padding: 15px 12px; }
  .paste-current { margin-top: 0; }
  .paste-language-row { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
  .paste-language-row .field { grid-column: 1; }
  .paste-language-row > button { grid-column: 2; grid-row: 1 / 3; align-self: center; }
  .paste-review-notice { padding: 15px; }
  .paste-workflow .dialog-actions > .button { flex: 1; }
  #paste-text-input { min-height: 200px; }
  .design-controls { gap: 22px 16px; }
  .design-group.colour-group { gap: 14px; }
  .gallery-toolbar { gap: 12px; margin-bottom: 20px; }
  .gallery-colours { width: 100%; flex-basis: 100%; flex-wrap: wrap; gap: 4px 10px; }
  .gallery-colours > span { width: 100%; padding-top: 0; }
  .gallery-colours .swatches { justify-content: start; gap: 0; }
  .gallery-content-toggle { width: 100%; }
  .gallery-content-toggle button { flex: 1; padding-right: 8px; padding-left: 8px; }
  .template-grid { gap: 13px; }
  .template-option { padding: 8px 8px 14px; border-radius: 14px; }
  .template-info { gap: 4px; margin: 12px 1px 0; }
  .template-name { gap: 4px; font-size: 12px; }
  .template-check { width: 18px; height: 18px; font-size: 10px; }
  .template-note { margin: 5px 1px 0; font-size: 10px; line-height: 1.5; }
  .sample-label { left: 4px; bottom: 4px; padding: 3px 6px; font-size: 9px; }
  .gallery-note { font-size: 11px; }
  .wizard-heading h1 { font-size: 28px; }
  .wizard-heading > p:last-child { font-size: 12px; }
  .resume-notice { align-items: flex-start; gap: 14px; padding: 15px; font-size: 11px; }
  .toast { bottom: calc(22px + env(safe-area-inset-bottom, 0px)); width: max-content; font-size: 11px; }
}
@media (max-width: 380px) {
  .library-main { padding-right: 14px; padding-left: 14px; }
  .library-grid { gap: 21px 11px; }
  .library-heading h1 { font-size: 24px; }
  .workspace-topbar { padding-right: 9px; padding-left: 9px; gap: 4px; }
  .workspace-actions { gap: 1px; }
  .workspace-title { min-width: 58px; }
  .editor-content { padding-right: 16px; padding-left: 16px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .design-controls { grid-template-columns: minmax(0, 1fr); }
  .design-toolbar > button { font-size: 8px; }
  .template-grid { gap: 10px; }
  .template-name { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .builder-body *, .builder-body *::before, .builder-body *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
