/*
 * Base visual herdada do painel MestreHub (public/admin/index.html, commit efbeac3, 2026-10-17).
 * Copiado sem alterações das regras genéricas (tokens, layout, cards, tabelas, pills, toasts,
 * drawer, estados vazios/erro/carregamento, responsivo). Seções exclusivas de vendas
 * (Mensagens do Robô, frases de ativação) foram omitidas. Ajustes do Launcher TV ficam em styles.css.
 */
:root {
  color-scheme: dark;
  --bg-main: #08090f;
  --bg-sidebar: #0b0c14;
  --bg-header: rgba(11, 12, 20, 0.72);
  --bg-card: #12131e;
  --bg-card-hover: #171927;
  --bg-inset: #0a0b12;

  --red-primary: #e6304a;
  --red-bright: #ff4d68;
  --red-glow: rgba(230, 48, 74, 0.35);

  --purple-primary: #7c3aed;
  --purple-soft: #9f6bfa;
  --purple-glow: rgba(124, 58, 237, 0.3);

  --text-primary: #f4f5f9;
  --text-secondary: #a1a6ba;
  --text-muted: #676c85;

  --border: rgba(255, 255, 255, 0.08);
  --border-soft: rgba(255, 255, 255, 0.05);

  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.14);
  --warning: #f5b942;
  --warning-bg: rgba(245, 185, 66, 0.14);
  --danger: #f04455;
  --danger-bg: rgba(240, 68, 85, 0.14);
  --info: #9f6bfa;
  --info-bg: rgba(159, 107, 250, 0.14);
  --neutral-bg: rgba(255, 255, 255, 0.06);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --sidebar-w: 248px;
  --header-h: 68px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(900px 480px at 85% -10%, var(--red-glow), transparent 60%),
    radial-gradient(700px 420px at -5% 10%, var(--purple-glow), transparent 55%),
    var(--bg-main);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--purple-soft); }
h1 { font-size: 1.3rem; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.02rem; margin: 0 0 14px; letter-spacing: -0.01em; }
.muted { color: var(--text-secondary); font-size: 0.85rem; }
.card, .data-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  max-width: 100%;
  overflow-x: auto;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 12px 24px -18px rgba(0, 0, 0, 0.6);
}
label { display: block; font-size: 0.78rem; color: var(--text-secondary); margin: 10px 0 4px; font-weight: 500; }
input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-inset);
  color: var(--text-primary);
  font-size: 0.88rem;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--purple-primary);
  box-shadow: 0 0 0 3px var(--purple-glow);
}
:focus-visible { outline: 2px solid var(--purple-soft); outline-offset: 2px; }
button {
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--red-primary), var(--red-bright));
  color: #fff;
  margin-top: 10px;
  margin-right: 8px;
  transition: transform 120ms var(--ease), filter 120ms var(--ease), box-shadow 120ms var(--ease);
}
button:hover:not(:disabled) { filter: brightness(1.08); box-shadow: 0 6px 18px -8px var(--red-glow); }
button:active:not(:disabled) { transform: translateY(1px); }
button.secondary { background: var(--neutral-bg); color: var(--text-primary); border-color: var(--border); }
button.secondary:hover:not(:disabled) { background: var(--bg-card-hover); box-shadow: none; filter: none; }
button.small { padding: 6px 11px; font-size: 0.78rem; margin-top: 0; }
button.icon-btn { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); padding: 6px 9px; }
button.icon-btn:hover:not(:disabled) { background: var(--bg-card-hover); color: var(--text-primary); box-shadow: none; filter: none; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.msg { margin-top: 12px; padding: 9px 12px; border-radius: var(--radius-sm); font-size: 0.83rem; display: none; white-space: pre-wrap; }
.msg.ok { display: block; background: var(--success-bg); color: #6ee7b7; border: 1px solid rgba(34,197,94,0.25); }
.msg.err { display: block; background: var(--danger-bg); color: #fca5b1; border: 1px solid rgba(240,68,85,0.25); }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.03em; background: var(--neutral-bg); color: var(--text-secondary);
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.pill.db, .pill.ok, .pill.APROVADO, .pill.APPROVED, .pill.PAGO, .pill.ENTREGUE { background: var(--success-bg); color: #4ade80; }
.pill.env, .pill.PENDING, .pill.AGUARDANDO_PAGAMENTO, .pill.PROCESSANDO, .pill.AGUARDANDO_ENTREGA, .pill.ENTREGANDO, .pill.RESERVANDO, .pill.GERANDO, .pill.ENTREGA_PENDENTE, .pill.ENTREGA_ENVIANDO { background: var(--warning-bg); color: var(--warning); }
.pill.bad, .pill.REJECTED, .pill.CANCELLED, .pill.CANCELADO, .pill.ERRO, .pill.ERROR, .pill.EXPIRED, .pill.ERRO_ENTREGA, .pill.ENTREGA_FALHOU { background: var(--danger-bg); color: #ff8a97; }
.pill.ACTIVE { background: var(--success-bg); color: #4ade80; }
.pill.SUSPENDED, .pill.DISABLED { background: var(--danger-bg); color: #ff8a97; }
.pill.SUPER_ADMIN, .pill.TENANT_ADMIN { background: var(--info-bg); color: var(--purple-soft); }
.pill.TENANT_OPERATOR, .pill.TENANT_VIEWER { background: var(--neutral-bg); color: var(--text-secondary); }
.wizard-step { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.wizard-step:last-child { border-bottom: none; }
.wizard-dot { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 700; margin-top: 2px; }
.wizard-dot.done { background: var(--success-bg); color: #4ade80; }
.wizard-dot.todo { background: var(--neutral-bg); color: var(--text-muted); }
.wizard-title { font-weight: 600; font-size: 0.9rem; }
.wizard-desc { color: var(--text-secondary); font-size: 0.8rem; margin-top: 2px; }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.section-title { font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); margin: 22px 0 8px; letter-spacing: 0.06em; font-weight: 600; }
.section-title:first-child { margin-top: 0; }
code, .mono { font-family: ui-monospace, Consolas, monospace; font-size: 0.8rem; }
.pixbox { background: var(--bg-inset); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; word-break: break-all; font-family: monospace; font-size: 0.78rem; margin-top: 8px; }
table, .data-table table { width: 100%; min-width: 480px; border-collapse: collapse; font-size: 0.85rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
th { color: var(--text-muted); font-weight: 600; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; }
tbody tr { cursor: pointer; transition: background 120ms var(--ease); }
tbody tr:hover { background: var(--bg-card-hover); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > div { flex: 1; min-width: 160px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.stat { background: var(--bg-inset); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; }
.stat .num { font-size: 1.6rem; font-weight: 700; }
.stat .label { font-size: 0.76rem; color: var(--text-secondary); margin-top: 2px; }
.pagination { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.back-link { display: inline-block; margin-bottom: 14px; font-size: 0.85rem; cursor: pointer; color: var(--text-secondary); }
.back-link:hover { color: var(--text-primary); }

/* ---------- metric cards ---------- */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden;
  transition: border-color 150ms var(--ease), transform 150ms var(--ease);
}
.metric-card:hover { border-color: var(--border); transform: translateY(-1px); }
.metric-card .metric-icon {
  width: 34px; height: 34px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
  background: var(--neutral-bg); color: var(--text-secondary);
}
.metric-card.tone-success .metric-icon { background: var(--success-bg); color: var(--success); }
.metric-card.tone-info .metric-icon { background: var(--info-bg); color: var(--purple-soft); }
.metric-card.tone-warning .metric-icon { background: var(--warning-bg); color: var(--warning); }
.metric-card.tone-danger .metric-icon { background: var(--danger-bg); color: var(--danger); }
.metric-card .metric-label { font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.metric-card .metric-value { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.02em; }
.metric-card .metric-detail { font-size: 0.78rem; color: var(--text-muted); }

/* ---------- Central de Pagamentos: cards de gateway + wizard ---------- */
.pill.off { background: var(--neutral-bg); color: var(--text-muted); }
.pill.partial { background: rgba(251, 146, 60, 0.16); color: #fb923c; }
/* ---------- Renovações e Custos: URGENTE (7 dias ou menos) precisa de um tom entre ATENÇÃO(amarelo) e VENCIDO(vermelho) que o resto do painel não tinha ---------- */
.pill.URGENTE { background: rgba(251, 146, 60, 0.15); color: #fb923c; }
.payment-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 18px; }
.payment-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px; display: flex; flex-direction: column; gap: 10px;
}
.payment-card .payment-card-head { display: flex; align-items: center; gap: 10px; }
.payment-card .payment-card-icon { font-size: 1.5rem; line-height: 1; }
.payment-card .payment-card-title { font-weight: 700; font-size: 1rem; flex: 1; }
.payment-card .payment-card-desc { color: var(--text-secondary); font-size: 0.8rem; }
.payment-card .payment-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 6px; }
.wizard-field { margin-bottom: 14px; }
.wizard-field label { display: block; margin-bottom: 5px; font-size: 0.83rem; font-weight: 600; }
.wizard-field .field-help { font-size: 0.76rem; color: var(--text-muted); margin-top: 4px; }
/* Credencial de API (token/chave de gateway): mascarada só visualmente, sem type="password" — ver secretInputTypeAttrs. */
.api-secret-input { -webkit-text-security: disc; text-security: disc; }
.wizard-result { border-radius: var(--radius-sm); padding: 12px; font-size: 0.85rem; margin-top: 12px; }
.wizard-result.ok { background: var(--success-bg); color: #6ee7b7; border: 1px solid rgba(34,197,94,0.25); }
.wizard-result.err { background: var(--danger-bg); color: #fca5b1; border: 1px solid rgba(240,68,85,0.25); }
.wizard-result.pending { background: var(--neutral-bg); color: var(--text-secondary); }
.diag-checklist { display: flex; flex-direction: column; gap: 2px; }
.diag-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 4px; border-bottom: 1px solid var(--border-soft); font-size: 0.85rem; }
.diag-row:last-child { border-bottom: none; }

/* ---------- dashboard: status do sistema / precisa de atenção ---------- */
.status-list { display: flex; flex-direction: column; }
.status-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 4px; border-bottom: 1px solid var(--border-soft); cursor: pointer;
  transition: background 120ms var(--ease);
}
.status-row:last-child { border-bottom: none; }
.status-row:hover { background: var(--bg-card-hover); }
.attn-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 11px 4px; border-bottom: 1px solid var(--border-soft);
}
.attn-item:last-child { border-bottom: none; }
.attn-item > span:first-child { color: var(--warning); font-size: 0.86rem; }

/* ---------- toolbar / filters ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.search-field { position: relative; flex: 1; min-width: 220px; }
.search-field svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-field input { padding-left: 34px; margin: 0; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip {
  padding: 7px 14px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; cursor: pointer;
  background: var(--neutral-bg); color: var(--text-secondary); border: 1px solid var(--border);
  transition: all 120ms var(--ease); user-select: none;
}
.filter-chip:hover { color: var(--text-primary); border-color: rgba(255,255,255,0.16); }
.filter-chip.active { background: linear-gradient(135deg, var(--red-primary), var(--purple-primary)); color: #fff; border-color: transparent; }

/* ---------- empty / skeleton / error ---------- */
.empty { color: var(--text-muted); font-size: 0.85rem; padding: 14px 0; }
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 54px 20px; color: var(--text-secondary); }
.empty-state .empty-icon { width: 46px; height: 46px; border-radius: 50%; background: var(--neutral-bg); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; color: var(--text-muted); }
.empty-state .empty-title { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.empty-state .empty-desc { font-size: 0.82rem; color: var(--text-muted); max-width: 320px; }
.error-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 20px; }
.error-state .empty-icon { color: var(--danger); background: var(--danger-bg); }
.error-state .empty-title { color: var(--text-primary); }
.skeleton { background: linear-gradient(90deg, var(--bg-inset) 25%, var(--bg-card-hover) 50%, var(--bg-inset) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-sm); }
.skeleton-row { height: 44px; margin-bottom: 8px; }
.skeleton-card { height: 92px; border-radius: var(--radius-lg); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.spinner {
  display: inline-block; width: 13px; height: 13px; margin-right: 6px;
  border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: currentColor;
  border-radius: 50%; animation: spin 0.6s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- toast ---------- */
.toast-stack { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 12px 16px; font-size: 0.83rem; box-shadow: 0 12px 30px -12px rgba(0,0,0,0.6);
  animation: toast-in 180ms var(--ease);
}
.toast.ok { border-color: rgba(34,197,94,0.3); }
.toast.err { border-color: rgba(240,68,85,0.3); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- action menu ---------- */
.action-menu-wrap { position: relative; display: inline-block; }
.action-menu {
  position: absolute; right: 0; top: calc(100% + 4px); min-width: 180px; z-index: 50;
  background: var(--bg-card-hover); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: 0 16px 32px -14px rgba(0,0,0,0.7); padding: 6px; display: none;
}
.action-menu.open { display: block; }
.action-menu button { display: block; width: 100%; text-align: left; background: transparent; border: none; color: var(--text-primary); font-weight: 500; margin: 0; padding: 8px 10px; border-radius: var(--radius-sm); }
.action-menu button:hover:not(:disabled) { background: var(--neutral-bg); box-shadow: none; filter: none; }

/* ---------- drawer ---------- */
.drawer-overlay { position: fixed; inset: 0; background: rgba(4, 5, 10, 0.6); backdrop-filter: blur(2px); z-index: 100; opacity: 0; pointer-events: none; transition: opacity 180ms var(--ease); }
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
/* Confirmação de "Restaurar padrão" (bateria de textos 2026-10-03): mostra texto atual x padrão. */
.restore-confirm-overlay { position: fixed; inset: 0; background: rgba(4, 5, 10, 0.7); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.restore-confirm-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px; width: min(560px, 100%); max-height: 90vh; overflow: auto; }
.restore-confirm-box h3 { margin: 0 0 8px; font-size: 1rem; }
.restore-confirm-text { white-space: pre-wrap; word-break: break-word; background: var(--bg-inset); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 8px 10px; margin: 4px 0 12px; max-height: 30vh; overflow: auto; font-family: inherit; font-size: 0.9rem; }
.restore-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.menu-screen-preview { white-space: pre-wrap; word-break: break-word; background: var(--bg-inset); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 10px 12px; margin: 6px 0 0; font-family: inherit; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(440px, 100vw);
  background: var(--bg-sidebar); border-left: 1px solid var(--border);
  z-index: 101; transform: translateX(100%); transition: transform 220ms var(--ease);
  display: flex; flex-direction: column; box-shadow: -20px 0 50px -20px rgba(0,0,0,0.7);
}
.drawer.open { transform: translateX(0); }
.drawer-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer-header h2 { margin: 0; font-size: 1rem; }
.drawer-body { padding: 20px; overflow-y: auto; flex: 1; }
.drawer-section { margin-bottom: 24px; }
.drawer-section:last-child { margin-bottom: 0; }
.drawer-kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 0.85rem; }
.drawer-kv dt { color: var(--text-muted); }
.drawer-kv dd { margin: 0; word-break: break-word; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item .tl-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--purple-soft); margin-top: 5px; flex-shrink: 0; position: relative; z-index: 1; }
.timeline-item:not(:last-child)::before { content: ''; position: absolute; left: 4px; top: 14px; bottom: 0; width: 1px; background: var(--border); }
.timeline-item.pending .tl-dot { background: var(--text-muted); }
.tl-label { font-size: 0.83rem; font-weight: 600; }
.tl-time { font-size: 0.76rem; color: var(--text-muted); }

#login-view, #app-shell { display: none; }
.login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background:
    radial-gradient(700px 420px at 50% 0%, var(--red-glow), transparent 60%),
    radial-gradient(600px 380px at 90% 100%, var(--purple-glow), transparent 55%),
    var(--bg-main);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px 28px; box-shadow: 0 30px 60px -30px rgba(0,0,0,0.8);
}
.login-brand {
  font-weight: 800; font-size: 1.4rem; letter-spacing: 0.03em;
  background: linear-gradient(135deg, #fff, #cbd0e0 60%); -webkit-background-clip: text; background-clip: text; color: transparent;
}
/* Achado real de acessibilidade (Lighthouse, 2026-09-20): var(--text-muted)
   (#676c85) sobre o fundo do card de login (#12131e) dá ~3.6:1 de
   contraste, abaixo do mínimo WCAG AA (4.5:1) pra texto normal. Cor
   própria só pra este rótulo (não mexe em --text-muted global, usado em
   18 outros lugares com contextos/fundos diferentes) — mesma tonalidade,
   só um pouco mais clara (~4.9:1), sem mudar a hierarquia visual. */
.login-brand-sub { font-size: 0.78rem; color: #8a8fb0; margin-top: 2px; letter-spacing: 0.02em; }
.shell { display: flex; min-height: 100vh; }
nav.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
nav.sidebar .brand {
  padding: 20px 20px 6px;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #fff, #cbd0e0 60%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
nav.sidebar .brand-sub { padding: 0 20px 16px; font-size: 0.72rem; color: var(--text-muted); border-bottom: 1px solid var(--border); margin-bottom: 10px; letter-spacing: 0.02em; }
nav.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  margin: 1px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 500;
  border-left: 2px solid transparent;
  transition: background 120ms var(--ease), color 120ms var(--ease);
}
nav.sidebar .nav-group { padding: 14px 28px 4px; font-size: 0.66rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
nav.sidebar a .nav-icon { flex-shrink: 0; width: 17px; height: 17px; display: flex; color: inherit; opacity: 0.85; }
nav.sidebar a:hover { background: var(--bg-card-hover); color: var(--text-primary); }
nav.sidebar a.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(230,48,74,0.22), rgba(124,58,237,0.12));
  box-shadow: inset 2px 0 0 var(--red-bright);
}
main.content { flex: 1; padding: 0 28px 60px; max-width: 1100px; min-width: 0; }
.app-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 16px 4px; margin-bottom: 20px;
  background: var(--bg-header); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.app-header .header-titles h1 { margin-bottom: 2px; }
.app-header .header-subtitle { font-size: 0.82rem; color: var(--text-secondary); }
.app-header .header-right { display: flex; align-items: center; gap: 14px; }
.app-header .header-right button { margin: 0; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 0.83rem; color: var(--text-secondary); }
.user-chip strong { color: var(--text-primary); font-weight: 600; }
.topbar { display: none; }
.empty-state .empty-icon svg, .error-state .empty-icon svg { width: 22px; height: 22px; }

/* MestreHub App (mobile, redesenho 2026-09-21) — layout operacional
   simplificado (Master + nav por abas) agora vale tanto dentro do app
   nativo (Capacitor) quanto no navegador comum em tela estreita
   (`body.mobile-layout`, calculado por `isMobileLayout()` = app nativo OU
   largura <= 600px, recalculado em boot() e a cada resize). Desktop
   (>=1024px) e tablet continuam sem essa classe — nada muda pra eles. */
.bottom-nav { display: none; }
body.mobile-layout nav.sidebar { display: none; }
body.mobile-layout main.content { padding-bottom: 84px; }
body.mobile-layout .bottom-nav {
  display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 150;
  background: var(--bg-header); border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
}
.bottom-nav a, .bottom-nav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 2px; color: var(--text-muted); text-decoration: none; font-size: 0.68rem;
  background: none; border: none; margin: 0; font-weight: 500;
}
.bottom-nav a .nav-icon, .bottom-nav button .nav-icon { width: 20px; height: 20px; }
.bottom-nav a.active, .bottom-nav button.active { color: var(--text-primary); }
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  nav.sidebar {
    width: 100%; min-width: 0; height: auto; position: static; padding: 10px 0; display: flex; align-items: center; flex-wrap: nowrap;
    overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border);
  }
  nav.sidebar .brand, nav.sidebar .brand-sub, #sidebar-version, nav.sidebar .nav-group { display: none; }
  #sidebar-links { display: flex; flex-wrap: nowrap; flex-shrink: 0; }
  nav.sidebar a { padding: 8px 14px; white-space: nowrap; border-left: none; border-bottom: 2px solid transparent; margin: 0 2px; }
  nav.sidebar a.active { border-left-color: transparent; box-shadow: inset 0 -2px 0 var(--red-bright); }
  main.content { padding: 0 14px 40px; max-width: 100%; }
  .app-header { flex-wrap: wrap; padding: 12px 2px; }
  .row > div { min-width: 100%; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .drawer { width: 100vw; }
}

/* ---------- Mobile operacional (redesenho 2026-09-21) — celular <=600px
   vira "controle remoto operacional", não o dashboard desktop espremido.
   Reduz padding/gap/fonte/altura de botão e garante ZERO overflow
   horizontal (min-width:0 nos containers flex/grid + word-break nos
   textos técnicos). Só entra em vigor <=600px — tablet/desktop intactos. */
@media (max-width: 600px) {
  body { font-size: 15px; }
  h1 { font-size: 1.08rem; }
  h2 { font-size: 0.92rem; margin-bottom: 10px; }
  .card, .data-card { padding: 13px; margin-bottom: 12px; border-radius: var(--radius-md); }
  main.content { padding: 0 10px 30px; }
  .app-header { padding: 8px 0; margin-bottom: 10px; gap: 8px; }
  .app-header .header-titles h1 { font-size: 1.02rem; }
  .app-header .header-subtitle { font-size: 0.74rem; }
  /* Achado real (teste em 320px): "Logado como admin SUPER_ADMIN" +
     "Atualizar painel" + "Sair" no mesmo cabeçalho, sem quebra, estourava
     a tela (header-right com display:flex e gap fixo, sem wrap próprio) —
     o cabeçalho pedido é compacto (título + ação), não a barra de usuário
     completa do desktop. */
  .app-header .header-right { flex-wrap: wrap; gap: 6px 8px; justify-content: flex-end; }
  .app-header .user-chip { display: none; }
  .app-header .header-right button { padding: 6px 10px; font-size: 0.76rem; }
  .stat-grid, .metrics-grid, .payment-grid { gap: 8px; }
  .stat { padding: 10px; }
  .stat .num { font-size: 1.15rem; }
  .stat .label { font-size: 0.68rem; }
  .metric-card { padding: 12px; gap: 6px; }
  .metric-card .metric-value { font-size: 1.3rem; }
  .metric-card .metric-icon { width: 26px; height: 26px; }
  button { padding: 8px 13px; font-size: 0.82rem; }
  button.small { padding: 5px 10px; }
  .row { gap: 8px; }
  .row, .stat-grid, .metrics-grid, .payment-grid, .card, .metric-card, .stat {
    min-width: 0; /* containers flex/grid não podem forçar a largura do pai a crescer além do viewport */
  }
  .mono, code, .pixbox, td.mono, .attn-item > span:last-child {
    overflow-wrap: anywhere; word-break: break-word;
  }
  .drawer-kv { grid-template-columns: 92px 1fr; }
}

