/* ==========================================================================
   DASHBOARD DE VENDAS OFSETE - ESTILO CORPORATIVO & EXECUTIVO PARA TV
   ========================================================================== */

:root {
  /* Cores de Fundo Corporativas (Matte Charcoal / Slate) */
  --bg-app: #0b0f17;
  --bg-card: #131924;
  --bg-card-header: #111622;
  --bg-subtle: #18202e;
  --border-card: #1e2638;
  --border-subtle: rgba(255, 255, 255, 0.06);

  /* Tipografia */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Cores Semânticas Corporativas */
  --accent-blue: #2563eb;
  --accent-blue-light: #38bdf8;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #ef4444;

  /* Transições */
  --transition-fast: 0.15s ease;
}

/* Reset e Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11", "tnum";
  overflow: hidden;
  user-select: none;
}

/* ==========================================================================
   TELA DE BLOQUEIO / LOGIN (PROTEÇÃO POR SENHA EM LINK PÚBLICO)
   ========================================================================== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background-color: rgba(11, 15, 23, 0.98);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-overlay.active {
  display: flex;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 32px 28px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-card);
}

.login-logo-icon {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  background-color: #1a2233;
  border: 1px solid #28354d;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
}

.login-brand h2 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
}

.login-brand p {
  font-size: 12px;
  color: var(--text-secondary);
}

.login-body .input-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.password-field-group {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field-group input {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 14px;
  background-color: #0b0f17;
  border: 1px solid var(--border-card);
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast);
}

.password-field-group input:focus {
  border-color: var(--accent-blue);
}

.password-field-group .btn-icon {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.password-field-group .btn-icon:hover {
  color: var(--text-primary);
}

.login-error {
  min-height: 20px;
  font-size: 12px;
  color: var(--accent-rose);
  margin-top: 6px;
}

.login-hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 16px;
}

/* ==========================================================================
   LAYOUT PRINCIPAL DO DASHBOARD (VIEWPORT TV 1080p)
   ========================================================================== */
.dashboard-viewport {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-app);
  overflow: hidden;
}

/* Palco fixo em 1920x1080 (design de referencia). O JS calcula --tv-scale
   para caber inteiro em qualquer resolucao/proporcao de tela, sem cortar
   nada e sem precisar de barra de rolagem (letterbox nas bordas quando a
   proporcao da tela for diferente de 16:9). */
.dashboard-canvas {
  width: 1920px;
  height: 1080px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 16px;
  background-color: var(--bg-app);
  overflow: hidden;
  transform: scale(var(--tv-scale, 1));
  transform-origin: center center;
}

/* HEADER DA TV (ESTILO UNIFICADO, COMPACTO E SEM WRAPPING) */
.tv-header {
  height: 34px;
  min-height: 34px;
  max-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  padding: 0 10px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 6px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.pulse-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  flex-shrink: 0;
}

.brand-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #fff;
  line-height: 1;
}

.brand-divider {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 12px;
}

.brand-subtitle {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  line-height: 1;
}

.source-status-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px;
  background-color: #0b0f17;
  border: 1px solid var(--border-card);
  border-radius: 4px;
  font-size: 10.5px;
  color: var(--text-secondary);
  white-space: nowrap !important;
  flex-shrink: 0;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  flex-shrink: 0;
}

.active-clients-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  background-color: #0b0f17;
  border: 1px solid var(--border-card);
  border-radius: 4px;
  font-size: 10.5px;
  color: #f59e0b;
  white-space: nowrap !important;
  flex-shrink: 0;
}

.active-clients-pill strong {
  color: #fbbf24;
}

.ptax-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  background-color: #0b0f17;
  border: 1px solid var(--border-card);
  border-radius: 4px;
  font-size: 10.5px;
  color: #38bdf8;
  white-space: nowrap !important;
  flex-shrink: 0;
}

.ptax-pill strong {
  color: #7dd3fc;
}

.header-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
}

.clock-display {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 24px;
  padding: 0 10px;
  background-color: #0b0f17;
  border: 1px solid var(--border-card);
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap !important;
  flex-shrink: 0;
}

#clockTime {
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.clock-divider {
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Indicador de Auto-refresh (30s) */
.refresh-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px;
  background-color: #0b0f17;
  border: 1px solid var(--border-card);
  border-radius: 4px;
  white-space: nowrap !important;
  flex-shrink: 0;
}

.countdown-circle {
  position: relative;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.countdown-circle svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  display: block;
}

.circle-bg {
  fill: none;
  stroke: #1e2638;
  stroke-width: 3.5;
}

.circle-progress {
  fill: none;
  stroke: var(--accent-emerald);
  stroke-width: 3.5;
  stroke-linecap: round;
}

#countdownSecs {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6.5px;
  font-weight: 700;
  color: var(--text-secondary);
  line-height: 1;
}

.refresh-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.header-actions-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Botões de Ação Unificados */
.btn-action {
  height: 24px;
  min-height: 24px;
  width: 26px;
  padding: 0;
  border-radius: 4px;
  background-color: #0b0f17;
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-action:hover {
  background-color: #1e2638;
  color: #fff;
  border-color: #2e394f;
}

.btn-meta-shortcut {
  width: auto;
  padding: 0 8px;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  background: #0f1d2d;
  border-color: #1e3a5f;
  color: #38bdf8;
  white-space: nowrap;
}

.btn-meta-shortcut:hover {
  background: #172d47;
  color: #fff;
}

/* Botão Rápido de Filtro no Header */
.btn-filter-toggle {
  height: 24px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 4px;
  background-color: #0b0f17;
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-filter-toggle .filter-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #94a3b8;
  flex-shrink: 0;
  transition: background-color var(--transition-fast);
}

.btn-filter-toggle.active {
  background-color: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #10b981;
}

.btn-filter-toggle.active .filter-status-dot {
  background-color: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.btn-filter-toggle:hover {
  filter: brightness(1.15);
}

.btn-logout:hover {
  color: var(--accent-rose);
  border-color: rgba(239, 68, 68, 0.4);
}

/* ==========================================================================
   GRID GERAL DA TV
   ========================================================================== */
.tv-grid-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

/* CARDS E SUPERFÍCIES */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* ==========================================================================
   LINHA 1: 4 CARDS DE KPIs (META, MÊS, YTD, HOJE)
   ========================================================================== */
.kpi-row {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr 1fr !important;
  gap: 8px;
  height: 126px;
  min-height: 126px;
}

.card-kpi {
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-header-mini {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 22px;
}

.kpi-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-icon {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #18202e;
  border: 1px solid var(--border-card);
}

.kpi-icon svg {
  width: 14px;
  height: 14px;
}

.icon-goal { color: var(--accent-emerald); }
.icon-month { color: var(--accent-blue-light); }
.icon-ytd { color: #a78bfa; }
.icon-today { color: #38bdf8; }

.kpi-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.kpi-title small {
  font-weight: 400;
  color: var(--text-muted);
}

.btn-edit-badge {
  background: #18202e;
  border: 1px solid var(--border-card);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-edit-badge:hover {
  background: #232d3f;
  color: #fff;
}

.kpi-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  min-height: 0;
}

/* Card da Meta do Mês - Sem cortes */
.card-goal {
  cursor: pointer;
  border-color: #1e3a5f;
  background-color: #111722;
}

.card-goal:hover {
  border-color: #2e5280;
}

.goal-main-metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 1px;
}

.goal-percentage {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  line-height: 1;
}

.goal-status-tag {
  font-size: 9.5px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  background-color: #18262e;
  color: var(--accent-emerald);
  border: 1px solid #1e3d38;
}

.goal-progress-bar-wrap {
  width: 100%;
  height: 4px;
  background-color: #1a2233;
  border-radius: 2px;
  margin: 3px 0;
  overflow: hidden;
}

.goal-progress-bar-fill {
  height: 100%;
  background-color: var(--accent-emerald);
  border-radius: 2px;
  transition: width 0.6s ease;
}

/* Informações da meta em linha única compacta (sem cortes) */
.goal-details-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 2px;
  border-top: 1px solid var(--border-card);
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.goal-detail-inline-item strong {
  color: #fff;
  font-weight: 700;
  margin-left: 2px;
}

.goal-detail-inline-divider {
  color: var(--text-muted);
}

/* Métricas dos outros Cards */
.metric-primary-val {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  margin-top: 1px;
  line-height: 1.1;
}

.metric-primary-val.text-accent {
  color: #38bdf8;
}

.metric-secondary-val {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
}

.metric-number {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.meta-item-divider {
  color: var(--text-muted);
  font-size: 10px;
}

.metric-secondary-val .meta-item {
  font-size: 11px;
  color: var(--text-muted);
}

.metric-secondary-val .meta-item strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* Linha de Comparativo Período a Período (Conforme Referência) */
.metric-comparison-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  padding-top: 3px;
  border-top: 1px solid var(--border-card);
  overflow: hidden;
}

.comparison-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1.5px 5px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.comparison-badge.positive {
  color: #10b981;
  background-color: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  text-shadow: 0 0 8px rgba(16, 185, 129, 0.25);
}

.comparison-badge.negative {
  color: #ef4444;
  background-color: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  text-shadow: 0 0 8px rgba(239, 68, 68, 0.25);
}

.comparison-badge.neutral {
  color: #94a3b8;
  background-color: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.comparison-arrow {
  font-size: 8px;
  line-height: 1;
}

.comparison-percent {
  font-weight: 800;
  letter-spacing: -0.2px;
}

.comparison-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

/* ==========================================================================
   LINHA 2: TABELA DE CLIENTES E EVOLUÇÃO DIÁRIA (7 DIAS)
   ========================================================================== */
.middle-row {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1.25fr !important;
  gap: 8px;
  min-height: 0;
  overflow: hidden !important;
}

.card-header {
  height: 30px;
  min-height: 30px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-card);
  background-color: var(--bg-card-header);
}

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

.section-icon {
  color: var(--accent-blue-light);
  display: flex;
  align-items: center;
}

.section-icon svg {
  width: 15px;
  height: 15px;
}

.card-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
  text-transform: uppercase;
}

.card-title small {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
  text-transform: none;
}

.card-sub-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  background-color: #18202e;
  border: 1px solid var(--border-card);
  border-radius: 4px;
  color: var(--text-secondary);
}

/* Legenda do Gráfico */
.chart-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 10px;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-box {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.legend-revenue { background-color: var(--accent-blue); }
.legend-m2 { background-color: var(--accent-emerald); }

/* Tabela de Clientes */
.table-container {
  flex: 1;
  padding: 2px 12px 4px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  min-height: 0;
}

.minimal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.minimal-table th {
  padding: 2.5px 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-card);
}

.minimal-table td {
  padding: 2px 6px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.th-client, .td-client {
  text-align: left;
  color: #fff !important;
}

.td-client {
  display: flex;
  align-items: center;
  gap: 6px;
}

.client-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background-color: #18202e;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
}

.client-name-text {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-right {
  text-align: right;
}

.font-semibold {
  font-weight: 600;
}

.total-row td {
  font-weight: 700;
  color: #fff !important;
  font-size: 11.5px;
  padding-top: 4px;
  padding-bottom: 2px;
  border-top: 1px solid var(--border-card);
  border-bottom: none;
}

/* Gráfico Canvas Minimalista */
.chart-container {
  flex: 1;
  position: relative;
  padding: 4px 10px 6px 10px;
  width: 100%;
  height: calc(100% - 30px);
  min-height: 0;
}

#evolutionCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ==========================================================================
   LINHA 3: VENDAS DO MÊS ATÉ HOJE POR VENDEDOR (GRID ALINHADO - 5 VENDEDORES)
   ========================================================================== */
.bottom-row {
  height: 205px;
  min-height: 205px;
  overflow: hidden !important;
}

.card-sellers-section {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.card-sellers-section .card-header {
  height: 28px;
  min-height: 28px;
  padding: 0 14px;
}

/* Cabeçalho de Colunas dos Vendedores (Alinhado 100% com as Linhas) */
.sellers-grid-header {
  display: grid;
  grid-template-columns: 340px 1fr 150px 120px;
  align-items: center;
  gap: 12px;
  padding: 2px 14px;
  height: 20px;
  min-height: 20px;
  border-bottom: 1px solid var(--border-card);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background-color: #0f141c;
}

.sellers-list-container {
  flex: 1;
  padding: 2px 14px 4px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 0;
}

.seller-row {
  display: grid;
  grid-template-columns: 340px 1fr 150px 120px;
  align-items: center;
  gap: 12px;
  padding: 1px 0;
  height: 20px;
}

.seller-name {
  font-size: 11.5px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

.seller-bar-track {
  width: 100%;
  max-width: 320px;
  height: 6px;
  background-color: #1a2233;
  border-radius: 3px;
  overflow: hidden;
}

.seller-bar-fill {
  height: 100%;
  background-color: var(--accent-blue);
  border-radius: 3px;
  transition: width 0.6s ease;
}

.seller-val-revenue {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.seller-val-m2 {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   MODAIS (META DO MÊS & CONFIGURAÇÕES MICRO ERP)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background-color: rgba(5, 8, 14, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.modal-backdrop.active {
  display: flex;
}

.modal-dialog {
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  position: relative;
  margin: auto;
}

.modal-dialog-lg {
  max-width: 620px;
}

.modal-header {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-card);
  background-color: var(--bg-card-header);
  flex-shrink: 0;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

.modal-title-wrap h3 {
  font-size: 15px;
  font-weight: 700;
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color var(--transition-fast);
}

.btn-close-modal:hover {
  color: #fff;
}

.modal-body {
  padding: 20px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto !important;
  scrollbar-width: thin !important;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent !important;
}

.modal-body::-webkit-scrollbar {
  display: block !important;
  width: 6px !important;
}

.modal-body::-webkit-scrollbar-track {
  background: transparent !important;
}

.modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25) !important;
  border-radius: 4px !important;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.45) !important;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 18px;
  line-height: 1.4;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input-prefix-wrap {
  display: flex;
  align-items: center;
  background-color: #0b0f17;
  border: 1px solid var(--border-card);
  border-radius: 6px;
  overflow: hidden;
}

.input-prefix-wrap:focus-within {
  border-color: var(--accent-blue);
}

.input-prefix {
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background-color: #121824;
  border-right: 1px solid var(--border-card);
}

.input-prefix-wrap input,
.form-group input[type="text"],
.form-group input[type="password"] {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.form-group input[type="text"],
.form-group input[type="password"] {
  background-color: #0b0f17;
  border: 1px solid var(--border-card);
  border-radius: 6px;
}

.form-group input:focus {
  border-color: var(--accent-blue);
}

.field-hint {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-check-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  cursor: pointer;
}

.form-check-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-emerald);
  cursor: pointer;
}

.form-check-toggle label {
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  cursor: pointer;
}

.section-badge-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.section-badge-title h4 {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.section-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background-color: #1a2233;
  color: var(--text-secondary);
}

.status-pill.active {
  background-color: #122822;
  color: var(--accent-emerald);
  border: 1px solid #1e3d38;
}

.section-separator {
  border: none;
  border-top: 1px solid var(--border-card);
  margin: 18px 0;
}

.modal-footer {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border-card);
  background-color: var(--bg-card-header);
  flex-shrink: 0;
}

.modal-feedback {
  min-height: 20px;
  font-size: 12px;
  margin-top: 10px;
  display: none;
}

.modal-feedback.success {
  display: block;
  color: var(--accent-emerald);
}

.modal-feedback.error {
  display: block;
  color: var(--accent-rose);
}

/* BOTÕES CORPORATIVOS */
.btn-primary {
  height: 38px;
  padding: 0 18px;
  background-color: var(--accent-blue);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color var(--transition-fast);
}

.btn-primary:hover {
  background-color: #1d4ed8;
}

.btn-secondary {
  height: 38px;
  padding: 0 14px;
  background-color: #18202e;
  border: 1px solid var(--border-card);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background-color: #232d3f;
  color: #fff;
}

.btn-full {
  width: 100%;
}

/* ==========================================================================
   OTIMIZAÇÃO ABSOLUTA PARA SMART TVS (SEM BARRAS DE ROLAGEM)
   ========================================================================== */
html, body, .dashboard-viewport, .tv-grid-layout {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
div::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}
