:root {
    --tiv-blue: #0041C8;
    --tiv-black: #000000;
    --tiv-white: #ffffff;
    --tiv-gray-50: #f7f7f7;
    --tiv-gray-100: #eeeeee;
    --tiv-gray-200: #dedede;
    --tiv-gray-500: #6d6d6d;
    --tiv-gray-700: #2a2a2a;
}

body.tiv-custom-admin-page,
body.tiv-custom-admin-page input,
body.tiv-custom-admin-page textarea,
body.tiv-custom-admin-page button,
body.tiv-custom-admin-page select {
    font-family: "Montserrat", sans-serif;
}

body.tiv-custom-admin-page #wpcontent {
    padding-left: 0;
}

body.tiv-custom-admin-page #wpbody-content {
    padding-bottom: 0;
}

body.tiv-custom-admin-page .notice,
body.tiv-custom-admin-page .update-nag {
    display: none;
}

.tiv-wizard-shell {
    min-height: calc(100vh - 32px);
    background: var(--tiv-white);
    color: var(--tiv-black);
}

.tiv-wizard-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 24px 34px 22px;
    border-bottom: 1px solid var(--tiv-gray-200);
    background: var(--tiv-white);
}

.tiv-eyebrow,
.tiv-step-number,
.tiv-visual-block-heading > span,
.tiv-report-header > span {
    display: block;
    margin-bottom: 8px;
    color: var(--tiv-blue);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.tiv-wizard-topbar h1 {
    margin: 0;
    font-size: 22px;
    line-height: 1.25;
}

.tiv-wizard-topbar p {
    margin: 6px 0 0;
    color: var(--tiv-gray-500);
}

.tiv-topbar-actions,
.tiv-report-toolbar,
.tiv-report-toolbar > div,
.tiv-footer-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tiv-save-status {
    min-width: 120px;
    color: var(--tiv-gray-500);
    font-size: 12px;
    text-align: right;
}

.tiv-save-status.is-saving {
    color: var(--tiv-blue);
}

.tiv-save-status.is-saved {
    color: #187a39;
}

.tiv-save-status.is-error {
    color: #b42318;
}

.tiv-link-button,
.tiv-button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--tiv-black);
    border-radius: 0;
    padding: 0 18px;
    background: var(--tiv-white);
    color: var(--tiv-black);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: .18s ease;
}

.tiv-link-button:hover,
.tiv-button:hover {
    border-color: var(--tiv-blue);
    color: var(--tiv-blue);
}

.tiv-button--primary {
    border-color: var(--tiv-blue);
    background: var(--tiv-blue);
    color: var(--tiv-white);
}

.tiv-button--primary:hover {
    border-color: var(--tiv-black);
    background: var(--tiv-black);
    color: var(--tiv-white);
}

.tiv-button--secondary {
    border-color: var(--tiv-gray-200);
}

.tiv-button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.tiv-progress-track {
    height: 4px;
    background: var(--tiv-gray-100);
}

.tiv-progress-track span {
    display: block;
    height: 100%;
    background: var(--tiv-blue);
    transition: width .25s ease;
}

.tiv-wizard-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: calc(100vh - 132px);
}

.tiv-wizard-sidebar {
    padding: 28px 18px;
    border-right: 1px solid var(--tiv-gray-200);
    background: var(--tiv-gray-50);
}

.tiv-wizard-sidebar ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

.tiv-wizard-sidebar li {
    margin: 0 0 4px;
}

.tiv-step-jump {
    display: grid;
    width: 100%;
    grid-template-columns: 34px 1fr;
    gap: 10px;
    align-items: center;
    border: 0;
    padding: 11px 12px;
    background: transparent;
    color: var(--tiv-gray-500);
    font-size: 12px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}

.tiv-step-jump span {
    display: flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--tiv-gray-200);
    background: var(--tiv-white);
    color: var(--tiv-black);
    font-size: 10px;
    font-weight: 700;
}

.tiv-wizard-sidebar li.is-active .tiv-step-jump {
    background: var(--tiv-black);
    color: var(--tiv-white);
}

.tiv-wizard-sidebar li.is-active .tiv-step-jump span {
    border-color: var(--tiv-blue);
    background: var(--tiv-blue);
    color: var(--tiv-white);
}

.tiv-wizard-sidebar li.is-complete .tiv-step-jump span {
    border-color: var(--tiv-blue);
    color: var(--tiv-blue);
}

.tiv-wizard-main {
    min-width: 0;
    background: var(--tiv-white);
}

#tiv-wizard-form {
    max-width: 1120px;
    min-height: calc(100vh - 220px);
    margin: 0 auto;
    padding: 54px 56px 80px;
}

.tiv-step {
    display: none;
}

.tiv-step.is-active {
    display: block;
}

.tiv-step-heading {
    max-width: 820px;
    margin-bottom: 38px;
}

.tiv-step-heading h2 {
    margin: 0 0 14px;
    font-size: clamp(28px, 3vw, 44px);
    line-height: 1.08;
    letter-spacing: -.035em;
}

.tiv-step-heading p {
    max-width: 760px;
    margin: 0;
    color: var(--tiv-gray-500);
    font-size: 15px;
    line-height: 1.7;
}

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

.tiv-intro-card {
    min-height: 190px;
    padding: 24px;
    border: 1px solid var(--tiv-gray-200);
}

.tiv-intro-card strong {
    color: var(--tiv-blue);
    font-size: 12px;
}

.tiv-intro-card h3 {
    margin: 34px 0 10px;
    font-size: 20px;
}

.tiv-intro-card p {
    margin: 0;
    color: var(--tiv-gray-500);
    font-size: 13px;
    line-height: 1.6;
}

.tiv-info-callout {
    margin-top: 20px;
    padding: 18px 20px;
    border-left: 4px solid var(--tiv-blue);
    background: #f2f6ff;
    font-size: 13px;
    line-height: 1.6;
}

.tiv-question {
    margin: 0 0 26px;
    padding: 28px;
    border: 1px solid var(--tiv-gray-200);
    background: var(--tiv-white);
}

.tiv-question-heading {
    max-width: 800px;
    margin-bottom: 18px;
}

.tiv-question-heading h3 {
    margin: 0 0 7px;
    font-size: 18px;
    line-height: 1.35;
}

.tiv-question-heading p {
    margin: 0;
    color: var(--tiv-gray-500);
    font-size: 13px;
    line-height: 1.55;
}

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

.tiv-option-card {
    position: relative;
    display: flex;
    min-height: 52px;
    align-items: center;
    gap: 11px;
    border: 1px solid var(--tiv-gray-200);
    padding: 12px 14px;
    background: var(--tiv-white);
    font-size: 13px;
    cursor: pointer;
    transition: .15s ease;
}

.tiv-option-card:hover {
    border-color: var(--tiv-blue);
}

.tiv-option-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tiv-option-marker {
    display: block;
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    border: 1px solid #9d9d9d;
    background: var(--tiv-white);
}

.tiv-option-grid--radio .tiv-option-marker {
    border-radius: 50%;
}

.tiv-option-card:has(input:checked) {
    border-color: var(--tiv-blue);
    background: #f2f6ff;
}

.tiv-option-card input:checked + .tiv-option-marker {
    border: 5px solid var(--tiv-blue);
}

.tiv-option-grid:not(.tiv-option-grid--radio) .tiv-option-card input:checked + .tiv-option-marker {
    border: 1px solid var(--tiv-blue);
    background: var(--tiv-blue);
    box-shadow: inset 0 0 0 4px var(--tiv-blue);
}

.tiv-other-field {
    display: none;
    margin-top: 12px;
}

.tiv-other-field.is-visible {
    display: block;
}

.tiv-text-input,
.tiv-textarea,
.tiv-other-field input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--tiv-gray-200);
    border-radius: 0;
    padding: 13px 14px;
    background: var(--tiv-white);
    color: var(--tiv-black);
    font-size: 14px;
    box-shadow: none;
}

.tiv-text-input:focus,
.tiv-textarea:focus,
.tiv-other-field input:focus {
    border-color: var(--tiv-blue);
    outline: 2px solid rgba(0, 65, 200, .12);
    box-shadow: none;
}

.tiv-textarea {
    min-height: 124px;
    resize: vertical;
}

.tiv-text-input--compact {
    margin-top: 10px;
}

.tiv-visual-block {
    margin: 0 0 28px;
    padding: 30px;
    border: 1px solid var(--tiv-gray-200);
    background: var(--tiv-white);
}

.tiv-visual-block--general {
    border-left: 4px solid var(--tiv-blue);
}

.tiv-visual-block-heading {
    max-width: 760px;
    margin-bottom: 20px;
}

.tiv-visual-block-heading h3 {
    margin: 0 0 8px;
    font-size: 23px;
    line-height: 1.25;
}

.tiv-visual-block-heading p {
    margin: 0;
    color: var(--tiv-gray-500);
    font-size: 13px;
    line-height: 1.6;
}

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

.tiv-reference-card {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border: 2px solid transparent;
    background: var(--tiv-gray-100);
    cursor: pointer;
}

.tiv-reference-card input {
    position: absolute;
    opacity: 0;
}

.tiv-reference-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .18s ease;
}

.tiv-reference-card:hover img {
    transform: scale(1.025);
}

.tiv-reference-card.is-selected {
    border-color: var(--tiv-blue);
}

.tiv-reference-check {
    position: absolute;
    top: 8px;
    right: 8px;
    display: none;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    background: var(--tiv-blue);
    color: var(--tiv-white);
    font-size: 14px;
    font-weight: 700;
}

.tiv-reference-card.is-selected .tiv-reference-check {
    display: flex;
}

.tiv-reference-grid--static .tiv-reference-card {
    cursor: default;
}

.tiv-gallery-caption {
    margin: 10px 0 0;
    color: var(--tiv-gray-500);
    font-size: 11px;
}

.tiv-empty-gallery {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 24px;
    border: 1px dashed #bbbbbb;
    background: var(--tiv-gray-50);
    color: var(--tiv-gray-500);
    font-size: 12px;
}

.tiv-empty-gallery strong {
    color: var(--tiv-black);
}

.tiv-visual-questions {
    display: grid;
    gap: 20px;
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--tiv-gray-200);
}

.tiv-inline-question h4 {
    margin: 0 0 11px;
    font-size: 14px;
}

.tiv-inline-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tiv-inline-options label {
    position: relative;
    display: inline-flex;
    cursor: pointer;
}

.tiv-inline-options input {
    position: absolute;
    opacity: 0;
}

.tiv-inline-options span {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    border: 1px solid var(--tiv-gray-200);
    padding: 0 12px;
    background: var(--tiv-white);
    font-size: 11px;
    font-weight: 500;
}

.tiv-inline-options input:checked + span {
    border-color: var(--tiv-blue);
    background: var(--tiv-blue);
    color: var(--tiv-white);
}

.tiv-wizard-footer {
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-top: 1px solid var(--tiv-gray-200);
    padding: 16px 28px;
    background: rgba(255,255,255,.97);
}

.tiv-summary-preview {
    margin-bottom: 30px;
    padding: 24px;
    border: 1px solid var(--tiv-gray-200);
    background: var(--tiv-gray-50);
}

.tiv-report-shell {
    min-height: calc(100vh - 32px);
    padding: 28px;
    background: #ececec;
}

.tiv-report-toolbar {
    max-width: 1080px;
    justify-content: space-between;
    margin: 0 auto 16px;
}

.tiv-report-document {
    max-width: 980px;
    margin: 0 auto;
    padding: 56px 64px;
    background: var(--tiv-white);
    color: var(--tiv-black);
}

.tiv-report-header {
    margin-bottom: 40px;
    padding-bottom: 28px;
    border-bottom: 4px solid var(--tiv-blue);
}

.tiv-report-header h1 {
    margin: 0;
    font-size: 36px;
    line-height: 1.15;
    letter-spacing: -.025em;
}

.tiv-report-header p {
    margin: 8px 0 0;
    color: var(--tiv-gray-500);
    font-size: 15px;
}

.tiv-report-section {
    margin: 0 0 38px;
}

.tiv-report-section h2 {
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--tiv-black);
    font-size: 18px;
}

.tiv-report-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    background: var(--tiv-gray-200);
}

.tiv-report-row {
    min-height: 92px;
    padding: 16px;
    background: var(--tiv-white);
}

.tiv-report-row span {
    display: block;
    margin-bottom: 8px;
    color: var(--tiv-gray-500);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.tiv-report-row strong {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.55;
}

.tiv-report-reference-group {
    margin-bottom: 20px;
}

.tiv-report-reference-group h3 {
    margin: 0 0 10px;
    font-size: 13px;
}

.tiv-report-reference-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

.tiv-report-reference-grid > div {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--tiv-gray-100);
}

.tiv-report-reference-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tiv-empty-report {
    padding: 24px;
    border: 1px dashed #aaa;
    color: var(--tiv-gray-500);
    text-align: center;
}

@media (max-width: 1100px) {
    .tiv-wizard-layout {
        grid-template-columns: 210px minmax(0, 1fr);
    }

    #tiv-wizard-form {
        padding: 42px 32px 70px;
    }

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

@media (max-width: 782px) {
    body.tiv-custom-admin-page #wpcontent {
        padding-left: 0;
    }

    .tiv-wizard-topbar,
    .tiv-wizard-footer,
    .tiv-report-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .tiv-topbar-actions,
    .tiv-footer-right,
    .tiv-report-toolbar > div {
        flex-wrap: wrap;
    }

    .tiv-save-status {
        text-align: left;
    }

    .tiv-wizard-layout {
        display: block;
    }

    .tiv-wizard-sidebar {
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid var(--tiv-gray-200);
        padding: 10px;
    }

    .tiv-wizard-sidebar ol {
        display: flex;
        min-width: max-content;
    }

    .tiv-step-jump {
        width: 170px;
    }

    #tiv-wizard-form {
        min-height: auto;
        padding: 34px 18px 60px;
    }

    .tiv-intro-grid,
    .tiv-option-grid,
    .tiv-report-grid {
        grid-template-columns: 1fr;
    }

    .tiv-reference-grid,
    .tiv-report-reference-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tiv-question,
    .tiv-visual-block {
        padding: 20px;
    }

    .tiv-report-shell {
        padding: 10px;
    }

    .tiv-report-document {
        padding: 32px 20px;
    }
}

@media print {
    #adminmenumain,
    #wpadminbar,
    #screen-meta,
    .no-print {
        display: none !important;
    }

    html.wp-toolbar {
        padding-top: 0 !important;
    }

    #wpcontent,
    #wpfooter {
        margin-left: 0 !important;
    }

    .tiv-report-shell {
        padding: 0;
        background: #fff;
    }

    .tiv-report-document {
        max-width: none;
        padding: 0;
    }

    .tiv-report-section,
    .tiv-report-reference-group {
        break-inside: avoid;
    }
}

/* === Atualização 0.2.0: página isolada, temas e galeria moderna === */
html[data-tiv-theme="light"] {
    color-scheme: light;
}

html[data-tiv-theme="dark"] {
    color-scheme: dark;
    --tiv-black: #f6f6f6;
    --tiv-white: #090909;
    --tiv-gray-50: #111111;
    --tiv-gray-100: #171717;
    --tiv-gray-200: #2b2b2b;
    --tiv-gray-500: #a5a5a5;
    --tiv-gray-700: #e3e3e3;
}

body.tiv-standalone {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    background: var(--tiv-white);
    color: var(--tiv-black);
    font-family: "Montserrat", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body.tiv-standalone *,
body.tiv-standalone *::before,
body.tiv-standalone *::after {
    box-sizing: border-box;
}

body.tiv-standalone button,
body.tiv-standalone input,
body.tiv-standalone textarea,
body.tiv-standalone select {
    font: inherit;
}

body.tiv-standalone .tiv-wizard-shell {
    min-height: 100vh;
}

.tiv-theme-toggle {
    white-space: nowrap;
}

.tiv-clear-answer {
    display: inline-flex;
    margin-top: 11px;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--tiv-gray-500);
    font-size: 11px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.tiv-clear-answer:hover {
    color: var(--tiv-blue);
}

.tiv-clear-answer--inline {
    margin-top: 9px;
}

/* Galeria de referências. */
.tiv-reference-grid {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
}

.tiv-reference-card {
    display: flex;
    aspect-ratio: auto;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--tiv-gray-200);
    border-radius: 14px;
    background: var(--tiv-white);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .055);
    cursor: default;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.tiv-reference-card:hover {
    border-color: rgba(0, 65, 200, .58);
    box-shadow: 0 16px 38px rgba(0, 0, 0, .09);
    transform: translateY(-2px);
}

.tiv-reference-card.is-selected {
    border-color: var(--tiv-blue);
    box-shadow: 0 0 0 2px rgba(0, 65, 200, .12), 0 16px 38px rgba(0, 0, 0, .09);
}

.tiv-reference-open {
    position: relative;
    display: block;
    width: 100%;
    border: 0;
    padding: 0;
    background: var(--tiv-gray-50);
    color: inherit;
    cursor: zoom-in;
}

.tiv-reference-media {
    display: flex;
    width: 100%;
    aspect-ratio: 4 / 3;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 10px;
    background:
        linear-gradient(45deg, rgba(127,127,127,.055) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(127,127,127,.055) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(127,127,127,.055) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(127,127,127,.055) 75%);
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-size: 16px 16px;
}

.tiv-reference-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform .22s ease;
}

.tiv-reference-open:hover .tiv-reference-media img {
    transform: scale(1.025);
}

.tiv-reference-zoom {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    border-radius: 999px;
    padding: 0 11px;
    background: rgba(0, 0, 0, .78);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .03em;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .18s ease, transform .18s ease;
}

.tiv-reference-open:hover .tiv-reference-zoom,
.tiv-reference-open:focus-visible .tiv-reference-zoom {
    opacity: 1;
    transform: translateY(0);
}

.tiv-reference-select {
    position: relative;
    display: flex;
    min-height: 48px;
    align-items: center;
    gap: 9px;
    border-top: 1px solid var(--tiv-gray-200);
    padding: 10px 13px;
    background: var(--tiv-white);
    color: var(--tiv-black);
    cursor: pointer;
}

.tiv-reference-select input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tiv-reference-select-icon {
    display: inline-flex;
    width: 22px;
    height: 22px;
    align-items: center;
    justify-content: center;
    flex: 0 0 22px;
    border: 1px solid var(--tiv-gray-200);
    border-radius: 50%;
    background: var(--tiv-white);
    color: transparent;
    font-size: 11px;
    font-weight: 700;
}

.tiv-reference-select-label {
    font-size: 11px;
    font-weight: 700;
}

.tiv-reference-select input:checked + .tiv-reference-select-icon {
    border-color: var(--tiv-blue);
    background: var(--tiv-blue);
    color: #fff;
}

.tiv-reference-grid--static .tiv-reference-card {
    display: block;
}

.tiv-reference-grid--static .tiv-reference-media {
    aspect-ratio: 4 / 3;
}

.tiv-gallery-caption {
    margin-top: 13px;
    font-size: 11px;
}

/* Modal de ampliação. */
body.tiv-lightbox-open {
    overflow: hidden;
}

.tiv-lightbox[hidden] {
    display: none !important;
}

.tiv-lightbox {
    position: fixed;
    z-index: 999999;
    inset: 0;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 24px;
}

.tiv-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .9);
    backdrop-filter: blur(7px);
}

.tiv-lightbox-dialog {
    position: relative;
    z-index: 1;
    display: flex;
    width: min(1180px, 100%);
    min-height: 0;
    flex-direction: column;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 16px;
    background: #0b0b0b;
    color: #fff;
    box-shadow: 0 30px 100px rgba(0,0,0,.5);
}

.tiv-lightbox-toolbar {
    display: flex;
    min-height: 64px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid rgba(255,255,255,.12);
    padding: 10px 14px 10px 20px;
}

.tiv-lightbox-toolbar > div {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tiv-lightbox-counter {
    color: rgba(255,255,255,.7);
    font-size: 12px;
    font-weight: 700;
}

.tiv-lightbox-close,
.tiv-lightbox-select,
.tiv-lightbox-nav {
    border: 1px solid rgba(255,255,255,.2);
    background: rgba(255,255,255,.08);
    color: #fff;
    cursor: pointer;
}

.tiv-lightbox-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 25px;
    line-height: 1;
}

.tiv-lightbox-select {
    min-height: 40px;
    border-radius: 999px;
    padding: 0 15px;
    font-size: 11px;
    font-weight: 700;
}

.tiv-lightbox-select.is-selected {
    border-color: var(--tiv-blue);
    background: var(--tiv-blue);
}

.tiv-lightbox-stage {
    display: grid;
    min-height: 0;
    flex: 1;
    grid-template-columns: 56px minmax(0, 1fr) 56px;
    align-items: center;
    gap: 12px;
    padding: 18px;
}

.tiv-lightbox-stage figure {
    display: flex;
    min-width: 0;
    min-height: 0;
    height: min(76vh, 820px);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    margin: 0;
}

.tiv-lightbox-stage img {
    display: block;
    max-width: 100%;
    max-height: calc(100% - 34px);
    object-fit: contain;
}

.tiv-lightbox-stage figcaption {
    min-height: 24px;
    margin-top: 10px;
    color: rgba(255,255,255,.72);
    font-size: 12px;
    text-align: center;
}

.tiv-lightbox-nav {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 34px;
    line-height: 1;
}

.tiv-lightbox-close:hover,
.tiv-lightbox-select:hover,
.tiv-lightbox-nav:hover {
    border-color: var(--tiv-blue);
    background: var(--tiv-blue);
}

/* Próximos passos. */
.tiv-next-steps {
    margin: 0 0 26px;
    padding: 28px;
    border: 1px solid var(--tiv-gray-200);
    border-left: 4px solid var(--tiv-blue);
    background: var(--tiv-white);
}

.tiv-next-steps .tiv-question-heading h3 {
    margin: 0 0 7px;
    font-size: 20px;
}

.tiv-next-steps-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.tiv-next-steps-grid article {
    min-height: 180px;
    border: 1px solid var(--tiv-gray-200);
    padding: 20px;
    background: var(--tiv-gray-50);
}

.tiv-next-steps-grid article > span {
    display: block;
    margin-bottom: 24px;
    color: var(--tiv-blue);
    font-size: 11px;
    font-weight: 700;
}

.tiv-next-steps-grid h4 {
    margin: 0 0 9px;
    font-size: 15px;
}

.tiv-next-steps-grid p {
    margin: 0;
    color: var(--tiv-gray-500);
    font-size: 12px;
    line-height: 1.65;
}

.tiv-next-steps-grid strong {
    color: var(--tiv-black);
}

/* Relatório: imagens clicáveis. */
.tiv-report-reference-grid > div,
.tiv-report-reference {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border: 1px solid var(--tiv-gray-200);
    padding: 0;
    background: var(--tiv-gray-100);
    cursor: zoom-in;
}

.tiv-report-reference img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Acesso restrito. */
.tiv-access-message {
    width: min(680px, calc(100% - 40px));
    margin: 12vh auto 0;
    border: 1px solid var(--tiv-gray-200);
    border-left: 4px solid var(--tiv-blue);
    padding: 38px;
    background: var(--tiv-white);
}

.tiv-access-message h1 {
    margin: 0 0 14px;
    font-size: clamp(28px, 5vw, 48px);
    line-height: 1.05;
}

.tiv-access-message p {
    margin: 0;
    color: var(--tiv-gray-500);
}

/* Ajustes do tema escuro para fundos antes fixos. */
html[data-tiv-theme="dark"] .tiv-info-callout,
html[data-tiv-theme="dark"] .tiv-option-card:has(input:checked),
html[data-tiv-theme="dark"] .tiv-summary-preview {
    background: #10182b;
}

html[data-tiv-theme="dark"] .tiv-wizard-footer {
    background: rgba(9,9,9,.96);
}

html[data-tiv-theme="dark"] .tiv-reference-card {
    box-shadow: 0 10px 28px rgba(0,0,0,.28);
}

html[data-tiv-theme="dark"] .tiv-report-shell {
    background: #050505;
}

html[data-tiv-theme="dark"] .tiv-button--primary,
html[data-tiv-theme="dark"] .tiv-inline-options input:checked + span,
html[data-tiv-theme="dark"] .tiv-reference-select input:checked + .tiv-reference-select-icon {
    color: #fff;
}

html[data-tiv-theme="dark"] .tiv-button--primary:hover {
    border-color: #fff;
    background: #fff;
    color: #000;
}

@media (max-width: 900px) {
    .tiv-reference-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tiv-next-steps-grid {
        grid-template-columns: 1fr;
    }

    .tiv-next-steps-grid article {
        min-height: 0;
    }
}

@media (max-width: 600px) {
    .tiv-reference-grid {
        grid-template-columns: 1fr;
    }

    .tiv-lightbox {
        padding: 0;
    }

    .tiv-lightbox-dialog {
        border: 0;
        border-radius: 0;
    }

    .tiv-lightbox-stage {
        grid-template-columns: 42px minmax(0, 1fr) 42px;
        gap: 4px;
        padding: 8px;
    }

    .tiv-lightbox-nav {
        width: 38px;
        height: 38px;
        font-size: 28px;
    }

    .tiv-lightbox-stage figure {
        height: calc(100vh - 100px);
    }

    .tiv-next-steps,
    .tiv-access-message {
        padding: 22px;
    }
}

@media print {
    .tiv-theme-toggle,
    .tiv-lightbox {
        display: none !important;
    }
}

/* === Atualização 0.3.0: relatório e PDF editorial === */
.tiv-report-shell {
    --tiv-report-ink: #111318;
    --tiv-report-muted: #657080;
    --tiv-report-line: #dfe4ec;
    --tiv-report-soft: #f5f7fa;
    --tiv-report-paper: #ffffff;
}

.tiv-report-shell--pdf {
    min-height: 100vh;
    background: #e9edf3;
    color: var(--tiv-report-ink);
}

.tiv-report-shell--pdf .tiv-report-document {
    width: min(210mm, calc(100% - 24px));
    max-width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    padding: 22mm 18mm 18mm;
    box-shadow: 0 24px 70px rgba(18, 31, 53, .15);
}

.tiv-report-document {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(17, 19, 24, .08);
}

.tiv-report-header {
    position: relative;
    margin-bottom: 20px;
    border-bottom: 0;
    padding: 4px 0 28px 22px;
}

.tiv-report-header-mark {
    position: absolute;
    top: 0;
    bottom: 28px;
    left: 0;
    width: 5px;
    background: #0041C8;
}

.tiv-report-header > span {
    color: #0041C8;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .15em;
}

.tiv-report-header h1 {
    max-width: 760px;
    margin-top: 18px;
    color: var(--tiv-report-ink);
    font-size: clamp(31px, 5vw, 48px);
}

.tiv-report-header p {
    color: var(--tiv-report-muted);
}

.tiv-report-meta-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin: 0 0 38px;
    background: var(--tiv-report-line);
}

.tiv-report-meta-strip > div {
    min-height: 82px;
    padding: 16px;
    background: var(--tiv-report-soft);
}

.tiv-report-meta-strip span {
    display: block;
    margin-bottom: 9px;
    color: var(--tiv-report-muted);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.tiv-report-meta-strip strong {
    color: var(--tiv-report-ink);
    font-size: 12px;
    line-height: 1.45;
}

.tiv-report-section {
    position: relative;
    margin-bottom: 34px;
}

.tiv-report-section h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom-color: var(--tiv-report-line);
    color: var(--tiv-report-ink);
    font-size: 17px;
}

.tiv-report-section h2::before {
    width: 18px;
    height: 3px;
    background: #0041C8;
    content: "";
}

.tiv-report-grid {
    gap: 10px;
    background: transparent;
}

.tiv-report-row {
    min-height: 88px;
    border: 1px solid var(--tiv-report-line);
    padding: 16px 17px;
    background: var(--tiv-report-paper);
}

.tiv-report-row span {
    color: var(--tiv-report-muted);
}

.tiv-report-row strong {
    color: var(--tiv-report-ink);
    font-size: 12.5px;
}

.tiv-report-reference-group {
    break-inside: avoid;
    margin-bottom: 24px;
}

.tiv-report-reference-group h3 {
    margin-bottom: 12px;
    color: var(--tiv-report-ink);
    font-size: 12px;
}

.tiv-report-reference-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.tiv-report-reference {
    border-color: var(--tiv-report-line);
    border-radius: 8px;
    background: var(--tiv-report-soft);
}

.tiv-report-reference img {
    object-fit: contain;
    padding: 6px;
}

.tiv-report-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 44px;
    border-top: 1px solid var(--tiv-report-line);
    padding-top: 15px;
    color: var(--tiv-report-muted);
    font-size: 9px;
}

.tiv-report-footer strong {
    color: var(--tiv-report-ink);
    font-size: 9px;
}

html[data-tiv-theme="dark"] .tiv-report-shell:not(.tiv-report-shell--pdf) {
    --tiv-report-ink: #f4f6fa;
    --tiv-report-muted: #a8b0bd;
    --tiv-report-line: #303642;
    --tiv-report-soft: #151820;
    --tiv-report-paper: #0b0d11;
}

.tiv-report-shell--pdf,
.tiv-report-shell--pdf .tiv-report-document,
.tiv-report-shell--pdf .tiv-report-section,
.tiv-report-shell--pdf .tiv-report-row,
.tiv-report-shell--pdf .tiv-report-meta-strip > div {
    color-scheme: light;
}

@media (max-width: 800px) {
    .tiv-report-meta-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tiv-report-reference-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media print {
    @page {
        size: A4 portrait;
        margin: 12mm 11mm 14mm;
    }

    html,
    body,
    body.tiv-standalone,
    html[data-tiv-theme="dark"] {
        background: #fff !important;
        color: #111318 !important;
        color-scheme: light !important;
    }

    .tiv-report-shell,
    .tiv-report-shell--pdf {
        min-height: 0;
        padding: 0 !important;
        background: #fff !important;
        --tiv-report-ink: #111318;
        --tiv-report-muted: #657080;
        --tiv-report-line: #dfe4ec;
        --tiv-report-soft: #f5f7fa;
        --tiv-report-paper: #ffffff;
    }

    .tiv-report-document,
    .tiv-report-shell--pdf .tiv-report-document {
        width: 100%;
        max-width: none;
        min-height: 0;
        border: 0;
        padding: 0 !important;
        box-shadow: none;
    }

    .tiv-report-header {
        padding-bottom: 18px;
    }

    .tiv-report-header h1 {
        font-size: 29px;
    }

    .tiv-report-meta-strip {
        margin-bottom: 24px;
    }

    .tiv-report-meta-strip > div {
        min-height: 66px;
        padding: 11px;
        background: #f5f7fa !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .tiv-report-section {
        margin-bottom: 23px;
    }

    .tiv-report-section,
    .tiv-report-reference-group,
    .tiv-report-row,
    .tiv-report-reference {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .tiv-report-section h2 {
        font-size: 15px;
    }

    .tiv-report-section h2::before,
    .tiv-report-header-mark {
        background: #0041C8 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

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

    .tiv-report-row {
        min-height: 70px;
        padding: 11px 12px;
        background: #fff !important;
    }

    .tiv-report-row strong {
        font-size: 10.5px;
        line-height: 1.45;
    }

    .tiv-report-reference-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 7px;
    }

    .tiv-report-reference {
        border-radius: 4px;
        background: #f5f7fa !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .tiv-report-footer {
        margin-top: 26px;
    }
}

.tiv-report-shell--pdf {
    --tiv-black: #111318;
    --tiv-white: #ffffff;
    --tiv-gray-50: #f7f8fa;
    --tiv-gray-100: #f1f3f6;
    --tiv-gray-200: #dfe4ec;
    --tiv-gray-500: #657080;
    --tiv-gray-700: #303744;
}

@media print {
    .tiv-report-reference {
        height: 36mm;
    }
}

/* === Atualização 0.4.0: telas configuráveis de abertura e encerramento === */
.tiv-presentation-heading {
    margin-bottom: 30px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--tiv-gray-200);
}

.tiv-presentation-heading--closing {
    border-bottom-color: var(--tiv-blue);
}

.tiv-presentation-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.tiv-presentation-card {
    min-height: 190px;
    border: 1px solid var(--tiv-gray-200);
    border-top: 4px solid var(--tiv-blue);
    padding: 24px;
    background: var(--tiv-white);
}

.tiv-presentation-card > span {
    display: block;
    margin-bottom: 34px;
    color: var(--tiv-blue);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
}

.tiv-presentation-card h3 {
    margin: 0 0 10px;
    color: var(--tiv-black);
    font-size: 18px;
    line-height: 1.3;
}

.tiv-presentation-card p {
    margin: 0;
    color: var(--tiv-gray-500);
    font-size: 13px;
    line-height: 1.7;
}

.tiv-presentation-grid--closing .tiv-presentation-card:last-child {
    background: var(--tiv-blue);
    border-color: var(--tiv-blue);
}

.tiv-presentation-grid--closing .tiv-presentation-card:last-child > span,
.tiv-presentation-grid--closing .tiv-presentation-card:last-child h3,
.tiv-presentation-grid--closing .tiv-presentation-card:last-child p {
    color: #fff;
}

.tiv-report-section-intro {
    max-width: 780px;
    margin: -4px 0 18px;
    color: var(--tiv-gray-500);
    font-size: 12px;
    line-height: 1.65;
}

html[data-tiv-theme="dark"] .tiv-presentation-card {
    background: var(--tiv-white);
}

@media (max-width: 760px) {
    .tiv-presentation-grid {
        grid-template-columns: 1fr;
    }

    .tiv-presentation-card {
        min-height: 0;
    }
}
