/* =========================================================================
   Mec-Projects – Mectrol
   Cores em variáveis: o modo noturno (html[data-tema="escuro"]) só troca
   os valores.
   ========================================================================= */
:root {
  color-scheme: light;
  --fundo: #f3f5f8;
  --painel: #ffffff;
  --painel-2: #f8fafc;
  --campo: #ffffff;
  --hover: #f5f9ff;
  --coluna: #e9eef5;
  --borda: #e2e8f0;
  --borda-forte: #cbd5e1;
  --texto: #0f172a;
  --texto-2: #475569;
  --texto-3: #94a3b8;
  --lateral: #0f1e33;
  --lateral-2: #17304f;
  --lateral-texto: #c7d2e1;
  --primaria: #1d4ed8;
  --primaria-forte: #1e40af;
  --primaria-clara: #e0e9ff;
  --next: #6d28d9;
  --ok: #15803d;      --ok-fundo: #dcfce7;    --ok-forte: #15803d;
  --alerta: #b45309;  --alerta-fundo: #fef3c7;
  --erro: #b91c1c;    --erro-fundo: #fee2e2;  --erro-forte: #b91c1c;  --erro-borda: #fca5a5;
  --info: #0e7490;    --info-fundo: #cffafe;
  --neutro: #475569;  --neutro-fundo: #e2e8f0;
  --toast: #0f172a;
  --raio: 8px;
  --sombra: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
  --sombra-alta: 0 10px 30px rgba(15, 23, 42, .18);
  --fonte: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

/* ---------- Modo noturno ---------- */
html[data-tema="escuro"] {
  color-scheme: dark;
  --fundo: #0e1420;
  --painel: #161f2e;
  --painel-2: #1b2638;
  --campo: #101826;
  --hover: #1d2a3e;
  --coluna: #121b29;
  --borda: #273549;
  --borda-forte: #36475f;
  --texto: #e6ecf4;
  --texto-2: #a7b4c6;
  --texto-3: #6e7e95;
  --lateral: #0a0f19;
  --lateral-2: #17243a;
  --lateral-texto: #b6c3d6;
  --primaria: #5b8cff;
  --primaria-forte: #2f5fd8;
  --primaria-clara: #1d2b4d;
  --next: #c4a5ff;
  --ok: #4ade80;      --ok-fundo: #11301f;    --ok-forte: #15803d;
  --alerta: #fbbf24;  --alerta-fundo: #36290b;
  --erro: #f87171;    --erro-fundo: #3a1618;  --erro-forte: #b91c1c;  --erro-borda: #7f2a2a;
  --info: #22d3ee;    --info-fundo: #0d2e37;
  --neutro: #b3bfcf;  --neutro-fundo: #243246;
  --toast: #05080d;
  --sombra: 0 1px 2px rgba(0, 0, 0, .3);
  --sombra-alta: 0 10px 30px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--fonte); font-size: 14px; color: var(--texto);
  background: var(--fundo); line-height: 1.45;
}
a { color: var(--primaria); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
code, .mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12.5px; }
.next { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; color: var(--next); font-weight: 600; }

/* ---------- Estrutura ---------- */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.lateral {
  background: var(--lateral); color: var(--lateral-texto);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.marca { padding: 18px 18px 14px; border-bottom: 1px solid var(--lateral-2); }
.marca b { display: block; color: #fff; font-size: 17px; letter-spacing: .3px; }
.marca span { font-size: 12px; opacity: .75; }
.menu { padding: 10px 8px; flex: 1; overflow-y: auto; }
.menu .grupo { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; opacity: .55; padding: 12px 10px 4px; }
.menu a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px;
  color: var(--lateral-texto); font-size: 13.5px;
}
.menu a:hover { background: var(--lateral-2); text-decoration: none; color: #fff; }
.menu a.ativo { background: #1d4ed8; color: #fff; }
.menu .ico { width: 18px; text-align: center; opacity: .9; }
.menu .contador { margin-left: auto; background: #ef4444; color: #fff; border-radius: 10px; font-size: 11px; padding: 0 7px; }
.rodape-lateral { padding: 10px 16px 12px; font-size: 11.5px; border-top: 1px solid var(--lateral-2); }
.rodape-lateral > div { opacity: .7; margin-top: 6px; }
.btn-tema {
  background: none; border: 1px solid var(--lateral-2); color: var(--lateral-texto); border-radius: 6px;
  font: inherit; font-size: 12px; padding: 4px 10px; cursor: pointer; width: 100%; text-align: left;
}
.btn-tema:hover { background: var(--lateral-2); color: #fff; }

.principal { min-width: 0; display: flex; flex-direction: column; }
.topo {
  display: flex; align-items: center; gap: 12px; padding: 10px 24px;
  background: var(--painel); border-bottom: 1px solid var(--borda); position: sticky; top: 0; z-index: 5;
}
.topo .titulo { flex: 1; min-width: 0; }
.topo .titulo small { color: var(--texto-2); }
.usuario { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.usuario .nome { font-weight: 600; }
.aviso-modo {
  background: var(--alerta-fundo); color: var(--alerta); font-size: 12px; padding: 3px 10px; border-radius: 20px;
}
.conteudo { padding: 20px 24px 40px; }

/* ---------- Componentes ---------- */
.cartao {
  background: var(--painel); border: 1px solid var(--borda); border-radius: var(--raio);
  box-shadow: var(--sombra);
}
.cartao > .cab {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--borda); flex-wrap: wrap;
}
.cartao > .cab h2, .cartao > .cab h3 { flex: 1; min-width: 160px; }
.cartao > .corpo { padding: 16px; }
.cartao > .corpo.sem-pad { padding: 0; }
.pe-cartao { padding: 12px 16px; border-top: 1px solid var(--borda); }

.grade { display: grid; gap: 16px; }
.grade > * { min-width: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mt { margin-top: 16px; }
.mt-p { margin-top: 8px; }
.mb { margin-bottom: 16px; }
.linha { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.espaco { flex: 1; }
.suave { color: var(--texto-2); }
.fraco { color: var(--texto-3); }
.peq { font-size: 12px; }
.direita { text-align: right; }
.nowrap { white-space: nowrap; }
.oculto { display: none !important; }

.faixa-alerta { background: var(--alerta-fundo); color: var(--alerta); padding: 8px 12px; border-radius: 6px; font-size: 13px; }
.faixa-alerta a { color: inherit; text-decoration: underline; font-weight: 600; }
.faixa-info { background: var(--info-fundo); color: var(--info); padding: 8px 12px; border-radius: 6px; font-size: 13px; }
.caixa-info { background: var(--primaria-clara); border: 1px solid var(--primaria); color: var(--texto); padding: 10px 12px; border-radius: 6px; font-size: 13px; }
.valor-fixo { padding: 7px 0; font-weight: 600; }

/* Indicadores */
.kpi { padding: 14px 16px; }
.kpi .rot { font-size: 12px; color: var(--texto-2); text-transform: uppercase; letter-spacing: .4px; }
.kpi .val { font-size: 26px; font-weight: 700; margin-top: 2px; }
.kpi .sub { font-size: 12px; color: var(--texto-2); }
.kpi.erro .val { color: var(--erro); }
.kpi.alerta .val { color: var(--alerta); }
.kpi.ok .val { color: var(--ok); }
a.kpi { color: inherit; display: block; }
a.kpi:hover { text-decoration: none; border-color: var(--borda-forte); }

/* Botões */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--borda-forte);
  background: var(--painel); color: var(--texto); padding: 7px 12px; border-radius: 6px;
  font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--painel-2); text-decoration: none; }
.btn.prim { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.btn.prim:hover { background: #1e40af; }
.btn.perigo { color: var(--erro); border-color: var(--erro-borda); }
.btn.perigo:hover { background: var(--erro-fundo); }
.btn.ok { background: var(--ok-forte); border-color: var(--ok-forte); color: #fff; }
.btn.peq { padding: 3px 8px; font-size: 12px; }
.btn.link { border: none; background: none; color: var(--primaria); padding: 2px 4px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Formulários */
.campo { display: flex; flex-direction: column; gap: 4px; }
.campo label { font-size: 12px; font-weight: 600; color: var(--texto-2); }
.campo .ajuda, .ajuda { font-size: 11.5px; color: var(--texto-3); }
input[type=text], input[type=date], input[type=number], input[type=search], select, textarea {
  font: inherit; font-size: 13.5px; border: 1px solid var(--borda-forte); border-radius: 6px;
  padding: 7px 9px; background: var(--campo); color: var(--texto); width: 100%;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primaria-clara); border-color: var(--primaria); }
input:disabled, select:disabled, textarea:disabled { background: var(--painel-2); color: var(--texto-2); }
.form-grade { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; }
.form-grade .s2 { grid-column: span 2; }
.form-grade .s3 { grid-column: span 3; }
.form-grade .s4 { grid-column: span 4; }
.filtros { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filtros input, .filtros select { width: auto; min-width: 150px; max-width: 280px; }
.filtros input[type=search] { min-width: 260px; }
.filtros input[type=checkbox], .linha input[type=checkbox] { min-width: 0; width: auto; margin: 0; }

/* Linha "+ Incluir…" em listas vazias */
.linha-incluir {
  display: block; width: calc(100% - 24px); margin: 12px; padding: 12px 14px; text-align: left;
  border: 1px dashed var(--borda-forte); border-radius: 6px; background: var(--painel-2); color: var(--primaria);
  font: inherit; font-weight: 600; cursor: pointer;
}
.linha-incluir:hover { background: var(--hover); border-color: var(--primaria); }
.anexos-parte { margin-top: 6px; }
.lista-escolha { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.lista-escolha label { padding: 6px 8px; border: 1px solid var(--borda); border-radius: 6px; cursor: pointer; }
.lista-escolha label:hover { background: var(--hover); }
.ajuda-texto p { margin: 0 0 10px; }
.ajuda-texto p:last-child { margin-bottom: 0; }
.info-termo { font-size: 13px; margin-left: 4px; color: var(--texto-3); font-weight: 400; cursor: help; }
.info-termo:hover { color: var(--primaria); text-decoration: none; }

/* Links e arquivos */
.links { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; }
.lnk { white-space: nowrap; }
.links-projeto { font-size: 13px; }
.editor-links { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.linha-link { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; gap: 6px; width: 100%; }
.lista-anexos { list-style: none; margin: 0; padding: 0; }
.lista-anexos li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--borda); }
.lista-anexos li:last-child { border-bottom: none; }
.lista-anexos .ico { font-size: 18px; }
.lista-anexos .info { flex: 1; min-width: 0; word-break: break-word; }

/* Tabelas */
.tabela-wrap { overflow-x: auto; }
table.tabela { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabela th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--texto-2); background: var(--painel-2); padding: 8px 10px; border-bottom: 1px solid var(--borda);
  white-space: nowrap; position: sticky; top: 0;
}
.tabela td { padding: 8px 10px; border-bottom: 1px solid var(--borda); vertical-align: middle; }
.tabela tr:last-child td { border-bottom: none; }
.tabela tr.clicavel { cursor: pointer; }
.tabela tr.clicavel:hover td { background: var(--hover); }
.tabela tr.sub td { background: var(--painel-2); }
.tabela tr.linha-atual td { background: var(--hover); }
.tabela th.ord { cursor: pointer; }
.tabela th.ord:hover { color: var(--texto); }
.vazio { padding: 28px; text-align: center; color: var(--texto-3); }

/* Selos */
.selo {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--neutro-fundo); color: var(--neutro);
}
.selo.ok { background: var(--ok-fundo); color: var(--ok); }
.selo.alerta { background: var(--alerta-fundo); color: var(--alerta); }
.selo.erro { background: var(--erro-fundo); color: var(--erro); }
.selo.info { background: var(--info-fundo); color: var(--info); }
.selo.prim { background: var(--primaria-clara); color: var(--primaria); }
.dep {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; white-space: nowrap;
}
.dep::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--cor, #94a3b8); }

/* Barra de progresso */
.prog { height: 6px; background: var(--borda); border-radius: 4px; overflow: hidden; min-width: 60px; }
.prog > i { display: block; height: 100%; background: var(--primaria); border-radius: 4px; }
.prog.ok > i { background: var(--ok); }
.prog-rot { display: flex; align-items: center; gap: 8px; }
.prog-rot .prog { flex: 1; }
.prog-rot span { font-size: 12px; color: var(--texto-2); width: 34px; text-align: right; }

/* Abas */
.abas { display: flex; gap: 2px; border-bottom: 1px solid var(--borda); margin-bottom: 16px; flex-wrap: wrap; }
.abas a {
  padding: 9px 14px; color: var(--texto-2); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500;
}
.abas a:hover { color: var(--texto); text-decoration: none; }
.abas a.ativo { color: var(--primaria); border-bottom-color: var(--primaria); }
.abas .n { font-size: 11px; background: var(--neutro-fundo); border-radius: 10px; padding: 0 6px; margin-left: 4px; }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(7, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.coluna { background: var(--coluna); border-radius: var(--raio); display: flex; flex-direction: column; min-height: 300px; }
.coluna .cab { padding: 10px 12px; display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; }
.coluna .cab small { margin-left: auto; color: var(--texto-2); font-weight: 400; }
.coluna .lista { padding: 0 8px 8px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.coluna.alvo { outline: 2px dashed var(--primaria); outline-offset: -2px; }
.card-k {
  background: var(--painel); border: 1px solid var(--borda); border-radius: 6px; padding: 10px; cursor: pointer;
  box-shadow: var(--sombra); border-left: 3px solid var(--borda-forte);
}
.card-k:hover { border-color: var(--borda-forte); }
.card-k[draggable=true] { cursor: grab; }
.card-k.atrasado { border-left-color: var(--erro); }
.card-k.risco, .card-k.atencao { border-left-color: var(--alerta); }
.card-k.vencendo { border-left-color: #eab308; }
.card-k.ok { border-left-color: var(--ok); }
.card-k .cod { font-size: 11.5px; color: var(--texto-2); }
.card-k .cod .next { font-size: 11px; }
.card-k .nome { font-weight: 600; margin: 2px 0 6px; }
.card-k .meta { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; color: var(--texto-2); margin-top: 6px; }

/* Etapas (linha do tempo da ficha) */
.trilha { display: flex; gap: 0; margin: 4px 0 16px; overflow-x: auto; }
.trilha .passo {
  flex: 1; min-width: 120px; text-align: center; font-size: 12px; color: var(--texto-3); position: relative; padding-top: 22px;
}
.trilha .passo::before {
  content: ""; position: absolute; top: 6px; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%;
  background: var(--borda-forte); z-index: 1;
}
.trilha .passo::after {
  content: ""; position: absolute; top: 11px; left: -50%; width: 100%; height: 2px; background: var(--borda-forte);
}
.trilha .passo:first-child::after { display: none; }
.trilha .passo.feito { color: var(--texto-2); }
.trilha .passo.feito::before, .trilha .passo.feito::after, .trilha .passo.atual::after { background: var(--ok); }
.trilha .passo.atual { color: var(--primaria); font-weight: 600; }
.trilha .passo.atual::before { background: var(--primaria); box-shadow: 0 0 0 4px var(--primaria-clara); }
.trilha .passo.perdido::before { background: var(--erro); }

/* Ficha */
.ficha-cab { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.ficha-cab .info { flex: 1; min-width: 260px; }
.ficha-cab .cod { color: var(--texto-2); font-size: 12.5px; }
.dados { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px 16px; }
.dados .d label { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--texto-3); }
.dados .d div { font-weight: 500; }

/* Lista de partes (elaboração, montagem) */
.check { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--borda); flex-wrap: wrap; }
.check:last-child { border-bottom: none; }
.check .num {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: var(--neutro-fundo); color: var(--neutro); flex: none;
}
.check.feito .num { background: var(--ok-forte); color: #fff; }
.check.atual .num { background: #1d4ed8; color: #fff; }
.check .nome { flex: 1; min-width: 180px; }

/* Tarefas do item (sequência) */
.passos { display: flex; gap: 3px; align-items: center; margin-bottom: 2px; }
.passos .seg { width: 16px; height: 7px; border-radius: 2px; background: var(--borda-forte); flex: none; }
.passos .seg.concluida { background: var(--ok); }
.passos .seg.atual { background: var(--primaria); box-shadow: 0 0 0 2px var(--primaria-clara); }
.passos .seg.atual.atrasado { background: var(--erro); box-shadow: 0 0 0 2px var(--erro-fundo); }
.passos .n { font-size: 11px; color: var(--texto-2); margin-left: 4px; }

/* Anotações */
.notas { display: flex; flex-direction: column; }
.nota { padding: 10px 0; border-bottom: 1px solid var(--borda); display: flex; gap: 10px; align-items: flex-start; }
.nota:last-child { border-bottom: none; }
.nota .quem { font-size: 12px; color: var(--texto-2); }
.nota .txt { white-space: pre-wrap; }
.nota.sistema .txt { color: var(--texto-2); font-size: 13px; }
.nota .ico {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--primaria-clara); color: var(--primaria); font-size: 12px; font-weight: 700;
}
.nota.sistema .ico { background: var(--neutro-fundo); color: var(--neutro); }
.nota-acao { flex: none; }

/* Modal */
.fundo-modal {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: flex; align-items: flex-start;
  justify-content: center; padding: 40px 16px; z-index: 50; overflow-y: auto;
}
.modal { background: var(--painel); border-radius: 10px; box-shadow: var(--sombra-alta); width: 100%; max-width: 640px; border: 1px solid var(--borda); }
.modal.largo { max-width: 1240px; }
#tab-tarefas td, #tab-tarefas th { padding: 6px 5px; }
#tab-tarefas [data-c=tipoId] { min-width: 175px; }
#tab-tarefas [data-c=dep] { min-width: 120px; }
#tab-tarefas [data-c=parceiroId] { min-width: 145px; }
#tab-tarefas [data-c=status] { min-width: 120px; }
#tab-tarefas [data-c=obs] { min-width: 110px; }
#tab-tarefas input[type=date] { min-width: 128px; }
#tab-modelos td { padding: 6px; }
.modal .cab { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--borda); }
.modal .cab h2 { flex: 1; }
.modal .corpo { padding: 18px; }
.modal .pe { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--borda); background: var(--painel-2); border-radius: 0 0 10px 10px; }
.fechar { background: none; border: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--texto-2); }

/* Mensagens rápidas (toast) */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast {
  background: var(--toast); color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--sombra-alta);
  font-size: 13px; max-width: 420px; animation: entra .2s ease-out; display: flex; align-items: center; gap: 12px;
  position: relative; overflow: hidden; border: 1px solid rgba(255, 255, 255, .08);
}
.toast.erro { background: var(--erro-forte); }
.toast-acao {
  background: #fff; color: #0f172a; border: none; border-radius: 5px; font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 4px 10px; cursor: pointer; white-space: nowrap;
}
.toast-acao:hover { background: #e0e9ff; }
.toast-tempo { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: #60a5fa; transform-origin: left; animation: tempo linear forwards; }
@keyframes entra { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes tempo { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #0f1e33, #1d4ed8); }
html[data-tema="escuro"] .login { background: linear-gradient(135deg, #05080d, #13254d); }
.login .caixa { background: var(--painel); border-radius: 12px; padding: 28px; width: 100%; max-width: 440px; box-shadow: var(--sombra-alta); }
.login h1 { font-size: 22px; }
.login .usuarios { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.login .usuarios button {
  display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border: 1px solid var(--borda-forte);
  border-radius: 8px; background: var(--painel); color: var(--texto); cursor: pointer; font: inherit; text-align: left;
}
.login .usuarios button:hover { border-color: var(--primaria); background: var(--hover); }

/* Barra por etapa (painel) */
.barras { display: flex; flex-direction: column; gap: 8px; }
.barra { display: grid; grid-template-columns: 170px 1fr 40px 110px; align-items: center; gap: 10px; font-size: 13px; }
.barra .b { height: 14px; background: var(--borda); border-radius: 4px; overflow: hidden; }
.barra .b i { display: block; height: 100%; background: var(--primaria); }
.barra a { color: inherit; }

.lista-simples { list-style: none; margin: 0; padding: 0; }
.lista-simples li { padding: 9px 16px; border-bottom: 1px solid var(--borda); display: flex; gap: 10px; align-items: center; }
.lista-simples li:last-child { border-bottom: none; }
.lista-simples li.nao-lido { background: var(--hover); }
.lista-simples li.nao-lido::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--primaria); flex: none; }

/* Responsivo */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g2-1 { grid-template-columns: minmax(0, 1fr); }
  .dados { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .lateral { position: static; height: auto; }
  .menu { display: flex; flex-wrap: wrap; }
  .menu .grupo { display: none; }
  .rodape-lateral > div { display: none; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .dados { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grade { grid-template-columns: 1fr 1fr; }
  .form-grade .s3, .form-grade .s4 { grid-column: span 2; }
  .linha-link { grid-template-columns: 1fr auto; }
  .linha-link [data-c=nome] { grid-column: span 2; }
  .conteudo, .topo { padding-left: 16px; padding-right: 16px; }
  .topo { flex-wrap: wrap; position: static; }
  .topo .titulo { flex-basis: 100%; }
  .topo .aviso-modo { display: none; }
  .usuario { width: 100%; justify-content: space-between; }
  .usuario .direita { text-align: left; }
  .barra { grid-template-columns: 110px 1fr 30px; }
  .barra .v { display: none; }
  .filtros input[type=search] { min-width: 0; width: 100%; max-width: none; }
}

@media print {
  .lateral, .topo .usuario, .btn, .filtros { display: none !important; }
  .app { display: block; }
  .cartao { box-shadow: none; }
}

/* =========================================================================
   Versão 0.3.1 – conjuntos, custos, ocorrências e linha do tempo
   ========================================================================= */
.conjuntos-cab { display: flex; flex-wrap: wrap; gap: 6px; }
.conj-chip { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 3px 10px; border: 1px solid var(--borda);
  border-radius: 999px; background: var(--painel-2); font-size: 12.5px; }
.tabela tr.grupo-conj td { background: var(--painel-2); border-top: 2px solid var(--borda-forte); padding-top: 7px; padding-bottom: 7px; }
.tabela tr.grupo-conj .linha { gap: 10px; flex-wrap: wrap; }
.tabela td.recuo { padding-left: 26px; }
.tabela td.centro, .tabela th.centro { text-align: center; }
.tabela tr.linha-comp td { border-top: 1px solid var(--borda-forte); }
.tabela-custos input[type=text] { width: 110px; }
.col-custo input[type=text] { width: 100px; }
.btn.btn-discreto { background: transparent; border-color: transparent; color: var(--texto-3); }
.btn.btn-discreto:hover { border-color: var(--borda); color: var(--texto-2); }
.ref-custo { font-size: 11px; color: var(--texto-3); margin-top: 2px; white-space: nowrap; }
.custo-discreto { color: var(--texto-2); }
.caixa-custo { border: 1px dashed var(--borda-forte); border-radius: var(--raio); padding: 10px 12px; background: var(--painel-2); }
.painel-custos .pe-cartao { border-top: 1px solid var(--borda); }
details.card-custos > summary { cursor: pointer; list-style: none; }
details.card-custos > summary::-webkit-details-marker { display: none; }
details.card-custos:not([open]) > summary { border-bottom: 0; opacity: .75; }
details.card-custos > summary h2 { font-size: 14px; }
.alerta-ocorr { color: var(--alerta); margin-top: 2px; cursor: help; }
.menu a.discreto { opacity: .65; }
.menu a.discreto:hover, .menu a.discreto.ativo { opacity: 1; }

/* Linha do tempo (Gantt) */
.gantt-wrap { overflow-x: auto; }
.gantt { display: inline-block; min-width: 100%; }
.gt-linha { display: flex; align-items: stretch; border-bottom: 1px solid var(--borda); }
.gt-linha.gt-grupo { background: var(--painel-2); }
.gt-linha.limitante { background: var(--erro-fundo); }
.gt-rot { flex: 0 0 280px; width: 280px; padding: 6px 12px; position: sticky; left: 0; background: inherit; background-color: var(--painel);
  z-index: 2; border-right: 1px solid var(--borda); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gt-linha.gt-grupo .gt-rot { background-color: var(--painel-2); }
.gt-linha.limitante .gt-rot { background-color: var(--erro-fundo); }
.gt-trilha { position: relative; min-height: 28px; flex: 0 0 auto; }
.gt-cab .gt-trilha { min-height: 24px; }
.gt-marca { position: absolute; top: 4px; font-size: 10.5px; color: var(--texto-3); border-left: 1px solid var(--borda); padding-left: 3px; height: 18px; }
.gt-barra { position: absolute; top: 6px; height: 16px; border-radius: 4px; font-size: 10.5px; line-height: 16px; color: #fff; padding: 0 5px;
  overflow: hidden; white-space: nowrap; box-sizing: border-box; border-right: 1px solid rgba(255,255,255,.6); }
.gt-barra.concluida { background: #16a34a; }
.gt-barra.andamento { background: #2563eb; }
.gt-barra.pendente  { background: #94a3b8; }
.gt-barra.atrasada  { background: #dc2626; }
.gt-v { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px solid; z-index: 1; }
.gt-v.hoje { border-color: #0f172a; border-left-style: dotted; }
html[data-tema="escuro"] .gt-v.hoje { border-color: #e6ecf4; }
.gt-v.cliente { border-color: #dc2626; }
.gt-v.derivado { border-color: #d97706; border-left-style: dashed; }
.legenda-gt { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; color: var(--texto-2); }
.legenda-gt .gt-barra { position: static; display: inline-block; width: 18px; height: 10px; vertical-align: middle; margin-right: 3px; padding: 0; }
.legenda-gt .gt-v { position: static; display: inline-block; height: 12px; vertical-align: middle; margin-right: 3px; }
@media print { .gantt-wrap { overflow: visible; } }


/* ================= 0.4: servidor (login Microsoft e SharePoint) ================= */
/* Aviso discreto enquanto algo está sendo gravado no servidor. */
body.salvando::after {
  content: 'Salvando…'; position: fixed; right: 16px; bottom: 16px; z-index: 2000;
  background: var(--texto); color: var(--fundo); padding: 6px 12px; border-radius: 999px;
  font-size: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.25); pointer-events: none;
}
.btn-microsoft { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 10px 14px; font-size: 15px; }
.btn-microsoft svg { flex: none; background: #fff; padding: 2px; border-radius: 2px; }
@media print { body.salvando::after { display: none; } }