:root {
    --blue-900: #0b3d2e;
    --blue-700: #147a52;
    --blue-100: #e8f6ef;
    --green-900: #0b3d2e;
    --green-700: #147a52;
    --green-500: #22a06b;
    --green-100: #e5f6ed;
    --green-50: #f3fbf7;
    --red-700: #b42318;
    --red-100: #feeceb;
    --background: #f2f7f4;
    --surface: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #d8e7df;
    --shadow: 0 8px 24px rgba(11, 61, 46, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    font-family: "Segoe UI", Arial, sans-serif;
    color: var(--text);
    background: var(--background);
}

a {
    color: inherit;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 18px;
    color: #fff;
    background: linear-gradient(180deg, #0b3d2e 0%, #0d563d 100%);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 28px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-weight: 800;
    background: #fff;
    color: var(--green-900);
}

.brand strong,
.brand small {
    display: block;
}

.brand small {
    margin-top: 3px;
    color: #c9d9e9;
}

.menu {
    display: grid;
    gap: 6px;
}

.menu a {
    padding: 12px 14px;
    border-radius: 10px;
    color: #dce9f5;
    text-decoration: none;
    transition: 0.2s ease;
}

.menu a:hover,
.menu a.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
}

.content-area {
    min-width: 0;
    max-width: 100%;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
    padding: 0 30px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    background: var(--surface);
}

.menu-button {
    display: none;
    border: 0;
    font-size: 24px;
    color: var(--blue-900);
    background: transparent;
    cursor: pointer;
}

.page-content {
    width: min(1400px, 100%);
    margin: 0 auto;
    padding: 32px;
}

.page-header {
    margin-bottom: 24px;
}

.page-header-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.page-header h1 {
    margin: 0 0 6px;
    font-size: clamp(26px, 4vw, 36px);
    color: var(--blue-900);
}

.page-header p,
.panel p {
    margin: 0;
    color: var(--muted);
}

.cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.card,
.panel {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.card {
    padding: 22px;
}

.card span {
    display: block;
    margin-bottom: 12px;
    color: var(--muted);
}

.card strong {
    font-size: 34px;
    color: var(--blue-700);
}

.card-featured {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, var(--green-900), var(--green-500));
}

.card-featured span,
.card-featured strong {
    color: #fff;
}

.panel {
    padding: 24px;
}

.panel h2 {
    margin: 0 0 10px;
    color: var(--blue-900);
}

.button {
    display: inline-block;
    border: 1px solid var(--blue-700);
    padding: 11px 16px;
    border-radius: 9px;
    font: inherit;
    font-weight: 600;
    color: #fff;
    background: var(--blue-700);
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    filter: brightness(0.95);
}

.button-secondary {
    border-color: var(--border);
    color: var(--blue-900);
    background: #fff;
}

.button-success {
    border-color: var(--green-700);
    color: var(--green-700);
    background: var(--green-100);
}

.button-danger {
    border-color: #f2c4c0;
    color: var(--red-700);
    background: var(--red-100);
}

.button-small {
    padding: 7px 10px;
    font-size: 14px;
}

.error-page {
    text-align: center;
}

.alert {
    margin-bottom: 18px;
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--blue-100);
}

.alert-success {
    color: var(--green-700);
    background: var(--green-100);
}

.alert-danger,
.alert-error {
    color: var(--red-700);
    background: var(--red-100);
}

.filter-panel {
    margin-bottom: 20px;
}

.filter-form {
    display: flex;
    align-items: end;
    gap: 14px;
}

.field {
    display: grid;
    gap: 7px;
}

.field-grow {
    flex: 1;
}

.field-full {
    grid-column: 1 / -1;
}

.field label {
    font-size: 14px;
    font-weight: 650;
    color: var(--blue-900);
}

.field input,
.field select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 10px 12px;
    font: inherit;
    color: var(--text);
    background: #fff;
    outline: none;
}

.field input:focus,
.field select:focus {
    border-color: var(--blue-700);
    box-shadow: 0 0 0 3px rgba(31, 95, 159, 0.12);
}

.field input.input-error {
    border-color: var(--red-700);
}

.field-error {
    color: var(--red-700);
}

.filter-actions,
.form-actions,
.row-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

.table-panel {
    padding: 0;
    overflow: hidden;
}

.table-summary {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 15px 18px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

th {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    background: #f9fbfd;
}

tbody tr:hover {
    background: var(--green-50);
}

.text-right {
    text-align: right;
}

.row-actions {
    justify-content: flex-end;
}

.row-actions form {
    margin: 0;
}

.badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 13px;
    font-weight: 650;
}

.badge-success {
    color: var(--green-700);
    background: var(--green-100);
}

.badge-muted {
    color: var(--muted);
    background: #edf1f5;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 18px;
}

.pagination a,
.pagination span {
    display: grid;
    place-items: center;
    min-width: 36px;
    height: 36px;
    border-radius: 8px;
    text-decoration: none;
}

.pagination a {
    border: 1px solid var(--border);
    background: #fff;
}

.pagination a.active {
    border-color: var(--blue-700);
    color: #fff;
    background: var(--blue-700);
}

.empty-state {
    padding: 56px 24px;
    text-align: center;
}

.empty-state h2 {
    margin: 0 0 8px;
    color: var(--blue-900);
}

.eyebrow {
    display: block;
    margin-bottom: 7px;
    color: var(--green-700);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.field textarea {
    width: 100%;
    min-height: 90px;
    resize: vertical;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 10px 12px;
    font: inherit;
    color: var(--text);
    background: #fff;
    outline: none;
}

.field textarea:focus {
    border-color: var(--green-700);
    box-shadow: 0 0 0 3px rgba(20, 122, 82, 0.12);
}

.field-help {
    color: var(--muted);
    font-size: 12px;
}

.form-section {
    margin-bottom: 22px;
}

.section-title {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 24px;
}

.section-title h2,
.section-title p {
    margin: 0;
}

.section-title p {
    margin-top: 4px;
}

.step-number {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #fff;
    font-weight: 800;
    background: var(--green-700);
}

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

.document-option {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 82px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    background: #fff;
    cursor: pointer;
    transition: 0.18s ease;
}

.document-option:hover,
.document-option.selected {
    border-color: var(--green-500);
    background: var(--green-50);
}

.document-option input {
    position: absolute;
    opacity: 0;
}

.checkmark {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 27px;
    height: 27px;
    border: 2px solid #b7d2c4;
    border-radius: 7px;
    color: transparent;
}

.document-option.selected .checkmark {
    color: #fff;
    border-color: var(--green-700);
    background: var(--green-700);
}

.document-option strong,
.document-option small {
    display: block;
}

.document-option small {
    margin-top: 4px;
    color: var(--muted);
}

.conditional-section {
    display: none;
}

.conditional-section.visible {
    display: block;
}

.dynamic-table-wrap {
    margin-bottom: 14px;
    overflow-x: auto;
}

.dynamic-table input {
    min-width: 94px;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 8px;
    font: inherit;
}

.dynamic-table th,
.dynamic-table td {
    padding: 9px;
}

.dynamic-table th:nth-child(2),
.dynamic-table td:nth-child(2) {
    min-width: 260px;
}

.icon-button {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    color: var(--red-700);
    background: var(--red-100);
    font-size: 21px;
    cursor: pointer;
}

.repeater-list {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.repeater-row {
    display: flex;
    gap: 8px;
}

.repeater-row input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 10px 12px;
    font: inherit;
}

.sticky-actions {
    position: sticky;
    z-index: 5;
    bottom: 14px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-top: 20px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.detail-grid,
.dashboard-layout,
.report-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 20px;
    margin-bottom: 22px;
}

.detail-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin: 20px 0 0;
}

.detail-list div {
    border-left: 3px solid #bce2ce;
    padding-left: 12px;
}

.detail-list dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.detail-list dd {
    margin: 5px 0 0;
    font-weight: 650;
}

.action-stack {
    display: grid;
    gap: 9px;
}

.action-stack form,
.action-stack .button {
    width: 100%;
    margin: 0;
    text-align: center;
}

.documents-list {
    display: grid;
    gap: 16px;
}

.document-card-head,
.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.document-card-head h2,
.document-card-head p,
.panel-heading h2,
.panel-heading p {
    margin: 0;
}

.document-card-head p,
.panel-heading p {
    margin-top: 4px;
}

.document-index {
    float: left;
    margin-right: 12px;
    color: #9abbaa;
    font-size: 24px;
    font-weight: 800;
}

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

.file-link {
    display: grid;
    gap: 5px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    text-decoration: none;
    background: var(--green-50);
}

.file-format {
    color: var(--green-700);
    font-size: 12px;
    font-weight: 800;
}

.file-link small {
    color: var(--muted);
}

.preview-link,
.text-link {
    color: var(--green-700);
    font-weight: 700;
    text-decoration: none;
}

.preview-link {
    display: inline-block;
    margin-top: 14px;
}

.empty-inline {
    margin-top: 18px;
    border: 1px dashed #bcd2c7;
    border-radius: 10px;
    padding: 18px;
    color: var(--muted);
    text-align: center;
    background: var(--green-50);
}

.badge-large {
    padding: 8px 13px;
}

.badge-soft {
    color: var(--green-700);
    background: var(--green-100);
}

.status-rascunho,
.status-pendente {
    color: #725600;
    background: #fff4c2;
}

.status-processando {
    color: #1769aa;
    background: #e7f2fc;
}

.status-concluida,
.status-concluido {
    color: var(--green-700);
    background: var(--green-100);
}

.status-erro,
.status-cancelada {
    color: var(--red-700);
    background: var(--red-100);
}

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

.ranking-list,
.activity-list {
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
}

.ranking-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
}

.activity-list a {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    text-decoration: none;
}

.activity-list small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
}

.activity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--green-500);
}

.quick-actions {
    display: grid;
    align-content: start;
    gap: 10px;
}

.quick-action {
    display: grid;
    gap: 5px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 13px;
    text-decoration: none;
    background: var(--green-50);
}

.quick-action span {
    color: var(--green-700);
    font-size: 13px;
}

.empty-state p {
    margin-bottom: 20px;
}

.form-panel {
    max-width: 900px;
}

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

.form-actions {
    justify-content: flex-end;
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

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

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

    .detail-grid,
    .dashboard-layout,
    .report-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: fixed;
        z-index: 20;
        width: 260px;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .menu-button {
        display: block;
    }

    .topbar {
        padding: 0 18px;
    }

    .page-content {
        padding: 24px 18px;
    }

    .cards {
        grid-template-columns: 1fr;
    }

    .page-header-actions,
    .filter-form {
        align-items: stretch;
        flex-direction: column;
    }

    .page-header-actions .button,
    .filter-actions .button {
        text-align: center;
    }

    .filter-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .field-full {
        grid-column: auto;
    }

    .form-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .form-actions .button {
        width: 100%;
        text-align: center;
    }

    .document-grid,
    .file-grid,
    .detail-list {
        grid-template-columns: 1fr;
    }

    .sticky-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .sticky-actions .button {
        width: 100%;
        text-align: center;
    }
}

/* Refinamento visual e telas de autenticação/administração */
:root {
    --green-950: #073b2a;
    --green-900: #0a4a35;
    --green-800: #0f6446;
    --green-700: #147a52;
    --green-600: #188b5e;
    --green-500: #22a06b;
    --green-100: #e4f4eb;
    --green-50: #f1faf5;
    --background: #f3f6f4;
    --surface: #ffffff;
    --text: #17221d;
    --muted: #66736c;
    --border: #dce6e0;
    --shadow: 0 10px 30px rgba(7, 59, 42, 0.07);
    --shadow-strong: 0 24px 60px rgba(7, 59, 42, 0.16);
}

body {
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    line-height: 1.5;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

.app-shell {
    grid-template-columns: 276px minmax(0, 1fr);
}

.sidebar {
    z-index: 30;
    display: flex;
    flex-direction: column;
    width: 276px;
    overflow-y: auto;
    padding: 22px 16px 18px;
    background:
        radial-gradient(circle at 15% 0%, rgba(55, 194, 128, 0.18), transparent 32%),
        linear-gradient(180deg, var(--green-950), #062f23 100%);
    box-shadow: 8px 0 30px rgba(7, 59, 42, 0.08);
}

.brand {
    min-height: 66px;
    padding: 0 9px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    font-size: 14px;
    letter-spacing: 0.04em;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
}

.brand strong {
    font-size: 17px;
}

.brand small {
    color: rgba(255, 255, 255, 0.62);
    font-size: 12px;
}

.menu {
    align-content: start;
    flex: 1;
    gap: 4px;
    padding-top: 18px;
}

.menu-label {
    margin: 15px 12px 6px;
    color: rgba(255, 255, 255, 0.42);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.menu-label:first-child {
    margin-top: 0;
}

.menu a {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.76);
    font-size: 14px;
    font-weight: 600;
}

.menu a:hover {
    background: rgba(255, 255, 255, 0.08);
}

.menu a.active {
    border-color: rgba(255, 255, 255, 0.08);
    background: linear-gradient(90deg, rgba(45, 186, 118, 0.28), rgba(255, 255, 255, 0.08));
    box-shadow: inset 3px 0 0 #5bd39b;
}

.menu-icon {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    color: #83dfb4;
    font-size: 14px;
}

.sidebar-footer {
    display: grid;
    gap: 2px;
    margin-top: 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 14px;
    color: rgba(255, 255, 255, 0.76);
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-footer span,
.sidebar-footer small {
    color: rgba(255, 255, 255, 0.48);
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.sidebar-footer strong {
    font-size: 12px;
}

.topbar {
    position: sticky;
    z-index: 15;
    top: 0;
    height: 74px;
    padding: 0 32px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 1px 0 var(--border);
    backdrop-filter: blur(14px);
}

.topbar-context,
.user-menu,
.identity-cell {
    display: flex;
    align-items: center;
}

.topbar-context {
    gap: 12px;
}

.topbar-context strong,
.topbar-context small,
.user-info strong,
.user-info small,
.identity-cell strong,
.identity-cell small {
    display: block;
}

.topbar-context strong {
    color: var(--green-950);
    font-size: 14px;
}

.topbar-context small,
.user-info small,
.identity-cell small {
    color: var(--muted);
    font-size: 11px;
}

.user-menu {
    gap: 10px;
}

.user-avatar,
.mini-avatar {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    font-weight: 800;
    background: linear-gradient(135deg, var(--green-800), var(--green-500));
}

.user-avatar {
    width: 38px;
    height: 38px;
}

.mini-avatar {
    width: 36px;
    height: 36px;
}

.user-info {
    min-width: 120px;
}

.user-info strong {
    max-width: 180px;
    overflow: hidden;
    color: var(--text);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu form {
    margin: 0;
}

.logout-button {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 10px;
    color: var(--muted);
    background: #fff;
    cursor: pointer;
}

.logout-button:hover {
    color: var(--red-700);
    border-color: #f2c4c0;
    background: var(--red-100);
}

.page-content {
    padding: 34px clamp(20px, 3vw, 42px) 50px;
}

.page-header {
    padding-bottom: 4px;
}

.page-header h1 {
    color: var(--green-950);
    font-size: clamp(28px, 3vw, 38px);
    font-weight: 750;
    letter-spacing: -0.035em;
}

.card,
.panel {
    border-color: var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
}

.card {
    position: relative;
    overflow: hidden;
    min-height: 128px;
}

.card::after {
    position: absolute;
    top: 0;
    right: 0;
    width: 64px;
    height: 4px;
    border-radius: 0 0 0 4px;
    background: var(--green-500);
    content: "";
}

.card strong {
    color: var(--green-800);
    font-weight: 750;
}

.panel {
    padding: 26px;
}

.table-panel {
    padding: 0;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border-color: var(--green-700);
    border-radius: 9px;
    background: linear-gradient(180deg, var(--green-600), var(--green-700));
    box-shadow: 0 5px 14px rgba(20, 122, 82, 0.14);
    transition: transform 0.15s ease, filter 0.15s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button-secondary,
.button-success,
.button-danger {
    box-shadow: none;
}

.button-secondary {
    background: #fff;
}

.button[disabled] {
    opacity: 0.45;
    pointer-events: none;
}

.filter-form {
    flex-wrap: wrap;
}

.filter-form > .field:not(.field-grow) {
    min-width: 150px;
}

.filter-form .field-grow {
    min-width: min(280px, 100%);
}

.field input,
.field select,
.field textarea {
    border-color: #cedbd4;
    border-radius: 9px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--green-600);
    box-shadow: 0 0 0 4px rgba(24, 139, 94, 0.11);
}

.table-responsive {
    width: 100%;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

th {
    color: #5e6d65;
    background: #f7faf8;
}

td {
    color: #33433b;
}

.sidebar-backdrop {
    display: none;
}

.permission-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.permission-cards article {
    display: grid;
    gap: 4px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    background: #fff;
}

.permission-cards strong {
    color: var(--green-900);
}

.permission-cards span {
    color: var(--muted);
    font-size: 13px;
}

.identity-cell {
    gap: 10px;
}

.access-pill,
.audit-action {
    display: inline-flex;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.access-administrador {
    color: #6d3a00;
    background: #fff0d2;
}

.access-operador {
    color: var(--green-800);
    background: var(--green-100);
}

.access-consulta {
    color: #365b7b;
    background: #e9f2fa;
}

.audit-filters > .field {
    flex: 1 1 145px;
}

.audit-description {
    min-width: 260px;
    white-space: normal;
}

.audit-action {
    color: #365b7b;
    background: #e9f2fa;
}

.action-cadastrou,
.action-gerou,
.action-login {
    color: var(--green-800);
    background: var(--green-100);
}

.action-excluiu,
.action-login_falhou,
.action-erro_geracao {
    color: var(--red-700);
    background: var(--red-100);
}

.single-column {
    grid-template-columns: 1fr;
}

.break-text {
    overflow-wrap: anywhere;
}

.audit-message {
    margin-top: 22px;
    border-radius: 10px;
    padding: 16px;
    background: var(--green-50);
}

.audit-message p {
    margin: 5px 0 0;
}

.audit-json {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.audit-json > div {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    background: #f8faf9;
}

.audit-json pre {
    max-width: 100%;
    overflow-x: auto;
    margin: 9px 0 0;
    color: #294338;
    white-space: pre-wrap;
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 78px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 7px;
    border: 0;
    padding: 6px 7px;
    color: var(--green-700);
    background: transparent;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transform: translateY(-50%);
}

.switch-field {
    display: flex;
    align-items: center;
    gap: 12px;
    width: fit-content;
    cursor: pointer;
}

.switch-field input {
    position: absolute;
    opacity: 0;
}

.switch-control {
    position: relative;
    width: 46px;
    height: 26px;
    border-radius: 99px;
    background: #b9c5bf;
    transition: 0.2s ease;
}

.switch-control::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
    content: "";
    transition: 0.2s ease;
}

.switch-field input:checked + .switch-control {
    background: var(--green-600);
}

.switch-field input:checked + .switch-control::after {
    transform: translateX(20px);
}

.switch-field strong,
.switch-field small {
    display: block;
}

.switch-field small {
    color: var(--muted);
    font-size: 12px;
}

.error-code {
    display: block;
    color: var(--green-200, #b9e3cc);
    font-size: 76px;
    font-weight: 900;
}

/* Login */
.login-page {
    overflow-x: hidden;
    background: #eef4f0;
}

.login-layout {
    display: grid;
    grid-template-columns: minmax(360px, 0.9fr) minmax(480px, 1.1fr);
    min-height: 100vh;
}

.login-presentation {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100vh;
    padding: clamp(32px, 5vw, 72px);
    color: #fff;
    background:
        radial-gradient(circle at 10% 12%, rgba(82, 216, 151, 0.28), transparent 28%),
        radial-gradient(circle at 95% 88%, rgba(47, 171, 111, 0.24), transparent 32%),
        linear-gradient(145deg, #073b2a, #0a563b 58%, #0c6846);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 13px;
    font-size: 19px;
}

.login-copy {
    max-width: 580px;
}

.login-kicker {
    color: #83dfb4;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.login-copy h1 {
    margin: 18px 0;
    font-size: clamp(38px, 4.5vw, 64px);
    line-height: 1.03;
    letter-spacing: -0.055em;
}

.login-copy p {
    max-width: 510px;
    margin: 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: 18px;
}

.login-presentation > small {
    color: rgba(255, 255, 255, 0.48);
}

.login-form-side {
    display: grid;
    place-items: center;
    padding: clamp(24px, 6vw, 80px);
}

.login-card {
    width: min(440px, 100%);
    border: 1px solid rgba(220, 230, 224, 0.85);
    border-radius: 18px;
    padding: clamp(26px, 4vw, 42px);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow-strong);
}

.login-card-head {
    margin-bottom: 26px;
}

.login-card-head h2 {
    margin: 4px 0 8px;
    color: var(--green-950);
    font-size: 30px;
    letter-spacing: -0.035em;
}

.login-card-head p {
    margin: 0;
    color: var(--muted);
}

.login-card form {
    display: grid;
    gap: 18px;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
}

.checkbox-field input {
    width: 17px;
    height: 17px;
    accent-color: var(--green-700);
}

.login-submit {
    width: 100%;
    min-height: 48px;
}

.login-security {
    display: block;
    margin-top: 22px;
    color: var(--muted);
    line-height: 1.45;
    text-align: center;
}

.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.login-options a,
.back-link {
    color: var(--green-700);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.recovery-layout {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 0 0, rgba(34, 160, 107, 0.14), transparent 30%),
        #eef4f0;
}

.recovery-card {
    width: min(470px, 100%);
}

.recovery-card .back-link {
    display: inline-block;
    margin-bottom: 24px;
}

.mobile-login-mark {
    display: none;
}

@media (max-width: 1100px) {
    .report-cards {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .permission-cards {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-105%);
        transition: transform 0.22s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        z-index: 25;
        inset: 0;
        display: block;
        border: 0;
        visibility: hidden;
        opacity: 0;
        background: rgba(5, 29, 21, 0.48);
        transition: 0.2s ease;
    }

    .sidebar-backdrop.visible {
        visibility: visible;
        opacity: 1;
    }

    body.menu-open {
        overflow: hidden;
    }

    .menu-button {
        display: block;
    }

    .login-layout {
        grid-template-columns: 1fr;
    }

    .login-presentation {
        display: none;
    }

    .login-form-side {
        min-height: 100vh;
    }

    .mobile-login-mark {
        display: grid;
        place-items: center;
        width: 48px;
        height: 48px;
        border-radius: 13px;
        margin-bottom: 22px;
        color: #fff;
        font-weight: 800;
        background: linear-gradient(135deg, var(--green-900), var(--green-500));
    }
}

@media (max-width: 640px) {
    .topbar {
        height: 66px;
        padding: 0 15px;
    }

    .topbar-context small,
    .user-info {
        display: none;
    }

    .user-avatar {
        width: 34px;
        height: 34px;
    }

    .page-content {
        padding: 24px 14px 40px;
    }

    .panel {
        padding: 20px;
    }

    .table-panel {
        padding: 0;
    }

    .filter-actions {
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .row-actions {
        justify-content: flex-start;
    }

    .document-card-head,
    .panel-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .report-cards {
        grid-template-columns: 1fr;
    }

    .login-form-side {
        padding: 18px;
    }

    .login-card {
        padding: 28px 22px;
    }
}

/* Garantia final de contraste das ações — versão 1.2.2. */
.button,
.button-secondary,
.button-success,
.button-danger,
.profile-dropdown .logout-button {
    border-color: var(--green-700);
    color: #fff;
    background: linear-gradient(180deg, var(--green-600), var(--green-700));
}

.button:hover,
.button-secondary:hover,
.button-success:hover,
.button-danger:hover,
.profile-dropdown .logout-button:hover {
    border-color: var(--green-800);
    color: #fff;
    background: var(--green-800);
}

/* GBcertifica 1.2.2: ações consistentes em todas as telas. */
.button,
.button-secondary,
.button-success,
.button-danger,
.profile-dropdown .logout-button {
    border-color: var(--green-700);
    color: #fff;
    background: linear-gradient(180deg, var(--green-600), var(--green-700));
}

.button:hover,
.button-secondary:hover,
.button-success:hover,
.button-danger:hover,
.profile-dropdown .logout-button:hover {
    border-color: var(--green-800);
    color: #fff;
    background: var(--green-800);
}

.password-reset-panel { max-width: 820px; }
.security-note,
.recovery-instruction {
    display: grid;
    gap: 5px;
    margin-bottom: 24px;
    border: 1px solid #cfe8da;
    border-radius: 12px;
    padding: 16px;
    color: var(--green-900);
    background: var(--green-50);
}
.security-note span,
.recovery-instruction span { color: var(--muted); line-height: 1.55; }
.recovery-admin-icon { margin: 24px 0 12px; font-size: 34px; }
.admin-recovery-card { text-align: left; }

/* ========================================================================== */
/* Interface profissional e responsiva - GBcertifica                         */
/* ========================================================================== */

[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    clip-path: inset(50%);
}

.topbar-actions,
.topbar-actions .user-menu {
    display: flex;
    align-items: center;
    gap: 14px;
}

.version-chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border: 1px solid #d4e7dc;
    border-radius: 999px;
    padding: 4px 10px;
    color: var(--green-700);
    background: #f3faf6;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.app-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(1400px, 100%);
    margin: auto auto 0;
    border-top: 1px solid var(--border);
    padding: 16px 32px 22px;
    color: var(--muted);
    font-size: 12px;
}

.app-footer strong {
    color: var(--green-700);
}

.button-with-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.button-with-icon > span {
    font-size: 16px;
    line-height: 1;
}

.panel-heading {
    margin-bottom: 22px;
}

.panel-heading .eyebrow {
    margin-bottom: 5px;
}

.panel-heading h2 {
    margin: 0 0 4px;
    font-size: 20px;
    letter-spacing: -0.025em;
}

/* Dashboard */
.dashboard-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.metric-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    background: #fff;
    box-shadow: 0 7px 22px rgba(11, 61, 46, 0.055);
}

.metric-card::after {
    position: absolute;
    right: -24px;
    bottom: -30px;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: rgba(20, 122, 82, 0.055);
    content: "";
}

.metric-card.metric-primary {
    border-color: transparent;
    color: #fff;
    background: linear-gradient(140deg, #0a4633, #147a52);
}

.metric-card.metric-primary::after {
    background: rgba(255, 255, 255, 0.09);
}

.metric-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.metric-primary .metric-top,
.metric-primary small {
    color: rgba(255, 255, 255, 0.75);
}

.metric-icon {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    color: var(--green-700);
    background: var(--green-100);
    font-size: 13px;
}

.metric-primary .metric-icon {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

.metric-card > strong {
    display: block;
    margin: 12px 0 5px;
    color: var(--green-900);
    font-size: 34px;
    line-height: 1;
    letter-spacing: -0.04em;
}

.metric-primary > strong {
    color: #fff;
}

.metric-card > small {
    color: var(--muted);
    font-size: 12px;
}

.dashboard-main-grid,
.dashboard-bottom-grid,
.report-insights-grid,
.form-page-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

.dashboard-main-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(310px, 0.8fr);
}

.dashboard-bottom-grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.65fr);
}

.dashboard-main-grid > *,
.dashboard-bottom-grid > *,
.report-insights-grid > *,
.form-page-grid > * {
    min-width: 0;
}

.completion-score {
    text-align: right;
}

.completion-score strong,
.completion-score span {
    display: block;
}

.completion-score strong {
    color: var(--green-700);
    font-size: 26px;
}

.completion-score span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.status-overview {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 20px;
}

.status-summary {
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid #e6eee9;
    border-radius: 11px;
    padding: 11px;
    background: #fbfdfc;
}

.status-summary strong,
.status-summary small {
    display: block;
}

.status-summary strong {
    color: var(--green-900);
    font-size: 18px;
}

.status-summary small {
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-dot {
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #9ca3af;
}

.status-dot.status-concluida { background: #22a06b; }
.status-dot.status-rascunho { background: #94a3b8; }
.status-dot.status-processando { background: #2563eb; }
.status-dot.status-erro { background: #d92d20; }
.status-dot.status-cancelada { background: #d97706; }

.attention-banner,
.success-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid #f4d5ae;
    border-radius: 12px;
    padding: 13px 14px;
    color: #7a4510;
    background: #fff8ed;
    text-decoration: none;
}

.success-banner {
    border-color: #cce9d9;
    color: var(--green-900);
    background: #f2fbf6;
}

.attention-banner > span,
.success-banner > span {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: #fff;
    background: #d97706;
    font-weight: 800;
}

.success-banner > span { background: var(--green-700); }
.attention-banner > div,
.success-banner > div { min-width: 0; flex: 1; }
.attention-banner strong,
.attention-banner small,
.success-banner strong,
.success-banner small { display: block; }
.attention-banner small,
.success-banner small { margin-top: 2px; opacity: 0.75; }
.attention-banner > b { font-size: 12px; white-space: nowrap; }

.mini-bars,
.report-type-grid,
.company-ranking {
    display: grid;
    gap: 15px;
}

.mini-bar-row > div,
.type-stat > div,
.company-rank-row > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.mini-bar-row span,
.type-stat span {
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mini-bar-row strong,
.type-stat strong {
    color: var(--green-900);
    font-size: 13px;
}

progress {
    width: 100%;
    height: 7px;
    overflow: hidden;
    border: 0;
    border-radius: 99px;
    background: #e9f0ec;
    appearance: none;
}

progress::-webkit-progress-bar { border-radius: 99px; background: #e9f0ec; }
progress::-webkit-progress-value { border-radius: 99px; background: linear-gradient(90deg, #22a06b, #147a52); }
progress::-moz-progress-bar { border-radius: 99px; background: linear-gradient(90deg, #22a06b, #147a52); }

.recent-panel {
    overflow: hidden;
}

.recent-table-wrap {
    overflow-x: auto;
}

.recent-table th,
.recent-table td {
    padding: 12px 10px;
}

.recent-table td:first-child strong,
.recent-table td:first-child small {
    display: block;
}

.recent-table td:first-child small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.icon-link {
    display: grid;
    place-items: center;
    width: 31px;
    height: 31px;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--green-700);
    background: #fff;
    font-weight: 800;
    text-decoration: none;
}

.shortcut-list {
    display: grid;
    gap: 8px;
    margin-top: 17px;
}

.shortcut-list a {
    display: flex;
    align-items: center;
    gap: 11px;
    border: 1px solid #e6eee9;
    border-radius: 12px;
    padding: 11px;
    background: #fbfdfc;
    text-decoration: none;
    transition: 0.18s ease;
}

.shortcut-list a:hover {
    border-color: #a9d6be;
    background: #f1faf5;
    transform: translateY(-1px);
}

.shortcut-list a > div { min-width: 0; flex: 1; }
.shortcut-list strong,
.shortcut-list small { display: block; }
.shortcut-list strong { color: var(--green-900); font-size: 13px; }
.shortcut-list small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.shortcut-list b { color: var(--green-700); }
.shortcut-icon {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    color: var(--green-700);
    background: var(--green-100);
    font-size: 12px;
}

.compact-empty {
    padding: 34px 20px;
}

.compact-empty > span {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--green-500);
    font-size: 30px;
}

.compact-empty h3 { margin: 0 0 5px; color: var(--green-900); }
.compact-empty p { margin: 0; color: var(--muted); }

/* Relatórios */
.report-filter-panel {
    margin-bottom: 18px;
}

.filter-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.filter-heading h2,
.filter-heading p { margin: 0; }
.filter-heading p { margin-top: 4px; color: var(--muted); }

.result-pill {
    border-radius: 999px;
    padding: 6px 11px;
    color: var(--green-700);
    background: var(--green-100);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.report-filter-grid {
    display: grid;
    grid-template-columns: minmax(210px, 1.25fr) minmax(185px, 1fr) repeat(2, minmax(150px, 0.8fr));
    align-items: end;
    gap: 12px;
}

.report-filter-grid > .field {
    min-width: 0;
}

.report-filter-grid input,
.report-filter-grid select {
    min-width: 0;
    max-width: 100%;
}

.report-filter-grid .filter-actions {
    flex-wrap: nowrap;
}

.report-filter-actions {
    display: grid;
    grid-template-columns: minmax(112px, 1fr) minmax(82px, auto);
    grid-column: 1 / -1;
    justify-self: end;
    width: min(320px, 100%);
}

.report-filter-grid .button {
    white-space: nowrap;
}

.report-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.report-metric {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 17px 18px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(11, 61, 46, 0.04);
}

.report-metric span,
.report-metric small { display: block; color: var(--muted); }
.report-metric span { font-size: 12px; font-weight: 700; }
.report-metric strong { display: block; margin: 7px 0 3px; color: var(--green-900); font-size: 27px; }
.report-metric small { font-size: 10px; }
.report-metric-primary { border-color: #b9dfca; background: linear-gradient(140deg, #f5fcf8, #eaf7f0); }
.metric-has-error { border-color: #f2c4c0; background: #fff8f7; }
.metric-has-error strong { color: var(--red-700); }

.report-insights-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(330px, 0.75fr);
}

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

.company-ranking { gap: 11px; }
.company-rank-row > div {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    margin-bottom: 7px;
}
.company-rank-row > div > span {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 7px;
    color: var(--green-700);
    background: var(--green-100);
    font-size: 10px;
    font-weight: 800;
}
.company-rank-row > div > strong {
    min-width: 0;
    overflow: hidden;
    color: var(--green-900);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.company-rank-row > div > b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    border-radius: 999px;
    padding: 3px 7px;
    color: var(--green-700);
    background: var(--green-50);
    font-size: 11px;
    white-space: nowrap;
}

.report-results-panel {
    padding-bottom: 0;
    overflow: hidden;
}

.report-results-panel > .panel-heading {
    padding-right: 2px;
}

.report-results-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.report-results-panel .table-responsive {
    width: auto;
    margin-right: -24px;
    margin-left: -24px;
}

.report-table {
    min-width: 860px;
    table-layout: fixed;
}

.report-table th:nth-child(1),
.report-table td:nth-child(1) { width: 105px; }
.report-table th:nth-child(2),
.report-table td:nth-child(2) { width: 21%; }
.report-table th:nth-child(3),
.report-table td:nth-child(3) { width: 25%; }
.report-table th:nth-child(4),
.report-table td:nth-child(4) { width: 24%; }
.report-table th:nth-child(5),
.report-table td:nth-child(5) { width: 125px; }
.report-table th:last-child,
.report-table td:last-child { width: 58px; text-align: center; }

.report-table td:nth-child(2),
.report-table td:nth-child(3),
.report-table td:nth-child(4) {
    overflow: hidden;
    text-overflow: ellipsis;
}

.report-results-panel .pagination {
    margin-right: -24px;
    margin-left: -24px;
    border-top: 1px solid var(--border);
}

/* Formulários */
.form-page-grid {
    grid-template-columns: minmax(0, 1fr) 315px;
    align-items: start;
}

.professional-form-panel {
    padding: 0;
    overflow: hidden;
}

.form-panel-heading {
    display: flex;
    align-items: center;
    gap: 13px;
    border-bottom: 1px solid var(--border);
    padding: 21px 24px;
    background: linear-gradient(180deg, #fff, #fbfdfc);
}

.form-panel-heading h2,
.form-panel-heading p { margin: 0; }
.form-panel-heading h2 { color: var(--green-900); font-size: 19px; }
.form-panel-heading p { margin-top: 3px; color: var(--muted); font-size: 12px; }

.form-heading-icon {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    color: #fff;
    background: linear-gradient(135deg, var(--green-900), var(--green-500));
    font-size: 12px;
}

.professional-form-panel form {
    padding: 24px;
}

.form-grid-spacious {
    gap: 21px 18px;
}

.label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.label-row > span {
    color: #839189;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.professional-actions {
    justify-content: flex-end;
    margin: 25px -24px -24px;
    border-top: 1px solid var(--border);
    padding: 16px 24px;
    background: #fbfdfc;
}

.form-guide-card {
    position: sticky;
    top: 88px;
}

.form-guide-card h2 {
    margin-bottom: 18px;
    font-size: 20px;
}

.form-checklist {
    display: grid;
    gap: 15px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.form-checklist li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.form-checklist li > span {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    color: var(--green-700);
    background: var(--green-100);
    font-size: 10px;
    font-weight: 800;
}

.form-checklist strong,
.form-checklist small { display: block; }
.form-checklist strong { color: var(--green-900); font-size: 12px; }
.form-checklist small { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.4; }

.form-info-box {
    margin-top: 20px;
    border: 1px solid #cfe8da;
    border-radius: 11px;
    padding: 13px;
    background: #f3faf6;
}

.form-info-box strong { color: var(--green-900); font-size: 11px; }
.form-info-box p { margin: 4px 0 0; font-size: 10px; line-height: 1.45; }

.emission-workflow {
    display: flex;
    align-items: center;
    width: min(850px, 100%);
    margin: 0 auto 24px;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 16px;
    background: #fff;
    box-shadow: 0 5px 17px rgba(11, 61, 46, 0.04);
}

.emission-workflow > span {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #8a9890;
}

.emission-workflow > span b {
    display: grid;
    place-items: center;
    width: 27px;
    height: 27px;
    border-radius: 50%;
    color: #718078;
    background: #edf2ef;
    font-size: 11px;
}

.emission-workflow > span small {
    font-size: 10px;
    font-weight: 750;
    white-space: nowrap;
}

.emission-workflow > span.active { color: var(--green-800); }
.emission-workflow > span.active b { color: #fff; background: var(--green-700); }
.emission-workflow > i { flex: 1; height: 1px; margin: 0 10px; background: #dfe9e3; }

.emission-form {
    width: min(1120px, 100%);
    margin: 0 auto;
}

.emission-form .form-section {
    padding: 26px;
}

.section-title-between,
.section-title-main {
    display: flex;
    align-items: flex-start;
}

.section-title-between {
    justify-content: space-between;
    gap: 18px;
}

.section-title-main { gap: 14px; }

.selection-counter {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 6px 11px;
    color: var(--green-700);
    background: var(--green-100);
    font-size: 10px;
    font-weight: 700;
}

.selection-counter strong { font-size: 12px; }

.emission-form .sticky-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 -8px 26px rgba(11, 61, 46, 0.08);
}

.emission-form .sticky-actions > div strong,
.emission-form .sticky-actions > div small { display: block; }
.emission-form .sticky-actions > div strong { color: var(--green-900); font-size: 12px; }
.emission-form .sticky-actions > div small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.emission-form .sticky-actions > span { display: flex; gap: 9px; }

.dynamic-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 11px;
}

.dynamic-table {
    min-width: 950px;
}

.dynamic-table th {
    background: #f5f9f7;
}

/* Tela de login simplificada */
.login-page-simple {
    min-height: 100vh;
    overflow: auto;
    background:
        linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.72)),
        linear-gradient(135deg, #edf1ef, #f8faf9);
}

.simple-login-layout {
    display: grid;
    grid-template-rows: 1fr auto;
    min-height: 100vh;
    place-items: center;
    padding: 32px 18px 20px;
}

.simple-login-card {
    position: relative;
    overflow: hidden;
    width: min(430px, 100%);
    border: 1px solid #dfe6e2;
    border-radius: 20px;
    padding: 36px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(23, 34, 29, 0.11);
}

.simple-login-card::before {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--green-900), var(--green-500));
    content: "";
}

.simple-login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.simple-login-brand .brand-mark {
    color: #fff;
    background: linear-gradient(135deg, #0b4f38, #22a06b);
}

.simple-login-brand strong,
.simple-login-brand small { display: block; }
.simple-login-brand strong { color: var(--green-900); font-size: 15px; }
.simple-login-brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }

.simple-login-card .login-card-head h1 {
    margin: 0 0 8px;
    color: var(--green-950, #073b2a);
    font-size: 30px;
    letter-spacing: -0.035em;
}

.simple-login-card .login-card-head p {
    max-width: 340px;
    font-size: 13px;
    line-height: 1.6;
}

.simple-login-card form {
    display: grid;
    gap: 17px;
}

.security-note {
    color: var(--muted);
    font-size: 10px;
}

.security-note::before {
    color: var(--green-500);
    content: "● ";
}

.login-version {
    align-self: end;
    color: #77857e;
    font-size: 11px;
    font-weight: 650;
}

.login-version span { margin: 0 5px; color: #b3bdb7; }

.login-options-end {
    justify-content: flex-end;
}

/* Cabeçalho, perfil e páginas de erro — versão 1.2.0 */
.profile-menu {
    position: relative;
}

.profile-menu > summary {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 218px;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 5px 7px;
    list-style: none;
    cursor: pointer;
    transition: 0.18s ease;
}

.profile-menu > summary::-webkit-details-marker {
    display: none;
}

.profile-menu > summary:hover,
.profile-menu[open] > summary {
    border-color: var(--border);
    background: #f7faf8;
}

.profile-chevron {
    width: 17px;
    height: 17px;
    margin-left: auto;
    fill: none;
    stroke: #718078;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    transition: transform 0.18s ease;
}

.profile-menu[open] .profile-chevron {
    transform: rotate(180deg);
}

.profile-dropdown {
    position: absolute;
    z-index: 90;
    top: calc(100% + 11px);
    right: 0;
    width: 320px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 14px;
    background: #fff;
    box-shadow: 0 22px 55px rgba(7, 59, 42, 0.17);
}

.profile-dropdown-head {
    display: flex;
    align-items: center;
    gap: 11px;
    border-bottom: 1px solid #edf1ef;
    padding: 2px 2px 13px;
}

.profile-dropdown-head div {
    min-width: 0;
}

.profile-dropdown-head strong,
.profile-dropdown-head small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-dropdown-head strong {
    color: var(--text);
    font-size: 13px;
}

.profile-dropdown-head small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

.user-avatar-large {
    width: 42px;
    height: 42px;
}

.profile-metadata {
    display: grid;
    gap: 8px;
    padding: 13px 2px;
}

.profile-metadata span {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    color: var(--muted);
    font-size: 10px;
}

.profile-metadata strong {
    max-width: 190px;
    overflow: hidden;
    color: var(--text);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-dropdown form {
    margin: 0;
}

.profile-dropdown .logout-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 40px;
    border-radius: 10px;
    color: #9d2f28;
    background: #fff8f7;
    font-size: 12px;
    font-weight: 750;
}

.profile-dropdown .logout-button svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.error-shell {
    width: min(700px, 100%);
    margin: clamp(30px, 8vh, 90px) auto;
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: clamp(34px, 6vw, 58px);
    background:
        radial-gradient(circle at 50% 0%, rgba(34, 160, 107, 0.08), transparent 38%),
        #fff;
    box-shadow: 0 18px 55px rgba(7, 59, 42, 0.09);
    text-align: center;
}

.error-illustration {
    display: grid;
    place-items: center;
    width: 82px;
    height: 82px;
    margin: 0 auto 17px;
    border: 1px solid #cfe8da;
    border-radius: 24px;
    color: var(--green-700);
    background: linear-gradient(145deg, #f5fcf8, #e8f6ef);
    transform: rotate(-3deg);
}

.error-illustration-warning {
    color: #a76516;
    border-color: #f3dfbd;
    background: linear-gradient(145deg, #fffaf0, #fff2d8);
}

.error-illustration-danger {
    color: #b42318;
    border-color: #f2cfcb;
    background: linear-gradient(145deg, #fff9f8, #feeceb);
}

.error-illustration svg {
    width: 48px;
    height: 48px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.4;
}

.error-shell .error-code {
    display: inline-flex;
    margin-bottom: 9px;
    border-radius: 999px;
    padding: 4px 10px;
    color: var(--green-700);
    background: var(--green-100);
    font-size: 11px;
    letter-spacing: 0.12em;
}

.error-shell h1 {
    margin: 0 0 9px;
    color: var(--green-950);
    font-size: clamp(27px, 4vw, 36px);
    letter-spacing: -0.04em;
}

.error-shell p {
    max-width: 510px;
    margin: 0 auto 25px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
}

/* Progresso de geração */
.processing-open { overflow: hidden; }

.processing-overlay {
    position: fixed;
    z-index: 200;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(5, 29, 21, 0.68);
    backdrop-filter: blur(5px);
}

.processing-card {
    width: min(520px, 100%);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 19px;
    padding: 30px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.24);
    text-align: center;
}

.processing-mark {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin: 0 auto 15px;
    border-radius: 13px;
    color: #fff;
    background: linear-gradient(135deg, var(--green-900), var(--green-500));
    font-size: 12px;
    font-weight: 900;
}

.processing-kicker {
    color: var(--green-700);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.processing-card h2 {
    margin: 7px 0 7px;
    color: var(--green-900);
    font-size: 22px;
}

.processing-card > p {
    min-height: 20px;
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 13px;
}

.processing-card > small {
    display: block;
    margin-top: 14px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
}

.loading-track {
    position: relative;
    height: 7px;
    overflow: hidden;
    border-radius: 99px;
    background: #e4ece7;
}

.loading-track span {
    position: absolute;
    top: 0;
    left: -35%;
    width: 35%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #22a06b, #0b4f38);
    animation: loading-slide 1.25s ease-in-out infinite;
}

@keyframes loading-slide {
    0% { left: -35%; }
    100% { left: 105%; }
}

.generation-progress-line {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0 17px;
}

.generation-progress-line progress {
    height: 9px;
}

.generation-progress-line strong {
    min-width: 38px;
    color: var(--green-700);
    font-size: 12px;
}

.processing-steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.processing-steps span {
    border-radius: 7px;
    padding: 6px 4px;
    color: #87938d;
    background: #f0f3f1;
    font-size: 8px;
    font-weight: 700;
}

.processing-steps span.active {
    color: var(--green-800);
    background: var(--green-100);
}

.generation-error {
    margin-top: 18px;
    border: 1px solid #f2c4c0;
    border-radius: 11px;
    padding: 14px;
    color: var(--red-700);
    background: #fff7f6;
    text-align: left;
}

.generation-error p { margin: 5px 0 12px; font-size: 11px; line-height: 1.45; }

@media (max-width: 1180px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-filter-grid .filter-actions { width: min(330px, 100%); }
}

@media (max-width: 980px) {
    .dashboard-main-grid,
    .dashboard-bottom-grid,
    .report-insights-grid,
    .form-page-grid { grid-template-columns: 1fr; }
    .form-guide-card { position: static; }
    .status-overview { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .dashboard-header,
    .report-header { align-items: stretch; flex-direction: column; }
    .dashboard-header .button,
    .report-header .button { width: 100%; }
    .report-results-heading { align-items: stretch; flex-direction: column; }
    .report-results-heading .button { width: 100%; text-align: center; }
    .report-filter-grid { grid-template-columns: 1fr 1fr; }
    .report-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-type-grid { grid-template-columns: 1fr; }
    .emission-workflow > span small { display: none; }
    .emission-workflow > i { margin: 0 6px; }
    .emission-form .form-grid { grid-template-columns: 1fr; }
    .emission-form .field { grid-column: 1; }
    .document-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .version-chip { display: none; }
    .app-footer { padding: 14px; }
    .metric-grid,
    .report-metrics { grid-template-columns: 1fr; }
    .status-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .attention-banner { align-items: flex-start; }
    .attention-banner > b { display: none; }
    .report-filter-grid { grid-template-columns: 1fr; }
    .report-filter-grid .filter-actions { grid-column: 1; justify-self: stretch; width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
    .report-filter-grid .button { text-align: center; }
    .report-results-panel .table-responsive { margin-right: -20px; margin-left: -20px; }
    .report-results-panel .pagination { margin-right: -20px; margin-left: -20px; }
    .filter-heading { align-items: stretch; flex-direction: column; }
    .result-pill { width: fit-content; }
    .professional-form-panel form,
    .emission-form .form-section { padding: 18px; }
    .professional-actions { margin: 22px -18px -18px; padding: 14px 18px; }
    .professional-actions .button { flex: 1; text-align: center; }
    .document-grid { grid-template-columns: 1fr; }
    .section-title-between { align-items: flex-start; flex-direction: column; }
    .emission-form .sticky-actions { align-items: stretch; flex-direction: column; }
    .emission-form .sticky-actions > span { display: grid; grid-template-columns: 1fr 1fr; }
    .emission-form .sticky-actions .button { text-align: center; }
    .simple-login-card { padding: 26px 21px; }
    .profile-menu > summary { min-width: 0; }
    .profile-menu > summary .user-info { display: none; }
    .profile-dropdown { right: -4px; width: min(320px, calc(100vw - 28px)); }
    .error-shell { border-radius: 17px; padding: 32px 20px; }
    .processing-card { padding: 24px 18px; }
    .processing-steps { grid-template-columns: repeat(2, 1fr); }
}

/* Última camada para impedir variações claras ou vermelhas em ações. */
.button,
.button-secondary,
.button-success,
.button-danger,
.profile-dropdown .logout-button {
    border-color: var(--green-700);
    color: #fff;
    background: linear-gradient(180deg, var(--green-600), var(--green-700));
}

.button:hover,
.button-secondary:hover,
.button-success:hover,
.button-danger:hover,
.profile-dropdown .logout-button:hover {
    border-color: var(--green-800);
    color: #fff;
    background: var(--green-800);
}
