:root {
 --ink: #182b27;
 --muted: #4b5b56;
 --brand: #164f42;
 --brand-dark: #10382e;
 --edge: #cbd6cf;
 --canvas: #f0f3ed;
 --sheet: #fff;
 --focus: #98702a;
 color-scheme: light;
 font-family: "Segoe UI", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-size: 15px; line-height: 1.55; }
a { color: var(--brand); text-underline-offset: .18em; }
button, input, select, textarea { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.site-header {
 display: flex;
 gap: 14px;
 align-items: center;
 justify-content: space-between;
 padding: 14px max(22px, calc((100vw - 1260px) / 2));
 background: var(--brand-dark);
}
.site-header a { color: #fff; }
.wordmark { text-decoration: none; font-family: Georgia, serif; font-size: 1.25rem; font-weight: bold; }
.wordmark::before {
 content: "";
 display: inline-block;
 inline-size: 13px;
 block-size: 13px;
 margin-inline-end: 9px;
 background: #e9b462;
 border-radius: 30% 70% 45% 55%;
}
.return { font-size: .9rem; white-space: nowrap; }
main { width: min(100%, 1304px); margin: auto; padding: 30px 23px max(32px, env(safe-area-inset-bottom)); }
.intro {
 display: flex;
 align-items: end;
 justify-content: space-between;
 gap: 20px;
 padding: 26px 0 28px;
 border-bottom: 1px solid #c2cec3;
 margin-bottom: 24px;
}
h1, h2, h3, p { margin: 0; }
h1 { font-family: Georgia, serif; font-weight: 500; font-size: clamp(2.15rem, 5.5vw, 4.2rem); letter-spacing: -.045em; line-height: 1.1; }
.intro p { margin-top: 10px; max-width: 56ch; color: var(--muted); }
.intro-actions { display: flex; flex-direction: column; align-items: center; gap: 7px; flex-shrink: 0; }
button.primary, button.secondary, .mobile-switch button {
 min-height: 44px;
 padding: 9px 15px;
 border: 1px solid var(--brand);
 border-radius: 7px;
 font-weight: 650;
 white-space: normal;
}
button.primary { color: #fff; background: var(--brand); }
button.primary:hover { background: var(--brand-dark); }
button.secondary, .mobile-switch button { color: var(--brand-dark); background: #fff; }
button.secondary:hover:not(:disabled), .mobile-switch button:hover { background: #e9f1ea; }
.workspace { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: clamp(16px, 3vw, 42px); align-items: start; }
.editor, #sections { display: grid; gap: 14px; min-width: 0; }
.panel { border: 1px solid var(--edge); padding: 18px; border-radius: 10px; background: var(--sheet); }
.panel h2, .preview-heading h2 { font-size: 1.1rem; line-height: 1.3; }
.panel-heading, .section-heading, .preview-heading, .dialog-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; margin-top: 15px; }
.field { display: grid; min-width: 0; gap: 3px; align-content: start; }
.field-wide { grid-column: 1 / -1; }
label, .field-label { font-size: .88rem; font-weight: 600; }
input:not([type="checkbox"]), textarea, select {
 width: 100%;
 min-width: 0;
 min-height: 44px;
 padding: 8px 10px;
 border-radius: 6px;
 border: 1px solid #a8b6ad;
 background: #fff;
}
textarea { resize: vertical; }
.hint, #save-status { color: var(--muted); font-size: .83rem; font-weight: 400; }
.panel > .hint { margin-top: 12px; }
.section-picker { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.add-section { display: grid; grid-template-columns: minmax(125px, 1fr) auto; align-items: end; gap: 3px 8px; }
.add-section label { grid-column: 1 / -1; }
.section-controls, .entry-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.text-button {
 min-height: 38px;
 min-width: 38px;
 padding: 5px 7px;
 border: 0;
 background: transparent;
 color: var(--brand-dark);
 text-decoration: underline;
 text-underline-offset: .2em;
}
.text-button:hover:not(:disabled) { background: #eaf0eb; border-radius: 5px; }
.danger { color: #812f3a; }
.entry { margin: 11px 0; padding: 10px 12px 12px; border: 1px solid #d7e1d7; border-radius: 7px; }
.entry legend { font-size: .83rem; color: var(--muted); padding-inline: 5px; }
.entry .fields { margin-top: 4px; }
#cv-help { scroll-margin-top: 18px; }
#cv-help > * + * { margin-top: 10px; }
#cv-review-results ul { padding-inline-start: 22px; }
#cv-review-results li { margin: 6px 0; }
.storage { padding: 3px 4px; }
.storage p { color: var(--muted); font-size: .9rem; }
.preview-heading { margin: 3px 0 13px; }
.preview-heading h2 { margin-right: auto; }
.preview-heading select { width: auto; max-width: 100%; }
.preview-panel { min-width: 0; }
.cv-paper {
 --accent: #145049;
 min-height: 55vh;
 padding: clamp(20px, 4vw, 42px);
 color: #19292a;
 background: white;
 border: 1px solid #d5ded6;
 box-shadow: 0 8px 24px #243c2920;
 overflow-wrap: anywhere;
}
.cv-paper[data-template="professional"] { --accent: #233e62; }
.cv-paper[data-template="artisan"] { --accent: #885026; }
.cv-paper[data-template="technician"] { --accent: #155a61; }
.cv-paper[data-template="freelance"] { --accent: #6b426f; }
.cv-paper[data-template="essential"] { --accent: #324637; }
.cv-paper header { padding-bottom: 14px; border-bottom: 3px solid var(--accent); margin-bottom: 16px; }
.cv-paper[data-template="artisan"] header { border-bottom-width: 1px; border-inline-start: 4px solid var(--accent); padding-inline-start: 12px; }
.cv-paper[data-template="technician"] header { border-bottom-style: double; border-bottom-width: 5px; }
.cv-paper[data-template="freelance"] header { border-bottom-width: 1px; }
.cv-paper[data-template="essential"] header { border: 0; }
.cv-paper h2 { color: var(--accent); font-size: clamp(1.65rem, 4vw, 2.35rem); line-height: 1.12; }
.cv-paper[data-template="graduate"] h2, .cv-paper[data-template="freelance"] h2 { font-family: Georgia, serif; }
.cv-paper .headline { margin-top: 6px; font-size: 1.03rem; font-weight: 650; }
.cv-paper .meta { margin-top: 6px; color: #455b5b; font-size: .84rem; }
.cv-paper section { margin: 0 0 14px; }
.cv-paper h3 { font-size: .84rem; color: var(--accent); text-transform: uppercase; letter-spacing: .075em; margin-bottom: 4px; }
.cv-paper h3, .cv-paper h4 { break-after: avoid; }
.cv-paper h4 { margin: 0; font-size: .96rem; }
.cv-paper .cv-entry + .cv-entry { margin-top: 8px; }
.cv-paper p { white-space: pre-line; }
.cv-paper .empty-preview { color: var(--muted); }
.mobile-switch { display: none; }
dialog {
 width: min(calc(100% - 28px), 510px);
 max-height: calc(100dvh - 28px);
 overflow: auto;
 padding: 20px;
 border: 1px solid var(--edge);
 border-radius: 12px;
 color: var(--ink);
}
dialog::backdrop { background: #142e28a0; }
dialog > * + * { margin-top: 10px; }
.check { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.check input { width: 17px; height: 17px; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#export-status:empty { display: none; }
#print-document { display: none; }
@media screen and (max-width: 760px) {
 main { padding: 14px 13px max(24px, env(safe-area-inset-bottom)); }
 .site-header { padding: 11px 14px; }
 .intro { align-items: start; flex-direction: column; gap: 12px; padding: 12px 0 17px; margin-bottom: 13px; }
 .intro-actions { flex-direction: row; flex-wrap: wrap; }
 .mobile-switch { display: flex; margin-bottom: 13px; gap: 8px; }
 .mobile-switch button { flex: 1; }
 .mobile-switch button[aria-pressed="true"] { color: white; background: var(--brand); }
 .workspace { display: block; }
 body[data-mobile-view="editor"] .preview-panel, body[data-mobile-view="preview"] .editor { display: none; }
 input:not([type="checkbox"]), textarea, select { font-size: 16px; }
 .panel { padding: 13px; }
 .panel-heading { align-items: start; }
}
@media screen and (max-width: 390px) {
 .fields { grid-template-columns: minmax(0, 1fr); }
 .preview-heading h2 { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
@page { size: A4; margin: 15mm 17mm; }
@media print {
 html, body { background: #fff; color: #000; line-height: 1.35; }
 body > :not(#print-document) { display: none !important; }
 #print-document { display: block; min-height: 0; padding: 0; border: 0; box-shadow: none; font-size: 10.5pt; }
 #print-document h2 { font-size: 24pt; }
 #print-document .empty-preview { display: none; }
 #print-document .cv-entry { break-inside: avoid; }
 #print-document section { orphans: 3; widows: 3; }
}
