/* Central Suporte no celular. Mesmas cores da Central (claro: azul; escuro: tons quentes). */
:root {
  --fundo: #f6f7f9;
  --painel: #ffffff;
  --texto: #1f2328;
  --muted: #6b7280;
  --linha: #e5e7eb;
  --hover: #eef2f7;
  --primaria: #2563eb;
  --topo: #2b3240;
  --topo-txt: #ffffff;
  --raio: 12px;
  --blue: #3b82f6; --yellow: #eab308; --orange: #f97316; --red: #ef4444;
  --gray: #9ca3af; --pink: #ec4899; --purple: #8b5cf6; --green: #22c55e;
  color-scheme: light;
}
:root[data-tema="escuro"] {
  --fundo: #262624; --painel: #30302e; --texto: #faf9f5; --muted: #b7b5a9; --linha: #3e3e3a;
  --hover: #383835; --primaria: #d97757; --topo: #1f1e1d; --topo-txt: #faf9f5;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-tema="sistema"] {
    --fundo: #262624; --painel: #30302e; --texto: #faf9f5; --muted: #b7b5a9; --linha: #3e3e3a;
    --hover: #383835; --primaria: #d97757; --topo: #1f1e1d; --topo-txt: #faf9f5;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--texto); background: var(--fundo);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.pequeno { font-size: 13px; }
.centro { text-align: center; }
.trunca { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.carregando { padding: 40px; text-align: center; color: var(--muted); }
.ico { flex-shrink: 0; vertical-align: middle; }

/* ---------- Topo ---------- */
.topo {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) 12px 10px;
  background: var(--topo); color: var(--topo-txt);
}
.marca { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #3b82f6, #8b5cf6); color: #fff; }
:root[data-tema="escuro"] .marca { background: #d97757; }
@media (prefers-color-scheme: dark) { :root[data-tema="sistema"] .marca { background: #d97757; } }
.topo-txt { flex: 1; min-width: 0; }
.topo h1 { margin: 0; font-size: 18px; font-weight: 600; }
.topo-sub { font-size: 12px; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topo-btn, .topo-voltar { border: 0; background: transparent; color: inherit; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; }
.topo-btn:active, .topo-voltar:active { background: rgba(255,255,255,.12); }
.girando .ico { animation: girar 1s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
.faixa-erro { margin: 10px 12px 0; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--orange) 15%, var(--painel)); font-size: 14px; }

/* ---------- Tela e abas ---------- */
.tela { padding: 12px 12px calc(env(safe-area-inset-bottom) + 86px); max-width: 720px; margin: 0 auto; }
.abas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; background: var(--painel); border-top: 1px solid var(--linha);
  padding-bottom: env(safe-area-inset-bottom);
}
.abas a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; font-size: 11px; color: var(--muted); position: relative; }
.abas a.ativa { color: var(--primaria); font-weight: 600; }
.abas .ponto { position: absolute; top: 6px; right: calc(50% - 16px); width: 8px; height: 8px; border-radius: 50%; background: var(--red); }

/* ---------- Peças ---------- */
.cartao { background: var(--painel); border: 1px solid var(--linha); border-radius: var(--raio); padding: 14px; margin-bottom: 12px; }
.cartao.destaque { border-color: var(--primaria); }
.cartao.texto { white-space: pre-wrap; word-break: break-word; }
.secao { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; margin: 18px 4px 8px; }
.linha-entre { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--linha); background: var(--painel); border-radius: 10px;
  padding: 11px 14px; font-weight: 500; cursor: pointer; min-height: 44px;
}
.btn:active { background: var(--hover); }
.btn-bloco { display: flex; width: 100%; margin-top: 10px; }
.btn-primario { background: var(--primaria); border-color: var(--primaria); color: #fff; }
.btn-perigo { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--linha)); }
.btn-peq { padding: 6px 10px; min-height: 38px; font-size: 14px; }
.btn-whats { color: #16a34a; }
.btn:disabled { opacity: .6; }
.input {
  width: 100%; font: inherit; font-size: 16px; color: var(--texto); background: var(--painel);
  border: 1px solid var(--linha); border-radius: 10px; padding: 11px 12px;
}
.input:focus { outline: 2px solid color-mix(in srgb, var(--primaria) 50%, transparent); border-color: var(--primaria); }
.badge, .chip { --c: var(--gray); display: inline-block; border-radius: 6px; font-size: 12px; font-weight: 500; white-space: nowrap;
  color: color-mix(in srgb, var(--c) 80%, var(--texto)); background: color-mix(in srgb, var(--c) 16%, transparent); }
.badge { padding: 2px 8px; flex-shrink: 0; }
.chip { padding: 7px 11px; font-size: 13px; }
.c-blue { --c: var(--blue); } .c-yellow { --c: var(--yellow); } .c-orange { --c: var(--orange); }
.c-red { --c: var(--red); } .c-gray { --c: var(--gray); } .c-pink { --c: var(--pink); }
.c-purple { --c: var(--purple); } .c-green { --c: var(--green); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.vazio { text-align: center; color: var(--muted); padding: 24px 10px; }

.segmentos { display: flex; background: var(--hover); border-radius: 11px; padding: 3px; gap: 2px; margin-bottom: 10px; overflow-x: auto; }
.segmentos button { flex: 1; border: 0; background: transparent; padding: 8px 6px; border-radius: 9px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.segmentos button.ativo { background: var(--painel); color: var(--texto); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.1); }

.busca { position: relative; margin-bottom: 8px; }
.busca .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.busca .input { padding-left: 38px; }
.contagem { margin: 0 4px 8px; }
.filtro-ativo { display: flex; align-items: center; gap: 8px; margin: 0 4px 8px; font-size: 14px; }
.filtro-ativo button { border: 0; background: none; color: var(--primaria); padding: 4px; }

/* ---------- Listas ---------- */
.lista { display: flex; flex-direction: column; gap: 8px; }
.item { display: block; background: var(--painel); border: 1px solid var(--linha); border-radius: var(--raio); padding: 11px 13px; }
a.item:active { background: var(--hover); }
.item-lin1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.item-lin2 { font-size: 13px; margin-top: 1px; }
.item-desc { font-size: 14px; margin-top: 5px; color: color-mix(in srgb, var(--texto) 85%, var(--muted));
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.dia-cab { font-weight: 600; margin: 12px 4px 0; font-size: 14px; }
.dia-cab:first-child { margin-top: 2px; }

/* ---------- Início ---------- */
.saudacao { display: flex; flex-direction: column; margin: 4px 4px 12px; }
.saudacao strong { font-size: 20px; }
.numeros { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 6px; }
.numeros a { background: var(--painel); border: 1px solid var(--linha); border-radius: var(--raio); padding: 10px 4px; text-align: center; display: flex; flex-direction: column; }
.numeros b { font-size: 22px; line-height: 1.2; }
.numeros span { font-size: 12px; color: var(--muted); }
.numeros a.destaque { border-color: color-mix(in srgb, var(--primaria) 55%, var(--linha)); }
.numeros a.destaque b { color: var(--primaria); }
.aviso { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; margin-bottom: 10px; border-radius: var(--raio);
  background: color-mix(in srgb, var(--purple) 12%, var(--painel)); border: 1px solid color-mix(in srgb, var(--purple) 30%, var(--linha)); font-size: 14px; }
.aviso .ico { color: var(--purple); margin-top: 1px; }
.aviso-escala { background: color-mix(in srgb, var(--green) 12%, var(--painel)); border-color: color-mix(in srgb, var(--green) 30%, var(--linha)); }
.aviso-escala .ico { color: var(--green); }

/* ---------- Atendimento e cliente ---------- */
.cli-mini { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--linha); margin-top: 4px; }
.tel { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0 2px; border-top: 1px solid var(--linha); margin-top: 6px; }
.tel span { flex: 1 1 100%; font-weight: 500; }
.nome-grande { margin: 0 0 8px; font-size: 20px; }
.dado { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--linha); font-size: 14px; }
.dado:first-child { border-top: 0; }
.dado span:last-child { text-align: right; word-break: break-word; }
.nome-grande + .dado { border-top: 0; }

/* ---------- Treinamentos ---------- */
.periodo { margin: 8px 4px 2px; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.eu { color: var(--green); font-weight: 600; }
.item.trein { display: flex; gap: 12px; align-items: flex-start; }
.item.trein.hoje { border-color: color-mix(in srgb, var(--primaria) 55%, var(--linha)); }
.trein-data { display: flex; flex-direction: column; align-items: center; min-width: 38px; padding-top: 2px; }
.trein-data b { font-size: 20px; line-height: 1; }
.trein-data small { font-size: 12px; color: var(--muted); }
.trein-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.selo { font-size: 11px; padding: 1px 6px; border-radius: 5px; font-weight: 600; background: color-mix(in srgb, var(--blue) 16%, transparent); color: color-mix(in srgb, var(--blue) 80%, var(--texto)); }
.selo.demo { background: color-mix(in srgb, var(--orange) 16%, transparent); color: color-mix(in srgb, var(--orange) 80%, var(--texto)); }
.escala table { width: 100%; border-collapse: collapse; font-size: 14px; }
.escala th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 4px 4px; }
.escala td { padding: 6px 4px; border-top: 1px solid var(--linha); }
.escala td:first-child { color: var(--muted); width: 74px; white-space: nowrap; }
.escala tr.hoje td { background: color-mix(in srgb, var(--primaria) 9%, transparent); }
.escala.minha { border-color: color-mix(in srgb, var(--green) 45%, var(--linha)); }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: color-mix(in srgb, var(--primaria) 14%, transparent); color: var(--primaria); font-weight: 600; }

/* ---------- Entrar ---------- */
.entrar { max-width: 420px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 48px) 18px 30px; text-align: center; }
.entrar-logo { width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 22px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #3b82f6, #8b5cf6); }
.entrar h1 { margin: 0 0 6px; font-size: 24px; }
.entrar-form { text-align: left; margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.campo { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; }
.erro-txt { color: var(--red); margin: 0; font-size: 14px; }

/* ---------- Aviso flutuante ---------- */
.aviso-flutuante {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 76px); transform: translateX(-50%);
  background: #1f2328; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 10;
  max-width: calc(100% - 32px); text-align: center; transition: opacity .3s;
}
.aviso-flutuante.sai { opacity: 0; }
