/* --- CONFIGURAÇÃO GERAL --- */
:root {
    --primary-blue: #5c7cfa;
    --primary-dark: #4263eb;
    --bg-body: #f8f9fa;
    --bg-header: #2C3E50;
    --text-main: #495057;
    --st-todo: #f1f3f5;
    --st-waiting: #fff9db;
    --st-doing: #ebfbee;
    --st-done: #fff0f6;
    /* NOVAS CORES PARA BOTÕES MODAL */
    --btn-save-green: #2ecc71;
    --btn-cancel-grey: #adb5bd;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background-color: var(--bg-body); color: var(--text-main); padding: 0 15px 15px 15px; line-height: 1.3; }

/* --- HEADER --- */
header {
    position: sticky; top: 0; background-color: var(--bg-header); z-index: 9000;
    padding: 20px 20px 10px 20px; border-bottom: 3px solid var(--primary-blue);
    text-align: center; margin-bottom: 20px; box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    border-radius: 0 0 15px 15px;
}
h1 { color: #ffffff; margin-bottom: 10px; text-transform: uppercase; font-weight: 800; font-size: 2.5em; letter-spacing: 1px; }
#relogio-topo { position: absolute; top: 15px; right: 20px; font-weight: 600; background: rgba(255,255,255,0.9); padding: 8px 12px; border-radius: 12px; border: 1px solid #dee2e6; font-size: 0.85em; color: #2C3E50; }

.search-wrapper { max-width: 500px; margin: 0 auto 15px; position: relative; }
.search-input { width: 100%; padding: 12px 45px 12px 20px; border-radius: 15px; border: none; outline: none; transition: 0.3s; font-size: 0.9em; box-shadow: inset 0 2px 4px rgba(0,0,0,0.1); }
.search-input:focus { box-shadow: 0 0 0 3px var(--primary-blue); }
.search-icon { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); color: #adb5bd; }

.header-actions { display: flex; justify-content: center; gap: 12px; margin-bottom: 15px; flex-wrap: wrap; }
.btn-main { padding: 10px 25px; border: none; border-radius: 12px; cursor: pointer; font-weight: bold; color: white; font-size: 0.85em; display: flex; align-items: center; gap: 8px; box-shadow: 0 4px 0 rgba(0,0,0,0.2); }
.btn-new { background-color: #51cf66; }
.btn-network { background-color: #fcc419; color: #000; }
.btn-network.connected { background-color: var(--primary-blue); color: white; }
.btn-import { background-color: #22b8cf; }
.btn-export { background-color: #339af0; }
.btn-toggle-view { background-color: #845ef7; }
.btn-main i { font-size: 1.1em; }

nav ul { list-style: none; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
nav li { position: relative; }
nav a {
    text-decoration: none !important; color: #ffffff !important; font-weight: 600; padding: 10px 18px;
    border-radius: 10px; border: 1.5px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.1);
    display: block; cursor: pointer; font-size: 0.85em; transition: 0.2s;
}
nav a:hover { background: rgba(255,255,255,0.2); }
nav a.active { background-color: var(--primary-blue) !important; border-color: var(--primary-blue) !important; color: #fff !important; }
.submenu-list { display: none; position: absolute; top: 100%; left: 0; background: white; border: 1px solid #dee2e6; border-radius: 8px; min-width: 170px; z-index: 9500; box-shadow: 0 8px 20px rgba(0,0,0,0.15); margin-top: 5px; }
nav li:hover .submenu-list { display: block; }
.submenu-list a { border: none !important; border-bottom: 1px solid #f1f3f5 !important; padding: 10px 15px; font-size: 0.8em; border-radius: 0 !important; color: #2C3E50 !important; background: white !important; }

/* --- DASHBOARD --- */
.summary-wrapper { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 25px; }
.stat-box { position: relative; background: #fff; padding: 12px; border-radius: 15px; display: flex; flex-direction: column; align-items: center; min-width: 130px; border: 1px solid #eee; border-bottom: 4px solid var(--primary-blue); cursor: pointer; }
.stat-box strong { font-size: 1.5em; }
.summary-popup { display: none; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); background: white; border-top: 5px solid var(--primary-blue); padding: 12px; border-radius: 15px; box-shadow: 0 20px 45px rgba(0,0,0,0.25); z-index: 9999; width: 500px; height: 450px; overflow-y: auto; margin-top: 10px; }
.stat-box:hover .summary-popup { display: block; }
.popup-title { font-size: 0.85em; font-weight: bold; border-bottom: 1px solid #eee; padding-bottom: 8px; margin-bottom: 10px; color: var(--primary-blue); text-transform: uppercase; text-align: center; }
.popup-item { font-size: 0.7em; padding: 8px; margin-bottom: 5px; border-radius: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1.5px solid rgba(0,0,0,0.03); transition: 0.2s; cursor: pointer; }
.popup-item:hover { transform: scale(1.02); background-color: #fff !important; border-color: var(--primary-blue); }
.popup-subject { flex: 1; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #333; text-align: left; }
.popup-sector { font-weight: 400; font-size: 0.85em; color: #666; min-width: 120px; text-align: right; }

.dash-grid-container { display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; padding-bottom: 30px; align-items: flex-start; }
.dash-sector-unit { display: flex; flex-direction: column; width: 290px; }
.chart-card { background: #212529; color: #fff; padding: 15px; border-radius: 15px 15px 0 0; text-align: center; border: 1px solid #343a40; min-height: 240px; display: flex; flex-direction: column; justify-content: space-between; }
.chart-card h3 { font-size: 0.7em; text-transform: uppercase; border-bottom: 1px solid #343a40; padding-bottom: 8px; margin-bottom: 10px; color: #adb5bd !important; }
.pie-chart { width: 80px; height: 80px; border-radius: 50%; margin: 0 auto 10px; position: relative; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pie-chart::after { content: attr(data-total); position: absolute; width: 68%; height: 68%; background: #1a1d20; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; color: #fff; font-size: 1.1em; }
.legend { text-align: left; font-size: 0.6em; display: flex; flex-direction: column; gap: 3px; }
.legend-item { display: flex; justify-content: space-between; border-bottom: 1px solid #343a40; padding-bottom: 1px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.list-card { background: white; padding: 10px; border-radius: 0 0 15px 15px; border: 1px solid #dee2e6; border-top: none; }
.dash-list-scroll { max-height: 270px; overflow-y: auto; min-height: 270px; }
.dash-item { font-size: 0.7em; padding: 8px; margin-bottom: 5px; border-radius: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1.5px solid rgba(0,0,0,0.03); transition: 0.2s; cursor: pointer; }
.dash-item:hover { transform: scale(1.02); background-color: #fff; border-color: var(--primary-blue); }
.dash-item-subject { flex: 1; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #333; }
.dash-status-text { font-weight: 400; font-size: 0.8em; text-transform: uppercase; min-width: 85px; text-align: center; }

/* --- TAREFAS E CARDS --- */
.section { display: none; min-height: 80vh; padding-top: 10px; }
.section.active { display: block; }
.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; padding-bottom: 30px; min-height: 100px; transition: background-color 0.2s; }
.task-grid.drag-over-active { background-color: rgba(92, 124, 250, 0.05); border-radius: 10px;}

.task-card { 
    padding: 12px; border-radius: 20px; border: 1px solid #e9ecef; display: flex; flex-direction: column; gap: 6px; height: 100%; 
    background: #fff; box-shadow: 0 4px 15px rgba(0,0,0,0.02); cursor: grab;
    overflow: visible !important; position: relative; z-index: 1; transition: transform 0.2s, z-index 0s;
}
.task-card:hover { transform: translateY(-6px); box-shadow: 0 15px 30px rgba(0,0,0,0.06); z-index: 10000 !important; }
.task-card.dragging { opacity: 0.4; transform: scale(0.9); border: 2px dashed var(--primary-blue) !important; background: #f8f9fa !important; cursor: grabbing; }
.task-card * { pointer-events: none; }
.task-card button, .task-card a, .task-card select, .task-card input { pointer-events: auto; }

.st-por-iniciar, .item-por-iniciar { background-color: var(--st-todo) !important; border-left: 6px solid #adb5bd; }
.st-em-espera, .item-em-espera { background-color: var(--st-waiting) !important; border-left: 6px solid #ffd43b; }
.st-em-execucao, .item-em-execucao { background-color: var(--st-doing) !important; border-left: 6px solid #69db7c; }
.st-concluida, .item-concluida { background-color: var(--st-done) !important; border-left: 6px solid var(--primary-blue); }
.st-concluida .card-assunto, .item-concluida .dash-item-subject { text-decoration: line-through; opacity: 0.5; }

.priority-tag {
    position: absolute !important; top: 8px !important; left: 15px !important; z-index: 20 !important;
    padding: 4px 14px !important; border-radius: 20px !important;
    font-size: 0.75em; font-weight: bold; width: fit-content; text-transform: lowercase; box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.prio-baixa { background-color: #f1f3f5; color: #495057; border: 1px solid #dee2e6; }
.prio-media { background-color: #fff9db; color: #e67700; border: 1px solid #ffe066; }
.prio-alta { background-color: #fff5f5; color: #c92a2a; border: 1px solid #ffc9c9; }

.due-badge { position: absolute; top: 8px; right: 8px; background-color: white; padding: 4px 10px; border-radius: 10px; font-size: 0.65em; font-weight: 700; letter-spacing: 0.5px; box-shadow: 0 3px 8px rgba(224, 49, 49, 0.2); display: flex; align-items: center; gap: 6px; z-index: 20; white-space: nowrap; border: 1px solid; }
.due-badge { color: #e03131; border-color: #e03131; }
.due-badge.soon { color: #d97706; border-color: #d97706; }
.due-badge i { font-size: 1.1em; }

.shared-badge {
    position: absolute !important; top: 8px !important; left: 47% !important; transform: translateX(-50%) !important;
    z-index: 20 !important; padding: 4px 15px !important; border-radius: 20px !important;
    background-color: #845ef7 !important; color: white !important; font-size: 0.7em !important; font-weight: 800 !important;
    text-transform: uppercase !important; white-space: nowrap !important; width: auto !important;
    display: inline-flex !important; align-items: center !important; gap: 5px !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2) !important; cursor: help; pointer-events: auto !important;
}

.card-assunto {
    text-align: center !important; justify-content: center !important; display: flex; align-items: center; width: 100%; top: 20px;
    min-height: 30px; height: auto !important; padding: 2px 5px; position: relative !important; overflow: visible !important;
    z-index: 5; pointer-events: auto !important; font-weight: 700 !important; margin-bottom: 15px !important; 
}
.kb-subject {
    text-align: left !important; justify-content: flex-start !important; padding-left: 0 !important;
    display: flex; align-items: center; width: 100%; min-height: 30px; height: auto !important;
    position: relative !important; overflow: visible !important; z-index: 5;
    pointer-events: auto !important; font-weight: 700 !important; margin-bottom: 15px !important; 
}
.subject-text {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    text-overflow: ellipsis; line-height: 1.3; max-height: 2.6em; width: 100%;
    pointer-events: auto; font-weight: 700 !important;
}

.btn-link-task {
    background-color: var(--primary-blue); color: #fff; padding: 4px 12px; border-radius: 30px; text-decoration: none; font-size: 0.75em; font-weight: bold; display: flex; align-items: center; gap: 6px; width: fit-content; box-shadow: 0 4px 0 var(--primary-dark); transition: 0.2s;
}
.btn-link-task:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--primary-dark); }
.card-footer { display: flex; gap: 8px; margin-top: auto; padding-top: 8px; border-top: 1px solid rgba(0,0,0,0.05); align-items: center; }
.status-select { flex-grow: 1; padding: 8px; border-radius: 10px; border: 1px solid #dee2e6; font-size: 0.9em; background: #fff; }
.btn-footer { padding: 8px 12px; border: none; border-radius: 8px; cursor: pointer; color: white; font-weight: bold; font-size: 0.85em; box-shadow: 0 3px 0 rgba(0,0,0,0.1); }
.btn-edit { background-color: var(--primary-blue); }
.btn-duplicate { background-color: #fab005; }
.btn-delete { background-color: #ff6b6b; }
.info-line { display: flex; align-items: center; gap: 10px; font-size: 0.9em; margin: 2px 0; color: #555; }
.sector-header { background-color: #dbeafe; color: #1e40af; padding: 12px 20px; margin: 25px 0 15px 0; border-radius: 8px; text-transform: uppercase; font-weight: 800; font-size: 0.9em; width: 100%; border-left: 5px solid var(--primary-blue); }

/* --- KANBAN --- */
#kanban-container { display: none; grid-template-columns: repeat(4, 1fr); gap: 15px; padding: 10px; align-items: flex-start; }
.kanban-col { background: #e9ecef; border-radius: 15px; padding: 15px; min-height: 70vh; }
.kanban-col-title { font-weight: 800; text-transform: uppercase; color: #495057; font-size: 0.85em; margin-bottom: 15px; border-bottom: 2px solid #dee2e6; padding-bottom: 8px; display: flex; justify-content: space-between; }
.kanban-card { background: white; border-radius: 12px; padding: 12px; margin-bottom: 10px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); border-left: 5px solid #ddd; cursor: pointer; position: relative; display: flex; flex-direction: column; overflow: visible !important; }
.kanban-card:hover { transform: scale(1.02); z-index: 10000 !important; }
.kb-sector { font-size: 0.7em; color: var(--primary-blue); font-weight: bold; }
.kb-info-line { display: flex; justify-content: space-between; align-items: center; font-size: 0.7em; color: #666; margin: 6px 0; }
.kb-theme { 
    color: #2b8a3e !important; /* Verde escuro para leitura clara */
    font-weight: 700;          /* Negrito para destacar */
    font-size: 1.00em;
}
.kb-poc { color: var(--primary-blue); font-weight: bold; }

/* --- MODAIS (HORIZONTAL) --- */
.modal { display: none; position: fixed; z-index: 100000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); overflow-y: auto; }
				   
					 
					 
					 
							   
								 
								
					  
 

/* Modal mais largo */
.modal-content.horizontal-modal {
    background: white; margin: 3% auto; padding: 30px; border-radius: 20px;
					 
				   
						
				
    width: 90%; max-width: 900px;
}

/* Título Azul */
#modal-title {
    color: var(--primary-blue) !important;
    border-bottom: 2px solid #f1f3f5; padding-bottom: 15px; margin-bottom: 20px;
						
							
}

/* Grelha do Corpo do Modal */
.modal-body-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Duas colunas iguais */
    gap: 30px;
    align-items: start;
				
					  
											
					   
}

.modal-col-left, .modal-col-right {
    display: flex; flex-direction: column; gap: 12px;
						
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.input-group { display: flex; flex-direction: column; gap: 5px; }
.input-group label { font-size: 0.85em; font-weight: bold; color: #495057; }

input, select, textarea { width: 100%; padding: 10px; border: 1.5px solid #eee; border-radius: 10px; outline: none; font-size: 0.9em; }
input:focus, select:focus, textarea:focus { border-color: var(--primary-blue); }

#modal-target-area { height: 42px; transition: all 0.2s ease-in-out; cursor: pointer; overflow-y: hidden; background-color: #fff; border: 1.5px solid #eee; display: block; }
#modal-target-area:focus { height: 150px; overflow-y: auto; border-color: var(--primary-blue); box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
#modal-target-area:not(:focus) { scrollbar-width: none; }

/* --- JANELA DE CONFIRMAÇÃO (CORREÇÃO CENTRO) --- */
#confirmModal {
    /* Ativar flexbox apenas neste modal para centrar no ecrã */
    display: none; 
    align-items: center;
    justify-content: center;
}

#confirmModal .modal-content {
    background: #FFFFFF !important; /* FUNDO BRANCO */
    margin: auto !important;         /* RESET DAS MARGENS */
    padding: 40px; 
    border-radius: 20px; 
    width: 90%; 
    max-width: 500px; 
    box-shadow: 0 15px 50px rgba(0,0,0,0.3);
    text-align: center;
}

#confirmModal h2 {
    color: var(--primary-blue) !important;
    margin-bottom: 25px;
}

#confirmModal #confirmMessage {
    font-weight: 600;
    color: #495057;
    margin-bottom: 30px;
}

/* --- SUBTAREFAS --- */
.subtasks-section { margin-top: 10px; }
.subtasks-list { list-style: none; margin-top: 10px; display: flex; flex-wrap: wrap; gap: 10px; }
.subtask-item { margin-bottom: 6px !important; display: flex; gap: 5px; width: 100%; }
.subtask-item input, .subtask-item select { padding: 6px 10px !important; font-size: 0.9em !important; height: auto !important; }
.btn-add-subtask { background: var(--primary-blue); color: white; padding: 8px 15px; border-radius: 10px; border: none; cursor: pointer; font-size: 0.8em; }
.btn-remove-subtask { background: #ff6b6b; color: white; padding: 6px 10px !important; border-radius: 8px; border: none; cursor: pointer; font-size: 0.8em !important; height: auto !important; }

/* --- ESTILOS DOS CARTÕES E SUB-TAREFAS NO CARTÃO --- */
.subtasks-details { 
    display: none; /* ESCONDIDO POR DEFEITO */
    margin-top: 10px; border-top: 1px solid #eee; padding-top: 10px; 
}
.subtasks-progress { 
    font-size: 0.85em; color: #495057; cursor: pointer; padding: 5px 0; transition: color 0.2s; 
    pointer-events: auto !important; position: relative; z-index: 10; 
}
.subtasks-progress:hover { color: var(--primary-blue); }
.subtask-card { display: flex; justify-content: space-between; align-items: center; padding: 2px 0; border-bottom: 1px dashed #eee; }
.subtask-desc { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; font-size: 0.85em; color: #495057; margin-right: 10px; }
.subtask-status { width: 120px; pointer-events: auto !important; cursor: pointer; padding: 2px 6px !important; height: auto !important; min-height: 24px !important; font-size: 0.8em !important; border-radius: 6px !important; }

/* --- BOTÕES DO RODAPÉ (MODAL HORIZONTAL) --- */
#modal-actions {
    display: flex; justify-content: flex-end; gap: 15px; margin-top: 25px; 
    border-top: 1px solid #f1f3f5; padding-top: 20px;
}

.btn-modal-save {
    padding: 10px 40px; border: none; border-radius: 8px; cursor: pointer;
    font-weight: bold; color: white;
    background-color: var(--btn-save-green) !important; /* VERDE */
    font-size: 1em;
}

.btn-modal-cancel {
    padding: 10px 30px; border: none; border-radius: 8px; cursor: pointer;
    font-weight: bold; color: white;
    background-color: var(--btn-cancel-grey) !important; /* CINZA */
    font-size: 1em;
}

.confirm-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 25px;
}

.btn-confirm-yes {
    background-color: #ff6b6b !important; /* Coral/Vermelho */
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

.btn-confirm-no {
    background-color: #707a83 !important; /* Cinzento */
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}





/* --- RELATÓRIO --- */
.report-header { background: white; padding: 20px; border-radius: 15px; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 3px solid var(--primary-blue); box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.report-box { background: white; border-radius: 12px; border: 1px solid #dee2e6; overflow: hidden; box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
.rb-header { padding: 12px 15px; font-weight: 800; font-size: 0.95em; text-transform: uppercase; border-bottom: 1px solid rgba(0,0,0,0.1); display: flex; align-items: center; gap: 8px; }
.rb-content { padding: 15px; min-height: 200px; max-height: 500px; overflow-y: auto; }
.box-red { border-top: 4px solid #ff6b6b; background: #fff5f5; } .box-red .rb-header { color: #c92a2a; background: #ffe3e3; }
.box-green { border-top: 4px solid #51cf66; background: #f4fce3; } .box-green .rb-header { color: #2b8a3e; background: #d3f9d8; }
.box-blue { border-top: 4px solid #339af0; background: #e7f5ff; } .box-blue .rb-header { color: #1864ab; background: #d0ebff; }
.box-gray { border-top: 4px solid #868e96; background: #f8f9fa; } .box-gray .rb-header { color: #343a40; background: #e9ecef; }
.box-purple { border-top: 4px solid #845ef7; background: #f3f0ff; } .box-purple .rb-header { color: #5f3dc4; background: #e5dbff; }
.rep-sector-group { margin-bottom: 15px; }
.rep-sector-title { font-size: 0.7em; font-weight: bold; color: #adb5bd; text-transform: uppercase; margin-bottom: 5px; border-bottom: 1px solid rgba(0,0,0,0.05); }
.rep-item { background: rgba(255,255,255,0.6); padding: 6px 10px; margin-bottom: 4px; border-radius: 6px; font-size: 0.75em; display: flex; justify-content: space-between; align-items: center; border: 1px solid rgba(0,0,0,0.05); }
.rep-item strong { color: #333; flex: 1; margin-right: 10px; }
.rep-tag { padding: 2px 6px; border-radius: 4px; font-size: 0.9em; font-weight: bold; margin-left: 5px; }
.tag-atraso { background: #ffc9c9; color: #c92a2a; } .tag-critico { background: #ffec99; color: #e67700; } .tag-data { color: #868e96; font-size: 0.9em; }
.rb-content-row { display: flex; flex-wrap: wrap; gap: 15px; padding: 15px; }
.rep-next-col { flex: 1; min-width: 200px; background: white; padding: 10px; border-radius: 8px; border: 1px solid #e5dbff; }
/*.rep-item span {font-size: 0.9em !important;   /* Controla o tamanho do texto entre parênteses */ /*margin-left: 10px;*/
/* --- POPUPS (TOOLTIPS) --- */
.custom-tooltip {
    visibility: hidden; opacity: 0; width: max-content; min-width: 160px; max-width: 280px;
    background-color: #2C3E50; color: #fff; text-align: left;
    border-radius: 8px; padding: 10px 12px;
    position: absolute; top: 125%; bottom: auto; left: 50%; transform: translateX(-50%);
    font-size: 0.8rem; font-weight: normal; white-space: pre-wrap;
    box-shadow: 0 10px 20px rgba(0,0,0,0.25); pointer-events: none;
    transition: opacity 0.2s, top 0.2s; z-index: 99999; border: 1px solid #34495e;
}
.custom-tooltip::after {
    content: ""; position: absolute; bottom: 100%; left: 50%; margin-left: -6px;
    border-width: 6px; border-style: solid; border-color: transparent transparent #2C3E50 transparent;
}
.description-tooltip { background-color: #fff; color: #333; border: 1px solid #dee2e6; }
.description-tooltip::after { border-color: transparent transparent #fff transparent; }

.shared-badge:hover .custom-tooltip,
.card-assunto:hover .custom-tooltip,
.kb-subject:hover .custom-tooltip {
    visibility: visible; opacity: 1; top: 115%;
}

.card-assunto .description-tooltip, .kb-subject .description-tooltip {
    top: 100% !important; bottom: auto !important; left: 0 !important; transform: none !important;
    margin-top: 8px; width: 300px; max-width: 90vw; white-space: normal; text-align: left; z-index: 99999;
    background-color:#1D82AF; color: #fff;
}
.card-assunto .description-tooltip::after, .kb-subject .description-tooltip::after {
    left: 20px !important; margin-left: 0 !important; border-color: transparent transparent #fff transparent;
}

/* Aumentar o título específico do relatório */
#report-view h2 {
    font-size: 2.5em !important; /* Aumente este valor conforme desejar (ex: 3em para ser maior) */
    font-weight: 800;             /* Torna a letra mais espessa */
    margin-bottom: 5px;          /* Espaço para a data por baixo */
    color: var(--bg-header);     /* Mantém a cor azul escura profissional */
}


/*
@media print {
    header, .header-actions, .btn-main, .search-wrapper, nav { display: none !important; }
    body { background: white; padding: 0; }
    #content-wrapper {
    transition: all 0.2s ease-out;
    transform-origin: top center; /* Garante que o zoom parta do topo centralizado */
    width: 100%;
    margin: 0 auto;
}
    .report-view { display: block !important; }
    .report-grid { display: grid !important; grid-template-columns: 1fr 1fr !important; page-break-inside: avoid; }
    .report-box { page-break-inside: avoid; border: 1px solid #ccc !important; box-shadow: none !important; }
    .rb-content { max-height: none !important; overflow: visible !important; }
}
*/

@media print {
    /* Esconder elementos desnecessários */
    header, .header-actions, .btn-main, .search-wrapper, nav, #relogio-topo { 
        display: none !important; 
    }

    body { 
        background: white !important; 
        padding: 0 !important; 
        margin: 0 !important;
    }

    /* Forçar o contentor a ocupar o topo da página */
    #content-wrapper { 
        transform: none !important; 
        width: 100% !important; 
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Título do Relatório: Evitar que fique sozinho numa página */
    .report-header { 
        display: flex !important;
        page-break-after: avoid !important; /* IMPORTANTE: Impede quebra após o título */
        break-after: avoid !important;
        margin-bottom: 20px !important;
    }

    /* Grelha de Dados */
    .report-grid { 
        display: grid !important; 
        grid-template-columns: 1fr 1fr !important; 
        gap: 15px !important;
        page-break-inside: auto !important;
    }

    /* Caixas Individuais: Impedir que uma caixa se parta ao meio entre páginas */
    .report-box { 
        page-break-inside: avoid !important; 
        break-inside: avoid !important;
        border: 1px solid #ccc !important; 
        margin-bottom: 10px !important;
        box-shadow: none !important; 
    }

    .rb-content { 
        max-height: none !important; 
        overflow: visible !important; 
    }
}

/* --- FIXAR TOPO DO RELATÓRIO NO ECRÃ --- */
.report-header { 
    background: white; 
    padding: 20px; 
    border-radius: 15px; 
    margin-bottom: 20px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 3px solid var(--primary-blue); 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);

    /* NOVAS PROPRIEDADES PARA FIXAR */
    position: sticky;
    top: 0;           /* Cola ao topo do ecrã */
    z-index: 9999;    /* Fica por cima do header principal (9000) */
}

/* Garantir que o fundo do relatório não fica transparente ao fazer scroll */
#report-view {
    background-color: var(--bg-body);
    padding-top: 10px;
}

/* --- MANTER COMPORTAMENTO NORMAL NA IMPRESSÃO --- */
@media print {
    .report-header { 
        position: static !important; /* Remove a fixação no papel/PDF */
        box-shadow: none !important;
        padding: 10px 0 !important;
        margin-bottom: 20px !important;
    }
    
    /* Garante que o conteúdo não salta para cima do cabeçalho no PDF */
    #content-wrapper { 
        position: relative !important;
    }
}

/* Indicação visual de perfil no seletor */
.user-selector-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.1);
    padding: 5px 15px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.2);
}

/* Quando o utilizador é de consulta, podemos mudar a cor do relógio para avisar */
body[data-perfil="consulta"] #relogio-topo {
    background: #ffc9c9;
    color: #c92a2a;
}

/* AJUSTE DA CAIXA DE PERFIL PARA NO MÁXIMO 8CM */
.user-selector-wrapper {
    position: absolute !important;
    top: 15px !important;
    left: 20px !important;
    display: inline-flex !important;
    align-items: center !important;
    background: rgba(255, 255, 255, 0.15) !important;
    padding: 8px 12px !important;
    border-radius: 12px !important; /* Border-radius pequeno conforme solicitado */
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    z-index: 9500 !important;
    
    /* Limite de largura de 8cm (aprox. 302px) */
    max-width: 8cm !important; 
    width: auto !important;
    overflow: hidden !important;
}

.user-selector-wrapper label {
    color: white !important;
    font-size: 0.75em !important; /* Texto ligeiramente menor para caber */
    margin-right: 5px !important;
    font-weight: bold !important;
    white-space: nowrap !important;
}

#global-user-selector {
    background: white !important;
    border: none !important;
    padding: 8px 12px !important;
    border-radius: 12px !important;
    font-size: 0.8em !important;
    cursor: pointer !important;
    outline: none !important;
    
    /* O seletor ocupa o espaço restante até ao limite de 8cm */
    flex: 1 !important;
    min-width: 100px !important;
    max-width: 100% !important;
}

/* --- NOVOS ESTILOS PARA SUBTAREFAS RICAS --- */
.subtask-item {
    flex-direction: column !important; /* Muda para coluna para acomodar a gaveta */
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 5px;
    transition: all 0.2s;
}

.subtask-header {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.btn-toggle-details {
    background: none;
    border: none;
    color: var(--primary-blue);
    cursor: pointer;
    font-size: 0.9em;
    padding: 5px;
    transition: transform 0.2s;
}

.btn-toggle-details.expanded {
    transform: rotate(180deg);
}

.subtask-details-panel {
    display: none; /* Escondido por defeito */
    width: 100%;
    padding: 10px 5px 5px 35px; /* Indentação para ficar alinhado */
    border-top: 1px solid #dee2e6;
    margin-top: 5px;
    gap: 10px;
    flex-wrap: wrap;
}

.subtask-row-detail {
    display: flex;
    gap: 10px;
    width: 100%;
}

.subtask-obs {
    width: 100%;
    min-height: 40px;
    font-size: 0.85em;
    resize: vertical;
}

/* Pequeno ajuste nos inputs da subtarefa para caberem melhor */
.subtask-header input[type="text"] { font-weight: 600; color: #333; }
.subtask-resp { flex: 1; font-size: 0.85em !important; }
.subtask-date { width: 140px !important; font-size: 0.85em !important; }



.toast {
position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #69db7c; /* Verde sucesso, como nas tarefas concluídas */
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    font-size: 1em;
    font-weight: bold;
    z-index: 1000; /* Acima de tudo */
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.toast-success-slide.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* Ícone maior e com margem */
.toast-success-slide i {
    margin-right: 10px;
    font-size: 1.2em;
}

/* Para ficar mais "cortina" (opcional: sombra mais suave e fundo ligeiramente transparente) */
.toast-success-slide::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(255,255,255,0.1), transparent);
    border-radius: 6px 6px 0 0;
    pointer-events: none;
}


.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #69db7c; /* Verde sucesso, como nas tarefas concluídas */
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    font-size: 1em;
    font-weight: bold;
    z-index: 1000; /* Acima de tudo */
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.toast.show {
    opacity: 1;
}

.toast i {
    margin-right: 8px;
}