:root {
    --azul: #2c47b7;
    --azul-escuro: #172a7a;
    --laranja: #ff6d00;
    --amarelo: #fff800;
    --ciano: #00edff;
    --tinta: #1a2744;
    --suave: #5b6475;
    --linha: #d8deef;
    --papel: #f6f8fc;
    --opcional: #9a4d00;
    --opcional-bg: #fff6eb;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: #e8edf6;
    color: var(--tinta);
    font-family: "Segoe UI", "Montserrat", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--azul); }

.wrap {
    max-width: 210mm;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 12px 40px rgba(23, 42, 122, 0.12);
}

.faixa {
    height: 8px;
    background: linear-gradient(90deg, var(--laranja) 0 33.33%, var(--amarelo) 33.33% 66.66%, var(--ciano) 66.66% 100%);
}

.cover, .section, .front-matter {
    padding: 18mm 16mm 16mm;
}

.cover {
    min-height: 260mm;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--papel);
}

.cover-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cover-brand img { height: 64px; width: auto; }

.kicker {
    margin: 0 0 8px;
    color: var(--azul);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.cover h1 {
    margin: 12px 0 12px;
    font-size: 38px;
    line-height: 1.12;
    letter-spacing: -0.03em;
}

.cover .lead {
    max-width: 38em;
    color: var(--suave);
    font-size: 17px;
}

.meta-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 28px;
}

.meta-box div {
    border: 1px solid var(--linha);
    background: #fff;
    padding: 14px 16px;
}

.meta-box strong { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--suave); }
.meta-box span { display: block; margin-top: 4px; font-weight: 600; }

.toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 16mm;
    background: #fff;
    border-bottom: 1px solid var(--linha);
    position: sticky;
    top: 0;
    z-index: 5;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--azul);
    background: var(--azul);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
}

.btn.ghost {
    background: #fff;
    color: var(--azul);
}

h2 {
    margin: 0 0 10px;
    font-size: 26px;
    letter-spacing: -0.02em;
}

h3 {
    margin: 22px 0 8px;
    font-size: 18px;
}

p { margin: 0 0 12px; }

.toc {
    columns: 1;
    padding: 0;
    margin: 0;
    list-style: none;
}

.toc li {
    display: flex;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--linha);
}

.toc a { text-decoration: none; color: inherit; font-weight: 600; }
.toc .num { color: var(--azul); width: 2.2em; flex: none; font-variant-numeric: tabular-nums; }

.note, .warn, .optional-callout {
    padding: 12px 14px;
    margin: 0 0 16px;
    border: 1px solid var(--linha);
    background: var(--papel);
}

.warn { border-color: #f1c4c4; background: #fff5f5; }
.optional-callout { border-color: #f0c48a; background: var(--opcional-bg); }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.badge.req { background: var(--azul); color: #fff; }
.badge.opt { background: var(--opcional-bg); color: var(--opcional); border: 1px solid #f0c48a; }

.step {
    margin: 0 0 28px;
    padding-top: 4px;
    scroll-margin-top: 72px;
}

.step.optional {
    padding: 14px 14px 4px;
    border-left: 5px solid var(--laranja);
    background: linear-gradient(90deg, var(--opcional-bg), #fff 48%);
}

.step-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 8px;
}

.step-num {
    flex: none;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    background: var(--azul);
    color: #fff;
    font-weight: 800;
}

.step.optional .step-num { background: var(--laranja); }

.shot {
    margin: 14px 0 18px;
    break-inside: avoid;
    page-break-inside: avoid;
}

.shot img {
    width: 100%;
    border: 1px solid var(--linha);
    background: var(--papel);
}

.shot.shot-icon {
    display: inline-block;
}

.shot.shot-icon img {
    width: 26px;
    height: auto;
    padding: 4px;
    background: #fff;
    border: 1px solid var(--linha);
    border-radius: 4px;
}

.inline-icon {
    display: inline-block;
    vertical-align: middle;
    width: 20px;
    height: auto;
    padding: 2px;
    background: #fff;
    border: 1px solid var(--linha);
    border-radius: 4px;
    margin: 0 2px;
}

.shot figcaption {
    margin-top: 6px;
    color: var(--suave);
    font-size: 12.5px;
}

ol.actions, ul.fields {
    margin: 0 0 14px;
    padding-left: 1.2em;
}

ol.actions li, ul.fields li { margin: 0 0 6px; }

.flow {
    display: grid;
    gap: 6px;
    margin: 0 0 18px;
}

.flow span {
    display: block;
    padding: 8px 12px;
    background: var(--papel);
    border-left: 4px solid var(--azul);
    font-weight: 600;
    font-size: 13.5px;
}

table.plain {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 16px;
    font-size: 13.5px;
}

table.plain th, table.plain td {
    border: 1px solid var(--linha);
    padding: 8px 10px;
    text-align: left;
    vertical-align: top;
}

table.plain th { background: var(--papel); }

.footer-doc {
    padding: 12px 16mm 16px;
    color: var(--suave);
    font-size: 12px;
    border-top: 1px solid var(--linha);
}

@media print {
    html, body {
        background: #fff;
        font-size: 11.5px;
        line-height: 1.4;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .wrap {
        max-width: none;
        box-shadow: none;
        background: #fff;
    }

    .toolbar, .no-print { display: none !important; }

    .cover, .section, .front-matter {
        padding: 4mm 6mm 6mm;
    }

    .cover {
        display: block;
        min-height: 0 !important;
        height: auto;
        background: #fff;
        padding-bottom: 2mm;
        break-after: auto;
        page-break-after: auto;
    }

    .cover-brand img { height: 44px; }
    .cover .kicker { margin-top: 10px !important; }
    .cover h1 {
        margin: 6px 0 8px;
        font-size: 26px;
    }
    .cover .lead { font-size: 13px; }

    .front-matter {
        padding-top: 0;
        break-after: auto;
        page-break-after: auto;
    }

    .front-matter h2, h2 { font-size: 16px; }
    h3 { font-size: 13.5px; margin: 8px 0 6px; }

    .toc li { padding: 4px 0; }
    .flow span { padding: 5px 10px; font-size: 12px; }

    .step,
    .step.optional {
        margin: 0 0 12px;
        break-inside: auto !important;
        page-break-inside: auto !important;
    }

    .step.optional {
        background: none;
        border-left: none;
        padding-left: 0;
    }

    .step-head {
        break-after: avoid;
        page-break-after: avoid;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .note,
    .warn,
    .optional-callout,
    figcaption {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .shot {
        margin: 8px 0 10px;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .shot img {
        width: 100%;
        height: auto;
        max-height: 140mm;
        object-fit: cover;
        object-position: top center;
        background: #fff;
    }

    a { color: inherit; text-decoration: none; }

    .footer-doc { padding: 8px 6mm 10px; }
}

@page {
    size: A4;
    margin: 10mm 9mm 12mm;
}
