/* Identidade visual AYCA — mesmo padrão do módulo AT do sistema AYCA */
:root {
  --primaria: #CC1616;
  --primaria-escura: #a81111;
  --primaria-clara: #fdecec;
  --escuro: #1A1210;
  --info: #2563eb;
  --info-claro: #eff6ff;
  --verde: #16a34a;
  --verde-escuro: #15803d;
  --verde-claro: #e7f6ec;
  --vermelho: #b91c1c;
  --vermelho-claro: #fdecea;
  --amarelo: #a16207;
  --amarelo-claro: #fff6db;
  --texto: #1f2937;
  --sub: #6b7280;
  --borda: #e5e7eb;
  --fundo: #f4f5f7;
  --card: #ffffff;
  --raio: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Barlow', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fundo); color: var(--texto); font-size: 15px; line-height: 1.45;
  overflow-x: hidden;
}
h1, h2, h3 { margin: 0 0 .6rem; line-height: 1.2; font-family: 'Barlow Condensed', 'Barlow', sans-serif; font-weight: 700; color: var(--escuro); }
h2 { font-size: 1.25rem; margin-top: 1.6rem; letter-spacing: .3px; }
h3 { font-size: 1.2rem; letter-spacing: .3px; }
.sub { color: var(--sub); font-size: .85rem; font-weight: normal; font-family: 'Barlow', sans-serif; letter-spacing: 0; }
.hidden { display: none !important; }
.vazio { color: var(--sub); padding: 1rem; background: var(--card); border: 1px dashed var(--borda); border-radius: var(--raio); text-align: center; }
a { color: var(--primaria); }

/* ---------- Topo ---------- */
.topo {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--escuro); color: #fff; padding: 0 1.2rem; height: 60px;
}
.topo .marca { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topo .marca img { height: 32px; display: block; }
.topo .h-title {
  font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 700; letter-spacing: 3px;
  text-transform: uppercase; color: rgba(255, 255, 255, .45); white-space: nowrap;
}
.topo .usuario { display: flex; align-items: center; gap: .9rem; font-size: .85rem; }
.topo .usuario .nome { color: rgba(255, 255, 255, .75); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.topo .btn-link { color: #fff; text-decoration: none; font-weight: 600; opacity: .85; }
.topo .btn-link:hover { opacity: 1; }
.container { max-width: 1200px; margin: 0 auto; padding: 1.4rem 1.2rem; }
.container.estreito { max-width: 560px; }

/* ---------- Abas ---------- */
.tabs { display: flex; gap: .25rem; overflow-x: auto; background: #fff; border-bottom: 1px solid var(--borda); padding: 0 .8rem; }
.tabs button {
  background: none; border: 0; color: var(--sub); padding: .85rem 1rem; font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer;
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.tabs button:hover { color: var(--escuro); }
.tabs button.ativo { color: var(--primaria); border-bottom-color: var(--primaria); }

/* ---------- Formulários ---------- */
label { display: block; font-size: .8rem; font-weight: 700; margin: .8rem 0 .3rem; color: var(--escuro); letter-spacing: .2px; }
input, select, textarea {
  width: 100%; padding: .6rem .7rem; font: inherit; color: inherit;
  border: 1.5px solid var(--borda); border-radius: 4px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primaria); }
.linha { display: flex; gap: .5rem; }
.linha > input { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .8rem; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .3rem; }
label.check { font-weight: 500; margin: 0; display: flex; gap: .5rem; align-items: center; padding: .45rem .5rem; border: 1.5px solid var(--borda); border-radius: 4px; cursor: pointer; }
label.check input { width: auto; accent-color: var(--primaria); }
.filtros { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: 1rem; background: #fff; padding: .9rem 1rem; border-radius: var(--raio); border: 1px solid var(--borda); }
.filtros > div { min-width: 150px; }
.filtros label { margin-top: 0; }
.ajuda { font-size: .8rem; color: var(--sub); margin-top: .3rem; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  background: var(--primaria); color: #fff; border: 0; border-radius: 4px;
  padding: .62rem 1.1rem; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s;
}
.btn:hover:not(:disabled) { background: var(--primaria-escura); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sec { background: #fff; color: #374151; border: 1.5px solid var(--borda); }
.btn.sec:hover:not(:disabled) { background: #fff; border-color: #9ca3af; color: var(--texto); }
.btn.verde { background: var(--verde); }
.btn.verde:hover:not(:disabled) { background: var(--verde-escuro); }
.btn.grande { width: 100%; padding: 1rem; font-size: 1.05rem; letter-spacing: .5px; border-radius: var(--raio); }
.btn-link { background: none; border: 0; color: var(--primaria); cursor: pointer; font: inherit; padding: .3rem 0; text-decoration: underline; }
.btn-mini { background: #fff; border: 1.5px solid var(--borda); border-radius: 4px; padding: .25rem .6rem; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; margin: 0 .2rem .2rem 0; color: #374151; }
.btn-mini:hover { border-color: #9ca3af; }
.btn-mini.perigo { color: var(--vermelho); }
.barra { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.barra .grupo { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--borda); border-radius: var(--raio); padding: 1rem; margin-bottom: .8rem; box-shadow: 0 1px 3px rgba(0, 0, 0, .05); }
.card h3 { margin-bottom: .2rem; }
.gps { display: flex; align-items: center; gap: .6rem; font-size: .9rem; }
.gps .ponto { width: 10px; height: 10px; border-radius: 50%; background: var(--sub); flex: none; }
.gps.bom .ponto { background: var(--verde); }
.gps.ruim .ponto { background: #f59e0b; }
.gps.erro .ponto { background: var(--vermelho); }

.dist { display: inline-block; margin: .5rem 0; padding: .25rem .6rem; border-radius: 99px; font-size: .85rem; font-weight: 600; }
.dist.dentro { background: var(--verde-claro); color: var(--verde-escuro); }
.dist.fora { background: var(--vermelho-claro); color: var(--vermelho); }
.dist.sem { background: var(--fundo); color: var(--sub); }

.linha-tempo { display: grid; grid-template-columns: repeat(4, 1fr); gap: .3rem; margin: .8rem 0; }
.passo { text-align: center; padding: .5rem .2rem; border-radius: 4px; background: var(--fundo); font-size: .72rem; color: var(--sub); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.passo strong { display: block; font-size: 1.1rem; color: var(--texto); font-family: 'Barlow Condensed', sans-serif; letter-spacing: 0; }
.passo.feito { background: var(--verde-claro); color: var(--verde-escuro); }
.acoes-ponto { display: grid; gap: .5rem; }
.obs { font-size: .85rem; background: var(--amarelo-claro); padding: .4rem .6rem; border-radius: 4px; margin-top: .4rem; }
.item-lista { display: flex; justify-content: space-between; gap: .5rem; align-items: center; padding: .6rem .8rem; background: var(--card); border: 1px solid var(--borda); border-left: 3px solid var(--primaria); border-radius: var(--raio); margin-bottom: .4rem; text-decoration: none; color: inherit; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 700; background: var(--fundo); color: var(--sub); white-space: nowrap; }
.st-agendado { background: var(--info-claro); color: var(--info); }
.st-em_andamento { background: var(--amarelo-claro); color: var(--amarelo); }
.st-concluido, .ok { background: var(--verde-claro); color: var(--verde-escuro); }
.st-cancelado, .pend { background: var(--vermelho-claro); color: var(--vermelho); }

/* ---------- Tabelas ---------- */
.tabela-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--borda); border-radius: var(--raio); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: .6rem .65rem; border-bottom: 1px solid var(--borda); text-align: left; vertical-align: top; }
th { background: #fafafa; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: var(--sub); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.cancelado td { opacity: .5; text-decoration: line-through; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.cel-hora { cursor: pointer; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.cel-hora:hover { background: var(--primaria-clara); }
td.cel-hora.ajustado { color: var(--amarelo); font-weight: 700; }
td.acoes { white-space: nowrap; }

.resumo { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.resumo .card { margin: 0; border-left: 4px solid var(--primaria); }
.resumo .grande { font-family: 'Barlow Condensed', sans-serif; font-size: 2rem; font-weight: 700; color: var(--escuro); font-variant-numeric: tabular-nums; line-height: 1.1; margin: .2rem 0; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(26, 18, 16, .55); display: flex; align-items: flex-start; justify-content: center; padding: 1rem; overflow-y: auto; z-index: 50; }
.modal-box { background: #fff; border-radius: 8px; padding: 1.3rem; width: 100%; max-width: 480px; margin: 2rem 0; border-top: 4px solid var(--primaria); }
.modal-box.largo { max-width: 720px; }
.modal-acoes { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.2rem; }
.mapa { height: 320px; border-radius: var(--raio); margin-top: .8rem; border: 1px solid var(--borda); }
.resultados { display: grid; gap: .3rem; margin-top: .4rem; }
.resultado { text-align: left; background: var(--fundo); border: 1px solid var(--borda); border-radius: 4px; padding: .45rem .6rem; cursor: pointer; font: inherit; font-size: .85rem; }
.resultado:hover { border-color: var(--primaria); }
.historico { margin-top: 1rem; font-size: .85rem; }
.historico div { border-left: 3px solid #f59e0b; padding: .3rem .6rem; margin-bottom: .4rem; background: var(--amarelo-claro); }
.secao { margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--borda); }
.secao-titulo { font-size: .7rem; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--sub); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 1.2rem; transform: translate(-50%, 150%);
  background: var(--escuro); color: #fff; padding: .8rem 1.1rem; border-radius: 6px;
  max-width: calc(100% - 2rem); width: max-content; z-index: 100; transition: transform .25s;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .2); font-weight: 500;
}
.toast.show { transform: translate(-50%, 0); }
.toast.erro { background: var(--vermelho); }
.toast.ok { background: var(--verde); }

/* ---------- Login ---------- */
.pagina-login { min-height: 100vh; background: linear-gradient(155deg, #0e0000 0%, #5c0000 50%, #8a0000 100%); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login { width: 100%; max-width: 400px; }
.login .card { padding: 2rem 1.6rem 1.6rem; border: 0; border-radius: 10px; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.login .logo { display: block; width: 190px; margin: 0 auto .4rem; }
.login .titulo { text-align: center; font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: .85rem; letter-spacing: 3px; text-transform: uppercase; color: var(--sub); margin-bottom: 1rem; }
.login .rodape { text-align: center; color: rgba(255, 255, 255, .5); font-size: .75rem; margin-top: 1rem; }
.aviso { padding: .7rem .9rem; border-radius: 4px; background: var(--vermelho-claro); color: var(--vermelho); font-size: .9rem; margin-top: 1rem; }

/* ---------- Comprovante ---------- */
.comprovante { background: #fff; border: 1px solid var(--borda); border-top: 4px solid var(--primaria); border-radius: var(--raio); padding: 1.4rem; }
.comprovante .logo { display: block; width: 130px; margin: 0 auto .6rem; }
.comprovante .cab { text-align: center; border-bottom: 2px dashed var(--borda); padding-bottom: .8rem; margin-bottom: .8rem; }
.comprovante .tipo { font-family: 'Barlow Condensed', sans-serif; font-size: 1.5rem; font-weight: 700; color: var(--primaria); }
.comprovante .hora { font-family: 'Barlow Condensed', sans-serif; font-size: 2.4rem; font-weight: 700; color: var(--escuro); font-variant-numeric: tabular-nums; line-height: 1.1; }
.comprovante dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem .8rem; margin: 0; font-size: .9rem; }
.comprovante dt { color: var(--sub); }
.comprovante dd { margin: 0; font-weight: 600; word-break: break-word; }
.comprovante .codigo { font-family: ui-monospace, Consolas, monospace; letter-spacing: .08em; font-size: 1.05rem; }
.comprovante .rodape { margin-top: 1rem; padding-top: .8rem; border-top: 2px dashed var(--borda); font-size: .75rem; color: var(--sub); text-align: center; }

.so-impressao { display: none; }
.so-impressao img { height: 40px; margin-bottom: .5rem; }

@media (max-width: 600px) {
  .grid2 { grid-template-columns: 1fr; }
  .container { padding: 1rem .8rem; }
  .topo { padding: 0 .9rem; }
  .topo .h-title, .topo .usuario .nome { display: none; }
  .topo .marca img { height: 28px; }
}

@media print {
  body { background: #fff; font-size: 11px; }
  .topo, .tabs, .filtros, .barra, .nao-imprimir, .toast, .modal { display: none !important; }
  .so-impressao { display: block; }
  .container { max-width: none; padding: 0; }
  .tabela-wrap, .card, .comprovante { border: 1px solid #999; box-shadow: none; }
  th { background: #eee !important; }
  td.cel-hora.ajustado { color: #000; }
  tr { page-break-inside: avoid; }
}
