/* ==========================================================================
   BRADOX PREMIUM SAAS — MASTER STYLESHEET
   Arquitetura de Interfaces SaaS de Alto Padrão (Linear / Vercel / Stripe Standard)
   ========================================================================== */

/* Tokens e fontes são carregados pelo index.html (tokens.css, ds.css). */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

/* ==========================================================================
   GLOBAL SMOOTH & MINIMALIST SCROLLBAR (SUAVE & QUASE IMPERCEPTÍVEL)
   ========================================================================== */
html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

/* Chrome, Edge, Safari, Brave */
*::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  transition: background var(--transition-fast);
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 163, 50, 0.38);
}

*::-webkit-scrollbar-thumb:active {
  background: rgba(212, 163, 50, 0.65);
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

/* Suporte Adaptativo Tema Claro */
[data-theme="light"] html,
[data-theme="light"] * {
  scrollbar-color: rgba(0, 0, 0, 0.12) transparent;
}

[data-theme="light"] *::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] *::-webkit-scrollbar-thumb:hover {
  background: rgba(184, 134, 11, 0.45);
}

body {
  font-family: var(--font-sans);
  font-size: 15.5px;
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--bg-app);
}

/* ==========================================================================
   AUTH MODE (FULLSCREEN LOGIN SCREEN)
   ========================================================================== */
body.auth-mode .topbar,
body.auth-mode .sidebar {
  display: none !important;
}

body.auth-mode #app {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 20%, rgba(212, 163, 50, 0.08) 0%, transparent 60%), var(--bg-app);
}

body.auth-mode .main-content {
  padding: 20px;
  max-width: 480px;
  width: 100%;
  margin: auto;
}

/* ==========================================================================
   TOPBAR
   ========================================================================== */
.topbar {
  height: var(--topbar-h);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.brand-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
  transition: transform var(--transition-fast);
}

.brand-logo:hover {
  transform: scale(1.02);
}

.server-badge-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background-color: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.2); }
}

.credits-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--gold-subtle);
  border: 1px solid rgba(212, 163, 50, 0.3);
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  color: var(--gold-highlight);
  font-size: 14px;
  font-weight: 600;
}

.credits-badge i {
  width: 17px;
  height: 17px;
  color: var(--gold-primary);
}

.credits-val {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15.5px;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.user-menu:hover {
  background-color: var(--bg-elevated);
  border-color: var(--border-subtle);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-elevated);
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background-color: var(--bg-elevated);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.btn-icon i {
  width: 17px;
  height: 17px;
}

/* ==========================================================================
   APP BODY & SIDEBAR
   ========================================================================== */
.app-body {
  display: flex;
  flex: 1;
}

.sidebar {
  width: var(--sidebar-w);
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  transition: width var(--transition-normal);
  flex-shrink: 0;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 30;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 9999px;
  transition: background var(--transition-fast);
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 163, 50, 0.35);
}

.sidebar.collapsed {
  width: var(--sidebar-w-collapsed);
}

.sidebar.collapsed .nav-section,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .sidebar-footer span {
  display: none;
}

.nav-section {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding: 16px 12px 8px;
  text-transform: uppercase;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  position: relative;
}

.nav-item i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.nav-item:hover {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
}

.nav-item:hover i {
  color: var(--text-primary);
}

.nav-item.active {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: 600;
  border-color: var(--border-subtle);
  border-left: 3px solid var(--gold-primary);
}

.nav-item.active i {
  color: var(--gold-highlight);
}

.nav-badge {
  margin-left: auto;
  font-size: 13px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: var(--radius-xs);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.nav-badge.green {
  background-color: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success);
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 12px 0;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}

/* ==========================================================================
   MAIN CONTENT & DASHBOARD HEADER
   ========================================================================== */
.main-content {
  flex: 1;
  padding: 24px 28px;
  background-color: var(--bg-app);
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px;
  gap: 18px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.page-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin-top: 5px;
  line-height: 1.5;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ==========================================================================
   BUTTONS (SaaS RESTRAINED & PROFESSIONAL)
   ========================================================================== */
.btn {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

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

.btn i {
  width: 18px;
  height: 18px;
}

/* Primary Button: Dourado Principal com hover de destaque */
.btn-primary {
  background-color: var(--gold-primary);
  color: #080808;
  border-color: var(--gold-muted);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--gold-highlight);
  box-shadow: 0 2px 8px rgba(212, 163, 50, 0.3);
}

.btn-primary:active:not(:disabled) {
  background-color: var(--gold-primary);
  transform: translateY(1px);
}

/* Secondary Button: Superfície com borda discreta */
.btn-secondary {
  background-color: var(--bg-surface);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-elevated);
  border-color: var(--border-hover);
}

/* Danger Button: Erro / Exclusão */
.btn-danger {
  background-color: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background-color: var(--danger);
  color: #FFFFFF;
}

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

.btn-ghost:hover:not(:disabled) {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 13.5px;
  font-weight: 600;
}

.btn-link {
  background: none;
  border: none;
  color: var(--gold-highlight);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-link:hover {
  color: #FFFFFF;
}

/* ==========================================================================
   METRIC CARDS GRID (3 CARDS PER ROW DESKTOP, 2 TABLET, 1 MOBILE)
   ========================================================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 1024px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
}

.metric-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
}

.metric-card:hover {
  border-color: var(--border-hover);
  background-color: var(--bg-elevated);
  box-shadow: var(--shadow-md);
}

.metric-card-master {
  background: linear-gradient(135deg, rgba(212, 163, 50, 0.12) 0%, var(--bg-surface) 100%) !important;
  border-color: var(--gold-muted) !important;
}

[data-theme="light"] .metric-card-master {
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%) !important;
  border-color: #f59e0b !important;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.12) !important;
}

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

.metric-title {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.metric-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.metric-icon-wrap i {
  width: 18px;
  height: 18px;
}

.metric-icon-wrap.gold {
  background-color: var(--gold-subtle);
  color: var(--gold-highlight);
  border: 1px solid rgba(212, 163, 50, 0.3);
}

.metric-icon-wrap.green {
  background-color: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.metric-icon-wrap.yellow {
  background-color: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.metric-icon-wrap.blue {
  background-color: var(--info-bg);
  color: var(--info);
  border: 1px solid var(--info-border);
}

.metric-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.metric-trend {
  font-size: 13.5px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
}

.metric-trend.positive { color: var(--success); }
.metric-trend.warning { color: var(--warning); }
.metric-trend.info { color: var(--info); }

/* ==========================================================================
   PANELS & CONTAINERS
   ========================================================================== */
.panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.panel-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-title i {
  width: 17px;
  height: 17px;
  color: var(--gold-primary);
}

.dashboard-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .dashboard-columns {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   INFRASTRUCTURE MULTI-SERVER CARDS
   ========================================================================== */
.server-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.server-card {
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: border-color var(--transition-fast);
}

.server-card:hover {
  border-color: var(--border-hover);
}

.server-info-col {
  display: flex;
  align-items: center;
  gap: 14px;
}

.server-type-badge {
  font-size: 11px;
  padding: 2px 7px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
}

/* ==========================================================================
   WHATSAPP AUTOMATION CENTER CARD
   ========================================================================== */
.automation-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
}

.automation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.automation-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background-color: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success);
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
}

.template-preview-box {
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 12px 0 16px;
  max-height: 120px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* ==========================================================================
   SEGMENTED FILTER TABS
   ========================================================================== */
.tab-group {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-elevated);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-xs);
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  background-color: var(--bg-secondary);
  color: var(--gold-highlight);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.tab-badge {
  font-size: 13px;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  background-color: rgba(255, 255, 255, 0.08);
}

.tab-btn.active .tab-badge {
  background-color: var(--gold-subtle);
  color: var(--gold-highlight);
}

/* ==========================================================================
   FORMS — SLEEK, FUNCTIONAL & RESTRAINED
   ========================================================================== */
.form-group {
  margin-bottom: 18px;
}

.form-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 7px;
}

.form-input, .form-select, select, input[type="text"], input[type="password"], input[type="email"], input[type="number"] {
  width: 100%;
  padding: 11px 16px;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15.5px;
  transition: all var(--transition-fast);
}

.form-input:focus, .form-select:focus, select:focus, input[type="text"]:focus, input[type="password"]:focus, input[type="email"]:focus, input[type="number"]:focus {
  outline: none;
  border-color: var(--gold-highlight);
  box-shadow: 0 0 0 1px var(--gold-primary);
}

select optgroup {
  background-color: #18191B;
  color: var(--gold-highlight);
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.06em;
  padding: 10px 8px 4px 8px;
}

select option {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-size: 15.5px;
  font-weight: 500;
  padding: 9px 14px;
}

.form-helper {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.45;
}

.form-section-title {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold-primary);
  text-transform: uppercase;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

/* ==========================================================================
   TABLES
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 10px 12px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  background-color: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: 8px 10px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table tr:hover td {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.status-pill.active {
  background-color: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success);
}

.status-pill.danger {
  background-color: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
}

.status-pill.warning {
  background-color: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning);
}

.status-pill.info {
  background-color: var(--info-bg);
  border: 1px solid var(--info-border);
  color: var(--info);
}

.badge-tag {
  font-size: 12.5px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  white-space: nowrap;
}

.action-buttons {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: flex-end;
}

.btn-sm-icon {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 29px;
  height: 29px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-sm-icon:hover {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.btn-sm-icon.danger {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.25);
}

.btn-sm-icon.danger:hover {
  background-color: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

.btn-sm-icon.warning {
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.25);
}

.btn-sm-icon.warning:hover {
  background-color: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning-border);
}

.btn-sm-icon i {
  width: 14px;
  height: 14px;
}

/* ==========================================================================
   SIGMA PLAYLIST & CONNECTION MODAL STYLES
   ========================================================================== */
.credential-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.credential-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.credential-val-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.credential-val-row code {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-copy-small {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-copy-small:hover {
  background-color: var(--bg-elevated);
  color: var(--gold-highlight);
  border-color: var(--gold-primary);
}

.btn-copy-small i {
  width: 13px;
  height: 13px;
}

.playlist-row-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--transition-fast);
}

.playlist-row-card:hover {
  border-color: var(--border-hover);
}

.playlist-row-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.playlist-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--text-primary);
}

.playlist-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.playlist-input-readonly {
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 7px 10px;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: text;
}

.playlist-row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ==========================================================================
   MULTI-SERVER CLUSTER TABS & BANNER
   ========================================================================== */
.cluster-tabs-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.cluster-tab-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: var(--radius-xs);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.cluster-tab-pill:hover {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
  border-color: rgba(212, 163, 50, 0.4);
}

.cluster-tab-pill.active {
  background: rgba(212, 163, 50, 0.14);
  border-color: var(--gold-highlight);
  color: var(--gold-highlight);
  box-shadow: 0 0 10px rgba(212, 163, 50, 0.2);
}

.cluster-banner-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--gold-primary);
  border-radius: var(--radius-xs);
  padding: 10px 14px;
  margin-bottom: 16px;
}

/* ==========================================================================
   NOTICES & ANNOUNCEMENTS COMPONENT (SIGMA SYSTEM)
   ========================================================================== */
.notices-banner-panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.notices-banner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.notices-accordion {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notice-card {
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.notice-card:hover {
  border-color: var(--border-hover);
}

.notice-card.notice-primary {
  border-left: 3px solid var(--gold-primary);
}

.notice-card.notice-danger {
  border-left: 3px solid var(--danger);
}

.notice-card.notice-info {
  border-left: 3px solid var(--info);
}

.notice-card.notice-success {
  border-left: 3px solid var(--success);
}

.notice-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
}

.notice-card-header:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.notice-toggle-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.notice-card-body {
  padding: 12px 16px 14px;
  border-top: 1px solid var(--border-subtle);
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
  background-color: var(--bg-surface);
}

.notice-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
}

.notice-badge.primary {
  background-color: rgba(212, 163, 50, 0.15);
  color: var(--gold-highlight);
  border: 1px solid rgba(212, 163, 50, 0.3);
}

.notice-badge.danger {
  background-color: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.notice-badge.info {
  background-color: var(--info-bg);
  color: var(--info);
  border: 1px solid var(--info-border);
}

.notice-badge.success {
  background-color: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

/* Notices Management View Cards */
.notice-manage-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  transition: border-color var(--transition-fast);
}

.notice-manage-card.notice-primary {
  border-left: 3px solid var(--gold-primary);
}

.notice-manage-card.notice-danger {
  border-left: 3px solid var(--danger);
}

.notice-manage-card.notice-info {
  border-left: 3px solid var(--info);
}

.notice-manage-card.notice-success {
  border-left: 3px solid var(--success);
}

.notice-manage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.notice-manage-body {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
}

/* ==========================================================================
   PAGINATION & SELECTION CONTROLS (SIGMA STANDARD)
   ========================================================================== */
.btn-page {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-page:hover:not(:disabled) {
  background-color: var(--bg-elevated);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.btn-page.active {
  background-color: var(--gold-primary);
  border-color: var(--gold-muted);
  color: #080808;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(212, 163, 50, 0.35);
}

.btn-page:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-page i {
  width: 14px;
  height: 14px;
}

.data-table tr.row-selected td {
  background-color: rgba(212, 163, 50, 0.08) !important;
}

/* ==========================================================================
   MODAL SYSTEM — PREMIUM SaaS FRAMING, SCROLL & ENCLOSURE
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(8, 8, 8, 0.88);
  backdrop-filter: blur(8px);
  z-index: 100000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  animation: overlayFadeIn 0.15s ease-out;
}

#error-modal, #confirm-modal {
  z-index: 999999 !important;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 24px 28px;
  box-shadow: var(--shadow-lg);
  animation: modalScaleUp 0.15s ease-out;
  overflow: hidden;
  position: relative;
}

.modal-box-lg {
  max-width: 680px;
}

@keyframes modalScaleUp {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.modal-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-icon i {
  width: 20px;
  height: 20px;
}

.modal-icon.danger {
  background-color: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
}

.modal-icon.success {
  background-color: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success);
}

.modal-icon.warning {
  background-color: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning);
}

.modal-icon.info {
  background-color: var(--info-bg);
  border: 1px solid var(--info-border);
  color: var(--info);
}

.modal-icon.gold {
  background-color: var(--gold-subtle);
  border: 1px solid var(--gold-muted);
  color: var(--gold-highlight);
}

.modal-title {
  font-size: 21px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 3px;
}

.modal-body {
  font-size: 15.5px;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 20px;
  overflow-y: auto;
  max-height: calc(90vh - 160px);
  padding-right: 6px;
  flex: 1;
}

.modal-body.text-only {
  white-space: pre-wrap;
  word-break: break-word;
}

.modal-info-note {
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--gold-primary);
  border-radius: var(--radius-xs);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}

.code-preview-box {
  background-color: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  color: var(--gold-highlight);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 280px;
  overflow-y: auto;
  user-select: all;
}

.modal-tab-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background-color: var(--bg-elevated);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  margin-bottom: 18px;
}

.modal-tab-group.tabs-3 {
  grid-template-columns: repeat(3, 1fr);
}

.modal-tab-group.tabs-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {
  .modal-tab-group.tabs-3,
  .modal-tab-group.tabs-4 {
    grid-template-columns: 1fr;
  }
}

.modal-tab-btn {
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.modal-tab-btn:hover {
  color: var(--text-primary);
}

.modal-tab-btn.active {
  background-color: var(--bg-surface);
  color: var(--gold-highlight);
  border-color: rgba(212, 163, 50, 0.4);
  box-shadow: var(--shadow-sm);
}

.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100001;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 440px;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast.success {
  border-color: var(--success);
  color: var(--success);
}

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

.toast.info {
  border-color: var(--info);
  color: var(--text-primary);
}

.toast.warning {
  border-color: var(--warning);
  color: var(--warning);
}

/* ==========================================================================
   EMPTY STATE COMPONENT
   ========================================================================== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  color: var(--text-muted);
}

.empty-state-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-state-desc {
  font-size: 13px;
  max-width: 420px;
  margin: 0 auto 20px;
  line-height: 1.5;
}

/* ==========================================================================
   RESPONSIVE OVERRIDES
   ========================================================================== */
@media (max-width: 768px) {
  .topbar {
    padding: 0 16px;
  }

  .main-content {
    padding: 20px 16px;
  }

  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    bottom: 0;
    left: 0;
    z-index: 45;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .credits-badge span:last-child {
    display: none;
  }
}

/* PASSWORD INPUT WITH EYE TOGGLE */
.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrap .form-input,
.password-input-wrap input {
  padding-right: 44px !important;
  width: 100%;
}

.password-toggle-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  z-index: 5;
}

.password-toggle-btn:hover {
  color: var(--gold-highlight);
  background: rgba(255, 255, 255, 0.06);
}

.password-toggle-btn i,
.password-toggle-btn svg {
  width: 18px;
  height: 18px;
  pointer-events: none;
}


/* Editor visual dos comunicados: usa o mesmo HTML sanitizado da exibição. */
.notice-rich-editor { border: 1px solid var(--border-subtle); border-radius: 12px; overflow: hidden; background: var(--bg-surface); }
.notice-rich-editor:focus-within { border-color: var(--gold-primary); }
.notice-editor-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; border-bottom: 1px solid var(--border-subtle); background: var(--bg-elevated); }
.notice-editor-toolbar button { border: 1px solid var(--border-subtle); border-radius: 6px; padding: 6px 9px; background: var(--bg-surface); color: var(--text-primary); font: inherit; font-size: 12px; cursor: pointer; }
.notice-editor-toolbar button:hover, .notice-editor-toolbar button:focus-visible { border-color: var(--gold-primary); color: var(--gold-highlight); }
.notice-editor-link { display: flex; gap: 6px; width: 100%; margin-top: 4px; }
.notice-editor-link input { flex: 1; min-width: 0; font-size: 12px; padding: 6px 9px; }
.notice-editor-content { min-height: 180px; max-height: 320px; overflow-y: auto; padding: 14px 16px; outline: none; line-height: 1.65; color: var(--text-primary); overflow-wrap: anywhere; }
.notice-editor-content:empty::before { content: attr(data-placeholder); color: var(--text-muted); pointer-events: none; }
.notice-editor-content p { margin: 0 0 10px; }
.notice-editor-content ul, .notice-editor-content ol, .notice-manage-body ul, .notice-manage-body ol { padding-left: 24px; }
.notice-editor-content a { color: var(--gold-highlight); text-decoration: underline; }
