/* Play+ · Painel — componentes reutilizáveis.
   Ordem: botões · campos compostos · cartões · selos · números · tabelas · paginação · listas ·
   gaveta · diálogo · avisos · dica · estado vazio · esqueleto · barra superior (chips). */

/* ==========================================================================
   Botões
   .btn (secundário, vidro) · .primary · .danger · .ghost · .small · .icon-only · .is-loading
   ========================================================================== */

.btn {
  --btn-bg: var(--fill-2);
  --btn-bg-hover: var(--fill-3);
  --btn-border: var(--line-2);
  --btn-fg: var(--text);
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--control-h);
  padding: 0 14px;
  font-size: 13.5px;
  font-weight: 550;
  line-height: 1;
  color: var(--btn-fg);
  text-decoration: none;
  white-space: nowrap;
  vertical-align: middle;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  cursor: pointer;
  user-select: none;
  transition:
    background var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}

.btn:hover {
  background: var(--btn-bg-hover);
  border-color: var(--line-3);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0) scale(0.98);
  transition-duration: 60ms;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.btn:disabled {
  opacity: 0.45;
  transform: none;
  box-shadow: none;
  cursor: not-allowed;
  pointer-events: none;
}

/* Ação principal: a única área com a cor da marca cheia */
.btn.primary {
  --btn-fg: var(--on-accent);
  font-weight: 650;
  background: linear-gradient(180deg, var(--accent), var(--accent-press));
  border-color: color-mix(in srgb, var(--accent) 70%, #000);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.24) inset,
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 8px 20px -10px color-mix(in srgb, var(--accent) 80%, transparent);
}

.btn.primary:hover {
  background: linear-gradient(180deg, var(--accent), var(--accent-press));
  border-color: color-mix(in srgb, var(--accent) 70%, #000);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.3) inset,
    0 2px 4px rgba(0, 0, 0, 0.4),
    0 12px 26px -10px var(--accent);
}

.btn.primary:focus-visible {
  box-shadow:
    0 0 0 2px var(--bg),
    0 0 0 4px var(--accent-text);
}

/* Ação que apaga, bloqueia ou não tem volta */
.btn.danger {
  --btn-fg: var(--danger);
  --btn-bg: transparent;
  --btn-bg-hover: var(--danger-soft);
  --btn-border: var(--danger-line);
}

.btn.danger:hover {
  border-color: var(--danger);
}

.btn.danger.solid {
  --btn-fg: #fff;
  --btn-bg: var(--danger-solid);
  --btn-bg-hover: color-mix(in srgb, var(--danger-solid) 88%, #fff);
  --btn-border: transparent;
  font-weight: 650;
}

.btn.ghost {
  --btn-bg: transparent;
  --btn-border: transparent;
  --btn-fg: var(--text-2);
  box-shadow: none;
}

.btn.ghost:hover {
  color: var(--text);
  background: var(--fill-2);
  border-color: transparent;
}

.btn.ghost.danger {
  --btn-fg: var(--danger);
}

.btn.ghost.danger:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.btn.small {
  height: var(--control-h-sm);
  padding: 0 11px;
  gap: 6px;
  font-size: 12.5px;
  border-radius: var(--r-sm);
}

/* Área de clique de pelo menos 36 px, mesmo no botão pequeno */
.btn.small::before {
  content: '';
  position: absolute;
  inset: -3px -2px;
}

.btn.icon-only {
  width: var(--control-h);
  padding: 0;
}

.btn.small.icon-only {
  width: var(--control-h-sm);
}

.btn.is-loading {
  color: transparent !important;
  pointer-events: none;
}

.btn.is-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 16px;
  height: 16px;
  margin: auto;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Abas e escolhas lado a lado. O botão marcado é o que tem a classe .primary (o app.js já alterna essa classe). */
.segmented {
  display: inline-flex;
  justify-self: start;
  gap: 2px;
  padding: 3px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.segmented > .btn {
  height: 30px;
  padding: 0 12px;
  font-size: 12.5px;
  color: var(--text-3);
  background: transparent;
  border-color: transparent;
  border-radius: 7px;
  box-shadow: none;
}

.segmented > .btn:hover {
  color: var(--text);
  background: var(--fill-1);
  transform: none;
}

.segmented > .btn.primary,
.segmented > .btn.primary:hover {
  font-weight: 600;
  color: var(--text);
  background: var(--fill-3);
  border-color: var(--line-2);
  box-shadow: var(--shadow-1);
}

/* Campos de usuário e senha escondidos enquanto a escolha é "Colar M3U" (m3u-paste.js) */
.m3u-off {
  display: none !important;
}

/* Duas opções separadas, lado a lado (02/11/2026): a escolhida em destaque */
.m3u-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.m3u-modes .btn {
  justify-content: center;
}

.segmented > .btn:focus-visible {
  box-shadow: var(--ring);
}

/* ==========================================================================
   Campos compostos
   ========================================================================== */

/* Campo com ícone à esquerda (e, se precisar, um botão à direita) */
.control {
  position: relative;
  display: block;
}

.control > .icon {
  position: absolute;
  top: 50%;
  left: 12px;
  color: var(--text-3);
  pointer-events: none;
  transform: translateY(-50%);
}

.control > input {
  padding-left: 38px;
}

.control--action > input {
  padding-right: 42px;
}

.control-btn {
  position: absolute;
  top: 50%;
  right: 3px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--text-3);
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  transform: translateY(-50%);
  transition:
    color var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease);
}

.control-btn:hover {
  color: var(--text);
  background: var(--fill-2);
}

.control-btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.search {
  flex: 1 1 280px;
  max-width: 460px;
}

/* Caixa de marcar com texto ao lado */
.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: var(--fs-small);
  font-weight: var(--fw-regular);
  line-height: 1.4;
  color: var(--text-2);
  cursor: pointer;
}

.check input {
  margin: 1px 0 0;
}

/* Linha de ajuda embaixo do texto da caixa de marcar */
.check-help {
  display: block;
  font-size: 12px;
  color: var(--text-3);
}

/* Validade da lista (lida do provedor) com o botão "Conferir agora" ao lado */
.list-validity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

/* Chave liga/desliga */
input.switch {
  position: relative;
  width: 30px;
  height: 18px;
  margin: 0;
  appearance: none;
  background: var(--fill-3);
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  transition:
    background var(--t-base) var(--ease),
    border-color var(--t-base) var(--ease);
}

input.switch::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: var(--text-2);
  border-radius: 50%;
  transition:
    transform var(--t-base) var(--ease),
    background var(--t-base) var(--ease);
}

input.switch:checked {
  background: var(--accent);
  border-color: transparent;
}

input.switch:checked::before {
  background: #fff;
  transform: translateX(12px);
}

input.switch:focus-visible {
  box-shadow: var(--ring);
}

/* Campos lado a lado */
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
}

.row > label {
  flex: 1;
  min-width: 140px;
}

.row > input {
  flex: 1;
  min-width: 160px;
}

/* Blocos empilhados (formulários e cartões da gaveta) */
.stack {
  display: grid;
  align-content: start;
  gap: 12px;
}

/* ==========================================================================
   Cartões e caixas
   ========================================================================== */

.card {
  position: relative;
  padding: var(--s-5);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0) 52%),
    var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-2);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 9px;
}

.card-title .icon {
  color: var(--text-3);
}

/* Cartão que pede atenção (pedido de vínculo aguardando aprovação) */
.card.highlight {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%),
    var(--glass);
  border-color: var(--accent-line);
}

/* Bloco opcional dentro de um formulário */
.sub-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: var(--fill-1);
  border: 1px dashed var(--line-2);
  border-radius: var(--r-lg);
}

/* Aviso com ícone */
.callout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: var(--fs-small);
  color: var(--text-2);
  background: var(--fill-1);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
}

.callout > span {
  flex: 1;
  min-width: 0;
}

.callout--danger {
  background: var(--danger-soft);
  border-color: var(--danger-line);
}

.callout--danger > .icon {
  color: var(--danger);
}

.callout--info > .icon {
  color: var(--info);
}

/* Abre e fecha (Histórico, Adicionar lista) */
details > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 6px;
  font-size: var(--fs-small);
  font-weight: 550;
  color: var(--text-2);
  list-style: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  user-select: none;
  transition:
    color var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease);
}

details > summary::-webkit-details-marker {
  display: none;
}

details > summary:hover {
  color: var(--text);
  background: var(--fill-1);
}

details > summary .icon {
  color: var(--text-3);
  transition: transform var(--t-fast) var(--ease);
}

details[open] > summary .icon {
  transform: rotate(90deg);
}

details > .stack,
details > .log {
  margin-top: 10px;
}

/* ==========================================================================
   Selos
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  color: var(--text-2);
  white-space: nowrap;
  vertical-align: middle;
  background: var(--neutral-soft);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
}

/* Selo com texto longo (nome de pessoa): pode quebrar em duas linhas em vez de alargar a coluna */
.badge--wrap {
  height: auto;
  min-height: 24px;
  padding-top: 4px;
  padding-bottom: 4px;
  line-height: 1.25;
  text-align: left;
  white-space: normal;
  border-radius: 12px;
}

.badge.active,
.badge.pending,
.badge.expired,
.badge.blocked {
  border-color: var(--tone-line);
  color: var(--tone);
  background: var(--tone-soft);
}

.badge.active::before,
.badge.pending::before,
.badge.expired::before,
.badge.blocked::before {
  content: '';
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
}

.badge.active,
.badge.online {
  --tone: var(--ok);
  --tone-soft: var(--ok-soft);
  --tone-line: var(--ok-line);
}

.badge.pending {
  --tone: var(--warn);
  --tone-soft: var(--warn-soft);
  --tone-line: var(--warn-line);
}

.badge.expired {
  --tone: var(--alert);
  --tone-soft: var(--alert-soft);
  --tone-line: var(--alert-line);
}

.badge.blocked {
  --tone: var(--danger);
  --tone-soft: var(--danger-soft);
  --tone-line: var(--danger-line);
}

/* Aparelho com o app aberto agora */
.badge.online {
  color: var(--tone);
  background: var(--tone-soft);
  border-color: var(--tone-line);
}

.badge.online i {
  width: 7px;
  height: 7px;
  background: var(--ok);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.6);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 7px rgba(61, 220, 151, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(61, 220, 151, 0);
  }
}

/* Contador (quantidade de erros, por exemplo) */
.count {
  display: inline-grid;
  flex: none;
  place-items: center;
  min-width: 30px;
  height: 24px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--warn);
  background: var(--warn-soft);
  border: 1px solid var(--warn-line);
  border-radius: var(--r-pill);
}

/* Código do aparelho e outros valores para ditar ou copiar */
.code {
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

/* Círculo com a inicial */
.avatar {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
  border: 1px solid var(--line-2);
  border-radius: 50%;
}

/* Cores de apoio por estado: definem --tone e --tone-soft para quem estiver dentro */
.tone-neutral {
  --tone: var(--text-2);
  --tone-soft: var(--neutral-soft);
}

.tone-ok {
  --tone: var(--ok);
  --tone-soft: var(--ok-soft);
}

.tone-warn {
  --tone: var(--warn);
  --tone-soft: var(--warn-soft);
}

.tone-danger {
  --tone: var(--danger);
  --tone-soft: var(--danger-soft);
}

.tone-info {
  --tone: var(--info);
  --tone-soft: var(--info-soft);
}

.tone-accent {
  --tone: var(--accent-text);
  --tone-soft: var(--accent-soft);
}

/* ==========================================================================
   Cartões de número (também servem de filtro)
   ========================================================================== */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(146px, 1fr));
  gap: 12px;
}

/* Poucos cartões: não esticam para ocupar a linha inteira */
.stats--compact {
  grid-template-columns: repeat(auto-fit, minmax(146px, 240px));
}

/* No computador os cartões ficam sempre em uma linha só, dividindo a largura (nenhum sobra sozinho embaixo) */
@media (min-width: 1100px) {
  .stats:not(.stats--compact) {
    grid-template-columns: none;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
  }
}

.stat {
  position: relative;
  display: grid;
  grid-template-areas:
    'value icon'
    'label label'
    'hint hint';
  grid-template-columns: 1fr auto;
  align-content: start;
  column-gap: 8px;
  min-height: 96px;
  padding: 14px 14px 13px;
  font: inherit;
  color: inherit;
  text-align: left;
  text-decoration: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0) 60%),
    var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  cursor: pointer;
  transition:
    border-color var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease),
    box-shadow var(--t-base) var(--ease),
    transform var(--t-base) var(--ease);
}

.stat:hover {
  border-color: var(--line-3);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.stat:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.stat > b {
  grid-area: value;
  align-self: center;
  font-size: 26px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.stat-icon {
  position: relative;
  display: grid;
  grid-area: icon;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--tone);
  background: var(--tone-soft);
  border-radius: 9px;
}

/* Ponto pulsando: número que muda sozinho ("Online agora") */
.stat-icon.is-live::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: var(--ok);
  border: 2px solid #0d1016;
  border-radius: 50%;
  box-sizing: content-box;
  animation: pulse 1.8s infinite;
}

.stat-label {
  grid-area: label;
  margin-top: 8px;
  font-size: var(--fs-caption);
  color: var(--text-2);
}

.stat-hint {
  grid-area: hint;
  margin-top: 1px;
  font-size: 12px;
  color: var(--text-3);
}

.stat.selected {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 12%, transparent), color-mix(in srgb, var(--accent) 3%, transparent)),
    var(--glass);
  border-color: var(--accent-line);
  box-shadow:
    inset 0 -2px 0 var(--accent),
    var(--shadow-1);
}

.stat.is-static {
  cursor: default;
}

.stat.is-static:hover {
  border-color: var(--line);
  box-shadow: var(--shadow-1);
  transform: none;
}

/* ==========================================================================
   Tabelas
   ========================================================================== */

.table-wrap {
  overflow: auto;
  background: var(--glass); /* liso, sem degradê: a coluna fixa de ações (--solid-row) precisa ter a mesma cor */
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-2);
}

/* Listas longas rolam dentro do cartão, com o cabeçalho fixo */
.table-wrap--scroll {
  max-height: max(360px, calc(100vh - 250px));
}

.table {
  width: 100%;
  min-width: 760px;
  border-spacing: 0;
  border-collapse: separate;
  font-variant-numeric: tabular-nums;
}

.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 14px;
  font-size: var(--fs-micro);
  font-weight: var(--fw-semi);
  letter-spacing: 0.07em;
  text-align: left;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
  background: var(--solid-2);
  border-bottom: 1px solid var(--line);
}

.table td {
  padding: 11px 14px;
  font-size: 13.5px;
  vertical-align: middle;
  border-bottom: 1px solid var(--line-soft);
}

/* --row-tint: tom da linha (zebra sutil, hover). A coluna de ações usa o mesmo tom por cima de um fundo cheio. */
.table tbody tr {
  --row-tint: transparent;
  background: var(--row-tint);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}

.table tbody tr:nth-child(even) {
  --row-tint: rgba(255, 255, 255, 0.012);
}

.table tbody tr:hover,
.table tbody tr:focus-visible {
  --row-tint: var(--fill-1);
}

.table tbody tr:hover td:first-child {
  box-shadow: inset 2px 0 0 var(--accent-line);
}

.table tbody tr:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: -2px;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

/* Tabela em que a linha não abre nada (as ações ficam nos botões) */
.table--static tbody tr {
  cursor: default;
}

/* Ações da linha: sempre à vista, mesmo quando a tabela rola para os lados */
.table th.actions,
.table td.actions {
  position: sticky;
  right: 0;
}

.table th.actions {
  z-index: 2;
}

.table td.actions {
  width: 1%;
  text-align: right;
  white-space: nowrap;
  background:
    linear-gradient(var(--row-tint), var(--row-tint)),
    var(--solid-row);
}

.table td.actions .btn + .btn {
  margin-left: 4px;
}

.table tr.is-skeleton,
.table tr.is-skeleton:hover {
  --row-tint: transparent;
  cursor: default;
}

.table tr.is-skeleton td {
  padding-top: 16px;
  padding-bottom: 16px;
}

/* Células compostas: ícone ou inicial + texto; texto em duas linhas (principal e apoio) */
.cell-person,
.cell-device {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-align: left;
}

.cell-stack {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.cell-stack > small {
  font-size: var(--fs-caption);
  color: var(--text-3);
}

.icon-tile {
  display: grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--text-2);
  background: var(--fill-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}

/* Observação: uma linha; o texto inteiro aparece ao passar o mouse */
.note-cell {
  display: block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   Paginação
   ========================================================================== */

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.pager .btn.small {
  min-width: 32px;
  padding: 0 10px;
  font-variant-numeric: tabular-nums;
}

.pager .btn.primary,
.pager .btn.primary:hover {
  color: #fff;
  background: var(--accent-soft);
  border-color: var(--accent-line);
  box-shadow: none;
}

.pager-gap {
  display: inline-grid;
  place-items: center;
  width: 24px;
  color: var(--text-4);
}

.pager-info {
  margin-left: 10px;
  font-size: var(--fs-caption);
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
}

/* ==========================================================================
   Listas, pares de dados e histórico
   ========================================================================== */

.list {
  display: grid;
  gap: 8px;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 9px 12px 9px 14px;
  font-size: 13.5px;
  background: var(--fill-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  transition:
    background var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}

.list-item > div:first-child {
  min-width: 0;
}

.list-item small {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-caption);
  color: var(--text-3);
  overflow-wrap: anywhere;
}

.list-item > .row {
  flex: none;
  flex-wrap: nowrap;
  gap: 6px;
}

.list-item[data-open] {
  cursor: pointer;
}

.list-item[data-open]:hover {
  background: var(--fill-2);
  border-color: var(--line-2);
  transform: translateY(-1px);
}

.list-item.is-skeleton {
  pointer-events: none;
}

/* Lista ordenada por quantidade, com uma barra fina mostrando o peso de cada item (--share de 0 a 1) */
.rank-item {
  position: relative;
  overflow: hidden;
}

.rank-item::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: calc(var(--share, 0) * 100%);
  height: 2px;
  background: linear-gradient(90deg, var(--warn), transparent);
  opacity: 0.7;
}

/* Pares "rótulo: valor" */
.kv {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  margin: 0;
  overflow: hidden;
  font-size: 13.5px;
  background: var(--fill-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.kv dt,
.kv dd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  margin: 0;
  padding: 7px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.kv dt {
  color: var(--text-3);
}

.kv dd {
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.kv > :nth-last-child(-n + 2) {
  border-bottom: 0;
}

.kv-strong {
  font-size: 18px;
  font-weight: 750;
}

/* Histórico (aparelho e plano) */
.log {
  display: grid;
  font-size: var(--fs-caption);
  color: var(--text-2);
}

.log-item {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 2px;
  border-bottom: 1px dashed var(--line-soft);
}

.log-item:last-child {
  border-bottom: 0;
}

.log-item time {
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  white-space: nowrap;
}

/* ==========================================================================
   Gaveta lateral (detalhe do aparelho, cliente e revendedor)
   Cabeçalho e rodapé fixos; o miolo rola.
   ========================================================================== */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-backdrop);
  background: rgba(2, 3, 5, 0.68);
  backdrop-filter: blur(4px);
  animation: fade-in var(--t-base) var(--ease);
}

.drawer-backdrop.is-closing {
  opacity: 0;
  transition: opacity 160ms ease-in;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-drawer);
  display: flex;
  flex-direction: column;
  width: min(var(--drawer-w), 100%);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--solid);
  border-left: 1px solid var(--line-2);
  box-shadow: -30px 0 80px rgba(0, 0, 0, 0.6);
  outline: none;
  animation: drawer-in var(--t-slow) var(--ease);
}

.drawer.is-closing {
  animation: drawer-out 160ms ease-in forwards;
}

@keyframes drawer-in {
  from {
    opacity: 0.4;
    transform: translateX(28px);
  }
}

@keyframes drawer-out {
  to {
    opacity: 0;
    transform: translateX(28px);
  }
}

.drawer-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px 16px 22px;
  background: var(--solid); /* fundo cheio: o que rola por baixo não aparece como mancha */
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 18px -14px rgba(0, 0, 0, 0.9);
}

.drawer-kicker {
  display: block;
  margin-bottom: 4px;
  font-size: var(--fs-micro);
  font-weight: var(--fw-semi);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-3);
}

.drawer-head .code {
  font-size: 22px;
  line-height: 1.2;
}

.drawer-name {
  font-size: 20px;
  font-weight: var(--fw-bold);
  line-height: 1.2;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.drawer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.drawer-body {
  display: grid;
  flex: 1 0 auto;
  align-content: start;
  gap: 16px;
  padding: 20px 22px 28px;
}

.drawer-body form,
.drawer-body .card {
  scroll-margin-top: 96px;
}

.drawer-foot {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  background: var(--solid);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 18px -14px rgba(0, 0, 0, 0.9);
}

.drawer-foot .btn.ghost.danger {
  margin-left: auto;
}

/* ==========================================================================
   Diálogo de confirmação
   ========================================================================== */

.dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  color: var(--text);
  background: #0d1016;
  border: 1px solid var(--line-2);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-3);
}

.dialog[open] {
  animation: dialog-in var(--t-base) var(--ease);
}

.dialog::backdrop {
  background: rgba(2, 3, 5, 0.72);
  backdrop-filter: blur(4px);
  animation: fade-in var(--t-base) var(--ease);
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

.dialog-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  padding: 22px 22px 6px;
}

.dialog-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--info);
  background: var(--info-soft);
  border-radius: 12px;
}

.dialog--danger .dialog-icon {
  color: var(--danger);
  background: var(--danger-soft);
}

.dialog-copy h2 {
  margin: 2px 0 6px;
  font-size: 16px;
}

.dialog-copy p {
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--text-2);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 18px 22px 20px;
}

/* ==========================================================================
   Avisos (toasts)
   ========================================================================== */

.toasts {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: var(--z-toast);
  display: grid;
  gap: 8px;
  width: max-content;
  max-width: min(460px, calc(100vw - 24px));
  pointer-events: none;
  transform: translateX(-50%);
}

/* Com o painel aberto, os avisos ficam no canto de baixo, ao lado do menu (não cobrem a gaveta) */
.shell:not([hidden]) ~ .toasts {
  left: calc(var(--sidebar-w) + 24px);
  transform: none;
}

.toast {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 11px 8px 11px 14px;
  font-size: 13.5px;
  line-height: 1.4;
  background: rgba(21, 25, 33, 0.94);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  pointer-events: auto;
  backdrop-filter: blur(16px);
  animation: rise-in var(--t-base) var(--ease);
}

.toast > .icon {
  margin-top: 1px;
  color: var(--info);
}

.toast--success > .icon {
  color: var(--ok);
}

.toast--error {
  border-color: var(--danger-line);
}

.toast--error > .icon {
  color: var(--danger);
}

.toast-text {
  padding-top: 1px;
  white-space: pre-line;
}

.toast-close {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin: -2px 0;
  padding: 0;
  color: var(--text-3);
  background: transparent;
  border: 0;
  border-radius: var(--r-xs);
}

.toast-close:hover {
  color: var(--text);
  background: var(--fill-2);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 160ms ease-in,
    transform 160ms ease-in;
}

/* ==========================================================================
   Dica ao passar o mouse (botões só de ícone e controles com data-tip)
   ========================================================================== */

.tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-tooltip);
  max-width: 260px;
  padding: 6px 9px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text);
  background: var(--solid-3);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  animation: fade-in var(--t-fast) var(--ease);
}

/* ==========================================================================
   Estado vazio: ícone + título + explicação + ação
   ========================================================================== */

.empty {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 44px 24px 48px;
  color: var(--text-3);
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 10px;
  color: var(--text-2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025));
  border: 1px solid var(--line-2);
  border-radius: 18px;
  box-shadow:
    0 0 0 6px rgba(255, 255, 255, 0.02),
    0 12px 28px -12px rgba(0, 0, 0, 0.8);
}

.empty b {
  font-size: 15px;
  font-weight: var(--fw-semi);
  color: var(--text);
}

.empty p {
  max-width: 440px;
  font-size: 13.5px;
  line-height: 1.5;
}

.empty .btn {
  margin-top: 14px;
}

.empty--compact {
  padding: 20px 16px 22px;
}

.empty--compact .empty-icon {
  width: 38px;
  height: 38px;
  margin-bottom: 6px;
  border-radius: 12px;
  box-shadow: none;
}

.empty--compact p {
  font-size: var(--fs-small);
}

/* ==========================================================================
   Esqueleto de carregamento
   ========================================================================== */

.sk {
  display: block;
  width: 100%;
  height: 12px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.12) 37%, rgba(255, 255, 255, 0.05) 63%);
  background-size: 400% 100%;
  border-radius: 6px;
  /* Só aparece se a resposta demorar um pouco: cargas rápidas não piscam. */
  animation:
    sk-shimmer 1.4s ease infinite,
    fade-in 0.2s 0.12s both;
}

@keyframes sk-shimmer {
  from {
    background-position: 100% 50%;
  }
  to {
    background-position: 0 50%;
  }
}

.sk--thin {
  height: 8px;
}

.sk--w40 {
  width: 40%;
}

.sk--w50 {
  width: 50%;
}

.sk--w60 {
  width: 60%;
}

.sk--w70 {
  width: 70%;
}

.sk--w80 {
  width: 80%;
}

.sk--pill {
  flex: none;
  width: 68px;
  height: 22px;
  border-radius: var(--r-pill);
}

.sk--chip {
  grid-area: icon;
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.sk--value {
  grid-area: value;
  align-self: center;
  width: 52px;
  height: 26px;
}

.sk--title {
  width: 180px;
  height: 22px;
}

.sk--banner {
  height: 76px;
  margin-bottom: 12px;
  border-radius: var(--r-md);
}

.sk--input {
  height: var(--control-h);
  border-radius: var(--r-md);
}

.sk-stack {
  display: grid;
  flex: 1;
  gap: 9px;
  min-width: 0;
}

.sk-field {
  display: grid;
  gap: 8px;
}

/* ==========================================================================
   Barra superior: filtro do admin, mensalidade e usuário
   ========================================================================== */

/* "Ocultar revendedores": o admin deixa de ver o que é dos revendedores (vale só neste navegador) */
.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: var(--control-h);
  padding: 0 14px 0 11px;
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  color: var(--text-2);
  white-space: nowrap;
  background: var(--fill-1);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  cursor: pointer;
  user-select: none;
  transition:
    background var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease);
}

.filter-toggle:hover {
  border-color: var(--line-2);
}

.filter-toggle.on {
  color: #fff;
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.plan-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: var(--control-h-sm);
  padding: 0 12px;
  font-size: var(--fs-caption);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-decoration: none;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  border-radius: var(--r-pill);
}

.plan-short {
  display: none;
}

.plan-pill {
  white-space: nowrap;
}

.plan-pill .icon {
  color: var(--accent-text);
}

.plan-pill.low {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: var(--warn-line);
}

.plan-pill.low .icon {
  color: var(--warn);
}

/* Mensalidade pela proximidade do vencimento (js/core.js, planTone): verde, amarelo, vermelho e vermelho piscando no dia. */
.plan-pill.tone-ok,
:where([data-theme='light']) .plan-pill.tone-ok {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: var(--ok-line);
}
.plan-pill.tone-warn,
:where([data-theme='light']) .plan-pill.tone-warn {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: var(--warn-line);
}
.plan-pill.tone-danger,
:where([data-theme='light']) .plan-pill.tone-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-line);
}
.plan-pill.tone-ok .icon { color: var(--ok); }
.plan-pill.tone-warn .icon { color: var(--warn); }
.plan-pill.tone-danger .icon { color: var(--danger); }
.plan-pill.tone-pulse {
  animation: plan-pulse 1.2s ease-in-out infinite;
}
@keyframes plan-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--danger-line); }
  50% { box-shadow: 0 0 0 6px transparent; background: color-mix(in srgb, var(--danger) 22%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .plan-pill.tone-pulse { animation: none; }
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  height: var(--control-h);
  padding: 0 14px 0 4px;
  background: var(--fill-1);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
}

.user-chip i {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  font-size: 12.5px;
  font-style: normal;
  font-weight: 700;
  color: var(--accent-text);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
  border-radius: 50%;
}

.user-chip-text {
  display: grid;
  line-height: 1.15;
}

.user-chip-text b {
  max-width: 180px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip-text small {
  font-size: 11px;
  color: var(--text-3);
}

/* ==========================================================================
   Acréscimos do redesenho
   Cores de apoio · selos pequenos · filtros · menu de ações · janela (assistente e prazo) ·
   escolhas · linhas de escolher · cartão do aparelho · caixa de entrada.
   ========================================================================== */

/* Os avisos e a dica ficam na camada de cima do navegador (atributo popover), para aparecerem por cima de uma janela.
   Estas regras desfazem o estilo padrão que o navegador dá a um popover. */
.toasts[popover],
.tooltip[popover] {
  inset: auto;
  margin: 0;
  overflow: visible;
  color: inherit;
}

.toasts[popover] {
  bottom: 24px;
  left: 50%;
  padding: 0;
  background: none;
  border: 0;
}

.tooltip[popover] {
  top: 0;
  left: 0;
  color: var(--text);
}

.tone-alert {
  --tone: var(--alert);
  --tone-soft: var(--alert-soft);
}

/* Texto na cor de um estado (vencendo, vencido, ok...) */
.tone-text-ok {
  color: var(--ok);
}

.tone-text-warn {
  color: var(--warn);
}

.tone-text-alert {
  color: var(--alert);
}

.tone-text-danger {
  color: var(--danger);
}

/* Selo pequeno dentro de uma linha ("Antiga", "Atual", "2 pedidos") */
.badge--mini {
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  font-size: 11px;
}

.badge--mini .icon {
  width: 12px;
  height: 12px;
}

.badge--mini.pending::before {
  display: none;
}

.badge.warn {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: var(--warn-line);
}

.badge.ok {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: var(--ok-line);
}

/* Selo "Teste" (cliente ou aparelho de teste) */
.badge.info {
  color: var(--info);
  background: var(--info-soft);
  border-color: var(--info-line);
}

/* Tecla de atalho */
kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  font: 600 11px/1 var(--font-sans);
  color: var(--text-2);
  background: var(--fill-2);
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 6px;
}

.callout--warn {
  background: var(--warn-soft);
  border-color: var(--warn-line);
}

.callout--warn > .icon {
  color: var(--warn);
}

.callout--info {
  background: var(--info-soft);
  border-color: var(--info-line);
}

/* Botão com cara de link (ação secundária dentro de um formulário) */
.link-btn {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 6px;
  padding: 4px 2px;
  font-size: var(--fs-small);
  color: var(--accent-text);
  background: none;
  border: 0;
  border-radius: var(--r-xs);
}

.link-btn:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Campo com um botão de texto à direita ("Gerar") */
.control--text-action > input {
  padding-right: 68px;
}

/* Sem ícone à esquerda (senha do cliente, link M3U): o texto começa na margem normal, não corta no celular. */
.control--text-action > input:first-child {
  padding-left: 12px;
}

.control-btn--text {
  width: auto;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-text);
}

.card-head--tight {
  margin-bottom: 0;
}

/* ---------- Filtros ---------- */

/* Busca e filtros na mesma linha (04/11/2026): os seletores ocupam o espaço ao lado da busca e só descem para a
   linha de baixo quando não cabem. A .filter-row "some" (display: contents) para cada seletor quebrar sozinho.
   No celular (responsive.css) volta a ser grade: busca em cima, filtros embaixo. */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
}

.filters .search {
  flex: 1 1 320px;
  min-width: 0;
  max-width: 560px;
}

.filters .filter-row {
  display: contents;
}

/* Aba "Ativados via código" (12/11/2026): dos filtros, só a versão do app vale. */
.filter-row--via > :not([data-f="version"]) {
  display: none !important;
}

/* Botão "Filtros": só no celular (responsive.css), onde os filtros ficam recolhidos */
.filters-toggle {
  display: none;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.filter-row select {
  width: auto;
  max-width: 220px;
  height: var(--control-h-sm);
  padding-left: 10px;
  font-size: var(--fs-small);
  color: var(--text-2);
  background-color: var(--fill-1);
  border-color: var(--line);
  border-radius: var(--r-sm);
  box-shadow: none;
}

/* Filtro ligado: destaca para ficar claro o que está valendo */
.filter-row select.is-on {
  font-weight: 600;
  color: #fff;
  background-color: var(--accent-soft);
  border-color: var(--accent-line);
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: var(--control-h-sm);
  padding: 0 11px;
  font-size: var(--fs-small);
  color: var(--text-2);
  white-space: nowrap;
  background: var(--fill-1);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition:
    background var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease);
}

.toggle-chip:hover {
  border-color: var(--line-3);
}

.toggle-chip:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.toggle-chip.is-on {
  font-weight: 600;
  color: #fff;
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.toggle-count {
  min-width: 18px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--text-2);
  background: var(--fill-3);
  border-radius: var(--r-pill);
}

.dot {
  width: 7px;
  height: 7px;
  background: var(--text-3);
  border-radius: 50%;
}

.dot--ok {
  background: var(--ok);
}

/* Total encontrado + filtros ligados + limpar */
.result-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-height: var(--control-h-sm);
  font-size: var(--fs-small);
}

.result-bar > b {
  font-variant-numeric: tabular-nums;
}

/* Filtro de revenda em Dispositivos e Clientes (08/11/2026): nome da revenda + "Só desta revenda / Com as sub-revendas" */
.owner-bar {
  padding: 6px 8px 6px 12px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.owner-bar-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--text-2);
}

.owner-bar-name b {
  color: var(--text);
}

.owner-bar [data-owner-clear] {
  margin-left: auto;
}

@media (max-width: 560px) {
  .owner-bar .segmented {
    display: flex;
    width: 100%;
  }

  .owner-bar .segmented > .btn {
    flex: 1;
    justify-content: center;
  }

  .owner-bar [data-owner-clear] {
    margin-left: 0;
  }
}

/* Total da lista no canto direito da linha da busca e dos filtros (Clientes). */
.filters-total {
  margin-left: auto;
  align-self: center;
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right; /* no celular fica numa linha própria: à direita */
  padding-right: var(--s-3); /* afastado da margem (pedido do dono, 04/11/2026) */
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 6px 0 10px;
  font-size: 12px;
  font-weight: 550;
  color: var(--text);
  background: var(--fill-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
}

.chip .icon {
  color: var(--text-3);
}

.chip:hover {
  border-color: var(--danger-line);
}

.chip:hover .icon {
  color: var(--danger);
}

/* Cabeçalho de coluna que ordena */
.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: -4px -6px;
  padding: 4px 6px;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-radius: var(--r-xs);
}

.th-sort .icon {
  width: 13px;
  height: 13px;
  opacity: 0.5;
}

.th-sort:hover,
.th-sort.on {
  color: var(--text);
}

.th-sort.on .icon {
  color: var(--accent-text);
  opacity: 1;
}

.cell-clip {
  display: block;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pager-per select {
  width: auto;
  height: var(--control-h-sm);
  font-size: var(--fs-caption);
  border-radius: var(--r-sm);
}

/* ---------- Menu de ações ---------- */

.menu {
  position: fixed;
  z-index: 90;
  display: grid;
  min-width: 208px;
  padding: 5px;
  background: #11141b;
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  animation: fade-in var(--t-fast) var(--ease);
}

.menu hr {
  width: 100%;
  height: 1px;
  margin: 4px 0;
  background: var(--line);
  border: 0;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 10px;
  font-size: 13.5px;
  color: var(--text);
  text-align: left;
  white-space: nowrap;
  background: none;
  border: 0;
  border-radius: var(--r-sm);
}

.menu-item .icon {
  color: var(--text-3);
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--fill-2);
  outline: none;
}

.menu-item.danger,
.menu-item.danger .icon {
  color: var(--danger);
}

.menu-item.danger:hover,
.menu-item.danger:focus-visible {
  background: var(--danger-soft);
}

/* ---------- Janela (assistente "Ativar dispositivo" e prazo) ---------- */

.modal {
  width: min(760px, calc(100vw - 32px));
  max-height: min(900px, calc(100dvh - 32px));
  padding: 0;
  overflow: hidden;
  color: var(--text);
  background: var(--solid);
  border: 1px solid var(--line-2);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-3);
}

.modal[open] {
  display: flex;
  animation: dialog-in var(--t-base) var(--ease);
}

.modal::backdrop {
  background: rgba(2, 3, 5, 0.72);
  backdrop-filter: blur(4px);
  animation: fade-in var(--t-base) var(--ease);
}

.modal--small {
  width: min(560px, calc(100vw - 32px));
}

.modal-card {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px 14px 22px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  font-size: 18px;
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
}

.modal-head p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin-top: 4px;
}

.modal-body {
  flex: 1;
  min-height: 0;
  padding: 18px 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 22px;
  background: var(--solid);
  border-top: 1px solid var(--line);
}

/* ---------- Escolhas (cartões de marcar: prazo e lista) ---------- */

.choices {
  display: grid;
  gap: 8px;
}

.choices--plans {
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
}

.choice {
  position: relative;
  display: block;
  cursor: pointer;
}

.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-body {
  display: grid;
  align-content: center;
  gap: 2px;
  height: 100%;
  min-height: 52px;
  padding: 9px 12px;
  font-size: 13.5px;
  font-weight: var(--fw-regular);
  color: var(--text);
  background: var(--fill-1);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  transition:
    background var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease);
}

.choice-body small {
  font-size: 12px;
  color: var(--text-3);
}

.choice:hover .choice-body {
  border-color: var(--line-3);
}

.choice input:checked + .choice-body {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

.choice input:focus-visible + .choice-body {
  box-shadow: var(--ring);
}

.choice.is-disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

/* Escolha em linha, com a bolinha à esquerda */
.choice--row .choice-body {
  min-height: 0;
  padding-left: 38px;
}

.choice--row .choice-body::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 13px;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--line-3);
  border-radius: 50%;
  transform: translateY(-50%);
}

.choice--row input:checked + .choice-body::before {
  background: #fff;
  border: 4.5px solid var(--accent);
}

/* ---------- Linha de escolher (cliente e aparelho no assistente) ---------- */

.pick-row,
.pick-card {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 50px;
  padding: 8px 12px;
  font-size: 13.5px;
  color: var(--text);
  text-align: left;
  background: var(--fill-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.pick-row {
  transition:
    background var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease);
}

.pick-row:hover,
.pick-row:focus-visible {
  background: var(--fill-2);
  border-color: var(--line-3);
  outline: none;
}

.pick-row:focus-visible {
  box-shadow: var(--ring);
}

.pick-row > .icon:last-child {
  color: var(--text-3);
}

.pick-row.is-on,
.pick-card {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.pick-row.is-on > .icon:last-child {
  color: var(--accent-text);
}

.pick-row--new {
  background: transparent;
  border-style: dashed;
}

/* Duas escolhas do mesmo tamanho, lado a lado ("Cadastrar cliente novo" e "Associar a cliente"); empilham no celular */
.pick-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.pick-card-text {
  display: grid;
  flex: 1;
  gap: 1px;
  min-width: 0;
}

.pick-card-text b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pick-card-text small {
  font-size: 12px;
  color: var(--text-3);
  overflow-wrap: anywhere;
}

.avatar--add {
  color: var(--accent-text);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

/* ---------- Cartão do aparelho conferido ---------- */

.dev-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--fill-1);
  border: 1px solid var(--ok-line);
  border-radius: var(--r-lg);
}

.dev-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dev-card-head > div {
  display: grid;
  flex: 1;
  min-width: 0;
}

.dev-card-head .code {
  font-size: 17px;
}

.dev-card-head small {
  font-size: var(--fs-caption);
  color: var(--text-3);
}

.dev-card-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.icon-tile--lg {
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
}

/* Fatos lado a lado (plataforma, versão, origem...) */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 10px 14px;
  margin: 0;
}

.facts dt {
  font-size: var(--fs-micro);
  font-weight: var(--fw-semi);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
}

.facts dd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 2px 0 0;
  font-size: 13.5px;
}

/* ---------- Linha de aparelho (caixa de entrada e gaveta do cliente) ---------- */

.dev-line {
  justify-content: flex-start;
}

.dev-line[data-open-device] {
  cursor: pointer;
}

.dev-line[data-open-device]:hover {
  background: var(--fill-2);
  border-color: var(--line-2);
}

.dev-line-text {
  flex: 1;
  min-width: 0;
}

.dev-line-text b {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.dev-line-who {
  font-weight: 550;
  color: var(--text-2);
}

.dev-line-actions {
  flex: none;
  flex-wrap: nowrap;
  gap: 6px;
}

/* Botões principais no topo da gaveta */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Caixa de entrada ---------- */

.inbox {
  display: grid;
  /* Cada bloco ocupa a largura toda (sem buraco ao lado); os itens é que se dividem em colunas. */
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: var(--s-4);
}

.inbox-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--tone, transparent) 7%, transparent), transparent 64px),
    var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-2);
}

/* Largura mínima folgada: o código, o texto e o botão cabem sem o texto quebrar em três linhas. */
.inbox-card > .list {
  grid-template-columns: repeat(auto-fill, minmax(min(400px, 100%), 1fr));
}

.inbox-card--line {
  grid-column: 1 / -1;
}

.inbox-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.inbox-head > div {
  flex: 1;
  min-width: 0;
}

.inbox-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inbox-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--tone);
  background: var(--tone-soft);
  border-radius: 10px;
}

.inbox-count {
  min-width: 22px;
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--tone);
  background: var(--tone-soft);
  border-radius: var(--r-pill);
}

/* Ícone grande de estado (fim do assistente) */
.state-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 48px;
  height: 48px;
  color: var(--text-2);
  background: var(--fill-2);
  border-radius: 14px;
}

.state-icon--ok {
  color: var(--ok);
  background: var(--ok-soft);
}

/* Contador de caracteres de um campo de texto */
.char-count {
  justify-self: end;
  margin-top: -2px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-4);
}

/* Número no item do menu lateral (pedidos + aguardando) */
.nav-count {
  min-width: 20px;
  margin-left: auto;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--warn);
  background: var(--warn-soft);
  border-radius: var(--r-pill);
}

/* Lembrete dos atalhos no pé do menu lateral */
.side-keys {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 6px;
  margin-top: auto;
  padding: 16px 10px 2px;
  font-size: 11.5px;
  color: var(--text-3);
}

.side-keys kbd {
  margin-left: 4px;
}

.side-keys kbd:first-child {
  margin-left: 0;
}

/* ---------- Vencimentos da semana (Painel de Controle) e pedido de teste (Caixa de entrada) ---------- */

.expiry {
  display: grid;
  gap: 12px;
}

.expiry-row {
  justify-content: flex-start;
}

.expiry-text {
  flex: 1;
  min-width: 0;
}

.expiry-text b {
  overflow-wrap: anywhere;
}

.expiry-when {
  flex: none;
}

.expiry-wa {
  flex: none;
}

.expiry-more {
  justify-self: start;
}

.trial-line {
  flex-wrap: wrap;
}

.trial-line .dev-line-text {
  flex: 1 1 240px;
}

.trial-line .dev-line-actions {
  flex: 0 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#resellers td[data-label='Situação'] .badge {
  max-width: 100%;
  text-align: left;
  white-space: normal;
}

.trial-line small {
  overflow-wrap: anywhere;
}

/* Mensagem do pedido de parceria (veio do site): inteira, com as quebras de linha que a pessoa digitou. */
.partner-line .partner-msg {
  display: block;
  margin-top: 4px;
  white-space: pre-line;
  color: var(--text);
}

.trial-request .row {
  flex-wrap: wrap;
  gap: 8px;
}

/* Entrada: separador e campo isca do pedido de teste */
.login-sep {
  height: 0;
  margin: 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.login-card a.btn {
  justify-content: center;
  width: 100%;
  height: 42px;
}

.hp-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ==========================================================================
   Tema claro (29/10/2026)
   Só o que aqui foi escrito para o fundo escuro: brilhos brancos, sombras pesadas, fundos escuros fixos
   e texto branco sobre o tom suave da marca. :where() deixa a regra com o mesmo peso da original.
   ========================================================================== */

:where([data-theme='light']) .btn.primary {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.2) inset,
    0 1px 2px rgba(15, 17, 21, 0.12),
    0 8px 20px -12px color-mix(in srgb, var(--accent) 70%, transparent);
}

:where([data-theme='light']) .btn.primary:hover {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.24) inset,
    0 2px 4px rgba(15, 17, 21, 0.12),
    0 12px 26px -12px var(--accent);
}

/* Girador do "carregando": branco só na ação principal e no vermelho cheio */
:where([data-theme='light']) .btn.is-loading::after {
  border-color: rgba(15, 17, 21, 0.18);
  border-top-color: var(--text-2);
}

:where([data-theme='light']) .btn.primary.is-loading::after,
:where([data-theme='light']) .btn.danger.solid.is-loading::after {
  border-color: rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
}

:where([data-theme='light']) .avatar {
  background: var(--fill-3);
}

:where([data-theme='light']) .table tbody tr:nth-child(even) {
  --row-tint: rgba(15, 17, 21, 0.018);
}

:where([data-theme='light']) .stat-icon.is-live::after {
  border-color: var(--glass);
}

:where([data-theme='light']) .badge.online i {
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 50%, transparent);
}

/* Fundo atrás da gaveta, do diálogo e da janela: véu cinza leve no lugar do preto */
:where([data-theme='light']) .drawer-backdrop {
  background: rgba(15, 17, 21, 0.28);
}

:where([data-theme='light']) .dialog::backdrop,
:where([data-theme='light']) .modal::backdrop {
  background: rgba(15, 17, 21, 0.32);
}

:where([data-theme='light']) .drawer {
  box-shadow: -24px 0 60px rgba(15, 17, 21, 0.14);
}

:where([data-theme='light']) .drawer-head {
  box-shadow: 0 10px 18px -16px rgba(15, 17, 21, 0.18);
}

:where([data-theme='light']) .drawer-foot {
  box-shadow: 0 -10px 18px -16px rgba(15, 17, 21, 0.18);
}

:where([data-theme='light']) .dialog,
:where([data-theme='light']) .menu {
  background: var(--solid);
}

:where([data-theme='light']) .toast {
  background: rgba(255, 255, 255, 0.97);
}

:where([data-theme='light']) .tooltip {
  box-shadow: 0 6px 20px rgba(15, 17, 21, 0.14);
}

:where([data-theme='light']) .empty-icon {
  background: var(--fill-2);
  box-shadow:
    0 0 0 6px var(--fill-1),
    0 10px 24px -14px rgba(15, 17, 21, 0.25);
}

:where([data-theme='light']) .sk {
  background: linear-gradient(90deg, rgba(15, 17, 21, 0.05) 25%, rgba(15, 17, 21, 0.1) 37%, rgba(15, 17, 21, 0.05) 63%);
  background-size: 400% 100%;
}

/* Ligado = tom suave da marca: o texto vai na cor da marca escurecida, não em branco */
:where([data-theme='light']) .pager .btn.primary,
:where([data-theme='light']) .pager .btn.primary:hover,
:where([data-theme='light']) .filter-toggle.on,
:where([data-theme='light']) .plan-pill,
:where([data-theme='light']) .filter-row select.is-on,
:where([data-theme='light']) .toggle-chip.is-on {
  color: var(--accent-text);
}

/* ---------- Termos de uso (02/11/2026, js/terms.js) ---------- */
.terms-modal {
  width: min(640px, calc(100vw - 32px));
}

.terms-card {
  overflow-y: auto;
}

.terms-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--fill-1);
}

.terms-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.terms-head small {
  color: var(--text-3);
  font-size: 12.5px;
}

.terms-head h2 {
  margin: 2px 0 0;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.terms-body {
  display: grid;
  gap: var(--s-4);
  padding: 20px 24px;
}

.terms-lead {
  margin: 0;
  color: var(--text-2);
  line-height: 1.55;
}

.terms-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3);
}

.terms-col {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.terms-col h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.terms-col--ok h3 {
  color: var(--ok);
}

.terms-col--no h3 {
  color: var(--danger);
}

.terms-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13.5px;
  line-height: 1.45;
}

.terms-list li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.terms-list .icon {
  flex: none;
  margin-top: 2px;
}

.terms-col--ok .icon {
  color: var(--ok);
}

.terms-col--no .icon {
  color: var(--danger);
}

.terms-note {
  display: flex;
  gap: 8px;
  margin: 0;
  color: var(--text-3);
  font-size: 13px;
  line-height: 1.5;
}

.terms-note .icon {
  flex: none;
  margin-top: 2px;
}

.terms-check {
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--fill-2);
}

.terms-check a {
  color: var(--text);
}

.terms-actions {
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 14px 24px 20px;
}

@media (max-width: 560px) {
  .terms-cols {
    grid-template-columns: minmax(0, 1fr);
  }
  .terms-head,
  .terms-body,
  .terms-actions {
    padding-left: 18px;
    padding-right: 18px;
  }
}

/* Verificação por aplicativo (Configurações > Minha conta, 12/11/2026): QR code sempre em fundo branco (o leitor precisa). */
.totp-qr { display: block; width: 200px; height: 200px; padding: 10px; background: #fff; border-radius: 12px; image-rendering: pixelated; }
.totp-secret { word-break: break-all; font-size: .95em; }
.totp-steps { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; }

/* Aviso em janela ao entrar no painel (16/11/2026): texto com as quebras de linha do aviso, rolando se for longo. */
.notice-popup .notice-popup-body { margin: 0; white-space: pre-line; line-height: 1.55; }
@media (min-width: 601px) { .notice-popup .notice-popup-body { max-height: min(60vh, 520px); overflow-y: auto; } }
