/* Tablet de Rua — usa a MESMA identidade visual do painel principal
   (tokens de web/styles.css: cores, radius, Manrope/Space Grotesk, e as
   classes .sidebar/.nav-item reaproveitadas do menu principal). Aqui só
   ficam as classes exclusivas do layout do tablet — nada de paleta, fonte
   ou componente (.btn, .panel, .form-control, .modal-*, .catalog-*, .badge,
   .sidebar, .nav-item) reescrito à parte; tudo isso vem de styles.css.

   Acento de marca: dentro do .tablet-shell trocamos --primary (dourado, do
   painel principal) por --accent-rose (já existe em styles.css, #C1503F) —
   chega perto do vermelho do visual "Executivo Claro" sem inventar hex novo
   nem tocar no painel principal. */
.tablet-shell {
  --primary: var(--accent-rose);
  --primary-rgb: var(--accent-rose-rgb, 193, 80, 63);
}

body { overflow-x: hidden; }

.tablet-shell { min-height: 100vh; display: flex; position: relative; z-index: 1; }

/* ---------- conteúdo principal (sidebar já vem de styles.css) ---------- */
.tablet-main-content { margin-left: 280px; flex: 1; padding: 24px 28px; max-width: 1360px; }
@media (max-width: 900px) { .tablet-main-content { margin-left: 0; padding: 14px; } }

.tablet-topbar-slim {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  margin-bottom: 18px; min-height: 28px;
}
.tablet-topbar-user { color: var(--text-muted); font-size: 0.85rem; }

.tablet-section { display: none; flex-direction: column; gap: 20px; }
.tablet-section.active { display: flex; }

.tablet-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .tablet-grid-2 { grid-template-columns: 1fr; } }

.tablet-btn-lg { width: 100%; min-height: 52px; font-size: 1rem; }

/* ---------- Hoje ---------- */
.tablet-hoje-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 720px) { .tablet-hoje-stats { grid-template-columns: 1fr; } }
.hoje-stat-card {
  background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 6px;
}
.hoje-stat-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.hoje-stat-card strong { font-family: var(--font-heading); font-size: 1.6rem; color: var(--text-primary); }

.hoje-pipeline { display: flex; gap: 10px; flex-wrap: wrap; }
.hoje-pipeline-stage {
  flex: 1; min-width: 100px; background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  padding: 12px; text-align: center;
}
.hoje-pipeline-stage strong { display: block; font-family: var(--font-heading); font-size: 1.3rem; color: var(--accent-rose); }
.hoje-pipeline-stage span { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }

.hoje-atalhos { display: flex; gap: 10px; flex-wrap: wrap; }
.hoje-atalhos .nav-item { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); }

/* ---------- chips de marca ---------- */
.marcas { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-marca {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-weight: 600; font-size: 0.88rem;
  cursor: pointer;
  transition: var(--transition-fast);
}
.chip-marca:hover { border-color: var(--border-active); color: var(--text-primary); }
.chip-marca.active { background: var(--accent-rose); border-color: var(--accent-rose); color: #fff; }

/* ---------- Catálogo: grid + painel de detalhe fixo ---------- */
.catalogo-layout { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 980px) {
  .catalogo-layout { grid-template-columns: 1.3fr 1fr; align-items: start; }
  .catalogo-layout .catalogo-detalhe-painel { position: sticky; top: 16px; max-height: calc(100vh - 100px); overflow-y: auto; }
}
.catalogo-detalhe-painel img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: var(--radius-md); border: 1px solid var(--border-color); background: var(--bg-input); margin-bottom: 14px; }

.ficha-accordion-item { border: 1px solid var(--border-color); border-radius: var(--radius-sm); margin-bottom: 8px; overflow: hidden; }
.ficha-accordion-header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 14px; cursor: pointer; font-weight: 600; font-size: 0.9rem; color: var(--text-primary);
  background: var(--bg-input);
}
.ficha-accordion-header:hover { color: var(--accent-rose); }
.ficha-accordion-body { padding: 12px 14px; font-size: 0.88rem; line-height: 1.65; color: var(--text-secondary); display: none; }
.ficha-accordion-item.open .ficha-accordion-body { display: block; }
.ficha-accordion-item.open .ficha-accordion-header { color: var(--accent-rose); }

.busca { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 0 12px; height: 46px; background: var(--bg-input); margin-bottom: 14px; }
.busca input { border: none; outline: none; flex: 1; font-size: 0.95rem; background: transparent; font-family: var(--font-sans); color: var(--text-primary); height: 100%; }

/* ---------- carrinho ---------- */
.tablet-cart-item, .linha-item {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--border-color);
}
.tablet-cart-item:last-child, .linha-item:last-child { border-bottom: none; }
.linha-item .spec { color: var(--text-muted); font-size: 0.76rem; font-style: italic; margin-top: 2px; }
.linha-item__qtd { display: flex; align-items: center; gap: 4px; }
.qtd-botao { width: 28px; height: 28px; border-radius: var(--radius-sm); border: 1px solid var(--border-color); background: var(--bg-input); color: var(--text-primary); cursor: pointer; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.qtd-botao:hover { border-color: var(--border-active); color: var(--accent-rose); }
.qtd-valor { min-width: 22px; text-align: center; font-family: var(--font-heading); font-weight: 700; }
.linha-item__preco { font-family: var(--font-heading); font-weight: 700; text-align: right; white-space: nowrap; color: var(--text-primary); }
.linha-item__remover { background: none; border: none; color: var(--text-muted); cursor: pointer; width: 28px; height: 28px; border-radius: var(--radius-sm); }
.linha-item__remover:hover { color: var(--accent-rose); background: rgba(var(--accent-rose-rgb), 0.12); }

.tablet-cart-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--border-color); padding-top: 12px; margin: 12px 0 16px; font-size: 1rem; color: var(--text-secondary); }
.tablet-cart-total strong { font-family: var(--font-heading); font-weight: 800; font-size: 1.4rem; color: var(--text-primary); }

.tablet-recent-list { display: flex; flex-direction: column; gap: 8px; }
.tablet-recent-item {
  background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 0.85rem; display: flex; justify-content: space-between; gap: 12px; align-items: center;
}

/* ---------- Clientes: lista + painel de detalhe ---------- */
.clientes-layout { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 980px) {
  .clientes-layout { grid-template-columns: 1.2fr 1fr; align-items: start; }
  .clientes-layout .clientes-detalhe-painel { position: sticky; top: 16px; max-height: calc(100vh - 100px); overflow-y: auto; }
}
.clientes-filtros { display: flex; gap: 8px; margin-bottom: 14px; }
.clientes-filtros select { flex: 1; }
.clientes-lista-body { display: flex; flex-direction: column; gap: 6px; max-height: 640px; overflow-y: auto; }
.cliente-lista-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  background: var(--bg-input); cursor: pointer; transition: var(--transition-fast);
}
.cliente-lista-row:hover { border-color: var(--border-active); }
.cliente-lista-row.selected { border-color: var(--accent-rose); background: rgba(var(--accent-rose-rgb), 0.08); }
.cliente-lista-row .nome { font-weight: 600; font-size: 0.92rem; color: var(--text-primary); }
.cliente-lista-row .sub { font-size: 0.76rem; color: var(--text-muted); margin-top: 2px; }

.potencial-badge { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.potencial-alto { color: var(--accent-emerald); background: rgba(var(--accent-emerald-rgb), 0.15); }
.potencial-medio { color: var(--accent-amber); background: rgba(var(--accent-amber-rgb), 0.15); }
.potencial-baixo { color: var(--text-muted); background: rgba(148, 148, 148, 0.15); }
.potencial-na { color: var(--text-muted); background: rgba(148, 148, 148, 0.08); }

.cliente-detalhe-acoes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
.cliente-detalhe-acao {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 4px; border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  background: var(--bg-input); color: var(--text-secondary); font-size: 0.72rem; text-decoration: none;
  cursor: pointer; transition: var(--transition-fast);
}
.cliente-detalhe-acao:hover { border-color: var(--accent-rose); color: var(--accent-rose); }
.cliente-detalhe-acao .icone { font-size: 1.1rem; }

/* ---------- cadastro rápido ---------- */
.cliente-picker { position: relative; }
.cliente-sugestoes {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20;
  background: var(--bg-card); border: 1px solid var(--border-active); border-radius: var(--radius-sm);
  max-height: 260px; overflow-y: auto; box-shadow: 0 8px 24px rgba(var(--primary-rgb), 0.18);
}

.historico-compras-item {
  display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
  padding: 8px 0; border-bottom: 1px solid var(--border-color); font-size: 0.85rem; color: var(--text-secondary);
}
.historico-compras-item:last-child { border-bottom: none; }
.historico-compras-item strong { font-family: var(--font-heading); color: var(--text-primary); }

/* ---------- sincronizar ---------- */
.sync-status-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border-color); font-size: 0.9rem; }
.sync-status-row strong { font-family: var(--font-heading); color: var(--text-primary); }

.tablet-offline-badge {
  display: none; align-items: center; gap: 6px; font-size: 0.72rem; font-weight: 700;
  color: var(--accent-amber); background: rgba(var(--accent-amber-rgb), 0.15);
  padding: 4px 10px; border-radius: 999px;
}
.tablet-offline-badge.visible { display: inline-flex; }

/* ---------- botão flutuante do copiloto ---------- */
.tablet-copilot-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 500;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent-rose); color: #fff; border: none;
  font-size: 1.4rem; cursor: pointer;
  box-shadow: 0 6px 18px rgba(var(--accent-rose-rgb), 0.4);
  transition: var(--transition-fast);
}
.tablet-copilot-fab:hover { transform: scale(1.06); }

.copilot-source-tag {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-muted); margin-top: 4px; display: block;
}

/* ---------- rótulo de marca (respostas do copiloto agrupadas por marca) ---------- */
.copilot-brand-tag {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; opacity: 0.75; margin-bottom: 4px; display: block;
}

/* ---------- tinte por marca — reaproveita as variáveis de acento do tema
   (ver :root em web/styles.css), então continua correto nos 4 temas do app,
   nunca hex cru. Uma marca sempre cai na mesma cor (ver brandColorKey).
   Especificidade elevada (body .chat-bubble.client.copilot-brand-tint-*) de
   propósito: as regras de tema em styles.css (ex.: "body.theme-robotic-light
   .chat-bubble.client") já usam 3 seletores e, senão, ganhariam da nossa por
   especificidade mesmo carregando depois. ---------- */
body .chat-bubble.client.copilot-brand-tint-cyan,
body .chat-bubble.agent.copilot-brand-tint-cyan { background: rgba(var(--accent-cyan-rgb), 0.15); border-left: 3px solid var(--accent-cyan); }
body .chat-bubble.client.copilot-brand-tint-emerald,
body .chat-bubble.agent.copilot-brand-tint-emerald { background: rgba(var(--accent-emerald-rgb), 0.15); border-left: 3px solid var(--accent-emerald); }
body .chat-bubble.client.copilot-brand-tint-amber,
body .chat-bubble.agent.copilot-brand-tint-amber { background: rgba(var(--accent-amber-rgb), 0.15); border-left: 3px solid var(--accent-amber); }
body .chat-bubble.client.copilot-brand-tint-rose,
body .chat-bubble.agent.copilot-brand-tint-rose { background: rgba(var(--accent-rose-rgb), 0.15); border-left: 3px solid var(--accent-rose); }
body .chat-bubble.client.copilot-brand-tint-purple,
body .chat-bubble.agent.copilot-brand-tint-purple { background: rgba(var(--accent-purple-rgb), 0.15); border-left: 3px solid var(--accent-purple); }

/* ---------- Adão — widget de suporte (teste) ---------- */
.adao-bubble {
  position: fixed; right: 20px; bottom: 20px; z-index: 9998;
  width: 56px; height: 56px; border-radius: 50%; border: none;
  background: var(--primary); color: #fff; font-size: 1.5rem; cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  display: flex; align-items: center; justify-content: center;
  transition: transform 150ms ease;
}
.adao-bubble:hover { transform: scale(1.06); }
.adao-bubble:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

.adao-panel {
  position: fixed; right: 20px; bottom: 88px; z-index: 9998;
  width: min(340px, calc(100vw - 40px)); height: min(460px, calc(100vh - 140px));
  background: var(--bg-card, #fff); border-radius: 14px; overflow: hidden;
  box-shadow: 0 12px 32px rgba(0,0,0,0.3);
  display: flex; flex-direction: column;
  border: 1px solid var(--border-color, rgba(0,0,0,0.08));
}
.adao-panel[hidden] { display: none; }

.adao-panel-header {
  background: var(--primary); color: #fff; padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; font-size: 0.9rem;
}
.adao-panel-header button {
  background: transparent; border: none; color: #fff; cursor: pointer;
  font-size: 1rem; line-height: 1; padding: 4px; min-width: 28px; min-height: 28px;
}

.adao-messages {
  flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px;
  font-size: 0.85rem;
}
.adao-msg { max-width: 85%; padding: 8px 11px; border-radius: 10px; line-height: 1.4; white-space: pre-wrap; }
.adao-msg.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 3px; }
.adao-msg.bot { align-self: flex-start; background: var(--bg-hover, rgba(0,0,0,0.06)); color: var(--text-primary, inherit); border-bottom-left-radius: 3px; }
.adao-msg.bot.error { background: rgba(var(--accent-rose-rgb), 0.15); border-left: 3px solid var(--accent-rose); }
.adao-msg.typing { opacity: 0.6; font-style: italic; }

.adao-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--border-color, rgba(0,0,0,0.08)); }
.adao-form input {
  flex: 1; min-height: 44px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--border-color, rgba(0,0,0,0.15)); font-size: 0.9rem;
}
.adao-form button {
  min-height: 44px; padding: 0 14px; border-radius: 8px; border: none;
  background: var(--primary); color: #fff; font-weight: 600; cursor: pointer;
}
.adao-form button:disabled { opacity: 0.5; cursor: default; }

@media (prefers-reduced-motion: reduce) { .adao-bubble { transition: none; } }
