/* =========================================================
   Sistema de Formularios — hoja de estilos general
   Paleta:
     --ink        #1B1F27  texto principal
     --muted      #6B7280  texto secundario
     --canvas     #F5F6F8  fondo de la app
     --surface    #FFFFFF  tarjetas / paneles
     --line       #E3E6EB  bordes
     --brand      #2A5DB0  acción primaria
     --brand-dark #1E4685
     --accent     #C17F1B  obligatorio / advertencia suave
     --danger     #C0392B
     --sidebar    #1B2333  fondo del nav vertical
     --sidebar-ink #C7CEDB
========================================================= */

* { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    background: var(--canvas);
    color: var(--ink);
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

:root {
    --ink: #1B1F27;
    --muted: #6B7280;
    --canvas: #F5F6F8;
    --surface: #FFFFFF;
    --line: #E3E6EB;
    --brand: #2A5DB0;
    --brand-dark: #1E4685;
    --accent: #C17F1B;
    --danger: #C0392B;
    --sidebar: #1B2333;
    --sidebar-ink: #C7CEDB;
    --radius: 8px;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0 0 4px; font-weight: 600; letter-spacing: -0.01em; }

button, input, select, textarea { font-family: inherit; font-size: inherit; }

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    font-weight: 500;
    line-height: 1.2;
    transition: background .15s ease, border-color .15s ease;
}
.btn:hover { background: #F0F2F5; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

.btn-danger { color: var(--danger); border-color: #EAC6C1; }
.btn-danger:hover { background: #FBEEEC; }

.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: rgba(0,0,0,.05); }

.btn-sm { padding: 5px 10px; font-size: 13px; }

/* ---------- Login ---------- */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 36px 32px;
}
.auth-card .brand-mark {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: var(--brand);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    margin-bottom: 16px;
}
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-card p.sub { color: var(--muted); margin: 0 0 24px; font-size: 14px; }

.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--ink);
}
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="file"],
.field textarea,
.field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: var(--ink);
}
.field textarea { resize: vertical; min-height: 70px; }

.alert {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
}
.alert-error { background: #FBEEEC; color: var(--danger); border: 1px solid #EAC6C1; }
.alert-ok { background: #EAF3E8; color: #2E7D32; border: 1px solid #C7E2C3; }

.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- App shell (sidebar + contenido) ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--sidebar);
    color: var(--sidebar-ink);
    display: flex;
    flex-direction: column;
    padding: 20px 12px;
}
.sidebar .brand {
    display: flex; align-items: center; gap: 10px;
    padding: 0 8px 20px;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
}
.sidebar .brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--sidebar-ink);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
}
.nav-link:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav-link.active { background: var(--brand); color: #fff; }
.nav-link svg { flex-shrink: 0; }

.sidebar-footer { margin-top: auto; }
.sidebar-user {
    padding: 10px 12px;
    font-size: 12px;
    color: #8892A6;
    border-top: 1px solid rgba(255,255,255,.08);
    margin-top: 8px;
    padding-top: 14px;
}
.sidebar-user strong { display: block; color: #DCE1EA; font-size: 13px; font-weight: 600; }

.main {
    flex: 1;
    padding: 32px 40px;
    max-width: 1100px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}
.page-head h1 { font-size: 22px; }
.page-head p { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- Tarjetas de formularios (Home) ---------- */
.forms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}
.form-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-card h3 { font-size: 15px; }
.form-card .meta { color: var(--muted); font-size: 12.5px; }
.form-card .badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 100px;
    width: fit-content;
    margin-top: 2px;
}
.badge-open { background: #EAF3E8; color: #2E7D32; }
.badge-restricted { background: #FDF1E3; color: var(--accent); }
.form-card .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.form-card.new-card {
    border-style: dashed;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--muted);
    min-height: 140px;
    cursor: pointer;
}
.form-card.new-card:hover { border-color: var(--brand); color: var(--brand); }
.form-card.new-card .plus {
    width: 34px; height: 34px; border-radius: 50%;
    border: 1.5px solid currentColor;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; margin-bottom: 8px;
}

.empty-state {
    border: 1px dashed var(--line);
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    color: var(--muted);
}
.empty-state h3 { color: var(--ink); margin-bottom: 6px; }

/* ---------- Constructor de formularios ---------- */
.builder-layout { display: flex; gap: 24px; align-items: flex-start; }
.builder-canvas { flex: 1; min-width: 0; }
.builder-palette {
    width: 210px;
    flex-shrink: 0;
    position: sticky;
    top: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
}
.builder-palette h4 { font-size: 12px; text-transform: none; color: var(--muted); margin-bottom: 10px; }
.personal-palette-btn { border-color: #A8D6B9 !important; color: #17663A; background: #F2FAF5; }
.palette-btn {
    width: 100%;
    text-align: left;
    padding: 9px 10px;
    margin-bottom: 6px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
    font-size: 13.5px;
    display: flex; align-items: center; gap: 8px;
}
.palette-btn:hover { border-color: var(--brand); color: var(--brand); }

.form-meta-card, .field-block {
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 3px solid var(--brand);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 14px;
}
.form-meta-card { border-left-color: var(--ink); }
.form-meta-card input[type="text"] {
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--line);
    padding: 6px 2px;
    font-size: 19px;
    font-weight: 600;
    margin-bottom: 10px;
}
.form-meta-card textarea {
    width: 100%;
    border: none;
    border-bottom: 1px solid transparent;
    padding: 4px 2px;
    color: var(--muted);
    resize: none;
}
.form-meta-card input[type="text"]:focus,
.form-meta-card textarea:focus { outline: none; border-bottom-color: var(--brand); }

.pdf-config-card { border-left-color: #274B8E; }
.pdf-config-card h3 { font-size: 17px; margin-bottom: 6px; }
.pdf-config-copy { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; }
.pdf-config-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
    gap: 16px;
    align-items: end;
}
.pdf-toggle-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    font-weight: 600;
}
.pdf-config-field { margin-bottom: 0; }
.pdf-logo-preview { margin-top: 16px; }
.pdf-logo-empty,
.pdf-logo-preview-card {
    border: 1px dashed var(--line);
    border-radius: 10px;
    background: #FBFCFE;
    min-height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.pdf-logo-empty { color: var(--muted); font-size: 13px; }
.pdf-logo-preview-card {
    flex-direction: column;
    gap: 14px;
}
.pdf-logo-preview-card img {
    max-width: 100%;
    max-height: 72px;
    object-fit: contain;
}

.field-block[data-type="line"] { border-left-color: var(--muted); padding: 10px 18px; }
.field-block[data-type="heading"] { border-left-color: #8B5CF6; }
.field-block[data-type="personal_info"] {
    border-left-color: #1FA35B;
    background: linear-gradient(180deg, #FFFFFF 0%, #FBFEFC 100%);
}

.field-block-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.field-block-head .drag-handle { cursor: grab; color: var(--muted); }
.field-block-head .type-tag {
    font-size: 11px;
    color: var(--muted);
    background: var(--canvas);
    padding: 2px 8px;
    border-radius: 100px;
}
.field-block-head .spacer { flex: 1; }

.personal-info-block-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 12px;
}
.personal-info-block-copy strong {
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
}
.personal-info-block-copy span {
    font-size: 12.5px;
    color: var(--muted);
}
.personal-info-block-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.personal-info-block-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 10px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #D9E0EA;
    color: #475569;
    font-size: 12.5px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}
.personal-info-block-pill:hover { border-color: #70B98C; }
.personal-info-block-pill.is-selected {
    background: #EEF8F1;
    border-color: #85CEA0;
    color: #17663A;
}
.personal-info-block-pill-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    flex-shrink: 0;
    color: #1FA35B;
    line-height: 0;
}

.field-label-input {
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--line);
    padding: 6px 2px;
    font-size: 15px;
    font-weight: 500;
}
.field-label-input:focus { outline: none; border-bottom-color: var(--brand); }

.field-preview-input {
    margin-top: 10px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--muted);
    background: #FAFBFC;
    font-size: 13.5px;
    max-width: 320px;
}

.options-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.option-row { display: flex; align-items: center; gap: 8px; }
.option-row input[type="text"] {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
}
.option-add-btn {
    align-self: flex-start;
    background: none;
    border: none;
    color: var(--brand);
    cursor: pointer;
    font-size: 13px;
    padding: 4px 0;
}

.field-block-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}
.field-block-footer .left { display: flex; gap: 4px; }
.required-toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.col-span-picker {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--muted);
}
.col-span-picker button {
    width: 26px;
    height: 26px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    padding: 0;
}
.col-span-picker button.is-active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
#fieldsContainer {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
}
#fieldsContainer .field-block { margin-bottom: 0; min-width: 0; }
#fieldsContainer .field-block.span-1 { grid-column: span 1; }
#fieldsContainer .field-block.span-2 { grid-column: span 2; }
#fieldsContainer .field-block.span-3 { grid-column: span 3; }
#fieldsContainer .field-preview-input { max-width: none; }
.personal-span-row { display: flex; align-items: center; gap: 8px; }
.personal-span-row .personal-info-block-pill { flex: 1; min-width: 0; }

.icon-btn {
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    border: none; background: transparent; border-radius: 6px;
    color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--canvas); color: var(--ink); }
.icon-btn.danger:hover { background: #FBEEEC; color: var(--danger); }

.field-block.dragging { opacity: .4; }
.drop-line { height: 3px; background: var(--brand); border-radius: 3px; margin: -1px 0 13px; }

.builder-actions {
    position: sticky;
    bottom: 0;
    background: linear-gradient(to top, var(--canvas) 60%, transparent);
    padding: 16px 0 4px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ---------- Visor / respuesta del formulario ---------- */
.viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}
.viewer-toolbar .links { display: flex; gap: 8px; }

.public-form-shell {
    max-width: 820px;
    margin: 0 auto;
    padding: 40px 20px;
}
.public-form-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 8px solid var(--brand);
    border-radius: 10px;
    padding: 28px 28px 8px;
    margin-bottom: 16px;
}
.public-form-card h1 { font-size: 22px; }
.public-form-card p.desc { color: var(--muted); margin-top: 6px; }

.field-view { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px 24px; margin-bottom: 14px; }
.field-view label { display: block; font-weight: 500; margin-bottom: 10px; }
.field-view .req { color: var(--danger); margin-left: 3px; }
.field-view input[type="text"],
.field-view input[type="file"],
.field-view textarea,
.field-view select {
    width: 100%;
    padding: 9px 12px;
    border: none;
    border-bottom: 1px solid var(--line);
    background: transparent;
}
.field-view input[type="text"]:focus,
.field-view textarea:focus,
.field-view select:focus { outline: none; border-bottom: 2px solid var(--brand); }
.field-view .choice-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 14.5px; }
.field-view.heading-view { border: none; background: none; padding: 6px 4px 0; }
.field-view.heading-view h2 { font-size: 17px; }
.field-view.line-view { border: none; background: none; padding: 0; height: 1px; background-color: var(--line); margin: 6px 0 20px; }

.gate-card {
    max-width: 420px;
    margin: 80px auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 32px;
    text-align: left;
}
.gate-card h1 { font-size: 18px; }
.gate-card p { color: var(--muted); font-size: 14px; }

.thanks-card {
    max-width: 420px;
    margin: 100px auto;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 40px 28px;
}
.thanks-card .check {
    width: 48px; height: 48px; border-radius: 50%;
    background: #EAF3E8; color: #2E7D32;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 14px; font-size: 22px;
}

/* ---------- Modal compartir ---------- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 18, 26, .45);
    backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border-radius: 12px;
    padding: 26px;
}
.modal-box h2 { font-size: 17px; margin-bottom: 4px; }
.modal-box p.sub { color: var(--muted); font-size: 13.5px; margin: 0 0 18px; }

.link-copy-row {
    display: flex; gap: 8px; margin-bottom: 20px;
}
.link-copy-row input {
    flex: 1;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--canvas);
    color: var(--muted);
    font-size: 13px;
}

.share-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
}
.share-option:hover { border-color: var(--brand); }
.share-option input { margin-top: 3px; }
.share-option .title { font-weight: 600; font-size: 14px; }
.share-option .desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.share-option.selected { border-color: var(--brand); background: #F3F7FD; }

.confirm-open-box {
    background: #FDF1E3;
    border: 1px solid #F0DBB4;
    color: #7A5310;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-top: 12px;
    display: none;
}
.confirm-open-box.show { display: block; }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.share-user-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    border-bottom: 1px solid var(--line);
    font-size: 13.5px;
}
.share-user-row:last-child { border-bottom: none; }
.share-user-row span:first-child { flex: 1; }

/* ---------- Tablas (respuestas / credenciales) ---------- */
.table-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.simple { width: 100%; border-collapse: collapse; }
table.simple th, table.simple td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}
table.simple th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; background: var(--canvas); }
table.simple tr:last-child td { border-bottom: none; }
table.simple td.actions-cell { display: flex; gap: 8px; }

/* ---------- Impresión de una respuesta ---------- */
.print-shell { max-width: 920px; margin: 0 auto; padding: 32px 20px; }
.print-toolbar { display: flex; justify-content: space-between; margin-bottom: 20px; }
.print-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 28px; }
.pdf-sheet {
    width: 188mm;
    margin: 8mm auto;
    padding: 8mm 9mm 10mm;
    background: #fff;
    color: #37465F;
    border: none;
    border-radius: 0;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}
.pdf-doc-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 22px;
}
.pdf-doc-logo {
    width: 100%;
    display: flex;
    justify-content: center;
}
.pdf-doc-logo img {
    max-width: calc(260px * 1.15);
    max-height: calc(68px * 1.15);
    object-fit: contain;
}
.pdf-doc-title {
    font-size: 20px;
    font-weight: 800;
    color: #101828;
    text-align: center;
    margin: 0;
}
.pdf-top-layout {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 18px;
    align-items: start;
    margin-bottom: 16px;
}
.pdf-top-layout .pdf-beside {
    grid-column: span 2;
    min-width: 0;
}
.pdf-top-layout.photo-left .pdf-photo-column { order: -1; }
.pdf-photo-solo {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}
.pdf-photo-solo.photo-left { justify-content: flex-start; }
.pdf-photo-solo .pdf-photo-box { width: min(100%, 48mm); }
.pdf-top-layout .pdf-photo-box {
    width: min(100%, 48mm);
    margin-inline: auto;
}
.pdf-fields-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.pdf-fields-grid + .pdf-top-layout,
.pdf-top-layout + .pdf-fields-grid {
    margin-top: 14px;
}
.pdf-field-row {
    display: grid;
    gap: 14px 18px;
}
.pdf-field-row.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pdf-field-row.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pdf-field-row .span-1 { grid-column: span 1; }
.pdf-field-row .span-2 { grid-column: span 2; }
.pdf-field-row .span-3 { grid-column: span 3; }
.pdf-decor .field-view { margin: 0; padding: 2px 0; }
.pdf-decor .field-view.line-view { margin: 6px 0; }
.pdf-primary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
}
.pdf-primary-grid .slot-1,
.pdf-primary-grid .slot-4 {
    grid-column: 1 / -1;
}
.pdf-secondary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 18px;
}
.pdf-secondary-grid.has-photo .slot-1 {
    grid-column: 1 / span 2;
}
.pdf-secondary-grid.no-photo .slot-1 {
    grid-column: 1 / span 3;
}
.pdf-secondary-grid.no-photo .slot-5 {
    grid-column: 1 / span 2;
}
.pdf-field-card {
    min-width: 0;
    break-inside: avoid;
}
.pdf-field-label {
    font-size: 10.5px;
    font-weight: 800;
    color: #37465F;
    letter-spacing: .01em;
    margin-bottom: 5px;
}
.pdf-field-value {
    min-height: 36px;
    padding: 3px 9px;
    border: 1.3px solid #C4CDD9;
    border-radius: 7px;
    background: #fff;
    font-size: 13.5px;
    line-height: 1.3;
    color: #24324B;
    overflow-wrap: anywhere;
    box-sizing: border-box;
}

.pdf-field-value input[type="text"] {
    border: none;
    width: 100%;
    font-size: 15px;
}

.pdf-field-value.has-value { font-weight: 500; }
.pdf-field-value.is-single-line {
    display: flex;
    align-items: center;
}
.pdf-field-value.is-multiline {
    min-height: 50px;
}
.pdf-field-value.is-empty { color: transparent; }
.pdf-photo-column {
    display: flex;
    justify-content: center;
    align-self: start;
    padding-top: 0px;
}
.pdf-photo-box {
    width: 100%;
    height: 60mm;
    border: 1.8px dashed #A7B5C9;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #8DA0BE;
    font-weight: 600;
    background: #FCFDFF;
}
.pdf-photo-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.pdf-photo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #9AA9BF;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}
.pdf-photo-placeholder-icon {
    display: inline-flex;
    line-height: 0;
}
.pdf-extra-fields {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #E5EAF2;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
}
.pdf-field-card-full {
    width: 100%;
    break-inside: avoid;
}
.pdf-doc-footer {
    margin-top: 20px;
    padding-top: 12px;
    border-top: 1px solid #E4E9F1;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: #6B7280;
    font-size: 11.5px;
}

.pdf-field-label .req {
    color: #D93A3A;
    margin-left: 3px;
}

.pdf-field-value input,
.pdf-field-value select,
.pdf-field-value textarea {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    padding: 0;
    margin: 0;
    font-size: inherit;
    font-family: inherit;
    color: #24324B;
    line-height: inherit;
    resize: vertical;
    border-radius: 0;
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
}
.pdf-field-value input::placeholder,
.pdf-field-value textarea::placeholder {
    color: #A6B0C3;
    font-weight: 400;
}
.pdf-field-value select {
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238FA4BE' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0 center;
    background-size: 14px;
    padding-right: 22px;
}
.pdf-field-value textarea {
    min-height: 44px;
    padding: 2px 0;
}
.pdf-field-value.is-single-line input,
.pdf-field-value.is-single-line select {
    height: 22px;
}
.pdf-field-value.has-choices {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 8px;
    padding-bottom: 8px;
}
.pdf-field-value.has-choices .choice-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 13.5px;
}
.pdf-field-value.has-choices .choice-row input {
    width: auto;
    margin: 0;
    accent-color: #2B517B;
}
.pdf-field-value.has-choices .choice-row label {
    margin: 0;
    font-weight: 400;
    cursor: pointer;
}
.pdf-photo-upload {
    cursor: pointer;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pdf-photo-upload input[type=file] { display: none; }
.pdf-photo-preview {
    width: 100%;
    height: 60mm;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pdf-photo-preview.has-photo {
    padding: 0;
}
.pdf-photo-preview.has-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media print {
    @page {
        size: A4;
        margin: 10mm;
    }
    .no-print { display: none !important; }
    body { background: #fff; }
    .print-shell { max-width: none; padding: 0; }
    .print-card { border: none; border-radius: 0; padding: 0; }
    .pdf-sheet {
        width: auto;
        margin: 0;
        padding: 10mm;
        box-shadow: none;
    }
}

@media (max-width: 640px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; align-items: center; overflow-x: auto; }
    .sidebar .brand { padding: 0 12px 0 0; }
    .sidebar-footer { display: none; }
    .main { padding: 20px; }
    .builder-layout { flex-direction: column-reverse; }
    .builder-palette { width: 100%; position: static; }
    .personal-info-block-items { grid-template-columns: 1fr; }
    .pdf-config-grid { grid-template-columns: 1fr; }
    #fieldsContainer,
    .pdf-top-layout,
    .pdf-field-row,
    .pdf-field-row.cols-2,
    .pdf-field-row.cols-3,
    .pdf-primary-grid,
    .pdf-secondary-grid,
    .pdf-extra-fields { grid-template-columns: 1fr; }
    #fieldsContainer .field-block.span-1,
    #fieldsContainer .field-block.span-2,
    #fieldsContainer .field-block.span-3,
    .pdf-top-layout .pdf-beside,
    .pdf-field-row .span-1,
    .pdf-field-row .span-2,
    .pdf-field-row .span-3,
    .pdf-primary-grid [class*="slot-"],
    .pdf-secondary-grid [class*="slot-"] {
        grid-column: auto;
        grid-row: auto;
    }
    .pdf-photo-column,
    .pdf-top-layout.photo-left .pdf-photo-column {
        order: -1;
        padding-top: 0;
    }
    .pdf-photo-box {
        width: 100%;
        max-width: 220px;
        margin: 0 auto;
    }
}
