@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #B6CBF9; /* Soft periwinkle blue from the reference */
    --primary-dark: #9bb5ef;
    --primary-text: #000000;
    --bg: #F3F5F9; /* Very light grey-blue for the app background */
    --bg-card: #FFFFFF;
    --text-main: #111111;
    --text-muted: #718096;
    --text2: #718096;   /* alias for --text-muted */
    --text3: #A0AEC0;   /* lighter muted text */
    --border: #E2E8F0;
    --black: #000000;
    --white: #FFFFFF;
    --green: #22c55e;
    --red: #ef4444;
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 32px;
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.06);
}

body {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

/* Sidebar Styling */
.sidebar {
    width: 260px;
    background: var(--primary);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    border-radius: 0 40px 40px 0; /* To give that modern floating/pill feel on the edge */
    padding: 30px 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 800;
    color: var(--black);
    margin-bottom: 40px;
    padding: 0 10px;
}

.logo i {
    font-size: 28px;
}

.logo .tag {
    font-size: 10px;
    background: var(--black);
    color: var(--white);
    border-radius: 6px;
    padding: 2px 6px;
    vertical-align: super;
}

.nav-sec {
    padding: 10px 14px;
    font-size: 11px;
    color: rgba(0,0,0,0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    margin-top: 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    border-radius: 100px; /* Pill shape */
    margin: 4px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--black);
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: rgba(255,255,255,0.4);
}

.nav-item.active {
    background: var(--black);
    color: var(--white);
}

.nav-item i {
    font-size: 22px;
}

.nav-div {
    display: none; /* Hide standard dividers for a cleaner look */
}

.acc-box {
    margin-top: auto;
    padding: 20px;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.3);
}

/* Main Content Area */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 30px 40px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    background: transparent;
    border: none;
    height: auto;
    padding: 0;
}

.topbar > span:first-child {
    font-size: 26px !important;
    font-weight: 800 !important;
    letter-spacing: -0.5px;
}

.content {
    flex: 1;
    overflow-y: auto;
    /* padding: 0 removed from here as we moved it to .main */
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: none;
    box-shadow: var(--shadow-card);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card.primary-card {
    background: var(--primary);
    color: var(--black);
}

.grid4, .grid3 {
    display: grid;
    gap: 20px;
    margin-bottom: 24px;
}
.grid4 { grid-template-columns: repeat(4, 1fr); }
.grid3 { grid-template-columns: repeat(3, 1fr); }
.grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}
.layout {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
}
.col-main { flex: 1; min-width: 0; }
.col-side { width: 320px; flex-shrink: 0; display: flex; flex-direction: column; gap: 24px; }

/* Stats inside Cards */
.stat-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}
.card.primary-card .stat-label {
    color: rgba(0,0,0,0.6);
}

.stat-val {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -1px;
}

.stat-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 8px;
    font-weight: 500;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 100px; /* Pill shape */
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    border: none;
    background: var(--white);
    color: var(--black);
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.btn:hover {
    background: var(--bg);
    transform: translateY(-1px);
}

.btn-primary, .btn-p {
    background: var(--black);
    color: var(--white);
}

.btn-primary:hover, .btn-p:hover {
    background: #222;
    color: var(--white);
}

.btn-red, .btn-r {
    background: #FFF1F2;
    color: var(--red);
    box-shadow: none;
}
.btn-red:hover, .btn-r:hover {
    background: #FFE4E6;
}

/* Round Action Buttons (Like in the balance card) */
.action-btn-group {
    display: flex;
    gap: 16px;
    margin-top: 24px;
}
.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--black);
}
.action-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--black);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: transform 0.2s;
}
.action-btn:hover .action-icon {
    transform: translateY(-2px);
}
.action-label {
    font-size: 12px;
    font-weight: 600;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 700;
}
.bg, .vg { background: #DCFCE7; color: #166534; }
.br, .vr { background: #FEE2E2; color: #991B1B; }
.bo { background: #FEF3C7; color: #92400E; }
.bp, .vp { background: var(--primary); color: var(--black); }
.vb { background: #DBEAFE; color: #1E40AF; }
.vgr { background: #F1F5F9; color: #475569; }

/* Tables */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
th {
    text-align: left;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    padding: 16px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    font-weight: 500;
    vertical-align: middle;
}
tr:last-child td {
    border-bottom: none;
}
tr:hover td {
    background: #F8FAFC;
}

/* Specific elements adjustments */
.av, .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--black);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.act {
    display: flex;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    align-items: center;
}
.act:last-child {
    border-bottom: none;
}

/* Utilities */
.green { color: var(--green); }
.red { color: var(--red); }

.prog-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 4px 0;
}

/* Login Page specific */
.login-body {
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.05);
    width: 100%;
    max-width: 440px;
}
.input-wrap {
    position: relative;
    margin-bottom: 16px;
}
.input-wrap i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 20px;
}
.input-wrap input, .form-group .input-wrap input {
    width: 100%;
    padding: 14px 16px 14px 44px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-family: inherit;
    font-weight: 500;
    outline: none;
    transition: all 0.2s;
    background: #F8FAFC;
}
.input-wrap input:focus {
    border-color: var(--black);
    background: var(--white);
}
.login-btn {
    width: 100%;
    padding: 16px;
    background: var(--black);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}
.login-btn:hover {
    background: #222;
    transform: translateY(-2px);
}

/* Modal */
.mbg, .modal-bg {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.2);
    backdrop-filter: blur(4px);
    z-index: 999;
    align-items: center;
    justify-content: center;
}
.mbg.open, .modal-bg.open {
    display: flex;
}
.mo, .modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
    transform: scale(0.95);
    animation: modalIn 0.2s forwards ease-out;
}
@keyframes modalIn {
    to { transform: scale(1); }
}
.mh, .modal h3 {
    font-size: 20px;
    font-weight: 800;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.mc, .modal-close {
    background: #F1F5F9;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
}
.mc:hover, .modal-close:hover {
    background: #E2E8F0;
    color: var(--black);
}

/* Forms inside system */
.fg, .form-group { margin-bottom: 16px; }
.fg label, .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.fg input, .fg select, .fg textarea, .form-group input, .form-group select, .form-group textarea {
    width: 100%;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    outline: none;
    transition: all 0.2s;
    resize: vertical;
}
.fg input:focus, .fg select:focus, .fg textarea:focus, .form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--black);
}

/* Top Filters / Tabs */
.fbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}
.ftabs, .tabs-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    background: var(--bg-card);
    padding: 6px;
    border-radius: 100px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}
.ft, .ftab {
    padding: 8px 20px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    color: var(--text-muted);
    background: transparent;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}
.ft:hover, .ftab:hover {
    color: var(--black);
}
.ft.on, .ftab.active {
    background: var(--black);
    color: var(--white);
}

/* Calendar grid */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    gap: 4px;
}
.cdn { font-size: 12px; color: var(--text-muted); padding: 8px 0; font-weight: 600; }
.cd { font-size: 13px; padding: 6px; border-radius: 50%; cursor: pointer; color: var(--black); font-weight: 500; }
.cd.today { background: var(--black); color: var(--white); }
.cd.om { color: var(--border); }

/* -- Progress Bar -- */
.pbar {
    height: 6px;
    background: var(--border);
    border-radius: 100px;
    overflow: hidden;
    margin-top: 8px;
}
.pbf, .pbar-fill {
    height: 100%;
    border-radius: 100px;
    transition: width 0.4s ease;
}

/* -- Month Nav (transacoes) -- */
.mnav {
    display: flex;
    align-items: center;
    gap: 10px;
}
.mb {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--black);
    font-size: 16px;
    transition: all 0.2s;
    box-shadow: var(--shadow-card);
}
.mb:hover { background: var(--primary); }
.ml {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
    min-width: 90px;
    text-align: center;
}

/* -- Modal Type Tabs (transacoes) -- */
.mtbs {
    display: flex;
    gap: 6px;
    background: var(--bg);
    padding: 5px;
    border-radius: 100px;
    margin-bottom: 20px;
}
.mt {
    flex: 1;
    padding: 8px 14px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
}
.mt:hover { color: var(--black); }
.mt.on {
    background: var(--black);
    color: var(--white);
}

/* -- Form Row (2-col layout) -- */
.fr, .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* -- Modal Footer -- */
.mf, .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* -- Info box inside modal -- */
.info {
    display: none;
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 12px;
    color: #1E40AF;
    margin-bottom: 14px;
}

/* -- Toggle Switch -- */
.tog {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    cursor: pointer;
}
.tog input { opacity: 0; width: 0; height: 0; }
.ts {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 100px;
    transition: 0.3s;
}
.ts::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--white);
    left: 3px;
    top: 3px;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.tog input:checked + .ts { background: var(--green); }
.tog input:checked + .ts::before { transform: translateX(16px); }

/* -- Empty State -- */
td.empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* -- Relatorios: Filter Bar -- */
.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    box-shadow: var(--shadow-card);
    margin-bottom: 24px;
}
.ff {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ff label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}
.ff input[type="date"] {
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    outline: none;
    transition: all 0.2s;
    background: var(--bg);
}
.ff input[type="date"]:focus { border-color: var(--black); background: var(--white); }

/* -- Relatorios: Sidebar Nav -- */
.rel-nav { width: 200px; flex-shrink: 0; }
.rel-main { flex: 1; min-width: 0; }
.rnav-sec {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 10px 12px 6px;
}
.rnav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
    margin: 2px 0;
}
.rnav-item:hover { background: var(--bg); color: var(--black); }
.rnav-item.active { background: var(--black); color: var(--white); }

/* -- Relatorios: DRE Rows -- */
.dre-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    font-weight: 500;
}
.dre-row:last-child { border-bottom: none; }
.dre-row.header {
    font-weight: 700;
    background: var(--bg);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    margin: 4px 0;
    border-bottom: none;
}
.dre-row.total {
    font-weight: 800;
    font-size: 16px;
    background: var(--primary);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    margin-top: 8px;
    border-bottom: none;
}
.sym {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 800;
    margin-right: 8px;
}
.sym.plus  { background: #DCFCE7; color: #166534; }
.sym.minus { background: #FEE2E2; color: #991B1B; }
.sym.eq    { background: var(--primary); color: var(--black); }

/* -- Account Menu Dropdown ------------------------------------------------- */
.acc-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    transition: background .15s;
    user-select: none;
    position: relative;
}
.acc-trigger:hover { background: rgba(0,0,0,0.05); }
.acc-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(0,0,0,0.15);
    color: var(--black);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    flex-shrink: 0;
}
.acc-info { flex: 1; min-width: 0; }
.acc-name  { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-email { font-size: 11px; color: rgba(0,0,0,0.5); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-arrow { font-size: 14px; color: rgba(0,0,0,0.4); transition: transform .2s; flex-shrink: 0; }
.acc-arrow.open { transform: rotate(180deg); }

.acc-dropdown {
    display: none;
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 6px 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.acc-dropdown.open { display: block; }

.acc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    font-size: 13px;
    color: var(--text-main);
    text-decoration: none;
    transition: background .12s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}
.acc-item:hover { background: #f5f3ff; }
.acc-item i { font-size: 16px; flex-shrink: 0; }
.acc-item-red { color: var(--red) !important; }
.acc-item-red i { color: var(--red) !important; }
.acc-item-red:hover { background: #fde8e0 !important; }
.acc-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* -- Navegação Inferior (Mobile App Mode) ---------------------------------- */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 10px 16px 20px 16px; /* Extra bottom padding for iOS home indicator */
    z-index: 900;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
    justify-content: space-between;
}
.bnav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 10px;
    font-weight: 600;
    flex: 1;
}
.bnav-item i {
    font-size: 24px;
    margin-bottom: 2px;
}
.bnav-item.active {
    color: var(--black);
}
.bnav-item.active i {
    color: var(--black);
}

/* -- Mobile Responsive Overrides ------------------------------------------- */
@media (max-width: 768px) {
    body {
        flex-direction: column;
        background: var(--bg);
    }
    
    .sidebar {
        display: none; /* Hide desktop sidebar */
    }
    
    .bottom-nav {
        display: flex; /* Show mobile bottom nav */
    }

    .main {
        padding: 20px 16px calc(80px + env(safe-area-inset-bottom, 0px)) 16px;
    }

    .topbar {
        margin-bottom: 20px;
    }
    
    .topbar > span:first-child {
        font-size: 22px !important;
    }
    
    /* Convert Grids to Single Column */
    .grid4, .grid3, .grid2, .layout {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .col-side {
        width: 100%;
    }

    .card {
        padding: 16px;
    }

    /* Modals */
    .mo, .modal {
        width: 95%;
        padding: 20px;
        margin: 10px;
        max-height: 85vh;
    }
    
    .fr, .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    /* Tables: scrollable containers handle overflow; keep cells readable */
    th, td { white-space: nowrap; font-size: 12px; }

    /* Topbar mobile — título e botões compactos */
    .topbar {
        gap: 10px;
        flex-wrap: nowrap;
        align-items: center;
    }
    .topbar > div:last-child {
        display: flex;
        gap: 6px;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-shrink: 1;
    }
    .topbar > div:last-child::-webkit-scrollbar { display: none; }

    /* Botões do topbar: menores no mobile */
    .btn {
        padding: 7px 10px;
        font-size: 12px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Oculta textos secundários em botões que tenham ícone */
    .btn-red:not(.btn-primary) { display: none; }

    /* Tabs de filtro: rolagem horizontal */
    .ftabs, div[style*="display:flex"][style*="gap:6px"] {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
    }
    .ftab { white-space: nowrap; flex-shrink: 0; }

    /* Month nav */
    .mnav { justify-content: center; }

    /* Sidebar drawer overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.45);
        z-index: 9998;
    }
    .sidebar-overlay.open { display: block; }

    /* Relatórios: filter-bar em coluna */
    .filter-bar { flex-direction: column; gap: 12px; }
    .ff { width: 100%; }

    /* col-side não sobrepõe */
    .layout { flex-direction: column; }
}

/* ── Melhorias adicionais de app ──────────────────────────────────── */

/* Bottom-nav: indicador de ativo no estilo iOS pill */
.bnav-item {
    position: relative;
    padding-top: 6px;
}
.bnav-item i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 28px;
    border-radius: 14px;
    transition: background 0.2s;
}
.bnav-item.active i {
    background: rgba(0,0,0,0.1);
}
.bnav-item.active {
    color: var(--black);
}

/* Bottom-nav: safe area iOS + barra mais alta */
.bottom-nav {
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    height: auto;
}

/* Botão FAB do Gemini: sobe acima do bottom-nav no mobile */
@media (max-width: 768px) {
    .ai-fab { bottom: 80px; right: 16px; }
    .ai-chat { bottom: 144px; right: 16px; width: calc(100vw - 32px); }
}

/* Cards: remover hover transform no touch */
@media (hover: none) {
    .card:hover { transform: none; box-shadow: var(--shadow-card); }
    .nav-item:hover { background: transparent; }
    .btn:hover { opacity: 1; }
}

/* Smooth scroll global */
html { scroll-behavior: smooth; }

/* Tabelas dentro de card: scroll horizontal (se não usar a transformação de card) */
.card-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Inputs e selects mobile: font-size 16px evita zoom no iOS */
@media (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important;
    }
    .fg input, .fg select, .fg textarea,
    .ai-input {
        font-size: 16px !important;
    }
    /* Modais fullscreen no mobile */
    .mbg.open, .modal-bg.open {
        align-items: flex-end;
    }
    .mo, .modal {
        width: 100%;
        max-width: 100%;
        border-radius: 24px 24px 0 0;
        margin: 0;
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* ── Transaction mobile cards (Procfy style) ────────────────────────── */
.tx-desktop-table { display: block; }
.tx-mobile-list   { display: none; }

@media (max-width: 768px) {
    .tx-desktop-table { display: none; }

    .tx-mobile-list {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 0;
    }
    .tx-card {
        background: var(--bg-card);
        border-radius: 12px;
        padding: 10px 8px 10px 12px;
        box-shadow: 0 1px 6px rgba(0,0,0,0.06);
        display: flex;
        flex-direction: row;
        align-items: stretch;
        gap: 6px;
    }
    .tx-card-body {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    .tx-card-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 6px;
    }
    .tx-card-date {
        font-size: 11px;
        font-weight: 600;
        color: var(--text-muted);
    }
    .tx-card-right {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-shrink: 0;
    }
    .tx-card-val {
        font-size: 13px;
        font-weight: 800;
    }
    .tx-card-desc {
        font-size: 12px;
        font-weight: 600;
        color: var(--text-main);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin: 2px 0 4px;
    }
    .tx-card-meta {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    .tx-card-row {
        display: flex;
        gap: 5px;
        font-size: 11px;
        align-items: center;
    }
    .tx-card-label {
        color: var(--text-muted);
        font-size: 10px;
        min-width: 58px;
        flex-shrink: 0;
    }
    .tx-card-ddw {
        display: flex;
        align-items: center;
        flex-shrink: 0;
        position: relative;
    }
    .tx-card-dots {
        width: 28px !important;
        height: 28px !important;
        border-radius: 50% !important;
        border: 1px solid var(--border) !important;
        background: var(--bg-card) !important;
        font-size: 13px !important;
    }
}

/* ── Dropdown menu (compartilhado: transacoes, faturas) ─────────────────── */
.ddw { position:relative; display:inline-block; }
.ddb { background:none; border:none; width:32px; height:32px; border-radius:50%; cursor:pointer; display:flex; align-items:center; justify-content:center; font-size:18px; color:var(--text-muted); transition:.2s; }
.ddb:hover { background:var(--bg); color:var(--black); }
.ddm { display:none; position:absolute; right:0; top:36px; background:#fff; border-radius:14px; box-shadow:0 8px 30px rgba(0,0,0,.12); min-width:190px; z-index:999; padding:6px; }
.ddm.open { display:block; animation:ddIn .15s ease-out; }
@keyframes ddIn { from{opacity:0;transform:translateY(-6px)} to{opacity:1;transform:translateY(0)} }
.ddi { display:flex; align-items:center; gap:10px; padding:9px 12px; border-radius:8px; font-size:13px; font-weight:500; color:var(--text-main); text-decoration:none; cursor:pointer; border:none; background:none; width:100%; text-align:left; transition:.15s; }
.ddi:hover { background:var(--bg); }
.ddi.red { color:var(--red); }
.ddi.red:hover { background:#FEF2F2; }
.dd-sep { height:1px; background:var(--border); margin:4px 0; }

/* ── Contact mobile cards ──────────────────────────────────────────── */
.ct-desktop-table { display: block; }
.ct-mobile-list   { display: none; }

@media (max-width: 768px) {
    .ct-desktop-table { display: none !important; }
    .ct-mobile-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 0;
    }
    .ct-card {
        background: var(--bg-card);
        border-radius: 14px;
        padding: 14px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
        display: flex;
        gap: 12px;
        align-items: flex-start;
    }
}

/* ── Faturas mobile cards ──────────────────────────────────────────── */
.ft-desktop-table { display: block; }
.ft-mobile-list   { display: none; }

@media (max-width: 768px) {
    .ft-desktop-table { display: none !important; }
    .ft-mobile-list {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 0;
    }
}

/* ── AI FAB: more clearance above bottom-nav ─────────────────────── */
@media (max-width: 768px) {
    .ai-fab { bottom: 90px !important; }
    .ai-chat { bottom: 155px !important; }
}

