:root {
    color-scheme: light;
    --bg: #f4f2ed;
    --surface: #ffffff;
    --surface-soft: #f8f6f1;
    --text: #24231f;
    --muted: #706d65;
    --border: #dedbd2;
    --primary: #c96b28;
    --primary-strong: #9f4811;
    --success: #217a50;
    --warning: #a76a06;
    --danger: #b43c35;
    --shadow: 0 18px 45px rgba(55, 43, 31, 0.09);
}

html[data-theme="escuro"] {
    color-scheme: dark;
    --bg: #171817;
    --surface: #222421;
    --surface-soft: #2a2c28;
    --text: #f2efe7;
    --muted: #b9b4a9;
    --border: #3c3e39;
    --primary: #ee9149;
    --primary-strong: #ffad6c;
    --success: #58b98a;
    --warning: #e6ad48;
    --danger: #ef7770;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.24);
}

@media (prefers-color-scheme: dark) {
    html[data-theme="sistema"] {
        color-scheme: dark;
        --bg: #171817;
        --surface: #222421;
        --surface-soft: #2a2c28;
        --text: #f2efe7;
        --muted: #b9b4a9;
        --border: #3c3e39;
        --primary: #ee9149;
        --primary-strong: #ffad6c;
        --success: #58b98a;
        --warning: #e6ad48;
        --danger: #ef7770;
        --shadow: 0 18px 45px rgba(0, 0, 0, 0.24);
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

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

h1,
h2,
p {
    margin-top: 0;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 250px;
    display: flex;
    flex-direction: column;
    padding: 24px 18px;
    background: var(--surface);
    border-right: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 26px;
    font-weight: 750;
}

.brand-mark {
    display: inline-grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    font-size: 0.82rem;
    letter-spacing: 0.05em;
}

.brand-mark-large {
    width: 54px;
    height: 54px;
    margin-bottom: 22px;
    border-radius: 17px;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.nav-link {
    display: flex;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: 12px;
    color: var(--muted);
}

.nav-link.is-active {
    background: var(--surface-soft);
    color: var(--text);
    font-weight: 700;
}

.nav-link.is-disabled {
    opacity: 0.68;
}

.nav-link small {
    color: var(--primary);
}

.sidebar-footer {
    display: grid;
    gap: 14px;
    margin-top: auto;
    color: var(--muted);
    font-size: 0.9rem;
}

.app-shell {
    min-height: 100vh;
    margin-left: 250px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 26px 36px 16px;
}

.topbar h1 {
    margin-bottom: 0;
    font-size: clamp(1.75rem, 4vw, 2.35rem);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-chip {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
}

.page-content {
    width: min(1200px, 100%);
    margin: 0 auto;
    padding: 16px 36px 48px;
}

.eyebrow {
    margin-bottom: 6px;
    color: var(--primary);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.muted {
    color: var(--muted);
}

.hero-card,
.content-card,
.metric-card,
.login-card {
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.hero-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: clamp(24px, 5vw, 42px);
    border-radius: 28px;
    background:
        radial-gradient(circle at top right, rgba(201, 107, 40, 0.2), transparent 42%),
        var(--surface);
}

.hero-card h2 {
    max-width: 640px;
    margin: 18px 0 10px;
    font-size: clamp(1.7rem, 4vw, 3rem);
    line-height: 1.05;
}

.hero-card p {
    max-width: 650px;
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.6;
}

.hero-badge {
    display: grid;
    width: 112px;
    height: 112px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 32px;
    color: var(--primary);
    font-size: 2.3rem;
    font-weight: 850;
}

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

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

.metric-card {
    padding: 22px;
    border-radius: 20px;
}

.metric-card p,
.metric-card span {
    color: var(--muted);
}

.metric-card p {
    margin-bottom: 16px;
    font-size: 0.87rem;
    font-weight: 700;
}

.metric-card strong {
    display: block;
    margin-bottom: 8px;
    font-size: 2rem;
}

.metric-card span {
    font-size: 0.82rem;
}

.metric-payment {
    border-top: 4px solid var(--danger);
}

.metric-receipt {
    border-top: 4px solid var(--success);
}

.content-card {
    padding: 26px;
    border-radius: 22px;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--border);
}

.timeline {
    display: grid;
    gap: 18px;
    padding-top: 22px;
}

.timeline > div {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.timeline span {
    display: grid;
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 10px;
    background: var(--surface-soft);
    color: var(--primary);
    font-weight: 800;
}

.timeline p {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.55;
}

.timeline strong {
    color: var(--text);
}

.status-pill {
    display: inline-flex;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
}

.status-success {
    background: color-mix(in srgb, var(--success) 14%, transparent);
    color: var(--success);
}

.status-pending {
    background: color-mix(in srgb, var(--warning) 14%, transparent);
    color: var(--warning);
}

.button {
    min-height: 42px;
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
}

.button-primary {
    background: var(--primary);
    color: #fff;
    font-weight: 750;
}

.button-primary:hover {
    background: var(--primary-strong);
}

.button-quiet {
    background: var(--surface-soft);
    color: var(--text);
    border-color: var(--border);
}

.button-success {
    background: var(--success);
    color: #fff;
    font-weight: 750;
}

.button-danger {
    background: var(--danger);
    color: #fff;
    font-weight: 750;
}

.button-warning {
    background: var(--warning);
    color: #fff;
    font-weight: 750;
}

.button-block {
    display: block;
    width: 100%;
    margin-top: 14px;
    text-align: center;
}

.notification-link {
    position: relative;
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    gap: 7px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
    font-size: 0.82rem;
    font-weight: 750;
}

.notification-link span {
    display: grid;
    min-width: 20px;
    height: 20px;
    place-items: center;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
}

.messages {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.message {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.message-error {
    color: var(--danger);
}

.message-warning {
    color: var(--warning);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 10% 10%, rgba(201, 107, 40, 0.22), transparent 28%),
        radial-gradient(circle at 90% 90%, rgba(33, 122, 80, 0.16), transparent 30%),
        var(--bg);
}

.login-card {
    width: min(440px, 100%);
    padding: clamp(24px, 6vw, 42px);
    border-radius: 26px;
}

.stacked-form {
    display: grid;
    gap: 10px;
    margin-top: 26px;
}

.stacked-form label {
    margin-top: 6px;
    font-size: 0.84rem;
    font-weight: 750;
}

.stacked-form input {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
    color: var(--text);
}

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

.account-stack,
.transaction-stack,
.attachment-list,
.card-list {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}

.account-row,
.transaction-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
}

.account-row small,
.transaction-row small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
}

.account-color,
.nature-dot {
    width: 12px;
    height: 38px;
    border-radius: 999px;
    background: var(--account-color);
}

.nature-dot {
    height: 12px;
}

.nature-pagamento {
    background: var(--danger);
}

.nature-recebimento {
    background: var(--success);
}

.text-payment {
    color: var(--danger);
}

.text-receipt {
    color: var(--success);
}

.nature-badge-pagamento {
    background: color-mix(in srgb, var(--danger) 14%, transparent);
    color: var(--danger);
}

.nature-badge-recebimento {
    background: color-mix(in srgb, var(--success) 14%, transparent);
    color: var(--success);
}

.nature-badge-ambos {
    background: color-mix(in srgb, var(--primary) 14%, transparent);
    color: var(--primary);
}

.empty-state {
    padding: 26px;
    border: 1px dashed var(--border);
    border-radius: 14px;
    color: var(--muted);
    text-align: center;
}

.section-heading-actions,
.filter-bar,
.form-actions,
.approval-card {
    display: flex;
    align-items: center;
    gap: 12px;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.approval-aguardando,
.approval-reenviado {
    background: color-mix(in srgb, #2f6fed 15%, transparent);
    color: #2f6fed;
}

.approval-correcao {
    background: color-mix(in srgb, var(--warning) 15%, transparent);
    color: var(--warning);
}

.approval-aprovado {
    background: color-mix(in srgb, var(--success) 15%, transparent);
    color: var(--success);
}

.approval-rejeitado {
    background: color-mix(in srgb, var(--danger) 15%, transparent);
    color: var(--danger);
}

.approval-cancelado {
    background: color-mix(in srgb, var(--muted) 15%, transparent);
    color: var(--muted);
}

.approval-rascunho {
    background: var(--surface-soft);
    color: var(--muted);
}

.filter-panel {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.filter-panel summary {
    cursor: pointer;
    font-weight: 800;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    padding-top: 18px;
}

.approval-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 22px;
}

.approval-request {
    padding: 20px;
    border: 1px solid var(--border);
    border-left: 5px solid var(--primary);
    border-radius: 18px;
    background: var(--surface-soft);
}

.request-payment {
    border-left-color: var(--danger);
}

.request-receipt {
    border-left-color: var(--success);
}

.approval-request-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.approval-request-head h2 {
    margin: 12px 0 5px;
}

.approval-request-head p {
    color: var(--muted);
    font-size: 0.83rem;
}

.approval-request-head > strong {
    white-space: nowrap;
    font-size: 1.25rem;
}

.request-data {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 16px 0;
}

.request-data div {
    padding: 9px;
    border-radius: 10px;
    background: var(--surface);
}

.request-data dt {
    color: var(--muted);
    font-size: 0.72rem;
    text-transform: uppercase;
}

.request-data dd {
    margin: 4px 0 0;
    font-weight: 700;
}

.analysis-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.7fr);
    align-items: start;
    gap: 20px;
}

.analysis-layout > div {
    display: grid;
    gap: 20px;
}

.decision-panel {
    position: sticky;
    top: 18px;
}

.history-card,
.danger-zone {
    margin-top: 20px;
}

.history-list {
    display: grid;
    gap: 0;
    margin-top: 20px;
}

.history-list article {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    padding-bottom: 22px;
}

.history-list article > span {
    position: relative;
    width: 12px;
    height: 12px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--primary);
}

.history-list article > span::after {
    content: "";
    position: absolute;
    top: 15px;
    left: 5px;
    width: 2px;
    height: calc(100% + 8px);
    background: var(--border);
}

.history-list article:last-child > span::after {
    display: none;
}

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

.history-list p {
    margin: 8px 0 0;
}

.history-list details {
    margin-top: 10px;
    color: var(--muted);
}

.history-list pre {
    max-width: 100%;
    overflow: auto;
    padding: 10px;
    border-radius: 10px;
    background: var(--surface-soft);
    white-space: pre-wrap;
    font-size: 0.72rem;
}

.danger-zone {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.5fr);
    gap: 20px;
    border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
}

.notification-list {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}

.notification-list article {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
}

.notification-list article.is-unread {
    border-left: 5px solid #2f6fed;
    background: color-mix(in srgb, #2f6fed 7%, var(--surface));
}

.notification-list p {
    margin: 5px 0;
    color: var(--muted);
}

.notification-list small {
    color: var(--muted);
}

.section-heading-actions {
    justify-content: space-between;
}

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

.form-card {
    max-width: 900px;
    margin: 0 auto;
}

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

.form-field {
    display: grid;
    align-content: start;
    gap: 7px;
}

.form-field label,
.compact-form label {
    font-size: 0.84rem;
    font-weight: 750;
}

.form-field-checkbox {
    grid-template-columns: auto 1fr;
    align-items: center;
}

.form-field-checkbox label {
    order: 2;
}

.form-field-checkbox input {
    width: 20px;
    height: 20px;
}

.form-control,
.compact-form input,
.compact-form select,
.compact-form textarea {
    width: 100%;
    min-height: 44px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-soft);
    color: var(--text);
}

textarea.form-control,
.compact-form textarea {
    max-width: 100%;
    min-height: 86px;
    resize: vertical;
}

.form-field small,
.compact-form .helptext {
    color: var(--muted);
    font-size: 0.76rem;
}

.field-error,
.errorlist {
    color: var(--danger);
    font-size: 0.8rem;
}

.form-actions {
    grid-column: 1 / -1;
    padding-top: 10px;
}

.responsive-table {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin-top: 20px;
    overflow-x: auto;
}

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

th,
td {
    padding: 13px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

th {
    color: var(--muted);
    font-size: 0.76rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.detail-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
    padding: clamp(24px, 5vw, 38px);
    border: 1px solid var(--border);
    border-radius: 26px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.detail-hero strong {
    display: block;
    margin: 16px 0 6px;
    font-size: clamp(2rem, 6vw, 4rem);
}

.detail-hero p {
    margin-bottom: 0;
    color: var(--muted);
}

.detail-payment {
    border-left: 6px solid var(--danger);
}

.detail-receipt {
    border-left: 6px solid var(--success);
}

.account-detail {
    border-left: 6px solid var(--account-color);
}

.detail-list {
    display: grid;
    gap: 0;
}

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

.detail-list dt {
    color: var(--muted);
}

.detail-list dd {
    margin: 0;
    font-weight: 700;
    text-align: right;
}

.note-box {
    margin-top: 18px;
    padding: 14px;
    border-radius: 12px;
    background: var(--surface-soft);
    line-height: 1.6;
}

.attachment-list a {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.attachment-item {
    display: grid;
    gap: 8px;
}

.attachment-item + .attachment-item {
    margin-top: 10px;
}

.attachment-item details {
    padding: 0 12px 12px;
    border: 1px solid var(--border);
    border-top: 0;
    border-radius: 0 0 12px 12px;
}

.attachment-item details > summary {
    padding-top: 10px;
    color: var(--warning);
    cursor: pointer;
    font-weight: 700;
}

.attachment-replaced {
    opacity: 0.68;
}

.attachment-replaced a {
    border-style: dashed;
}

.attachment-list small {
    color: var(--muted);
}

.compact-form {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.compact-form p {
    display: grid;
    gap: 6px;
    margin: 0;
}

.card-credit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.credit-card-panel,
.credit-card-hero {
    padding: 24px;
    border: 1px solid color-mix(in srgb, var(--card-color) 55%, var(--border));
    border-radius: 22px;
    background: linear-gradient(145deg, color-mix(in srgb, var(--card-color) 24%, var(--surface)), var(--surface));
    color: var(--text);
}

.credit-card-panel {
    display: grid;
    gap: 22px;
}

.credit-card-panel h2,
.credit-card-hero h2 {
    margin: 4px 0;
}

.credit-card-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.limit-progress {
    overflow: hidden;
    height: 8px;
    border-radius: 999px;
    background: var(--surface-soft);
}

.limit-progress span {
    display: block;
    max-width: 100%;
    height: 100%;
    border-radius: inherit;
    background: var(--card-color);
}

.card-limit-data {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 0;
}

.card-limit-data div {
    display: grid;
    gap: 4px;
}

.card-limit-data dt {
    color: var(--muted);
    font-size: 0.75rem;
}

.card-limit-data dd {
    margin: 0;
    font-weight: 750;
}

.payment-items {
    display: grid;
    gap: 16px;
}

.recurrence-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.patrimony-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.patrimony-card {
    display: grid;
    gap: .65rem;
    padding: 1.1rem;
    border: 1px solid var(--border);
    border-left: 5px solid var(--primary);
    border-radius: 1rem;
    background: var(--surface-soft);
}

.patrimony-card > strong {
    font-size: 1.55rem;
}

.debt-card { border-left-color: var(--danger); }
.investment-card, .investment-detail { border-left-color: #0f766e; }
.goal-card, .goal-detail { border-left-color: var(--goal-color); }

.progress-track {
    overflow: hidden;
    height: 9px;
    border-radius: 999px;
    background: var(--border);
}

.progress-track span {
    display: block;
    max-width: 100%;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
}

.goal-card .progress-track span,
.goal-detail .progress-track span {
    background: var(--goal-color);
}

.recurrence-card {
    display: grid;
    gap: .65rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 1rem;
    color: inherit;
    text-decoration: none;
}

.recurrence-card.nature-pagamento { border-left-color: var(--danger); }
.recurrence-card.nature-recebimento { border-left-color: var(--success); }

.calendar-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.calendar-agenda {
    display: grid;
    gap: .65rem;
    margin-top: 1rem;
}

.calendar-month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: .5rem;
    margin-top: 1rem;
}

.calendar-day {
    min-height: 130px;
    padding: .55rem;
    border: 1px solid var(--border);
    border-radius: .75rem;
}

.calendar-day > time {
    display: block;
    margin-bottom: .45rem;
    font-weight: 700;
}

.calendar-chip {
    display: grid;
    gap: .15rem;
    margin-bottom: .35rem;
    padding: .4rem;
    border-left: 3px solid var(--accent);
    border-radius: .4rem;
    background: var(--surface-soft);
    color: inherit;
    font-size: .75rem;
    text-decoration: none;
}

.calendar-chip.event-pagamento { border-left-color: var(--danger); }
.calendar-chip.event-recebimento { border-left-color: var(--success); }

.calendar-event {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: .9rem 1rem;
    border: 1px solid var(--border);
    border-left: 5px solid var(--accent);
    border-radius: .8rem;
    color: inherit;
    text-decoration: none;
}

.calendar-event.event-pagamento { border-left-color: var(--danger); }
.calendar-event.event-recebimento { border-left-color: var(--success); }
.calendar-event.event-overdue { border-left-color: #f97316; }
.calendar-event.event-done { opacity: .62; text-decoration: line-through; }
.notification-urgente { border-left: 4px solid var(--danger); }
.notification-atencao { border-left: 4px solid #eab308; }

.payment-item {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.payment-item p {
    display: grid;
    gap: 6px;
    margin: 0;
}

.payment-live-summary {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    border-radius: 14px;
    background: var(--surface-soft);
}

.approval-card {
    align-items: flex-start;
    margin-top: 20px;
}

.approval-card > div {
    margin-right: auto;
}

.approval-card .compact-form {
    min-width: min(320px, 100%);
    margin-top: 0;
}

.list-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 15px;
}

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

.category-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 12px;
    background: color-mix(in srgb, var(--category-color) 18%, transparent);
    color: var(--category-color);
    font-weight: 850;
}

.account-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 22px;
}

.account-card {
    padding: 22px;
    border: 1px solid var(--border);
    border-top: 5px solid var(--account-color);
    border-radius: 18px;
    background: var(--surface-soft);
}

.account-card span,
.account-card small {
    color: var(--muted);
}

.account-card h2 {
    margin: 12px 0;
}

.account-card strong {
    display: block;
    margin-bottom: 10px;
    font-size: 1.7rem;
}

hr {
    margin: 24px 0;
    border: 0;
    border-top: 1px solid var(--border);
}

.stacked-form .button {
    margin-top: 12px;
}

.mobile-nav {
    display: none;
}

.family-grid,
.gallery-grid,
.task-board {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.family-card {
    display: grid;
    gap: 10px;
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.family-card h2,
.family-card p {
    margin: 0;
}

.family-card p,
.family-card small,
.detail-list dt,
.shopping-row small,
figcaption {
    color: var(--muted);
}

.family-stack,
.detail-stack {
    display: grid;
    gap: 14px;
}

.family-stack article,
.shopping-row {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
}

.shopping-row,
.quick-links {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.shopping-row.is-done {
    opacity: .65;
}

.shopping-row.is-done strong {
    text-decoration: line-through;
}

.shopping-row small {
    display: block;
    margin-top: 5px;
}

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

.detail-list div {
    padding: 12px;
    border-radius: 12px;
    background: var(--surface-soft);
}

.detail-list dd {
    margin: 4px 0 0;
}

.inline-search {
    width: min(360px, 100%);
}

.gallery-placeholder {
    display: grid;
    min-height: 130px;
    place-items: center;
    border-radius: 14px;
    background: var(--surface-soft);
    color: var(--primary);
    font-size: 2rem;
    font-weight: 800;
}

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

.photo-grid figure {
    margin: 0;
}

.photo-grid img {
    width: 100%;
    max-height: 280px;
    object-fit: cover;
    border-radius: 14px;
}

@media (max-width: 860px) {
    .sidebar {
        display: none;
    }

    .app-shell {
        margin-left: 0;
        padding-bottom: 76px;
    }

    .topbar,
    .page-content {
        padding-right: 18px;
        padding-left: 18px;
    }

    .topbar-actions .button {
        width: 44px;
        overflow: hidden;
        color: transparent;
    }

    .topbar-actions .button::after {
        content: "Aa";
        color: var(--text);
    }

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

    .dashboard-grid,
    .account-grid,
    .approval-grid,
    .analysis-layout,
    .danger-zone,
    .family-grid,
    .gallery-grid,
    .task-board,
    .photo-grid {
        grid-template-columns: 1fr;
    }

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

    .decision-panel {
        position: static;
    }

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

    .form-actions {
        grid-column: auto;
    }

    .section-heading-actions,
    .approval-card {
        align-items: stretch;
        flex-direction: column;
    }

    .mobile-nav {
        position: fixed;
        inset: auto 12px 12px;
        z-index: 10;
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: minmax(76px, 1fr);
        overflow-x: auto;
        padding: 8px;
        border: 1px solid var(--border);
        border-radius: 18px;
        background: var(--surface);
        box-shadow: var(--shadow);
        text-align: center;
    }

    .mobile-nav a,
    .mobile-nav span {
        padding: 10px 4px;
        border-radius: 12px;
        color: var(--muted);
        font-size: 0.78rem;
    }

    .mobile-nav .is-active {
        background: var(--surface-soft);
        color: var(--text);
        font-weight: 750;
    }
}

@media (max-width: 560px) {
    .topbar,
    .topbar-actions {
        min-width: 0;
        width: 100%;
        max-width: 100%;
    }

    .topbar-actions {
        justify-content: flex-start;
        overflow-x: auto;
        contain: inline-size;
    }

    .mobile-nav {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        contain: layout paint;
    }

    .app-shell,
    .page-content,
    .content-card,
    .pending-list,
    .responsive-table,
    .responsive-form,
    .responsive-form p,
    .responsive-form .form-control {
        min-width: 0;
        width: 100%;
        max-width: 100%;
    }

    .responsive-table {
        overflow: hidden;
    }

    .calendar-toolbar {
        align-items: stretch;
        flex-direction: column;
    }
    .calendar-event {
        grid-template-columns: 52px minmax(0, 1fr);
    }
    .calendar-event > strong:last-child {
        grid-column: 2;
    }
    .calendar-month-grid {
        grid-template-columns: 1fr;
    }
    .calendar-day {
        min-height: auto;
    }
}

.skip-link {
    position: fixed;
    z-index: 100;
    top: 8px;
    left: 8px;
    transform: translateY(-160%);
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--text);
    color: var(--surface);
}

.skip-link:focus {
    transform: translateY(0);
}

:focus-visible {
    outline: 3px solid #3b82f6;
    outline-offset: 3px;
}

.quick-action-grid,
.management-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.management-card {
    color: inherit;
    text-decoration: none;
}

.pending-highlight,
.pending-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.pending-list {
    display: grid;
    gap: 14px;
}

.pending-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-soft);
}

.pending-card > * {
    flex: 1;
}

.pending-card form,
.permission-form {
    display: grid;
    gap: 12px;
}

.error-card {
    max-width: 680px;
    margin-inline: auto;
    text-align: center;
}

.error-card > strong {
    display: block;
    font-size: clamp(4rem, 20vw, 10rem);
    line-height: 1;
    color: var(--muted);
}

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

@media (max-width: 560px) {
    .pending-highlight,
    .pending-card {
        flex-direction: column;
    }

    .pending-card form,
    .pending-card textarea,
    .pending-card input {
        min-width: 0;
        width: 100%;
        max-width: 100%;
    }

    .pending-card,
    .pending-card > *,
    .credit-card-panel {
        min-width: 0;
        width: 100%;
        max-width: 100%;
    }

    .pending-card {
        overflow: hidden;
    }

    .pending-card .quick-action-grid {
        grid-template-columns: 1fr;
    }

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

    textarea.form-control {
        min-width: 0;
        max-width: calc(100vw - 24px);
    }
}

@media (max-width: 560px) {
    .hero-badge {
        display: none;
    }

    .hero-card {
        border-radius: 22px;
    }

    .topbar {
        align-items: flex-start;
    }

    .user-chip {
        display: none;
    }

    .responsive-table table,
    .responsive-table thead,
    .responsive-table tbody,
    .responsive-table tr,
    .responsive-table th,
    .responsive-table td {
        display: block;
        min-width: 0;
        max-width: 100%;
        table-layout: fixed;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .responsive-table thead {
        display: none;
    }

    .responsive-table tr {
        margin-bottom: 12px;
        padding: 10px;
        border: 1px solid var(--border);
        border-radius: 14px;
        background: var(--surface-soft);
    }

    .responsive-table td {
        display: flex;
        width: 100%;
        justify-content: space-between;
        gap: 14px;
        padding: 8px;
        border: 0;
        text-align: right;
        overflow-wrap: anywhere;
    }

    .responsive-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 0.76rem;
        font-weight: 750;
        text-align: left;
        text-transform: uppercase;
    }

    .list-card {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .list-card .status-pill,
    .list-card .button {
        grid-column: 2;
        justify-self: start;
    }

    .detail-hero {
        flex-direction: column;
    }

    .credit-card-hero,
    .payment-live-summary {
        align-items: stretch;
        flex-direction: column;
    }

    .card-limit-data,
    .payment-item {
        grid-template-columns: 1fr;
    }

    .filter-grid,
    .request-data {
        grid-template-columns: 1fr;
    }

    .approval-request-head,
    .notification-list article {
        align-items: flex-start;
        flex-direction: column;
    }

    .shopping-row,
    .quick-links {
        align-items: stretch;
        flex-direction: column;
    }

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

.gastos-periodo-card {
    margin-bottom: 16px;
}

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

.period-picker {
    position: relative;
    min-width: min(320px, 100%);
    text-align: center;
}

.period-picker summary,
.filter-panel summary {
    cursor: pointer;
    font-weight: 800;
}

.period-picker summary {
    list-style: none;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
}

.period-picker summary::-webkit-details-marker,
.filter-panel summary::-webkit-details-marker {
    display: none;
}

.period-picker-form {
    display: grid;
    gap: 10px;
    margin-top: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
    text-align: left;
}

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

.filter-panel > summary {
    margin-bottom: 12px;
}

.gastos-filter-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    align-items: end;
}

.filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.category-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.category-summary-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px 12px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-soft);
    color: inherit;
}

.category-summary-color {
    width: 12px;
    height: 100%;
    min-height: 46px;
    border-radius: 999px;
    background: var(--category-color, var(--primary));
}

.category-summary-values {
    grid-column: 2;
}

.category-summary-track,
.category-summary-card .text-link {
    grid-column: 1 / -1;
}

.category-summary-card small,
.responsive-table td small {
    display: block;
}

.gastos-type-compra_cartao {
    background: rgba(37, 99, 235, .14);
}

.gastos-type-pagamento_fatura {
    background: rgba(118, 86, 214, .16);
}

.gastos-type-aporte {
    background: rgba(21, 148, 103, .16);
}

.gastos-type-retirada {
    background: rgba(217, 144, 32, .16);
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
}

@media (max-width: 560px) {
    .period-navigation,
    .filter-actions,
    .pagination-bar {
        align-items: stretch;
        flex-direction: column;
    }

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

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

.open-items-stack {
    display: grid;
    gap: 12px;
}

.open-item-card {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 16px;
}

.open-item-head {
    align-items: center;
    display: grid;
    gap: 12px;
    grid-template-columns: auto minmax(0, 1fr) auto;
}

.open-item-head a,
.category-card-main {
    color: inherit;
    text-decoration: none;
}

.open-item-head small,
.open-item-card small {
    color: var(--muted);
    display: block;
}

.open-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.open-item-meta span:not(.status-pill) {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    font-size: .82rem;
    padding: 4px 10px;
}

.confirm-box {
    border-top: 1px solid var(--border);
    margin-top: 14px;
    padding-top: 14px;
}

.confirm-box summary {
    color: var(--primary);
    cursor: pointer;
    font-weight: 800;
}

.confirm-box form {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 12px;
}

.confirm-box textarea,
.confirm-box button {
    grid-column: 1 / -1;
}

.category-card-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.category-dashboard-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 14px;
    padding: 16px;
}

.category-card-main {
    align-items: center;
    display: flex;
    gap: 12px;
}

.category-icon-large {
    align-items: center;
    background: color-mix(in srgb, var(--category-color, var(--primary)) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--category-color, var(--primary)) 35%, transparent);
    border-radius: 16px;
    color: var(--category-color, var(--primary));
    display: inline-flex;
    font-size: 1.25rem;
    font-weight: 800;
    height: 48px;
    justify-content: center;
    width: 48px;
}

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

.category-metrics span {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px;
}

.category-metrics small {
    color: var(--muted);
    display: block;
    font-size: .76rem;
}

.category-metrics strong {
    display: block;
    margin-top: 3px;
}

.category-card-footer {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
}

.mini-month-chart {
    align-items: end;
    display: grid;
    gap: 4px;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    height: 80px;
}

.mini-month-chart.large {
    height: 144px;
}

.mini-month-chart a {
    align-items: end;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    min-height: 36px;
    overflow: hidden;
    position: relative;
}

.mini-month-chart span {
    background: var(--bar-color, var(--primary));
    border-radius: 8px 8px 0 0;
    display: block;
    min-height: 3px;
    width: 100%;
}

.mini-month-chart small {
    bottom: 2px;
    color: var(--text);
    font-size: .65rem;
    left: 50%;
    position: absolute;
    transform: translateX(-50%);
}

.dashboard-category-extra {
    margin-top: 16px;
}

.import-summary {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.summary-card-credit,
.gastos-type-estorno_cartao {
    background: rgba(118, 86, 214, .16);
}

.floating-action {
    bottom: 16px;
    position: sticky;
    z-index: 5;
}

.metrics-grid-six {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.pending-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, .42fr);
    gap: 20px;
    margin-bottom: 16px;
    background:
        radial-gradient(circle at top right, color-mix(in srgb, var(--primary) 18%, transparent), transparent 38%),
        var(--surface);
}

.pending-hero h2 {
    margin: 4px 0 12px;
    font-size: clamp(1.55rem, 4vw, 2.35rem);
}

.pending-hero p,
.pending-info-grid p {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.6;
}

.pending-session-chip {
    display: grid;
    align-content: center;
    gap: 8px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface-soft);
}

.pending-session-chip span,
.pending-session-chip small {
    color: var(--muted);
}

.pending-session-chip strong {
    font-size: .95rem;
}

.pending-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.pending-info-grid article {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
}

.warning-box {
    border-color: color-mix(in srgb, var(--warning) 45%, var(--border));
    background: color-mix(in srgb, var(--warning) 10%, var(--surface));
}

.metric-neutral {
    border-top: 4px solid var(--muted);
}

.metric-warning {
    border-top: 4px solid var(--warning);
}

.metric-success {
    border-top: 4px solid var(--success);
}

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

.priority-card {
    display: grid;
    gap: 8px;
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--border);
    border-left: 5px solid var(--primary);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow);
    color: inherit;
}

.priority-card:hover {
    border-left-color: var(--primary-strong);
    transform: translateY(-1px);
}

.priority-card span,
.priority-card small {
    color: var(--muted);
}

.priority-card em {
    font-size: 2rem;
    font-style: normal;
    font-weight: 850;
}

.pending-filter-panel {
    margin-bottom: 18px;
}

.pending-filter-grid {
    grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
    align-items: end;
}

.pending-filter-grid label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 750;
}

.pending-filter-grid input,
.pending-filter-grid select {
    min-width: 0;
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-soft);
    color: var(--text);
}

.history-panel {
    margin-bottom: 18px;
}

.history-panel > summary,
.occurrence-panel > summary {
    cursor: pointer;
    font-weight: 800;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.history-grid span {
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface-soft);
}

.history-grid small {
    color: var(--muted);
}

.pending-detail-list {
    margin-top: 18px;
}

.pending-item-card {
    display: grid;
    gap: 14px;
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface-soft);
}

.pending-item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.pending-item-head h3 {
    margin: 10px 0 8px;
}

.pending-item-head p {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.55;
}

.pending-item-head > strong {
    white-space: nowrap;
    font-size: 1.15rem;
}

.pending-badges,
.pending-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pending-data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin: 0;
}

.pending-data-grid div {
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.pending-data-grid dt {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 750;
    text-transform: uppercase;
}

.pending-data-grid dd {
    margin: 4px 0 0;
    overflow-wrap: anywhere;
    font-weight: 700;
}

.occurrence-panel {
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.occurrence-list {
    display: grid;
    gap: 8px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.occurrence-list li {
    display: grid;
    gap: 3px;
    padding: 10px;
    border-radius: 11px;
    background: var(--surface);
}

.occurrence-list span,
.occurrence-list small {
    color: var(--muted);
}

.monthly-control-grid .summary-card,
.migration-check-grid .metric-card,
.decision-card,
.detail-record-card {
    text-decoration: none;
}

.mini-status-list {
    display: grid;
    gap: 4px;
    margin: 10px 0 14px;
    padding: 0;
    list-style: none;
    color: var(--muted);
    font-size: .84rem;
}

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

.compact-row-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 10px;
    padding: 12px;
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
}

.compact-row-card small {
    grid-column: 1 / -1;
    color: var(--muted);
}

.mode-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.mode-tab {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    background: var(--surface);
    text-decoration: none;
    font-weight: 800;
}

.mode-tab.active,
.mode-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.sticky-tabs {
    position: sticky;
    top: 74px;
    z-index: 5;
    justify-content: flex-start;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: color-mix(in srgb, var(--card) 92%, transparent);
    backdrop-filter: blur(10px);
}

.category-metrics-readable {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.category-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
}

.detail-card-list,
.decision-card-list {
    display: grid;
    gap: 14px;
}

.detail-record-card,
.decision-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
}

.human-decisions-panel {
    display: grid;
    gap: 22px;
}

.decision-group-section {
    display: grid;
    gap: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

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

.decision-explain-grid > div {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--card);
}

.decision-explain-grid ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

.technical-import-panel {
    margin-top: 18px;
}

@media (max-width: 760px) {
    .monthly-open-layout,
    .confirm-box form,
    .confirmation-columns,
    .decision-explain-grid {
        grid-template-columns: 1fr;
    }

    .open-item-head {
        align-items: start;
        grid-template-columns: auto minmax(0, 1fr);
    }

    .open-item-head > strong {
        grid-column: 1 / -1;
    }

    .category-metrics,
    .category-action-grid {
        grid-template-columns: 1fr;
    }

    .pending-hero,
    .priority-grid {
        grid-template-columns: 1fr;
    }

    .pending-item-head {
        flex-direction: column;
    }

    .pending-item-head > strong {
        white-space: normal;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.category-redesign-page,
.category-detail-page {
    display: grid;
    gap: 18px;
}

.category-hero-v2,
.category-period-card,
.category-filter-card,
.category-detail-hero {
    border: 1px solid var(--border);
    border-radius: 24px;
    background:
        radial-gradient(circle at top left, color-mix(in srgb, var(--primary) 10%, transparent), transparent 32%),
        var(--card);
    box-shadow: var(--shadow);
}

.category-hero-v2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 20px;
}

.category-hero-v2 h2 {
    margin: 2px 0 0;
    max-width: 740px;
    font-size: clamp(1.15rem, 2vw, 1.7rem);
}

.category-hero-actions,
.category-search {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.category-search {
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
}

.category-search input {
    width: min(280px, 48vw);
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    padding: 8px 10px;
}

.mobile-filter-button {
    display: none;
}

.category-period-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    padding: 14px 18px;
}

.category-view-switch {
    display: inline-flex;
    gap: 6px;
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
}

.category-view-switch a {
    padding: 9px 16px;
    border-radius: 999px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 850;
}

.category-view-switch a.active {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 28%, transparent);
}

.category-period-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.period-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text);
    font-size: 1.55rem;
    text-decoration: none;
}

.category-period-picker {
    position: relative;
}

.category-period-picker > summary {
    min-width: 220px;
    padding: 11px 18px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    text-align: center;
    font-weight: 900;
    cursor: pointer;
    list-style: none;
}

.category-period-picker > summary::-webkit-details-marker {
    display: none;
}

.category-period-picker form {
    position: absolute;
    z-index: 30;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    gap: 10px;
    width: min(320px, 90vw);
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.category-kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(150px, 1fr));
    gap: 12px;
}

.category-kpi-card {
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    min-height: 142px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--card);
    color: var(--text);
    text-decoration: none;
    box-shadow: var(--shadow-sm, 0 8px 20px rgba(15, 23, 42, .06));
}

.category-kpi-card:hover,
.finance-category-card:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--primary) 36%, var(--border));
}

.category-kpi-card .kpi-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    color: #fff;
    background: var(--primary);
    font-weight: 900;
}

.category-kpi-card p {
    margin: 10px 0 4px;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.category-kpi-card strong {
    font-size: clamp(1.05rem, 1.6vw, 1.38rem);
    line-height: 1.1;
}

.category-kpi-card small {
    margin-top: 8px;
    color: var(--muted);
}

.category-kpi-card.income .kpi-icon,
.finance-category-card.is-income .category-icon-badge {
    background: linear-gradient(135deg, #16a34a, #22c55e);
}

.category-kpi-card.expense .kpi-icon,
.finance-category-card.is-expense .category-icon-badge {
    background: linear-gradient(135deg, #dc2626, #f97316);
}

.category-kpi-card.income-soft .kpi-icon {
    background: linear-gradient(135deg, #059669, #14b8a6);
}

.category-kpi-card.warning .kpi-icon {
    background: linear-gradient(135deg, #d97706, #f59e0b);
}

.category-kpi-card.card-waiting .kpi-icon {
    background: linear-gradient(135deg, #7c3aed, #2563eb);
}

.category-kpi-card.balance .kpi-icon {
    background: linear-gradient(135deg, #0f172a, #475569);
}

[data-theme="escuro"] .category-kpi-card.balance .kpi-icon {
    background: linear-gradient(135deg, #94a3b8, #475569);
}

.category-filter-card {
    display: grid;
    gap: 12px;
    padding: 14px;
}

.filter-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-chip {
    padding: 9px 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    font-weight: 800;
    font-size: .9rem;
}

.filter-chip.active,
.filter-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 9%, var(--surface));
}

.advanced-filter-panel > summary {
    width: fit-content;
    cursor: pointer;
    color: var(--primary);
    font-weight: 850;
}

.advanced-filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.checkbox-card {
    display: flex;
    gap: 8px;
    align-items: center;
    min-height: 44px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}

.filter-note {
    margin: 0;
}

.finance-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    align-items: stretch;
}

.finance-category-card {
    position: relative;
    display: grid;
    gap: 14px;
    min-height: 360px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--category-color) 10%, transparent), transparent 34%),
        var(--card);
    box-shadow: var(--shadow);
    transition: transform .16s ease, border-color .16s ease;
    overflow: visible;
}

.finance-category-card.is-empty {
    opacity: .78;
}

.category-card-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: 22px;
}

.category-card-top,
.category-value-stack,
.category-annual-meta,
.category-progress-footer,
.category-card-bottom,
.category-mini-bars,
.category-empty-state {
    position: relative;
    z-index: 2;
}

.category-card-top {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
}

.category-icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 16px;
    color: #fff;
    background: var(--category-color);
    font-size: 1.25rem;
    font-weight: 900;
    box-shadow: 0 12px 24px color-mix(in srgb, var(--category-color) 26%, transparent);
}

.category-icon-badge.detail {
    width: 58px;
    height: 58px;
    font-size: 1.45rem;
}

.category-title-block h3 {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.2;
}

.category-type-badge,
.category-status-pill {
    display: inline-flex;
    width: fit-content;
    margin-top: 6px;
    padding: 5px 9px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--category-color, var(--primary)) 12%, var(--surface));
    color: color-mix(in srgb, var(--category-color, var(--primary)) 80%, var(--text));
    font-size: .72rem;
    font-weight: 850;
}

.category-card-menu {
    position: relative;
    z-index: 4;
}

.category-card-menu > summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    cursor: pointer;
    list-style: none;
    font-size: 1.35rem;
    line-height: 1;
}

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

.category-menu-popover {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    display: grid;
    min-width: 210px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.category-menu-popover a {
    padding: 10px;
    border-radius: 10px;
    color: var(--text);
    text-decoration: none;
    font-weight: 750;
}

.category-menu-popover a:hover {
    background: var(--surface);
}

.category-value-stack {
    display: grid;
    gap: 8px;
}

.category-value-stack div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
}

.category-value-stack span,
.category-annual-meta span,
.category-card-bottom span {
    color: var(--muted);
    font-size: .84rem;
}

.category-value-stack strong {
    font-size: 1.02rem;
    text-align: right;
    white-space: nowrap;
}

.category-empty-state {
    padding: 10px 12px;
    border: 1px dashed var(--border);
    border-radius: 14px;
    color: var(--muted);
    background: var(--surface);
    font-weight: 750;
}

.category-annual-meta {
    display: grid;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 16px;
    background: var(--surface);
}

.category-progress-footer {
    align-self: end;
    display: grid;
    gap: 8px;
}

.category-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.category-status-row strong {
    color: var(--muted);
    font-size: .82rem;
}

.category-status-pill {
    margin: 0;
}

.category-status-pill.is-success {
    color: #15803d;
    background: color-mix(in srgb, #22c55e 15%, var(--surface));
}

.category-status-pill.is-warning {
    color: #b45309;
    background: color-mix(in srgb, #f59e0b 18%, var(--surface));
}

.category-status-pill.is-danger {
    color: #b91c1c;
    background: color-mix(in srgb, #ef4444 16%, var(--surface));
}

.category-status-pill.is-neutral {
    color: var(--muted);
    background: var(--surface);
}

.category-progress-track {
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: color-mix(in srgb, var(--border) 55%, transparent);
}

.category-progress-track span {
    display: block;
    height: 100%;
    max-width: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--category-color), color-mix(in srgb, var(--category-color) 45%, #fff));
}

.category-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 4px;
}

.category-detail-link {
    position: relative;
    z-index: 3;
    color: var(--primary);
    font-weight: 900;
    text-decoration: none;
}

.category-mini-bars {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 4px;
    height: 54px;
    align-items: end;
}

.category-mini-bars a {
    display: flex;
    align-items: end;
    min-height: 28px;
    border-radius: 7px;
    background: var(--surface);
    overflow: hidden;
}

.category-mini-bars span {
    display: block;
    width: 100%;
    min-height: 2px;
    border-radius: 7px 7px 0 0;
    background: var(--category-color);
}

.category-detail-hero {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 20px;
}

.category-detail-hero h2 {
    margin: 0;
}

.detail-hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.detail-hero-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(110px, 1fr));
    gap: 10px;
}

.detail-hero-summary span,
.tab-summary-grid article {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}

.detail-hero-summary small,
.tab-summary-grid small {
    display: block;
    color: var(--muted);
    font-size: .75rem;
}

.tab-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.category-annual-chart {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 8px;
    min-height: 180px;
    align-items: end;
}

.category-annual-chart a {
    display: grid;
    grid-template-rows: 1fr auto auto;
    align-items: end;
    gap: 5px;
    min-height: 160px;
    padding: 8px 5px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    text-align: center;
    text-decoration: none;
}

.category-annual-chart span {
    width: 100%;
    min-height: 3px;
    border-radius: 8px 8px 2px 2px;
    background: var(--primary);
}

.category-annual-chart small,
.category-annual-chart strong {
    font-size: .72rem;
}

@media (min-width: 1680px) {
    .finance-category-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 1480px) {
    .category-kpi-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1120px) {
    .category-hero-v2,
    .category-period-card,
    .category-detail-hero {
        grid-template-columns: 1fr;
    }

    .category-hero-actions {
        justify-content: stretch;
    }

    .category-search {
        flex: 1 1 100%;
    }

    .category-search input {
        width: 100%;
    }

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

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

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

    .detail-hero-summary,
    .tab-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mobile-filter-button {
        display: inline-flex;
    }
}

@media (max-width: 560px) {
    .category-hero-v2,
    .category-period-card,
    .category-filter-card,
    .category-detail-hero {
        border-radius: 18px;
        padding: 14px;
    }

    .category-kpi-grid,
    .finance-category-grid,
    .advanced-filter-grid,
    .detail-hero-summary,
    .tab-summary-grid {
        grid-template-columns: 1fr;
    }

    .category-view-switch {
        width: 100%;
        justify-content: space-between;
    }

    .category-view-switch a {
        flex: 1;
        text-align: center;
    }

    .category-period-nav {
        gap: 6px;
    }

    .category-period-picker > summary {
        min-width: 0;
        width: 180px;
    }

    .finance-category-card {
        min-height: 0;
    }

    .category-annual-chart {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

/* Categorias - layout limpo inspirado em database/cards */
.notion-categories-page {
    display: flex;
    flex-direction: column;
    gap: 12px;
    color: #111827;
}

.notion-year-board {
    min-height: 96px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    justify-items: center;
    border: 1px solid #e6e3de;
    border-top: 0;
    border-radius: 0 0 10px 10px;
    background: #ffffff;
}

.notion-year-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    height: 34px;
    padding: 0 16px;
    border: 1px solid #d9d5ce;
    border-radius: 7px;
    background: #f3f2f0;
    color: #111827;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.notion-year-chip.active {
    background: #ffffff;
    border-color: #cfcac2;
}

.notion-database-shell {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.notion-database-tabs {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 2px 0 4px;
}

.notion-view-tabs,
.notion-toolbar,
.notion-period-switch,
.notion-period-picker {
    display: flex;
    align-items: center;
    gap: 6px;
}

.notion-view-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    color: #57534e;
    font-size: 15px;
    font-weight: 650;
    text-decoration: none;
}

.notion-view-tab.active {
    background: #f1f1ef;
    color: #111827;
}

.view-tab-icon {
    font-size: 15px;
}

.notion-toolbar {
    color: #8a8580;
}

.notion-toolbar > a,
.notion-toolbar-search > summary {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    color: #8a8580;
    text-decoration: none;
    cursor: pointer;
}

.notion-toolbar > a:hover,
.notion-toolbar-search > summary:hover {
    background: #f3f2f0;
    color: #2563eb;
}

.notion-toolbar-search {
    position: relative;
}

.notion-toolbar-search > summary {
    list-style: none;
}

.notion-toolbar-search > summary::-webkit-details-marker {
    display: none;
}

.notion-toolbar-search form {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 20;
    width: 260px;
    padding: 10px;
    border: 1px solid #e6e3de;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
}

.notion-toolbar-search input,
.notion-filter-grid input,
.notion-filter-grid select,
.notion-period-picker input,
.notion-period-picker select {
    width: 100%;
    min-height: 34px;
    border: 1px solid #ddd8d0;
    border-radius: 7px;
    background: #ffffff;
    color: #111827;
    padding: 6px 9px;
    font: inherit;
}

.notion-new-button {
    width: auto !important;
    min-width: 72px;
    padding: 0 10px !important;
    gap: 7px;
    background: #2383e2;
    color: #ffffff !important;
    border-radius: 7px;
    font-weight: 700;
}

.notion-new-button:hover {
    background: #1f73c9 !important;
    color: #ffffff !important;
}

.notion-period-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 4px 0 8px;
    border-bottom: 1px solid #efede9;
}

.notion-period-switch {
    background: #f7f6f3;
    border-radius: 999px;
    padding: 3px;
}

.notion-period-switch a {
    padding: 5px 10px;
    border-radius: 999px;
    color: #6b625b;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
}

.notion-period-switch a.active {
    background: #ffffff;
    color: #111827;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.notion-period-picker > a {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #f7f6f3;
    color: #6b625b;
    text-decoration: none;
}

.notion-period-picker details {
    position: relative;
}

.notion-period-picker summary {
    min-width: 128px;
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e6e3de;
    border-radius: 7px;
    background: #ffffff;
    color: #111827;
    font-size: 13px;
    font-weight: 700;
    list-style: none;
    cursor: pointer;
}

.notion-period-picker summary::-webkit-details-marker {
    display: none;
}

.notion-period-picker form {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 18;
    width: 240px;
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid #e6e3de;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
}

.notion-period-picker button,
.notion-filter-actions button {
    min-height: 34px;
    border: 0;
    border-radius: 7px;
    background: #2383e2;
    color: #ffffff;
    padding: 0 12px;
    font-weight: 700;
    cursor: pointer;
}

.notion-filter-panel {
    border: 1px solid #efede9;
    border-radius: 10px;
    background: #ffffff;
}

.notion-filter-panel > summary {
    padding: 10px 12px;
    color: #6b625b;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}

.notion-filter-panel > summary::-webkit-details-marker {
    display: none;
}

.notion-filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 0 12px 12px;
}

.notion-filter-grid label {
    display: grid;
    gap: 5px;
    color: #6b625b;
    font-size: 12px;
    font-weight: 700;
}

.notion-checkbox {
    align-content: end;
    grid-template-columns: auto 1fr;
    align-items: center;
}

.notion-checkbox input {
    width: auto;
    min-height: auto;
}

.notion-filter-actions {
    display: flex;
    align-items: end;
    gap: 8px;
}

.notion-filter-actions a {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border-radius: 7px;
    background: #f3f2f0;
    color: #57534e;
    font-weight: 700;
    text-decoration: none;
}

.notion-muted-line {
    margin: 0;
    color: #8a8580;
    font-size: 12px;
}

.notion-category-grid.finance-category-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(190px, 1fr));
    gap: 14px;
}

.notion-category-card.finance-category-card {
    position: relative;
    min-height: 160px;
    display: block;
    padding: 14px 12px 12px;
    border: 1px solid #e6e3de;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: none;
    overflow: visible;
    transition: background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.notion-category-card.finance-category-card:hover {
    background: #fbfaf8;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.notion-category-card .category-card-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: 10px;
}

.notion-card-title,
.notion-type-pill,
.notion-card-field,
.notion-year-tag,
.notion-card-note,
.notion-card-menu {
    position: relative;
    z-index: 2;
}

.notion-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 28px;
}

.notion-card-icon {
    width: 18px;
    min-width: 18px;
    display: inline-flex;
    justify-content: center;
    color: #df4d49;
    font-size: 15px;
    line-height: 1;
}

.notion-category-card.is-income .notion-card-icon {
    color: #2c9f64;
}

.notion-card-title h3 {
    margin: 0;
    color: #111827;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.25;
}

.notion-type-pill,
.notion-year-tag {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1;
}

.notion-type-pill {
    margin-top: 14px;
    padding: 4px 6px;
    background: #f7d8d4;
    color: #8f302b;
}

.notion-category-card.is-income .notion-type-pill {
    background: #dcefe3;
    color: #256946;
}

.notion-card-field {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.notion-card-field span {
    color: #111827;
    font-size: 12px;
    font-weight: 700;
}

.notion-card-field strong {
    color: #111827;
    font-size: 13px;
    font-weight: 500;
}

.notion-year-tag {
    margin-top: 12px;
    padding: 5px 7px;
    background: #f7d8d4;
    color: #8f302b;
}

.notion-card-note {
    margin: 12px 0 0;
    color: #8a8580;
    font-size: 11px;
    line-height: 1.45;
}

.notion-card-menu {
    position: absolute;
    top: 10px;
    right: 10px;
}

.notion-card-menu > summary {
    width: 26px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: #a19b94;
    font-size: 10px;
    letter-spacing: 1px;
    list-style: none;
    cursor: pointer;
}

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

.notion-card-menu > summary:hover {
    background: #f3f2f0;
    color: #111827;
}

.notion-card-menu-popover {
    top: calc(100% + 6px);
    right: 0;
    min-width: 190px;
}

.notion-empty-state {
    grid-column: 1 / -1;
    padding: 28px;
    border: 1px dashed #ddd8d0;
    border-radius: 10px;
    color: #8a8580;
    text-align: center;
}

[data-theme="escuro"] .notion-categories-page {
    color: #f8fafc;
}

[data-theme="escuro"] .notion-year-board,
[data-theme="escuro"] .notion-filter-panel,
[data-theme="escuro"] .notion-category-card.finance-category-card,
[data-theme="escuro"] .notion-toolbar-search form,
[data-theme="escuro"] .notion-period-picker form {
    border-color: #263244;
    background: #0f172a;
}

[data-theme="escuro"] .notion-year-chip,
[data-theme="escuro"] .notion-view-tab.active,
[data-theme="escuro"] .notion-period-switch,
[data-theme="escuro"] .notion-period-picker > a,
[data-theme="escuro"] .notion-filter-actions a {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}

[data-theme="escuro"] .notion-year-chip.active,
[data-theme="escuro"] .notion-period-switch a.active,
[data-theme="escuro"] .notion-period-picker summary,
[data-theme="escuro"] .notion-toolbar-search input,
[data-theme="escuro"] .notion-filter-grid input,
[data-theme="escuro"] .notion-filter-grid select,
[data-theme="escuro"] .notion-period-picker input,
[data-theme="escuro"] .notion-period-picker select {
    background: #111827;
    border-color: #334155;
    color: #f8fafc;
}

[data-theme="escuro"] .notion-category-card.finance-category-card:hover {
    background: #111c31;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

[data-theme="escuro"] .notion-card-title h3,
[data-theme="escuro"] .notion-card-field span,
[data-theme="escuro"] .notion-card-field strong {
    color: #f8fafc;
}

[data-theme="escuro"] .notion-period-row {
    border-bottom-color: #263244;
}

[data-theme="escuro"] .notion-card-menu > summary:hover,
[data-theme="escuro"] .notion-toolbar > a:hover,
[data-theme="escuro"] .notion-toolbar-search > summary:hover {
    background: #1e293b;
}

@media (max-width: 1500px) {
    .notion-category-grid.finance-category-grid {
        grid-template-columns: repeat(4, minmax(190px, 1fr));
    }
}

@media (max-width: 1180px) {
    .notion-category-grid.finance-category-grid {
        grid-template-columns: repeat(3, minmax(190px, 1fr));
    }

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

@media (max-width: 860px) {
    .notion-year-board {
        min-height: 78px;
    }

    .notion-database-tabs,
    .notion-period-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .notion-toolbar {
        flex-wrap: wrap;
    }

    .notion-category-grid.finance-category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 560px) {
    .notion-year-board {
        gap: 8px;
        grid-template-columns: 1fr;
        padding: 12px;
    }

    .notion-year-chip {
        width: 100%;
    }

    .notion-view-tabs,
    .notion-period-switch,
    .notion-period-picker {
        width: 100%;
        justify-content: space-between;
    }

    .notion-category-grid.finance-category-grid,
    .notion-filter-grid {
        grid-template-columns: 1fr;
    }
}

/* Categorias - versão profissional */
.pro-categories-page {
    --pro-surface: #ffffff;
    --pro-surface-muted: #f6f8fb;
    --pro-border: #e3e8ef;
    --pro-border-strong: #d6dde8;
    --pro-text: #102033;
    --pro-muted: #687386;
    --pro-blue: #2563eb;
    --pro-shadow: 0 18px 46px rgba(15, 23, 42, 0.08);
    --pro-card-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    display: grid;
    gap: 18px;
    color: var(--pro-text);
}

.pro-category-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    padding: 24px;
    border: 1px solid var(--pro-border);
    border-radius: 24px;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.13), transparent 34%),
        linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: var(--pro-shadow);
    overflow: hidden;
}

.pro-category-hero::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: linear-gradient(180deg, #2563eb, #0f766e);
}

.pro-hero-copy {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 6px;
}

.pro-eyebrow {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.09);
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.pro-hero-copy h2 {
    margin: 0;
    color: var(--pro-text);
    font-size: clamp(26px, 3vw, 38px);
    font-weight: 850;
    letter-spacing: -0.04em;
}

.pro-hero-copy p {
    margin: 0;
    max-width: 640px;
    color: var(--pro-muted);
    font-size: 15px;
    line-height: 1.55;
}

.pro-hero-actions {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.pro-search {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 340px;
    padding: 6px;
    border: 1px solid var(--pro-border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.pro-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--pro-text);
    padding: 8px 10px;
    font: inherit;
    outline: none;
}

.pro-search button,
.pro-primary-button {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    padding: 0 16px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.26);
}

.pro-year-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.pro-year-card {
    min-height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--pro-border);
    border-radius: 20px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,250,252,0.96)),
        var(--pro-surface);
    color: var(--pro-text);
    text-decoration: none;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}

.pro-year-card span {
    display: inline-flex;
    min-width: 86px;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--pro-border-strong);
    border-radius: 12px;
    background: #ffffff;
    color: var(--pro-text);
    font-size: 16px;
    font-weight: 850;
    box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.04);
}

.pro-year-card.active {
    border-color: rgba(37, 99, 235, 0.34);
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.13), transparent 44%),
        #ffffff;
}

.pro-year-card.active span {
    border-color: rgba(37, 99, 235, 0.36);
    color: #1d4ed8;
}

.pro-workspace-card {
    display: grid;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--pro-border);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: var(--pro-shadow);
}

.pro-viewbar,
.pro-periodbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.pro-view-tabs,
.pro-toolbar,
.pro-period-switch,
.pro-period-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pro-view-tabs a,
.pro-toolbar a,
.pro-period-switch a {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 999px;
    color: var(--pro-muted);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    transition: background 140ms ease, color 140ms ease;
}

.pro-view-tabs a {
    padding: 0 14px;
}

.pro-toolbar a {
    padding: 0 12px;
    background: #f7f9fc;
    border: 1px solid var(--pro-border);
}

.pro-view-tabs a.active,
.pro-view-tabs a:hover,
.pro-period-switch a.active {
    background: #eef4ff;
    color: #1d4ed8;
}

.pro-toolbar a:hover {
    color: #1d4ed8;
    background: #eef4ff;
}

.pro-periodbar {
    padding: 12px;
    border: 1px solid var(--pro-border);
    border-radius: 18px;
    background: #f8fafc;
}

.pro-period-switch {
    padding: 4px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid var(--pro-border);
}

.pro-period-switch a {
    min-width: 64px;
    padding: 0 12px;
}

.pro-period-picker {
    position: relative;
}

.pro-period-arrow,
.pro-period-picker summary {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--pro-border);
    border-radius: 999px;
    background: #ffffff;
    color: var(--pro-text);
    text-decoration: none;
    font-weight: 850;
}

.pro-period-arrow {
    width: 38px;
    font-size: 22px;
}

.pro-period-picker summary {
    min-width: 178px;
    padding: 0 18px;
    list-style: none;
    cursor: pointer;
}

.pro-period-picker summary::-webkit-details-marker {
    display: none;
}

.pro-period-picker details {
    position: relative;
}

.pro-period-picker form {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    z-index: 30;
    width: 260px;
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--pro-border);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.16);
}

.pro-period-picker label,
.pro-filter-grid label {
    display: grid;
    gap: 6px;
    color: var(--pro-muted);
    font-size: 12px;
    font-weight: 800;
}

.pro-period-picker input,
.pro-period-picker select,
.pro-filter-grid input,
.pro-filter-grid select {
    min-height: 38px;
    width: 100%;
    border: 1px solid var(--pro-border);
    border-radius: 12px;
    background: #ffffff;
    color: var(--pro-text);
    padding: 8px 10px;
    font: inherit;
}

.pro-period-picker button,
.pro-filter-actions button {
    min-height: 38px;
    border: 0;
    border-radius: 12px;
    background: #2563eb;
    color: #ffffff;
    padding: 0 14px;
    font-weight: 850;
    cursor: pointer;
}

.pro-filter-drawer {
    border: 1px solid var(--pro-border);
    border-radius: 18px;
    background: #ffffff;
}

.pro-filter-drawer > summary {
    padding: 13px 15px;
    color: var(--pro-text);
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
    list-style: none;
}

.pro-filter-drawer > summary::-webkit-details-marker {
    display: none;
}

.pro-filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 0 15px 15px;
}

.pro-check {
    grid-template-columns: auto 1fr;
    align-content: end;
    align-items: center;
}

.pro-check input {
    min-height: 0;
    width: auto;
}

.pro-filter-actions {
    display: flex;
    align-items: end;
    gap: 8px;
}

.pro-filter-actions a {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #f1f5f9;
    color: var(--pro-muted);
    padding: 0 14px;
    font-size: 13px;
    font-weight: 850;
    text-decoration: none;
}

.pro-muted-line {
    margin: -2px 2px 0;
    color: var(--pro-muted);
    font-size: 12px;
}

.pro-category-grid.finance-category-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(240px, 1fr));
    gap: 18px;
}

.pro-category-card.finance-category-card {
    position: relative;
    min-height: 236px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    border: 1px solid var(--pro-border);
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(248, 250, 252, 0.97)),
        #ffffff;
    box-shadow: var(--pro-card-shadow);
    overflow: hidden;
    isolation: isolate;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.pro-category-card.finance-category-card:hover {
    transform: translateY(-4px);
    border-color: color-mix(in srgb, var(--category-color) 42%, var(--pro-border));
    box-shadow: 0 22px 46px rgba(15, 23, 42, 0.13);
}

.pro-card-accent {
    position: absolute;
    inset: 0 0 auto;
    height: 5px;
    background: linear-gradient(90deg, var(--category-color), color-mix(in srgb, var(--category-color) 45%, #ffffff));
    z-index: 0;
}

.pro-category-card::after {
    content: "";
    position: absolute;
    right: -44px;
    top: -44px;
    width: 128px;
    height: 128px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--category-color) 11%, transparent);
    z-index: 0;
}

.pro-category-card .category-card-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: 22px;
}

.pro-card-header,
.pro-card-menu,
.pro-main-metric,
.pro-card-facts,
.pro-card-footer {
    position: relative;
    z-index: 2;
}

.pro-card-header {
    display: grid;
    grid-template-columns: 50px 1fr;
    gap: 13px;
    align-items: start;
    padding-right: 34px;
}

.pro-card-icon {
    width: 50px;
    height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: color-mix(in srgb, var(--category-color) 14%, #ffffff);
    color: var(--category-color);
    font-size: 21px;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--category-color) 18%, transparent);
}

.pro-card-header h3 {
    margin: 2px 0 8px;
    color: var(--pro-text);
    font-size: 18px;
    font-weight: 850;
    line-height: 1.18;
    letter-spacing: -0.02em;
}

.pro-type-badge {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--category-color) 12%, #ffffff);
    color: color-mix(in srgb, var(--category-color) 78%, #111827);
    font-size: 11px;
    font-weight: 850;
}

.pro-card-menu {
    position: absolute;
    top: 16px;
    right: 16px;
}

.pro-card-menu > summary {
    width: 34px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: #8a94a6;
    font-size: 11px;
    letter-spacing: 1px;
    list-style: none;
    cursor: pointer;
}

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

.pro-card-menu > summary:hover {
    background: #eef2f7;
    color: var(--pro-text);
}

.pro-card-popover {
    right: 0;
    top: calc(100% + 8px);
    min-width: 210px;
    z-index: 40;
}

.pro-main-metric {
    display: grid;
    gap: 5px;
    margin-top: auto;
    padding: 14px;
    border: 1px solid #edf1f6;
    border-radius: 18px;
    background: rgba(255,255,255,0.72);
}

.pro-main-metric span {
    color: var(--pro-muted);
    font-size: 12px;
    font-weight: 800;
}

.pro-main-metric strong {
    color: var(--pro-text);
    font-size: 24px;
    font-weight: 900;
    letter-spacing: -0.04em;
}

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

.pro-card-facts div {
    display: grid;
    gap: 4px;
    padding: 10px;
    border-radius: 14px;
    background: #f8fafc;
}

.pro-card-facts small {
    color: var(--pro-muted);
    font-size: 11px;
    font-weight: 800;
}

.pro-card-facts strong {
    color: var(--pro-text);
    font-size: 13px;
    font-weight: 850;
}

.pro-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.pro-year-tag,
.pro-status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 0 10px;
    font-size: 11px;
    font-weight: 850;
    white-space: nowrap;
}

.pro-year-tag {
    background: #eef2ff;
    color: #3730a3;
}

.pro-status-pill {
    background: #f1f5f9;
    color: #64748b;
}

.pro-status-pill.is-success {
    background: #dcfce7;
    color: #166534;
}

.pro-status-pill.is-warning {
    background: #fef3c7;
    color: #92400e;
}

.pro-status-pill.is-danger {
    background: #fee2e2;
    color: #991b1b;
}

.pro-empty-state {
    grid-column: 1 / -1;
    padding: 34px;
    border: 1px dashed var(--pro-border-strong);
    border-radius: 22px;
    color: var(--pro-muted);
    text-align: center;
    background: #ffffff;
}

[data-theme="escuro"] .pro-categories-page {
    --pro-surface: #111827;
    --pro-surface-muted: #0f172a;
    --pro-border: #253246;
    --pro-border-strong: #334155;
    --pro-text: #f8fafc;
    --pro-muted: #a5b4c7;
    --pro-shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
    --pro-card-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
}

[data-theme="escuro"] .pro-category-hero,
[data-theme="escuro"] .pro-workspace-card,
[data-theme="escuro"] .pro-year-card,
[data-theme="escuro"] .pro-category-card.finance-category-card,
[data-theme="escuro"] .pro-filter-drawer,
[data-theme="escuro"] .pro-period-picker form,
[data-theme="escuro"] .pro-empty-state {
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(17, 24, 39, 0.98)),
        #0f172a;
}

[data-theme="escuro"] .pro-search,
[data-theme="escuro"] .pro-periodbar,
[data-theme="escuro"] .pro-period-switch,
[data-theme="escuro"] .pro-period-arrow,
[data-theme="escuro"] .pro-period-picker summary,
[data-theme="escuro"] .pro-main-metric,
[data-theme="escuro"] .pro-card-facts div,
[data-theme="escuro"] .pro-toolbar a,
[data-theme="escuro"] .pro-year-card span,
[data-theme="escuro"] .pro-filter-actions a,
[data-theme="escuro"] .pro-period-picker input,
[data-theme="escuro"] .pro-period-picker select,
[data-theme="escuro"] .pro-filter-grid input,
[data-theme="escuro"] .pro-filter-grid select {
    border-color: #334155;
    background: #111827;
    color: #f8fafc;
}

[data-theme="escuro"] .pro-search input {
    color: #f8fafc;
}

[data-theme="escuro"] .pro-card-menu > summary:hover,
[data-theme="escuro"] .pro-toolbar a:hover {
    background: #1e293b;
}

@media (max-width: 1500px) {
    .pro-category-grid.finance-category-grid {
        grid-template-columns: repeat(3, minmax(240px, 1fr));
    }
}

@media (max-width: 1180px) {
    .pro-category-hero,
    .pro-viewbar,
    .pro-periodbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .pro-hero-actions,
    .pro-search {
        width: 100%;
    }

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

@media (max-width: 820px) {
    .pro-year-panel,
    .pro-category-grid.finance-category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .pro-category-hero,
    .pro-workspace-card {
        border-radius: 18px;
        padding: 15px;
    }

    .pro-year-panel,
    .pro-category-grid.finance-category-grid,
    .pro-filter-grid,
    .pro-card-facts {
        grid-template-columns: 1fr;
    }

    .pro-view-tabs,
    .pro-toolbar,
    .pro-period-switch,
    .pro-period-picker {
        width: 100%;
    }

    .pro-period-switch a,
    .pro-period-picker summary {
        flex: 1;
    }

    .pro-search {
        min-width: 0;
        border-radius: 16px;
        flex-direction: column;
        align-items: stretch;
    }
}

/* Ajuste fino: cards mais sóbrios e densidade melhor no desktop */
.pro-category-grid.finance-category-grid {
    grid-template-columns: repeat(4, minmax(220px, 1fr));
}

.pro-category-card.finance-category-card {
    min-height: 214px;
    gap: 13px;
    padding: 18px;
}

.pro-category-card::after {
    display: none;
}

.pro-main-metric {
    padding: 12px;
}

.pro-main-metric strong {
    font-size: 21px;
}

.pro-card-facts div {
    padding: 9px;
}

@media (max-width: 1280px) {
    .pro-category-grid.finance-category-grid {
        grid-template-columns: repeat(3, minmax(220px, 1fr));
    }
}

/* Correção final de cascata: categorias precisam vencer os ajustes de desktop
   quando a tela é tablet/celular. */
@media (max-width: 820px) {
    .pro-category-grid.finance-category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .pro-categories-page,
    .pro-category-hero,
    .pro-workspace-card,
    .pro-category-grid.finance-category-grid,
    .pro-category-card.finance-category-card {
        min-width: 0;
        max-width: 100%;
    }

    .pro-categories-page {
        overflow-x: hidden;
    }

    .pro-category-hero,
    .pro-workspace-card {
        padding: 15px;
    }

    .pro-hero-copy,
    .pro-hero-actions,
    .pro-search,
    .pro-primary-button {
        width: 100%;
        min-width: 0;
    }

    .pro-hero-copy p {
        max-width: 100%;
    }

    .pro-hero-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .pro-search {
        flex-direction: column;
        align-items: stretch;
        border-radius: 16px;
    }

    .pro-search input,
    .pro-search button,
    .pro-primary-button {
        width: 100%;
    }

    .pro-year-panel,
    .pro-category-grid.finance-category-grid,
    .pro-filter-grid,
    .pro-card-facts {
        grid-template-columns: minmax(0, 1fr);
    }

    .pro-view-tabs,
    .pro-toolbar,
    .pro-period-switch,
    .pro-period-picker {
        width: 100%;
        min-width: 0;
    }

    .pro-view-tabs,
    .pro-toolbar {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: thin;
    }

    .pro-view-tabs a,
    .pro-toolbar a {
        flex: 0 0 auto;
    }

    .pro-periodbar {
        min-width: 0;
        overflow: visible;
    }

    .pro-period-picker summary {
        min-width: 0;
    }

    .pro-category-card.finance-category-card {
        width: 100%;
    }

    .pro-card-footer {
        flex-wrap: wrap;
    }
}
