/* HAON_TEL_COCKPIT_V1 — Central de Ligações: cockpit premium, tudo aberto e fixo.
   Escopado em .tel-shell / #panelTel; usa as CSS vars do tema (claro/escuro automático). */

/* ── o painel da aba vira coluna; o shell preenche a altura ── */
#panelTel { display: flex; flex-direction: column; min-height: 0; }
#panelTel > .ops-channel { flex: 0 0 auto; }

.tel-shell {
  flex: 1 1 auto; min-height: 0;
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  background: var(--bg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  /* tints que funcionam nos dois temas */
  --tel-tint: rgba(63, 168, 117, .10);
  --tel-tint-2: rgba(63, 168, 117, .16);
  --tel-accent: var(--green-700);
}
[data-theme="dark"] .tel-shell {
  --tel-tint: rgba(63, 168, 117, .14);
  --tel-tint-2: rgba(63, 168, 117, .22);
  --tel-accent: var(--green-500);
}

/* ── colunas base ── */
.tel-col {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 0; overflow: hidden;
  display: flex; flex-direction: column;
}

/* ============ COLUNA 1 — FILA ============ */
.tel-col-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 16px 11px; border-bottom: 1px solid var(--line);
}
.tel-col-title { font-weight: 800; font-size: 13.5px; letter-spacing: .2px; }
.tel-qcount {
  font-weight: 800; font-size: 11px; color: var(--tel-accent);
  background: var(--tel-tint); border-radius: 999px; padding: 2px 9px;
  min-width: 22px; text-align: center;
}
.tel-search-wrap { position: relative; padding: 11px 12px; }
.tel-search-wrap > svg {
  position: absolute; left: 23px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--muted); pointer-events: none;
}
.tel-search {
  width: 100%; box-sizing: border-box; padding: 9px 12px 9px 33px;
  border: 1px solid var(--line); border-radius: 11px;
  background: var(--bg); color: var(--ink); font-size: 13px; outline: none;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast);
}
.tel-search:focus { border-color: var(--green-500); box-shadow: 0 0 0 3px var(--tel-tint); }

.tel-queue-list {
  flex: 1 1 auto; overflow-y: auto; padding: 5px 8px 10px;
  display: flex; flex-direction: column; gap: 3px;
}
.tel-qitem {
  display: flex; align-items: center; gap: 11px; width: 100%; box-sizing: border-box;
  text-align: left; padding: 9px 10px; border: 1px solid transparent; border-radius: 12px;
  background: none; cursor: pointer; color: inherit;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.tel-qitem:hover { background: var(--tel-tint); }
.tel-qitem.on { background: var(--tel-tint-2); border-color: var(--green-500); }
.tel-qav {
  flex: 0 0 auto; width: 37px; height: 37px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #fff;
  background: linear-gradient(135deg, var(--green-500), var(--green-700));
}
.tel-qtx { display: flex; flex-direction: column; min-width: 0; }
.tel-qtx b { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tel-qtx small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============ COLUNA 2 — FOCO (rola junto) ============ */
.tel-col-focus {
  background: transparent; border: none; box-shadow: none;
  overflow-y: auto; padding-right: 2px; display: flex; flex-direction: column; gap: 12px;
}

/* KPIs do dia */
.tel-metas { display: flex; flex-wrap: wrap; gap: 8px; }
.tel-meta {
  display: inline-flex; align-items: baseline; gap: 5px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 13px; font-size: 12px; color: var(--soft); font-weight: 600; box-shadow: var(--shadow);
}
.tel-meta b { font-size: 16px; font-weight: 800; color: var(--ink); }
.tel-meta-total b { color: var(--tel-accent); }

/* card de chamada */
.tel-card { display: flex; flex-direction: column; gap: 12px; }

/* HERO do lead */
.tel-hero {
  display: flex; align-items: center; gap: 16px; position: relative; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px 18px 22px; box-shadow: var(--shadow);
}
.tel-hero::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--green-500), var(--green-700));
}
.tel-hero-av {
  flex: 0 0 auto; width: 58px; height: 58px; border-radius: 16px;
  display: grid; place-items: center; font-weight: 800; font-size: 24px; color: #fff;
  background: linear-gradient(135deg, var(--green-500), var(--green-700));
  box-shadow: 0 8px 20px rgba(47, 143, 98, .32);
}
.tel-hero-id { flex: 1 1 auto; min-width: 0; }
.tel-hero-name { margin: 0; font-size: 19px; font-weight: 800; line-height: 1.2; }
.tel-hero-sub { font-size: 12.5px; color: var(--soft); font-weight: 600; margin-top: 3px; }
.tel-hero-addr { font-size: 12px; color: var(--muted); margin-top: 5px; display: flex; align-items: center; gap: 4px; }
.tel-hero-phone { text-align: right; flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; }
.tel-hero-phone-num { font-size: 16px; font-weight: 800; color: var(--ink); letter-spacing: .3px; font-variant-numeric: tabular-nums; }
.tel-callstate {
  margin-top: 8px; display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 800; color: var(--tel-accent);
  background: var(--tel-tint); border-radius: 999px; padding: 5px 12px;
}
.tel-callstate::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green-600); animation: telPulse 1.2s infinite; }
@keyframes telPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }

/* AÇÕES (Ligar) */
.tel-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.tel-call {
  display: inline-flex; align-items: center; gap: 9px; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--green-600), var(--green-700)); color: #fff;
  font-weight: 800; font-size: 14.5px; padding: 13px 24px; border-radius: 14px;
  box-shadow: 0 10px 26px rgba(31, 106, 74, .34);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast), filter var(--dur-fast);
}
.tel-call:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(31, 106, 74, .44); filter: brightness(1.05); }
.tel-call:active { transform: translateY(0); }
.tel-call svg { width: 20px; height: 20px; }
.tel-call-cell { font-weight: 700; font-size: 13px; color: var(--blue-600); text-decoration: none; }
.tel-call-cell:hover { text-decoration: underline; }

/* GRID interno: esquerda (consent + outcomes) | direita (roteiro + notas) */
.tel-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.tel-left, .tel-right { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

/* seções sempre abertas */
.tel-sec { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 15px 16px; box-shadow: var(--shadow); }
.tel-sec-h { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 13px; color: var(--ink); margin-bottom: 13px; }
.tel-sec-ico { font-size: 15px; line-height: 1; }

/* outcomes */
.tel-outcomes { display: grid; grid-template-columns: repeat(auto-fit, minmax(94px, 1fr)); gap: 8px; }
.tel-out {
  border: 1.5px solid var(--c, var(--line)); color: var(--c, var(--ink)); background: none; cursor: pointer;
  font-weight: 700; font-size: 12.5px; padding: 11px 8px; border-radius: 11px;
  transition: background var(--dur-fast), color var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur-fast);
}
.tel-out:hover { background: var(--c); color: #fff; transform: translateY(-1px); box-shadow: 0 6px 16px color-mix(in srgb, var(--c) 36%, transparent); }
.tel-out:disabled { opacity: .4; cursor: default; transform: none; box-shadow: none; background: none; color: var(--c, var(--muted)); }

/* consentimento */
.tel-consent { display: flex; flex-direction: column; gap: 10px; }
.tel-ck { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; color: var(--soft); cursor: pointer; line-height: 1.4; }
.tel-ck input { margin: 2px 0 0; width: 16px; height: 16px; accent-color: var(--green-600); flex: 0 0 auto; }
.tel-ck b { color: var(--ink); font-weight: 700; }
.tel-consent-note { font-size: 11px; color: var(--muted); margin: 5px 0 0; line-height: 1.5; padding: 10px 12px; background: var(--bg); border-radius: 10px; }

/* roteiro IA */
.tel-script { min-height: 38px; }
.tel-genscript, .tel-sumbtn {
  border: 1px dashed var(--green-500); color: var(--tel-accent); background: var(--tel-tint); cursor: pointer;
  font-weight: 700; font-size: 12.5px; padding: 11px 14px; border-radius: 11px; width: 100%;
  transition: background var(--dur-fast);
}
.tel-genscript:hover, .tel-sumbtn:hover { background: var(--tel-tint-2); }
.tel-genscript:disabled, .tel-sumbtn:disabled { opacity: .6; cursor: default; }
.tel-sumbtn { margin-top: 9px; }
.tel-script-h { display: flex; align-items: center; justify-content: space-between; font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 9px; }
.tel-regen { border: 1px solid var(--line); background: var(--panel); color: var(--soft); cursor: pointer; border-radius: 8px; width: 26px; height: 26px; font-size: 14px; line-height: 1; }
.tel-regen:hover { border-color: var(--green-500); color: var(--tel-accent); }
.tel-appr { border: 1px solid var(--line); border-left: 3px solid var(--green-500); border-radius: 10px; padding: 11px 13px; margin-bottom: 9px; background: var(--bg); }
.tel-appr:last-child { margin-bottom: 0; }
.tel-appr-tag { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; color: var(--tel-accent); margin-bottom: 8px; }
.tel-appr p { margin: 0 0 8px; font-size: 12.5px; line-height: 1.5; color: var(--ink); }
.tel-appr p:last-child { margin-bottom: 0; }
.tel-appr p span { display: block; font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); margin-bottom: 2px; }
.tel-script-msg { font-size: 12px; color: var(--soft); padding: 8px 0; line-height: 1.5; }
.tel-assinar { border: none; background: var(--green-600); color: #fff; cursor: pointer; font-weight: 700; padding: 7px 13px; border-radius: 9px; margin-left: 4px; }

/* notas + resumo */
.tel-notes {
  width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 11px;
  background: var(--bg); color: var(--ink); padding: 11px 13px; font-size: 12.5px; font-family: inherit;
  resize: vertical; min-height: 72px; outline: none; line-height: 1.5;
}
.tel-notes:focus { border-color: var(--green-500); box-shadow: 0 0 0 3px var(--tel-tint); }
.tel-summary { margin-top: 11px; display: flex; flex-direction: column; gap: 9px; }
.tel-sum-row { background: var(--tel-tint); border: 1px solid var(--green-100); border-radius: 10px; padding: 10px 12px; }
[data-theme="dark"] .tel-sum-row { border-color: var(--line-strong); }
.tel-sum-row span { display: block; font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .3px; color: var(--tel-accent); margin-bottom: 3px; }
.tel-sum-row p { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--ink); }

/* estados vazios */
.tel-empty { text-align: center; color: var(--muted); font-size: 12.5px; padding: 24px 16px; line-height: 1.6; }
.tel-empty small { display: block; margin-top: 6px; font-size: 11px; opacity: .85; }
.tel-empty-big {
  padding: 64px 28px; font-size: 14px; background: var(--panel); border: 1px dashed var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ── responsivo ── */
@media (max-width: 1100px) { .tel-grid { grid-template-columns: 1fr; } }
@media (max-width: 880px) {
  .tel-shell { grid-template-columns: 1fr; }
  .tel-col-queue { max-height: 230px; }
  .tel-hero { flex-wrap: wrap; }
  .tel-hero-phone { text-align: left; align-items: flex-start; width: 100%; margin-top: 6px; }
}
