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

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

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --primary-glow: rgba(79,70,229,0.15);
    --accent: #06b6d4;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #0f172a;
    --text-light: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.1);
    --radius: 14px;
    --radius-sm: 10px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-y: auto !important;
    height: auto !important;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ===== LOGIN / REGISTER / FORGOT / RESET ===== */
#login-page, #register-page, #forgot-page, #reset-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    position: relative;
    overflow-y: auto;
}

#login-page::before, #register-page::before, #forgot-page::before, #reset-page::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, #312e81 0%, #4f46e5 40%, #06b6d4 100%);
    z-index: -1;
}

.login-container {
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(20px);
    padding: 48px 36px;
    border-radius: 24px;
    width: 90%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0,0,0,0.15);
    position: relative;
    z-index: 1;
    border: 1px solid rgba(255,255,255,0.3);
}

.login-container h1 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-subtitle { color: var(--text-light); margin-bottom: 32px; font-size: 0.92rem; }
.login-link { margin-top: 18px; font-size: 0.84rem; color: var(--text-muted); }
.login-link a { color: var(--primary); text-decoration: none; font-weight: 600; transition: color 0.2s; }
.login-link a:hover { color: var(--primary-dark); }
.error-msg { color: var(--danger); font-size: 0.84rem; margin-top: 12px; min-height: 20px; }

/* ===== HEADER ===== */
header {
    background: var(--card-bg);
    padding: 14px 24px;
    position: relative;
    z-index: 100;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.header-top h1 {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-info { display: flex; align-items: center; gap: 10px; }

.user-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.73rem;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.btn-logout {
    background: transparent;
    color: var(--text-muted);
    border: 1.5px solid var(--border);
    padding: 5px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-logout:hover { background: var(--danger); color: white; border-color: var(--danger); }

nav { display: flex; gap: 3px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
nav::-webkit-scrollbar { display: none; }

.nav-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s;
    position: relative;
    flex-shrink: 0;
}

.nav-btn:hover { background: var(--bg); color: var(--text); }

.nav-btn.active {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(79,70,229,0.3);
}

/* ===== MAIN ===== */
main { padding: 24px; max-width: 1000px; margin: 0 auto; }

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.35s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== STATS ===== */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: all 0.2s;
    border: 1px solid var(--border);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-card .stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-header h2 {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.3px;
}

/* ===== BUTTONS ===== */
.btn-primary {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    color: white;
    border: none;
    padding: 11px 24px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.86rem;
    font-weight: 600;
    transition: all 0.25s;
    box-shadow: 0 2px 10px rgba(79,70,229,0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(79,70,229,0.35);
}

.btn-primary:active { transform: translateY(0); }

.btn-sm {
    padding: 8px 14px;
    font-size: 0.76rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    min-height: 36px;
    touch-action: manipulation;
}

.btn-edit { background: var(--warning-light); color: #92400e; }
.btn-edit:hover { background: #fde68a; transform: translateY(-1px); }
.btn-delete { background: var(--danger-light); color: #991b1b; }
.btn-delete:hover { background: #fecaca; transform: translateY(-1px); }

/* ===== SEARCH & FILTER ===== */
.search-bar, .filter-bar { margin-bottom: 20px; }

.search-bar input, .filter-bar select, .filter-bar input[type="date"], .filter-bar input[type="text"] {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 14px;
    font-size: 0.9rem;
    background: var(--card-bg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: all 0.2s;
    outline: none;
    color: var(--text);
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--border, #e2e8f0);
}

.filter-bar input[type="date"] {
    min-height: 48px;
    padding: 12px 14px;
    font-family: inherit;
}

.filter-bar input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 0.6;
    cursor: pointer;
}

body.dark .filter-bar input[type="date"] {
    color-scheme: dark;
}

body.dark .filter-bar input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.7;
}

.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-bar select {
    flex: 1;
    min-width: 180px;
}

.filter-bar input[type="date"] {
    flex: 0 1 160px;
    min-width: 140px;
}

.search-bar input:focus, .filter-bar select:focus, .filter-bar input[type="date"]:focus, .filter-bar input[type="text"]:focus {
    box-shadow: 0 3px 12px rgba(79,70,229,0.15);
    border-color: #4f46e5;
}

/* ===== CARDS ===== */
.card-list { display: flex; flex-direction: column; gap: 12px; }

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    transition: all 0.25s;
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
}

.card:hover { box-shadow: var(--shadow-md); transform: translateX(4px); }
.card h4 { margin-bottom: 6px; font-size: 0.95rem; font-weight: 700; color: var(--text); }
.card p { font-size: 0.82rem; color: var(--text-light); margin-bottom: 3px; line-height: 1.6; }
.card-actions { display: flex; gap: 8px; margin-top: 12px; }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.status-Pendente { background: var(--warning-light); color: #92400e; }
.status-EmAndamento { background: var(--primary-light); color: var(--primary-dark); }
.status-Concluido { background: var(--success-light); color: #065f46; }

/* ===== REPORTS ===== */
.report-section { display: grid; grid-template-columns: 1fr; gap: 16px; }

.report-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.report-card:hover { box-shadow: var(--shadow-md); }
.report-card h3 { margin-bottom: 16px; font-size: 1rem; font-weight: 700; }

.report-card select, .report-card input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s;
}

.report-card select:focus, .report-card input:focus { border-color: var(--primary); }

.report-card label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 4px;
    font-weight: 600;
}

.report-card p { font-size: 0.82rem; color: var(--text-muted); }

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(15,23,42,0.5);
    backdrop-filter: blur(6px);
    z-index: 200;
    justify-content: center;
    align-items: flex-end;
}

.modal.active { display: flex; }

.modal-content {
    background: var(--card-bg);
    width: 100%;
    max-width: 480px;
    border-radius: 24px 24px 0 0;
    padding: 28px 20px;
    max-height: 92vh;
    overflow-y: auto;
    animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-overflow-scrolling: touch;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0.5; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h3 { font-size: 1.15rem; font-weight: 800; }

.close-btn {
    background: var(--bg);
    border: none;
    width: 36px; height: 36px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-btn:hover { background: var(--danger-light); color: var(--danger); }

form input, form select, form textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
    color: var(--text);
    background: var(--card-bg);
}

form input:focus, form select:focus, form textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

form input::placeholder, form textarea::placeholder { color: var(--text-muted); }
form textarea { resize: vertical; min-height: 70px; }
form .btn-primary { width: 100%; padding: 14px; font-size: 0.95rem; margin-top: 4px; }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state span { font-size: 3rem; display: block; margin-bottom: 12px; opacity: 0.6; }
.empty-state p { font-size: 0.9rem; }

/* ===== TRIAL BANNER ===== */
.trial-banner {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #fbbf24;
    border-radius: var(--radius);
    padding: 12px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 0.86rem;
    color: #92400e;
    font-weight: 500;
}

.trial-banner.expired {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    border-color: #f87171;
    color: #991b1b;
}

.btn-upgrade {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(245,158,11,0.3);
}

.btn-upgrade:hover { transform: translateY(-1px); }
.trial-banner.expired .btn-upgrade { background: linear-gradient(135deg, #ef4444, #dc2626); }

/* ===== PLANO BADGE HEADER ===== */
.plano-badge-header {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.plano-badge-header.trial { background: var(--warning-light); color: #92400e; }
.plano-badge-header.basico { background: var(--primary-light); color: var(--primary-dark); }
.plano-badge-header.profissional { background: var(--success-light); color: #065f46; }
.plano-badge-header.premium { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; }

/* ===== PLANOS ===== */
.planos-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }

.plano-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 36px 28px;
    box-shadow: var(--shadow);
    text-align: center;
    position: relative;
    border: 2px solid var(--border);
    transition: all 0.3s;
}

.plano-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); }

.plano-destaque {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary), var(--shadow-md);
    background: linear-gradient(180deg, #fafafe 0%, #eef2ff 100%);
}

.plano-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    color: white;
    padding: 5px 18px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(79,70,229,0.3);
}

.plano-destaque .plano-badge { background: linear-gradient(135deg, #f59e0b, #d97706); }

.plano-card h3 { font-size: 1.3rem; margin: 16px 0 8px; font-weight: 800; }

.plano-preco {
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 24px;
}

.plano-preco span { font-size: 0.9rem; font-weight: 500; -webkit-text-fill-color: var(--text-muted); }

.plano-card ul { list-style: none; margin-bottom: 28px; text-align: left; padding: 0; }

.plano-card li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.86rem;
    color: var(--text);
}

.plano-card li:last-child { border-bottom: none; }
.plano-card .btn-primary { width: 100%; }

/* ===== CONFIG ===== */
.config-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }

.config-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.config-card h3 { margin-bottom: 20px; font-size: 1.05rem; font-weight: 700; }

.config-card label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 4px;
    margin-top: 10px;
}

.config-card label:first-of-type { margin-top: 0; }

.plano-info { display: flex; flex-direction: column; gap: 12px; }
.plano-info-row { display: flex; justify-content: space-between; align-items: center; }
.plano-info-label { font-size: 0.86rem; color: var(--text-light); }
.plano-info-value { font-size: 0.86rem; font-weight: 700; color: var(--text); }
.plano-info-value.ativo { color: var(--success); }
.plano-info-value.expirado { color: var(--danger); }

/* ===== RESPONSIVE ===== */
@media (min-width: 600px) {
    .modal { align-items: center; }
    .modal-content { border-radius: 24px; }
    .report-section { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 768px) {
    .stats-bar { grid-template-columns: repeat(4, 1fr); }
    .planos-grid { grid-template-columns: repeat(3, 1fr); }
    .config-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== MOBILE NAV BOTTOM BAR ===== */
@media (max-width: 599px) {
    header { padding: 10px 16px; }
    .header-top { margin-bottom: 0; }
    .header-top h1 { font-size: 1rem; }
    
    header nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--card-bg);
        border-top: 1px solid var(--border);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
        display: flex;
        justify-content: space-around;
        gap: 0;
        padding: 8px 2px;
        z-index: 100;
        overflow-x: hidden;
        flex-wrap: nowrap;
    }

    header nav .nav-btn {
        flex-direction: column;
        padding: 4px 2px;
        font-size: 1.4rem;
        border-radius: 8px;
        min-width: 0;
        flex: 1;
        text-align: center;
        line-height: 1;
    }

    header nav .nav-btn::after {
        font-size: 0.5rem;
        display: block;
        margin-top: 2px;
    }

    header nav .nav-btn[data-page="dashboard"]::after { content: "Painel"; }
    header nav .nav-btn[data-page="clientes"]::after { content: "Clientes"; }
    header nav .nav-btn[data-page="veiculos"]::after { content: "Veículos"; }
    header nav .nav-btn[data-page="servicos"]::after { content: "OS"; }
    header nav .nav-btn[data-page="orcamentos"]::after { content: "Orçam."; }
    header nav .nav-btn[data-page="agendamentos"]::after { content: "Agenda"; }
    header nav .nav-btn[data-page="relatorios"]::after { content: "PDF"; }
    header nav .nav-btn[data-page="config"]::after { content: "Config"; }

    header nav .nav-btn.active {
        background: var(--primary-light);
        color: var(--primary);
        box-shadow: none;
    }

    main { padding: 16px; padding-bottom: 80px; }

    /* Botões de ação nos cards: maiores e mais tocáveis no mobile */
    .card-actions {
        gap: 6px;
    }

    .card-actions .btn-sm {
        padding: 10px 12px;
        font-size: 0.74rem;
        min-height: 40px;
        flex: 1 1 auto;
    }

    /* Cards de OS e Orçamento: texto menor */
    .card p {
        font-size: 0.78rem;
    }

    /* Relatórios: botões full width */
    .report-card .btn-primary {
        width: 100%;
        padding: 14px;
    }
}

/* ===== FIX SCROLL MOBILE ===== */
html, body {
    overflow-y: auto !important;
    height: auto !important;
    -webkit-overflow-scrolling: touch;
}

#app-container {
    min-height: 100vh;
    height: auto !important;
    overflow: visible !important;
}

.page {
    overflow: visible !important;
}

main {
    overflow: visible !important;
}

@media (max-width: 599px) {
    main {
        padding-bottom: 90px !important;
    }
}

/* ===== FIX CARD OVERFLOW ===== */
.card {
    overflow: hidden;
    word-break: break-word;
}

.card-actions {
    flex-wrap: wrap;
    gap: 6px;
}

.status-badge {
    flex-shrink: 0;
}

/* ===== WHATSAPP FLOAT ===== */
.whatsapp-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: #25d366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(37,211,102,0.4);
    z-index: 150;
    transition: all 0.3s;
    animation: whatsappPulse 2s infinite;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(37,211,102,0.5);
}

@keyframes whatsappPulse {
    0%, 100% { box-shadow: 0 4px 16px rgba(37,211,102,0.4); }
    50% { box-shadow: 0 4px 24px rgba(37,211,102,0.6); }
}

@media (max-width: 599px) {
    .whatsapp-float {
        bottom: 74px;
        right: 16px;
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
}

/* ===== ORCAMENTO ITENS ===== */
.orc-item-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.orc-item-row .orc-desc { flex: 3; }
.orc-item-row .orc-val { flex: 1; min-width: 80px; }
.orc-item-row .orc-tipo { flex: 1; min-width: 90px; font-size: 0.78rem; padding: 8px; }

/* Desktop: mostrar labels nos botões */
@media (min-width: 600px) {
    .nav-btn[data-page="dashboard"]::after { content: " Painel"; }
    .nav-btn[data-page="clientes"]::after { content: " Clientes"; }
    .nav-btn[data-page="veiculos"]::after { content: " Veículos"; }
    .nav-btn[data-page="servicos"]::after { content: " OS"; }
    .nav-btn[data-page="orcamentos"]::after { content: " Orçamentos"; }
    .nav-btn[data-page="agendamentos"]::after { content: " Agenda"; }
    .nav-btn[data-page="relatorios"]::after { content: " Relatórios"; }
    .nav-btn[data-page="config"]::after { content: " Config"; }
    .nav-btn::after { font-size: inherit !important; display: inline !important; margin-top: 0 !important; }
}

/* ===== CHARTS ===== */
#chart-status, #chart-faturamento {
    max-height: 220px;
}

@media (max-width: 599px) {
    .stat-card canvas {
        max-height: 180px;
    }
}

/* ===== DARK MODE ===== */

body.dark header {
    background: #1e293b;
    border-bottom-color: #334155;
}

body.dark .stat-card {
    border-color: #334155;
}

body.dark .nav-btn.active {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
}

body.dark .btn-primary {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
}

body.dark .modal-content {
    background: #1e293b;
}

body.dark .close-btn {
    background: #334155;
    color: #94a3b8;
}

body.dark form input,
body.dark form select,
body.dark form textarea {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

body.dark .search-bar input,
body.dark .filter-bar select,
body.dark .filter-bar input[type="date"],
body.dark .filter-bar input[type="text"] {
    background: #1e293b;
    border: none;
    color: #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

body.dark .plano-card {
    background: #1e293b;
    border-color: #334155;
}

body.dark .plano-destaque {
    border-color: #6366f1;
    background: linear-gradient(180deg, #1e293b 0%, #1e1b4b 100%);
}

body.dark .config-card {
    background: #1e293b;
    border-color: #334155;
}

body.dark .report-card {
    background: #1e293b;
    border-color: #334155;
}

body.dark .report-card select,
body.dark .report-card input {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

body.dark .trial-banner {
    background: linear-gradient(135deg, #422006, #78350f);
    border-color: #92400e;
    color: #fbbf24;
}

body.dark .trial-banner.expired {
    background: linear-gradient(135deg, #450a0a, #7f1d1d);
    border-color: #991b1b;
    color: #fca5a5;
}

body.dark .user-badge {
    background: #312e81;
    color: #a5b4fc;
}

body.dark .btn-logout {
    border-color: #475569;
    color: #94a3b8;
}

body.dark .orc-item-row input {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

/* Toggle button */
.theme-toggle {
    background: none;
    border: 1.5px solid var(--border);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.theme-toggle:hover {
    background: var(--primary-light);
}

/* ===== THEME TOGGLE ===== */
.btn-theme {
    background: transparent;
    border: 1.5px solid var(--border);
    width: 34px; height: 34px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.btn-theme:hover { background: var(--bg); }

/* ===== HISTÓRICO / TIMELINE ===== */
.historico-veiculo-info {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.historico-veiculo-info h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.historico-veiculo-info p {
    font-size: 0.86rem;
    color: var(--text-light);
}

.historico-resumo {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.historico-stat {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 14px 10px;
    text-align: center;
    border: 1px solid var(--border);
}

.historico-stat-value {
    font-size: 1rem;
    font-weight: 800;
    color: var(--primary);
    word-break: break-word;
}

.historico-stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-top: 4px;
}

.historico-timeline {
    position: relative;
    padding-left: 24px;
}

.historico-timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-entry {
    position: relative;
    margin-bottom: 20px;
}

.timeline-entry:last-child {
    margin-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -20px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--card-bg);
    box-shadow: 0 0 0 2px var(--primary);
    z-index: 1;
}

.timeline-content {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    border: 1px solid var(--border);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 4px;
}

.timeline-header strong {
    font-size: 0.88rem;
    color: var(--text);
}

.timeline-date {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.timeline-desc {
    font-size: 0.86rem;
    color: var(--text-light);
    margin-bottom: 8px;
}

.timeline-details {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-light);
}

.timeline-obs {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
    font-style: italic;
}

@media (max-width: 599px) {
    .historico-resumo {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .historico-stat {
        padding: 8px;
    }

    .historico-stat-value {
        font-size: 0.85rem;
    }

    .historico-stat-label {
        font-size: 0.6rem;
    }

    .historico-veiculo-info h3 {
        font-size: 0.92rem;
    }

    .historico-veiculo-info p {
        font-size: 0.8rem;
    }

    .timeline-content {
        padding: 12px !important;
    }

    .timeline-header {
        flex-direction: column;
        gap: 2px;
    }

    .timeline-details {
        flex-wrap: wrap;
        gap: 6px !important;
    }

    /* Modal de histórico: tela cheia no mobile */
    #modal-historico .modal-content {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
    }

    /* Quick client form: ajustar grids no mobile */
    #quick-client-form-servico div[style*="1fr 1fr 1fr"],
    #quick-client-form div[style*="1fr 1fr 1fr"] {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Modais gerais: mais espaço no mobile */
    .modal-content {
        padding: 20px 16px !important;
        max-height: 95vh !important;
    }

    .modal-header h3 {
        font-size: 0.95rem;
    }

    /* Modal Pix: QR Code menor no mobile */
    #modal-pix .modal-content {
        max-width: 100% !important;
    }

    #modal-pix img {
        width: 160px !important;
        height: 160px !important;
    }

    /* Planos: cards mais compactos */
    .plano-card {
        padding: 20px 16px;
    }

    .plano-preco {
        font-size: 2.2rem;
    }

    .plano-card li {
        font-size: 0.82rem;
        padding: 8px 0;
    }

    /* Config: cards responsivos */
    .config-card {
        padding: 16px !important;
    }

    .config-card h3 {
        font-size: 0.95rem;
    }

    /* Formulários: inputs maiores pra toque */
    input, select, textarea {
        min-height: 44px;
        font-size: 16px !important; /* Previne zoom no iOS */
    }

    /* Page header: título e botão empilham */
    .page-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start !important;
    }

    .page-header .btn-primary {
        width: 100%;
    }

    /* Search bar full width */
    .search-bar input {
        font-size: 16px !important;
    }

    /* Filter bar: full width */
    .filter-bar {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }
    .filter-bar select {
        width: 100%;
        min-height: 48px;
        flex: 1 1 100%;
        font-size: 16px;
    }
    .filter-bar input[type="date"] {
        flex: 1 1 calc(50% - 4px);
        min-height: 48px;
        font-size: 16px;
        min-width: 0;
    }
}

/* ===== DARK MODE ===== */
body.dark {
    --primary: #818cf8;
    --primary-dark: #6366f1;
    --primary-light: #1e1b4b;
    --primary-glow: rgba(129,140,248,0.15);
    --accent: #22d3ee;
    --bg: #0f172a;
    --card-bg: #1e293b;
    --text: #e2e8f0;
    --text-light: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --success: #34d399;
    --success-light: #064e3b;
    --warning: #fbbf24;
    --warning-light: #451a03;
    --danger: #f87171;
    --danger-light: #450a0a;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.4);
}

body.dark header { background: #1e293b; border-color: #334155; }
body.dark .nav-btn.active { background: linear-gradient(135deg, #818cf8, #6366f1); }
body.dark .stat-card { background: #1e293b; border-color: #334155; }
body.dark .card { background: #1e293b; border-color: #334155; }
body.dark .modal-content { background: #1e293b; }
body.dark .close-btn { background: #334155; }
body.dark .close-btn:hover { background: #450a0a; }
body.dark form input, body.dark form select, body.dark form textarea { background: #0f172a; border-color: #334155; color: #e2e8f0; }
body.dark .search-bar input, body.dark .filter-bar select, body.dark .filter-bar input[type="date"] { background: #1e293b; border: none; color: #e2e8f0; }
body.dark .config-card { background: #1e293b; border-color: #334155; }
body.dark .report-card { background: #1e293b; border-color: #334155; }
body.dark .report-card select, body.dark .report-card input { background: #0f172a; border-color: #334155; color: #e2e8f0; }
body.dark .plano-card { background: #1e293b; border-color: #334155; }
body.dark .plano-destaque { border-color: #818cf8; }
body.dark .trial-banner { background: linear-gradient(135deg, #451a03, #78350f); border-color: #92400e; }
body.dark .trial-banner.expired { background: linear-gradient(135deg, #450a0a, #7f1d1d); border-color: #dc2626; }
body.dark .btn-theme { border-color: #475569; }
body.dark .login-container { background: rgba(30,41,59,0.97); }
body.dark .login-container h1 { background: linear-gradient(135deg, #818cf8, #22d3ee); -webkit-background-clip: text; }
body.dark .login-subtitle { color: #94a3b8; }
body.dark .header-top h1 { background: linear-gradient(135deg, #818cf8, #22d3ee); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

@media (max-width: 599px) {
    body.dark header nav { background: #1e293b; border-color: #334155; }
    body.dark header nav .nav-btn.active { background: #818cf8; }
}

/* ===== DASHBOARD FINANCEIRO ===== */

/* Quick Stats Row */
.dash-quick-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.quick-stat {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: all 0.2s;
}

.quick-stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.quick-icon {
    font-size: 1.3rem;
}

.quick-val {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary);
}

.quick-lbl {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.qs-pendente .quick-val {
    color: #f59e0b;
}

.kpi-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.dashboard-section-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: -10px;
    margin-bottom: 14px;
}

@media (max-width: 599px) {
    .dash-quick-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .quick-val { font-size: 1.1rem; }
}

body.dark .quick-stat { background: #1e293b; border-color: #334155; }
body.dark .quick-val { color: #818cf8; }
body.dark .qs-pendente .quick-val { color: #fbbf24; }

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 22px 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 6px;
    word-break: break-word;
}

.kpi-variation {
    font-size: 0.78rem;
    font-weight: 600;
    min-height: 20px;
}

.kpi-variation.variation-positive {
    color: #10b981;
}

.kpi-variation.variation-negative {
    color: #ef4444;
}

.dashboard-empty-msg {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.dashboard-chart-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}

.dashboard-section-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text);
}

.dashboard-chart-container {
    height: 280px;
}

.dashboard-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.dashboard-list-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.dashboard-ranked-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ranked-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.ranked-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.ranked-position {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.ranked-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ranked-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranked-detail {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.ranked-empty {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 0.86rem;
}

/* Dashboard responsive */
@media (max-width: 599px) {
    .kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .kpi-card {
        padding: 14px;
    }

    .kpi-label {
        font-size: 0.72rem;
    }

    .kpi-value {
        font-size: 1.1rem;
    }

    .kpi-hint {
        font-size: 0.65rem;
    }

    .dashboard-two-col {
        grid-template-columns: 1fr;
    }

    #dash-pendentes-section .pendentes-grid {
        grid-template-columns: 1fr !important;
    }

    .dashboard-chart-container {
        height: 200px;
    }

    .dashboard-chart-card {
        padding: 14px;
    }

    .dashboard-section-title {
        font-size: 0.88rem;
    }

    .dashboard-list-card {
        padding: 14px;
    }

    .ranked-item {
        padding: 8px 10px;
        font-size: 0.78rem;
    }
}

@media (min-width: 600px) and (max-width: 767px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-two-col {
        grid-template-columns: 1fr;
    }
}

/* Dashboard dark mode */
body.dark .kpi-card { background: #1e293b; border-color: #334155; }
body.dark .kpi-value { background: linear-gradient(135deg, #818cf8, #22d3ee); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
body.dark .dashboard-chart-card { background: #1e293b; border-color: #334155; }
body.dark .dashboard-list-card { background: #1e293b; border-color: #334155; }
body.dark .dashboard-empty-msg { background: #1e293b; border-color: #334155; }
body.dark .ranked-item { background: #0f172a; border-color: #334155; }
body.dark .ranked-position { background: linear-gradient(135deg, #818cf8, #6366f1); }

/* ===== TOAST NOTIFICATIONS ===== */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    padding: 14px 22px;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 0.88rem;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
    max-width: 360px;
    word-break: break-word;
}

.toast.toast-show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    background: #10b981;
}

.toast-warning {
    background: #f59e0b;
}

@media (max-width: 599px) {
    #toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
    }

    .toast {
        max-width: 100%;
    }
}

/* ===== WHATSAPP AUTO TOGGLE SWITCH ===== */
.whatsapp-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.whatsapp-toggle-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #cbd5e1;
    border-radius: 26px;
    transition: background 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: #10b981;
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

body.dark .toggle-slider {
    background: #475569;
}

body.dark .toggle-switch input:checked + .toggle-slider {
    background: #34d399;
}

/* ===== AGENDAMENTO CONFIG ROWS ===== */
.agend-dia-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
    flex-wrap: wrap;
}

@media (max-width: 480px) {
    .agend-dia-row {
        gap: 6px;
    }
    .agend-dia-row span[style*="min-width"] {
        min-width: 60px !important;
        font-size: 0.8rem !important;
    }
    .agend-dia-row input[type="time"] {
        width: 90px;
    }
}

/* ===== FOTOS GRID ===== */
.fotos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}
.foto-thumb {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.foto-thumb img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}
.foto-thumb .foto-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(239,68,68,0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.foto-thumb .foto-legenda {
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 4px 6px;
    text-align: center;
    background: var(--bg);
}
