:root {
    --azul-escuro: #0d2b5e;
    --azul: #1a4ba3;
    --azul-claro: #3b82f6;
    --ciano: #00c6e0;
    --ciano-claro: #4dd9ec;
    --verde: #22c55e;
    --amarelo: #fbbf24;
    --vermelho: #ef4444;
    --cinza: #f0f0f0;
    --branco: #ffffff;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    background-color: #f4f6f9;
    margin: 0;
    padding: 20px;
    color: #1f2937;
}

/* ---- Header ---- */
.header {
    background: linear-gradient(120deg, var(--azul-escuro), var(--azul));
    color: var(--branco);
    padding: 15px 25px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(13, 43, 94, 0.25);
}
.header-titulo { display: flex; align-items: center; gap: 12px; }
.header-logo { height: 32px; }
.header h2 { margin: 0; font-weight: 600; }
.header-botoes { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.usuario-logado { color: rgba(255,255,255,0.8); font-size: 13px; margin-right: 8px; }
.subtitulo-linha { font-size: 13px; color: #cfe0ff; margin-top: 6px; }
.tag-somente-leitura {
    background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.4); color: white;
    font-size: 11px; font-weight: bold; padding: 3px 8px; border-radius: 10px; text-transform: uppercase;
}
.separador { color: rgba(255,255,255,0.3); margin: 0 5px; }

.barra-geral-container {
    width: 160px; background: rgba(0,0,0,0.3); height: 18px; border-radius: 10px;
    overflow: hidden; position: relative; border: 1px solid rgba(255,255,255,0.4);
}
#barra-progresso-geral { width: 0%; height: 100%; background: var(--verde); transition: width 0.3s; }
#texto-progresso-geral {
    position: absolute; width: 100%; text-align: center; top: 1px; font-size: 11px;
    font-weight: bold; color: white; text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

/* ---- Botões ---- */
button {
    background-color: var(--azul-claro); color: white; border: none; padding: 8px 14px;
    border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 13px; transition: 0.15s;
}
button:hover { filter: brightness(1.08); }
button.sucesso { background-color: var(--verde); }
button.voltar { background-color: #6c757d; }
button.marco { background-color: #9b59b6; }
button.excel { background-color: #207245; }
button.pdf { background-color: #c0392b; }
button.gantt { background-color: var(--ciano); color: #0d2b5e; }
button.acao { padding: 4px 8px; font-size: 12px; margin: 2px 0; width: 100%; border-radius: 4px; }
button.excluir { background-color: var(--vermelho); }

/* ---- Login ---- */
body.tela-login {
    display: flex; align-items: center; justify-content: center; min-height: 100vh;
    background: radial-gradient(circle at top, var(--azul), var(--azul-escuro));
}
.login-box {
    background: rgba(255,255,255,0.06); backdrop-filter: blur(6px); padding: 40px 36px;
    border-radius: 14px; width: 320px; text-align: center; color: white;
    box-shadow: 0 8px 30px rgba(0,0,0,0.35); border: 1px solid rgba(255,255,255,0.15);
}
.login-logo { height: 56px; margin-bottom: 12px; }
.login-box h1 { margin: 0; font-size: 24px; }
.login-box .subtitulo { color: var(--ciano-claro); font-size: 13px; margin-top: 2px; margin-bottom: 20px; }
.login-box label { display: block; text-align: left; font-size: 13px; margin: 12px 0 4px; color: #dce6ff; }
.login-box input {
    width: 100%; padding: 9px 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1); color: white; font-size: 14px;
}
.login-box input:focus { outline: 2px solid var(--ciano); }
.login-box button { width: 100%; margin-top: 18px; background: var(--ciano); color: var(--azul-escuro); padding: 10px; }
.alerta-erro {
    background: rgba(239, 68, 68, 0.15); border: 1px solid var(--vermelho); color: #fecaca;
    padding: 8px 10px; border-radius: 6px; font-size: 13px; margin-top: 12px;
}

.login-box select {
    width: 100%; padding: 9px 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1); color: white; font-size: 14px;
}
.login-box select:focus { outline: 2px solid var(--ciano); }
.login-box select option { color: #111; background: white; }

/* ---- Grid de projetos ---- */
.grid-projetos { display: flex; gap: 15px; flex-wrap: wrap; }
.card-projeto {
    background: white; padding: 20px; border-radius: 10px; width: 260px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1); cursor: pointer; border-top: 4px solid var(--azul-escuro);
    transition: 0.2s; position: relative;
}
.card-projeto:hover { transform: translateY(-3px); box-shadow: 0 6px 14px rgba(0,0,0,0.15); }
.card-projeto h3 { margin: 6px 0 6px 0; color: var(--azul-escuro); font-size: 18px; }
.card-projeto p { margin: 0; font-size: 13px; color: #555; }
.tag-equipe { display: inline-block; background: var(--cinza); padding: 3px 8px; border-radius: 10px; font-size: 11px; font-weight: bold; }
.tag-status {
    position: absolute; top: 15px; right: 15px; padding: 3px 8px; border-radius: 4px;
    font-size: 10px; font-weight: bold; color: white; text-transform: uppercase;
}
.status-aberto { background-color: #17a2b8; }
.status-andamento { background-color: var(--amarelo); color: #000; }
.status-concluido { background-color: var(--verde); }
.status-cancelado { background-color: var(--vermelho); }
.barra-mini { width: 100%; background: #e9ecef; height: 8px; border-radius: 4px; overflow: hidden; margin: 10px 0 8px; }
.barra-mini div { height: 100%; background: var(--verde); }
.card-rodape { display: flex; justify-content: space-between; align-items: center; }
.progresso-numero { font-size: 11px; font-weight: bold; color: var(--azul-escuro); }

/* ---- Tabela do cronograma ---- */
.tabela-container { overflow-y: auto; max-height: calc(100vh - 120px); border: 1px solid #ccc; border-radius: 6px; }
table { width: 100%; border-collapse: collapse; background: white; font-size: 12px; }
th { background: var(--azul-escuro); color: white; padding: 8px; text-align: left; position: sticky; top: 0; z-index: 10; }
td { padding: 4px; border-bottom: 1px solid var(--cinza); vertical-align: middle; transition: background-color 0.3s; }
input, select { width: 100%; padding: 5px; border: 1px solid #ccc; border-radius: 4px; }
.col-id { width: 40px; } .col-acoes { width: 70px; } .col-tarefa { min-width: 250px; }
.col-curta input { width: 50px; text-align: center; } .col-data input { width: 120px; }
input.progresso-input { width: 60px; font-weight: bold; text-align: center; border: 1px solid #aaa; }
.progresso-visual-marco {
    position: relative; width: 60px; background: #e9ecef; border-radius: 4px; text-align: center;
    overflow: hidden; display: inline-block; padding: 4px 0; border: 1px solid #ccc;
}
.barra-preenchimento { position: absolute; top: 0; left: 0; height: 100%; background: var(--verde); z-index: 1; opacity: 0.5; }
.texto-percentual { position: relative; z-index: 2; font-weight: bold; font-size: 12px; color: var(--azul-escuro); }
.duracao-visual-marco { font-weight: bold; color: var(--azul-escuro); font-size: 14px; text-align: center; display: block; }
tr.is-marco { background-color: #cfe0ff !important; }
tr.is-marco input.tarefa { font-weight: bold; color: var(--azul-escuro); background: transparent; border: none; font-size: 14px; }
tr.is-marco .td-id { font-weight: bold; color: var(--azul-escuro); }
tr.is-marco .hide-on-marco { visibility: hidden; }
tr.linha-concluida td { background-color: #d4edda !important; border-bottom: 1px solid #c3e6cb; }
tr.linha-concluida input:not(.progresso-input) { background: transparent !important; color: #155724 !important; border-color: transparent !important; font-weight: bold; }
tr.linha-concluida .acao.excluir { display: none; }
tr.is-marco.linha-concluida td { background-color: #a8d6b4 !important; }
tr.is-marco.linha-concluida input.tarefa, tr.is-marco.linha-concluida .td-id,
tr.is-marco.linha-concluida .duracao-visual-marco, tr.is-marco.linha-concluida .texto-percentual { color: #0f401b !important; }

/* ---- Modais ---- */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(13,43,94,0.55); z-index: 1000; align-items: center; justify-content: center;
}
.modal-content { background: white; padding: 25px; border-radius: 10px; width: 350px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
.modal-content h3 { margin-top: 0; color: var(--azul-escuro); }
.modal-content label { display: block; font-weight: bold; margin-top: 10px; font-size: 13px; color: var(--azul-escuro); }
.modal-content input, .modal-content select { margin-top: 5px; margin-bottom: 10px; }
.modal-botoes { display: flex; justify-content: flex-end; gap: 10px; margin-top: 15px; }
.modal-gantt-content {
    background: white; padding: 20px; border-radius: 10px; width: 95%; max-width: 1400px; height: 90vh;
    display: flex; flex-direction: column; box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.gantt-header-modal { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--azul-escuro); padding-bottom: 10px; margin-bottom: 10px; }
.gantt-header-modal h2 { color: var(--azul-escuro); margin: 0; }
.gantt-body { flex-grow: 1; overflow: hidden; display: flex; flex-direction: column; }

#statusProjetoAtual {
    background: rgba(255,255,255,0.15); color: white; border: 1px solid rgba(255,255,255,0.5);
    padding: 3px 8px; border-radius: 4px; font-weight: bold; cursor: pointer; width: auto;
}
#statusProjetoAtual option { color: black; }
body.modal-open { overflow: hidden; }
#indicador-salvamento { font-size: 13px; font-weight: bold; margin-left: 10px; color: #cfe0ff; min-width: 90px; text-align: center; }

/* ---- Gestão de usuários ---- */
.painel-usuarios { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.card-novo-usuario {
    background: white; padding: 20px; border-radius: 10px; width: 280px; flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.card-novo-usuario h3 { margin-top: 0; color: var(--azul-escuro); }
.card-novo-usuario label { display: block; font-weight: bold; margin-top: 10px; font-size: 13px; color: var(--azul-escuro); }
.lista-usuarios { flex-grow: 1; min-width: 320px; }
.lista-usuarios h3 { color: var(--azul-escuro); margin-top: 0; }
.card-usuario {
    background: white; padding: 16px 20px; border-radius: 10px; margin-bottom: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.card-usuario-cabecalho { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.card-usuario-cabecalho strong { color: var(--azul-escuro); font-size: 15px; }
.card-usuario .nome-completo { color: #666; font-size: 13px; }
.acao-inline { padding: 4px 10px; font-size: 12px; }
.tabela-permissoes { width: 100%; font-size: 13px; }
.tabela-permissoes th { background: var(--cinza); color: var(--azul-escuro); padding: 6px; position: static; }
.tabela-permissoes td { padding: 6px; border-bottom: 1px solid var(--cinza); }
