* {
    box-sizing: border-box;
}

:root {
    color-scheme: light;
    --bg: #f2f6fc;
    --surface: #ffffff;
    --surface-muted: #f6f8fc;
    --surface-raised: #ffffff;
    --text: #1f2937;
    --text-soft: #6b7280;
    --border: #d1d5db;
    --border-soft: #e5e7eb;
    --primary: #0f4c81;
    --primary-contrast: #ffffff;
    --secondary: #6b7280;
    --danger: #b42318;
    --shadow: 0 16px 34px rgba(15, 23, 42, 0.08);
    --shadow-soft: 0 10px 24px rgba(15, 23, 42, 0.08);
    --container-max: 2400px;
    --container-padding-x: clamp(0.8rem, 1.6vw, 2.2rem);
    --container-padding-y: clamp(1.1rem, 1.8vw, 2.25rem);
    --section-padding: clamp(1.2rem, 1.7vw, 1.7rem);
    --grid-gap: clamp(1rem, 1.35vw, 1.6rem);
    --font-size-base: clamp(1rem, 0.18vw + 0.97rem, 1.08rem);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #07111f;
    --surface: #0f1b31;
    --surface-muted: #152540;
    --surface-raised: #1b2e4f;
    --text: #ecf3ff;
    --text-soft: #aebbd4;
    --border: #314564;
    --border-soft: #223554;
    --primary: #62b8ff;
    --primary-contrast: #06101d;
    --secondary: #475569;
    --danger: #ef7469;
    --shadow: 0 20px 44px rgba(2, 8, 23, 0.5);
    --shadow-soft: 0 10px 24px rgba(2, 8, 23, 0.34);
}

.global-watermark {
    margin-top: auto;
    padding-top: clamp(0.85rem, 1.5vw, 1.4rem);
    text-align: right;
    pointer-events: none;
    user-select: none;
    font-family: "Segoe Script", "Segoe UI", cursive;
    font-size: 8pt;
    line-height: 1;
    white-space: nowrap;
    color: rgba(200, 150, 40, 170);
}

html[data-theme="dark"] .global-watermark {
    color: rgba(230, 150, 40, 170);
}

body {
    margin: 0;
    font-family: "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top, color-mix(in srgb, var(--primary) 12%, transparent) 0, transparent 34%),
        radial-gradient(circle at top right, color-mix(in srgb, var(--surface-raised) 20%, transparent) 0, transparent 28%),
        var(--bg);
    color: var(--text);
    font-size: var(--font-size-base);
    line-height: 1.55;
    transition: background-color 0.2s ease, color 0.2s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    isolation: isolate;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: url("../img/app-bg.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.17;
    z-index: -2;
    pointer-events: none;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, rgba(7, 17, 31, 0.74) 0%, rgba(7, 17, 31, 0.52) 100%);
    z-index: -1;
    pointer-events: none;
}

html[data-theme="light"] body::after {
    background: linear-gradient(180deg, rgba(242, 246, 252, 0.9) 0%, rgba(242, 246, 252, 0.82) 100%);
}

.container {
    width: min(var(--container-max), 98vw);
    margin: 0 auto;
    padding: var(--container-padding-y) var(--container-padding-x) calc(var(--container-padding-y) * 1.5);
    flex: 1;
    display: flex;
    flex-direction: column;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: clamp(1.25rem, 2vw, 2rem);
    padding: 1rem clamp(1.2rem, 1.4vw, 1.6rem);
    background: linear-gradient(180deg, color-mix(in srgb, var(--surface-raised) 38%, var(--surface)) 0%, var(--surface) 100%);
    border-radius: 22px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-soft);
}

nav ul {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.brand-title {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    line-height: 1.15;
}

.brand-title span {
    display: block;
    margin: 0;
    padding: 0;
}

.brand-logo {
    width: 56px;
    height: 56px;
    display: block;
    object-fit: contain;
    border-radius: 10px;
    flex: 0 0 auto;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

section,
article,
form {
    background: linear-gradient(180deg, color-mix(in srgb, var(--surface-raised) 24%, var(--surface)) 0%, var(--surface) 100%);
    border-radius: 22px;
    padding: var(--section-padding);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-soft);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: var(--grid-gap);
}

.dashboard-top-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 235px), 1fr));
    gap: var(--grid-gap);
    margin-bottom: var(--grid-gap);
}

.dashboard-main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(380px, 0.95fr);
    gap: var(--grid-gap);
    margin-bottom: var(--grid-gap);
}

.dashboard-bottom-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: var(--grid-gap);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.page-header h1 {
    font-size: clamp(2rem, 1.2vw + 1.5rem, 2.8rem);
    line-height: 1.08;
    margin-bottom: 0.55rem;
}

.page-header h2 {
    font-size: clamp(1.25rem, 0.5vw + 1.05rem, 1.7rem);
}

.page-header h3 {
    font-size: clamp(1.05rem, 0.25vw + 1rem, 1.22rem);
}

.page-header h1,
.page-header h2,
.page-header h3 {
    margin-top: 0;
}

.page-header p {
    max-width: 72ch;
    margin-bottom: 0;
}

.header-actions,
.form-actions,
.filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
}

.table-actions-compact {
    gap: 0.7rem;
}

.filters-grid {
    align-items: end;
}

.detail-grid {
    align-items: start;
}

.empresa-overview-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
        "cadastro carteira"
        "cadastro socios";
}

.empresa-overview-card {
    min-width: 0;
}

.empresa-overview-card-cadastro {
    grid-area: cadastro;
}

.empresa-overview-card-carteira {
    grid-area: carteira;
}

.empresa-overview-card-socios {
    grid-area: socios;
}

.button-link {
    display: inline;
    min-height: 0;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: var(--primary);
    border: 0;
    box-shadow: none;
}

.button-inline {
    min-height: 0;
    padding: 0.1rem 0.38rem;
    border-radius: 6px;
    font-size: 0.74rem;
    line-height: 1.05;
    white-space: nowrap;
    font-weight: 600;
    box-shadow: none;
}

.button-secondary {
    background: transparent;
    color: var(--text-soft);
    border: 0;
}

.button-danger {
    background: transparent;
    color: var(--danger);
    border: 0;
}

.theme-toggle {
    width: auto;
    min-width: 0;
    padding: 0.48rem 0.72rem;
    background: color-mix(in srgb, var(--surface-raised) 68%, var(--surface));
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.theme-toggle:hover {
    background: var(--surface);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
    min-width: 920px;
}

th,
td {
    padding: 0.95rem 0.9rem;
    border-bottom: 1px solid var(--border-soft);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--text-soft);
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    background: color-mix(in srgb, var(--surface-raised) 46%, var(--surface));
    position: sticky;
    top: 0;
    z-index: 1;
}

tbody tr:hover {
    background: color-mix(in srgb, var(--primary) 8%, transparent);
}

tbody tr:nth-child(even) {
    background: color-mix(in srgb, var(--surface-raised) 20%, transparent);
}

.message {
    border-left: 4px solid var(--primary);
}

.muted {
    color: var(--text-soft);
    font-size: 0.95rem;
}

.simple-list {
    margin: 0;
    padding-left: 1.25rem;
    display: grid;
    gap: 0.55rem;
}

.dashboard-number {
    font-size: clamp(2rem, 2vw + 1rem, 2.8rem);
    font-weight: 700;
    margin: 0;
    color: var(--primary);
}

.metric-card {
    background: linear-gradient(180deg, color-mix(in srgb, var(--surface-raised) 42%, var(--surface-muted)) 0%, var(--surface-muted) 100%);
    box-shadow: var(--shadow-soft);
}

.dashboard-card {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-height: clamp(168px, 18vw, 198px);
    padding: clamp(1.05rem, 1.6vw, 1.35rem);
    border-radius: 18px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--surface-raised) 52%, var(--surface)) 0%, var(--surface) 100%);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-soft);
    color: var(--text);
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    overflow: hidden;
}

.dashboard-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--primary);
    opacity: 0.85;
}

.dashboard-card:hover {
    text-decoration: none;
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--primary) 32%, var(--border-soft));
}

.dashboard-card-neutral {
    background: linear-gradient(180deg, color-mix(in srgb, var(--surface-muted) 70%, var(--surface)) 0%, var(--surface) 100%);
}

.dashboard-card-warning {
    background: linear-gradient(180deg, color-mix(in srgb, #f59e0b 10%, var(--surface)) 0%, var(--surface) 100%);
}

.dashboard-card-alert,
.dashboard-card-danger {
    background: linear-gradient(180deg, color-mix(in srgb, var(--danger) 10%, var(--surface)) 0%, var(--surface) 100%);
}

.dashboard-card-danger {
    border-color: color-mix(in srgb, var(--danger) 30%, var(--border-soft));
}

.dashboard-card-alert::before,
.dashboard-card-danger::before {
    background: var(--danger);
}

.dashboard-card-warning::before {
    background: #f59e0b;
}

.metric-label,
.card-kicker {
    display: inline-block;
    margin: 0 0 0.35rem;
    color: var(--text-soft);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stack-list {
    display: grid;
    gap: 1rem;
}

.dashboard-split {
    display: grid;
    gap: 1rem;
}

.section-divider {
    border: 0;
    border-top: 1px solid var(--border-soft);
    margin: 1.1rem 0;
}

.section-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
}

.particularidade-card {
    background: linear-gradient(180deg, color-mix(in srgb, var(--surface-raised) 44%, var(--surface-muted)) 0%, var(--surface-muted) 100%);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-soft);
}

.particularidade-card-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.particularidade-card h2,
.particularidade-card h3 {
    margin: 0;
}

.particularidade-resumo {
    margin: 0 0 0.75rem;
}

.particularidade-card-foot,
.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0.15rem 0.65rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
}

.badge-neutral {
    background: var(--surface);
    color: var(--text-soft);
}

.badge-status {
    background: color-mix(in srgb, var(--primary) 14%, var(--surface));
    color: var(--primary);
}

.badge-alert {
    background: color-mix(in srgb, var(--danger) 14%, var(--surface));
    color: var(--danger);
}

.badge-priority-1 {
    background: color-mix(in srgb, #94a3b8 16%, var(--surface));
    color: var(--text-soft);
}

.badge-priority-2 {
    background: color-mix(in srgb, #f59e0b 18%, var(--surface));
    color: #b45309;
}

.badge-priority-3 {
    background: color-mix(in srgb, #fb923c 18%, var(--surface));
    color: #c2410c;
}

.badge-priority-4 {
    background: color-mix(in srgb, var(--danger) 18%, var(--surface));
    color: var(--danger);
}

.form-section {
    padding: 0;
    background: transparent;
    box-shadow: none;
    border: 0;
    margin-bottom: 1.25rem;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 0.85rem;
}

.quick-action-card {
    display: flex;
    align-items: center;
    min-height: 82px;
    padding: 1.1rem;
    border-radius: 16px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--surface-raised) 44%, var(--surface-muted)) 0%, var(--surface-muted) 100%);
    border: 1px solid var(--border-soft);
    color: var(--text);
    font-weight: 600;
    box-shadow: var(--shadow-soft);
}

.quick-action-card:hover {
    text-decoration: none;
    border-color: var(--primary);
    transform: translateY(-1px);
}

.particularidade-modelos-tabs {
    margin-bottom: 0.85rem;
}

.particularidade-card-tab {
    display: flex;
    align-items: center;
    min-height: 82px;
    justify-content: flex-start;
}

.particularidade-card-tab-title {
    color: var(--text);
    font-weight: 700;
    font-size: 1.02rem;
    width: 100%;
}

.quick-action-card.quick-action-card-active {
    border-color: color-mix(in srgb, var(--primary) 55%, var(--border-soft));
    background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 14%, var(--surface-raised)) 0%, color-mix(in srgb, var(--primary) 8%, var(--surface-muted)) 100%);
}

.particularidade-criar-link {
    margin-left: auto;
}

.particularidade-modelo-painel {
    margin-top: 0.95rem;
    display: grid;
    gap: 1rem;
}

.particularidade-modelo-painel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.particularidade-modelo-painel-head h3 {
    margin: 0;
}

.field-span-full {
    grid-column: 1 / -1;
}

.helptext {
    display: block;
    margin-top: 0.35rem;
    color: var(--text-soft);
    font-size: 0.85rem;
}

.table-shell {
    padding: 0;
    overflow: hidden;
    border-radius: 24px;
}

.table-shell .section-head {
    padding: var(--section-padding) var(--section-padding) 0;
}

.table-wrap {
    overflow-x: auto;
    padding: 0 var(--section-padding) var(--section-padding);
    scrollbar-width: thin;
}

.data-table {
    min-width: 100%;
}

.lucro-lote-toggle {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-soft);
}

.lucro-lote-wrap {
    padding: 0;
    margin: 1rem 0;
}

.lucro-lote-table {
    min-width: 620px;
    table-layout: fixed;
}

.lucro-lote-table th:nth-child(1),
.lucro-lote-table td:nth-child(1) {
    width: 34%;
}

.lucro-lote-table th:nth-child(2),
.lucro-lote-table td:nth-child(2) {
    width: 46%;
}

.lucro-lote-table th:nth-child(3),
.lucro-lote-table td:nth-child(3) {
    width: 20%;
}

.lucro-lote-table input {
    min-width: 0;
}

.lucro-lote-delete-field {
    display: none;
}

button.lucro-lote-remover {
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.table-sort-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    white-space: nowrap;
}

.table-sort-link:hover,
.table-sort-link:focus-visible {
    color: var(--primary);
}

.data-table td:first-child,
.data-table th:first-child {
    padding-left: 0.3rem;
}

.data-table td:last-child,
.data-table th:last-child {
    padding-right: 0.3rem;
}

.data-table .cell-title {
    font-weight: 700;
    color: var(--text);
}

.empresa-link-urgente,
.data-table .cell-title.empresa-link-urgente {
    color: var(--danger);
}

.empresa-urgente-marcador {
    font-size: 0.8em;
    font-weight: 800;
    white-space: nowrap;
}

.data-table .cell-subtitle {
    display: block;
    margin-top: 0.2rem;
    color: var(--text-soft);
    font-size: 0.92rem;
}

.data-table td .table-actions {
    justify-content: flex-start;
}

.data-table td.actions-cell {
    vertical-align: middle;
    white-space: nowrap;
}

.data-table td.actions-cell .button-inline {
    align-self: center;
}

.socios-table {
    min-width: 0;
    width: min(960px, 100%);
    table-layout: fixed;
}

.socios-table th:first-child,
.socios-table td:first-child {
    width: 56%;
}

.socios-table th:nth-child(2),
.socios-table td:nth-child(2) {
    width: 44%;
}

.table-link {
    display: inline;
    margin: 0;
    padding: 0;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    min-height: 0;
    min-width: 0;
    font-size: 0.84rem;
    line-height: 1.1;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-soft);
}

.table-link.table-link-edit {
    color: var(--primary);
}

.table-link.table-link-receipt {
    color: var(--danger);
}

.table-link.table-link-danger {
    color: var(--danger);
}

.table-link:hover {
    text-decoration: underline;
}

.tarefas-table-wrap {
    padding-top: 0.25rem;
}

.tarefas-table {
    font-size: 0.84rem;
    min-width: 1180px;
}

.tarefas-table th,
.tarefas-table td {
    padding-top: 0.48rem;
    padding-bottom: 0.48rem;
}

.tarefas-table .mes-col {
    width: 56px;
    text-align: center;
}

.empresa-task-group {
    border-top: 1px solid var(--border-soft);
    padding-top: 1rem;
    margin-top: 1rem;
}

.empresa-task-group .section-head {
    margin-bottom: 0.6rem;
}

.empresa-task-group h3 {
    font-size: 1rem;
    margin: 0;
}

.tarefa-checkbox-form {
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    border-radius: 0;
}

input[type="checkbox"],
.tarefa-checkbox {
    appearance: auto;
    -webkit-appearance: checkbox;
    display: inline-block;
    flex: 0 0 auto;
    vertical-align: middle;
    width: 14px !important;
    height: 14px !important;
    min-height: 14px !important;
    margin: 0 !important;
    padding: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

input[type="checkbox"]:disabled,
.tarefa-checkbox:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.form-checkbox {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 0.55rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    width: fit-content;
    margin: 0;
}

.meses-aplicaveis-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.45rem 0.85rem;
    margin-top: 0.5rem;
}

.meses-aplicaveis-grid label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    font-weight: 500;
}

form p:has(> input.tarefa-checkbox) {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-soft);
}

form p:has(> input.tarefa-checkbox) > label {
    display: inline-block;
    margin: 0;
    min-width: 128px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
    gap: var(--grid-gap);
}

.summary-card {
    padding: 1.1rem;
    border-radius: 18px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--surface-raised) 44%, var(--surface-muted)) 0%, var(--surface-muted) 100%);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-soft);
}

.summary-card h3 {
    margin-top: 0;
    margin-bottom: 0.65rem;
}

.summary-card .summary-value {
    font-size: clamp(1.2rem, 1.4vw, 1.95rem);
    line-height: 1.08;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.actions-summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.summary-grid-action {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 96px;
    padding: 1rem;
    text-align: center;
}

.summary-grid-action .button-link {
    white-space: normal;
}

.summary-grid-spacer {
    min-width: 0;
}

@media (max-width: 900px) {
    .actions-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .summary-grid-spacer {
        display: none;
    }
}

@media (max-width: 520px) {
    .actions-summary-grid {
        grid-template-columns: 1fr;
    }
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-head h2,
.section-head h3,
.section-head p {
    margin-top: 0;
}

.section-head p:last-child {
    margin-bottom: 0;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: var(--grid-gap);
}

input,
select,
textarea,
button {
    font: inherit;
}

input:not([type="checkbox"]),
select,
textarea {
    width: 100%;
    min-height: 48px;
    padding: 0.9rem 0.95rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface-muted) 82%, var(--surface-raised));
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

textarea {
    min-height: 132px;
    resize: vertical;
}

button,
.button-link {
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--primary);
    width: auto;
}

button:hover,
.button-link:hover {
    text-decoration: underline;
    filter: none;
    transform: none;
}

.button-link.button-secondary {
    border: 0;
}

.action-chip {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0.25rem 0.72rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
}

.action-chip:hover {
    text-decoration: none;
    filter: brightness(1.06);
}

.action-chip-neutral {
    color: var(--text-soft);
    background: color-mix(in srgb, var(--surface-raised) 72%, var(--surface));
}

.action-chip-info {
    color: #0ea5e9;
    border-color: color-mix(in srgb, #0ea5e9 50%, var(--border));
    background: color-mix(in srgb, #0ea5e9 14%, transparent);
}

.action-chip-success {
    color: #10b981;
    border-color: color-mix(in srgb, #10b981 48%, var(--border));
    background: color-mix(in srgb, #10b981 14%, transparent);
}

.action-chip-warning {
    color: #f59e0b;
    border-color: color-mix(in srgb, #f59e0b 48%, var(--border));
    background: color-mix(in srgb, #f59e0b 16%, transparent);
}

.action-chip-danger {
    color: #ef4444;
    border-color: color-mix(in srgb, #ef4444 44%, var(--border));
    background: color-mix(in srgb, #ef4444 14%, transparent);
}

.inline-subsection {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 14px;
    border: 1px solid var(--border-soft);
    background: color-mix(in srgb, var(--surface-raised) 45%, var(--surface));
}

.despesas-dinamicas {
    display: grid;
    gap: 0.65rem;
}

.despesa-item {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) minmax(140px, 1fr) auto;
    gap: 0.65rem;
    align-items: center;
}

@media (max-width: 780px) {
    .despesa-item {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
}

section + section,
section + article,
article + section,
form + section {
    margin-top: var(--grid-gap);
}

body .container > * + * {
    margin-top: var(--grid-gap);
}

.nav-links a {
    color: var(--text-soft);
    font-weight: 600;
    white-space: nowrap;
}

.nav-links a:hover {
    color: var(--primary);
}

.mode-switch-form {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.mode-switch-button {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.42rem 0.7rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-soft);
    background: color-mix(in srgb, var(--surface) 74%, var(--surface-raised));
}

.mode-switch-button.mode-switch-button-danger {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
}

.auth-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: var(--grid-gap);
    align-items: stretch;
}

.auth-panel {
    border-radius: 24px;
    padding: clamp(1.4rem, 2vw, 2rem);
}

.auth-panel-brand {
    background:
        radial-gradient(circle at top right, color-mix(in srgb, var(--primary) 18%, transparent) 0, transparent 46%),
        linear-gradient(180deg, color-mix(in srgb, var(--surface-raised) 36%, var(--surface)) 0%, var(--surface) 100%);
    border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--border-soft));
}

.auth-kicker {
    margin: 0 0 0.55rem;
    color: var(--primary);
    font-size: 0.84rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.auth-panel-brand h1 {
    margin: 0 0 0.7rem;
    font-size: clamp(1.8rem, 1vw + 1.45rem, 2.35rem);
    line-height: 1.08;
}

.auth-panel-brand > p {
    margin: 0;
    max-width: 50ch;
}

.auth-points {
    margin-top: 1rem;
    display: grid;
    gap: 0.65rem;
}

.auth-points p {
    margin: 0;
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    background: color-mix(in srgb, var(--surface-raised) 30%, var(--surface-muted));
}

.auth-panel-form h2 {
    margin: 0 0 0.2rem;
    font-size: clamp(1.25rem, 0.5vw + 1.05rem, 1.6rem);
}

.auth-form {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
    margin-top: 1rem;
}

.auth-form-grid {
    display: grid;
    gap: 0.95rem;
}

.auth-field label {
    display: inline-block;
    margin-bottom: 0.45rem;
    font-weight: 600;
}

.auth-field input {
    width: 100%;
}

.auth-error {
    margin-top: 0.35rem;
    display: block;
    color: var(--danger);
    font-size: 0.85rem;
    font-weight: 600;
}

.auth-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-start;
}

section > *:first-child,
article > *:first-child,
form > *:first-child {
    margin-top: 0;
}

section > *:last-child,
article > *:last-child,
form > *:last-child {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    nav,
    .page-header,
    .header-actions,
    .form-actions,
    .filter-actions {
        flex-direction: column;
        align-items: stretch;
    }

    nav ul {
        flex-wrap: wrap;
    }

    .particularidade-card-head {
        flex-direction: column;
    }

    .brand-logo {
        width: 42px;
        height: 42px;
    }

    .container {
        width: min(var(--container-max), calc(100vw - 1.2rem));
        padding-left: 0.6rem;
        padding-right: 0.6rem;
    }

    .dashboard-main-grid,
    .dashboard-bottom-grid {
        grid-template-columns: 1fr;
    }

    .empresa-overview-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "cadastro"
            "carteira"
            "socios";
    }

    table {
        min-width: 720px;
    }
}

@media (min-width: 769px) and (max-width: 1380px) {
    .dashboard-main-grid,
    .dashboard-bottom-grid {
        grid-template-columns: 1fr;
    }

    .auth-layout {
        grid-template-columns: 1fr;
    }
}

strong,
h1,
h2,
h3,
h4,
label,
th {
    color: var(--text);
}

p,
li,
td {
    color: var(--text);
}

html[data-theme="dark"] .button-link:hover,
html[data-theme="dark"] button:hover,
html[data-theme="dark"] .theme-toggle:hover {
    filter: brightness(1.06);
}

.pagination-nav {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 0.9rem;
}

.pagination-links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.report-tabs {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    padding: 0.3rem;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface-raised) 35%, var(--surface));
}

.report-tabs a {
    flex: 0 0 auto;
    padding: 0.65rem 0.85rem;
    border-radius: 6px;
    color: var(--text-soft);
    font-weight: 700;
    text-decoration: none;
}

.report-tabs a.active {
    color: var(--text);
    background: var(--surface-raised);
    box-shadow: inset 0 -2px 0 var(--primary);
}

.report-toolbar,
.report-action-band,
.report-action-list,
.report-company-list,
.report-summary-strip,
.report-result-head {
    margin-top: var(--grid-gap);
}

.report-filters {
    grid-template-columns: repeat(4, minmax(140px, 1fr));
}

.report-filters > div:nth-of-type(5) {
    grid-column: span 2;
}

.report-summary-strip {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    border-top: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
}

.report-summary-strip > div {
    min-width: 0;
    padding: 0.8rem 1rem;
    border-right: 1px solid var(--border-soft);
}

.report-summary-strip > div:last-child {
    border-right: 0;
}

.report-summary-strip span,
.report-summary-strip strong {
    display: block;
}

.report-summary-strip span {
    color: var(--text-soft);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.report-summary-strip strong {
    margin-top: 0.25rem;
    font-size: 1.05rem;
}

.report-summary-compact {
    grid-template-columns: repeat(2, minmax(0, 220px));
}

.report-result-head,
.report-action-band,
.report-action-list > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.report-result-head h2,
.report-result-head p,
.report-action-band h2,
.report-action-band p,
.report-action-list h2,
.report-action-list p {
    margin-top: 0;
}

.report-result-head p,
.report-action-band p,
.report-action-list p {
    margin-bottom: 0;
}

.report-export-actions {
    display: flex;
    gap: 0.8rem;
}

.report-company-list {
    border-top: 1px solid var(--border-soft);
}

.report-company {
    border-bottom: 1px solid var(--border-soft);
}

.report-company summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 0.2rem;
    cursor: pointer;
}

.report-company summary span {
    color: var(--text-soft);
    font-size: 0.88rem;
    white-space: nowrap;
}

.report-company .table-wrap {
    padding: 0 0 1rem;
}

.report-company .tarefas-table {
    min-width: 720px;
}

.report-action-band,
.report-action-list > div {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-soft);
}

.report-action-list {
    border-top: 1px solid var(--border-soft);
}

.report-operational-filters {
    grid-template-columns: repeat(2, minmax(180px, 280px)) auto;
}

.report-empty-state {
    padding: 1rem 0;
    color: var(--text-soft);
}

@media (max-width: 900px) {
    .report-filters,
    .report-summary-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .report-filters > div:nth-of-type(5) {
        grid-column: span 2;
    }
}

@media (max-width: 600px) {
    .report-filters,
    .report-operational-filters,
    .report-summary-strip {
        grid-template-columns: 1fr;
    }

    .report-filters > div:nth-of-type(5) {
        grid-column: auto;
    }

    .report-result-head,
    .report-action-band,
    .report-action-list > div,
    .report-company summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .report-summary-strip > div {
        border-right: 0;
        border-bottom: 1px solid var(--border-soft);
    }
}

@media (min-width: 1024px) {
    nav {
        flex-wrap: nowrap;
    }

    .brand-title {
        transform: translateY(2px);
    }

    nav > ul:first-child {
        flex: 0 0 auto;
    }

    .nav-links {
        flex: 1 1 auto;
        min-width: 0;
        justify-content: flex-end;
        flex-wrap: nowrap;
        gap: 0.65rem;
    }
}
