    /* --- CONFIGURAÇÕES GERAIS E ESTILOS --- */
    :root {
        --app-primary: #FFD700;
        --app-secondary: #111;
        --app-bg: #f4f6f8;
        --card-bg: #ffffff;
        --app-text: #333333;
        --input-bg: #ffffff;
        --input-border: #dddddd;
        --success: #00C853;
        --danger: #ff4757;
        --info: #00d2d3;
        --warning: #ff9f43;
    }

    body.dark-mode {
        --app-bg: #121212;
        --card-bg: #1e1e1e;
        --app-text: #e0e0e0;
        --input-bg: #2c2c2c;
        --input-border: #444444;
        --app-secondary: #000000;
    }

    * { box-sizing: border-box; margin: 0; padding: 0; outline: none; }
    body { font-family: 'Roboto', sans-serif; background: var(--app-bg); color: var(--app-text); transition: background 0.3s, color 0.3s; }

    /* LAYOUT */
    #login-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: #121212; z-index: 99999; display: flex; justify-content: center; align-items: center; }
    .login-box { background: var(--card-bg); padding: 40px; border-radius: 10px; width: 90%; max-width: 400px; text-align: center; border-top: 5px solid var(--app-primary); color: var(--app-text); }
    .login-logo { max-width: 260px; height: auto; margin-bottom: 25px; display: inline-block; }
    .super-app-wrapper { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; margin: 0; background: var(--app-bg); border-radius: 0; overflow: hidden; box-shadow: none; flex-direction: column; z-index: 9999; transition: background 0.3s; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }

    /* HEADER & NAV */
    .app-header { background: var(--app-secondary); color: var(--app-primary); padding: 10px 20px; display: flex; justify-content: space-between; align-items: center; height: 70px; flex-shrink: 0; z-index: 100; }
    .app-logo-area { display: flex; align-items: center; gap: 15px; }
    .header-logo { max-height: 45px; width: auto; object-fit: contain; }
    .app-version { font-size: 10px; color: #fff; opacity: 0.6; background: rgba(255,255,255,0.1); padding: 2px 5px; border-radius: 4px; }
    .header-actions { display: flex; align-items: center; gap: 15px; }
    .user-welcome { font-size: 11px; color: #ccc; margin-right: 10px; white-space: nowrap; }
    .btn-theme { background: none; border: 1px solid #444; color: #FFD700; cursor: pointer; padding: 5px 10px; border-radius: 20px; font-size: 12px; }

    /* NOTIFICAÇÃO */
    .notification-area { position: relative; cursor: pointer; color: #fff; margin-right: 10px; }
    .notification-badge { position: absolute; top: -5px; right: -5px; background: var(--danger); color: white; font-size: 9px; padding: 2px 5px; border-radius: 50%; display: none; border: 1px solid #fff; }

    .app-nav { display: flex; background: var(--card-bg); border-bottom: 1px solid var(--input-border); overflow-x: auto; flex-shrink: 0; z-index: 99; }
    .nav-item { flex: 1; padding: 12px 10px; text-align: center; font-size: 11px; font-weight: 600; color: #666; cursor: pointer; min-width: 70px; border-bottom: 3px solid transparent; display: flex; flex-direction: column; align-items: center; gap: 5px; }
    .nav-item.active { color: var(--app-text); border-bottom-color: var(--app-primary); background: rgba(0,0,0,0.02); }
    body.dark-mode .nav-item.active { background: rgba(255,255,255,0.05); }
    
    .app-content { padding: 20px; flex: 1; overflow-y: auto; overflow-x: hidden; position: relative; min-height: 0; }
    .tab-pane { display: none; animation: fadeIn 0.3s forwards; width: 100%; }
    .tab-pane.active { display: block; }
    @keyframes fadeIn { from { opacity:0; transform:translateY(5px); } to { opacity:1; transform:translateY(0); } }

    /* COMPONENTES */
    .card { background: var(--card-bg); border: 1px solid var(--input-border); border-radius: 8px; padding: 20px; margin-bottom: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.02); color: var(--app-text); }
    .form-group { margin-bottom: 15px; }
    .form-label { font-size: 12px; font-weight: bold; color: var(--app-text); opacity: 0.8; display: block; margin-bottom: 5px; }
    .form-control { width: 100%; padding: 10px; border: 1px solid var(--input-border); border-radius: 5px; background: var(--input-bg); color: var(--app-text); }
    .btn { width: 100%; padding: 12px; border: none; border-radius: 5px; font-weight: bold; cursor: pointer; text-transform: uppercase; margin-top: 5px; display: flex; align-items: center; justify-content: center; gap: 8px; }
    .btn-primary { background: var(--app-primary); color: #000; }
    .btn-dark { background: var(--app-secondary); color: #fff; }
    .btn-success { background: var(--success); color: #fff; }
    .btn-danger { background: var(--danger); color: #fff; }
    .btn-warning { background: var(--warning); color: #fff; }
    .btn-info { background: var(--info); color: #fff; }
    .btn-sm { padding: 5px 10px; font-size: 10px; width: auto; display: inline-flex; }

    /* AGENDA */
    .task-card { display: flex; align-items: flex-start; gap: 15px; padding: 15px; border-bottom: 1px solid var(--input-border); transition: background 0.2s; }
    .task-card:last-child { border-bottom: none; }
    .task-time-box { text-align: center; min-width: 50px; }
    .task-time-val { font-size: 14px; font-weight: bold; color: var(--app-text); }
    .task-date-val { font-size: 10px; text-transform: uppercase; opacity: 0.7; }
    .task-details { flex: 1; }
    .task-title { font-size: 14px; font-weight: bold; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
    .task-desc { font-size: 12px; opacity: 0.8; margin-bottom: 5px; }
    .task-meta { font-size: 11px; opacity: 0.6; display: flex; gap: 10px; }
    .task-type-badge { font-size: 9px; padding: 2px 6px; border-radius: 4px; font-weight: bold; text-transform: uppercase; }
    .type-visita { background: #e3f2fd; color: #1976d2; }
    .type-reuniao { background: #e8f5e9; color: #2e7d32; }
    .type-tarefa { background: #fff3e0; color: #ef6c00; }
    
    /* BOTÃO FLUTUANTE */
    .btn-fab { position: fixed; bottom: calc(25px + env(safe-area-inset-bottom)); right: calc(25px + env(safe-area-inset-right)); width: 55px; height: 55px; border-radius: 50%; background: var(--app-primary); color: #000; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 15px rgba(0,0,0,0.4); font-size: 22px; border: none; cursor: pointer; z-index: 9999; }
    .btn-fab:hover { transform: scale(1.1); transition: 0.2s; }
    .whatsapp-sidebar { position: fixed; right: 0; top: 50%; transform: translateY(-50%); z-index: 9999; display: flex; align-items: center; }
    .whatsapp-tab { background: #25D366; color: #fff; padding: 10px 5px; border-radius: 8px 0 0 8px; cursor: pointer; display: flex; align-items: center; gap: 6px; font-size: 9px; font-weight: bold; box-shadow: -2px 2px 8px rgba(0,0,0,0.3); writing-mode: vertical-lr; letter-spacing: 1px; }
    .whatsapp-tab i { font-size: 14px; }
    .whatsapp-panel { background: var(--card-bg); width: 0; overflow: hidden; border-radius: 10px 0 0 10px; box-shadow: -4px 0 20px rgba(0,0,0,0.3); transition: width 0.3s ease, padding 0.3s ease; white-space: nowrap; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; border: none; }
    .whatsapp-panel.open { width: 260px; padding: 20px; border: 1px solid var(--input-border); border-right: none; }
    .whatsapp-panel p { white-space: normal; font-size: 12px; color: var(--app-text); line-height: 1.6; text-align: center; margin-bottom: 15px; opacity: 0; transition: opacity 0.2s ease 0.15s; }
    .whatsapp-panel.open p { opacity: 1; }
    .whatsapp-panel .btn-wpp-action { display: inline-flex; align-items: center; gap: 8px; background: #25D366; color: #fff; padding: 12px 20px; border-radius: 25px; text-decoration: none; font-size: 13px; font-weight: bold; box-shadow: 0 3px 10px rgba(37,211,102,0.4); opacity: 0; transition: opacity 0.2s ease 0.2s; }
    .whatsapp-panel.open .btn-wpp-action { opacity: 1; }
    .whatsapp-panel .btn-wpp-action:hover { transform: scale(1.05); transition: transform 0.2s; }
    .user-status-badge { font-size: 9px; padding: 3px 8px; border-radius: 12px; font-weight: bold; text-transform: uppercase; letter-spacing: 0.5px; margin-right: 8px; white-space: nowrap; }
    .user-status-ativo { background: rgba(0,200,83,0.2); color: #00C853; border: 1px solid #00C853; }
    .user-status-atrasado { background: rgba(255,71,87,0.2); color: #ff4757; border: 1px solid #ff4757; animation: pulseStatus 1.5s infinite; }
    @keyframes pulseStatus { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

    #newTaskForm { animation: slideDown 0.3s ease-out; border-left: 5px solid var(--app-primary); background: var(--input-bg); }
    @keyframes slideDown { from { opacity:0; transform:translateY(-10px); } to { opacity:1; transform:translateY(0); } }

    /* DASHBOARD */
    .user-list-item { display: flex; justify-content: space-between; align-items: center; padding: 15px; border-bottom: 1px solid var(--input-border); background: var(--card-bg); color: var(--app-text); }
    .u-badge { font-size: 10px; padding: 2px 6px; border-radius: 4px; text-transform: uppercase; font-weight: bold; margin-left: 5px; }
    .badge-admin { background: #333; color: #fff; }
    .badge-user { background: #eee; color: #333; }
    .history-item { border: 1px solid var(--input-border); border-radius: 8px; padding: 15px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
    .status-badge { padding: 4px 8px; border-radius: 4px; font-size: 10px; font-weight: bold; text-transform: uppercase; }
    .st-pendente { background: rgba(255, 159, 67, 0.15); color: var(--warning); border: 1px solid var(--warning); }
    .st-aprovado { background: rgba(0, 200, 83, 0.15); color: var(--success); border: 1px solid var(--success); }
    .st-reprovado { background: rgba(255, 71, 87, 0.15); color: var(--danger); border: 1px solid var(--danger); }
    
    .dash-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
    .dash-label { font-size: 11px; text-transform: uppercase; opacity: 0.7; }
    .charts-wrapper { display: grid; grid-template-columns: 1fr; gap: 20px; margin-bottom: 20px; }
    @media(min-width: 768px) { .charts-wrapper { grid-template-columns: 1fr 1fr; } }
    .tech-table { width: 100%; border-collapse: collapse; font-size: 12px; }
    .tech-table th { background: var(--app-secondary); color: #fff; padding: 8px; text-align: left; }
    .tech-table td { border-bottom: 1px solid var(--input-border); padding: 8px; }
    .cost-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; background: var(--input-bg); padding: 10px; border: 1px dashed var(--input-border); border-radius: 5px; }
    .loader { border: 4px solid #f3f3f3; border-top: 4px solid var(--app-primary); border-radius: 50%; width: 24px; height: 24px; animation: spin 1s linear infinite; display: none; margin: 0 auto; }
    @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

    .summary-thead { background: #eee; border-bottom: 2px solid #333; color: #000; }
    body.dark-mode .summary-thead { background: #2c2c2c; border-bottom: 2px solid #555; color: #fff; }

    /* PDFS */
    .pdf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 15px; margin-top: 15px; }
    .pdf-card { display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--input-bg); border: 1px solid var(--input-border); border-radius: 10px; padding: 15px 10px; text-decoration: none; color: var(--app-text); transition: transform 0.2s, box-shadow 0.2s; text-align: center; height: 100%; }
    .pdf-card:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); border-color: var(--app-primary); }
    .pdf-icon { font-size: 32px; color: #ff4757; margin-bottom: 10px; }
    .pdf-title { font-size: 11px; font-weight: bold; line-height: 1.3; overflow: hidden; }

    /* MOBILE */
    @media (max-width: 600px) {
        .app-header { padding: 5px 15px; height: 60px; }

        .header-logo { max-height: 30px; }
        .app-version { font-size: 9px; padding: 1px 3px; }
        .user-welcome { display: none !important; }
        .header-actions { gap: 12px; }
        .app-logo-area { gap: 8px; }
        .btn-theme, .header-actions div[onclick*="doLogout"] { font-size: 14px; }
    }

    /* IMPRESSÃO */
    @media print {
        #login-overlay, .app-nav, .no-print, .admin-only, .btn, .dash-header input, .btn-fab,
        #historico, #biblioteca, #calculos, #consumo, #config, #admin, #agenda { display: none !important; }
        .super-app-wrapper { margin: 0; box-shadow: none; width: 100%; max-width: 100%; border:none; background: #fff !important; color: #000 !important; }
        .app-content { padding: 0; }
        .card { border: none; box-shadow: none; padding: 0; background: #fff !important; color: #000 !important; }
        thead { background-color: #ddd !important; color: #000 !important; border-bottom: 2px solid #000 !important; -webkit-print-color-adjust: exact; }
        #totalCostsDisplay { display: none; }
        body.printing-financial #financeiro { display: block !important; }
        body.printing-financial #orcamento { display: none !important; }
        body.printing-financial .print-header { display: none !important; }
        body:not(.printing-financial) #orcamento { display: block !important; position: static; }
        body:not(.printing-financial) #financeiro { display: none !important; }
        body:not(.printing-financial) .print-header { display: flex !important; border-bottom: 3px solid #000 !important; margin-bottom: 20px; padding-bottom: 15px; justify-content: space-between; align-items: center; }
        #printLogoImg { max-height: 60px; max-width: 200px; display: block; }
    }
    .print-header { display: none; }

    /* --- ESTILOS MÓDULO O.S. --- */
    .os-status-funnel { display: flex; overflow-x: auto; gap: 10px; padding: 10px 0; margin-bottom: 15px; scrollbar-width: none; }
    .os-status-funnel::-webkit-scrollbar { display: none; }
    .funnel-step { flex: 0 0 auto; padding: 8px 15px; font-size: 10px; font-weight: bold; border-radius: 20px; border: 1px solid var(--input-border); background: var(--input-bg); color: var(--app-text); opacity: 0.6; }
    .funnel-step.active { background: var(--app-primary); color: #000; border-color: var(--app-primary); opacity: 1; }
    
    .checklist-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-bottom: 1px solid var(--input-border); font-size: 12px; }
    .checklist-item input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--success); }
    
    .photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .photo-upload-box { border: 2px dashed var(--input-border); border-radius: 8px; padding: 20px; text-align: center; background: var(--input-bg); position: relative; overflow: hidden; }
    .photo-upload-box input[type="file"] { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
    .photo-preview { max-width: 100%; max-height: 100px; display: none; margin-top: 10px; border-radius: 4px; }
    
    .signature-wrapper { border: 2px dashed var(--input-border); background: #fff; border-radius: 8px; overflow: hidden; margin-bottom: 10px; }
    #signaturePad { width: 100%; height: 150px; touch-action: none; cursor: crosshair; }
    
    .geo-box { background: rgba(0, 200, 83, 0.1); border-left: 4px solid var(--success); padding: 15px; border-radius: 4px; margin-bottom: 15px; }
    .geo-time { font-size: 18px; font-weight: bold; color: var(--success); }
