﻿/* CONTROLO DO MENU MOBILE (Escondido no Desktop) */
.mobile-menu-btn { display: none; }
.sidebar-close-btn { display: none; }
.sidebar-overlay { display: none; }
.mobile-bottom-nav { display: none; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }


/* =========================================================
   MEDIA QUERIES - RESPONSIVIDADE MOBILE / TABLET
   ========================================================= */

@media (max-width: 1024px) {
    /* TABLETS */
    .app-container { grid-template-columns: 78px 1fr; }
    .brand-lockup > div:last-child, .nav-item span, .nav-item small, .nav-section-label, .sidebar-collapse span { display: none; }
    .sidebar-header, .nav-item, .sidebar-collapse { justify-content: center; }
    .quick-actions { display: none !important; }
    .form-group.span-2 { grid-column: span 1; }
    .budget-list { grid-template-columns: 1fr; }
}

@media (max-width: 900px) and (min-width: 769px) {
    .topbar { padding-inline: 18px; }
    .topbar-search { width: min(100%, 300px); }
    .user-info-text,
    .user-info > .ph-caret-down { display: none; }
    .user-info { width: 46px; height: 46px; padding: 3px; border-radius: 14px; }
    .user-avatar { width: 38px; height: 38px; }
}

@media (max-width: 768px) {
    .sidebar {
        top: 0;
        right: auto;
        bottom: 0;
        left: 0;
        width: 85%;
        max-width: 300px;
        height: 100%;
        padding-bottom: 0;
        transform: translateX(-100%);
        border: 0;
        border-right: 1px solid #e2e8f0;
        background: #fff;
        box-shadow: 12px 0 35px rgba(15,23,42,.14);
        overflow: hidden;
    }
    .sidebar.active { transform: translateX(0); }
    .sidebar .sidebar-header { display: flex !important; }
    .sidebar .sidebar-close-btn { display: flex !important; }
    .sidebar .nav-menu {
        width: auto;
        height: auto;
        padding: 10px 14px;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        overflow-x: hidden;
        overflow-y: auto;
        scroll-snap-type: none;
    }
    .sidebar .nav-section-label { display: block !important; }
    .sidebar .nav-item,
    .app-container.sidebar-collapsed .sidebar .nav-item {
        flex: 0 0 auto;
        min-width: 0;
        min-height: 40px;
        padding: 7px 9px;
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        gap: 10px;
        text-align: left;
        scroll-snap-align: none;
    }
    .sidebar .nav-item span,
    .app-container.sidebar-collapsed .sidebar .nav-item span {
        display: block;
        width: auto;
        font-size: .79rem;
        line-height: 1.2;
    }
    .sidebar .nav-icon { width: 27px; height: 27px; flex: 0 0 27px; }
    .sidebar-overlay { display: block !important; }

    .mobile-bottom-nav {
        position: fixed;
        right: 12px;
        bottom: calc(10px + env(safe-area-inset-bottom));
        left: 12px;
        z-index: 1280;
        min-height: 72px;
        padding: 7px 8px;
        display: grid;
        grid-template-columns: repeat(5,1fr);
        align-items: end;
        gap: 2px;
        border: 1px solid rgba(226,232,240,.92);
        border-radius: 22px;
        background: rgba(255,255,255,.97);
        box-shadow: 0 14px 38px rgba(15,23,42,.17);
        backdrop-filter: blur(18px);
    }
    .mobile-nav-item {
        min-width: 0;
        height: 56px;
        padding: 5px 2px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        border: 0;
        border-radius: 13px;
        background: transparent;
        color: #475569;
        font-size: .63rem;
        font-weight: 750;
        cursor: pointer;
    }
    .mobile-nav-item i { font-size: 1.55rem; }
    .mobile-nav-item.active { color: #0869ed; background: #f4f8ff; }
    .mobile-nav-create {
        align-self: start;
        width: 64px;
        height: 64px;
        margin: -27px auto 0;
        border: 5px solid #fff;
        border-radius: 50%;
        background: linear-gradient(145deg,#1680ff,#075be0);
        color: #fff;
        box-shadow: 0 10px 24px rgba(20,104,238,.38);
    }
    .mobile-nav-create i { font-size: 2rem; font-weight: 400; }
    .mobile-nav-create.active { color: #fff; background: linear-gradient(145deg,#1680ff,#075be0); }
}

@media (max-width: 768px) {
    /* SMARTPHONES E ECRÃƒS PEQUENOS */
    
    /* 1. O TRUQUE DE MESTRE: Reduz o tamanho base da fonte. 
       Isso encolhe tudo o que usa 'rem' (tÃ­tulos, textos, botÃµes) de forma proporcional! */
    html {
        font-size: 14px; 
    }

    body { height: auto; overflow-x: hidden; overflow-y: auto; background: var(--bg-gray-dark); }
    
    .app-container { 
        display: flex; 
        flex-direction: column; 
        padding: 0; 
        height: 100%;
        min-height: 100vh;
        width: 100%;
        overflow-x: hidden;
    }

    /* Topbar no Mobile */
    .topbar { 
        position: fixed; 
        top: 0; 
        left: 0;
        right: 0;
        width: 100%; 
        min-height: 58px;
        border-radius: 0; 
        padding: 10px 16px; /* Reduzido */
        justify-content: space-between; 
        border-top: none;
        border-left: none;
        border-right: none;
        background: var(--bg-white);
        box-shadow: var(--shadow-sm);
        z-index: 1200;
    }
    
    .mobile-menu-btn { 
        display: flex; 
        align-items: center; 
        justify-content: center; 
        background: var(--bg-gray); 
        border: 1px solid var(--border-light); 
        width: 38px; height: 38px; /* Mais pequeno */
        border-radius: 8px; 
        font-size: 1.3rem; 
        color: var(--primary); 
        cursor: pointer; 
    }

    .topbar-brand {
        display: flex;
        align-items: center;
        gap: 8px;
        color: var(--primary);
        font-size: 1.02rem;
        letter-spacing: -.02em;
    }

    .topbar-brand-mark {
        width: 34px;
        height: 34px;
        display: grid;
        place-items: center;
        border-radius: 10px;
        background: linear-gradient(145deg, #1680ff, #075be0);
        color: #fff;
        font-size: 1.05rem;
        box-shadow: 0 8px 18px -12px rgba(8, 105, 237, .9);
    }

    /* Ocultar elementos nÃ£o essenciais da Topbar */
    .hide-mobile { display: none !important; }
    .user-info-text { display: none; }
    .user-info { padding: 4px; border-radius: 50%; border: none; background: transparent;}
    .user-info i.ph-caret-down { display: none; }
    .topbar-right { margin-left: auto; gap: 8px; }
    .topbar-actions { gap: 6px; }
    .notification-panel { position: fixed; top: 66px; right: 12px; left: 12px; width: auto; max-height: calc(100vh - 164px - env(safe-area-inset-bottom)); }
    .user-dropdown { right: 16px; top: calc(100% + 4px); width: calc(100vw - 32px); max-width: 300px; }

    /* Sidebar Flutuante (Off-canvas) */
    .sidebar { 
        position: fixed; 
        top: 0; 
        left: 0; 
        width: 85%; 
        max-width: 300px; 
        height: 100%; 
        border-radius: 0; 
        transform: translateX(-100%); 
        border: none;
        z-index: 1300;
    }
    .sidebar-header {
        justify-content: space-between;
        align-items: center;
        gap: 12px;
    }
    .app-container.sidebar-collapsed .brand-lockup > div:last-child,
    .app-container.sidebar-collapsed .nav-item span,
    .app-container.sidebar-collapsed .nav-section-label,
    .brand-lockup > div:last-child, .nav-item span, .nav-section-label { display: block; }
    .app-container.sidebar-collapsed .sidebar-header { justify-content: space-between; padding: 18px; }
    .app-container.sidebar-collapsed .nav-item, .nav-item { justify-content: flex-start; padding: 7px 9px; }
    
    .sidebar.active { transform: translateX(0); }
    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, .48);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
        z-index: 1250;
    }
    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }
    .sidebar-close-btn { 
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 36px;
        width: 36px;
        height: 36px;
        margin-left: auto;
        background: rgba(255,255,255,0.16);
        border: 1px solid rgba(255,255,255,.3);
        color: white;
        border-radius: 12px;
        font-size: 1.1rem;
        cursor: pointer;
        box-shadow: inset 0 1px 0 rgba(255,255,255,.16);
    }
    .sidebar-close-btn:active { transform: scale(.96); }

    /* Navegação inferior no mobile: reutiliza os itens e eventos da sidebar. */
    .sidebar {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-width: none;
        height: calc(76px + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        transform: none;
        border-top: 1px solid #dfe7f1;
        background: rgba(255,255,255,.96);
        box-shadow: 0 -10px 30px rgba(15,23,42,.09);
        backdrop-filter: blur(16px);
        overflow: hidden;
        z-index: 1300;
    }
    .sidebar.active { transform: none; }
    .sidebar-header,
    .sidebar-collapse,
    .sidebar-budget-total,
    .sidebar-close-btn,
    .sidebar-overlay,
    .mobile-menu-btn { display: none !important; }
    .nav-menu {
        width: 100%;
        height: 76px;
        padding: 6px 8px;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 4px;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        overscroll-behavior-x: contain;
    }
    .nav-menu::-webkit-scrollbar { display: none; }
    .nav-section-label { display: none !important; }
    .app-container.sidebar-collapsed .nav-item,
    .nav-item {
        flex: 0 0 76px;
        min-width: 76px;
        min-height: 62px;
        padding: 5px 4px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 3px;
        border-radius: 12px;
        text-align: center;
        scroll-snap-align: center;
        transform: none;
    }
    .app-container.sidebar-collapsed .nav-item span,
    .nav-item span {
        display: block;
        width: 100%;
        overflow: hidden;
        color: inherit;
        font-size: .61rem;
        font-weight: 750;
        line-height: 1.15;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .nav-item small { display: none !important; }
    .nav-icon { width: 29px; height: 29px; flex: 0 0 29px; border-radius: 9px; }
    .nav-item:hover { transform: none; }
    .nav-item.active { box-shadow: inset 0 -3px 0 var(--accent); }

    /* Main Content - Reduzindo paddings laterais */
    .main-content { 
        border-radius: 0; 
        border: none; 
        padding: 70px 12px calc(94px + env(safe-area-inset-bottom)); /* Espaço para topbar e navegação inferior */
        box-shadow: none; 
        overflow-y: visible; 
        overflow-x: hidden;
        background: transparent;
    }
    .main-content > .tab-pane { max-width: 100%; }

    /* Ajuste de TÃ­tulos e BotÃµes do CabeÃ§alho */
    .page-header { flex-direction: column; align-items: stretch; gap: 10px; margin-bottom: 16px; }
    .page-header .btn { width: 100%; justify-content: center; }
    #clientes .clients-hero-action,
    #transportadoras .clients-hero-action,
    #produtos .catalog-hero-action,
    #servicos .catalog-hero-action {
        width: 52px;
        min-width: 52px;
        max-width: 52px;
        height: 52px;
        min-height: 52px;
        display: flex;
        justify-content: center;
        align-items: center;
        align-self: flex-end;
    }
    #clientes .clients-hero-action i,
    #transportadoras .clients-hero-action i,
    #produtos .catalog-hero-action i,
    #servicos .catalog-hero-action i {
        position: absolute;
        inset: 0;
        display: grid;
        place-items: center;
        width: 100%;
        height: 100%;
        margin: 0;
        line-height: 1;
    }
    .page-header-info h2 { font-size: 1.5rem; margin-bottom: 2px; } /* Texto menor */
    .page-header-info p { line-height: 1.45; }
    
    /* Filtros e Busca */
    .filter-bar { flex-direction: column; padding: 12px; gap: 8px; margin-bottom: 16px;}
    .filter-input { width: 100%; }
    
    /* CartÃµes de FormulÃ¡rio e Resumo */
    .form-card { padding: 16px; margin-bottom: 16px; } /* Reduzido de 24px */
    .form-grid { grid-template-columns: 1fr; gap: 12px; }
    .form-group.span-2 { grid-column: auto; }
    
    .summary-card { padding: 16px; } /* Reduzido de 24px */
    .summary-value { font-size: 1.5rem; } /* Menor para caber no telemÃ³vel */
    .summary-grid { grid-template-columns: 1fr; gap: 12px; margin-bottom: 18px; }

    /* CartÃµes de Listagem (Produtos, Clientes, OrÃ§amentos) */
    .item-card { 
        flex-direction: column; 
        align-items: flex-start; 
        padding: 14px; /* Reduzido de 20px */
        gap: 12px;
    }
    .item-price-info { text-align: left; width: 100%; }
    .item-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } 
    .item-actions .btn-success { grid-column: span 2; } 

    /* Barra RÃ¡pida do OrÃ§amento */
    .quick-add-bar { flex-direction: column; align-items: stretch; padding: 14px; gap: 12px;}
    .quick-add-icon { display: none; } 
    .quick-add-input.flex-fill { width: 100%; min-width: unset; }
    .quick-add-input.w-small,
    .quick-add-input.w-medium { width: 100%; }
    .quick-add-btn { height: 44px; } /* Menos alto */
    
    .action-buttons-grid { flex-direction: column; gap: 10px; }
    .btn-save-orc { padding: 12px; font-size: 1rem; }
    
    .budget-header { flex-direction: column; gap: 8px;}
    .history-header { flex-direction: column; }
    .history-search {
        width: 100%;
        max-width: none;
        flex: 0 0 auto;
    }
    .history-filters { width: 100%; justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
    .history-filter { white-space: nowrap; }
    #lista-orcamentos.budget-list {
        display: block;
        overflow: hidden;
        border: 1px solid var(--border-light);
        border-radius: 14px;
        background: var(--bg-white);
        box-shadow: var(--shadow-sm);
    }
    #lista-orcamentos .budget-card {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px 10px;
        padding: 12px;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
    #lista-orcamentos .budget-card + .budget-card {
        border-top: 1px solid var(--border-light);
    }
    #lista-orcamentos .budget-card:hover {
        transform: none;
        box-shadow: none;
    }
    #lista-orcamentos .budget-card::before {
        width: 3px;
    }
    #lista-orcamentos .budget-header {
        display: contents;
    }
    #lista-orcamentos .budget-header > div:first-child {
        grid-column: 1;
        min-width: 0;
        padding-left: 6px;
    }
    #lista-orcamentos .budget-client {
        max-width: 100%;
        font-size: .86rem;
        line-height: 1.2;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    #lista-orcamentos .budget-date {
        margin-top: 4px;
        font-size: .72rem;
    }
    #lista-orcamentos .budget-total {
        grid-column: 2;
        grid-row: 1;
        align-self: start;
        font-size: .9rem;
        text-align: right;
    }
    #lista-orcamentos .budget-status {
        margin-top: 6px;
        padding: 4px 8px;
        font-size: .66rem;
    }
    #lista-orcamentos .budget-meta-grid {
        grid-column: 1 / -1;
        display: flex;
        gap: 6px;
        margin: 2px 0 0;
        padding-left: 6px;
        overflow-x: auto;
        scrollbar-width: none;
    }
    #lista-orcamentos .budget-meta-grid::-webkit-scrollbar {
        display: none;
    }
    #lista-orcamentos .budget-meta-item {
        flex: 0 0 auto;
        padding: 5px 8px;
        border-radius: 999px;
        font-size: .68rem;
        background: #f8fafc;
    }
    #lista-orcamentos .budget-observation {
        grid-column: 1 / -1;
        margin-top: 0;
        padding-left: 6px;
        font-size: .72rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    #lista-orcamentos .budget-status-actions {
        grid-column: 1;
        margin: 0;
        padding-left: 6px;
    }
    #lista-orcamentos .status-action {
        width: 32px;
        height: 32px;
        min-height: 32px;
        border-radius: 11px;
    }
    #lista-orcamentos .budget-actions {
        grid-column: 1 / -1;
        display: flex;
        gap: 7px;
        margin-top: 4px;
        padding-left: 6px;
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: none;
    }
    #lista-orcamentos .budget-actions::-webkit-scrollbar {
        display: none;
    }
    #lista-orcamentos .budget-actions .btn {
        width: 38px;
        min-width: 38px;
        height: 38px;
        min-height: 38px;
        padding: 0;
        position: relative;
        overflow: hidden;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0;
        background: var(--accent);
        border: 0;
        border-radius: 12px;
        box-shadow: 0 12px 24px -16px currentColor, 0 1px 0 rgba(255, 255, 255, .34) inset;
        color: #fff;
        font-size: 0;
        transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
    }
    #lista-orcamentos .budget-actions .btn::before {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg, rgba(255, 255, 255, .24), rgba(255, 255, 255, 0) 58%);
        pointer-events: none;
    }
    #lista-orcamentos .budget-actions .btn:active {
        transform: translateY(1px) scale(.96);
        box-shadow: 0 8px 18px -16px currentColor, 0 1px 0 rgba(255, 255, 255, .24) inset;
        filter: saturate(1.08);
    }
    #lista-orcamentos .budget-actions .btn-primary,
    #lista-orcamentos .budget-actions .btn-whatsapp,
    #lista-orcamentos .budget-actions .btn-danger {
        color: #fff;
    }
    #lista-orcamentos .budget-actions .btn-primary {
        background: linear-gradient(135deg, #2563eb, #0ea5e9);
    }
    #lista-orcamentos .budget-actions .btn-whatsapp {
        background: linear-gradient(135deg, #16a34a, #22c55e);
    }
    #lista-orcamentos .budget-actions .btn-danger {
        background: linear-gradient(135deg, #dc2626, #ef4444);
    }
    #lista-orcamentos .budget-actions .btn-secondary,
    #lista-orcamentos .budget-actions .btn-ghost {
        color: #fff;
        background: linear-gradient(135deg, #64748b, #94a3b8);
    }
    #lista-orcamentos .budget-actions .btn-secondary:first-child {
        background: linear-gradient(135deg, #7c3aed, #a855f7);
    }
    #lista-orcamentos .budget-actions .btn i {
        position: relative;
        z-index: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 1em;
        height: 1em;
        margin: 0;
        font-size: 1.02rem;
        line-height: 1;
        color: #fff;
    }
    #lista-orcamentos .budget-actions .btn i::before {
        display: block;
        line-height: 1;
    }
    #lista-orcamentos.budget-list {
        display: grid;
        gap: 14px;
        overflow: visible;
        border: 0;
        background: transparent;
        box-shadow: none;
        width: 100%;
    }
    #lista-orcamentos .budget-card {
        grid-template-columns: 1fr;
        gap: 12px;
        width: 100%;
        padding: 14px 12px 0;
        border: 1px solid var(--border-light);
        border-radius: 14px;
        background: #fff;
        box-shadow: 0 18px 42px -34px rgba(15, 23, 42, .62);
        overflow: visible;
    }
    #lista-orcamentos .budget-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
        grid-column: 1;
    }
    #lista-orcamentos .budget-header > div:first-child {
        grid-column: 1;
        padding-left: 6px;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 4px 8px;
        align-items: start;
    }
    #lista-orcamentos .budget-client {
        grid-column: 1;
        align-items: flex-start;
        white-space: normal;
        overflow: visible;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow-wrap: anywhere;
        line-height: 1.25;
        font-size: .98rem;
    }
    #lista-orcamentos .budget-date {
        grid-column: 1;
        white-space: normal;
        line-height: 1.35;
    }
    #lista-orcamentos .budget-status {
        grid-column: 2;
        grid-row: 1 / span 2;
        align-self: center;
        width: fit-content;
    }
    #lista-orcamentos .budget-total {
        grid-column: 1;
        grid-row: auto;
        min-height: auto;
        padding: 12px 14px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-radius: 12px;
        background: #eff6ff;
    }
    #lista-orcamentos .budget-total strong {
        font-size: 1.18rem;
    }
    #lista-orcamentos .budget-meta-grid {
        grid-column: 1;
        grid-row: auto;
        padding-left: 6px;
        margin: 0;
        overflow: visible;
        flex-wrap: wrap;
        scrollbar-width: auto;
    }
    #lista-orcamentos .budget-meta-grid::-webkit-scrollbar {
        display: initial;
    }
    #lista-orcamentos .budget-meta-item {
        flex: 0 1 auto;
        white-space: nowrap;
    }
    #lista-orcamentos .budget-meta-item:nth-child(4) {
        display: none;
    }
    #lista-orcamentos .budget-detail-toggle {
        grid-column: 1;
        width: calc(100% - 6px);
        height: 42px;
        margin-left: 6px;
        padding: 0 12px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border: 1px solid #dbe3ee;
        border-radius: 12px;
        background: linear-gradient(180deg, #ffffff, #f8fafc);
        color: #1e293b;
        font-weight: 850;
        cursor: pointer;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9);
    }
    #lista-orcamentos .budget-detail-toggle i {
        color: var(--accent);
        transition: transform .18s ease;
    }
    #lista-orcamentos .budget-card.details-open .budget-detail-toggle i {
        transform: rotate(180deg);
    }
    #lista-orcamentos .budget-detail-panel {
        grid-column: 1;
        grid-template-columns: 1fr;
        gap: 6px;
        margin-left: 6px;
        padding: 10px;
        display: none;
    }
    #lista-orcamentos .budget-card.details-open .budget-detail-panel {
        display: grid;
    }
    #lista-orcamentos .budget-detail-item {
        grid-template-columns: 30px minmax(0, 1fr);
        padding: 7px 4px;
        border-right: 0;
        border-bottom: 1px solid #e2e8f0;
    }
    #lista-orcamentos .budget-detail-item:last-child {
        border-bottom: 0;
    }
    #lista-orcamentos .budget-status-actions,
    #lista-orcamentos .budget-actions {
        display: none;
    }
    #lista-orcamentos .budget-mobile-row {
        display: flex;
        align-items: center;
        gap: 0;
        padding-left: 6px;
        position: relative;
    }
    #lista-orcamentos .budget-mobile-menu-wrap {
        position: relative;
        min-width: 0;
    }
    #lista-orcamentos .budget-mobile-trigger,
    #lista-orcamentos .budget-mobile-actionbar > button,
    #lista-orcamentos .budget-mobile-actionbar > .budget-mobile-menu-wrap > button {
        min-height: 44px;
        border: 1px solid #dbe3ee;
        background: #fff;
        color: #0f172a;
        cursor: pointer;
    }
    #lista-orcamentos .budget-mobile-trigger {
        width: auto;
        min-width: 164px;
        min-height: 38px;
        border-radius: 11px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 0 12px 0 13px;
        color: var(--accent);
        background: #ffffff;
        border-color: #cbd5e1;
        font-weight: 850;
        box-shadow: 0 10px 22px -22px rgba(15, 23, 42, .55), inset 0 1px 0 rgba(255, 255, 255, .9);
    }
    #lista-orcamentos .budget-mobile-trigger span {
        min-width: 0;
        display: inline;
    }
    #lista-orcamentos .budget-mobile-trigger > i {
        width: 20px;
        height: 20px;
        display: grid;
        place-items: center;
        flex: 0 0 auto;
        border-radius: 7px;
        background: transparent;
        color: var(--accent);
        box-shadow: none;
    }
    #lista-orcamentos .budget-mobile-menu {
        position: absolute;
        z-index: 30;
        top: calc(100% + 6px);
        left: 0;
        display: none;
        min-width: min(280px, calc(100vw - 58px));
        padding: 10px;
        border: 1px solid #cbd5e1;
        border-radius: 14px;
        background: #fff;
        box-shadow: 0 24px 48px -32px rgba(15, 23, 42, .78);
    }
    #lista-orcamentos .budget-mobile-menu-wrap.open .budget-mobile-menu {
        display: grid;
        gap: 6px;
    }
    #lista-orcamentos .budget-mobile-more .budget-mobile-menu,
    #lista-orcamentos .budget-mobile-actionbar .budget-mobile-menu {
        left: auto;
        right: 0;
    }
    #lista-orcamentos .budget-mobile-actionbar .budget-mobile-menu.bottom-menu {
        top: auto;
        bottom: calc(100% + 6px);
    }
    #lista-orcamentos .budget-mobile-menu button {
        width: 100%;
        min-height: 44px;
        display: flex;
        align-items: center;
        gap: 10px;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: #0f172a;
        font-weight: 800;
        text-align: left;
        padding: 0 10px;
    }
    #lista-orcamentos .budget-mobile-menu button:focus-visible,
    #lista-orcamentos .budget-mobile-trigger:focus-visible,
    #lista-orcamentos .budget-mobile-actionbar > button:focus-visible,
    #lista-orcamentos .budget-mobile-actionbar > .budget-mobile-menu-wrap > button:focus-visible,
    #lista-orcamentos .budget-detail-toggle:focus-visible {
        outline: 3px solid var(--border-focus);
        outline-offset: 2px;
    }
    #lista-orcamentos .status-option.aprovado i { color: #16a34a; }
    #lista-orcamentos .status-option.pendente i { color: #f59e0b; }
    #lista-orcamentos .status-option.recusado i,
    #lista-orcamentos .budget-mobile-menu .danger i { color: #dc2626; }
    #lista-orcamentos .budget-mobile-actionbar {
        grid-column: 1;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        margin: 4px -12px 0;
        border-top: 1px solid #e2e8f0;
        overflow: visible;
    }
    #lista-orcamentos .budget-mobile-actionbar > button,
    #lista-orcamentos .budget-mobile-actionbar > .budget-mobile-menu-wrap > button {
        width: 100%;
        min-width: 0;
        height: 58px;
        border-width: 0 1px 0 0;
        border-radius: 0;
        display: grid;
        place-items: center;
        gap: 3px;
        font-size: .74rem;
        font-weight: 800;
        box-shadow: none;
    }
    #lista-orcamentos .budget-mobile-actionbar .budget-mobile-menu-wrap:last-child > button {
        border-right: 0;
    }
    #lista-orcamentos .budget-mobile-actionbar > button i,
    #lista-orcamentos .budget-mobile-actionbar > .budget-mobile-menu-wrap > button i {
        font-size: 1.28rem;
        color: var(--accent);
    }
    #lista-orcamentos .budget-mobile-actionbar .ph-whatsapp-logo {
        color: #16a34a;
    }
    #lista-orcamentos .budget-mobile-actionbar > button[disabled],
    #lista-orcamentos .budget-mobile-actionbar > .budget-mobile-menu-wrap > button[disabled] {
        opacity: .45;
        cursor: not-allowed;
    }
    #lista-orcamentos .budget-mobile-actionbar > button:active:not([disabled]),
    #lista-orcamentos .budget-mobile-actionbar > .budget-mobile-menu-wrap > button:active:not([disabled]),
    #lista-orcamentos .budget-mobile-trigger:active,
    #lista-orcamentos .budget-detail-toggle:active {
        background: #eff6ff;
        transform: scale(.98);
    }
    @media (max-width: 360px) {
        #lista-orcamentos .budget-header > div:first-child {
            grid-template-columns: minmax(0, 1fr);
        }
        #lista-orcamentos .budget-status {
            grid-column: 1;
            grid-row: auto;
            align-self: start;
        }
        #lista-orcamentos .budget-mobile-actionbar > button,
        #lista-orcamentos .budget-mobile-actionbar > .budget-mobile-menu-wrap > button {
            font-size: .7rem;
        }
    }
    .finance-summary-card { flex-direction: column; }
    .budget-table-wrap,
    .clients-table-shell {
        margin-inline: -2px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    #clientes .clients-table-shell {
        margin-inline: 0;
        overflow: hidden;
    }
    .budget-table-wrap::after {
        content: "Deslize para ver mais";
        display: block;
        padding: 8px 10px;
        color: var(--text-tertiary);
        font-size: .72rem;
        text-align: center;
        background: #fff;
        border-top: 1px solid var(--border-light);
    }
    .dashboard-list-item {
        grid-template-columns: 34px minmax(0, 1fr);
        align-items: flex-start;
    }
    .dashboard-list-item .list-meta {
        grid-column: 2;
        text-align: left;
        white-space: normal;
    }
    .shortcuts-grid,
    .users-overview,
    .permissions-grid {
        grid-template-columns: 1fr;
    }
    .user-card-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    .user-card-actions .btn {
        width: 100%;
    }
    
    /* Modais - Mais fluidos */
    .modal-overlay { padding: 10px; align-items: flex-end; } 
    .modal,
    .modal-content {
        width: 100%;
        max-width: none;
        max-height: min(88vh, 720px);
        border-radius: 16px 16px 8px 8px;
        transform: translateY(100%);
        margin: 0;
    }
    .modal-overlay.active .modal,
    .modal-overlay.active .modal-content { transform: translateY(0); }
    .modal-header { padding: 16px; }
    .modal-header h3 { font-size: 1.08rem; line-height: 1.25; }
    .modal-body { padding: 16px; }
    .modal-footer { padding: 16px; flex-direction: column-reverse; gap: 10px; }
    .modal-footer .btn { width: 100%; margin: 0; }
    .modal-tabs { gap: 4px; padding-bottom: 2px; }
    .tab-btn { padding: 10px 12px; font-size: .86rem; }
}

@media (max-width: 420px) {
    .budget-actions,
    .item-actions,
    .user-card-actions {
        grid-template-columns: 1fr;
    }

    .mobile-menu-btn,
    .icon-btn {
        width: 36px;
        height: 36px;
    }

    .main-content {
        padding: 68px 10px calc(92px + env(safe-area-inset-bottom));
    }
}
