/* Morada Piscinas - visual do logo: azul degrade + laranja do sol. */

:root {
  --azul: #0B5FD0;
  --azul-claro: #1E88E5;
  --azul-escuro: #063C86;
  --laranja: #F26522;
  --laranja-claro: #F7941D;
  --tinta: #10243b;
  --cinza: #64748b;
  --linha: #dfe7f1;
  --fundo: #f2f6fb;
  --papel: #ffffff;
  --verde: #16a34a;
  --vermelho: #dc2626;
  --amarelo: #d97706;
  --raio: 12px;
  --sombra: 0 1px 3px rgba(16, 36, 59, .08), 0 6px 20px rgba(16, 36, 59, .05);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--fundo);
  color: var(--tinta);
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--azul); }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.25; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }

/* ---------------------------------------------------------------- topo */

#topo {
  position: sticky; top: 0; z-index: 40;
  background: linear-gradient(100deg, var(--azul-escuro), var(--azul) 55%, var(--azul-claro));
  color: #fff;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  box-shadow: 0 2px 10px rgba(6, 60, 134, .25);
}

#topo .marca { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: .3px; }
#topo .marca .gota {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(140deg, var(--laranja-claro), var(--laranja));
  display: grid; place-items: center; font-size: 15px;
}
#topo .marca small { display: block; font-weight: 400; font-size: 10px; opacity: .8; letter-spacing: 1.4px; }
#topo .espaco { flex: 1; }
#topo .quem { text-align: right; font-size: 12px; line-height: 1.3; }
#topo .quem b { display: block; font-size: 13px; }
#topo button.sair {
  background: rgba(255, 255, 255, .16); color: #fff; border: 0;
  padding: 7px 12px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
#botao-menu { display: none; background: rgba(255,255,255,.16); border: 0; color: #fff;
  width: 38px; height: 38px; border-radius: 9px; font-size: 19px; cursor: pointer; }

/* ---------------------------------------------------------------- layout */

#corpo { display: flex; min-height: calc(100vh - 56px); align-items: flex-start; }

#menu {
  width: 216px; flex: none; padding: 14px 10px; position: sticky; top: 56px;
  max-height: calc(100vh - 56px); overflow-y: auto;
}
#menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; color: var(--tinta);
  text-decoration: none; font-size: 14px; margin-bottom: 3px;
}
#menu a .ic { width: 20px; text-align: center; font-size: 15px; }
#menu a:hover { background: #e5eefb; }
#menu a.ativo { background: var(--azul); color: #fff; font-weight: 600; }
#menu a .selo {
  margin-left: auto; background: var(--laranja); color: #fff; border-radius: 20px;
  font-size: 11px; padding: 1px 7px; font-weight: 700;
}
#menu a.ativo .selo { background: #fff; color: var(--azul); }
#menu .grupo { font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--cinza); margin: 14px 12px 6px; }

#tela { flex: 1; padding: 16px; min-width: 0; }

/* ---------------------------------------------------------------- cartoes */

.cartao {
  background: var(--papel); border: 1px solid var(--linha);
  border-radius: var(--raio); padding: 14px; box-shadow: var(--sombra); margin-bottom: 14px;
}
.cartao > h2:first-child, .cartao > h3:first-child { margin-top: 0; }

.grade { display: grid; gap: 12px; }
.grade.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grade.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grade.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grade.auto { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

.indicador {
  background: var(--papel); border: 1px solid var(--linha); border-radius: var(--raio);
  padding: 12px 14px; box-shadow: var(--sombra); border-left: 4px solid var(--azul);
}
.indicador .rotulo { font-size: 12px; color: var(--cinza); text-transform: uppercase; letter-spacing: .5px; }
.indicador .valor { font-size: 25px; font-weight: 700; margin-top: 3px; line-height: 1.1; }
.indicador .nota { font-size: 12px; color: var(--cinza); margin-top: 2px; }
.indicador.laranja { border-left-color: var(--laranja); }
.indicador.verde { border-left-color: var(--verde); }
.indicador.vermelho { border-left-color: var(--vermelho); }
.indicador.vermelho .valor { color: var(--vermelho); }
.indicador.verde .valor { color: var(--verde); }

/* ---------------------------------------------------------------- tabela */

.rolagem { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--cinza); padding: 8px 10px; border-bottom: 2px solid var(--linha); white-space: nowrap;
}
td { padding: 9px 10px; border-bottom: 1px solid #eef3f9; vertical-align: middle; }
tbody tr:hover { background: #f7fafd; }
tr.clicavel { cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.vazio { padding: 30px; text-align: center; color: var(--cinza); }

/* ---------------------------------------------------------------- selos */

.selo {
  display: inline-block; padding: 3px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.s-aberta { background: #e0ecfd; color: #1d4ed8; }
.s-agendada { background: #dbeafe; color: #1e40af; }
.s-em_andamento { background: #fef3c7; color: #92400e; }
.s-aguardando_peca { background: #fee2e2; color: #b91c1c; }
.s-concluida { background: #dcfce7; color: #166534; }
.s-cancelada { background: #f1f5f9; color: #64748b; }
.s-urgente { background: #fee2e2; color: #b91c1c; }
.s-alta { background: #ffedd5; color: #c2410c; }
.s-normal { background: #eef2f7; color: #475569; }
.s-baixa { background: #f1f5f9; color: #94a3b8; }
.s-orcamento { background: #ede9fe; color: #6d28d9; }
.s-vencida { background: #fee2e2; color: #b91c1c; }
.s-ok { background: #dcfce7; color: #166534; }

/* ---------------------------------------------------------------- botoes */

button, .botao {
  font: inherit; cursor: pointer; border: 1px solid var(--linha);
  background: var(--papel); color: var(--tinta);
  padding: 9px 14px; border-radius: 9px; display: inline-flex;
  align-items: center; gap: 7px; text-decoration: none;
}
button:hover, .botao:hover { background: #f4f8fd; }
button.primario, .botao.primario {
  background: linear-gradient(100deg, var(--azul), var(--azul-claro));
  color: #fff; border-color: transparent; font-weight: 600;
}
button.primario:hover { filter: brightness(1.07); }
button.laranja {
  background: linear-gradient(100deg, var(--laranja), var(--laranja-claro));
  color: #fff; border-color: transparent; font-weight: 600;
}
button.perigo { color: var(--vermelho); border-color: #fecaca; }
button.pequeno { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
button:disabled { opacity: .5; cursor: not-allowed; }

.barra { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.barra .espaco { flex: 1; }

/* ---------------------------------------------------------------- form */

label.campo { display: block; margin-bottom: 10px; font-size: 12.5px; color: var(--cinza); }
label.campo > span { display: block; margin-bottom: 4px; font-weight: 600; }
input, select, textarea {
  font: inherit; width: 100%; padding: 9px 11px; border: 1px solid var(--linha);
  border-radius: 9px; background: #fff; color: var(--tinta);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(30, 136, 229, .35); border-color: var(--azul-claro);
}
textarea { min-height: 78px; resize: vertical; }
input[type=checkbox] { width: auto; }
.linha-check { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 14px; }

/* ---------------------------------------------------------------- janela */

.fundo-janela {
  position: fixed; inset: 0; background: rgba(10, 30, 55, .55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 12px; z-index: 100; overflow-y: auto;
}
.janela {
  background: var(--papel); border-radius: 14px; width: 100%; max-width: 720px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3); overflow: hidden;
}
.janela.larga { max-width: 980px; }
.janela header {
  padding: 13px 16px; border-bottom: 1px solid var(--linha);
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(100deg, var(--azul-escuro), var(--azul)); color: #fff;
}
.janela header h2 { margin: 0; font-size: 16px; flex: 1; }
.janela header button { background: rgba(255,255,255,.18); border: 0; color: #fff; }
.janela .conteudo { padding: 16px; max-height: 72vh; overflow-y: auto; }
.janela footer {
  padding: 12px 16px; border-top: 1px solid var(--linha);
  display: flex; gap: 8px; justify-content: flex-end; background: #f8fafd; flex-wrap: wrap;
}

/* ---------------------------------------------------------------- aviso */

#avisos { position: fixed; right: 14px; bottom: 14px; z-index: 200; display: grid; gap: 8px; }
.aviso {
  background: var(--tinta); color: #fff; padding: 11px 15px; border-radius: 10px;
  box-shadow: 0 8px 26px rgba(0,0,0,.28); font-size: 14px; max-width: 330px;
}
.aviso.erro { background: var(--vermelho); }
.aviso.ok { background: var(--verde); }

/* ---------------------------------------------------------------- login */

#login {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(150deg, var(--azul-escuro), var(--azul) 60%, var(--azul-claro));
}
#login .caixa {
  background: #fff; padding: 26px; border-radius: 16px; width: 100%; max-width: 370px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
#login .logo { text-align: center; margin-bottom: 18px; }
#login .logo .gota {
  width: 60px; height: 60px; border-radius: 18px; margin: 0 auto 10px;
  background: linear-gradient(140deg, var(--laranja-claro), var(--laranja));
  display: grid; place-items: center; font-size: 30px;
}
#login .logo b { font-size: 20px; color: var(--azul-escuro); }
#login .logo small { display: block; color: var(--cinza); letter-spacing: 3px; font-size: 11px; }

/* ---------------------------------------------------------------- diversos */

.aba-linha { display: flex; gap: 4px; border-bottom: 1px solid var(--linha); margin-bottom: 14px; overflow-x: auto; }
.aba-linha button {
  border: 0; background: none; border-bottom: 3px solid transparent; border-radius: 0;
  padding: 9px 13px; color: var(--cinza); white-space: nowrap;
}
.aba-linha button.ativo { color: var(--azul); border-bottom-color: var(--azul); font-weight: 600; }

.dinheiro { font-variant-numeric: tabular-nums; white-space: nowrap; }
.positivo { color: var(--verde); font-weight: 600; }
.negativo { color: var(--vermelho); font-weight: 600; }
.fraco { color: var(--cinza); font-size: 13px; }
.corte { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.item-lista {
  display: flex; gap: 10px; align-items: center; padding: 10px;
  border: 1px solid var(--linha); border-radius: 10px; margin-bottom: 8px; background: #fff;
}
.item-lista .cresce { flex: 1; min-width: 0; }

.barra-progresso { height: 8px; background: #e8eef7; border-radius: 6px; overflow: hidden; }
.barra-progresso i { display: block; height: 100%; background: linear-gradient(90deg, var(--azul), var(--azul-claro)); }

.linha-tempo { border-left: 2px solid var(--linha); margin-left: 8px; padding-left: 14px; }
.linha-tempo .evt { position: relative; padding-bottom: 12px; font-size: 13.5px; }
.linha-tempo .evt::before {
  content: ''; position: absolute; left: -20px; top: 5px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--azul);
}

.busca-viva { position: relative; }
.busca-viva .sugestoes {
  position: absolute; z-index: 30; left: 0; right: 0; background: #fff;
  border: 1px solid var(--linha); border-radius: 10px; box-shadow: var(--sombra);
  max-height: 260px; overflow-y: auto;
}
.busca-viva .sugestoes div { padding: 9px 11px; cursor: pointer; font-size: 14px; }
.busca-viva .sugestoes div:hover { background: #eef5fd; }

/* ---------------------------------------------------------------- celular */

@media (max-width: 860px) {
  body { font-size: 15px; }
  #botao-menu { display: block; }
  #menu {
    position: fixed; top: 56px; left: 0; bottom: 0; width: 250px; background: #fff;
    z-index: 50; transform: translateX(-102%); transition: transform .18s;
    box-shadow: 6px 0 24px rgba(0,0,0,.16); max-height: none;
  }
  #menu.aberto { transform: none; }
  #tela { padding: 12px 10px 70px; }
  .grade.n2, .grade.n3, .grade.n4 { grid-template-columns: 1fr; }
  .grade.auto { grid-template-columns: 1fr 1fr; }
  #topo .quem span { display: none; }
  .janela { max-width: none; border-radius: 12px; }
  .janela .conteudo { max-height: none; }
  .indicador .valor { font-size: 22px; }
  th, td { padding: 8px 7px; font-size: 13.5px; }
  .esconde-celular { display: none !important; }
}

@media (max-width: 460px) {
  .grade.auto { grid-template-columns: 1fr; }
}

@media print {
  #topo, #menu, .barra, .janela footer, #avisos { display: none !important; }
  body { background: #fff; }
  .cartao { box-shadow: none; border: 1px solid #ccc; }
  .fundo-janela { position: static; background: none; padding: 0; }
  .janela { max-width: none; box-shadow: none; }
  .janela .conteudo { max-height: none; overflow: visible; }
}

/* ---------------------------------------------------------------- logo oficial */
/* A arte e usada inteira, sobre placa branca, sem recorte nem troca de cor. */
#topo .placa-logo {
  display: inline-flex; background: #fff; border-radius: 9px; padding: 3px 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .15);
}
#topo .placa-logo img { display: block; height: 36px; width: auto; }
#topo a.marca { text-decoration: none; }
#login .logo img { display: block; margin: 0 auto 6px; max-width: 220px; height: auto; }
.pedido-site { border-left: 4px solid var(--laranja); }
.botao.laranja { background: linear-gradient(100deg, var(--laranja), var(--laranja-claro)); color: #fff; border-color: transparent; font-weight: 600; }

/* ---------------------------------------------------------------- ficha da ordem */
.grade.ficha-grade { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .grade.ficha-grade { grid-template-columns: 1fr; } }
.acoes-item { white-space: nowrap; }
.acoes-item button { padding: 5px 9px; font-size: 14px; line-height: 1; }

/* ------------------------------------------------ assinatura na tela */
.assina { border: 1px solid var(--linha); border-radius: 12px; padding: 10px 12px; margin: 8px 0 14px; background: #fff; }
.assina-topo { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.assina canvas { width: 100%; height: auto; aspect-ratio: 3 / 1; border: 1px dashed var(--linha);
  border-radius: 10px; touch-action: none; background: #fff; display: block; }
.marcar { display: flex; align-items: center; gap: 10px; margin: 10px 0; font-size: 15px; }
.marcar input { width: 20px; height: 20px; }
.risco { border: 0; border-top: 1px solid var(--linha); margin: 18px 0 10px; }
.titulinho { font-size: 16px; margin: 0 0 8px; }

/* ------------------------------------------------ manual */
.passo-a-passo { margin: 8px 0 0; padding-left: 22px; }
.passo-a-passo li { margin-bottom: 8px; line-height: 1.55; }
.atencao { background: #fff6e8; border-left: 4px solid var(--laranja); border-radius: 0 10px 10px 0;
  padding: 10px 14px; margin: 12px 0 0; }
.dica { background: #eef4ff; border-left: 4px solid var(--azul); border-radius: 0 10px 10px 0;
  padding: 10px 14px; margin: 12px 0 0; }
.divisor-manual { margin: 26px 0 10px; font-size: 20px; color: var(--azul-escuro); }
.indice-manual { display: grid; gap: 10px; margin-top: 10px; }
.indice-manual a { color: var(--azul); text-decoration: none; }
.indice-manual a:hover { text-decoration: underline; }
@media print {
  #topo, #menu, .barra button, .botao { display: none !important; }
  #corpo, #tela { display: block !important; }
  .cartao { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
}
