/* ============================================================
   Fica Frio - Tema Clima Frio & Agradável
   Paleta: Azul gelo, branco neve, ciano suave, cinza frio
   ============================================================ */

:root {
    /* Paleta principal - tons frios e frescos */
    --ice-blue: #4a9ece;
    --ice-dark: #1b6b9e;
    --ice-deeper: #0d4a6f;
    --frost: #e8f4fd;
    --frost-light: #f0f8ff;
    --snow: #f7fbfe;
    --glacier: #b8dff5;
    --mint: #7ec8db;
    --cyan-soft: #5bb8d4;
    --steel: #64748b;
    --accent: #38bdf8;
    --accent-warm: #67d4e8;
    --success-cold: #34d399;
    --warning-cold: #fbbf24;
    --danger-cold: #f87171;

    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-bg: linear-gradient(180deg, #0d4a6f 0%, #1b6b9e 100%);
    --sidebar-text: #a3d5ef;
    --sidebar-active: #ffffff;
    --sidebar-hover-bg: rgba(56, 189, 248, 0.12);
    --sidebar-accent: #38bdf8;

    --topbar-height: 56px;
}

/* ---- Reset & Base ---- */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--snow);
    margin: 0;
    min-height: 100vh;
    color: #1e293b;
}

a { color: var(--ice-blue); text-decoration: none; }
a:hover { color: var(--ice-dark); }

/* ---- Botões ---- */
.btn-primary {
    background: linear-gradient(135deg, var(--ice-blue), var(--ice-dark)) !important;
    border: none !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(74, 158, 206, 0.3);
}
.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, var(--ice-dark), var(--ice-deeper)) !important;
    box-shadow: 0 4px 12px rgba(74, 158, 206, 0.4);
    transform: translateY(-1px);
}
.btn-outline-primary {
    color: var(--ice-blue) !important;
    border-color: var(--ice-blue) !important;
}
.btn-outline-primary:hover {
    background: var(--ice-blue) !important;
    color: #fff !important;
}
.btn-warning {
    background: var(--warning-cold) !important;
    border-color: var(--warning-cold) !important;
    color: #1a1a1a !important;
}
.btn-warning:hover {
    background: #f59e0b !important;
    border-color: #f59e0b !important;
}
.bg-primary { background: var(--ice-blue) !important; }
.text-primary { color: var(--ice-blue) !important; }
.bg-warning { background: var(--warning-cold) !important; }
.text-warning { color: #d97706 !important; }

/* ---- Login ---- */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, #0d4a6f 0%, #4a9ece 40%, #b8dff5 70%, #e8f4fd 100%);
    position: relative;
    overflow: hidden;
}
.login-container::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 80%;
    height: 150%;
    background: radial-gradient(ellipse, rgba(56, 189, 248, 0.15), transparent 70%);
    pointer-events: none;
}
.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(13, 74, 111, 0.25), 0 0 40px rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(184, 223, 245, 0.5);
}
.login-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ice-blue), var(--accent));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    box-shadow: 0 8px 24px rgba(56, 189, 248, 0.35);
}
.login-icon i { font-size: 2.5rem; color: #fff; }

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform 0.3s ease;
    box-shadow: 4px 0 20px rgba(13, 74, 111, 0.15);
}
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(56, 189, 248, 0.15);
}
.sidebar-header i { font-size: 1.75rem; color: var(--accent); }
.sidebar-brand { font-size: 1.25rem; font-weight: 700; color: #fff; letter-spacing: 0.5px; }
.sidebar-nav { flex: 1; padding: 0.75rem 0; overflow-y: auto; }
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.sidebar-link:hover {
    background: var(--sidebar-hover-bg);
    color: #fff;
}
.sidebar-link.active {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-accent);
    border-left-color: var(--sidebar-accent);
    font-weight: 600;
}
.sidebar-link i { font-size: 1.2rem; width: 24px; text-align: center; }
.sidebar-divider { border-color: rgba(56, 189, 248, 0.12); margin: 0.5rem 1.5rem; }
.sidebar-section {
    padding: 0.85rem 1.5rem 0.35rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.65);
}
.sidebar-footer { padding: 0.75rem 0; border-top: 1px solid rgba(56, 189, 248, 0.15); }
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1.5rem;
    color: #fff;
    font-size: 0.85rem;
}
.sidebar-user i { font-size: 1.4rem; color: var(--accent); }

/* ---- Main Content ---- */
.main-content { margin-left: var(--sidebar-width); min-height: 100vh; }
.content-wrapper { padding: 1.5rem; max-width: 1400px; }

/* ---- Topbar mobile ---- */
.topbar {
    background: linear-gradient(135deg, var(--ice-deeper), var(--ice-dark));
    color: #fff;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1030;
}
.topbar .fw-bold { color: var(--accent); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1035; backdrop-filter: blur(2px); }

/* ---- Cards ---- */
.card {
    border: 1px solid rgba(184, 223, 245, 0.4);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(74, 158, 206, 0.06);
    transition: box-shadow 0.2s;
}
.card:hover { box-shadow: 0 4px 16px rgba(74, 158, 206, 0.1); }
.card-header {
    border-radius: 14px 14px 0 0 !important;
    border-bottom: 1px solid rgba(184, 223, 245, 0.3);
    background: var(--frost-light);
}
.card-stat .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

/* Cards gradiente frio */
.card-azul {
    background: linear-gradient(135deg, var(--ice-blue), var(--cyan-soft));
    color: #fff;
    border: none;
}
.card-frosted {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(184, 223, 245, 0.5);
}

/* ---- Planos ---- */
.plano-card {
    border: 2px solid var(--glacier);
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.plano-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--ice-blue), var(--accent));
    opacity: 0;
    transition: opacity 0.3s;
}
.plano-card:hover, .plano-card.selected {
    border-color: var(--accent);
    box-shadow: 0 8px 30px rgba(56, 189, 248, 0.2);
    transform: translateY(-3px);
}
.plano-card:hover::before, .plano-card.selected::before { opacity: 1; }
.plano-card.selected::after {
    content: '✓';
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--accent);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}
.plano-preco { font-size: 2rem; font-weight: 800; color: var(--ice-dark); }
.plano-preco small { font-size: 0.9rem; font-weight: 400; color: var(--steel); }
.plano-badge-basico { background: var(--frost); color: var(--ice-dark); }
.plano-badge-intermediario { background: linear-gradient(135deg, var(--glacier), var(--frost)); color: var(--ice-deeper); }
.plano-badge-completo { background: linear-gradient(135deg, var(--ice-blue), var(--accent)); color: #fff; }

/* ---- QR Code ---- */
.qrcode-container {
    display: inline-block;
    padding: 16px;
    background: #fff;
    border: 3px solid var(--glacier);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(74, 158, 206, 0.1);
}

/* ---- Página pública equipamento ---- */
.public-header {
    background: linear-gradient(135deg, var(--ice-deeper), var(--ice-blue), var(--cyan-soft));
    color: #fff;
    padding: 2rem 1rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.public-header::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--snow);
    border-radius: 50% 50% 0 0;
}
.public-header .logo-icon {
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(8px);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}
.public-header .logo-icon i { font-size: 1.8rem; color: #fff; }

/* ---- Timeline manutenção ---- */
.timeline-item {
    position: relative;
    padding-left: 2rem;
    padding-bottom: 1.5rem;
    border-left: 2px solid var(--glacier);
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--ice-blue);
    box-shadow: 0 0 0 3px var(--frost);
}
.timeline-item.concluida::before { background: var(--success-cold); box-shadow: 0 0 0 3px #d1fae5; }
.timeline-item.agendada::before { background: var(--warning-cold); box-shadow: 0 0 0 3px #fef3c7; }
.timeline-item.cancelada::before { background: var(--danger-cold); box-shadow: 0 0 0 3px #fee2e2; }
.timeline-item:last-child { border-left-color: transparent; }

/* ---- Tabelas ---- */
.table th {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--steel);
    background: var(--frost);
    border-bottom: 2px solid var(--glacier);
}
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background: var(--frost-light); }

/* ---- WhatsApp ---- */
.whatsapp-badge { background: #25D366; color: #fff; font-size: 0.75rem; padding: 0.3em 0.6em; border-radius: 4px; }
.btn-whatsapp { background: #25D366; border-color: #25D366; color: #fff; }
.btn-whatsapp:hover { background: #1da851; border-color: #1da851; color: #fff; }

/* ---- Fotos de equipamento ---- */
.equipment-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}
.equipment-photo {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 1;
    border: 2px solid var(--glacier);
    transition: all 0.2s;
}
.equipment-photo:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(56, 189, 248, 0.2);
    transform: scale(1.02);
}
.equipment-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.equipment-photo .photo-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(248, 113, 113, 0.9);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}
.equipment-photo:hover .photo-remove { opacity: 1; }
.photo-upload-area {
    border: 2px dashed var(--glacier);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--frost-light);
}
.photo-upload-area:hover,
.photo-upload-area.dragover {
    border-color: var(--accent);
    background: var(--frost);
    border-style: solid;
}
.photo-upload-area i { font-size: 2rem; color: var(--ice-blue); }

/* ---- QR code badge na lista ---- */
.qr-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--frost);
    color: var(--ice-dark);
    border: 1px solid var(--glacier);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}
.qr-badge:hover { background: var(--glacier); color: var(--ice-deeper); }

/* ---- Responsivo ---- */
@media (max-width: 767.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .sidebar.show + .main-content .sidebar-overlay, .sidebar.show ~ .sidebar-overlay { display: block; }
    .main-content { margin-left: 0; }
    .content-wrapper { padding: 1rem; }
    .equipment-photos { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}

/* ---- Utilitários ---- */
.badge { font-weight: 500; font-size: 0.75rem; }
.btn { border-radius: 8px; transition: all 0.2s; }
.form-control, .form-select {
    border-radius: 8px;
    border-color: var(--glacier);
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}
.alert { border-radius: 10px; }
.border-frost { border-color: var(--glacier) !important; }
.border-ice { border-color: var(--ice-blue) !important; }
.bg-frost { background: var(--frost) !important; }
.bg-frost-light { background: var(--frost-light) !important; }
.bg-azul-light { background: var(--frost) !important; }
.bg-amarelo-light { background: #fef9e7 !important; }
.border-amarelo { border-color: var(--warning-cold) !important; }
.text-ice { color: var(--ice-blue) !important; }
.text-steel { color: var(--steel) !important; }

/* Print-friendly */
@media print {
    .sidebar, .topbar, .btn, .sidebar-overlay { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
}

/* ============================================================
   PWA / Offline / Mobile
   ============================================================ */

/* Indicador de conexão */
.online-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    transition: background 0.3s;
}
.online-dot.online {
    background: var(--success-cold);
    box-shadow: 0 0 6px var(--success-cold);
}
.online-dot.offline {
    background: var(--danger-cold);
    box-shadow: 0 0 6px var(--danger-cold);
    animation: pulse-offline 1.5s infinite;
}
@keyframes pulse-offline {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.sidebar-sync-status {
    border-top: 1px solid rgba(56, 189, 248, 0.15);
    border-bottom: 1px solid rgba(56, 189, 248, 0.15);
}

/* Sync progress bar */
.sync-progress-bar {
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 9999;
    background: var(--frost);
    padding: 0.5rem 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    text-align: center;
    font-size: 0.85rem;
}

/* Offline mode body styles */
body.app-offline .sidebar {
    background: linear-gradient(180deg, #4a4a4a 0%, #333 100%);
}
body.app-offline .topbar {
    background: #555 !important;
}
body.app-offline::after {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: repeating-linear-gradient(
        90deg,
        var(--warning-cold),
        var(--warning-cold) 10px,
        transparent 10px,
        transparent 20px
    );
    z-index: 99999;
    animation: offline-stripe 1s linear infinite;
}
@keyframes offline-stripe {
    from { background-position: 0 0; }
    to { background-position: 20px 0; }
}

/* Toast container */
.toast-container .toast {
    min-width: 280px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

/* Mobile form improvements */
@media (max-width: 767.98px) {
    .form-control, .form-select {
        font-size: 16px !important; /* Previne zoom no iOS */
        min-height: 44px; /* Touch target mínimo */
    }
    .btn {
        min-height: 44px;
        font-size: 1rem;
    }
    .btn-sm {
        min-height: 36px;
    }
    .table {
        font-size: 0.85rem;
    }
    .table th, .table td {
        padding: 0.5rem 0.4rem;
        white-space: nowrap;
    }
    .content-wrapper {
        padding: 0.75rem !important;
    }
    .card-body {
        padding: 0.75rem;
    }
    h1.h3 { font-size: 1.25rem; }

    /* Stack action buttons */
    .d-flex.justify-content-between {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Photo grid mobile */
    .equipment-photos {
        grid-template-columns: repeat(2, 1fr);
    }
    .foto-item .row {
        flex-direction: column;
    }
    .foto-item .col-md-5,
    .foto-item .col-md-6,
    .foto-item .col-md-1 {
        width: 100%;
    }
}

/* Install prompt banner */
.install-prompt {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(135deg, var(--ice-dark), var(--ice-deeper));
    color: #fff;
    padding: 1rem;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
}
.install-prompt .btn-install {
    background: #fff;
    color: var(--ice-dark);
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    white-space: nowrap;
}
.install-prompt .btn-dismiss {
    background: transparent;
    color: rgba(255,255,255,0.7);
    border: none;
    font-size: 1.2rem;
}

/* ---- Global Search ---- */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 1050;
    max-height: 300px;
    overflow-y: auto;
}
.search-results .list-group-item {
    border: none;
    border-bottom: 1px solid #f0f0f0;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
}
.search-results .list-group-item:hover {
    background: var(--frost);
}
.search-results .list-group-item .badge {
    font-size: 0.65rem;
}

/* ---- Sidebar badges ---- */
.sidebar .nav-link .badge {
    font-size: 0.6rem;
    padding: 0.2em 0.45em;
    vertical-align: middle;
}

/* ---- Chart bars ---- */
.chart-bars {
    padding: 0 1rem;
}
.chart-bar {
    transition: height 0.5s ease;
}
.chart-bar:hover {
    opacity: 0.85;
    transform: scaleY(1.02);
}
.chart-bar-value {
    font-size: 0.7rem;
    white-space: nowrap;
}

/* ---- Checklist styles ---- */
.checklist-result-conforme {
    color: var(--success-cold);
    font-weight: 600;
}
.checklist-result-nao-conforme {
    color: var(--danger-cold);
    font-weight: 600;
}
.checklist-result-na {
    color: var(--steel);
}

/* ---- Relatório PDF / Print ---- */
.report-container {
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    padding: 2rem;
}
@media print {
    body { background: #fff !important; }
    .sidebar, .topbar, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; }
    .report-container { box-shadow: none; max-width: 100%; }
}

/* ---- Satisfaction stars ---- */
.star-rating {
    display: inline-flex;
    gap: 0.25rem;
    font-size: 2rem;
    cursor: pointer;
}
.star-rating .star {
    color: #ddd;
    transition: color 0.2s;
}
.star-rating .star.filled,
.star-rating .star:hover,
.star-rating .star:hover ~ .star {
    color: var(--warning-cold);
}
.star-rating.readonly { cursor: default; }

/* ---- PMOC status ---- */
.pmoc-vigente { border-left: 4px solid var(--success-cold); }
.pmoc-vencido { border-left: 4px solid var(--danger-cold); }
.pmoc-rascunho { border-left: 4px solid var(--steel); }

/* ---- Breadcrumb ---- */
.breadcrumb-nav {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}
.breadcrumb-nav a {
    color: var(--steel);
}
.breadcrumb-nav a:hover {
    color: var(--ice-dark);
}

/* PWA standalone mode - hide browser UI hints */
@media (display-mode: standalone) {
    .topbar { padding-top: env(safe-area-inset-top, 0); }
    body { padding-bottom: env(safe-area-inset-bottom, 0); }
}

/* ============================================================
   MOBILE-APP-ENHANCEMENTS-START (gerado automaticamente)
   Bottom nav, touch refinements, safe-area, prevent zoom, etc.
   ============================================================ */

/* ---- Touch / no-callout / smooth scroll ---- */
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior-y: contain;          /* evita "pull-to-refresh" ao rolar listas */
    touch-action: manipulation;              /* elimina delay de 300ms */
}
img, button, a { -webkit-touch-callout: none; }
input, textarea, select, [contenteditable] { -webkit-user-select: text; user-select: text; }

/* Scrollbar discreta (mobile/desktop) */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(27,107,158,.35); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(27,107,158,.6); }

/* Hover só em dispositivos com mouse de verdade */
@media (hover: none) {
    .btn:hover, .sidebar-link:hover, a:hover { transform: none !important; }
}

/* ---- Safe-area inset universal (notch / Dynamic Island) ---- */
.topbar { padding-top: calc(.75rem + env(safe-area-inset-top, 0)); padding-left: calc(1rem + env(safe-area-inset-left, 0)); padding-right: calc(1rem + env(safe-area-inset-right, 0)); }
.sidebar { padding-top: env(safe-area-inset-top, 0); }

/* ---- Bottom Navigation Bar (estilo nativo) ---- */
.bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 1040;
    background: #ffffff;
    border-top: 1px solid #e5edf3;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    align-items: stretch;
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -4px 18px rgba(13,74,111,.10);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
}
.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px 6px;
    color: #64748b;
    text-decoration: none;
    font-size: .68rem;
    font-weight: 500;
    line-height: 1;
    min-height: 56px;
    transition: color .15s, transform .1s;
    position: relative;
}
.bottom-nav-item i { font-size: 1.35rem; line-height: 1; }
.bottom-nav-item:active { transform: scale(.94); color: var(--ice-dark); }
.bottom-nav-item.active { color: var(--ice-dark); }
.bottom-nav-item.active::before {
    content: '';
    position: absolute; top: 0; left: 25%; right: 25%;
    height: 3px; border-radius: 0 0 4px 4px;
    background: var(--accent);
}
/* FAB central destacado */
.bottom-nav-fab { transform: translateY(-10px); }
.bottom-nav-fab .bottom-nav-fab-circle {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ice-blue), var(--ice-dark));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 16px rgba(27,107,158,.45);
    margin-bottom: 2px;
}
.bottom-nav-fab .bottom-nav-fab-circle i { font-size: 1.6rem; color: #fff; }
.bottom-nav-fab.active .bottom-nav-fab-circle { background: linear-gradient(135deg, var(--ice-dark), var(--ice-deeper)); }

/* Conteúdo precisa respirar acima do bottom-nav */
@media (max-width: 767.98px) {
    body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0)); }
    .install-prompt { bottom: calc(64px + env(safe-area-inset-bottom, 0)); }
    /* Toasts de Bootstrap fixos no rodapé não devem cobrir o bottom-nav */
    .toast-container.position-fixed.bottom-0 { bottom: calc(70px + env(safe-area-inset-bottom, 0)) !important; }
}
@media (min-width: 768px) {
    .bottom-nav { display: none !important; }
}

/* ---- Refinos mobile gerais ---- */
@media (max-width: 767.98px) {
    /* Tabelas com scroll horizontal sem cortar visual */
    .table-responsive { -webkit-overflow-scrolling: touch; }

    /* Cards mais "app" */
    .card { border-radius: 14px; }

    /* Modais ocupam tela toda em telas estreitas */
    .modal-fullscreen-sm-down .modal-body { padding: 1rem; }

    /* Inputs com toque maior */
    .input-group > .form-control,
    .input-group > .form-select { min-height: 44px; }

    /* Sidebar sobre tudo */
    .sidebar { z-index: 1060; box-shadow: 4px 0 24px rgba(0,0,0,.35); }
    .sidebar-overlay { z-index: 1055; }

    /* Topbar: botão hamburger maior */
    .topbar .btn-link { padding: .25rem .5rem; }
    .topbar .btn-link i { font-size: 1.6rem !important; }
}

/* ---- Standalone (PWA instalado) ---- */
@media (display-mode: standalone), (display-mode: window-controls-overlay) {
    /* esconde elementos que só fazem sentido no browser */
    .install-prompt { display: none !important; }
    body { overscroll-behavior: none; }
}

/* ---- Animação sutil ao trocar de página (cache-page transition) ---- */
@keyframes appFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.content-wrapper { animation: appFadeIn .25s ease-out; }
@media (prefers-reduced-motion: reduce) {
    .content-wrapper { animation: none; }
}

/* ---- Splash de carregamento (overlay rápido) ---- */
.app-splash {
    position: fixed; inset: 0; z-index: 99998;
    background: linear-gradient(160deg, var(--ice-deeper), var(--ice-dark));
    color: #fff;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 1rem;
    opacity: 1; transition: opacity .3s;
}
.app-splash.hide { opacity: 0; pointer-events: none; }
.app-splash i { font-size: 3.5rem; color: var(--accent); animation: spin 2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   MOBILE-APP-ENHANCEMENTS-END
   ============================================================ */
