:root {
    --bg-color: #f4f7f6;
    --surface-color: #ffffff;
    --primary-color: #000000;
    --text-main: #1d1d1f;
    --text-muted: #86868b;
    --border-color: #e5e5ea;
    --accent-color: #f5f5f7;
    --highlight-color: #0071e3;
    --brand-color: #004a8c;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow: hidden; 
}

/* =========================================
   1. LAYOUT PRINCIPAL (PC / Tablet)
   ========================================= */
.dashboard-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* =========================================
   2. SIDEBAR (Lateral Esquerda)
   ========================================= */
.sidebar {
    width: 320px;
    min-width: 320px;
    background-color: var(--surface-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 20px;
    z-index: 10;
    overflow-y: auto; 
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

/* Título Principal Adicionado */
.main-title-section {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.main-title-section h1 {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.4;
}

/* Branding J. Simões */
.brand-section {
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.company-logo {
    max-width: 150px;
    height: auto;
    margin-bottom: 12px;
}

.slogan-highlight {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
    font-style: italic;
}

.quality-policy {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 12px;
    padding: 0 10px;
}

.company-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    color: var(--highlight-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.company-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Perfil (Sem Avatar) */
.profile-section {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
    text-align: center;
}

.info h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
}

/* KPIs */
.kpi-container {
    margin-bottom: 32px;
}

.kpi-container h3 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-align: center;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.kpi-card {
    background: var(--accent-color);
    padding: 12px;
    border-radius: 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.kpi-card i {
    font-size: 20px;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.kpi-value {
    font-size: 14px;
    font-weight: 700;
}

.kpi-label {
    font-size: 10px;
    color: var(--text-muted);
}

/* Navegação de Dias */
.days-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.day-tab {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 14px 16px;
    border-radius: 12px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}

.day-tab .day-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 500;
}

.day-tab .day-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.day-tab:hover {
    background: var(--accent-color);
}

.day-tab.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.day-tab.active .day-subtitle,
.day-tab.active .day-title {
    color: #ffffff;
}

/* Rodapé Desenvolvedor (Atualizado) */
.developer-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px dashed var(--border-color);
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
}

.developer-footer p {
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.developer-footer strong {
    color: var(--text-main);
}

.developer-footer .dev-email {
    color: var(--highlight-color);
    margin-bottom: 12px;
}

.developer-footer a {
    color: inherit;
    text-decoration: underline;
    transition: color 0.2s;
}

.developer-footer a:hover {
    color: var(--highlight-color);
}

/* =========================================
   3. ÁREA CENTRAL (Linha do Tempo)
   ========================================= */
.content-area {
    flex: 1;
    background-color: var(--bg-color);
    padding: 32px;
    overflow-y: auto;
    position: relative;
}

.mobile-header {
    display: none;
}

.timeline-container {
    max-width: 600px;
    margin: 0 auto;
}

/* Cartões da Rota */
.route-card {
    background: var(--surface-color);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid transparent;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
}

.route-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.route-card.selected-route {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
}

.route-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.time {
    font-size: 16px;
    font-weight: 700;
}

.badge {
    background: var(--accent-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* Design da Rota Interna */
.location-row {
    display: flex;
    gap: 16px;
}

.line-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 6px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
    border: 2px solid var(--surface-color);
    box-shadow: 0 0 0 2px var(--text-muted);
}

.dot.destination {
    background: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-color);
}

.line {
    width: 2px;
    height: 40px;
    background: var(--border-color);
    margin: 4px 0;
}

.location-info h3 {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.location-info p {
    font-size: 15px;
    font-weight: 500;
}

.location-group {
    margin-bottom: 16px;
}

/* Opções de Almoço */
.lunch-options {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px dashed var(--border-color);
}

.lunch-options h4 {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lunch-option {
    background: var(--accent-color);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lunch-option.recommended {
    background: #e8f5e9;
    border-left: 4px solid #4caf50;
}

.lunch-option .distance {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

/* Botões de Ação do Cartão */
.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 20px;
}

.btn-card-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: opacity 0.2s;
}

.btn-card-action:hover {
    opacity: 0.8;
}

.btn-maps {
    background: #e8f0fe;
    color: #1a73e8;
}

.btn-calendar {
    background: #fce8e6;
    color: #d93025;
}

/* =========================================
   4. MAPA (Lateral Direita)
   ========================================= */
.map-area {
    width: 450px;
    min-width: 450px;
    background: var(--surface-color);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 20;
}

.mobile-only {
    display: none;
}

#map {
    flex: 1;
    width: 100%;
    background-color: #e5e5ea;
    z-index: 1;
}

.map-footer {
    padding: 20px;
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    z-index: 2;
}

.route-info-box {
    background: var(--accent-color);
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    width: 100%;
    background: var(--primary-color);
    color: var(--surface-color);
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #333333;
}

.btn-primary:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

.leaflet-routing-container {
    display: none !important;
}

/* =========================================
   5. RESPONSIVO (Mobile e Tablet)
   ========================================= */
@media (max-width: 1024px) {
    .dashboard-layout {
        flex-direction: column;
        overflow-y: auto;
    }

    .sidebar {
        width: 100%;
        min-width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 16px;
        overflow-y: visible;
    }

    .brand-section {
        padding-top: 10px;
    }

    .days-nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 8px;
    }

    .day-tab {
        flex: 1;
        min-width: 140px;
    }

    .content-area {
        overflow-y: visible;
        padding: 16px;
        padding-bottom: 100px;
    }

    .mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 24px;
    }

    .mobile-header h1 {
        font-size: 20px;
    }

    .btn-mobile-map {
        background: var(--accent-color);
        border: none;
        padding: 8px 16px;
        border-radius: 20px;
        font-weight: 600;
        font-size: 13px;
        display: flex;
        align-items: center;
        gap: 6px;
        cursor: pointer;
    }

    .map-area {
        position: fixed;
        top: 100%;
        left: 0;
        width: 100%;
        height: 100vh;
        min-width: 100%;
        border-left: none;
        transition: top 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        z-index: 9999;
    }

    .map-area.open {
        top: 0;
    }

    .mobile-only {
        display: flex;
    }

    .map-header {
        justify-content: space-between;
        align-items: center;
        padding: 16px 20px;
        background: var(--surface-color);
        border-bottom: 1px solid var(--border-color);
    }

    .map-header h2 {
        font-size: 18px;
    }

    .btn-close {
        background: var(--accent-color);
        border: none;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        cursor: pointer;
    }
}