﻿:root {
    --blue: #255d86;
    --blue2: #337db4;
    --blue-soft: #eef6fb;
    --orange: #e49a72;
    --text: #202c35;
    --muted: #65727d;
    --line: #d7e0e6;
    --bg: #f3f6f8;
    --green: #176b43;
    --green-bg: #edf9f2;
    --red: #b42318;
    --red-bg: #fff0ef;
    --yellow: #835a00;
    --yellow-bg: #fff8df;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background: var(--bg);
}

.topbar {
    display: flex;
    align-items: center;
    gap: 26px;
    justify-content: space-between;
    background: #fff;
    padding: 18px 28px;
    border-bottom: 4px solid var(--blue2);
}

.brand-logos,
.report-logos {
    display: flex;
    gap: 12px;
    align-items: center;
}

.logo-slot {
    width: 132px;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #fff;
}

.logo-slot img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: none;
}

.logo-ph {
    width: 100%;
    height: 100%;
    border: 1px dashed #b8c3ca;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    font-weight: 800;
    color: #75828b;
    background: #fafcfd;
}

.logo-ph small { font-size: 9px; }

.head-title {
    flex: 1;
    text-align: right;
}

.head-title h1 {
    margin: 0;
    color: var(--blue);
    font-size: 23px;
}

.head-title h2 {
    margin: 5px 0 9px;
    font-size: 15px;
    font-weight: 700;
    color: #4d5c66;
}

.docmeta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: flex-end;
    font-size: 11px;
}

.modo-banner {
    padding: 10px 20px;
    text-align: center;
    font-size: 12px;
    font-weight: 800;
}

.modo-banner.dev {
    background: var(--yellow-bg);
    color: var(--yellow);
    border-bottom: 1px solid #e2cb7a;
}

.modo-banner.ok {
    background: var(--green-bg);
    color: var(--green);
}

.container {
    max-width: 1120px;
    margin: 22px auto 70px;
    padding: 0 16px;
}

.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 16px;
    padding: 21px;
    box-shadow: 0 2px 8px rgba(0,0,0,.035);
}

.card h3 {
    margin-top: 0;
    color: var(--blue);
}

.grid {
    display: grid;
    gap: 14px;
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
    font-size: 13px;
    font-weight: 700;
}

input[type="text"],
input[inputmode],
select {
    width: 100%;
    margin-top: 6px;
    padding: 12px 11px;
    border: 1px solid #aebcc6;
    border-radius: 7px;
    font-size: 15px;
    background: #fff;
}

input:focus,
select:focus {
    outline: 3px solid rgba(51,125,180,.13);
    border-color: var(--blue2);
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.section-title-row h3 { margin-bottom: 10px; }

.btn-link {
    border: 0;
    background: transparent;
    color: var(--blue2);
    font-weight: 800;
    cursor: pointer;
    text-decoration: underline;
}

.checks {
    display: grid;
    gap: 8px;
}

.check-row,
.declaration-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 11px 12px;
    background: #fbfcfd;
    font-weight: 500;
    line-height: 1.4;
}

.check-row input,
.declaration-row input,
.inline-check input {
    width: auto;
    margin: 2px 0 0;
    transform: scale(1.12);
}

.declarations {
    margin-top: 14px;
    display: grid;
    gap: 9px;
}

.declaration-row {
    background: var(--blue-soft);
    border-color: #c5ddec;
}

.actions {
    display: flex;
    gap: 10px;
    margin: 18px 0;
}

.btn {
    border: 0;
    border-radius: 7px;
    padding: 13px 22px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    background: #dce4e9;
    color: var(--text);
}

.btn-primary {
    background: var(--blue);
    color: #fff;
}

.error-box {
    background: var(--red-bg);
    color: var(--red);
    border-color: #efb4ae;
}

.error-box h3 { color: var(--red); }

.hidden { display: none !important; }

/* RELATORIO */
.report { padding: 24px; }

.report-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 2px solid var(--blue2);
    padding-bottom: 14px;
    margin-bottom: 16px;
}

.report-logo {
    width: 115px;
    height: 55px;
}

.report-heading {
    text-align: right;
    flex: 1;
}

.report-heading h2 {
    margin: 0;
    font-size: 20px;
    color: var(--blue);
}

.report-heading p {
    margin: 5px 0;
    font-size: 13px;
}

.report-doc {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
    font-size: 10px;
    color: var(--muted);
}

.status {
    padding: 15px;
    text-align: center;
    border-radius: 8px;
    margin: 14px 0 18px;
    font-weight: 800;
    line-height: 1.45;
}

.status.ok {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid #91d0ad;
}

.status.dev {
    background: var(--yellow-bg);
    color: var(--yellow);
    border: 1px solid #e2cb7a;
}

.report-section {
    margin: 18px 0;
}

.report-section > h3 {
    border-bottom: 1px solid var(--line);
    padding-bottom: 6px;
    margin-bottom: 12px;
}

.data-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
}

.data-grid > div {
    border: 1px solid #e1e8ec;
    background: #f8fafb;
    border-radius: 7px;
    padding: 10px;
}

.data-grid span,
.param span {
    display: block;
    color: var(--muted);
    font-size: 10px;
}

.data-grid strong {
    display: block;
    margin-top: 4px;
    font-size: 13px;
}

.param-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.param {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fff;
}

.param strong {
    display: block;
    margin-top: 6px;
    font-size: 19px;
    color: var(--blue);
}

.main-param {
    background: var(--blue-soft);
    border-color: #c2dcec;
}

.note-box,
.final-note {
    margin-top: 12px;
    padding: 11px 13px;
    border-left: 4px solid var(--blue2);
    background: #f4f9fc;
    line-height: 1.45;
    font-size: 12px;
}

.note-box.warning {
    border-left-color: #cc9000;
    background: #fff8e7;
}

.report-checks {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.report-check {
    border: 1px solid #dce9e1;
    background: #f7fbf8;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 11px;
    line-height: 1.4;
}

.report-check::before {
    content: "✓ ";
    color: var(--green);
    font-weight: 900;
}

.declaration-report {
    background: #f9fbfc;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 12px;
}

.declaration-report p {
    margin: 7px 0;
    font-size: 12px;
    line-height: 1.45;
}

/* MEMORIAL */
details {
    border: 1px solid #cbd8e1;
    border-radius: 8px;
    overflow: hidden;
}

summary {
    cursor: pointer;
    padding: 14px 16px;
    color: var(--blue);
    font-weight: 900;
    background: var(--blue-soft);
    user-select: none;
}

.memorial-toolbar {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.inline-check {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-weight: 600;
}

#memorial {
    padding: 18px;
}

.mem-title {
    text-align: center;
    color: var(--blue);
    margin: 0 0 4px;
}

.mem-subtitle {
    text-align: center;
    color: var(--muted);
    margin: 0 0 20px;
    font-size: 12px;
}

.mem-section {
    margin: 20px 0;
    break-inside: avoid;
}

.mem-section h4 {
    color: var(--blue);
    border-bottom: 1px solid var(--line);
    padding-bottom: 5px;
    margin-bottom: 10px;
}

.mem-source {
    font-size: 10px;
    color: var(--muted);
    background: #f5f7f8;
    border-left: 3px solid #aebbc4;
    padding: 7px 9px;
    margin: 7px 0 12px;
}

.eq {
    margin: 10px 0;
    padding: 9px 12px;
    text-align: center;
    background: #fff;
    border: 1px solid #edf0f2;
    border-radius: 6px;
}

.eq.result {
    background: #f0f8f3;
    border-color: #c9e5d4;
}

math {
    font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif;
    font-size: 1.18rem;
}

.mem-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 11px;
}

.mem-table th,
.mem-table td {
    border: 1px solid #d8e0e5;
    padding: 7px 8px;
    text-align: left;
}

.mem-table th {
    background: var(--blue);
    color: #fff;
}

.mem-warning {
    margin: 10px 0;
    padding: 10px 12px;
    background: #fff8e7;
    border-left: 4px solid #cc9000;
    font-size: 11px;
    line-height: 1.45;
}

.mem-ok {
    margin: 10px 0;
    padding: 10px 12px;
    background: #edf9f2;
    border-left: 4px solid var(--green);
    font-size: 11px;
    line-height: 1.45;
}

footer {
    background: #fff;
    border-top: 1px solid var(--line);
    padding: 20px;
    text-align: center;
    font-size: 10px;
    color: var(--muted);
}

@media (max-width: 850px) {
    .topbar,
    .report-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .head-title,
    .report-heading {
        text-align: left;
    }

    .docmeta,
    .report-doc {
        justify-content: flex-start;
    }

    .grid-3,
    .data-grid,
    .param-grid,
    .report-checks {
        grid-template-columns: 1fr;
    }

    .actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

/* IMPRESSAO / PDF */
@page {
    size: A4;
    margin: 12mm 12mm 14mm 12mm;
}

@media print {
    body {
        background: #fff;
        font-size: 10pt;
    }

    .topbar,
    .modo-banner,
    main > section.card:not(#resultado),
    main > .actions,
    #erros,
    footer,
    .no-print {
        display: none !important;
    }

    .container {
        max-width: none;
        margin: 0;
        padding: 0;
    }

    #resultado {
        display: block !important;
    }

    .report {
        border: 0;
        box-shadow: none;
        padding: 0;
    }

    .report-header {
        margin-top: 0;
    }

    .report-section {
        break-inside: avoid;
    }

    .data-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .param-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .report-checks {
        grid-template-columns: repeat(2, 1fr);
    }

    details {
        border: 0;
        overflow: visible;
    }

    details > summary {
        display: none;
    }

    .memorial-screen {
        display: none;
    }

    body.print-with-memorial .memorial-screen {
        display: block;
        page-break-before: always;
    }

    body.print-with-memorial #memorial {
        display: block;
        padding: 0;
    }

    body.print-with-memorial #memorialDetails {
        display: block;
    }

    body.print-with-memorial #memorialDetails[open] > div {
        display: block;
    }

    .mem-section {
        break-inside: avoid;
    }

    math {
        font-size: 12pt;
    }
}
