body {
    font-family: Arial, Helvetica, sans-serif;
    background: #eef1f3;
    margin: 0;
    padding: 20px;
    color: #222;
}
.container {
    max-width: 850px;
    margin: 0 auto;
    background: #fff;
    padding: 25px 35px 40px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.container.container-wide {
    max-width: 1280px;
}

/* ==========================================================================
   LAYOUT COM PRÉ-VISUALIZAÇÃO DA PÁGINA (FORMULÁRIO + IMAGEM)
   ========================================================================== */
.layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 26px;
    align-items: start;
}
.form-col {
    min-width: 0;
}
.preview-col {
    position: sticky;
    top: 16px;
    min-width: 0;
}
.preview-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}
.preview-tab {
    background: #fff;
    border: 1px solid #b9c2c6;
    border-bottom: none;
    padding: 6px 16px;
    font-size: 12.5px;
    font-weight: bold;
    color: #555;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
}
.preview-tab.active {
    background: #1a7a6c;
    color: #fff;
    border-color: #1a7a6c;
}
.pdf-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 595.32 / 841.92;
    background: #fff;
    border: 1px solid #b9c2c6;
    box-shadow: 0 2px 8px rgba(0,0,0,.10);
    overflow: hidden;
}
.pdf-page {
    position: absolute;
    inset: 0;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: top left;
}
.pdf-field {
    position: absolute;
    white-space: nowrap;
    font-family: Arial, Helvetica, sans-serif;
    color: #10312c;
    pointer-events: none;
}
.pdf-field.pdf-field-multi {
    white-space: pre-wrap;
    word-break: break-word;
    overflow: hidden;
}
.pdf-check {
    position: absolute;
    font-weight: bold;
    font-family: Arial, Helvetica, sans-serif;
    color: #000;
    pointer-events: none;
    display: none;
}

@media (max-width: 900px) {
    .layout {
        grid-template-columns: 1fr;
    }
    .preview-col {
        position: static;
        order: -1;
    }
}
.header {
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 3px solid #1a7a6c;
    padding-bottom: 12px;
    margin-bottom: 20px;
}
.header .logo-text {
    line-height: 1.1;
}
.header .logo-text small {
    display: block;
    color: #1a7a6c;
    font-size: 11px;
    letter-spacing: 1px;
}
.header .logo-text strong {
    font-size: 20px;
    color: #333;
}
h1 {
    font-size: 18px;
    text-transform: uppercase;
    margin: 0 0 20px;
    text-align: center;
    letter-spacing: .5px;
}
fieldset {
    border: 1px solid #b9c2c6;
    border-radius: 4px;
    margin-bottom: 18px;
    padding: 15px 18px 18px;
}
legend {
    font-weight: bold;
    background: #1a7a6c;
    color: #fff;
    padding: 4px 12px;
    border-radius: 3px;
    font-size: 13px;
    text-transform: uppercase;
}
.row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 12px;
}
.field {
    flex: 1 1 200px;
    display: flex;
    flex-direction: column;
}
.field.wide { flex: 1 1 100%; }
label {
    font-size: 12.5px;
    font-weight: bold;
    margin-bottom: 4px;
    color: #333;
}
input[type=text], input[type=date], input[type=number], input[type=tel],
select, textarea {
    border: 1px solid #b9c2c6;
    border-radius: 4px;
    padding: 7px 9px;
    font-size: 14px;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}
textarea { resize: vertical; min-height: 55px; }
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    padding: 6px 0;
}
.radio-group label {
    font-weight: normal;
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    font-size: 14px;
}
.radio-group input { width: auto; }
.hint {
    font-size: 11.5px;
    color: #777;
    margin-top: 4px;
}
.actions {
    text-align: center;
    margin-top: 25px;
}
button, .btn {
    background: #1a7a6c;
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: 5px;
    font-size: 15px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
button:hover, .btn:hover { background: #145f54; }
.btn.secondary {
    background: #6c757d;
    margin-left: 10px;
}
.btn.secondary:hover { background: #565e64; }
.alert {
    background: #ffefc2;
    border: 1px solid #e0c469;
    padding: 10px 14px;
    border-radius: 5px;
    font-size: 13px;
    margin-bottom: 15px;
}
@media print {
    body { background: #fff; padding: 0; }
    .container { box-shadow: none; max-width: 100%; }
    .no-print { display: none !important; }
}


/* ==========================================================================
   PREENCHIMENTO RÁPIDO PELO PRONTUÁRIO
   ========================================================================== */
.import-box {
    border: 2px solid #1a7a6c;
    background: #f8fffd;
}

.import-textarea {
    min-height: 180px;
    font-family: Consolas, "Courier New", monospace;
    line-height: 1.35;
}

.import-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.import-actions button,
.import-actions .btn {
    margin: 0;
}

.import-status {
    font-size: 12.5px;
    font-weight: bold;
}

.import-status.sucesso {
    color: #146c43;
}

.import-status.erro {
    color: #b02a37;
}