*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #F5F3FF; --panel: #FFFFFF; --panel2: #EDE9FE;
  --border: #DDD6FE; --text: #1E1B4B; --text-muted: #64748b;
  --brand: #2563eb; --brand-dark: #2563eb; --brand-light: #EEF2FF;
  --radius: 8px; --shadow: 0 2px 8px rgba(99,102,241,.1);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; min-height: 100vh; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* HEADER */
.site-header { background: var(--panel); border-bottom: 2px solid var(--brand); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 10; }
.header-inner { max-width: 1400px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; color: var(--brand); }
.header-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.field-label-sm { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }
.tmpl-sel { padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; font-family: inherit; cursor: pointer; background: white; }
.btn-pdf { padding: 9px 20px; background: var(--brand); border: none; border-radius: 8px; color: white; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; transition: background .12s; }
.btn-pdf:hover { background: var(--brand-dark); }

/* MAIN */
.app-main { max-width: 1400px; margin: 0 auto; padding: 20px; display: grid; grid-template-columns: 440px 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .app-main { grid-template-columns: 1fr; } }

/* FORM */
.section-block { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden; }
.section-summary { padding: 14px 16px; cursor: pointer; font-size: 13px; font-weight: 700; color: var(--text); background: var(--panel2); list-style: none; display: flex; align-items: center; gap: 8px; user-select: none; }
.section-summary::-webkit-details-marker { display: none; }
.section-summary::after { content: '▾'; margin-left: auto; color: var(--text-muted); font-size: 16px; transition: transform .2s; }
details[open] .section-summary::after { transform: rotate(-180deg); }
.section-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }

/* FORM FIELDS */
.field-group { display: flex; flex-direction: column; gap: 5px; }
.field-group label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.field-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 500px) { .field-row-2 { grid-template-columns: 1fr; } }
.field-inp { padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 13px; color: var(--text); background: var(--bg); outline: none; transition: border .15s; font-family: inherit; resize: vertical; }
.field-inp:focus { border-color: var(--brand); background: white; }

/* EXPERIENCE/EDUCATION ITEMS */
.exp-item, .edu-item, .proj-item { border: 1px solid var(--border); border-radius: 6px; padding: 14px; background: var(--bg); position: relative; }
.item-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.item-num { font-size: 11px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .07em; }
.btn-del-item { padding: 3px 8px; border: 1px solid var(--border); border-radius: 4px; background: white; color: var(--text-muted); font-size: 12px; cursor: pointer; font-family: inherit; }
.btn-del-item:hover { background: #FEE2E2; border-color: #EF4444; color: #EF4444; }
.btn-add-item { padding: 8px 16px; border: 2px dashed var(--border); border-radius: 6px; background: none; color: var(--brand); font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all .12s; width: 100%; }
.btn-add-item:hover { border-color: var(--brand); background: var(--brand-light); }

/* PREVIEW */
.preview-col { position: sticky; top: 70px; }
.preview-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.pane-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
.check-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); cursor: pointer; }
.check-label input { accent-color: var(--brand); }
.preview-wrap { max-height: calc(100vh - 100px); overflow-y: auto; }

/* RESUME PAPER */
.resume-preview { background: white; width: 100%; box-shadow: 0 4px 24px rgba(0,0,0,.15); min-height: 297mm; font-family: Georgia, serif; font-size: 10pt; color: #111; line-height: 1.5; }

/* MODERN TEMPLATE */
.tmpl-modern .r-header { background: #1E1B4B; color: white; padding: 28px 32px; }
.tmpl-modern .r-name { font-size: 26pt; font-weight: 700; margin-bottom: 4px; font-family: Arial, sans-serif; }
.tmpl-modern .r-title { font-size: 13pt; color: #A5B4FC; margin-bottom: 12px; font-family: Arial, sans-serif; font-style: italic; }
.tmpl-modern .r-contact { display: flex; gap: 16px; flex-wrap: wrap; font-size: 9pt; font-family: Arial, sans-serif; color: #C7D2FE; }
.tmpl-modern .r-body { display: grid; grid-template-columns: 1fr 220px; gap: 0; }
.tmpl-modern .r-main { padding: 24px 24px 24px 32px; }
.tmpl-modern .r-sidebar { background: #F5F3FF; padding: 24px 20px; border-left: 1px solid #0f172a; }
.tmpl-modern .r-section-title { font-family: Arial, sans-serif; font-size: 9pt; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: #2563eb; border-bottom: 2px solid #2563eb; padding-bottom: 4px; margin-bottom: 14px; margin-top: 20px; }
.tmpl-modern .r-section-title:first-child { margin-top: 0; }
.tmpl-modern .r-item-title { font-weight: 700; font-size: 11pt; font-family: Arial, sans-serif; }
.tmpl-modern .r-item-sub { font-size: 9.5pt; color: #2563eb; font-style: italic; margin-bottom: 2px; }
.tmpl-modern .r-item-date { font-size: 8.5pt; color: #5b6878; font-family: Arial, sans-serif; }
.tmpl-modern .r-item-desc { font-size: 9.5pt; color: #374151; margin-top: 6px; white-space: pre-line; }
.tmpl-modern .r-skill-tag { display: inline-block; background: #EDE9FE; color: #2563eb; padding: 2px 8px; border-radius: 10px; font-size: 8.5pt; margin: 2px; font-family: Arial, sans-serif; font-weight: 600; }
.tmpl-modern .r-summary { font-size: 10pt; color: #374151; white-space: pre-line; }
.tmpl-modern .r-lang { font-size: 9pt; color: #374151; margin: 4px 0; }
@media (max-width: 600px) { .tmpl-modern .r-body { grid-template-columns: 1fr; } .tmpl-modern .r-sidebar { border-left: none; border-top: 1px solid #0f172a; } }

/* CLASSIC TEMPLATE */
.tmpl-classic .r-header { text-align: center; padding: 28px 32px 18px; border-bottom: 2px solid #111; }
.tmpl-classic .r-name { font-size: 26pt; font-weight: 700; letter-spacing: .02em; margin-bottom: 4px; }
.tmpl-classic .r-title { font-size: 12pt; color: #555; font-style: italic; margin-bottom: 10px; }
.tmpl-classic .r-contact { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; font-size: 9pt; color: #444; font-family: Arial, sans-serif; }
.tmpl-classic .r-body { padding: 20px 36px; }
.tmpl-classic .r-section-title { font-family: Arial, sans-serif; font-size: 9pt; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; border-bottom: 1px solid #333; padding-bottom: 3px; margin: 18px 0 10px; }
.tmpl-classic .r-item-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tmpl-classic .r-item-title { font-weight: 700; font-size: 10.5pt; }
.tmpl-classic .r-item-date { font-size: 9pt; color: #555; font-style: italic; white-space: nowrap; }
.tmpl-classic .r-item-sub { font-size: 10pt; color: #333; }
.tmpl-classic .r-item-desc { font-size: 9.5pt; color: #333; margin-top: 5px; white-space: pre-line; }
.tmpl-classic .r-skills { font-size: 10pt; color: #333; }
.tmpl-classic .r-summary { font-size: 10pt; color: #333; white-space: pre-line; }

/* MINIMAL TEMPLATE */
.tmpl-minimal .r-header { padding: 36px 40px 20px; }
.tmpl-minimal .r-name { font-size: 30pt; font-weight: 300; letter-spacing: .05em; margin-bottom: 2px; font-family: Arial, sans-serif; }
.tmpl-minimal .r-title { font-size: 12pt; color: #888; margin-bottom: 10px; font-family: Arial, sans-serif; }
.tmpl-minimal .r-contact { display: flex; gap: 20px; flex-wrap: wrap; font-size: 9pt; color: #666; font-family: Arial, sans-serif; }
.tmpl-minimal .r-body { padding: 20px 40px; }
.tmpl-minimal .r-section-title { font-family: Arial, sans-serif; font-size: 8pt; font-weight: 700; text-transform: uppercase; letter-spacing: .2em; color: #888; margin: 24px 0 10px; }
.tmpl-minimal .r-item-title { font-weight: 700; font-size: 11pt; }
.tmpl-minimal .r-item-sub { font-size: 10pt; color: #888; }
.tmpl-minimal .r-item-date { font-size: 9pt; color: #AAA; }
.tmpl-minimal .r-item-desc { font-size: 9.5pt; color: #444; margin-top: 6px; white-space: pre-line; }
.tmpl-minimal .r-skill-tag { font-size: 9pt; color: #555; margin-right: 12px; }
.tmpl-minimal .r-summary { font-size: 10.5pt; color: #333; white-space: pre-line; }

/* ITEM SPACING */
.r-item { margin-bottom: 14px; }

/* FOOTER */
.site-footer { border-top: 1px solid var(--border); text-align: center; padding: 14px; color: var(--text-muted); font-size: 12px; margin-top: 16px; }

@media print { .site-header, .form-col, .preview-label-row, .site-footer { display: none !important; } .app-main { grid-template-columns: 1fr; padding: 0; margin: 0; max-width: none; } .preview-col { position: static; } .resume-preview { box-shadow: none; } }
