/* ---------- Estilos da tela logada: layout "Dashboard" ----------
   Tudo aqui vale só com body.dash-active (aplicado por app.js quando o
   layout efetivo da conta é "dashboard"). Nenhum nó do feed/conta muda de
   lugar: a sidebar é fixa e o conteúdo recebe padding à esquerda. O visual
   clássico (styles.css) segue intocado; a última seção (seletor em Minha
   conta) é comum aos dois layouts. */

:root {
  --dash-sidebar-w: 248px;
  --dash-nav-h: 64px;
  --dash-bg: #F6F7F9;
  --dash-card: var(--white);
  --dash-radius: 16px;
}

html[data-theme="dark"] {
  --dash-bg: #101216;
  --dash-card: #1A1E24;
}

/* ----- Casca ----- */

body.dash-active {
  background: var(--dash-bg);
}

/* Sidebar fixa sob a topnav (que segue sticky) */
body.dash-active .dash-sidebar {
  position: fixed;
  top: var(--dash-nav-h);
  left: 0;
  bottom: 0;
  width: var(--dash-sidebar-w);
  overflow-y: auto;
  padding: 20px 14px 24px;
  background: var(--dash-card);
  border-right: 1px solid var(--border);
  /* Acima da barra sticky do feed (.feed-live, z 15) e abaixo da topnav (20) */
  z-index: 18;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Conteúdo logado deslocado. #inbox é a seção que contém tudo. */
body.dash-active #inbox {
  padding-left: var(--dash-sidebar-w);
}

/* A largura do .container é medida do espaço restante */
body.dash-active #inbox > .container {
  width: min(1120px, 100%);
}

/* Topbar no desktop: a barra deixa de seguir o .container centralizado e
   ocupa a tela toda — logotipo alinhado à esquerda, sobre a sidebar, e as
   ações no canto direito. No celular (≤900px) vale a grade centralizada. */
@media (min-width: 901px) {
  body.dash-active .topnav .nav-inner {
    width: 100%;
    padding-inline: 20px 24px;
  }
}

/* Topbar: itens duplicados pela sidebar somem (o logotipo fica) */
body.dash-active #messagesBtn,
body.dash-active #accountBtn,
body.dash-active #adminBtn {
  display: none !important;
}

/* Cabeçalho do feed mais discreto: a Visão geral tem o título da página */
body.dash-active .feed-bar {
  padding-top: 28px;
  padding-bottom: 16px;
}

body.dash-active.dash-view-overview .feed-bar .page-title {
  display: none;
}

body.dash-active.dash-view-overview .feed-bar .session-meta {
  margin-top: 0;
}

/* Na Visão geral a feed-bar quase sempre fica vazia (título escondido, ações
   só com número extra para conectar): sem padding, para não abrir um vão
   acima do título. Quando há algo visível nela ou um aviso logo abaixo
   (trust/cofre/trial…), o respiro volta só nesses casos. */
body.dash-active.dash-view-overview .feed-bar {
  padding-top: 0;
  padding-bottom: 0;
  gap: 0; /* no celular é coluna: o gap sozinho abria 16px entre filhos vazios */
}

/* Só o que de fato aparece no Dashboard conta (Minha conta/Mensagens/Admin
   ficam display:none por CSS, sem [hidden] — não podem disparar o padding) */
body.dash-active.dash-view-overview .feed-bar:has(#numberPickerWrap:not([hidden])),
body.dash-active.dash-view-overview .feed-bar:has(#addNumberBtn:not([hidden])) {
  padding-top: 24px;
}

body.dash-active.dash-view-overview .feed-bar + .container:has(> :not([hidden])) {
  padding-top: 24px;
}

/* Com aviso acima, a Visão geral encosta mais nele (o aviso já tem margem) */
body.dash-active.dash-view-overview .feed-bar + .container:has(> :not([hidden])) ~ .dash-overview {
  padding-top: 8px;
}

/* ----- Feed sob o Dashboard -----
   No desktop a sidebar (sempre visível) escolhe o filtro por tipo, então os
   chips somem; fica a busca. No celular a sidebar é um drawer FECHADO: sem os
   chips o usuário não vê que o feed está filtrado (o título "Apagadas" é o
   único sinal) nem tem como trocar sem abrir o menu — então ali os chips
   voltam, com os mesmos contadores e estado dos itens da sidebar. Os cards de
   superfície (Guardadas / Sem visto) continuam no feed nos dois casos. O feed
   ocupa a mesma largura da Visão geral; o card de conexão do WhatsApp
   (.waha-card, styles.css) só herda raio e fundo dos .dash-card. */

body.dash-active .feed-bar .page-title {
  font-size: 26px;
}

@media (min-width: 901px) {
  body.dash-active #feedFilters {
    display: none !important;
  }

  body.dash-active .feed-filters {
    justify-content: flex-end;
  }
}

body.dash-active .feed-surfaces {
  margin-top: 8px;
}

body.dash-active .feed-surface {
  background: var(--dash-card);
  border-radius: var(--dash-radius);
}

body.dash-active .feed {
  padding-top: 8px;
}

body.dash-active .feed-filters {
  margin-bottom: 16px;
}

body.dash-active .feed-search {
  flex: 0 1 380px;
}

@media (max-width: 640px) {
  body.dash-active .feed-search {
    flex: 1 1 100%;
    min-width: 0;
  }
}

body.dash-active .feed-search input {
  border-radius: 999px;
  background: var(--dash-card);
}

body.dash-active .list,
body.dash-active .feed-live,
body.dash-active .feed-pager,
body.dash-active .empty,
body.dash-active .enc-banner,
body.dash-active .enc-chip,
body.dash-active .silent-intro {
  max-width: none;
}

body.dash-active .msg {
  border-radius: var(--dash-radius);
}

/* Card de conexão do WhatsApp: mesma casca dos demais cards do Dashboard */
body.dash-active .waha-card {
  background: var(--dash-card);
  border-radius: var(--dash-radius);
  padding: 16px 22px;
}

/* Peças que usam --white como "cor da superfície" (anel do selo, fundo dos
   botões ícone, URL da segunda tela) passam a casar com o fundo do card. */
body.dash-active .waha-dot,
body.dash-active .waha-icon-btn,
body.dash-active .pair-handoff-url {
  --white: var(--dash-card);
}

/* ----- Sidebar: itens ----- */

/* O logotipo já está na topnav (que segue visível em todas as larguras) */
body.dash-active .dash-brand {
  display: none;
}

body.dash-active .dash-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

body.dash-active .dash-sub {
  list-style: none;
  margin: 2px 0 4px;
  padding: 0 0 0 32px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

body.dash-active .dash-group {
  margin: 14px 0 4px;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

body.dash-active .dash-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

body.dash-active .dash-item:hover {
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  color: var(--ink);
}

body.dash-active .dash-item.is-active {
  background: color-mix(in srgb, var(--yellow) 18%, var(--dash-card));
  color: var(--ink);
}

body.dash-active .dash-item.is-parent-active {
  color: var(--ink);
}

body.dash-active .dash-item.is-sub {
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--slate);
}

body.dash-active .dash-item.is-sub.is-active {
  color: var(--ink);
  font-weight: 600;
}

/* Subitens são multi-seleção: um marcador por item aceso (vários podem
   estar ativos ao mesmo tempo, então o realce de fundo sozinho confundiria) */
body.dash-active .dash-item.is-sub::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  margin-right: 2px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid color-mix(in srgb, var(--slate) 55%, transparent);
  transition: background 0.15s ease, border-color 0.15s ease;
}

body.dash-active .dash-item.is-sub.is-active::before {
  background: var(--yellow);
  border-color: var(--yellow-active);
}

body.dash-active .dash-ico {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--slate);
}

body.dash-active .dash-item.is-active .dash-ico {
  color: var(--yellow-active);
}

body.dash-active .dash-item > span:first-of-type {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.dash-active .dash-count {
  flex: 0 0 auto;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  font-feature-settings: "tnum";
}

body.dash-active .dash-item.is-active .dash-count {
  background: var(--yellow);
  color: var(--on-yellow);
}

body.dash-active .dash-chevron {
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

/* Botão do drawer: só em telas estreitas. Painel lateral fechado → X aberto
   (mesmo mecanismo do sol/lua do themeToggle, aqui guiado por aria-expanded). */
body.dash-active .dash-menu-btn {
  display: none;
}

.dash-menu-btn .icon-close { display: none; }
.dash-menu-btn[aria-expanded="true"] .icon-panel { display: none; }
.dash-menu-btn[aria-expanded="true"] .icon-close { display: block; }

/* ----- Visão geral ----- */

body.dash-active .dash-overview {
  padding-top: 28px;
  padding-bottom: 48px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

body.dash-active .dash-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

body.dash-active .dash-head .page-title {
  font-size: 26px;
}

/* Aviso de cofre travado na Visão geral: o gap da coluna já espaça */
body.dash-active .dash-overview .enc-banner {
  margin: 0;
}

body.dash-active .dash-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(380px, 100%);
  padding: 0 14px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--dash-card);
  color: var(--muted);
}

body.dash-active .dash-search:focus-within {
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--yellow) 25%, transparent);
}

body.dash-active .dash-search svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

body.dash-active .dash-search input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  outline: none;
}

body.dash-active .dash-search input::-webkit-search-decoration {
  -webkit-appearance: none;
}

body.dash-active .dash-card {
  background: var(--dash-card);
  border: 1px solid var(--border);
  border-radius: var(--dash-radius);
  box-shadow: var(--shadow-card);
}

/* Proteção */
body.dash-active .dash-protection {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
}

/* Ícone do número com o ponto de estado como selo no canto */
body.dash-active .dash-protection-ico {
  position: relative;
  display: inline-flex;
  width: 40px;
  height: 40px;
}

body.dash-active .dash-protection-ico .i3d {
  font-size: 40px;
  filter: drop-shadow(0 3px 5px rgba(20, 22, 30, 0.12));
}

body.dash-active .dash-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--slate);
  box-shadow: 0 0 0 3px var(--dash-card), 0 0 0 5px color-mix(in srgb, var(--slate) 18%, transparent);
}

body.dash-active .dash-dot.is-ok {
  background: var(--green);
  box-shadow: 0 0 0 3px var(--dash-card), 0 0 0 5px color-mix(in srgb, var(--green) 22%, transparent);
}

body.dash-active .dash-dot.is-off {
  background: var(--red);
  box-shadow: 0 0 0 3px var(--dash-card), 0 0 0 5px color-mix(in srgb, var(--red) 22%, transparent);
}

body.dash-active .dash-protection-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

body.dash-active .dash-protection-copy strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

body.dash-active .dash-protection-copy span,
body.dash-active .dash-protection-side {
  font-size: 13px;
  color: var(--slate);
}

body.dash-active .dash-protection-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

body.dash-active .dash-protection-side span:first-child {
  color: var(--text-2);
  font-weight: 600;
}

body.dash-active .dash-protection-side span:first-child:empty + span {
  display: none;
}

/* Novidades */
body.dash-active .dash-news {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 20px 22px;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--yellow) 22%, var(--dash-card)),
    var(--dash-card) 70%);
}

/* Placa neutra (mesma família de .icon-tile): o objeto 3D já traz a cor. */
body.dash-active .dash-news-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--snow) 76%, var(--white));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

html[data-theme="dark"] body.dash-active .dash-news-icon {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

body.dash-active .dash-news-icon .i3d {
  font-size: 32px;
}

body.dash-active .dash-news-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

body.dash-active .dash-now {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

body.dash-active .dash-news-copy strong {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

body.dash-active .dash-news-copy > span {
  font-size: 13px;
  color: var(--slate);
}

body.dash-active .dash-news-preview {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--text-2);
}

/* "Quem mais aparece": até 3 contatos com novidades, clicáveis (busca) */
body.dash-active .dash-news-peers {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

body.dash-active .dash-news-peer {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 3px 6px 3px 3px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
}

body.dash-active .dash-news-peer:hover {
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  color: var(--ink);
}

body.dash-active .dash-news-peer .msg-avatar {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  font-size: 11px;
}

body.dash-active .dash-news-peer-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.dash-active .dash-news-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Portas: Recuperadas (sem filtro) e Leitura privada, lado a lado. Mesmo
   desenho do card de Proteção (3D, texto, dado, ação), aqui como botão. */
body.dash-active .dash-doors {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

body.dash-active .dash-door {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  column-gap: 14px;
  padding: 16px 18px;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

body.dash-active .dash-door:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card-hover);
}

body.dash-active .dash-door > .i3d {
  width: 46px;
  height: 46px;
  filter: drop-shadow(0 4px 6px rgba(20, 22, 30, 0.14));
}

body.dash-active .dash-door-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

body.dash-active .dash-door-body strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

body.dash-active .dash-door-sub {
  font-size: 13px;
  line-height: 1.3;
  color: var(--slate);
}

body.dash-active .dash-door-num {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
  font-feature-settings: "tnum";
}

/* Novidade naquela superfície: mesmo amarelo dos contadores da sidebar */
body.dash-active .dash-door-num.has-new {
  color: var(--yellow-active);
}

/* Contadores */
body.dash-active .dash-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

/* Objeto 3D grande à esquerda; à direita a coluna de texto com o rótulo
   pequeno em cima e o número como protagonista. */
body.dash-active .dash-stat {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 14px;
  padding: 16px 18px;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

body.dash-active .dash-stat:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card-hover);
}

body.dash-active .dash-stat > .i3d {
  width: 46px;
  height: 46px;
  filter: drop-shadow(0 4px 6px rgba(20, 22, 30, 0.14));
}

body.dash-active .dash-stat-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

body.dash-active .dash-stat-head {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--slate);
}

body.dash-active .dash-stat-num {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
  font-feature-settings: "tnum";
}

/* Badge "+N" de novidades no canto do card de estatística */
body.dash-active .dash-stat {
  position: relative;
}

body.dash-active .dash-stat-new {
  position: absolute;
  top: 10px;
  right: 12px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--on-yellow);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  font-feature-settings: "tnum";
}

/* Contador da sidebar com novidade daquele tipo */
body.dash-active .dash-count.has-new {
  background: var(--yellow);
  color: var(--on-yellow);
}

/* Expiração (dado real: `expiring` do poll) */
body.dash-active .dash-expiring {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--red) 8%, var(--dash-card));
  border: 1px solid color-mix(in srgb, var(--red) 25%, transparent);
  font-size: 14px;
  color: var(--text-2);
}

body.dash-active .dash-expiring .i3d {
  font-size: 26px;
}

body.dash-active .dash-expiring p {
  margin: 0;
  flex: 1 1 auto;
}

/* Wipe agendado (conta cancelada / trial vencido): tom mais forte */
body.dash-active .dash-expiring.is-held {
  background: color-mix(in srgb, var(--red) 14%, var(--dash-card));
  border-color: color-mix(in srgb, var(--red) 45%, transparent);
  color: var(--ink);
}

body.dash-active .dash-demo-tag {
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px dashed var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Eventos recentes */
body.dash-active .dash-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

body.dash-active .dash-section-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

body.dash-active .dash-recent {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* "Ver todas" depois da lista: fim de leitura, largura total */
body.dash-active .dash-recent-more {
  width: 100%;
  justify-content: center;
}

/* Cartão do feed em modo compacto: sem animação de entrada, bolhas menores */
body.dash-active .msg.is-compact {
  animation: none;
  padding: 12px 16px;
}

body.dash-active .msg.is-compact .fm-chat {
  margin-top: 6px;
}

body.dash-active .msg.is-compact .fm-bubble {
  max-width: min(640px, 100%);
}

body.dash-active .msg.is-compact .msg-time,
body.dash-active .msg.is-compact .msg-footer {
  display: none;
}

/* Contatos protegidos (em breve) */
body.dash-active .dash-contacts {
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

body.dash-active .dash-contacts-count {
  margin: 4px 0;
  font-size: 14px;
  color: var(--slate);
}

body.dash-active .dash-contacts-count strong {
  font-size: 22px;
  color: var(--ink);
  margin-right: 6px;
}

/* ----- Telas estreitas: sidebar vira drawer ----- */

@media (max-width: 900px) {
  body.dash-active #inbox {
    padding-left: 0;
  }

  body.dash-active .dash-menu-btn {
    display: inline-grid;
  }

  /* Topbar: menu à esquerda, logotipo + nome centralizados, ações à direita.
     Grade 1fr auto 1fr centraliza a marca em relação à tela enquanto houver
     espaço; em telas muito estreitas as laterais crescem sem sobrepor. A
     ordem no DOM (marca, menu, ações) não muda — só a coluna de cada um. */
  body.dash-active .nav-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
  }

  /* grid-row explícito: sem ele, a marca (1ª no DOM, coluna 2) empurraria o
     menu (coluna 1) para uma segunda linha pela auto-colocação. */
  body.dash-active .nav-inner .dash-menu-btn {
    grid-row: 1;
    grid-column: 1;
    justify-self: start;
  }

  body.dash-active .nav-inner .brand {
    grid-row: 1;
    grid-column: 2;
    justify-self: center;
  }

  body.dash-active .nav-inner .nav-right {
    grid-row: 1;
    grid-column: 3;
    justify-self: end;
    gap: 8px;
  }

  body.dash-active .nav-tag,
  body.dash-active .lang-toggle {
    display: none;
  }

  body.dash-active .dash-sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: none;
    width: min(300px, 86vw);
  }

  body.dash-active.dash-drawer-open .dash-sidebar {
    transform: none;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  }

  /* Véu atrás do drawer */
  body.dash-active.dash-drawer-open::before {
    content: "";
    position: fixed;
    inset: var(--dash-nav-h) 0 0 0;
    background: rgba(12, 14, 18, 0.45);
    z-index: 17;
  }

  body.dash-active .dash-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.dash-active .dash-doors {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  body.dash-active .dash-door > .i3d {
    width: 38px;
    height: 38px;
  }

  body.dash-active .dash-door-num {
    font-size: 24px;
  }

  body.dash-active .dash-protection {
    grid-template-columns: auto 1fr;
  }

  /* No celular o card fica só com estado + número: as linhas de sincronização
     e o "Gerenciar conexão" somem (a conexão mora em Configurações → Minha
     conexão). "Conectar" (número ainda não pareado) continua visível. */
  body.dash-active .dash-protection-side,
  body.dash-active .dash-protection > .btn.is-manage {
    display: none;
  }

  body.dash-active .dash-protection > .btn {
    grid-column: 1 / -1;
    justify-self: start;
  }

  body.dash-active .dash-news {
    grid-template-columns: auto 1fr;
  }

  body.dash-active .dash-news-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

/* Celular estreito: continuam 2 por linha, com objeto e textos compactados
   para caber em ~165px (rótulo pode quebrar em duas linhas). */
@media (max-width: 560px) {
  body.dash-active .dash-stats {
    gap: 10px;
  }

  body.dash-active .dash-stat {
    column-gap: 10px;
    padding: 14px 12px;
  }

  body.dash-active .dash-stat > .i3d {
    width: 38px;
    height: 38px;
  }

  body.dash-active .dash-stat-head {
    font-size: 11.5px;
  }

  body.dash-active .dash-stat-num {
    font-size: 24px;
  }
}

/* ---------- Minha conta: seletor de aparência (comum aos dois layouts) ---------- */

.layout-zone {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.layout-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.layout-option {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.layout-option:hover {
  border-color: color-mix(in srgb, var(--yellow) 60%, var(--border));
}

.layout-option input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.layout-option:has(input:checked) {
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--yellow) 25%, transparent);
}

.layout-option:has(input:focus-visible) {
  outline: 2px solid var(--focus-blue);
  outline-offset: 2px;
}

.layout-option:has(input:disabled) {
  opacity: 0.6;
  cursor: progress;
}

/* Miniatura esquemática do layout */
.layout-thumb {
  display: grid;
  gap: 4px;
  height: 64px;
  padding: 6px;
  border-radius: 8px;
  background: var(--snow);
  border: 1px solid var(--border);
}

.layout-thumb i {
  display: block;
  border-radius: 3px;
  background: color-mix(in srgb, var(--ink) 12%, transparent);
}

.layout-thumb.is-classic {
  grid-template-rows: 10px 1fr 1fr;
}

.layout-thumb.is-classic i:first-child {
  background: var(--yellow);
}

.layout-thumb.is-dashboard {
  grid-template-columns: 22px 1fr;
  grid-template-rows: 1fr 1fr;
}

.layout-thumb.is-dashboard i:first-child {
  grid-row: 1 / -1;
  background: color-mix(in srgb, var(--ink) 22%, transparent);
}

.layout-thumb.is-dashboard i:nth-child(2) {
  background: var(--yellow);
}

.layout-option-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.layout-option-copy strong {
  font-size: 14px;
  color: var(--ink);
}

.layout-option-copy em {
  font-style: normal;
  font-size: 12px;
  color: var(--slate);
}

@media (max-width: 560px) {
  .layout-picker {
    grid-template-columns: 1fr;
  }
}

/* Painel master: campo de política ocupa a linha inteira (4º campo da grade
   1fr 2fr 1fr cairia na coluna estreita) e badge na lista de contas */
.inst-grid .acct-layout-field {
  grid-column: 1 / -1;
}

.acct-layout-field select {
  max-width: 420px;
}

.inst-badge.layout {
  background: color-mix(in srgb, var(--yellow) 18%, var(--white));
  color: var(--yellow-active);
}
