/* ============================================================
   Finanças Oliveira - camada visual v2
   Carregada depois de style.css: identidade da logo (azul-marinho
   + dourado) e experiência de aplicativo no celular.
   ============================================================ */

:root {
    --brand-900: #0F1A33;
    --brand-800: #14213D;
    --brand: #1B2B4F;
    --brand-600: #2A3F6E;
    --brand-100: #E8EDF6;
    --brand-50: #F4F6FB;
    --gold: #C9A24E;
    --gold-600: #A9862F;
    --gold-100: #F7EFDC;

    --primary: var(--brand);
    --primary-dark: var(--brand-900);
    --bg: #F4F6FB;
    --card: #FFFFFF;
    --text: #14213D;
    --muted: #5F6B82;
    --border: #E3E8F0;
    --success: #15803D;
    --danger: #C62828;
    --warning: #B7791F;
    --info: #2563EB;

    --radius: 18px;
    --shadow: 0 1px 2px rgba(20, 33, 61, 0.04), 0 8px 24px rgba(20, 33, 61, 0.06);
    --shadow-strong: 0 18px 44px rgba(20, 33, 61, 0.16);
    --header-height: 64px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html {
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

.icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

:focus-visible {
    outline: 3px solid rgba(201, 162, 78, 0.55);
    outline-offset: 2px;
}

/* ------------------------------------------------------------
   Barra superior
   ------------------------------------------------------------ */

.app-header {
    height: calc(var(--header-height) + var(--safe-top));
    padding-top: var(--safe-top);
    background: var(--brand);
    color: #fff;
    border-bottom: 0;
    box-shadow: 0 6px 20px rgba(15, 26, 51, 0.18);
    backdrop-filter: none;
}

.app-body {
    margin-top: calc(var(--header-height) + var(--safe-top));
}

.app-sidebar {
    top: calc(var(--header-height) + var(--safe-top));
    height: calc(100vh - var(--header-height) - var(--safe-top));
}

.header-content {
    padding: 0 20px 0 max(20px, env(safe-area-inset-left));
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: #fff;
    text-decoration: none;
}

.app-brand__mark {
    width: 38px;
    height: 38px;
    padding: 3px;
    border-radius: 11px;
    background: #fff;
    object-fit: contain;
}

.app-brand__text strong {
    display: block;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.15;
    white-space: nowrap;
}

.app-brand__text small {
    display: block;
    color: var(--gold);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    white-space: nowrap;
}

.app-header__page {
    display: none;
}

.menu-toggle {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.menu-toggle .icon {
    width: 22px;
    height: 22px;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 14px;
}

.user-chip__avatar {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-weight: 700;
}

.user-info {
    color: inherit;
    font-weight: 600;
}

.btn-logout {
    display: inline-grid;
    place-items: center;
    width: 40px;
    min-height: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.16);
}

/* ------------------------------------------------------------
   Menu lateral
   ------------------------------------------------------------ */

.app-sidebar {
    padding: 10px 12px 18px;
    background: #fff;
    border-right: 1px solid var(--border);
    box-shadow: none;
}

.sidebar-brand {
    display: none;
}

.nav-section {
    margin: 18px 12px 6px;
    color: #98A2B3;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-nav > .nav-section:first-child {
    margin-top: 6px;
}

.nav-link {
    gap: 12px;
    width: 100%;
    min-height: 44px;
    margin: 2px 0;
    padding: 10px 12px;
    border: 0;
    border-radius: 12px;
    background: none;
    color: #3B4660;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.nav-link:hover {
    background: var(--brand-50);
    color: var(--brand);
}

.nav-link.active {
    border: 0;
    background: var(--brand);
    color: #fff;
    box-shadow: 0 6px 16px rgba(27, 43, 79, 0.22);
}

.nav-link.active .embed-icon {
    color: var(--gold);
}

.embed-icon .icon {
    width: 20px;
    height: 20px;
}

.nav-menu--footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.nav-link--logout {
    color: var(--danger);
}

.nav-link--install {
    color: var(--gold-600);
}

/* ------------------------------------------------------------
   Conteúdo
   ------------------------------------------------------------ */

.page-header h2,
.dashboard-title {
    color: var(--text);
    font-size: clamp(22px, 2.4vw, 30px);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.page-subtitle,
.dashboard-subtitle {
    margin-top: 4px;
    color: var(--muted);
    font-size: 14px;
}

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #EEF1F6;
}

.card-header h3 {
    color: var(--text);
    font-weight: 700;
}

.metric-card {
    border-color: var(--border);
    box-shadow: var(--shadow);
}

/* Botões */
.btn,
.btn-login,
.btn-add-expense {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    border-radius: 12px;
    font-weight: 600;
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.btn:active,
.btn-login:active,
.btn-add-expense:active {
    transform: scale(0.98);
}

.btn .icon {
    width: 18px;
    height: 18px;
}

.btn-primary,
.btn-login,
.btn-add-expense {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
    box-shadow: 0 6px 16px rgba(27, 43, 79, 0.2);
}

.btn-primary:hover,
.btn-login:hover,
.btn-add-expense:hover {
    background: var(--brand-600);
    box-shadow: 0 10px 22px rgba(27, 43, 79, 0.26);
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.btn-info {
    border-color: transparent;
    background: var(--brand-100);
    color: var(--brand);
}

.btn-secondary {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
}

.btn-sm {
    min-height: 36px;
    border-radius: 10px;
}

/* Formulários */
.form-group label,
.modal label {
    color: #344054;
    font-size: 13px;
    font-weight: 600;
}

.form-group :is(input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]), select, textarea),
.filter-form :is(input, select) {
    min-height: 46px;
    border: 1px solid #D5DCE7;
    border-radius: 12px;
    background-color: #fff;
    color: var(--text);
}

.form-group :is(input, select, textarea):focus,
.filter-form :is(input, select):focus,
.dash-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(27, 43, 79, 0.14);
    outline: none;
}

input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--brand);
}

/* Cartões: cabeçalho com seletor de mês ‹ Outubro 2026 › */
.card-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
}

.card-page-header__title {
    flex: 1 1 auto;
    min-width: 0;
}

.back-link {
    display: inline-block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.back-link:hover {
    color: var(--brand);
}

.month-switcher {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.month-switcher__arrow {
    display: grid;
    place-items: center;
    width: 48px;
    color: var(--brand);
    font-size: 26px;
    line-height: 1;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.month-switcher__arrow:hover {
    background: var(--brand-50);
}

.month-switcher__arrow.is-disabled {
    color: #C5CCD8;
}

.month-switcher__current {
    position: relative;
    display: grid;
    justify-items: center;
    min-width: 150px;
    padding: 6px 14px;
    border-right: 1px solid var(--border);
    border-left: 1px solid var(--border);
    cursor: pointer;
}

.month-switcher__current small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.month-switcher__current strong {
    color: var(--text);
    font-size: 16px;
    white-space: nowrap;
}

/* O seletor nativo de mês fica invisível por cima do texto: tocar abre o calendário */
.month-switcher__picker {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.month-switcher__today {
    text-decoration: none;
}

@media (max-width: 768px) {
    .card-page-header > .btn {
        flex: 0 0 auto;
        width: auto;
    }

    .month-switcher {
        flex: 1 1 100%;
    }

    .month-switcher__current {
        flex: 1;
    }

    .month-switcher__arrow {
        width: 56px;
    }
}

/* Janela "Pagar fatura": cartão e valor em destaque */
.pay-invoice-summary {
    display: grid;
    gap: 4px;
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--brand-900), var(--brand-600));
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
}

.pay-invoice-summary strong {
    color: #fff;
    font-size: 24px;
}

/* Categoria + Subcategoria: ocupa a linha inteira mesmo dentro de grids de formulário */
.category-picker {
    grid-column: 1 / -1;
}

/* Opção "+ Cadastrar ..." da busca */
.autocomplete-suggestion--create strong {
    color: var(--brand);
}

.autocomplete-suggestion--create {
    border-top: 1px dashed var(--border);
    background: var(--gold-100);
}

.autocomplete-field.is-loading .autocomplete-input {
    background-image: linear-gradient(90deg, transparent, rgba(201, 162, 78, 0.18), transparent);
    background-size: 200% 100%;
    animation: app-loading 1s linear infinite;
}

@keyframes app-loading {
    from { background-position: 100% 0; }
    to { background-position: -100% 0; }
}

/* Valores em R$: mesma fonte dos outros campos, com números alinhados */
.money-input {
    font-family: inherit;
    font-variant-numeric: tabular-nums;
}

/* Tabelas */
.table th {
    background: var(--brand-50);
    color: #475467;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.table td {
    border-color: #EEF1F6;
}

.badge {
    border-radius: 999px;
}

/* Alertas */
.alert-banner .icon,
.btn-export .icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    vertical-align: -3px;
}

.toast-success {
    bottom: calc(96px + var(--safe-bottom));
    border-radius: 999px;
    background: var(--success);
    box-shadow: var(--shadow-strong);
}

/* Modais */
.modal-close {
    border-radius: 12px;
    background: var(--brand-50);
    color: var(--text);
}

.modal-close .icon {
    width: 20px;
    height: 20px;
}

/* Modais de Metas e Recorrentes (form.modal-form > .form-body + .modal-footer) */
.modal-form .form-body {
    display: grid;
    gap: 14px;
    padding: 20px;
}

.modal-form .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.modal-form .form-group :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
    width: 100%;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px calc(16px + var(--safe-bottom));
    border-top: 1px solid #EEF1F6;
    background: #fff;
}

.modal-footer .btn {
    min-width: 120px;
}

@media (max-width: 768px) {
    .modal-footer {
        position: sticky;
        bottom: 0;
    }

    .modal-footer .btn {
        flex: 1;
    }
}

/* ------------------------------------------------------------
   Cartões de crédito
   ------------------------------------------------------------ */

.credit-card-tile {
    border-color: transparent;
    border-radius: var(--radius);
    background:
        radial-gradient(circle at 100% 0%, rgba(201, 162, 78, 0.22), transparent 14rem),
        linear-gradient(135deg, var(--brand-900), var(--brand-600));
}

.credit-card-tile:hover,
.credit-card-tile.is-selected {
    border-color: var(--gold);
}

.credit-card-tile strong {
    color: #fff;
}

/* O selo de status herdava o branco de ".credit-card-tile span" e sumia no fundo claro */
.credit-card-tile .badge {
    justify-self: start;
    padding: 6px 14px;
    border: 0;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.credit-card-tile .badge-danger {
    background: #FDE2E2;
    color: #9B1C1C;
}

.credit-card-tile .badge-warning {
    background: #FDF0D5;
    color: #8A5A00;
}

.credit-card-tile .badge-success {
    background: #DCFCE7;
    color: #14532D;
}

.credit-card-tile .badge-info {
    background: var(--brand-100);
    color: var(--brand);
}

/* ------------------------------------------------------------
   Relatórios
   ------------------------------------------------------------ */

.report-builder {
    display: grid;
    gap: 20px;
}

.chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.chip {
    min-height: 38px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.chip.is-active {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
}

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

.report-range fieldset {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 8px;
    min-width: 0;
    padding: 0;
    border: 0;
}

.report-range legend {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.report-range select {
    width: 100%;
    min-height: 46px;
    padding: 0 12px;
    border: 1px solid #D5DCE7;
    border-radius: 12px;
    background: #fff;
    color: var(--text);
}

.report-step__title {
    margin: 0 0 12px;
    color: var(--text);
    font-size: 17px;
    font-weight: 700;
}

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

.report-card {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.report-card:hover {
    border-color: var(--gold);
    box-shadow: var(--shadow-strong);
}

.report-card:active {
    transform: scale(0.99);
}

.report-card__icon {
    display: grid;
    place-items: center;
    flex: 0 0 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--brand-100);
    color: var(--brand);
}

.report-card__body {
    flex: 1;
    min-width: 0;
}

.report-card__body strong {
    display: block;
    font-size: 15px;
}

.report-card__body small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
}

.report-card__action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--gold-100);
    color: var(--gold-600);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.report-card__action .icon {
    width: 16px;
    height: 16px;
}

.report-note {
    margin-top: 18px;
    font-size: 13px;
}

/* ------------------------------------------------------------
   Convite para instalar o app
   ------------------------------------------------------------ */

.install-banner {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1060;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 400px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow-strong);
    animation: app-slide-up 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.install-banner[hidden] {
    display: none;
}

.install-banner img {
    flex: 0 0 44px;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.install-banner__text {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    line-height: 1.35;
}

.install-banner__text strong {
    display: block;
    color: var(--text);
    font-size: 14px;
}

.install-banner__text span {
    color: var(--muted);
}

.install-banner .btn {
    flex: 0 0 auto;
}

.install-banner__close {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 0;
    background: none;
    color: var(--muted);
    cursor: pointer;
}

@keyframes app-slide-up {
    from { transform: translateY(24px); opacity: 0; }
    to { transform: none; opacity: 1; }
}

@keyframes app-sheet-up {
    from { transform: translateY(100%); }
    to { transform: none; }
}

/* ------------------------------------------------------------
   Login
   ------------------------------------------------------------ */

.login-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: calc(24px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
    background:
        radial-gradient(circle at 85% 0%, rgba(201, 162, 78, 0.16), transparent 24rem),
        radial-gradient(circle at 0% 100%, rgba(42, 63, 110, 0.9), transparent 30rem),
        var(--brand-900);
}

.login-container {
    width: min(100%, 420px);
    padding: 32px 28px 24px;
    border: 0;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.login-header {
    margin-bottom: 22px;
    text-align: center;
}

.login-logo {
    width: 190px;
    height: auto;
    margin: 0 auto 10px;
}

.login-header p {
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
}

.login-form .form-group input {
    width: 100%;
}

.password-field {
    position: relative;
}

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

.password-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 10px;
    background: none;
    color: var(--muted);
    cursor: pointer;
    transform: translateY(-50%);
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 18px;
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
}

.remember-me input {
    width: 18px;
    height: 18px;
}

.btn-login {
    width: 100%;
    min-height: 50px;
    border-radius: 14px;
    font-size: 16px;
}

.login-footer {
    margin-top: 20px;
    color: #98A2B3;
    font-size: 12px;
    text-align: center;
}

/* ------------------------------------------------------------
   Celular: experiência de aplicativo
   ------------------------------------------------------------ */

@media (max-width: 768px) {
    :root {
        --header-height: 58px;
    }

    /* iOS não dá zoom ao focar campos com 16px ou mais */
    input,
    select,
    textarea {
        font-size: 16px !important;
    }

    body {
        padding-bottom: calc(72px + var(--safe-bottom));
        overscroll-behavior-y: none;
    }

    .header-content {
        gap: 8px;
        padding: 0 12px;
    }

    .header-left {
        gap: 10px;
    }

    .menu-toggle {
        display: inline-grid;
        place-items: center;
        flex: 0 0 42px;
    }

    .app-brand__mark {
        width: 32px;
        height: 32px;
        padding: 2px;
        border-radius: 9px;
    }

    .app-brand__text {
        display: none;
    }

    .app-header__page {
        display: block;
        overflow: hidden;
        color: #fff;
        font-size: 17px;
        font-weight: 700;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .user-chip,
    .btn-logout {
        display: none;
    }

    /* Menu vira gaveta lateral */
    .app-sidebar {
        top: 0;
        height: 100vh;
        height: 100dvh;
        padding: calc(14px + var(--safe-top)) 12px calc(18px + var(--safe-bottom));
        border-radius: 0 24px 24px 0;
    }

    .sidebar-brand {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 6px 8px 14px;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-brand img {
        width: 44px;
        height: 44px;
        border: 1px solid var(--border);
        border-radius: 12px;
    }

    .sidebar-brand strong {
        display: block;
        color: var(--brand);
        font-size: 16px;
    }

    .sidebar-brand small {
        color: var(--muted);
        font-size: 13px;
    }

    .nav-link {
        min-height: 48px;
    }

    .app-main {
        padding: 16px 14px calc(28px + var(--safe-bottom));
    }

    .page-header {
        gap: 12px;
    }

    .page-header-actions,
    .page-header-actions .btn,
    .page-action-button {
        width: 100%;
    }

    /* Alertas de vencimento compactos: só o resumo e o link "ver todas" */
    .alert-banner {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 6px 12px;
        margin-bottom: 10px;
        padding: 10px 14px;
        border-radius: 14px;
        font-size: 14px;
    }

    .alert-banner .alert-item {
        display: none;
    }

    /* Barra de navegação inferior */
    .mobile-bottom-nav {
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1030;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        align-items: center;
        gap: 0;
        height: calc(64px + var(--safe-bottom));
        padding: 0 4px var(--safe-bottom);
        border: 0;
        border-top: 1px solid var(--border);
        border-radius: 0;
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 -6px 24px rgba(20, 33, 61, 0.06);
    }

    .mobile-bottom-nav__item {
        gap: 3px;
        min-height: 56px;
        padding: 4px 2px;
        border-radius: 14px;
        color: #8A94A8;
    }

    .mobile-bottom-nav__item .icon {
        width: 23px;
        height: 23px;
    }

    .mobile-bottom-nav__item strong {
        font-size: 11px;
        font-weight: 600;
    }

    .mobile-bottom-nav__item.active,
    .mobile-bottom-nav__item:hover {
        background: none;
        color: var(--brand);
    }

    .mobile-bottom-nav__item.active .icon {
        stroke-width: 2.4;
    }

    .mobile-bottom-nav__item.active strong {
        font-weight: 700;
    }

    .install-banner {
        right: 12px;
        bottom: calc(76px + var(--safe-bottom));
        left: 12px;
        z-index: 1025;
        max-width: none;
    }

    body.sidebar-open .install-banner,
    body.modal-open .install-banner {
        display: none;
    }

    /* Tabelas viram cartões (o app.js coloca o nome da coluna em data-label) */
    .table-responsive {
        overflow: visible;
        border: 0;
    }

    .card-body.table-responsive {
        padding: 12px;
    }

    .table--stack,
    .table--stack tbody,
    .table--stack tr,
    .table--stack td {
        display: block;
        width: 100%;
    }

    .table--stack {
        min-width: 0 !important;
        border: 0;
        font-size: 14px;
    }

    .table--stack thead {
        display: none;
    }

    .table--stack tr {
        margin-bottom: 12px;
        padding: 4px 14px;
        border: 1px solid var(--border);
        border-radius: 16px;
        background: #fff;
        box-shadow: 0 1px 2px rgba(20, 33, 61, 0.04);
    }

    .table--stack tr:last-child {
        margin-bottom: 0;
    }

    .table--stack td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        min-height: 0;
        padding: 9px 0;
        border: 0;
        border-bottom: 1px dashed #E8ECF3;
        text-align: right;
        word-break: break-word;
    }

    .table--stack td:last-child {
        border-bottom: 0;
    }

    .table--stack td[data-label]::before {
        content: attr(data-label);
        flex: 0 0 auto;
        max-width: 45%;
        color: var(--muted);
        font-size: 12px;
        font-weight: 600;
        text-align: left;
    }

    .table--stack td[data-label=""]::before {
        content: none;
    }

    .table--stack td.table-actions {
        display: flex;
        flex-wrap: wrap;
        justify-content: stretch;
        gap: 8px;
        min-width: 0;
        padding-top: 12px;
    }

    .table--stack td.table-actions::before {
        display: none;
    }

    .table--stack td.table-actions > *,
    .table--stack td.table-actions .inline-form {
        flex: 1 1 140px;
        margin: 0;
    }

    /* Modais viram "bottom sheet" */
    .modal > .modal-dialog,
    .modal-overlay > .modal-container,
    .modal-overlay > .modal-dialog {
        max-height: calc(100dvh - 16px - var(--safe-top));
        overflow-y: auto;
        padding-bottom: var(--safe-bottom);
        -webkit-overflow-scrolling: touch;
        animation: app-sheet-up 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    .modal-header {
        position: sticky;
        top: 0;
        z-index: 2;
        padding-top: 22px;
        background: #fff;
    }

    .modal-header::before {
        content: "";
        position: absolute;
        top: 8px;
        left: 50%;
        width: 40px;
        height: 4px;
        margin-left: -20px;
        border-radius: 4px;
        background: #D5DCE7;
    }

    .modal-body {
        max-height: none;
        overflow: visible;
    }

    /* Linhas de 3 campos (ex.: Investimentos) viram 2 por linha no celular;
       o !important vence o grid-template-columns escrito direto no HTML */
    .form-grid--three {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .form-grid--two,
    .form-grid--three {
        gap: 12px !important;
    }

    .form-grid--two > *,
    .form-grid--three > * {
        min-width: 0;
    }

    /* Dashboard */
    .dashboard-actions,
    .dashboard-filters,
    .dash-export {
        width: 100%;
    }

    .dashboard-filters .dash-select {
        flex: 1;
        height: 44px;
    }

    .dash-nav-btn,
    .btn-export {
        height: 44px;
    }

    .dash-nav-btn {
        width: 44px;
    }

    .btn-export {
        justify-content: center;
        width: 100%;
    }

    .export-panel {
        position: fixed;
        top: auto;
        right: 12px;
        bottom: calc(76px + var(--safe-bottom));
        left: 12px;
        min-width: 0;
        border-radius: 18px;
        box-shadow: var(--shadow-strong);
    }

    .export-form .dash-select {
        flex: 1 1 40%;
        height: 44px;
    }

    .export-form .btn {
        width: 100%;
    }

    /* Relatórios */
    .report-range,
    .report-grid {
        grid-template-columns: 1fr;
    }

    .report-card {
        padding: 14px;
    }

    .report-card__action {
        padding: 8px 10px;
    }

    .chip-group {
        flex-wrap: nowrap;
        margin-right: -16px;
        padding-right: 16px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .chip {
        flex: 0 0 auto;
    }
}

@media (max-width: 380px) {
    .report-card__action {
        display: none;
    }

    /* Telas bem estreitas: um campo por linha nos formulários */
    .form-grid--two,
    .form-grid--three {
        grid-template-columns: 1fr !important;
    }
}

/* App instalado: sem "pull to refresh" do navegador, seleção mais contida */
.is-standalone .mobile-bottom-nav,
.is-standalone .app-header {
    -webkit-user-select: none;
    user-select: none;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

@media print {
    .mobile-bottom-nav,
    .install-banner,
    .app-header,
    .app-sidebar,
    .sidebar-overlay {
        display: none !important;
    }

    .app-body {
        margin-top: 0;
    }

    .app-main {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
    }
}
