/* Catálogo MTI — leiaute do PDF "Catálogo de Serviços MTI/2025": fundo branco, azul-marinho, fonte Quicksand. */
:root {
  --azul: #002060;
  --azul-escuro: #001a4f;
  --texto: #1f3b8f;
  --texto-suave: #5a6b95;
  --linha: #1b1b1b;
  --linha-clara: #c9d1e6;
  --fundo: #ffffff;
  --fundo-suave: #f3f5fb;
  --destaque: #272a6c;
  --verde: #16794a;
  --vermelho: #b42318;
  --raio: 8px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  font-family: "Quicksand", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  color: var(--texto);
  background: var(--fundo);
  line-height: 1.45;
}
[hidden] { display: none !important; }
a { color: inherit; }
h1, h2, h3 { color: var(--azul); margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---- Cabeçalho e navegação ---- */
.cabecalho { text-align: center; padding: 18px 16px 6px; }
.cabecalho img { width: min(360px, 82vw); height: auto; display: inline-block; }
.navegacao {
  position: sticky; top: 0; z-index: 20;
  background: var(--azul);
  display: flex; justify-content: center; gap: 4px;
  padding: 0 12px;
  box-shadow: 0 2px 8px rgba(0, 32, 96, .18);
}
.navegacao a {
  color: #fff; text-decoration: none; font-weight: 600;
  padding: 14px 18px; border-bottom: 3px solid transparent; letter-spacing: .02em;
}
.navegacao a[aria-current="page"] { border-bottom-color: #fff; }
.navegacao a:hover { background: rgba(255, 255, 255, .08); }

.pagina { max-width: 1040px; margin: 0 auto; padding: 24px 16px 40px; }
.titulo-secao { font-size: 1.5rem; font-weight: 700; margin: 28px 0 16px; }
.titulo-maior { font-size: 1.6rem; font-weight: 700; text-transform: uppercase; }
.linha-separadora { border: 0; border-top: 1px solid #999; margin: 18px 0 28px; }

/* ---- Capa ---- */
.capa { display: grid; grid-template-columns: minmax(0, 420px) 1fr; gap: 24px 40px; align-items: end; margin: 12px 0 8px; }
.capa img { width: 100%; height: auto; display: block; }
.capa h1 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); font-weight: 700; margin-top: 10px; }
.capa .meta { color: var(--azul); }
.capa .meta b { display: block; font-size: 1.35rem; }
.capa .meta small { display: block; font-weight: 700; }
.capa .data { margin-top: 14px; }
.capa .data span { display: block; font-weight: 400; }
@media (max-width: 720px) { .capa { grid-template-columns: 1fr; } }

/* ---- Tabela de serviços (páginas 6 a 8) ---- */
.rolagem { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabela-servicos { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 13px; }
.tabela-servicos th, .tabela-servicos td { border: 1px solid var(--linha); padding: 7px 8px; vertical-align: middle; }
.tabela-servicos thead th { background: var(--azul); color: #fff; font-weight: 500; font-size: 12px; text-transform: uppercase; text-align: left; }
.tabela-servicos thead th.centro { text-align: center; }
.tabela-servicos td.num { width: 34px; }
.tabela-servicos td.valor { text-align: center; width: 72px; }
.tabela-servicos td.texto-complexidade { white-space: pre-line; font-size: 12.5px; }
.tabela-servicos td.grupo { width: 32px; padding: 6px 2px; text-align: center; vertical-align: middle; }
.vertical {
  display: inline-block; writing-mode: vertical-rl; text-orientation: upright;
  font-size: 8.5px; letter-spacing: -1px; line-height: 1; text-transform: uppercase; font-weight: 500;
}
.tabela-servicos tbody tr.servico { cursor: pointer; }
.tabela-servicos tbody tr.servico:hover td:not(.grupo) { background: var(--fundo-suave); }
.tabela-servicos tbody a { text-decoration: none; }
.tabela-servicos tbody tr.servico:hover a { text-decoration: underline; }
.dica { color: var(--texto-suave); font-size: .9rem; margin: -6px 0 12px; }

/* ---- Descrição dos serviços (páginas 9 a 32) ---- */
.grupo-titulo { font-size: 1.25rem; font-weight: 500; margin: 34px 0 6px; }
.grupo-intro { margin: 8px 0 18px; }
.detalhe { width: 100%; border-collapse: collapse; margin: 18px 0 8px; font-size: 13.5px; }
.detalhe th, .detalhe td { border: 1px solid var(--linha); padding: 9px 10px; vertical-align: middle; text-align: left; }
.detalhe th { background: var(--azul); color: #fff; font-weight: 500; width: 25%; text-transform: uppercase; font-size: 12.5px; }
.detalhe thead th, .detalhe thead td { background: var(--azul); color: #fff; font-weight: 500; text-transform: none; font-size: 13.5px; }
.detalhe:target { outline: 3px solid #f2b705; outline-offset: 3px; }
.detalhe p { margin: 0 0 4px; }
.detalhe p:last-child { margin-bottom: 0; }
.detalhe ul { margin: 2px 0 4px; padding-left: 52px; }
.detalhe ul ul, .detalhe ul.sub { padding-left: 74px; list-style: circle; }
.detalhe li { margin: 2px 0; }
.detalhe li::marker { color: #000; }
.detalhe .criterios { border-collapse: collapse; margin: 6px 0 14px; width: min(100%, 470px); }
.detalhe .criterios td { border: 1px solid var(--linha); padding: 7px 8px; background: #fff; }
.voltar { display: inline-block; font-size: .85rem; color: var(--texto-suave); margin-bottom: 4px; }
.vazio { padding: 28px; text-align: center; color: var(--texto-suave); border: 1px dashed var(--linha-clara); border-radius: var(--raio); }

/* ---- Rodapé (endereço da MTI, como no PDF) ---- */
.rodape { text-align: center; color: #888; font-family: "Times New Roman", serif; font-size: 13px; line-height: 1.35; padding: 22px 16px 30px; border-top: 1px solid #eee; }
.rodape a.admin { display: inline-block; margin-top: 10px; font-family: "Quicksand", sans-serif; color: #aab; font-size: 12px; }

/* ---- Componentes comuns ---- */
.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--azul); background: #fff; color: var(--azul);
  padding: 9px 16px; border-radius: var(--raio); font-weight: 600; cursor: pointer; text-decoration: none;
  min-height: 40px;
}
.botao:hover { background: var(--fundo-suave); }
.botao.principal { background: var(--azul); color: #fff; }
.botao.principal:hover { background: var(--azul-escuro); }
.botao.perigo { border-color: var(--vermelho); color: var(--vermelho); }
.botao.pequeno { padding: 5px 10px; min-height: 32px; font-size: .88rem; }
.botao:disabled { opacity: .55; cursor: default; }
.campo { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 600; color: var(--azul); min-width: 0; }
.campo input, .campo select, .campo textarea {
  font-weight: 500; font-size: .95rem; border: 1px solid #aab4cf; border-radius: 6px; padding: 8px 10px; background: #fff; min-height: 40px; width: 100%;
}
.campo textarea { resize: vertical; min-height: 64px; line-height: 1.4; }
.campo input:focus, .campo select:focus, .campo textarea:focus, .botao:focus-visible { outline: 2px solid #f2b705; outline-offset: 1px; }
.campo small { font-weight: 400; color: var(--texto-suave); }
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 100;
  background: var(--azul); color: #fff; padding: 12px 18px; border-radius: var(--raio); box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
  max-width: calc(100vw - 32px);
}
.toast.erro { background: var(--vermelho); }

/* ---- Gerar OS ---- */
.resumo-os { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1px solid var(--linha); margin: 6px 0 20px; }
.resumo-os div { padding: 12px 14px; border-right: 1px solid var(--linha); }
.resumo-os div:last-child { border-right: 0; }
.resumo-os span { display: block; font-size: .8rem; text-transform: uppercase; color: #fff; background: var(--azul); margin: -12px -14px 10px; padding: 7px 14px; }
.resumo-os b { font-size: 1.35rem; color: var(--azul); }
.dados-os { border: 1px solid var(--linha); margin-bottom: 18px; }
.dados-os h3 { background: var(--azul); color: #fff; font-size: .95rem; font-weight: 600; padding: 9px 12px; }
.grade-os { padding: 12px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.grade-os .largo { grid-column: 1 / -1; }
@media (max-width: 760px) { .grade-os { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 460px) { .grade-os { grid-template-columns: 1fr; } }
.incluir { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; background: var(--fundo-suave); padding: 14px; border-radius: var(--raio); margin-bottom: 18px; }
.incluir .campo { flex: 1 1 380px; }
.item-os { border: 1px solid var(--linha); margin-bottom: 16px; }
.item-os header { background: var(--azul); color: #fff; padding: 9px 12px; display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.item-os header b { font-weight: 600; }
.item-os header small { display: block; opacity: .85; font-size: .8rem; }
.item-os header .botao { border-color: #fff; color: #fff; background: transparent; }
.item-os header .botao:hover { background: rgba(255, 255, 255, .12); }
.item-os .corpo { padding: 12px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.item-os .corpo .largo { grid-column: 1 / -1; }
.item-os .conta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; border-top: 1px solid var(--linha-clara); padding-top: 10px; }
.item-os .conta b { color: var(--azul); }
.esforco-os { grid-column: 1 / -1; background: var(--fundo-suave); border-radius: 6px; padding: 10px 12px; font-size: .9rem; }
.esforco-os .rotulo { display: inline-block; background: var(--azul); color: #fff; font-size: .75rem; font-weight: 600; padding: 3px 8px; border-radius: 4px; margin-bottom: 6px; }
.esforco-os p { margin: 0 0 4px; }
.esforco-os ul { margin: 2px 0; padding-left: 22px; }
.esforco-os .criterios { border-collapse: collapse; width: min(100%, 560px); background: #fff; }
.esforco-os .criterios th, .esforco-os .criterios td { border: 1px solid var(--linha); padding: 6px 8px; text-align: left; }
.esforco-os .criterios th { background: var(--azul); color: #fff; font-weight: 500; font-size: .82rem; }
.esforco-os .criterios tr[data-nivel] { cursor: pointer; }
.esforco-os .criterios tr[data-nivel]:hover td, .esforco-os .criterios tr[data-nivel]:focus-visible td { background: #e8edf8; }
.esforco-os .criterios tr.escolhido td { background: #dce3f2; font-weight: 700; }
.esforco-os .criterios tr.escolhido td:first-child::before { content: "✓ "; }
.item-os .regra { white-space: pre-line; font-size: .85rem; color: var(--texto-suave); grid-column: 1 / -1; background: var(--fundo-suave); padding: 8px 10px; border-radius: 6px; }
.item-os details { grid-column: 1 / -1; font-size: .88rem; }
.item-os details summary { cursor: pointer; color: var(--texto-suave); }
.acoes-os { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
@media (max-width: 760px) { .item-os .corpo { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 460px) {
  .item-os .corpo { grid-template-columns: 1fr; }
  .resumo-os { grid-template-columns: 1fr; }
  .resumo-os div { border-right: 0; border-bottom: 1px solid var(--linha); }
  .navegacao a { padding: 13px 12px; }
}
/* ---- Gerar OS: serviço em cascata (expande/retrai) ---- */
.item-os .alternar-item {
  flex: 1; min-width: 0; display: flex; gap: 10px; align-items: center; text-align: left;
  background: none; border: 0; color: inherit; padding: 0; cursor: pointer; font: inherit;
}
.item-os .alternar-item:focus-visible { outline: 2px solid #f2b705; outline-offset: 3px; }
.item-os .seta { flex: none; width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.6); border-radius: 50%; font-size: .7rem; transition: transform .15s; }
.item-os .alternar-item[aria-expanded="true"] .seta { transform: rotate(90deg); }
.item-os .resumo-item { display: block; margin-top: 2px; font-size: .8rem; color: #ffe39a; font-weight: 600; }

/* ---- Gerar OS: totais flutuantes e voltar ao topo ---- */
#os { padding-bottom: 96px; }
/* Quadro de totais e botão "voltar ao topo" lado a lado, fixos no canto inferior direito (um nunca cobre o outro). */
.flutuante-os { position: fixed; right: 16px; bottom: 16px; z-index: 40; display: flex; flex-direction: row; align-items: center; gap: 10px; }
.totais-flutuantes {
  display: flex; gap: 6px 18px; align-items: baseline; white-space: nowrap;
  background: var(--azul); color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: 0 6px 24px rgba(0, 20, 60, .3);
  font-size: .8rem; text-transform: uppercase; letter-spacing: .02em;
}
.totais-flutuantes b { font-size: 1.05rem; text-transform: none; margin-left: 6px; letter-spacing: 0; }
.botao-topo {
  flex: none; width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--azul); cursor: pointer;
  background: #fff; color: var(--azul); font-size: 1.3rem; font-weight: 700; box-shadow: 0 4px 16px rgba(0, 20, 60, .3);
}
.botao-topo:hover { background: var(--fundo-suave); }
.botao-topo:focus-visible { outline: 2px solid #f2b705; outline-offset: 2px; }
@media (max-width: 560px) {
  .flutuante-os { left: 12px; right: 12px; bottom: 12px; }
  .totais-flutuantes { flex: 1; min-width: 0; justify-content: space-between; font-size: .68rem; padding: 9px 12px; }
  .totais-flutuantes b { font-size: .95rem; margin-left: 4px; }
  .botao-topo { width: 42px; height: 42px; }
}

/* ---- Catálogo: detalhamento em modal ---- */
dialog#d-detalhe { border: 0; border-radius: 12px; padding: 0; width: min(920px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); color: var(--texto); }
dialog#d-detalhe[open] { display: flex; flex-direction: column; }
dialog#d-detalhe::backdrop { background: rgba(0, 20, 60, .5); }
#d-detalhe .modal-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--linha-clara); }
#d-detalhe .modal-topo h2 { font-size: 1.05rem; }
#d-detalhe .modal-corpo { overflow-y: auto; padding: 4px 16px 16px; }
#d-detalhe .modal-corpo .detalhe { margin-top: 12px; }
#d-detalhe .grupo-modal { color: var(--texto-suave); font-size: .9rem; margin: 12px 0 0; }

@media print {
  .navegacao, .rodape a.admin, .voltar, .dica, .flutuante-os { display: none !important; }
  .detalhe { break-inside: avoid; }
}
