/* ZeraCRM 2 (rodada 2) — casca copiada do Zera Hub (que copiou do ZeraSync 2) e adaptada ao CRM (DESIGN §3):
   trilho de 68 px, topo de 56 px com o logo ZeraCRM, seletor de base, busca, + Novo, sino, avatar, faixa
   "Suporte Zera", miolo e barra de baixo no celular. As classes .seletor-empresa e .faixa-equipe-zera são as do
   kit (o CRM chama de base e de suporte: .seletor-base e .faixa-suporte vão junto). */

/* nenhuma tela rola na horizontal: conteúdo largo (tabela, quadro) rola dentro do próprio container */
html, body { max-width: 100%; overflow-x: hidden; }

.app { display: grid; grid-template-columns: var(--trilho) 1fr; grid-template-rows: var(--topo) 1fr; height: 100vh; height: 100dvh; overflow: hidden; }

/* ------------------------------------------------------------------ trilho */
.trilho {
  grid-row: 1 / 3; grid-column: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 0 12px; background: var(--zera-noite); color: #c8d3de; z-index: 20;
}
.trilho .marca { width: 40px; height: 40px; border-radius: 12px; display: block; overflow: hidden; margin-bottom: 10px; box-shadow: 0 0 0 1px rgba(255,255,255,.14), 0 6px 16px rgba(0,0,0,.35); transition: transform var(--t-rapido), box-shadow var(--t-rapido); }
.trilho .marca:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px rgba(255,255,255,.28), 0 8px 20px rgba(0,0,0,.4); }
.trilho .marca img { width: 100%; height: 100%; display: block; }
.trilho nav { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.item-trilho {
  position: relative; width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  color: #9fb0c1; border: 0; background: transparent; transition: background var(--t-rapido), color var(--t-rapido);
}
.item-trilho:hover { background: var(--zera-noite-2); color: #fff; text-decoration: none; }
.item-trilho[aria-current="page"] { background: rgba(143, 176, 207, 0.16); color: #fff; }
/* no CRM o indicador é azul-aço claro: o teal é da marca (DESIGN §2), nunca do miolo */
.item-trilho[aria-current="page"]::before { content: ""; position: absolute; left: -11px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: #8fb0cf; }
.item-trilho .selo { position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; font-size: 10.5px; padding: 0 5px; box-shadow: 0 0 0 2px var(--zera-noite); }
.trilho .base-trilho { margin-top: auto; display: flex; flex-direction: column; gap: 6px; align-items: center; }

/* ------------------------------------------------------------------ topo */
.topo {
  grid-column: 2; display: flex; align-items: center; gap: 12px; padding: 0 16px; height: var(--topo);
  background: var(--sup); border-bottom: 1px solid var(--linha); z-index: 15; min-width: 0;
}
.logo-topo { display: inline-flex; align-items: center; height: 40px; padding: 0 4px; border-radius: 10px; color: var(--txt); flex: none; }
.logo-topo:hover { text-decoration: none; background: var(--hover); }
.divisor-topo { width: 1px; height: 26px; background: var(--linha); flex: none; }
.seletor-empresa { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px 0 6px; border-radius: 11px; border: 0; background: transparent; min-width: 0; max-width: 300px; color: var(--txt); }
.seletor-empresa:hover { background: var(--hover); }
.seletor-empresa > .ic { color: var(--txt-3); }
.logo-empresa { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: var(--zera); flex: none; }
.seletor-empresa .nomes { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; line-height: 1.2; }
.seletor-empresa .nomes b { font-size: 14px; font-weight: 650; max-width: 100%; }
.seletor-empresa .nomes span { font-size: 11.5px; color: var(--txt-3); }
.logo-empresa.com-logo { background: var(--sup) !important; box-shadow: inset 0 0 0 1px var(--linha); overflow: hidden; }
.logo-empresa img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo-empresa-p { width: 22px; height: 22px; border-radius: 7px; font-size: 10px; }
.topo .busca-global { flex: 1; max-width: 520px; margin: 0 auto 0 8px; }
.topo .busca-global .entrada { height: 38px; cursor: pointer; }
.topo .busca-global kbd { position: absolute; right: 10px; }
.botao-eu { border: 0; background: none; padding: 0; border-radius: 50%; flex: none; }

/* equipe Zera olhando empresa da qual não é membro: pílula âmbar com o corte, em todas as telas */
.faixa-equipe-zera { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px 0 10px; border: 1px solid color-mix(in srgb, var(--alerta) 45%, transparent);
  border-radius: 999px; background: var(--alerta-bg); color: var(--alerta-forte); font-size: 12px; font-weight: 700; white-space: nowrap; flex: none;
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 10px, 100% 100%, 0 100%); transition: background-color 120ms; }
.faixa-equipe-zera:hover { background: color-mix(in srgb, var(--alerta) 24%, transparent); }
html[data-theme="dark"] .faixa-equipe-zera { color: #f3c27a; }
.menu-equipe-zera { display: flex; flex-direction: column; gap: 4px; padding: 8px 12px 6px; max-width: 266px; }
.menu-equipe-zera b { font-size: 13.5px; }
.menu-equipe-zera span { font-size: 12.5px; color: var(--txt-2); line-height: 1.4; }
/* demonstração (?demo=1 em localhost): nunca passa por dado de verdade */
.selo-demo { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--ia-suave); color: var(--ia-forte); font-size: 12px; font-weight: 700; flex: none; }
html[data-theme="dark"] .selo-demo { color: #b9a8ff; }

/* ------------------------------------------------------------------ miolo */
.miolo { grid-column: 2; grid-row: 2; min-width: 0; min-height: 0; overflow: hidden; position: relative; background: var(--bg); }
.tela { height: 100%; overflow: auto; }
.tela-padrao { max-width: 1280px; margin: 0 auto; padding: 22px 24px 40px; }
.cab-tela { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.cab-tela h1 { margin-right: auto; }
.cab-tela .sub { width: 100%; color: var(--txt-3); font-size: 13.5px; margin-top: -10px; }
.tela-cheia { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px 16px; background: var(--bg); }
.vazio-cartao { padding: 8px 0; }

.carregando-app { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: var(--bg); z-index: 200; }

/* ------------------------------------------------------------------ celular */
.nav-celular { display: none; }
@media (max-width: 1023px) {
  .topo .busca-global { max-width: 340px; }
}
@media (max-width: 767px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 52px 1fr 60px; }
  .trilho { display: none; }
  .topo { grid-column: 1; padding: 0 10px; gap: 8px; height: 52px; }
  .topo .busca-global, .seletor-empresa .nomes span, .selo-demo span { display: none; }
  .divisor-topo { display: none; }
  .seletor-empresa { margin-right: auto; max-width: none; flex: 1; }
  .faixa-equipe-zera span { display: none; }
  .faixa-equipe-zera { padding: 0 9px; }
  .miolo { grid-column: 1; grid-row: 2; }
  .nav-celular { grid-row: 3; display: flex; justify-content: space-around; align-items: center; background: var(--zera-noite); padding-bottom: env(safe-area-inset-bottom); }
  .nav-celular a, .nav-celular .nav-mais { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; color: #9fb0c1; font-size: 10.5px; font-weight: 600; padding: 6px 10px; text-decoration: none; min-width: 56px; }
  .nav-celular .nav-mais { background: none; border: 0; font-family: inherit; cursor: pointer; }
  .nav-celular a[aria-current="page"], .nav-celular .nav-mais[aria-current="page"] { color: #fff; }
  .tela-padrao { padding: 14px 12px 28px; }
}
@media (max-width: 420px) {
  .logo-topo .logo-produto { --logo-alt: 24px !important; width: 61px !important; }
}

/* ------------------------------------------------------------------ movimento da casca */
.tela { animation: entrada-tela 320ms cubic-bezier(.16, 1, .3, 1); }
@keyframes entrada-tela { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.item-trilho svg { transition: transform var(--t-estado); }
.item-trilho:hover svg { transform: scale(1.08); }
.item-trilho[aria-current="page"]::before { animation: indicador-entra 260ms cubic-bezier(.16, 1, .3, 1); }
@keyframes indicador-entra { from { transform: scaleY(.2); opacity: 0; } to { transform: none; opacity: 1; } }
.trilho nav .item-trilho { animation: surgir 420ms cubic-bezier(.16, 1, .3, 1) both; }
.trilho nav .item-trilho:nth-child(2) { animation-delay: 40ms; } .trilho nav .item-trilho:nth-child(3) { animation-delay: 80ms; }
.trilho nav .item-trilho:nth-child(4) { animation-delay: 120ms; } .trilho nav .item-trilho:nth-child(5) { animation-delay: 160ms; }
.botao-eu .avatar { transition: transform var(--t-estado), box-shadow var(--t-estado); }
.botao-eu:hover .avatar { transform: scale(1.06); box-shadow: 0 0 0 3px var(--zera-suave); }
@media (prefers-reduced-motion: reduce) { .tela, .trilho nav .item-trilho, .item-trilho[aria-current="page"]::before { animation: none; } }

/* ------------------------------------------------------------------ ZeraCRM 2: peças do topo */
/* destaque da base ativa (DESIGN §2: o teal do CRM marca a base aberta) */
.seletor-base .logo-empresa { box-shadow: 0 0 0 2px var(--sup), 0 0 0 3.5px var(--crm); }
.seletor-base .logo-empresa.com-logo { box-shadow: inset 0 0 0 1px var(--linha), 0 0 0 2px var(--sup), 0 0 0 3.5px var(--crm); }
.botao-novo { flex: none; }
.botao-sino { position: relative; flex: none; }
.botao-sino .sino-selo { position: absolute; top: 1px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; font-size: 10px; background: var(--zera-forte); color: #fff; box-shadow: 0 0 0 2px var(--sup); }
.botao-sino .sino-selo.alerta { background: color-mix(in srgb, var(--alerta) 80%, #000); }
.menu-vazio { padding: 8px 12px 10px; font-size: 13px; color: var(--txt-3); max-width: 290px; }
.menu-idioma { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 10px 8px; }
.menu-idioma-rotulo { font-size: 12px; font-weight: 650; color: var(--txt-3); }
.menu-idioma .seletor-idioma { flex: none; }
.menu-idioma .seg-idioma { height: 28px; padding: 0 8px; font-size: 12px; }
.base-suspensa .vazio { max-width: 460px; }
.carregando-tela { padding-top: 24px; }
@media (max-width: 767px) {
  .botao-novo span { display: none; }
  .botao-novo { width: 34px; padding: 0; }
  .topo .busca-global { display: none; }
}
