* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #e2e8f0;
    padding: 20px;
    color: #1e293b;
}

/* PAINEL DE INTERFACE DE PREENCHIMENTO */
.admin-panel {
    max-width: 800px;
    margin: 0 auto 30px auto;
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.admin-panel h2 {
    color: #0f172a;
    margin-bottom: 5px;
}

.admin-panel p {
    color: #64748b;
    margin-bottom: 15px;
    font-size: 14px;
}

.form-group-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.form-group-row input,
.form-group-row textarea {
    flex: 1;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 14px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    resize: vertical;
}

/* EDITOR DE TEXTO COM FORMATAÇÃO */
.text-editor {
    flex: 1;
}

.editor-toolbar {
    display: flex;
    gap: 6px;
    padding: 6px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
}

.editor-toolbar button {
    width: 32px;
    height: 30px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.editor-toolbar button:hover {
    background: #e2e8f0;
}

.editor-toolbar select {
    height: 30px;
    font-size: 13px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #ffffff;
}

.editor-area {
    min-height: 90px;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 0 0 4px 4px;
    font-size: 14px;
    line-height: 1.5;
    background: #ffffff;
    outline: none;
}

.editor-area:focus {
    border-color: #0284c7;
}

.btn-print {
    width: 100%;
    padding: 12px;
    background-color: #0284c7;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-print:hover {
    background-color: #0369a1;
}

/* DESIGN DA FOLHA A4 PARA PRÉ-VISUALIZAÇÃO E IMPRESSÃO */
.a4-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
}

.a4-page {
    width: 210mm;
    min-height: 297mm;
    padding: 15mm;
    margin: 0 auto;
    background: #ffffff;
    box-shadow: 0 0 15px rgba(0,0,0,0.15);
    position: relative;
    display: flex;
    flex-direction: column;
    transform-origin: top center;
}

/* TOPO DA FOLHA */
.header {
    text-align: center;
    border-bottom: 2px solid #0284c7;
    padding-bottom: 12px;
    margin-bottom: 15px;
    position: relative;
}

.header-logo {
    position: absolute;
    top: 0;
    left: 0;
    width: 75px;
    height: auto;
}

.header h1 {
    font-size: 20px;
    color: #0f172a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header .sub-desc-1 {
    font-size: 13px;
    color: #0369a1;
    font-weight: 600;
    margin-top: 4px;
}

.header .sub-desc-2 {
    font-size: 13px;
    color: #475569;
    font-style: italic;
    margin-top: 2px;
}

/* ESTRUTURA DOS CAMPOS DE DADOS */
.section {
    margin-bottom: 15px;
}

.section-title {
    font-size: 12px;
    font-weight: bold;
    color: #0f172a;
    background-color: #f1f5f9;
    padding: 6px 10px;
    border-left: 4px solid #0284c7;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.grid-table {
    display: flex;
    flex-wrap: wrap;
    border-top: 1px solid #cbd5e1;
    border-left: 1px solid #cbd5e1;
}

.grid-cell {
    border-right: 1px solid #cbd5e1;
    border-bottom: 1px solid #cbd5e1;
    padding: 6px 8px;
    min-height: 42px;
}

.col-3 { width: 25%; }
.col-4 { width: 33.33%; }
.col-6 { width: 50%; }

.grid-cell .label {
    display: block;
    font-size: 10px;
    font-weight: bold;
    color: #64748b;
    text-transform: uppercase;
}

.grid-cell .value {
    font-size: 13px;
    color: #0f172a;
    font-weight: 500;
}

/* TEXTOS E OPÇÕES */
.text-block {
    font-size: 12px;
    line-height: 1.5;
    color: #334155;
    text-align: justify;
    background-color: #fafafa;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
}

.options-group {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.checkbox-container input {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    accent-color: #0284c7;
}

/* CAIXA DE TAG */
.tag-box {
    margin-top: 10px;
}

.tag-title {
    font-size: 11px;
    font-weight: normal;
    color: #1e293b;
    margin-right: 6px;
}

.tag-value {
    font-size: 11px;
    color: #334155;
}

/* ASSINATURA DIGITAL */
.signature-box {
    margin-top: 24px;
    text-align: left;
}

.signature-label {
    display: block;
    font-size: 10px;
    font-weight: bold;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.signature-line {
    width: 220px;
    height: 36px;
    border-bottom: 1px solid #334155;
}

/* DATAS E RODAPÉ */
.date-current {
    text-align: right;
    margin-top: 20px;
    font-size: 13px;
    color: #334155;
}

.footer-print {
    margin-top: auto;
    border-top: 1px solid #cbd5e1;
    padding-top: 8px;
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #64748b;
}

/* 🖨️ CONFIGURAÇÕES REAIS DE IMPRESSÃO / SALVAR EM PDF */
@media print {
    body {
        background-color: #ffffff;
        padding: 0;
    }

    .no-print {
        display: none !important;
    }

    .a4-wrap {
        display: block;
        height: auto !important;
    }

    .a4-page {
        box-shadow: none;
        margin: 0;
        width: 100%;
        min-height: 100vh;
        padding: 0;
        transform: none !important;
    }

    @page {
        size: A4;
        margin: 12mm 15mm;
    }
}

/* 📱 RESPONSIVIDADE MOBILE DO PAINEL (a folha A4 é escalada via JS p/ refletir a impressão) */
@media screen and (max-width: 768px) {
    body {
        padding: 10px;
    }

    .admin-panel {
        padding: 15px;
        margin-bottom: 20px;
    }

    .admin-panel h2 {
        font-size: 19px;
    }

    .form-group-row {
        flex-direction: column;
        gap: 8px;
    }

    .form-group-row input {
        font-size: 16px;
    }

    .btn-print {
        font-size: 16px;
        padding: 14px;
    }
}