/* Shell e componentes comuns. Cada grupo de telas tem o seu css/telas-<grupo>.css;
   aqui fica so' o que mais de uma tela usa. Base: docs/design-preview-opcao-c.html
   (repo do Loom) e os prints do banco de paineis. */

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--text); overflow: hidden;
  font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased;
  /* o "desktop" atras da janela */
  background: radial-gradient(1200px 700px at 30% 20%, #23252e 0%, #121318 60%, #0a0a0d 100%);
}
[data-tema="claro"] body { background: radial-gradient(1200px 700px at 30% 20%, #eef0f4 0%, #d6d9e0 60%, #c3c7d0 100%); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; }
.ico { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }
.ico.sm { width: 14px; height: 14px; }
.ico.lg { width: 22px; height: 22px; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.t2 { color: var(--text-2); }
.tm { color: var(--text-mute); }
.ok-txt { color: var(--text-ok); } .warn-txt { color: var(--text-warn); } .bad-txt { color: var(--text-bad); }
.espaco { flex: 1; }
.oculto { display: none !important; }
.truncar { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ─── Shell ─────────────────────────────────────────────────────────── */
/* --- Janela ----------------------------------------------------------- */
.janela {
  position: fixed; inset: 22px 28px 54px; display: flex; flex-direction: column;
  border-radius: 10px; overflow: hidden; background: var(--bg);
  border: 1px solid var(--line); box-shadow: 0 28px 70px rgba(0,0,0,.55), 0 0 0 1px rgba(0,0,0,.25);
  transition: inset .18s ease, border-radius .18s ease;
}
[data-tema="claro"] .janela { box-shadow: 0 24px 60px rgba(20,22,30,.28), 0 0 0 1px rgba(0,0,0,.06); }
.janela.maximizada { inset: 0; border-radius: 0; border: 0; }
@media (max-width: 1100px), (max-height: 800px) { .janela { inset: 8px 10px 44px; } }
.barra-titulo {
  height: 32px; flex: none; display: flex; align-items: center; gap: 8px; padding-left: 12px;
  background: var(--chrome); border-bottom: 1px solid var(--line); color: var(--text-2);
  font-size: 12px; user-select: none;
}
.barra-titulo img { width: 16px; height: 16px; }
.barra-titulo .ctl { display: flex; height: 100%; margin-left: auto; }
.barra-titulo .ctl button {
  width: 46px; height: 100%; border: 0; background: none; color: var(--text-2);
  display: grid; place-items: center; font-size: 13px; line-height: 1;
}
.barra-titulo .ctl button:hover { background: var(--hover); color: var(--text); }
.barra-titulo .ctl button.fechar:hover { background: #C42B1C; color: #fff; }
.barra-titulo svg { width: 10px; height: 10px; }

#app {
  flex: 1; min-height: 0; display: grid;
  transform: translateZ(0);   /* telas com position:fixed (modais) ficam presas na janela */
  grid-template-columns: 88px minmax(0, 1fr); grid-template-rows: 52px minmax(0, 1fr);
  grid-template-areas: "marca topo" "rail tela";
}
.marca { grid-area: marca; background: var(--chrome); border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); display: grid; place-items: center; }
.marca img { width: 22px; height: 22px; }
.topo {
  grid-area: topo; background: var(--chrome); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: var(--s4); padding: 0 var(--s5);
}
.busca {
  width: min(470px, 46%); height: 34px; display: flex; align-items: center; gap: var(--s3);
  padding: 0 var(--s4); background: var(--raised); border: 1px solid var(--line);
  border-radius: var(--r-control); color: var(--text-2);
}
.busca input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--text); }
.busca input::placeholder { color: var(--text-ph); }
.eu { display: flex; align-items: center; gap: var(--s4); font-weight: 600; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  border: 1px solid var(--line); background: var(--raised); font-size: 11px; font-weight: 600; position: relative;
}
.avatar.on::after {
  content: ""; position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--ok); border: 2px solid var(--chrome);
}
.btn-icone {
  width: 32px; height: 32px; display: grid; place-items: center; border: 0; background: none;
  color: var(--text-2); border-radius: var(--r-control);
}
.btn-icone:hover { background: var(--hover); color: var(--text); }

.rail {
  grid-area: rail; background: var(--chrome); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: var(--s3) var(--s3);
  overflow-y: auto;
}
.rail a {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 0 7px; border-radius: var(--r-panel); text-decoration: none;
  color: var(--text-2); font-size: 12px; font-weight: 500;
}
.rail a:hover { background: var(--panel); color: var(--text); }
.rail a.on { background: var(--hover); color: var(--text); font-weight: 600; }
.rail a.on::before { content: ""; position: absolute; left: -8px; top: 10px; bottom: 10px; width: 2px; border-radius: 2px; background: var(--focus); }
.rail .ico { width: 20px; height: 20px; }
.rail .badge { position: absolute; top: 4px; left: calc(50% + 4px); }

#tela { grid-area: tela; min-width: 0; min-height: 0; background: var(--bg); overflow: auto; position: relative; }

/* ─── Componentes ───────────────────────────────────────────────────── */
.badge {
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff;
  font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; line-height: 1;
}
.btn {
  height: var(--control); padding: 0 14px; border-radius: var(--r-control); border: 1px solid var(--line);
  background: transparent; font-weight: 500; display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; white-space: nowrap; color: var(--text);
}
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.sm { height: var(--control-sm); padding: 0 10px; font-size: 13px; }
.btn.solido { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.solido:hover { background: var(--accent-hover); }
.btn.claro { background: #F4F4F5; color: #0B0B0D; border-color: #F4F4F5; }   /* "Abrir proximo lead" */
.btn.ok { background: var(--ok); color: var(--on-status); border-color: var(--ok); }
.btn.perigo { background: var(--bad); color: var(--on-status); border-color: var(--bad); }
.btn.cinza { background: var(--raised); border-color: var(--raised); }
.btn.cinza:hover { background: var(--hover); }
.btn.fantasma { border-color: transparent; color: var(--text-2); }
.btn.fantasma:hover { color: var(--text); }

.chip {
  height: 28px; padding: 0 10px; border-radius: var(--r-control); border: 1px solid var(--line);
  background: var(--raised); color: var(--text); display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 500; white-space: nowrap;
}
.chip.tracejado { background: none; border-style: dashed; color: var(--text-2); }
.chip.sel { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus) inset; }
.chip.apagado { color: var(--text-off); }
.chip .rot { color: var(--text-2); font-weight: 400; }

/* quadradinho de status: <span class="ponto" style="--c:var(--ok)"></span> */
.ponto { width: 8px; height: 8px; border-radius: var(--r-mark); background: var(--c, var(--neutral)); flex: none; display: inline-block; }
.ponto.vazado { background: none; box-shadow: 0 0 0 1.5px var(--c, var(--neutral)) inset; }
.estado { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }

.campo {
  height: var(--control); border: 1px solid var(--line); border-radius: var(--r-control); background: var(--raised);
  padding: 0 10px; color: var(--text); outline: none; width: 100%;
}
.campo::placeholder { color: var(--text-ph); }
.campo:focus { border-color: var(--focus); }
textarea.campo { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; }

kbd { font: 500 11px var(--mono); color: var(--text-2); border: 1px solid var(--line); border-radius: var(--r-kbd); padding: 1px 5px; background: var(--raised); }

/* abas com sublinhado, como as da bancada */
.abas { display: flex; align-items: flex-end; gap: var(--s2); border-bottom: 1px solid var(--line); }
.abas button {
  border: 0; background: none; color: var(--text-2); padding: 8px 6px 7px; margin-bottom: -1px;
  border-bottom: 2px solid transparent; font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
}
.abas button:hover { color: var(--text); }
.abas button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--text); }
.abas .cont { font-family: var(--mono); font-size: 12px; background: var(--raised); border-radius: var(--r-kbd); padding: 0 5px; color: var(--text); }

/* seletor segmentado (Saida | Entrada, Semana | Mes) */
.seg { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--chrome); }
.seg button { height: 28px; padding: 0 12px; border: 0; border-radius: var(--r-control); background: none; color: var(--text-2); font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--raised); color: var(--text); font-weight: 600; }

.cartao { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-panel); }

/* cabecalho de pagina: "Leads  14 no total ........ [Copiar] [Atualizar]" */
.cab { display: flex; align-items: center; gap: var(--s4); padding: var(--s5) var(--s5) var(--s4); flex-wrap: wrap; }
.cab h1 { font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.cab .sub { color: var(--text-2); font-size: 13px; }

/* linha de lista de 2 linhas de texto */
.lista { list-style: none; margin: 0; padding: 0; }
.lista > li {
  display: flex; align-items: center; gap: var(--s4); min-height: 55px; padding: 6px var(--s4);
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.lista > li:hover { background: var(--panel); }
.lista > li.sel { background: var(--raised); box-shadow: inset 2px 0 0 var(--focus); }
.lista .tit { font-weight: 500; }
.lista .sub { color: var(--text-2); font-size: 13px; display: flex; align-items: center; gap: var(--s3); }
.marca-origem {
  width: 18px; height: 18px; border-radius: 4px; background: var(--raised); border: 1px solid var(--line);
  display: inline-grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--text);
}

.vazio { padding: 48px 24px; text-align: center; color: var(--text-2); }

/* ─── Controles do apresentador ─────────────────────────────────────── */
#apresentador {
  position: fixed; left: 50%; bottom: 11px; transform: translateX(-50%); z-index: 50; display: flex; gap: 4px; align-items: center;
  padding: 4px; border-radius: 10px; background: rgba(19,19,22,.92); border: 1px solid #33333A;
  box-shadow: 0 8px 24px rgba(0,0,0,.35); color: #EDEDED; font-size: 12px;
  backdrop-filter: blur(6px); opacity: .6; transition: opacity .15s;
}
/* Fica na faixa abaixo da janela, fora do app. Com a janela maximizada recolhe
   para a alca e abre com hover ou foco. */
.janela.maximizada ~ #apresentador:not(:hover):not(:focus-within) > :not(.alca) { display: none; }
#apresentador:hover, #apresentador:focus-within { opacity: 1; }
#apresentador .alca { color: #EDEDED; font-family: var(--mono); }
#apresentador.oculto-apr { display: none; }
#apresentador button {
  height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: none; color: #A1A1A1;
  display: inline-flex; align-items: center; gap: 6px; font-weight: 500;
}
#apresentador button:hover { background: #34343B; color: #EDEDED; }
#apresentador button[aria-pressed="true"] { background: #2A2A30; color: #EDEDED; }
#apresentador .div { width: 1px; height: 18px; background: #33333A; margin: 0 2px; }

#ajuda {
  position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.6); display: grid; place-items: center;
}
#ajuda .caixa { width: 440px; background: #1A1A1E; color: #EDEDED; border: 1px solid #33333A; border-radius: var(--r-window); padding: 20px 22px; box-shadow: var(--shadow); }
#ajuda h3 { font-size: 15px; margin-bottom: 12px; }
#ajuda dl { display: grid; grid-template-columns: 64px 1fr; gap: 8px 12px; margin: 0 0 14px; }
#ajuda dt { text-align: right; } #ajuda dd { margin: 0; color: #C6C6CE; }
#ajuda p { color: #A1A1A1; font-size: 13px; }

/* camada da ligacao: o grupo da call desenha aqui dentro (toast e janela).
   Ela e' uma segunda janela, um pouco deslocada da principal, como no app (a call
   abre em janela propria). O transform faz o position:fixed de dentro valer
   relativo a ela, e o aviso de chamada cai no canto dela. */
#camada-ligacao {
  position: fixed; inset: 44px 46px 70px 64px; z-index: 40;
  transform: translateZ(0); pointer-events: none;
}
#camada-ligacao > * { pointer-events: auto; }
#camada-ligacao:empty { display: none; }
#camada-ligacao:has(> .cj) {
  pointer-events: auto; border-radius: 10px; overflow: hidden; border: 1px solid #33333A;
  box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(0,0,0,.3); background: #131316;
}
#camada-ligacao:has(> .cj)::before {
  content: attr(data-titulo); position: absolute; left: 0; right: 0; top: 0; height: 32px; z-index: 50;
  display: flex; align-items: center; padding-left: 36px; font-size: 12px; color: #A1A1A1;
  background: #131316 url("../img/athena-symbol-on-dark.png") 12px center / 16px 16px no-repeat;
  border-bottom: 1px solid #33333A;
}
#camada-ligacao:has(> .cj)::after {
  content: "\2014\00a0\00a0\00a0\00a0\00a0\00a0\25A2\00a0\00a0\00a0\00a0\00a0\00a0\2715";
  position: absolute; right: 16px; top: 0; height: 32px; z-index: 51; display: flex; align-items: center;
  color: #A1A1A1; font-size: 12px; letter-spacing: 1px; pointer-events: none;
}
#camada-ligacao > .cj { top: 32px; }
.janela.maximizada ~ #camada-ligacao { inset: 20px 24px 20px 40px; }
@media (max-width: 1100px), (max-height: 800px) { #camada-ligacao { inset: 18px 18px 50px 32px; } }

/* rolagem discreta */
* { scrollbar-width: thin; scrollbar-color: var(--hover) transparent; }
