:root {
  /* Paleta Argos: azul-marinho + cinza */
  --bg: #0f2038;          /* marinho escuro (fundos escuros/login) */
  --bg-soft: #17324f;
  --surface: #ffffff;
  --text: #12233b;        /* texto marinho */
  --muted: #64748b;       /* cinza */
  --primary: #1e3a5f;     /* azul-marinho */
  --primary-600: #16304d; /* marinho + escuro (hover) */
  --steel: #64748b;       /* cinza aço (para degrades/detalhes) */
  --border: #e2e8f0;
  --erro: #dc2626;
  --graf-plan: #29abe2;   /* azul bebê — planejado */
  --graf-real: #16a34a;   /* verde — realizado/executado */
  --graf-custo: #dc2626;  /* vermelho — custo (futuro) */
  --radius: 14px;
  --shadow: 0 10px 30px rgba(2, 6, 23, .12);
  --topbar-h: 68px;       /* altura da barra superior (para a lateral full-height) */
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
/* CRITICO: garante que elementos com [hidden] fiquem realmente escondidos
   (senao .modal-overlay/.login-wrap com display:grid anulam o hidden e o modal
   aparece sozinho por cima da tela de login). */
[hidden] { display: none !important; }
body { margin: 0; color: var(--text); background: #f1f5f9; }
h1, h2 { margin: 0; }
.muted { color: var(--muted); }
.flex-1 { flex: 1; }
button, input { font: inherit; }

/* ---- Login ---- */
/* tela cheia com imagem de fundo + cartao (estilo PPC, marinho) */
#tela-login {
  position: fixed; inset: 0; padding: 4vh 6vw;
  background: var(--bg) url('/login-bg.png') center center / 100% 100% no-repeat;
  display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 16px;
}
/* logotipo acima do card, alinhado a largura do card (centralizado sobre ele) */
.login-logo {
  display: block; width: 392px; max-width: 92vw; height: auto;
  border-radius: 16px; filter: drop-shadow(0 12px 30px rgba(0,0,0,.35));
}
@media (max-width: 720px) {
  #tela-login { align-items: center; justify-content: center; padding: 24px 16px; }
  .login-logo { width: 240px; max-width: 72vw; }
}
.login-card {
  width: 392px; max-width: 92vw; border-radius: 20px; padding: 28px 26px;
  /* membrana de vidro: 60% transparente (40% branco) */
  background: rgba(255,255,255,0.40);
  border: 1px solid rgba(255,255,255,0.55);
  backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 24px 60px rgba(2,6,23,0.35);
  display: grid; gap: 14px;
}
.login-langs { display: flex; justify-content: center; gap: 10px; margin-bottom: 4px; }
.login-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.login-ic {
  width: 46px; height: 46px; flex: none; border-radius: 50%; border: 2px solid var(--primary);
  display: flex; align-items: center; justify-content: center; color: var(--primary);
}
.login-title { font-size: 18px; font-weight: 800; letter-spacing: .5px; color: var(--primary); }
.login-sub { font-size: 13px; color: #475569; margin-top: 2px; }
.login-field {
  display: flex; align-items: center; gap: 10px; padding: 0 12px;
  background: rgba(255,255,255,0.55); border: 1px solid rgba(255,255,255,0.7); border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
}
.login-field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,58,95,.18); }
.login-field .lf-ic { color: var(--muted); display: flex; flex: none; }
.login-field input { flex: 1; min-width: 0; background: transparent; border: none; color: #111; padding: 13px 0; font-size: 15px; }
.login-field input::placeholder { color: #94a3b8; }
.login-field input:focus { outline: none; }
.lf-eye { background: none; border: none; color: var(--muted); cursor: pointer; padding: 0; display: flex; flex: none; }
.lf-eye:hover { color: var(--primary); }
.login-btn {
  width: 100%; padding: 13px; border: none; border-radius: 12px; cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--primary-600)); color: #fff;
  font-weight: 800; font-size: 16px; letter-spacing: .5px;
  box-shadow: 0 10px 24px rgba(15,32,56,.45);
  transition: filter .15s;
}
.login-btn:hover { filter: brightness(1.1); }
#tela-login .erro { color: #b3261e; font-weight: 700; text-align: center; margin: 2px 0 0; }
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.brand-mark {
  width: 48px; height: 48px; border-radius: 12px;
  display: grid; place-content: center;
  background: linear-gradient(135deg, var(--primary), var(--steel));
  color: #fff; font-weight: 800; font-size: 22px;
}
.brand-mark.small { width: 32px; height: 32px; font-size: 16px; border-radius: 8px; }
.brand h1 { font-size: 22px; }

.field { display: grid; gap: 6px; font-size: 14px; }
.field span { color: var(--muted); font-weight: 600; }
.field input {
  padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,58,95,.18); }

.btn { border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 600; cursor: pointer; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.erro { color: var(--erro); font-size: 14px; margin: 0; }

.lang-flags { display: inline-flex; gap: 6px; align-items: center; }
.flag-btn {
  width: 28px; height: 19px; padding: 0; border: 0; border-radius: 4px;
  overflow: hidden; cursor: pointer; background: none; line-height: 0;
  opacity: .45; filter: grayscale(.35);
  box-shadow: 0 0 0 1px rgba(2, 6, 23, .18);
  transition: opacity .15s, transform .1s, box-shadow .15s, filter .15s;
}
.flag-btn svg { width: 100%; height: 100%; display: block; }
.flag-btn:hover { opacity: .9; transform: translateY(-1px); }
.flag-btn.active { opacity: 1; filter: none; box-shadow: 0 0 0 2px var(--primary); }
.rodape { text-align: center; color: #94a3b8; font-size: 13px; }

/* ---- App ---- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
/* Logo Argo recortado via CSS (mostra só a região do logo do PNG cheio, sem espaço em branco) */
.topbar-logo { display: block; flex: none; width: 200px; height: 56px;
  background: url(/argo-logo.png?v=4) no-repeat; background-size: 209px 140px; background-position: -4px -36px; }
.conteudo { padding: 24px 20px; max-width: 1100px; margin: 0 auto; }
.conteudo h2 { margin-bottom: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.item-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; transition: transform .12s, box-shadow .12s;
}
.item-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.item-card h3 { margin: 0 0 4px; font-size: 16px; }
.item-card .sub { font-size: 13px; color: var(--muted); }

.secao-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.secao-topo h2 { margin: 0; }

.card-acoes { display: flex; gap: 8px; margin-top: 12px; }
.btn-mini {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 8px; padding: 5px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: border-color .12s, color .12s;
}
.btn-mini:hover { border-color: var(--primary); color: var(--primary); }
.btn-mini-perigo:hover { border-color: var(--erro); color: var(--erro); }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(2, 6, 23, .55);
  display: grid; place-items: center; padding: 20px;
}
.modal-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  width: min(660px, 96vw); max-height: 92vh;
  display: flex; flex-direction: column; overflow: hidden;
}
/* modais de cadastro (empresa/construtora/empreendimento) maximizados */
#modal-cadastro .modal-card, #modal-empreendimento .modal-card { width: min(1080px, 96vw); max-height: 94vh; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border); flex: 0 0 auto;
}
.modal-head h3 { margin: 0; font-size: 19px; }
.modal-x {
  border: 0; background: none; color: var(--muted); font-size: 26px; line-height: 1;
  cursor: pointer; padding: 0 4px; border-radius: 8px;
}
.modal-x:hover { color: var(--text); }
/* o form precisa ser coluna flexivel para o corpo rolar e o rodape ficar fixo */
#modal-cadastro form, #modal-empreendimento form, #modal-item form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.modal-item-card { width: min(520px, 96vw); }

/* ---- Orçamento (tabela de itens) ---- */
.orc-wrap { overflow-x: auto; }
.orc-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.orc-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 0 12px 10px; border-bottom: 2px solid var(--border); }
.orc-table th.num, .orc-table td.num { text-align: right; }
.orc-table td { padding: 12px; border-bottom: 1px solid var(--border); }
.orc-table tbody tr:hover { background: #f8fafc; }
.orc-table tfoot td { padding: 12px; font-weight: 800; border-top: 2px solid var(--border); background: #f8fafc; }
.orc-acoes { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.orc-acoes .btn-mini { padding: 5px 8px; }
.orc-peso-badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-weight: 700; font-size: 13px; }
.orc-peso-ok { background: #dcfce7; color: #166534; }
.orc-peso-warn { background: #fef3c7; color: #92400e; }
.orc-total-linha { display: flex; justify-content: flex-end; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; }

/* ---- Vista de obra: menu lateral + modulo ---- */
.obra-layout { display: flex; gap: 22px; align-items: flex-start; }
#obra-menu { flex: 0 0 236px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 8px; position: sticky; top: 78px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }

/* MODO OBRA: barra lateral encostada à esquerda, em altura total (estilo app-shell) */
body.modo-obra .conteudo { max-width: none; padding: 0; margin: 0; }
body.modo-obra .obra-layout { gap: 0; align-items: stretch; }
body.modo-obra #obra-menu {
  flex: 0 0 240px; border: 0; border-right: 1px solid var(--border); border-radius: 0;
  padding: 14px 10px; position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h)); overflow-y: auto;
  box-shadow: 1px 0 3px rgba(15,23,42,.05);
}
body.modo-obra #obra-main { flex: 1 1 auto; min-width: 0; padding: 22px 28px 40px; max-width: 1600px; }
body.modo-obra #obra-main #breadcrumb { margin-bottom: 14px; }
.menu-obra-titulo { font-weight: 800; font-size: 15px; letter-spacing: -.01em; padding: 4px 12px 14px; color: var(--primary); border-bottom: 1px solid var(--border); margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-nav { display: flex; flex-direction: column; gap: 3px; }
/* Base única: itens, cabeçalhos de grupo e sub-itens seguem o mesmo padrão */
.menu-item, .menu-grupo-titulo {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 9px;
  font-size: 14px; font-weight: 600; color: var(--text);
  cursor: pointer; position: relative; user-select: none;
  transition: background .13s ease, color .13s ease;
}
.menu-ico { width: 18px; height: 18px; flex: 0 0 18px; opacity: .75; transition: opacity .13s; }
.menu-txt { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item:hover, .menu-grupo-titulo:hover { background: color-mix(in srgb, var(--primary) 7%, var(--surface)); color: var(--primary); }
.menu-item:hover .menu-ico, .menu-grupo-titulo:hover .menu-ico { opacity: 1; }
.menu-item.ativo { background: var(--primary); color: #fff; box-shadow: 0 3px 8px color-mix(in srgb, var(--primary) 30%, transparent); }
.menu-item.ativo .menu-ico { opacity: 1; }
.menu-soon { color: var(--muted); cursor: default; font-weight: 500; }
.menu-soon .menu-ico { opacity: .45; }
.menu-soon:hover { background: transparent; color: var(--muted); }
.soon-badge { margin-left: auto; font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; background: #f1f5f9; color: var(--muted); padding: 2px 7px; border-radius: 10px; font-weight: 700; }
/* Grupos recolhíveis (acordeão): sub-itens indentados com guia à esquerda */
.menu-grupo { margin-top: 3px; }
.menu-grupo-seta { margin-left: auto; font-size: 10px; opacity: .5; transition: transform .18s ease; }
.menu-grupo.aberto > .menu-grupo-titulo { color: var(--primary); }
.menu-grupo.aberto > .menu-grupo-titulo .menu-grupo-seta { transform: rotate(90deg); opacity: .85; }
.menu-grupo-itens { display: none; margin: 2px 0 5px 19px; padding-left: 12px; border-left: 1.5px solid var(--border); }
.menu-grupo.aberto .menu-grupo-itens { display: flex; flex-direction: column; gap: 2px; }
.menu-grupo-itens .menu-ico { display: none; }
.menu-grupo-itens .menu-item { padding: 8px 11px; font-size: 13px; font-weight: 500; }
.menu-grupo-itens .menu-item.ativo { font-weight: 600; }
#modulo-conteudo { flex: 1 1 auto; min-width: 0; }
.modulo-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.modulo-head h2 { margin: 0; }
.modulo-acoes { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.orc-moeda { border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-weight: 600; background: var(--surface); cursor: pointer; }
.orc-moeda-badge { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 8px; padding: 6px 11px; font-weight: 600; font-size: 13px; color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); cursor: default; }
.campo-hint { display: block; margin-top: 3px; font-size: 12px; }
.orc-in { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px; font-size: 14px; outline: none; }
.orc-in:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,58,95,.15); }
.orc-in.num { text-align: right; }
.orc-num { color: var(--muted); font-weight: 700; }
/* Peso: alternar automático/manual + edição */
.orc-peso-th { display: inline-flex; align-items: center; gap: 6px; }
.orc-peso-modo { border: 1px solid var(--border); background: var(--surface); border-radius: 6px; padding: 1px 5px; font-size: 12px; cursor: pointer; line-height: 1.4; }
.orc-peso-modo:hover { border-color: var(--primary); }
.orc-peso-modo.ativo { background: var(--primary); border-color: var(--primary); }
.orc-peso-wrap { display: inline-flex; align-items: center; gap: 4px; justify-content: flex-end; }
.orc-peso-input { width: 84px; }
.orc-peso-suf { color: var(--muted); font-weight: 600; }
.orc-peso-aviso { margin: 10px 2px 0; font-size: 13px; }

/* Cronograma (Medição N: %Mês + %Acum) */
.cron-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.cron-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.cron-table th, .cron-table td { padding: 7px 9px; border-bottom: 1px solid var(--border); white-space: nowrap; text-align: right; }
.cron-table thead th { background: color-mix(in srgb, var(--primary) 7%, var(--surface)); color: var(--primary); font-weight: 700; }
.cron-med { text-align: center; border-left: 2px solid var(--border); }
.cron-mesmed { text-align: center; font-weight: 600; color: var(--text); border-left: 2px solid var(--border); }
.cron-sub { font-size: 12px; }
.cron-acum-col { border-right: 1px dashed var(--border); background: color-mix(in srgb, var(--primary) 3%, transparent); }
.cron-sub.cron-acum-col { background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
.cron-col-num { width: 42px; text-align: left; }
.cron-col-item { min-width: 210px; text-align: left; }
.cron-col-peso { width: 74px; }
.cron-item-nome { text-align: left; font-weight: 600; }
.cron-cell { width: 62px; text-align: right; border: 1px solid var(--border); border-radius: 7px; padding: 5px 6px; font-size: 13px; outline: none; }
.cron-cell:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(30,58,95,.15); }
.cron-acum { color: var(--muted); font-variant-numeric: tabular-nums; }
.cron-row-over .cron-cell { border-color: var(--erro); }
/* Linha Consolidado (curva S planejada) */
.cron-consol td { background: color-mix(in srgb, var(--primary) 6%, var(--surface)); font-weight: 700; color: var(--primary); }
.cron-consol-lbl { text-align: left; }
.cron-acum-100 { color: #166534 !important; }
/* Botão Reprogramar obra */
.btn-reprogramar { background: #c2410c; color: #fff; border: 1px solid #c2410c; }
.btn-reprogramar:hover { background: #9a3412; border-color: #9a3412; }
/* Cronograma obsoleto (linhas de base arquivadas) */
.baseline-lista { display: flex; flex-direction: column; gap: 10px; max-width: 640px; }
.baseline-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; background: var(--surface); }
.baseline-info { display: flex; flex-direction: column; gap: 2px; }
.baseline-info strong { color: var(--primary); }
.baseline-info .muted { font-size: 13px; }

/* Tipologias */
.tipo-lista { display: flex; flex-direction: column; gap: 10px; max-width: 720px; }
.tipo-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; background: var(--surface); }
.tipo-card-prod { background: color-mix(in srgb, var(--primary) 5%, var(--surface)); border-style: dashed; }
.tipo-card-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tipo-card-info strong { color: var(--primary); }
.tipo-card-info .muted { font-size: 13px; }
.tipo-card-acoes { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.tipo-badge { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; background: var(--primary); color: #fff; padding: 1px 7px; border-radius: 10px; font-weight: 700; vertical-align: middle; }
.tipo-grade th.tipo-col-pav { text-align: left; min-width: 120px; }
.tipo-grade .tipo-cod-pav, .tipo-grade .tipo-cod-uni { width: 100%; min-width: 70px; border: 1px solid var(--border); border-radius: 7px; padding: 6px 8px; font-size: 13px; outline: none; }
.tipo-grade .tipo-cod-pav { font-weight: 600; }
.tipo-grade .tipo-cod-pav:focus, .tipo-grade .tipo-cod-uni:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(30,58,95,.15); }
.tipo-grade .tipo-dup { border-color: var(--erro) !important; background: #fee2e2; color: #b91c1c; font-weight: 700; }

/* Parametrização de vistorias */
.vist-table th, .vist-table td { text-align: left; vertical-align: top; padding: 16px 16px; }
.vist-table th { padding-top: 12px; padding-bottom: 12px; }
.vist-ordem { font-weight: 600; color: var(--primary); white-space: nowrap; }
.vist-mes { white-space: nowrap; }
.vist-virada { border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px; font-size: 13px; outline: none; }
.vist-virada:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(30,58,95,.15); }
.vist-virada-row { display: flex; align-items: center; gap: 12px; }
.vist-weekday { font-size: 13px; text-transform: capitalize; white-space: nowrap; }
.vist-vist-td { min-width: 420px; }
/* Grade: data | dia da semana | retroativa | remover */
.vist-grid { display: grid; grid-template-columns: max-content max-content 1fr max-content; gap: 12px 16px; align-items: center; }
.vist-dow { color: var(--muted); text-transform: capitalize; font-size: 13px; white-space: nowrap; }
.vist-retro { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.vist-retro input { cursor: pointer; }
.vist-edit { border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; font-size: 13px; outline: none; }
.vist-edit:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(30,58,95,.15); }
.vist-rem { border: none; background: transparent; color: var(--erro); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; justify-self: end; }
.vist-add { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.vist-nova { border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; font-size: 13px; }
.vist-nova[hidden] { display: none; }

/* Itens de medição */
.med-nome-lin { font-weight: 600; }
.med-lin td { vertical-align: middle; }
.med-table select.med-in, .med-table input.med-in { width: 100%; }
.med-table td { vertical-align: middle; }
.med-obra { color: var(--muted); font-weight: 600; }
.med-table .orc-in { padding: 6px 8px; }
select.orc-in { background: var(--surface); cursor: pointer; }
.med-sub-locked { opacity: .55; background: color-mix(in srgb, var(--muted) 8%, var(--surface)); }
.med-sub-locked .orc-in { text-decoration: line-through; }
/* Tabela de subitens: larguras fixas por coluna (Nome flexível, resto cabe o texto) */
.med-table { table-layout: fixed; min-width: 1202px; }
.med-table th, .med-table td { vertical-align: top; }
.med-table td { overflow: hidden; }
.med-table thead th { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.med-table select.orc-in, .med-table input.med-peso { width: 100%; }
.med-table select.orc-in { text-overflow: ellipsis; }
/* Campo Nome: largura automática (coluna flexível) e quebra de linha */
.med-nome { width: 100%; resize: none; min-height: 34px; line-height: 1.35; white-space: normal; overflow: hidden; font-family: inherit; box-sizing: border-box; }
/* Arrastar para reordenar + seleção múltipla */
.med-drag { cursor: grab; color: var(--muted); font-size: 16px; user-select: none; display: inline-block; padding: 0 2px; }
.med-drag:active { cursor: grabbing; }
.med-dragging { opacity: .5; background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.med-drag-td, .med-table .med-sel { text-align: center; }
.med-sel { cursor: pointer; }
.btn-excluir-sel { background: var(--erro); color: #fff; border: 1px solid var(--erro); }
.btn-excluir-sel:hover { background: #b91c1c; border-color: #b91c1c; }

/* Lançamento da Medição */
.medlan-head { display: flex; align-items: center; gap: 12px; }
.medlan-selects { display: flex; gap: 16px; flex-wrap: wrap; margin: 10px 0 16px; }
.medlan-sel { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.medlan-sel select { min-width: 200px; padding: 7px 9px; }
.medlan-filtro { display: inline-flex; align-items: center; gap: 8px; align-self: flex-end; padding-bottom: 8px; font-size: 14px; color: var(--text); cursor: pointer; user-select: none; }
.medlan-filtro input { width: 16px; height: 16px; cursor: pointer; }
.medlan-realizado { display: flex; align-items: center; gap: 14px; padding: 10px 14px; background: color-mix(in srgb, var(--primary) 8%, var(--surface)); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 14px; }
.medlan-subs { display: flex; flex-direction: column; gap: 12px; }
.medlan-sub { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
/* Cabeçalho estilo referência */
.medlan-cab { padding: 10px 14px; background: color-mix(in srgb, var(--muted) 6%, var(--surface)); border-bottom: 1px solid var(--border); }
.medlan-cab-nome { font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.medlan-cab-linhas { display: flex; gap: 10px 24px; flex-wrap: wrap; font-size: 13px; color: var(--text); }
.medlan-cab-bloco { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.medlan-cab-bloco b { color: var(--text); }
.medlan-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: #ea7a12; }
.medlan-tag-med { color: #ea7a12; font-weight: 700; }
.medlan-cab-med { display: inline-flex; align-items: center; gap: 6px 22px; flex-wrap: wrap; }
.medlan-cab-n { display: inline-block; min-width: 18px; text-align: center; padding: 0 5px; border-radius: 999px; background: color-mix(in srgb, var(--primary) 12%, var(--surface)); color: var(--primary); font-weight: 700; font-size: 12px; }
.medlan-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 16%, var(--surface)); color: var(--muted); }
.medlan-badge-prod { background: color-mix(in srgb, var(--primary) 18%, var(--surface)); color: var(--primary); }
/* Corpo: controle (células/input) + donut à direita */
.medlan-corpo { display: flex; align-items: flex-start; gap: 16px; padding: 12px 14px; }
.medlan-corpo-main { flex: 1; min-width: 0; }
.medlan-pct { display: flex; align-items: center; gap: 8px; }
.medlan-pct label { font-size: 13px; color: var(--muted); }
.medlan-pct-in { width: 110px; text-align: right; }
.medlan-pct-in:disabled { background: color-mix(in srgb, var(--muted) 8%, var(--surface)); color: var(--muted); }
.medlan-hint { font-size: 12px; font-style: italic; }
.medlan-cells { display: flex; flex-wrap: wrap; gap: 6px; }
/* Grade na mesma ordem da tipologia: uma linha por pavimento (topo primeiro), colunas alinhadas */
.medlan-grid { display: flex; flex-direction: column; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.medlan-grid-row { display: flex; gap: 6px; }
.medlan-cell-empty { flex: 0 0 auto; min-width: 66px; min-height: 40px; border-radius: 7px; border: 1px dashed color-mix(in srgb, var(--border) 70%, transparent); background: color-mix(in srgb, var(--muted) 4%, transparent); }
.medlan-cell { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 66px; min-height: 40px; padding: 5px 7px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); cursor: pointer; font-size: 13px; color: var(--text); transition: background .12s, border-color .12s; line-height: 1.2; }
.medlan-cell:hover { border-color: var(--primary); }
.medlan-cell .cell-cod { font-weight: 600; }
.medlan-cell .cell-med, .medlan-cell .cell-data { font-size: 10px; font-weight: 500; opacity: .95; white-space: nowrap; }
/* Medição ATUAL (vistoria selecionada) = verde · medições ANTERIORES = azul */
.medlan-cell.cell-vist { background: var(--ok, #16a34a); border-color: var(--ok, #16a34a); color: #fff; }
.medlan-cell.cell-prev { background: var(--primary); border-color: var(--primary); color: #fff; }
/* Donut do % executado */
.medlan-donut { flex: 0 0 auto; }
.medlan-donut-txt { font-size: 19px; font-weight: 800; fill: var(--text); letter-spacing: -.02em; }

/* Gráficos (curva S) */
.graf-resumo { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.graf-card { flex: 1 1 140px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.graf-card-lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.graf-card strong { font-size: 22px; font-weight: 800; }
.graf-plan-txt { color: var(--graf-plan); }
.graf-real-txt { color: var(--graf-real); }
.graf-card-face { flex: 0 0 auto; align-items: center; justify-content: center; }
.graf-card-face .graf-face { margin: 0; }
.graf-pos { color: #16a34a; }
.graf-neg { color: var(--erro); }
.graf-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.graf-tab { padding: 7px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; }
.graf-tab:hover { border-color: var(--primary); color: var(--primary); }
.graf-tab.ativo { background: var(--primary); border-color: var(--primary); color: #fff; }
.graf-opts { display: flex; gap: 18px 24px; flex-wrap: wrap; align-items: center; margin: 2px 0 8px; }
.graf-opt-grp { display: inline-flex; align-items: center; gap: 6px; }
.graf-opt-lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; }
.graf-opt { padding: 5px 12px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.graf-opt:first-of-type { border-radius: 8px 0 0 8px; }
.graf-opt:last-of-type { border-radius: 0 8px 8px 0; border-left: none; }
.graf-opt.ativo { background: var(--primary); border-color: var(--primary); color: #fff; }
.graf-sel-med { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.graf-sel-med select { padding: 6px 9px; }
.graf-barlbl { font-size: 11px; font-weight: 700; text-anchor: middle; fill: var(--text); }
.graf-barlbl.graf-plan-txt { fill: var(--graf-plan); }
.graf-barlbl.graf-real-txt { fill: var(--graf-real); }
.graf-legenda { display: flex; gap: 18px; margin: 4px 0 8px; font-size: 13px; color: var(--muted); }
.graf-leg { display: inline-flex; align-items: center; gap: 6px; }
.graf-sw { width: 16px; height: 4px; border-radius: 2px; display: inline-block; }
.graf-sw-plan { background: var(--graf-plan); }
.graf-sw-real { background: var(--graf-real); }
.graf-wrap { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 10px; overflow-x: auto; }
.graf-svg { display: block; height: auto; max-width: none; }
.graf-vlbl { font-size: 9px; font-weight: 400; text-anchor: middle; fill: var(--text); }
.graf-vlbl.graf-plan-txt { fill: var(--primary); }
.graf-vlbl.graf-real-txt { fill: #16a34a; }
.graf-grid { stroke: var(--border); stroke-width: 1; }
.graf-axy, .graf-axx { fill: var(--muted); font-size: 10px; font-weight: 400; }
.graf-axy { text-anchor: end; }
.graf-axx { text-anchor: middle; }
.graf-axv { text-anchor: end; }   /* meses na vertical: ancorado no fim (junto ao eixo) */
.graf-linha { stroke-width: 3; }
.graf-plan { stroke: var(--graf-plan); }
.graf-real { stroke: var(--graf-real); }
.graf-pt-plan circle { fill: var(--graf-plan); }
.graf-pt-real circle { fill: var(--graf-real); }
.graf-bar { rx: 2; }
.graf-plan-bar { fill: var(--graf-plan); }
.graf-real-bar { fill: var(--graf-real); }
/* Custo (vermelho) */
.graf-custo { stroke: var(--graf-custo); }
.graf-pt-custo circle { fill: var(--graf-custo); }
.graf-custo-bar { fill: var(--graf-custo); }
.graf-custo-txt { color: var(--graf-custo); }
.graf-barlbl.graf-custo-txt { fill: var(--graf-custo); }
.graf-vlbl.graf-custo-txt { fill: var(--graf-custo); }
.graf-sw-custo { background: var(--graf-custo); }
/* Linha do "hoje" */
.graf-hoje { stroke: #f59e0b; stroke-width: 1.5; stroke-dasharray: 5 3; }
.graf-hoje-lbl { fill: #b45309; font-size: 10px; font-weight: 700; text-anchor: middle; }
.graf-chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); cursor: pointer; user-select: none; }
.graf-chk input { width: 15px; height: 15px; cursor: pointer; }
/* Tabelas (Medição Física / Custo) com carinhas */
.graf-tabela-tit { font-weight: 700; margin: 18px 0 6px; }
.graf-tabela-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; }
.graf-tabela { border-collapse: collapse; font-size: 12px; white-space: nowrap; width: 100%; }
.graf-tabela th, .graf-tabela td { border: 1px solid var(--border); padding: 6px 12px; text-align: center; }
.graf-tabela th { background: color-mix(in srgb, var(--muted) 7%, var(--surface)); font-weight: 700; color: var(--text); }
.graf-tab-lbl { text-align: left !important; font-weight: 700; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.graf-dif-v { font-weight: 600; }
.graf-face { display: inline-block; vertical-align: middle; margin-top: 3px; }
/* Detalhamento */
.det-sel { margin-bottom: 12px; font-size: 14px; color: var(--muted); }
.det-sel select { padding: 6px 9px; margin-left: 4px; }
.det-table td { white-space: nowrap; }
.det-table th { white-space: normal; vertical-align: bottom; line-height: 1.25; max-width: 130px; }
.det-table .det-nome { white-space: normal; min-width: 220px; }
.det-table .det-exec { font-weight: 700; }
.det-face { text-align: center; }
.det-acao { text-align: center; }
.det-btn { border: 1px solid var(--border); background: var(--surface); border-radius: 6px; padding: 3px 7px; cursor: pointer; font-size: 15px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); transition: border-color .12s, color .12s, background .12s; }
.det-btn:hover { border-color: var(--primary); color: var(--primary); }
.det-btn svg { display: block; }
.det-olho:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.card-topo { position: relative; }
.card-carinha { position: absolute; top: 0; right: 0; }

/* Modal do Gantt */
.modal-gantt-card { width: min(1120px, 96vw); max-height: 92vh; display: flex; flex-direction: column; }
.gantt-print-head, .gantt-print-rod { display: none; }   /* só aparecem na impressão do Gantt */
.gantt-head-acoes { display: flex; align-items: center; gap: 10px; }
#gantt-body { overflow: auto; }
.gantt-cabec { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 4px 4px 14px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.gantt-cabec-txt { text-align: center; display: flex; flex-direction: column; gap: 2px; }
.gantt-cabec-txt strong { font-size: 16px; color: var(--primary); }
.gantt-cabec-txt .muted { font-size: 13px; }
.gantt-logo { max-height: 52px; max-width: 180px; object-fit: contain; }
.gantt-scroll { overflow-x: auto; padding-bottom: 6px; }
.gantt { display: grid; gap: 2px; min-width: 520px; }
.gantt-corner { font-size: 12px; font-weight: 700; color: var(--muted); display: flex; align-items: center; padding: 0 8px; }
.gantt-mes { font-size: 11px; font-weight: 700; color: var(--primary); text-align: center; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--border); }
.gantt-item { font-size: 12px; font-weight: 600; color: var(--text); display: flex; align-items: center; padding-right: 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.gantt-cell { background: color-mix(in srgb, var(--primary) 3%, var(--surface)); border-radius: 3px; }
.gantt-bar { align-self: center; height: 20px; margin: 0 2px; background: linear-gradient(var(--primary), var(--primary-600)); border-radius: 5px; display: flex; align-items: center; justify-content: center; z-index: 1; box-shadow: 0 1px 2px rgba(2,6,23,.2); }
.gantt-bar span { color: #fff; font-size: 10px; font-weight: 700; white-space: nowrap; overflow: hidden; }
.gantt-sub { margin: 18px 0 8px; font-size: 13px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
/* Curva S (SVG) */
.gantt-scurve { display: block; }
.gs-grid { stroke: var(--border); stroke-width: 1; }
.gs-lbl-y { fill: var(--muted); font-size: 10px; text-anchor: end; }
.gs-lbl-x { fill: var(--muted); font-size: 10px; text-anchor: middle; }
.gs-lbl-v { fill: var(--primary); font-size: 9px; font-weight: 700; text-anchor: middle; }
.gs-area { fill: color-mix(in srgb, var(--primary) 14%, transparent); }
.gs-line { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.gs-dot { fill: #fff; stroke: var(--primary); stroke-width: 2; }

/* Impressão do Gantt: mostra só o modal */
@media print {
  body.print-gantt > *:not(#modal-gantt) { display: none !important; }
  body.print-gantt #modal-gantt { position: static; display: block; background: none; padding: 0; }
  body.print-gantt #modal-gantt .modal-card { box-shadow: none; max-width: none; width: auto; max-height: none; border: 0; }
  body.print-gantt #gantt-body { overflow: visible; }
  body.print-gantt .gantt-scroll { overflow: visible !important; }
  body.print-gantt .gantt-head-acoes { display: none !important; }
  body.print-gantt #modal-gantt .modal-head { display: none !important; }
  body.print-gantt .gantt-print-head { display: flex; align-items: center; gap: 14px; border-bottom: 2px solid #1e3a5f; padding-bottom: 10px; margin-bottom: 12px; }
  body.print-gantt .gantt-print-head img { max-height: 46px; max-width: 150px; object-fit: contain; flex: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.print-gantt .gantt-print-head .gph-tit { flex: 1; text-align: center; }
  body.print-gantt .gantt-print-head .gph-tit b { font-size: 16px; }
  body.print-gantt .gantt-print-rod { display: flex; justify-content: center; margin-top: 14px; padding-top: 8px; border-top: 1px solid #999; }
  body.print-gantt .gantt-print-rod img { max-height: 40px; max-width: 150px; object-fit: contain; }
  @page { size: landscape; margin: 10mm; }
}

/* Modal de importação */
.modal-import-card { width: min(520px, 94vw); }
.imp-passo { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; }
.imp-passo + .imp-passo { border-top: 1px solid var(--border); }
.imp-num { flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.imp-txt { flex: 1 1 auto; min-width: 0; }
.imp-txt strong { display: block; font-size: 14px; margin-bottom: 3px; }
.imp-txt p { margin: 0 0 10px; font-size: 13px; }
.imp-status { margin: 6px 0 0; font-size: 13px; font-weight: 600; padding: 8px 10px; border-radius: 8px; }
.imp-status.imp-ok { background: #dcfce7; color: #166534; }
.imp-status.imp-erro { background: #fee2e2; color: #b91c1c; }
@media (max-width: 760px) {
  .obra-layout { flex-direction: column; }
  #obra-menu, body.modo-obra #obra-menu { width: 100%; position: static; flex-basis: auto; height: auto; border-right: 0; border-bottom: 1px solid var(--border); box-shadow: none; }
  body.modo-obra #obra-main { padding: 16px; }
}
.tol-faixas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px 16px; margin: 4px 0 8px; }
@media (max-width: 620px) { .tol-faixas { grid-template-columns: repeat(2, 1fr); } }
.tol-topo { display: flex; align-items: center; gap: 10px; }
.tol-face-svg { width: 44px; height: 44px; flex: 0 0 auto; filter: drop-shadow(0 3px 5px rgba(0,0,0,.22)); }
.tol-campo { display: grid; gap: 2px; min-width: 0; flex: 1 1 auto; }
.tol-campo span { font-size: 12px; color: var(--muted); font-weight: 600; }
.tol-campo input {
  border: none; border-bottom: 1px solid var(--border); background: transparent;
  padding: 3px 0; font-size: 18px; font-weight: 700; color: var(--text); outline: none; width: 100%;
}
.tol-campo input:focus { border-bottom-color: var(--primary); }
.tol-campo-vazio { flex: 1 1 auto; }
.tol-desc { font-size: 12px; color: var(--muted); margin: 10px 0 0; line-height: 1.35; }
.check-obsoleta { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 14px; color: var(--text); cursor: pointer; }
.check-obsoleta input { width: 16px; height: 16px; accent-color: var(--primary); }
.modal-body { padding: 22px 24px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.form-secao {
  margin: 22px 0 12px; font-size: 12px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--primary);
}
.form-secao:first-child { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .field span { color: var(--muted); font-weight: 600; font-size: 13px; }
.form-grid .field input {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; outline: none; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.form-grid .field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,58,95,.18); }
.form-grid .span2 { grid-column: 1 / -1; }
.form-grid .grow3 { grid-column: span 1; }
.modal-acoes {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 24px; border-top: 1px solid var(--border); flex: 0 0 auto;
}
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }

/* ---- Breadcrumb ---- */
.crumb { margin-bottom: 12px; font-size: 14px; color: var(--muted); }
.crumb b { color: var(--text); }
.crumb-sep { margin: 0 4px; color: var(--border); }
.link-crumb {
  border: 0; background: none; color: var(--primary); font: inherit; font-weight: 600;
  cursor: pointer; padding: 0;
}
.link-crumb:hover { text-decoration: underline; }

/* ---- Cartao clicavel (empresas: entrar) ---- */
.item-card.clicavel { cursor: pointer; }

/* ---- Seletor de logo no cadastro ---- */
.logo-picker { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.logo-thumb {
  width: 72px; height: 72px; border-radius: 14px; flex: 0 0 auto;
  border: 1px dashed var(--border); background: #f8fafc;
  background-size: contain; background-position: center; background-repeat: no-repeat;
  display: grid; place-content: center; overflow: hidden;
}
.logo-thumb.tem-logo { border-style: solid; background-color: #fff; }
#cad-logo-ph {
  width: 100%; height: 100%; display: grid; place-content: center;
  color: #fff; font-weight: 800; font-size: 30px;
  background: linear-gradient(135deg, var(--primary), var(--steel));
}
.campo-label { font-weight: 600; font-size: 13px; }
.cropper-botoes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.btn-sm { padding: 7px 12px; font-size: 13px; border: 1px solid var(--border); }
.btn-sm:hover { border-color: var(--primary); color: var(--primary); }

/* ---- Modal "Ajustar logotipo" (estilo PPC) ---- */
.modal-logo-card { width: min(340px, 96vw); }
.logo-hint { font-size: 13px; margin: 0 0 14px; }
#logoFrame {
  width: 260px; height: 260px; margin: 0 auto; border-radius: 14px; overflow: hidden;
  position: relative; cursor: grab; border: 1px solid var(--border); touch-action: none;
}
#logoFrame:active { cursor: grabbing; }
#logoCanvas { display: block; width: 260px; height: 260px; }
.logo-zoom-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.logo-zoom-row input { flex: 1; accent-color: var(--primary); }

/* ---- Logo/miniatura nos cartoes ---- */
.card-topo { display: flex; gap: 12px; align-items: center; }
.card-info { min-width: 0; }
.card-logo {
  width: 46px; height: 46px; border-radius: 10px; flex: 0 0 auto;
  background-size: contain; background-repeat: no-repeat; background-position: center; background-color: #fff;
  border: 1px solid var(--border);
}
.card-logo-vazio {
  display: grid; place-content: center; color: #fff; font-weight: 800; font-size: 20px;
  background: linear-gradient(135deg, var(--primary), var(--steel));
}

/* ===== Seletor de Controle de Custos (cards) ===== */
.custo-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 4px; }
@media (max-width: 640px) { .custo-cards { grid-template-columns: 1fr; } }
.custo-card {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  padding: 16px 14px 14px; border: 1.5px solid var(--border); border-radius: 14px;
  background: #fff; cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s, transform .1s;
}
.custo-card:hover { border-color: #cbd5e1; box-shadow: 0 4px 14px rgba(15,32,56,.08); }
.custo-card input { position: absolute; opacity: 0; width: 0; height: 0; }
.custo-card-ico {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-content: center;
  background: #f1f5f9; color: var(--muted); transition: background .15s, color .15s;
}
.custo-card-ico svg { width: 22px; height: 22px; }
.custo-card-tit { font-weight: 700; color: var(--text); font-size: 15px; }
.custo-card-desc { font-size: 12px; line-height: 1.35; color: var(--muted); }
.custo-card-badge {
  position: absolute; top: 10px; right: 10px; font-size: 10px; font-weight: 700; letter-spacing: .3px;
  text-transform: uppercase; color: var(--muted); background: #f1f5f9; border-radius: 999px; padding: 2px 8px;
}
/* selecionado */
.custo-card:has(input:checked) {
  border-color: var(--primary); background: #f6f9fd;
  box-shadow: 0 0 0 3px rgba(30,58,95,.14);
}
.custo-card:has(input:checked) .custo-card-ico { background: var(--primary); color: #fff; }
.custo-card:has(input:checked) .custo-card-tit { color: var(--primary); }
/* foco por teclado */
.custo-card:focus-within { border-color: var(--primary); }
.custo-card-soon { cursor: not-allowed; opacity: .6; }
.custo-card-soon:hover { border-color: var(--border); box-shadow: none; }

/* ===== Custo analítico — livro de lançamentos ===== */
.lanc-form { background: #f8fafc; border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.lanc-form-grid { display: grid; grid-template-columns: 130px 150px 1fr 140px 1.2fr; gap: 10px; align-items: end; }
@media (max-width: 900px) { .lanc-form-grid { grid-template-columns: 1fr 1fr; } .lanc-form-grid .lanc-desc, .lanc-form-grid .lanc-aprop { grid-column: 1 / -1; } }
.lanc-form .field { gap: 4px; }
.lanc-form .field span { font-size: 12px; }
.lanc-form input, .lanc-form select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font: inherit; background: #fff; }
.lanc-form input:focus, .lanc-form select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,58,95,.15); outline: none; }
.lanc-form-acoes { display: flex; gap: 8px; margin-top: 12px; }
.lanc-busca-linha { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.lanc-busca { padding: 8px 12px; border: 1px solid var(--border); border-radius: 999px; font: inherit; min-width: 240px; }
.lanc-busca:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,58,95,.15); outline: none; }
.lanc-total { font-size: 14px; }
.lanc-acoes { white-space: nowrap; }
.lanc-acoes .det-btn { margin: 0 2px; }

/* ===== Custo Sintético — grade matriz (item × mês, rolagem horizontal) ===== */
.custo-head-flex { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.custo-acoes-topo { display: flex; gap: 8px; }
.custo-matriz-wrap { overflow-x: auto; }
.custo-matriz { min-width: max-content; }
.custo-matriz th, .custo-matriz td { border: 1px solid var(--border); }
.custo-col-fix {
  position: sticky; left: 0; z-index: 3; background: #fff; text-align: left;
  min-width: 220px; max-width: 320px; box-shadow: 1px 0 0 var(--border);
}
thead .custo-col-fix { z-index: 4; background: #f1f5f9; }
.custo-col-mes { min-width: 120px; }
.custo-col-med { font-size: 11px; font-weight: 600; color: var(--muted); }
.custo-consol-row th, .custo-consol-row td { background: #eef2f7; font-weight: 700; }
.custo-consol-cel { color: var(--primary); }
.custo-matriz input.custo-real { width: 100%; min-width: 96px; text-align: right; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; font: inherit; background: #fff; }
.custo-matriz input.custo-real:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,58,95,.15); outline: none; }

/* ===== Vínculo de subitens ===== */
.med-chip { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; vertical-align: middle; white-space: nowrap; }
.med-chip-vinc { background: #fef3c7; color: #b45309; }
.med-chip-prin { background: #e0e7ff; color: #3730a3; }
.med-sub-vinc { background: #fffdf5; }
.med-sub-vinc .med-nome, .med-sub-vinc .med-tip, .med-sub-vinc .med-rep, .med-sub-vinc .med-peso { opacity: .75; }
.vinc-card { max-width: 560px; width: 100%; }
.vinc-regra { background: #f1f5f9; border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.vinc-lista { list-style: none; margin: 4px 0 14px; padding: 0; display: grid; gap: 6px; }
.vinc-li { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.vinc-li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.vinc-empty { border: none; padding: 4px 2px; }
.modal-foot { display: flex; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--border); }

/* ===== Dashboard ===== */
.dash-grid { display: grid; grid-template-columns: auto repeat(4, 1fr); gap: 12px; margin-bottom: 14px; align-items: stretch; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr 1fr; } }
.dash-grid .graf-card { display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.dash-face { align-items: center; justify-content: center; }
.dash-face-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; text-align: center; }

/* ===== Detalhamento: botão + modal Pontos de atenção ===== */
.det-head-flex { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.det-pontos-btn { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; font-weight: 700; }
.det-pontos-btn:hover { background: #fee2e2; }
.pa-card { max-width: 720px; width: 100%; }
.pa-regra { background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.pa-impacto { font-weight: 800; color: #b91c1c; }
.pa-critico td { background: #fef2f2; }
.pa-critico .det-nome { font-weight: 700; }
.pa-foot { justify-content: space-between; }
.pa-foot-esq { display: flex; gap: 8px; }

/* ===== Simulação ===== */
.sim-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: #eef2ff; border: 1px solid #c7d2fe; color: #3730a3; border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; font-size: 13px; font-weight: 600; }

/* ===== Dashboard v2 ===== */
.dash-face-st { font-size: 15px; font-weight: 800; margin-top: 2px; }
.dash-st-verde { color: #16a34a; } .dash-st-amarelo { color: #ca8a04; } .dash-st-laranja { color: #ea580c; } .dash-st-vermelho { color: var(--erro); }
.dash-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin-bottom: 14px; align-items: start; }
@media (max-width: 860px) { .dash-cols { grid-template-columns: 1fr; } }
.dash-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.dash-panel-tit { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.dash-panel-tit .btn { margin-left: auto; }
.dash-pt { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.dash-pt:last-child { border-bottom: none; }
.dash-pt-face { flex: none; display: flex; }
.dash-pt-nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.dash-pt-imp { flex: none; font-weight: 800; color: #b91c1c; }
.dash-pt-mais { padding-top: 8px; font-size: 13px; color: var(--muted); }
.dash-ok { display: flex; align-items: center; gap: 10px; color: #16a34a; font-weight: 600; padding: 8px 0; }
.dash-cst { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.dash-cst:last-child { border-bottom: none; }
.dash-cst span { color: var(--muted); }

/* ===== Dashboard: barras de itens executados ===== */
.dash-exec-wrap { overflow-x: auto; }
.dash-bars { display: block; height: auto; max-width: 100%; }
.dash-bar-lbl { font-size: 12px; fill: var(--text); }
.dash-bar-bg { fill: #eef2f7; }
.dash-bar-fill { fill: var(--graf-real); }
.dash-bar-val { font-size: 11px; font-weight: 700; fill: var(--graf-real); }

/* ===== Fotos da obra ===== */
.foto-form { background: #f8fafc; border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 16px; }
.foto-form-grid { display: grid; grid-template-columns: auto 200px 1fr auto; gap: 12px; align-items: end; }
@media (max-width: 820px) { .foto-form-grid { grid-template-columns: 1fr 1fr; } .foto-cap-in { grid-column: 1 / -1; } }
.foto-pick { display: inline-flex; align-items: center; cursor: pointer; white-space: nowrap; }
.foto-status { margin-top: 8px; font-size: 13px; }
.foto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.foto-card { position: relative; margin: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }
.foto-img { width: 100%; height: 150px; object-fit: cover; display: block; cursor: zoom-in; }
.foto-cap { padding: 7px 10px; font-size: 12px; color: var(--text); }
.foto-data { color: var(--muted); font-weight: 600; }
.foto-del { position: absolute; top: 6px; right: 6px; border: none; background: rgba(2,6,23,.55); color: #fff; border-radius: 8px; padding: 3px 7px; cursor: pointer; font-size: 13px; }
.foto-del:hover { background: var(--erro); }
.foto-lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(2,6,23,.85); display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.foto-lightbox img { max-width: 92vw; max-height: 84vh; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.foto-lb-x { position: fixed; top: 16px; right: 20px; background: none; border: none; color: #fff; font-size: 34px; line-height: 1; cursor: pointer; }
.foto-lb-cap { position: fixed; bottom: 20px; left: 0; right: 0; text-align: center; color: #fff; font-size: 14px; }
/* miniaturas no dashboard */
.dash-fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.dash-foto { height: 76px; border-radius: 8px; object-fit: cover; width: 100%; cursor: zoom-in; border: 1px solid var(--border); }

/* ===== Dashboard v3: guia de perguntas + card de decisão ===== */
.dash-guia { background: #eef2ff; border: 1px solid #c7d2fe; color: #3730a3; border-radius: 10px; padding: 8px 14px; margin-bottom: 12px; font-size: 13px; }
.dash-guia b { font-weight: 700; }
.dash-grid { grid-template-columns: auto repeat(auto-fit, minmax(128px, 1fr)); }
.dash-sub { font-size: 11px; font-weight: 700; }
.dash-qtag { font-size: 11px; font-weight: 700; color: var(--primary); background: #eff6ff; border: 1px solid #dbeafe; border-radius: 999px; padding: 1px 8px; }
.dash-dec { display: flex; gap: 12px; align-items: flex-start; border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.dash-dec-alerta { background: #fff7ed; border: 1px solid #fed7aa; }
.dash-dec-ok { background: #f0fdf4; border: 1px solid #bbf7d0; }
.dash-dec-ic { font-size: 22px; line-height: 1; }
.dash-dec-tit { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 2px; }
.dash-dec-txt { font-size: 15px; font-weight: 600; color: var(--text); }

/* ===== Dashboard: cabeçalho de relatório + impressão ===== */
.dash-report-head { position: relative; display: flex; align-items: center; gap: 20px; margin-bottom: 14px; padding: 4px 150px 12px 0; border-bottom: 2px solid var(--border); }
.dash-rh-logos { display: flex; align-items: center; gap: 12px; flex: none; }
.dash-logo { height: 78px; max-width: 210px; object-fit: contain; flex: none; }
.dash-logo-l, .dash-logo-r { min-width: 60px; }   /* placeholders mantêm o título centralizado */
.dash-rh-info { flex: 1; min-width: 0; text-align: center; }
.dash-rh-info h2 { font-size: 20px; }
.dash-print-btn { position: absolute; top: 0; right: 0; }
@media print { .dash-report-head { padding-right: 0; } }
.dash-rh-sub { font-size: 13px; margin-top: 2px; }
@media print {
  .topbar, #obra-menu, #breadcrumb, .no-print { display: none !important; }
  body.modo-obra #obra-main { max-width: none !important; padding: 0 !important; }
  .conteudo { padding: 0 !important; max-width: none !important; }
  .obra-layout { display: block !important; }
  .dash-panel, .graf-card, .dash-dec, .foto-card { break-inside: avoid; page-break-inside: avoid; }
  .dash-cols { grid-template-columns: 1fr 1fr !important; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  @page { margin: 12mm; size: A4 landscape; }
  /* Relatório da simulação imprime em RETRATO (dashboard continua paisagem) */
  @page retrato { margin: 12mm; size: A4 portrait; }
  .sim-report { page: retrato; }
  .sim-report .graf-wrap svg { max-width: 100% !important; height: auto !important; }
}

/* ===== Medição por produção ===== */
.orc-prod { filter: grayscale(1); opacity: .45; }
.orc-prod.ativo { filter: none; opacity: 1; background: #fde8c8; }
.det-badge-prod {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 10px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  background: #fde8c8; color: #8a5a12; vertical-align: middle;
}

/* ===== Toast (aviso rápido) ===== */
.toast {
  position: fixed; bottom: 26px; left: 50%;
  transform: translateX(-50%) translateY(18px);
  padding: 12px 22px; border-radius: 9px; color: #fff;
  font-size: 14px; font-weight: 600; letter-spacing: .01em;
  box-shadow: 0 8px 24px rgba(0,0,0,.22); z-index: 9999; max-width: 90vw;
  opacity: 0; transition: opacity .25s ease, transform .25s ease;
  display: flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-ok { background: #16a34a; }
.toast-ok::before { content: "✓"; font-weight: 800; }
.toast-erro { background: var(--erro); }

/* ===== Donut de % nos cards do dashboard ===== */
.dash-donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 6px; }
.dash-donut { display: block; }
.dash-donut-val { font-size: 19px; font-weight: 800; letter-spacing: .2px; }
.dash-donut-txt { font-size: 16px; font-weight: 500; }

/* ===== Toggle Linhas/Barras nos gráficos do dashboard ===== */
.dash-graf-toggle { float: right; display: inline-flex; gap: 2px; }

/* ===== Aviso do modal de vínculo (quem fica x quem some) ===== */
.vinc-aviso {
  background: #fef3c7; border: 1px solid #fcd34d; color: #7c5410;
  border-radius: 8px; padding: 10px 14px; margin-bottom: 12px;
  font-size: 13px; line-height: 1.45;
}

/* ===== Subitem vinculado na Medição (só leitura) ===== */
.medlan-badge-vinc { background: #fde8c8; color: #8a5a12; }
.medlan-sub-vinc { background: #fffdf7; }
.medlan-grid-ro { pointer-events: none; }

/* ===== Botão imprimir por subitem (mapa do prédio A4) ===== */
.medlan-sub { position: relative; }
.medlan-cab { padding-right: 96px; }
.medlan-print {
  position: absolute; top: 12px; right: 14px; z-index: 2;
  font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
  box-shadow: 0 1px 2px rgba(15,23,42,.06);
  transition: border-color .12s, color .12s, background .12s;
}
.medlan-print:hover { border-color: var(--primary); color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, var(--surface)); }

/* ===== Relatórios (montador) ===== */
.rel-form-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; margin-bottom: 6px; }
.rel-blocos-tit { font-weight: 700; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 12px 0 8px; }
.rel-blocos { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 18px; margin-bottom: 16px; }
.rel-check { display: flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; padding: 7px 8px; border: 1px solid var(--border); border-radius: 8px; transition: border-color .12s, background .12s; }
.rel-check:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
.rel-check input { width: 16px; height: 16px; }
.rel-form-acoes { display: flex; gap: 10px; }
.rel-acoes { text-align: right; white-space: nowrap; }
.rel-acoes .btn-mini { margin-left: 4px; }
@media (max-width: 640px) { .rel-form-grid { grid-template-columns: 1fr; } }

/* ===== Checklist por tipologia (matriz) ===== */
.cl-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cl-sel { display: flex; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin: 6px 0 18px; padding: 14px 18px; background: color-mix(in srgb, var(--primary) 4%, var(--surface)); border: 1px solid var(--border); border-radius: 12px; }
.cl-filtro { display: inline-flex; flex-direction: column; gap: 6px; }
.cl-filtro-lbl { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); }
.cl-sel select { padding: 9px 14px; border: 1.5px solid var(--border); border-radius: 9px; background: var(--surface); font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; min-width: 140px; transition: border-color .12s, box-shadow .12s; }
.cl-sel select:hover { border-color: var(--primary); }
.cl-sel select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.cl-legenda { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.cl-legenda i { width: 13px; height: 13px; border-radius: 3px; display: inline-block; vertical-align: -1px; margin-right: 3px; }
.cl-lg-ok { background: #16a34a; }
.cl-lg-off { background: var(--surface); border: 1px solid var(--border); }
.cl-wrap { overflow-x: auto; }
.cl-table { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.cl-table th, .cl-table td { border: 1px solid var(--border); padding: 4px 6px; text-align: center; white-space: nowrap; }
/* nome do serviço: quebra em várias linhas em vez de cortar */
.cl-table .cl-nome, .cl-table .cl-nome-h { text-align: left !important; position: sticky; left: 0; z-index: 2; background: var(--surface); width: 260px; min-width: 220px; max-width: 300px; white-space: normal; word-break: break-word; overflow-wrap: anywhere; vertical-align: middle; }
.cl-nome-h, .cl-pav, .cl-uni, .cl-tot-h { background: color-mix(in srgb, var(--primary) 8%, var(--surface)); font-weight: 700; color: var(--text); }
.cl-pav { font-size: 11px; color: var(--muted); }
.cl-uni { min-width: 34px; font-size: 11px; }
.cl-ok { background: #16a34a; color: #fff; font-weight: 700; }
.cl-off { background: var(--surface); }
.cl-tot, .cl-tot-h { font-weight: 700; background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
.cl-tot-full { color: #16a34a; }
.cl-tot-row td { background: color-mix(in srgb, var(--primary) 8%, var(--surface)); font-weight: 700; }
.cl-tot-row .cl-nome { font-size: 12px; }
.cl-vinc { font-size: 10px; opacity: .7; }
@media print {
  .cl-sel, .cl-head .modulo-acoes { display: none !important; }
  .cl-table { font-size: 9px; }
  /* fundo 100% branco p/ economizar tinta: célula feita vira só o ✓ preto, sem azul/cinza */
  .cl-table th, .cl-table td,
  .cl-nome, .cl-nome-h, .cl-pav, .cl-uni, .cl-tot-h, .cl-tot, .cl-tot-row td, .cl-ok, .cl-off {
    background: #fff !important; background-color: #fff !important; color: #111 !important;
    border-color: #999 !important; padding: 2px 3px;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .cl-nome, .cl-nome-h { position: static; }
  .cl-tot-full, .cl-vinc { color: #111 !important; }
}

/* ===== Checklist: seletor de pavimento + barras 0-100% ===== */
.cl-pav-sel select { padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 14px; }
.cl-sofalta { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; cursor: pointer; user-select: none; }
.cl-sofalta input { width: 16px; height: 16px; }
.cl-secao-tit { font-weight: 700; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 6px 0 10px; }
.cl-bars { max-width: 860px; }
.cl-bar-grp { font-weight: 700; font-size: 12px; color: var(--primary); text-transform: uppercase; letter-spacing: .03em; margin: 16px 0 6px; padding-bottom: 3px; border-bottom: 1px solid var(--border); }
.cl-bar-row { display: grid; grid-template-columns: 300px 1fr 52px; align-items: center; gap: 12px; padding: 4px 0; }
.cl-bar-nome { font-size: 13px; white-space: normal; word-break: break-word; overflow-wrap: anywhere; }
.cl-bar-track { height: 16px; background: color-mix(in srgb, var(--muted) 16%, var(--surface)); border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.cl-bar-fill { height: 100%; border-radius: 9px 0 0 9px; transition: width .3s; }
.cl-bar-pct { font-size: 12px; font-weight: 600; text-align: right; color: var(--muted); }
@media (max-width: 640px) { .cl-bar-row { grid-template-columns: 40% 1fr 44px; } }
@media print {
  .cl-bar-track { background: #fff !important; border-color: #999 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cl-bar-fill { background: #bbb !important; }
  .cl-bar-pct { color: #111 !important; }
  .cl-bars { max-width: 100%; }
}

/* Rodapé da empresa nos relatórios de tela (Dashboard, Simulação) — só na impressão */
.rel-rodape-emp { display: none; }
@media print {
  .rel-rodape-emp { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 22px; padding-top: 8px; border-top: 1px solid #999; font-size: 11px; color: #333; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rel-rodape-emp img { max-height: 40px; max-width: 160px; object-fit: contain; }
}

/* Cabeçalho de relatório só-impressão (Gráficos, Consolidado): obra esq · construtora dir */
.graf-head-flex { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rel-head-print { display: none; }
@media print {
  .rel-head-print { display: flex; align-items: center; gap: 18px; border-bottom: 2px solid #1e3a5f; padding-bottom: 10px; margin-bottom: 14px; }
  .rel-head-print img { max-height: 64px; max-width: 190px; object-fit: contain; flex: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rel-head-print .rhp-info { flex: 1; text-align: center; }
  .rel-head-print .rhp-info h2 { margin: 0; font-size: 18px; }
  .rel-head-print .rhp-sub { font-size: 12px; color: #333; margin-top: 3px; }
}

/* ===== Data Marco (milestones) ===== */
.mk-novo { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 4px 0 14px; }
.mk-novo .orc-in { padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 14px; }
.mk-novo .mk-n-evt { flex: 1; min-width: 220px; }
.mk-table td, .mk-table th { vertical-align: middle; }
.mk-table .orc-in { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); font-size: 13px; }
.mk-table .mk-data { width: 140px; }
.mk-acoes { white-space: nowrap; text-align: center; }
.mk-acoes .btn-mini { margin: 0 2px; }
.mk-status.mk-st-ok { color: #16a34a; font-weight: 600; }
.mk-status.mk-st-cancel { color: var(--erro); font-weight: 600; }
.mk-status.mk-st-wait { color: var(--muted); font-weight: 600; }

/* ===== Impressão dos Gráficos: limpa e enquadrada em 1 folha (A3 se ficar pequeno) ===== */
@media print {
  .graf-opts, .graf-chk, .graf-tabs { display: none !important; }   /* controles não fazem sentido impressos */
  .graf-vlbl, .graf-barlbl-v { display: none !important; }          /* remove rótulos de % (poluição) */
  .graf-wrap, .orc-wrap { overflow: visible !important; }           /* sem barra de rolagem na impressão */
  .graf-svg { width: 100% !important; height: auto !important; max-width: 100% !important; max-height: 58vh; }
  .graf-tabelas { page-break-before: always; }                      /* tabelas numa folha separada do gráfico */
  .graf-resumo { gap: 8px !important; margin-bottom: 8px !important; }
  .graf-card { padding: 6px 10px !important; }
  .graf-resumo, .graf-legenda, .graf-wrap, .orc-wrap { break-inside: avoid; page-break-inside: avoid; }
  .graf-wrap { margin: 4px 0 8px !important; }
  .graf-table, .orc-table.det-table { font-size: 9.5px !important; }
  .graf-table th, .graf-table td, .orc-table.det-table th, .orc-table.det-table td { padding: 2px 5px !important; }
}

/* Datas marco no gráfico (linha vertical + rótulo do evento) */
.graf-marco { stroke-width: 1.4; stroke-dasharray: 4 3; opacity: .85; }
.graf-marco-lbl { font-size: 10px; font-weight: 700; }
.dash-marcos-chk { margin-left: 6px; }

/* ===== Relatório geral gerado (Fase 2): blocos, cada um numa página na impressão ===== */
.rel-gerado { max-width: 1000px; }
.rel-bloco { margin-bottom: 26px; }
.rel-bloco h3 { font-size: 15px; margin: 0 0 10px; padding-bottom: 5px; border-bottom: 2px solid var(--primary); color: var(--text); }
.rel-fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.rel-foto { margin: 0; }
.rel-foto img { width: 100%; height: 150px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.rel-foto figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
.rel-det-tab td, .rel-det-tab th { font-size: 12px; }
.btn-mini-gerar { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
@media print {
  .rel-bloco { page-break-inside: avoid; }
  .rel-bloco + .rel-bloco { page-break-before: always; }   /* cada bloco em sua folha */
  .rel-foto img { height: 130px; }
}

/* ===== Gráfico Produção na Vistoria (barras por subitem) ===== */
.prod-wrap { max-width: 980px; }
.prod-grupo { margin-bottom: 18px; page-break-inside: avoid; }
.prod-grupo-tit { font-weight: 700; font-size: 13px; color: var(--primary); text-transform: uppercase; letter-spacing: .03em; margin: 14px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.prod-row { display: grid; grid-template-columns: 340px 1fr; align-items: center; gap: 14px; padding: 3px 0; }
.prod-nome { font-size: 13px; }
.prod-track { position: relative; height: 20px; background: color-mix(in srgb, var(--muted) 14%, var(--surface)); border: 1px solid var(--border); border-radius: 5px; overflow: hidden; }
.prod-fill { position: absolute; left: 0; top: 0; height: 100%; border-radius: 5px 0 0 5px; }
.prod-pct { position: absolute; right: 8px; top: 0; height: 100%; display: flex; align-items: center; font-size: 11px; font-weight: 700; color: var(--text); }
.prod-pct.prod-100 { color: #fff; right: 50%; transform: translateX(50%); }
@media (max-width: 640px) { .prod-row { grid-template-columns: 45% 1fr; } }
@media print {
  .prod-track { background: #fff !important; border-color: #999 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .prod-pct { color: #111 !important; }
}

/* Link Política de Privacidade (tela de login) */
.login-priv { text-align: center; margin: 14px 0 0; }
.login-priv a { font-size: 12px; color: var(--muted); text-decoration: underline; }
.login-priv a:hover { color: var(--primary); }

/* ===== Carrossel de fotos do Dashboard (últimas 20, auto-gira) ===== */
.dash-fotos-panel { margin-bottom: 18px; }
/* Hero do dashboard: KPIs à esquerda + fotos no canto direito */
.dash-hero { display: flex; gap: 16px; align-items: stretch; margin-bottom: 14px; }
.dash-hero-kpis { flex: 1 1 0; min-width: 0; margin-bottom: 0; }
.dash-hero-fotos { flex: 0 0 340px; max-width: 340px; margin-bottom: 0; display: flex; flex-direction: column; }
.dash-hero-fotos .dash-carousel { flex: 1; }
@media (max-width: 900px) { .dash-hero { flex-wrap: wrap; } .dash-hero-kpis, .dash-hero-fotos { flex: 1 1 100%; max-width: none; } }
.dash-carousel { display: flex; align-items: center; gap: 10px; }
.caro-stage { flex: 1; position: relative; overflow: hidden; border-radius: 12px; background: #0b1220; min-width: 0; aspect-ratio: 4 / 3; }
.caro-img { width: 100%; height: 100%; object-fit: contain; display: block; cursor: zoom-in; }
.caro-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 14px 10px; color: #fff; font-size: 13px; background: linear-gradient(transparent, rgba(0,0,0,.65)); }
.caro-nav { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 24px; line-height: 1; cursor: pointer; box-shadow: 0 1px 3px rgba(15,23,42,.12); transition: background .12s, border-color .12s; }
.caro-nav:hover { border-color: var(--primary); color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, var(--surface)); }
.caro-dots { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.caro-dot { width: 9px; height: 9px; border-radius: 50%; background: color-mix(in srgb, var(--muted) 45%, var(--surface)); border: 1px solid var(--border); cursor: pointer; transition: background .12s, transform .12s; }
.caro-dot.ativo { background: var(--primary); transform: scale(1.2); }
@media (max-width: 640px) { .caro-img { height: 220px; } }
@media print { .dash-carousel .caro-nav, .caro-dots { display: none; } .caro-img { height: 260px; object-fit: contain; } }

/* ===== "MÓDULO 2 | CONTROLE DE OBRAS" (centro do topo) — visual metálico ===== */
.topbar { position: relative; }
.topbar-mod2 { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 12px; white-space: nowrap; pointer-events: none; }
.topbar-mod2 span { font-family: 'Segoe UI', Roboto, Arial, sans-serif; font-weight: 800; font-size: 19px; letter-spacing: 2.5px; }
.topbar-mod2 .mod2-a { background: linear-gradient(180deg, #4f8bf0 0%, #1e40af 55%, #0f2a6b 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; text-shadow: 0 1px 0 rgba(255,255,255,.15); }
.topbar-mod2 .mod2-b { background: linear-gradient(180deg, #c7d0da 0%, #7b8794 52%, #454f5b 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.topbar-mod2 .mod2-sep { color: #b8c1cc; font-weight: 300; font-size: 24px; -webkit-text-fill-color: initial; }
@media (max-width: 1080px) { .topbar-mod2 { display: none; } }
:root[data-theme="dark"] .topbar-mod2 .mod2-b { background: linear-gradient(180deg, #e2e8f0, #94a3b8); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .topbar-mod2 .mod2-b { background: linear-gradient(180deg, #e2e8f0, #94a3b8); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; } }

/* Dias + Previsão pareados (linha própria abaixo dos donuts) */
.dash-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.dash-pair .graf-card { align-items: center; text-align: center; }
@media (max-width: 520px) { .dash-pair { grid-template-columns: 1fr; } }

/* Fotos na IMPRESSÃO do Dashboard: todas, no fim, 2 por linha (some na tela) */
.dash-fotos-print { display: none; }
@media print {
  .dash-hero-fotos { display: none !important; }   /* esconde o carrossel na impressão */
  .dash-fotos-print { display: block; page-break-before: always; }
  .dash-fotos-print .dfp-tit { font-size: 14px; font-weight: 700; margin: 0 0 10px; }
  .dash-fotos-print .dfp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .dfp-item { margin: 0; page-break-inside: avoid; }
  .dfp-item img { width: 100%; height: 230px; object-fit: contain; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 6px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .dfp-item figcaption { font-size: 11px; color: #333; margin-top: 3px; }
}

/* Logo da empresa cliente no topo (dentro da obra) — bom tamanho e legível */
.topbar-logo-emp { height: 118px; max-width: 500px; width: auto; object-fit: contain; display: none; flex: none; align-self: center;
  mix-blend-mode: multiply; /* funde o fundo branco do logo com o topo branco */ }
/* no tema escuro o multiply escureceria o logo — desliga */
:root[data-theme="dark"] .topbar-logo-emp { mix-blend-mode: normal; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .topbar-logo-emp { mix-blend-mode: normal; } }

/* ===== Foto: botão "cliente pode ver" ===== */
.foto-card { position: relative; }
.foto-cli { position: absolute; top: 6px; left: 6px; border: 0; border-radius: 8px; width: 30px; height: 30px; cursor: pointer;
  background: rgba(255,255,255,.9); font-size: 15px; line-height: 1; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.foto-cli:hover { background: #fff; }
.foto-card.foto-cli-on { outline: 3px solid var(--ok, #16a34a); outline-offset: -3px; }
.foto-card.foto-cli-on .foto-cli { background: var(--ok, #16a34a); }
.foto-cli-tag { display: inline-block; background: var(--ok, #16a34a); color: #fff; font-weight: 700; font-size: 10px; padding: 1px 6px; border-radius: 6px; }

/* ===== Tela "Avanço para o cliente" ===== */
.cli-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 18px; }
.cli-desc { margin-bottom: 12px; max-width: 720px; }
.cli-link-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cli-url { flex: 1 1 320px; min-width: 220px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: #f1f5f9; color: var(--text); }
.cli-revogar { color: #c0392b; }
.cli-check { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; font-weight: 600; cursor: pointer; }
.cli-check input { width: 17px; height: 17px; }
.cli-preview { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.cli-preview-tit { font-weight: 800; color: var(--primary, #1e3a5f); letter-spacing: .5px; text-transform: uppercase; font-size: 13px; margin-bottom: 14px; }
.cli-preview-body { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-start; }
.cli-donut { flex: 0 0 auto; text-align: center; }
.cli-donut-lbl { font-weight: 700; color: var(--text); margin-top: 2px; }
.cli-fotos { flex: 1 1 300px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; min-width: 0; }
.cli-foto { margin: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.cli-foto img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.cli-foto figcaption { font-size: 11px; color: #444; padding: 4px 6px; }
.cli-nota { margin-top: 12px; }
.cli-itens { display: flex; flex-direction: column; gap: 8px; }
.cli-item { display: grid; grid-template-columns: 34px minmax(140px, 260px) 1fr; gap: 12px; align-items: center; }
.cli-item-eye { border: 1px solid var(--border); background: #f1f5f9; border-radius: 8px; width: 30px; height: 30px; cursor: pointer; font-size: 14px; }
.cli-item-eye:hover { background: #e2e8f0; }
.cli-item-nome { font-weight: 600; font-size: 14px; }
.cli-item-bar { position: relative; background: #eef2f7; border-radius: 6px; height: 24px; }
.cli-item-fill { background: #2c5aa0; height: 100%; border-radius: 6px; }
.cli-item-pct { position: absolute; top: 50%; left: 8px; transform: translateY(-50%); font-size: 12px; font-weight: 700; color: #1f2937; }
.cli-item-off { opacity: .45; }
.cli-item-off .cli-item-fill { background: #94a3b8; }
@media (max-width: 560px) { .cli-item { grid-template-columns: 30px 1fr; } .cli-item-bar { grid-column: 1 / -1; } }

/* ===== Controle de acessos: usuários, perfis, logs ===== */
.tabela { width: 100%; border-collapse: collapse; background: var(--surface); }
.tabela th, .tabela td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
.tabela th { font-weight: 700; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.tabela tbody tr:hover { background: rgba(44,90,160,.04); }
.ta-c { text-align: center !important; }
.ta-r { text-align: right !important; white-space: nowrap; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.tag-admin { background: #1e3a5f; color: #fff; }
.tag-on { background: #dcfce7; color: #166534; }
.tag-off { background: #fee2e2; color: #991b1b; }

/* Modal genérico (overlay + card) */
.modal-cad { position: fixed; inset: 0; background: rgba(15,32,56,.55); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 18px; }
.modal-box { background: var(--surface); border-radius: 14px; padding: 22px; width: 100%; max-width: 460px; box-shadow: 0 20px 60px rgba(0,0,0,.3); max-height: 90vh; overflow: auto; }
.modal-box.modal-lg { max-width: 620px; }
.modal-box h3 { margin: 0 0 16px; color: var(--primary, #1e3a5f); }
.modal-acoes { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.form-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .form-grid2 { grid-template-columns: 1fr; } }

/* Permissões (checkboxes) */
.perm-master { display: flex; align-items: center; gap: 8px; margin: 14px 0; font-size: 14px; }
.perm-master input { width: 16px; height: 16px; }
.perm-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 10px; font-weight: 700; color: var(--primary, #1e3a5f); }
.perm-perfil { padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px 16px; }
.perm-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13.5px; }
.perm-item .perm-lbl { flex: 1; min-width: 0; }
.perm-sel { padding: 4px 8px; border: 1px solid var(--border); border-radius: 7px; font-size: 12.5px; background: var(--surface); color: var(--text); flex: none; }

/* Logs */
.tabela-logs td { font-size: 13px; }
.log-data { white-space: nowrap; color: var(--muted); }
.log-path { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.log-acao { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: #eef2f7; color: #334155; }
.log-login { background: #dcfce7; color: #166534; }
.log-logout { background: #f1f5f9; color: #475569; }
.log-post { background: #dbeafe; color: #1e40af; }
.log-delete { background: #fee2e2; color: #991b1b; }

.secao-acoes { display: flex; gap: 10px; align-items: center; }
