:root {
    --bg-app: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-column: #161d30;
    --bg-card: #222f47;
    --text-color: #f8fafc;
    --color-alta: #ef4444;
    --color-media: #f59e0b;
    --color-baixa: #10b981;
    --accent: #3b82f6;
    --border-color: #334155;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', system-ui, sans-serif; }
body { background-color: var(--bg-app); color: var(--text-color); min-height: 100vh; display: flex; overflow: hidden; }

/* LAYOUT GLOBAL */
.app-layout { display: flex; width: 100vw; height: 100vh; overflow: hidden; position: relative; }

/* SIDEBAR REFINADA */
.sidebar { 
    width: 280px; background-color: var(--bg-sidebar); padding: 24px 16px; 
    display: flex; flex-direction: column; gap: 20px; border-right: 1px solid var(--border-color); 
    overflow-y: auto; height: 100vh; transition: width 0.3s ease;
}
.sidebar.collapsed { width: 75px; padding: 24px 10px; }
.sidebar.collapsed h2, .sidebar.collapsed .menu-text, .sidebar.collapsed .section-dados-obra { display: none; }

.sidebar-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 15px; border-bottom: 1px solid var(--border-color); }
.sidebar-header h2 { font-size: 1.2rem; font-weight: 700; letter-spacing: 0.5px; white-space: nowrap; }

nav { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.menu-item { background: none; border: none; color: #94a3b8; text-align: left; padding: 12px 16px; font-size: 0.95rem; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 12px; width: 100%; transition: all 0.2s ease; }
.menu-item:hover { background-color: #24334d; color: #fff; }
.menu-item.active { background-color: var(--accent); color: white; font-weight: 600; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3); }

/* CONTÊINER DE DADOS DA OBRA ATIVA COM MINI BARRAS */
.section-dados-obra { background: #151f32; padding: 14px; border-radius: 8px; border: 1px solid #24334d; margin-top: 10px; display: flex; flex-direction: column; gap: 12px; }
.menu-tag-item { display: flex; flex-direction: column; gap: 6px; }
.menu-tag-info { display: flex; justify-content: space-between; font-size: 0.8rem; color: #cbd5e1; font-weight: 500; }
.mini-progress-bg { background-color: #0f172a; width: 100%; height: 6px; border-radius: 3px; overflow: hidden; border: 1px solid #1e293b; }
.mini-progress-fill { background: linear-gradient(90deg, #3b82f6, #10b981); height: 100%; width: 0%; transition: width 0.4s ease; }

/* BOTÕES DE CONFIGURAÇÃO DE ESCOPO */
.add-tag-btn { background: #24334d; border: 1px solid var(--accent); color: var(--accent); padding: 10px 14px; font-size: 0.85rem; font-weight: 600; border-radius: 6px; cursor: pointer; width: 100%; text-align: center; transition: all 0.2s; display: flex; align-items: center; justify-content: center; gap: 6px; }
.add-tag-btn:hover { background: var(--accent); color: white; box-shadow: 0 4px 10px rgba(59, 130, 246, 0.2); }

/* ÁREA DE CONTEÚDO OPERACIONAL */
.main-content { flex: 1; display: flex; flex-direction: column; padding: 30px; background-color: #0b0f19; overflow-y: auto; height: 100vh; }
.main-header { margin-bottom: 25px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; }
.header-btn { background-color: #1e293b; border: 1px solid var(--border-color); color: white; padding: 10px 18px; font-size: 0.9rem; font-weight: 600; border-radius: 6px; cursor: pointer; transition: background 0.2s; }
.header-btn:hover { background-color: #2d3d54; border-color: var(--accent); }

/* SISTEMA KANBAN E ELEMENTOS FLUIDOS */
.kanban-board { flex: 1; display: flex; gap: 20px; overflow-x: auto; padding-bottom: 15px; align-items: flex-start; }
.kanban-column { flex: 1; background-color: var(--bg-column); border-radius: 12px; min-width: 290px; display: flex; flex-direction: column; padding: 16px; border: 1px solid #222f47; max-height: calc(100vh - 160px); }
.column-header { font-weight: 700; font-size: 1rem; padding: 12px; text-align: center; background-color: #111c30; border-radius: 8px; margin-bottom: 16px; border-bottom: 3px solid var(--accent); }
.column-body { flex: 1; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; min-height: 150px; }

/* CARTÕES E MAPA DE CALOR */
.card { background-color: var(--bg-card); padding: 16px; border-radius: 8px; cursor: grab; box-shadow: 0 4px 10px rgba(0,0,0,0.2); border: 1px solid #2e3d54; position: relative; transition: transform 0.2s, box-shadow 0.2s; }
.card:active { cursor: grabbing; transform: scale(0.98); }
.card h4 { font-size: 0.95rem; color: #fff; margin-bottom: 6px; padding-right: 40px; word-break: break-word; }
.prioridade-Alta { border-left: 5px solid var(--color-alta); }
.prioridade-Media { border-left: 5px solid var(--color-media); }
.prioridade-Baixa { border-left: 5px solid var(--color-baixa); }
.card-actions { display: flex; gap: 10px; font-size: 0.85rem; position: absolute; top: 14px; right: 14px; cursor: pointer; z-index: 10; }
.status-impedido { background-color: #2e1622 !important; border-left: 5px solid var(--color-alta) !important; }

/* REGRA DE CARD CONCLUÍDO: TEXTO RISCADO E SUAVIZAÇÃO VISUAL */
#col-Concluído .card { opacity: 0.6; box-shadow: none; border-color: #1e293b; background-color: #111a2e !important; }
#col-Concluído .card h4 { text-decoration: line-through; color: #94a3b8 !important; }
#col-Concluído .card .fase-tag { background-color: #475569 !important; }

/* GRID CENTRAL DE OBRAS E DASHBOARD */
.dash-tags-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; width: 100%; }
.tag-banner { background: #161d30; border: 1px solid #222f47; border-radius: 10px; padding: 20px; transition: all 0.2s; position: relative; }
.tag-banner:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 6px 15px rgba(0,0,0,0.3); }

/* SISTEMA DO DASHBOARD */
.dashboard-grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; width: 100%; margin-bottom: 25px; }
.dash-card { padding: 24px 20px; border-radius: 12px; box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4); border: 1px solid rgba(255, 255, 255, 0.05); }
.dash-card h4 { margin: 0; font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.dash-card .count { font-size: 2.5rem; font-weight: 800; margin-top: 8px; line-height: 1; }

.card-planejado { background: linear-gradient(135deg, #1e3a8a, #3b82f6); }
.card-planejado h4 { color: #93c5fd; }
.card-execucao { background: linear-gradient(135deg, #78350f, #f59e0b); }
.card-execucao h4 { color: #fde68a; }
.card-impedido { background: linear-gradient(135deg, #7f1d1d, #ef4444); }
.card-impedido h4 { color: #fca5a5; }
.card-concluido { background: linear-gradient(135deg, #064e3b, #10b981); }
.card-concluido h4 { color: #a7f3d0; }

.dashboard-chart-box { width: 100%; background-color: #161d30; border: 1px solid #222f47; padding: 24px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.2); }
.dashboard-chart-box h3 { color: #fff; margin-top: 0; margin-bottom: 20px; font-size: 1.1rem; border-left: 4px solid var(--color-media); padding-left: 12px; }
.chart-container-wrapper { position: relative; height: 320px; width: 100%; }

.progress-bar-bg { background-color: #0f172a; width: 100%; height: 10px; border-radius: 5px; overflow: hidden; margin-top: 10px; border: 1px solid var(--border-color); }
.progress-bar-fill { background: linear-gradient(90deg, #3b82f6, #10b981); height: 100%; width: 0%; transition: width 0.4s ease; }

/* SEÇÃO DE ALERTAS PREVENTIVOS DO DIÁRIO */
.alertas-painel-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; width: 100%; margin-top: 5px; }
.alerta-coluna { background-color: #161d30; border: 1px solid #222f47; border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.alerta-coluna h3 { font-size: 1rem; color: #fff; padding-left: 10px; border-left: 4px solid var(--color-alta); }
.alerta-coluna.preventiva h3 { border-left-color: var(--color-media); }
.card-alerta-mini { background: #1e293b; border: 1px solid #334155; padding: 14px; border-radius: 8px; border-left: 4px solid var(--color-alta); }
.alerta-coluna.preventiva .card-alerta-mini { border-left-color: var(--color-media); }
.card-alerta-mini h4 { font-size: 0.95rem; color: #fff; margin-bottom: 4px; }
.card-alerta-mini small { color: #94a3b8; display: block; font-weight: 500; }

/* MODAIS SEGUROS COM BLUR CONTRA VAZAMENTO */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background-color: rgba(0, 0, 0, 0.6); backdrop-filter: blur(5px); display: none; justify-content: center; align-items: center; z-index: 200; padding: 15px; }
.modal-overlay.active { display: flex !important; }
.modal-card { background-color: #1e293b; border: 1px solid #475569; width: 100%; max-width: 480px; border-radius: 10px; display: flex; flex-direction: column; box-shadow: 0 25px 50px rgba(0,0,0,0.5); overflow: hidden; }
.modal-header { padding: 16px 20px; background-color: #111827; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #334155; }
.close-modal-btn { background: none; border: none; color: #94a3b8; font-size: 1.6rem; cursor: pointer; line-height: 1; }
.modal-body { padding: 22px; display: flex; flex-direction: column; gap: 16px; max-height: calc(100vh - 120px); overflow-y: auto; }

/* ELEMENTOS DE FORMULÁRIO */
.form-group { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.form-group label { font-size: 0.85rem; color: #94a3b8; font-weight: 600; }
.form-group input, .form-group textarea, .form-group select { background-color: #0f172a; border: 1px solid #475569; color: white; padding: 11px; border-radius: 6px; font-size: 0.9rem; outline: none; width: 100%; transition: border-color 0.2s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent); }
.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }

.save-task-btn { background-color: var(--accent); color: white; border: none; padding: 12px; border-radius: 6px; font-weight: bold; font-size: 0.95rem; cursor: pointer; text-align: center; transition: background 0.2s; }
.save-task-btn:hover { background-color: #2563eb; }

/* FLOATING ACTION BUTTON (FAB) */
.fab-btn { position: fixed; bottom: 30px; right: 30px; width: 56px; height: 55px; background-color: #10b981; color: white; border: none; border-radius: 50%; font-size: 2rem; cursor: pointer; box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4); z-index: 99; display: flex; justify-content: center; align-items: center; transition: transform 0.2s; }
.fab-btn:hover { transform: scale(1.05); background-color: #059669; }

/* CALENDÁRIO INTERNO */
.calendar-modal-card { max-width: 440px; }
.agenda-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.agenda-header button { background: #24334d; border: 1px solid #334155; color: white; padding: 6px 14px; border-radius: 4px; cursor: pointer; }
.calendar-grid-header, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.calendar-grid-header { font-weight: bold; font-size: 0.85rem; color: var(--accent); padding-bottom: 5px; }
.calendar-day { background-color: #111c30; padding: 12px 0; border-radius: 6px; font-size: 0.85rem; cursor: pointer; position: relative; border: 1px solid #1e293b; }
.calendar-day.empty { background: transparent; cursor: default; border: none; }
.calendar-day.today { border: 2px solid var(--accent); font-weight: 700; color: #fff; }
.calendar-day.has-task::after { content: ''; position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%); width: 6px; height: 6px; background-color: var(--color-media); border-radius: 50%; }

@media (max-width: 1024px) {
    .kanban-board { flex-direction: column; overflow-x: hidden; align-items: stretch; }
    .kanban-column { max-height: none; min-width: 100%; }
    .alertas-painel-row { grid-template-columns: 1fr; }
}

/* ... Mantenha os seus estilos padrões e adicione este bloco no final do arquivo ... */

@media (max-width: 768px) {
    /* Transforma o Layout Global em Fluxo Vertical */
    body, .app-layout {
        flex-direction: column !important;
        overflow-x: hidden;
    #btn-config-etapas-mobile {
        display: block !important; /* Mostra a engrenagem de gestão no celular */
    }
    }

    /* Ajusta a área principal para dar espaço à barra inferior */
    .main-content {
        padding: 15px !important;
        padding-bottom: 80px !important; /* Espaço para o menu não cobrir o conteúdo */
        height: calc(100vh - 70px) !important;
        overflow-y: auto;
    }

    /* TRANSFORMA A SIDEBAR EM MENU HORIZONTAL INFERIOR */
    .sidebar {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 65px !important;
        flex-direction: row !important;
        background-color: #161d30 !important;
        padding: 0 10px !important;
        gap: 0 !important;
        border-right: none !important;
        border-top: 1px solid #334155 !important;
        z-index: 999 !important;
        overflow: hidden !important;
        justify-content: space-around !important;
        align-items: center !important;
    }

    /* Oculta elementos que ocupam muito espaço no celular */
    .sidebar-header, 
    .section-dados-obra, 
    .sidebar-menu span, 
    .menu-text,
    #nome-usuario-logado {
        display: none !important;
    }

    /* Configura os botões de navegação em formato de aba inferior */
    .sidebar nav {
        display: flex !important;
        flex-direction: row !important;
        width: 100% !important;
        justify-content: space-around !important;
        gap: 5px !important;
    }

    .menu-item {
        padding: 10px !important;
        border-radius: 8px !important;
        justify-content: center !important;
        align-items: center !important;
        flex-direction: column !important;
        font-size: 1.3rem !important; /* Aumenta o tamanho do emoji/ícone */
        width: auto !important;
        flex: 1 !important;
        background: none !important;
    }
    
    .menu-item.active {
        background-color: #24334d !important;
        color: #3b82f6 !important;
        box-shadow: none !important;
    }

    /* RESPONSIVIDADE DO KANBAN: Transforma em Rolagem Lateral Fluida */
    .kanban-board {
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        gap: 15px !important;
        width: 100% !important;
        padding-bottom: 15px !important;
        align-items: flex-start !important;
    }

    .kanban-column {
        flex: 0 0 280px !important; /* Mantém a largura de coluna fixa para rolar horizontalmente de forma elegante */
        max-height: calc(100vh - 200px) !important;
    }

    /* Ajusta a Grid de Cards do Dashboard */
    .dashboard-grid-cards {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }

    .alertas-painel-row {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    /* Move o FAB para cima para não sobrepor o menu */
    .fab-btn, #fab-task {
        bottom: 80px !important;
        right: 20px !important;
    }
}









/* Container de Fases Estilo App */
.grid-fases-cliente {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    width: 100%;
    padding: 5px;
}

.card-fase-cliente {
    background: #161d30;
    border: 1px solid #334155;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
}

.card-fase-cliente:hover {
    transform: translateY(-3px);
    border-color: #3b82f6;
}

.fase-capa-placeholder {
    width: 100%;
    height: 100px;
    background: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    border-bottom: 1px solid #334155;
}

.fase-info-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.badge-concluido-cliente {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 20px;
    font-weight: 700;
    display: inline-block;
    align-self: flex-start;
}

/* Linha do Tempo Interna da Fase */
.linha-tempo-sessao {
    margin-bottom: 25px;
    width: 100%;
}

.linha-tempo-data-titulo {
    font-size: 0.95rem;
    color: #3b82f6;
    font-weight: 700;
    margin-bottom: 15px;
    border-left: 3px solid #3b82f6;
    padding-left: 8px;
}

.grid-fotos-sessao {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.card-foto {
    background:#1e293b;
    padding:12px;
    border-radius:8px;
    position:relative;
    width: calc(25% - 12px); /* 4 items per row, considering the gap */
    min-width: 220px;
    display: flex;
    flex-direction: column;
}

.card-foto .imagem-container {
    width:100%;
    height:180px;
    border-radius:6px;
    overflow:hidden;
    border:1px solid #334155;
    margin-bottom: 10px;
}

.card-foto .imagem-container img {
    width:100%;
    height:100%;
    object-fit:cover;
    cursor:pointer;
    transition: transform 0.2s;
}

.card-foto .imagem-container img:hover {
    transform: scale(1.05);
}

.card-foto h4 {
    font-size:0.85rem;
    color:#fff;
    font-weight:500;
    line-height:1.4;
    flex-grow: 1;
}