/* =========================================
   Ficheiro: css/style.css
   Projeto: Fenix Drive 
   ========================================= */

/* =========================================
   VARIÁVEIS GLOBAIS
   ========================================= */
:root { 
    --primary: #1a1a1a; 
    --accent-dark-bg: #F39C12;
    --accent-light-bg: #FF8400;
    --accent-light-grey: #C0C0C0;
    --bg: #f4f7f6;
    --sidebar-width: 240px; 
}

/* =========================================
   RESET E ESTILOS GLOBAIS
   ========================================= */
* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: 'Segoe UI', sans-serif; 
}

body, html { 
    background-color: var(--bg); 
    color: #333; 
    display: flex; 
    min-height: 100vh; 
    width: 100%; /* Força a página a ocupar 100% da largura */
    margin: 0;
    padding: 0;
    overflow-x: hidden !important; 
    overflow-y: auto;
}

.page-body { 
    padding: 90px 40px 40px 40px; /* Mantenha o padding que ajustámos para o header fixo */
    flex: 1; 
    
    /* A MAGIA ANTI-SCROLL: */
    min-width: 0; 
    max-width: 100%;
}

/* Utilitários Genéricos */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-muted { color: #888; }
.text-accent { color: var(--accent-light-bg) !important; }
.text-accent-dark { color: var(--accent-dark-bg) !important; }
.u-full-width { width: 100%; }
.margin-t-10 { margin-top: 10px; }
.margin-b-20 { margin-bottom: 20px; }
.font-light { font-weight: 400; }
.font-normal { font-weight: 400; }
.text-base { font-size: 16px; }
.flex-align-center { display: flex; align-items: center; gap: 8px; }
.icon-sm { width: 16px; height: 16px; object-fit: contain; }
.bg-transparent { background: transparent !important; border: none !important; }

/* Mensagens de Carregamento e Erro */
.loader-container { text-align: center; padding-top: 50px; color: #888; }
.error-container { text-align: center; padding: 20px; }
.error-icon { font-size: 48px; color: #ccc; }
.error-text { margin-top: 15px; color: #666; }

/* =========================================
   VISIBILIDADE (DESKTOP VS MOBILE)
   ========================================= */
.mobile-only { display: none !important; }
.desktop-only { display: flex; align-items: center; }
.desktop-icon { display: inline-block !important; }
.mobile-icon { display: none !important; }

/* =========================================
   LAYOUT: SIDEBAR E HEADER
   ========================================= */
.sidebar { 
    width: var(--sidebar-width); 
    background: var(--primary); 
    color: white; 
    display: flex; 
    flex-direction: column; 
    position: fixed; 
    height: 100%; 
    z-index: 1000; 
}

.sidebar-header { padding: 25px 20px; border-bottom: 1px solid #333; text-align: center; }
.sidebar-header img { width: 100%; max-width: 160px; }
.menu-items { flex: 1; padding: 20px 0; overflow-y: auto; }

.menu-btn { 
    width: 100%; border: none; background: none; color: #888; 
    padding: 15px 25px; text-align: left; cursor: pointer; 
    display: flex; align-items: center; gap: 12px; transition: 0.3s; font-size: 15px; 
}
.menu-btn i { width: 20px; text-align: center; }
.menu-btn:hover { color: var(--accent-dark-bg); background: rgba(255,255,255,0.05); }
.menu-btn.active { color: white; background: var(--accent-dark-bg); }
.menu-btn.active .text-accent { color: white !important; }

/* Sidebar Extra Elements (Mobile Profiling) */
.sidebar-user-profile { padding: 15px 20px; text-align: center; color: #ccc; font-size: 14px; border-bottom: 1px solid #333; }
.mobile-menu-divider { border-bottom: 1px solid #333; margin-bottom: 10px; padding-bottom: 20px; color: white; cursor: default; }
.mobile-menu-footer { margin-top: 10px; border-top: 1px solid #333; padding-top: 20px; }

.main-content { 
    margin-left: var(--sidebar-width); 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    width: calc(100% - var(--sidebar-width)); 
    min-height: 100vh; /* Garante altura total */
}

header { 
    background: white; 
    padding: 15px 40px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.05); 
    z-index: 900; 
    
    /* AS REGRAS DO FIXED CORRIGIDAS */
    position: fixed;
    top: 0;
    right: 0; /* Cola-o à direita do ecrã */
    width: calc(100% - var(--sidebar-width)); /* A largura é 100% MENOS o menu lateral */
}

.breadcrumb { color: #888; font-size: 14px; display: flex; align-items: center; gap: 8px; text-transform: lowercase; }
.breadcrumb i.fa-chevron-right { font-size: 10px; margin: 0 5px; color: #ccc; }
.breadcrumb span { font-weight: 400; color: #333; }

.user-profile { display: flex; align-items: center; gap: 10px; color: #555; font-size: 14px; }

/* Botões de Controlo do Menu (Hamburger/Close) */
.hamburger-btn, .close-menu-btn { background: none; border: none; font-size: 26px; cursor: pointer; color: var(--accent-light-bg); }
.close-menu-btn { color: var(--accent-dark-bg); font-size: 32px; }

/* =========================================
   BOTÕES GERAIS
   ========================================= */
.btn-logout-top { background: none; border: 1px solid #ddd; padding: 8px 15px; border-radius: 6px; cursor: pointer; transition: 0.2s; margin-left: 15px; font-size: 13px; color: #666; }
.btn-logout-top:hover { background: #f9f9f9; border-color: #ccc; color: #333; }

.btn-save { background: var(--accent-light-bg); color: white; border: none; padding: 12px 20px; border-radius: 6px; cursor: pointer; width: 100%; font-weight: bold; transition: 0.3s; }
.btn-save:hover { background: #e67600; }

.btn-danger-solid { background: #e74c3c; color: white; border: none; padding: 12px 20px; border-radius: 6px; cursor: pointer; width: 100%; font-weight: bold; }

button.btn-cancel, .btn-cancel { width: 100% !important; margin: 10px 0 0 0 !important; display: block !important; }

.btn-new-item { color: var(--accent-light-bg) !important; border-color: var(--accent-light-bg) !important; }

.btn-action { color: var(--accent-light-bg); background: none; border: none; cursor: pointer; font-size: 16px; transition: 0.2s; padding: 5px; }
.btn-action:hover { opacity: 0.7; }

/* =========================================
   ESTILOS DE TABELAS (LISTAGENS GERAIS)
   ========================================= */
.card { 
    background: white; 
    padding: 30px; 
    border-radius: 12px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); 
    
    /* BLOQUEIO DE LARGURA: */
    max-width: 100%; 
    overflow: hidden; /* Corta qualquer micro-ponta que tente sair do cartão */
}
.header-flex { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0px; }
.header-flex h3 { font-weight: 400; }
.header-flex-left { margin-bottom: 20px !important }
.table-container { 
    max-width: 100%;
    overflow-x: auto; 
    overflow-y: hidden;
    /* Se tiver a barra a tocar muito no limite de baixo, pode usar um padding-bottom: 5px; aqui */
}
table { 
    width: 100%; 
    min-width: 350px; 
    border-collapse: collapse; 
    margin-top: 0px; 
    
    /* TRUQUE 2: Mantém a tabela restrita à largura do contentor */
    table-layout: auto; 
}

th, td { 
    font-weight: 400; 
    border-bottom: 1px solid #eee; 
    padding: 12px; 
    font-size: 14px; 
    
    /* A MAGIA AQUI: Proíbe terminantemente o texto de quebrar de linha */
    white-space: nowrap; 
}

th {
    font-weight: bold;
    color: #666;
    text-align: left;
}

.table-row-clickable { cursor: pointer; transition: background-color 0.2s; }
.table-row-clickable:hover { background-color: color-mix(in srgb, var(--accent-light-bg) 5%, transparent); }

.badge-category { background: #eee; color: #333; padding: 2px 8px; border-radius: 4px; font-size: 11px; }

/* Utilitários de Texto Responsivo em Tabelas */
.show-on-mobile { display: none; }
.toll-trip-header { cursor: pointer; background: #f8f9fa; }
.toll-trip-header:hover { background: #eef1f5; }
.toll-trip-row td { color: #666; font-size: 13px; }

/* =========================================
   FORMULÁRIOS E MODAIS
   ========================================= */
.modal { 
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    height: 100dvh; /* A MAGIA: Respeita a altura dinâmica com/sem teclado mobile */
    background: rgba(0,0,0,0.6); 
    z-index: 2000; 
    align-items: center; 
    justify-content: center; 
    overflow-y: auto; /* Permite scroll natural se o modal for mais alto que o ecrã */
}

.modal-content { 
    background: white; 
    padding: 30px; 
    border-radius: 12px; 
    width: 90%; /* Margem de segurança no mobile para não colar aos cantos */
    max-width: 450px; 
    margin: auto; /* Garante o centro absoluto em conjunto com o flexbox e overflow */
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2); 
}

.modal-title-icon { margin-right: 8px; color: var(--accent-light-bg); }

.modal-info-box { font-size: 14px; margin-bottom: 20px; background: #f9f9f9; padding: 15px; border-radius: 6px; color: #555; line-height: 1.6; }

.form-group { margin-bottom: 15px; }

.form-group label { 
    display: block; 
    margin-bottom: 5px; 
    font-size: 13px; 
    color: #666; 
}

.form-group input, 
.form-group select, 
.form-group textarea { 
    width: 100%; 
    padding: 10px; 
    border: 1px solid #ddd; 
    border-radius: 6px; 
    outline: none; 
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s;
    background-color: #fff;
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus { 
    border-color: var(--accent-light-bg); 
}

/* =========================================
   GRELHA DE CATEGORIAS (CHECKBOXES)
   ========================================= */
.categories-wrapper { 
    text-align: left; 
    margin-top: 10px; 
}

.categories-grid { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    column-gap: 15px; 
    row-gap: 10px; 
    background: #f9f9f9; 
    padding: 15px; 
    border-radius: 6px; 
    border: 1px solid #ddd; 
    max-height: 120px; 
    overflow-y: auto; 
}

.checkbox-label { 
    font-size: 13px; 
    font-weight: 400; 
    cursor: pointer; 
    display: flex; 
    flex-direction: row; 
    align-items: center; 
    justify-content: flex-start; 
    gap: 8px; 
    margin: 0; 
    color: #555;
}

.checkbox-label input[type="checkbox"] { 
    width: auto !important; 
    height: auto !important; 
    margin: 0 !important; 
    display: inline-block !important; 
    flex-shrink: 0; 
}

/* =========================================
   DESIGN MOBILE (APP NATIVA) - CORRIGIDO
   ========================================= */
@media (max-width: 768px) { 
    body, html {
        background: var(--bg); 
        overflow: hidden !important; /* Corta o scroll no root para evitar o efeito elástico no iOS */
        position: fixed; /* Evita que o teclado mobile desloque o layout de forma errada */
        width: 100%;
        height: 100%;
        height: 100dvh;
    }
    
    .main-content { 
        width: 100% !important; 
        margin-left: 0 !important; 
        background: transparent !important; 
        height: 100dvh !important; /* Ocupa exatamente o ecrã visível */
        overflow-y: auto !important; /* Permite o scroll interno */
        -webkit-overflow-scrolling: touch; 
    }

    .container { 
        display: block; /* Alterado de flex para block para evitar bugs de renderização */
        width: 100%; 
        height: 100vh; 
        border-radius: 0; 
        box-shadow: none;
        background: white;
        -webkit-transform: translateZ(0); /* Força aceleração de hardware */
        transform: translateZ(0);
    }

    .left-side { 
        display: none !important; 
    } 
    
    .right-side { 
        width: 100%;
        height: 100%;
        padding: 40px 30px; 
        display: flex; 
        flex-direction: column;
        justify-content: center;
        box-sizing: border-box;
        opacity: 1 !important;
        visibility: visible !important;
    }

    .logo-box {
        display: block;
        margin-bottom: 30px;
    }

    .logo-box img {
        max-width: 220px;
        height: auto;
        margin: 0 auto;
    }
    
    /* Garante que os inputs são visíveis e clicáveis */
    .input-group input {
        -webkit-appearance: none; /* Remove sombras internas do iOS */
        opacity: 1;
    }
}

/* =========================================
   GRELHAS DE FORMULÁRIO (2 COLUNAS)
   ========================================= */
.form-grid-2-col { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 15px; 
}

/* Responsividade para Formulários em Mobile */
@media (max-width: 768px) {
    .form-grid-2-col {
        grid-template-columns: 1fr; /* No telemóvel, volta a ser 1 coluna */
        gap: 0; /* O gap já não é necessário pois os .form-group têm margin-bottom */
    }
    table {
        min-width: 100% !important; /* Anula os 350px fixos */
    }
}

/* =========================================
   PÁGINA: RESUMO (DASHBOARD CARDS E CHARTS)
   ========================================= */
.summary-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 15px; }

.week-indicator { background-color: color-mix(in srgb, var(--accent-light-grey) 15%, transparent); color: var(--primary); padding: 8px 15px; border-radius: 20px; font-weight: 300; font-size: 14px; display: flex; align-items: center; gap: 8px; cursor: pointer; transition: background-color 0.2s, transform 0.1s; user-select: none; }
.week-indicator:hover { background-color: color-mix(in srgb, var(--accent-light-grey) 25%, transparent); }
.week-indicator:active { transform: scale(0.98); }

.dashboard-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-bottom: 30px; }
@media (max-width: 768px) { .dashboard-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; } .dash-card { padding: 14px; border-left: none !important; box-shadow: 0 2px 8px rgba(0,0,0,0.04); border-bottom: 3px solid #eee; } .dash-card-icon { width: auto; height: auto; min-width: auto; border-radius: 0; font-size: 18px; margin-right: 10px; padding: 0 15px; background: none !important; color: #666 !important; } .dash-card-info h4 { font-size: 11px; } .dash-card-info .value { font-size: 17px; } }

.dash-card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); border-left: 5px solid var(--accent-light-bg); display: flex; align-items: center; transition: transform 0.2s; }
.dash-card:hover { transform: translateY(-3px); }

.dash-card-icon { width: 60px; height: 60px; min-width: 60px; border-radius: 50%; background-color: color-mix(in srgb, var(--accent-light-bg) 10%, transparent); color: var(--accent-light-bg); display: flex; align-items: center; justify-content: center; font-size: 24px; margin-right: 20px; flex-shrink: 0; }

.dash-card-info h4 { margin: 0; font-size: 13px; color: #888; text-transform: uppercase; letter-spacing: 0.5px; }
.dash-card-info .value { margin: 5px 0 0 0; font-size: 28px; font-weight: 600; color: #2c3e50; }

.chart-container { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); height: 350px; width: 100%; display: flex; flex-direction: column; box-sizing: border-box; }
.chart-title { font-size: 16px; color: #2c3e50; margin-top: 0; margin-bottom: 15px; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.chart-wrapper { position: relative; flex-grow: 1; width: 100%; min-height: 0; }

/* =========================================
   RESPONSIVIDADE (SMARTPHONES ATÉ 768px)
   ========================================= */
@media (max-width: 768px) {
    .mobile-only { display: block !important; }
    .desktop-only { display: none !important; }
    .desktop-icon { display: none !important; }
    .mobile-icon { display: inline-block !important; }

    .sidebar {
        position: fixed !important; left: -100vw !important; top: 0 !important;
        width: 100vw !important; height: 100vh !important;
        background: rgba(26, 26, 26, 0.95) !important;
        z-index: 99999 !important; transition: left 0.3s ease-in-out !important;
        display: flex !important; flex-direction: column !important; margin: 0 !important;
    }
    .sidebar.open { left: 0 !important; }

    .sidebar-header { display: flex !important; justify-content: space-between !important; align-items: center !important; padding: 20px 25px !important; border-bottom: none !important; }
    .sidebar-header img { width: 210px !important; max-width: 100% !important; margin: 0 !important; }

    .menu-items { padding-left: 15px !important; padding-right: 15px !important; }
    .menu-btn { font-size: 18px !important; padding: 16px 20px !important; }
    .menu-btn i { font-size: 20px !important; }

    header { 
        display: flex !important; 
        justify-content: space-between !important; 
        align-items: center !important; 
        padding: 15px 20px !important; 
        width: 100% !important; /* Força os 100% no telemóvel */
        left: 0 !important; /* Garante que começa colado à esquerda */
    }

    .page-body { 
        padding: 80px 15px 80px 15px !important; /* Ajuste para não cortar conteúdo no fim da página */
    } 
    
    .card { padding: 15px; }
    .hide-on-mobile { display: none !important; }
    .show-on-mobile { display: table-cell !important; }
    td, th { font-size: 13px !important; padding: 10px 8px !important; }
    .toll-desc { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    .dashboard-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .dash-card { padding: 14px; border-left: none !important; box-shadow: 0 2px 8px rgba(0,0,0,0.04); border-bottom: 3px solid #eee; }
    .dash-card-icon { width: auto; height: auto; min-width: auto; border-radius: 0; font-size: 18px; margin-right: 10px; padding: 0 15px; background: none !important; color: #666 !important; }
    .dash-card-info .value { font-size: 17px; }
    .dash-card-info h4 { font-size: 11px; }
    .chart-container { height: 320px; padding: 15px; }
}

/* Exceção: Manter 2 colunas no modal de utilizadores no Mobile */
#userForm .form-grid-2-col {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important; /* Reduzimos ligeiramente o gap para caber melhor em ecrãs pequenos */
}

/* =========================================
   PÁGINA: RESERVAS (BOOKINGS) E TIMELINE
   ========================================= */
.booking-form-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); 
    gap: 15px; 
}

/* O .status-badge base foi atualizado para ter contornos com mais contraste */
.status-badge { 
    padding: 4px 12px; 
    border-radius: 20px; 
    font-weight: 700; 
    font-size: 11px; 
    text-transform: uppercase; 
    display: inline-block;
    min-width: 100px; 
    text-align: center;
    border: 1px solid transparent;
}

/* Timeline */
.timeline-container { 
    margin-top: 20px; 
    padding: 15px; 
    background: #fdfdfd; 
    border: 1px dashed #ccc; 
    border-radius: 8px; 
    display: none; 
}

.timeline-track { 
    position: relative; 
    height: 32px; 
    background: #e9ecef; 
    border-radius: 4px; 
    margin-top: 5px; 
}

.timeline-block { 
    position: absolute; 
    height: 100%; 
    border-radius: 4px; 
    cursor: pointer; 
    opacity: 0.85; 
    transition: transform 0.2s; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    color: rgba(255, 255, 255, 0.9); 
    font-size: 11px; 
    overflow: hidden;
}

.timeline-block:hover { 
    opacity: 1; 
    transform: scaleY(1.15); 
    z-index: 10; 
}

.timeline-hours { 
    display: flex; 
    justify-content: space-between; 
    font-size: 10px; 
    color: #888; 
    margin-top: 6px; 
    font-weight: bold; 
}

.timeline-tooltip { 
    position: absolute; 
    display: none; 
    background: #fff; 
    border: 1px solid #ccc; 
    padding: 10px 15px; 
    border-radius: 8px; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.15); 
    font-size: 13px; 
    color: #333; 
    z-index: 100; 
    min-width: 180px; 
    transform: translate(-50%, -110%); 
    pointer-events: none; 
}

/* Modais Específicos de Reservas */
.manager-actions { 
    display: none; 
    margin-top: 15px; 
    border-top: 1px solid #eee; 
    padding-top: 15px; 
    justify-content: space-between; 
    gap: 10px; 
}

.btn-approve { 
    background: #28a745; 
    color: white; 
    padding: 10px 15px; 
    border: none; 
    border-radius: 6px; 
    flex: 1; 
    font-weight: bold; 
    cursor: pointer;
}

.btn-reject { 
    background: #ffc107; 
    color: #000; 
    padding: 10px 15px; 
    border: none; 
    border-radius: 6px; 
    flex: 1; 
    font-weight: bold; 
    cursor: pointer;
}

.info-box-booking {
    margin-bottom: 20px; 
    padding: 12px 15px; 
    background: #f8f9fa; 
    border: 1px solid #e9ecef; 
    border-radius: 8px; 
    font-size: 14px; 
    color: #495057;
}

/* =========================================
   PÁGINA: DISPONIBILIDADE / TURNOS (AVAILABILITY)
   ========================================= */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.summary-card-item {
    background: #fff;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border-bottom: 4px solid #eee;
}

.summary-card-item i {
    font-size: 22px;
    margin-bottom: 8px;
    color: #888;
}

.summary-label {
    font-size: 11px;
    text-transform: uppercase;
    color: #888;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
    font-weight: 700;
}

.summary-value {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50 !important;
}

.border-total { border-bottom-color: var(--accent-light-bg); }
.border-work { border-bottom-color: #2ecc71; }
.border-break { border-bottom-color: #3498db; }

.badge-single { 
    background: var(--accent-dark-bg); 
    color: white; 
    padding: 2px 8px; 
    border-radius: 4px; 
    font-size: 11px; 
}

/* Responsividade Específica da Availability */
@media (max-width: 768px) {
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .summary-card-item {
        flex-direction: row;
        justify-content: flex-start; 
        align-items: center;
        padding: 14px; 
        text-align: left;
    }

    .summary-card-item i { 
        margin-bottom: 0; 
        font-size: 18px !important;
        width: auto;
        padding: 0 15px;
        text-align: center;
    }

    .summary-value { font-size: 17px !important; }
    .summary-label { font-size: 11px !important; }
}

/* =========================================
   MODAL DE DETALHES DE TURNO (CLEAN DESIGN)
   ========================================= */
.shift-clean-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.shift-clean-item {
    display: flex;
    flex-direction: column;
}

#dp_profile_display .shift-clean-item {
    background: #f8f9fa;
    padding: 12px 15px;
    border-radius: 8px;
}

.shift-clean-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    font-weight: bold;
    margin-bottom: 4px;
}

.shift-clean-value {
    font-size: 15px;
    color: #333;
    font-weight: 500;
}

.shift-clean-highlight {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.shift-clean-separator {
    border: 0;
    border-top: 1px solid #eee;
    margin: 15px 0;
}

/* =========================================
   PÁGINA: UPGRADES / DEMANDAS
   ========================================= */
/* Alinhamento dos Badges à esquerda e Título sem negrito */
.td-status { text-align: left !important; padding-left: 10px; }
.td-title { font-weight: 400 !important; }

/* Badges de Estado Específicos (Cores de Alto Contraste) */
.status-pendente { background-color: #fff9db !important; color: #856404 !important; border-color: #ffeeba !important; }
.status-confirmado, .status-concluido { background-color: #ebfbee !important; color: #2b8a3e !important; border-color: #d3f9d8 !important; }
.status-desenvolvimento, .status-ticket { background-color: #e7f5ff !important; color: #1864ab !important; border-color: #d0ebff !important; }
.status-cancelado, .status-rejeitado { background-color: #fff5f5 !important; color: #c92a2a !important; border-color: #ffe3e3 !important; }

/* Botão de Gatilho do Filtro */
.btn-geral {
    background: #fafafa; 
    border: 1px solid #ddd; 
    padding: 10px 20px; 
    border-radius: 12px;
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    font-weight: 500;
    color: black; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.05); 
    margin-bottom: 20px;
    transition: box-shadow 0.2s;
}

.btn-geral:hover {
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
}

.btn-geral i { color: #f39c12; font-size: 16px; }

/* Grelha de Filtros (Checkbox) */
.filter-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 10px; 
    margin: 20px 0; 
}

.filter-option { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    font-size: 14px; 
    cursor: pointer; 
}

.filter-option input[type="checkbox"] {
    width: auto; /* Anula o 100% definido nos inputs normais de formulário */
}

/* Campos Desativados (Read-only) */
input:disabled, textarea:disabled, select:disabled {
    background-color: #f9f9f9; 
    color: #555; 
    border: 1px dashed #ccc;
    cursor: not-allowed;
}

/* =========================================
   PÁGINA: UTILIZADORES
   ========================================= */
/* Container da Password com Ícone de Revelar */
.password-container {
    position: relative;
    display: flex;
    align-items: center;
}

.password-container input {
    width: 100%;
    padding-right: 35px; /* Espaço para não escrever por cima do ícone */
    box-sizing: border-box;
}

.password-container i {
    position: absolute;
    right: 12px;
    cursor: pointer;
    color: #888;
    transition: color 0.2s;
    font-size: 16px;
}

.password-container i:hover {
    color: var(--accent-light-bg);
}

/* Tooltip Customizada (Usada nos Badges de Multi-Categorias) */
.custom-tooltip { 
    position: fixed; 
    background: #333; 
    color: #fff; 
    padding: 6px 12px; 
    border-radius: 6px; 
    font-size: 12px; 
    z-index: 10000; 
    pointer-events: none; 
    display: none; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.badge-multi { 
    background: #34495E; 
    color: white; 
    padding: 2px 6px; 
    border-radius: 4px; 
    font-size: 10px; 
    cursor: help; 
    margin-right: 2px; 
}

/* Responsividade Específica para Tabela de Utilizadores */
@media (max-width: 768px) {
    .hide-email-mobile { display: none !important; }
}

/* =========================================
   PÁGINA: VEÍCULOS / TELEMETRIA
   ========================================= */
.page-header-flex { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; margin-bottom: 25px; }
.vehicle-selector-wrapper { min-width: 250px; }
.vehicle-selector { margin-bottom: 0 !important; font-weight: 600; background-color: #fff; }
.dashboard-grid-2-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.telemetry-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 15px; }
.card-title-bordered { font-size: 18px; border-bottom: 1px solid #eee; padding-bottom: 10px; margin: 0; }
.card-header-bordered { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #eee; padding-bottom: 10px; margin-bottom: 15px; }
.telemetry-card { background: #f9f9f9; padding: 15px; border-radius: 8px; display: flex; flex-direction: column; }
.telemetry-value { font-size: 18px; font-weight: bold; }
.telemetry-location { font-size: 14px; margin-top: 5px; color: #555; }
.settings-list { display: flex; flex-direction: column; gap: 15px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.toggle-label { font-weight: 500; font-size: 14px; }
.toggle-checkbox { width: 20px; height: 20px; accent-color: var(--accent-light-bg); }
.divider-subtle { border: 0; border-top: 1px solid #f0f0f0; margin: 0; }
.docs-list-container { font-size: 14px; color: #666; }
.doc-item-row { display: flex; justify-content: space-between; align-items: center; padding: 12px; background: #f9f9f9; border-radius: 6px; margin-bottom: 8px; }
.doc-item-info { display: flex; align-items: center; gap: 10px; }
.doc-item-details { display: flex; flex-direction: column; }
.doc-item-title { font-weight: 600; font-size: 14px; text-transform: capitalize; color: #333; }
.doc-item-date { font-size: 11px; color: #888; }
.file-input-dashed { padding: 10px; border: 1px dashed #ccc; background: #fafafa; width: 100%; box-sizing: border-box; border-radius: 6px; }

@media (max-width: 768px) {
    .dashboard-grid-2-col { grid-template-columns: 1fr; }
    .telemetry-grid { grid-template-columns: 1fr 1fr; gap: 10px; } 
    .vehicle-selector-wrapper { width: 100%; min-width: 100%; }
    .vehicle-selector { width: 100%; }
}

/* =========================================
   ADITAMENTOS: VEÍCULOS E DOCUMENTOS
   ========================================= */

/* Grelhas Dinâmicas */
.grid-auto-fit { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.grid-auto-fit-lg { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* Listagem de Documentos */
.empty-docs-msg { padding: 20px; text-align: center; color: #999; }
.doc-item { display: flex; align-items: center; justify-content: space-between; padding: 12px; border-bottom: 1px solid #eee; cursor: pointer; transition: background-color 0.2s; }
.doc-item:hover { background-color: #f9f9f9; }
.doc-icon-container { display: flex; align-items: center; gap: 12px; }
.doc-icon { color: #95a5a6; font-size: 1.2rem; }
.doc-text-container { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-type-title { font-weight: 500; text-transform: capitalize; color: #333; }
.doc-filename { font-size: 0.75rem; color: #666; }
.doc-actions { display: flex; align-items: center; gap: 15px; }

/* Badges e Botões de Documentos */
.doc-status-badge { font-size: 0.7rem; padding: 3px 8px; border-radius: 12px; color: #000; border: 1px solid transparent; }
.doc-status-pendente { background: #fff3cd; border-color: #ffeeba; }
.doc-status-validado { background: #d1e7dd; border-color: #badbcc; }
.doc-status-rejeitado { background: #ffebee; border-color: #f5b7b1; color: #c0392b; }
.doc-download-btn { color: #e67e22; text-decoration: none; font-size: 1.1rem; transition: opacity 0.2s; }
.doc-download-btn:hover { opacity: 0.7; }

/* Modais de Upload e Detalhes */
.modal-content-sm { width: 90%; max-width: 400px; padding: 25px; }
.modal-content-xs { max-width: 350px; text-align: center; padding: 30px; }
.modal-icon-large { font-size: 3rem; color: #f39c12; margin-bottom: 20px; }
.modal-text-muted { color: #666; margin-bottom: 25px; font-size: 0.9rem; line-height: 1.5; }
.modal-detail-text { line-height: 1.8; margin-bottom: 20px; }
.modal-detail-text p { margin-bottom: 5px; }
.text-capitalize { text-transform: capitalize; }

/* Caixas de Mensagem Dinâmicas (JS) */
.msg-box { display: none; padding: 10px; margin-bottom: 15px; border-radius: 4px; font-size: 0.85rem; border: 1px solid transparent; font-weight: 500; }
.msg-success { background-color: #e8fdf0; border-color: #2ecc71; color: #27ae60; display: block; }
.msg-error { background-color: #ffebee; border-color: #f44336; color: #c0392b; display: block; }

/* Utilitários Genéricos */
.flex-gap-10 { display: flex; gap: 10px; }
.btn-action-transparent { background: none; border: none; cursor: pointer; padding: 5px; }
/* --- LAYOUT VEÍCULO FOTO + DADOS --- */
.vehicle-details-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.vehicle-image-container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto 15px auto;
    display: block;
}

.vehicle-img-optimized {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 600 / 336;
    object-fit: cover;
    border-radius: 6px;
}

.text-small {
    font-size: 13px;
    line-height: 1.3;
}

/* Lado a Lado apenas em Desktop */
@media (min-width: 992px) {
    .vehicle-details-wrapper {
        flex-direction: row;
        align-items: flex-start;
    }
    .vehicle-image-container {
        flex: 0 0 320px;
        position: sticky;
        top: 20px;
        margin-bottom: 0;
        margin: 0;
    }
    /* Usa a tua classe shift-clean-grid original e preenche o resto do espaço */
    .vehicle-details-wrapper .shift-clean-grid {
        flex: 1;
    }
}

/* PROFILE PAGE */

/* Perfil e Formulários Grid */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: #555;
}

.form-group input {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    font-size: 1rem;
}

.full-width {
    grid-column: span 2;
}

.separator {
    border: 0;
    border-top: 1px solid #eee;
    margin: 30px 0;
}

/* Affiliate Box */
.affiliate-section h4 {
    margin-bottom: 10px;
    color: #1a1a1a;
}

.copy-link-box {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    background: #f9f9f9;
    padding: 10px;
    border-radius: 8px;
    border: 1px dashed #ccc;
}

.copy-link-box input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: monospace;
    font-size: 0.9rem;
    color: #666;
    outline: none;
}

/* Responsividade Mobile */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .full-width {
        grid-column: span 1;
    }
}

/* =========================================
   SUMMARY CARDS (TURNOS) - LAYOUT & CORES
========================================= */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 Colunas no Desktop/Tablet Horizontal */
    gap: 15px;
    margin-bottom: 20px;
}

/* Responsividade para Tablets e ecrãs médios */
@media (max-width: 992px) {
    .summary-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 Colunas */
    }
}

/* Responsividade para Telemóveis */
@media (max-width: 576px) {
    .summary-grid {
        grid-template-columns: 1fr; /* 1 Coluna */
    }
}

.summary-card-item {
    background: #ffffff;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border: 1px solid #eeeeee;
}

.summary-card-item i {
    font-size: 2rem;
}

.summary-card-item .summary-label {
    font-size: 0.85rem;
    color: #7f8c8d;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.summary-card-item .summary-value {
    font-size: 1.2rem;
    color: #2c3e50;
    margin-top: 2px;
}

/* Cores específicas de cada estado 
.border-total { border-left: 4px solid var(--primary, #34495e); }
.border-total i { color: var(--primary, #34495e); }

.border-work { border-left: 4px solid #2ecc71; }
.border-work i { color: #2ecc71; }

.border-break { border-left: 4px solid #3498db; }
.border-break i { color: #3498db; }

.border-stop { border-left: 4px solid #e67e22; } 
.border-stop i { color: #e67e22; } */
/* Badges de Faturas (Alto Contraste Fenix Drive) */
.status-pending { 
    background-color: #fff9db !important; 
    color: #856404 !important; 
    border-color: #ffeeba !important; 
}
.status-paid { 
    background-color: #ebfbee !important; 
    color: #2b8a3e !important; 
    border-color: #d3f9d8 !important; 
}
.status-cancelled { 
    background-color: #fff5f5 !important; 
    color: #c92a2a !important; 
    border-color: #ffe3e3 !important; 
}

.pdf-icon-btn {
    color: #c0392b;
    font-size: 1.2rem;
    transition: opacity 0.2s, transform 0.1s;
}
.pdf-icon-btn:hover {
    opacity: 0.7;
    transform: scale(1.1);
}
.pdf-disabled {
    color: #ddd;
    cursor: not-allowed;
}
/* FUELING
/* Badge de Sincronização e Estados */
.badge-sync {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.sync-success {
    background: #e6f4ea;
    color: #1e8e3e;
}

.sync-warning {
    background: #fef7e0;
    color: #f29900;
}

.sync-danger {
    background: #fce8e6;
    color: #d93025;
}

.sync-pending {
    background: #f1f3f4;
    color: #5f6368;
}

/* Ajustes Clean para Separação */
.margin-t-20 {
    margin-top: 20px;
}

/* availability-add: segment rows */
.segment-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 10px; align-items: end; padding: 12px;
    border: 1px solid #e8e8e8; border-radius: 8px; margin-bottom: 8px;
    background: #fafafa;
}
.segment-row .seg-actions {
    grid-column: 1 / -1;
    display: flex; align-items: center; justify-content: space-between;
    padding-top: 4px;
}
.segment-row .seg-label { font-size: 11px; color: #888; margin-bottom: 4px; }
.segment-row .seg-remove { background:none; border:none; cursor:pointer; color:#e74c3c; font-size:20px; padding:4px 8px; }
@media (min-width: 700px) {
    .segment-row { grid-template-columns: 1fr 1fr 1fr 1fr auto; }
    .segment-row .seg-actions { grid-column: auto; flex-direction: column; justify-content: center; }
}
