/* ============================================
   CLASHBOT - DESIGN MODERNO E PROFISSIONAL
   ============================================ */

:root {
  /* Cores primárias - Paleta vibrante */
  --primary: #7c3aed;
  --primary-light: #a78bfa;
  --primary-dark: #5b21b6;
  --secondary: #06b6d4;
  --secondary-light: #22d3ee;
  --accent: #f59e0b;
  --accent-light: #fbbf24;
  --success: #10b981;
  --success-light: #34d399;
  --danger: #ef4444;
  --danger-light: #f87171;
  --warning: #f59e0b;
  --warning-light: #fbbf24;
  
  /* Cores de fundo e texto */
  --bg-dark: #0f172a;
  --bg-darker: #020617;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-color: rgba(203, 213, 225, 0.1);
  --border-color-light: rgba(203, 213, 225, 0.2);
  
  /* Sombras */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.3);
}

/* ============================================
   RESET E ESTILOS GLOBAIS
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  background: linear-gradient(135deg, var(--bg-darker) 0%, #1a1f35 50%, var(--bg-dark) 100%);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
  transition: all 0.3s ease;
}

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */

.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg-dark);
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
  width: 280px;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
  border-right: 1px solid var(--border-color-light);
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.3);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 58, 237, 0.5);
}

/* Brand/Logo */
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  font-size: 28px;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4);
  flex-shrink: 0;
}

.brand strong {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.brand span {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Navegação */
.sidebar nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  border: 1px solid transparent;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.sidebar nav a::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s ease;
}

.sidebar nav a:hover::before {
  left: 100%;
}

.sidebar nav a:hover {
  background: rgba(124, 58, 237, 0.15);
  border-color: rgba(124, 58, 237, 0.3);
  color: var(--primary-light);
  transform: translateX(4px);
}

.sidebar nav a:active {
  background: rgba(124, 58, 237, 0.25);
  border-color: var(--primary);
  color: var(--primary-light);
}

/* Cartão de usuário */
.user-card {
  padding: 16px;
  border: 1px solid var(--border-color-light);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(6, 182, 212, 0.05));
  backdrop-filter: blur(10px);
}

.user-card small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.user-card b {
  display: block;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 4px;
  font-weight: 600;
}

.user-card span {
  display: block;
  font-size: 12px;
  color: var(--primary-light);
  font-weight: 500;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main {
  flex: 1;
  padding: 32px;
  max-width: 1600px;
  width: 100%;
  overflow-y: auto;
}

.main::-webkit-scrollbar {
  width: 8px;
}

.main::-webkit-scrollbar-track {
  background: transparent;
}

.main::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.2);
  border-radius: 4px;
}

.main::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 58, 237, 0.4);
}

/* ============================================
   TOPBAR
   ============================================ */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

.topbar h1 {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--text-primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.topbar p {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.topbar [data-local-time] {
  color: var(--secondary-light);
  font-weight: 600;
}

/* ============================================
   GRID SYSTEM
   ============================================ */

.grid {
  display: grid;
  gap: 24px;
  margin-bottom: 24px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* ============================================
   CARDS
   ============================================ */

.card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(20, 30, 48, 0.8));
  border: 1px solid var(--border-color-light);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.1), transparent);
  pointer-events: none;
}

.card:hover {
  border-color: var(--border-color-light);
  box-shadow: 0 20px 40px rgba(124, 58, 237, 0.2);
  transform: translateY(-4px);
}

/* Stat Card */
.stat {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat span {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.stat b {
  font-size: 42px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat small {
  display: block;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

/* Mini Card */
.mini-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px;
  transition: all 0.3s ease;
}

.mini-card:hover {
  border-color: var(--primary);
  background: rgba(124, 58, 237, 0.1);
}

.mini-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.mini-card p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.mini-card ul {
  list-style: none;
  padding-left: 0;
  margin: 8px 0 16px;
}

.mini-card li {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  padding-left: 0;
}

.mini-card li span {
  color: var(--text-muted);
  font-size: 12px;
}

/* ============================================
   BOTÕES
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::before {
  width: 300px;
  height: 300px;
}

/* Botão primário */
.btn {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(124, 58, 237, 0.6);
}

.btn:active {
  transform: translateY(0);
}

/* Botão secundário */
.btn.secondary {
  background: rgba(124, 58, 237, 0.15);
  color: var(--primary-light);
  border: 1px solid var(--border-color-light);
  box-shadow: none;
}

.btn.secondary:hover {
  background: rgba(124, 58, 237, 0.25);
  border-color: var(--primary);
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.2);
}

/* Botão perigo */
.btn.danger {
  background: linear-gradient(135deg, var(--danger), var(--danger-light));
  color: white;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.btn.danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.6);
}

/* ============================================
   FORMULÁRIOS
   ============================================ */

label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  margin: 0 0 16px 0;
  border-radius: 12px;
  border: 1px solid var(--border-color-light);
  background: rgba(20, 30, 48, 0.6);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.3s ease;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  background: rgba(20, 30, 48, 0.9);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a78bfa' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ============================================
   TABELAS
   ============================================ */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  padding: 16px;
  border-bottom: 2px solid var(--border-color-light);
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 12px;
  background: rgba(124, 58, 237, 0.05);
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  vertical-align: middle;
}

.table tr:hover {
  background: rgba(124, 58, 237, 0.08);
}

.table tr:last-child td {
  border-bottom: none;
}

.table .icon-img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: contain;
  display: inline-block;
}

/* ============================================
   BADGES
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid transparent;
  transition: all 0.3s ease;
}

.badge.open {
  background: rgba(6, 182, 212, 0.15);
  color: var(--secondary-light);
  border-color: rgba(6, 182, 212, 0.3);
}

.badge.pending {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning-light);
  border-color: rgba(245, 158, 11, 0.3);
}

.badge.progress {
  background: rgba(124, 58, 237, 0.15);
  color: var(--primary-light);
  border-color: rgba(124, 58, 237, 0.3);
}

.badge.closed {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success-light);
  border-color: rgba(16, 185, 129, 0.3);
}

.badge.canceled {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger-light);
  border-color: rgba(239, 68, 68, 0.3);
}

.badge.urgent {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger-light);
  border-color: rgba(239, 68, 68, 0.3);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.ticket-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.ticket-status-badge .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px currentColor;
  background: currentColor;
  animation: blink 2s infinite;
}

@keyframes blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.ticket-status-badge.open {
  background: rgba(6, 182, 212, 0.15);
  color: var(--secondary-light);
  border-color: rgba(6, 182, 212, 0.3);
}

.ticket-status-badge.pending {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning-light);
  border-color: rgba(245, 158, 11, 0.3);
}

.ticket-status-badge.progress {
  background: rgba(124, 58, 237, 0.15);
  color: var(--primary-light);
  border-color: rgba(124, 58, 237, 0.3);
}

.ticket-status-badge.closed {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success-light);
  border-color: rgba(16, 185, 129, 0.3);
}

.ticket-status-badge.canceled {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger-light);
  border-color: rgba(239, 68, 68, 0.3);
}

/* ============================================
   ALERTAS
   ============================================ */

.alert {
  padding: 16px 18px;
  border-radius: 12px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color-light);
  border-left: 4px solid;
  font-size: 14px;
  font-weight: 500;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(-20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.alert.success {
  background: rgba(16, 185, 129, 0.1);
  border-color: var(--success);
  color: var(--success-light);
}

.alert.error {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--danger);
  color: var(--danger-light);
}

.notice {
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid var(--border-color-light);
  border-left: 4px solid var(--warning);
  background: rgba(245, 158, 11, 0.1);
  margin-bottom: 20px;
  line-height: 1.6;
  font-size: 14px;
}

.notice strong {
  color: var(--warning-light);
  font-weight: 600;
}

.notice.danger-notice {
  border-left-color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger-light);
}

.notice.danger-notice strong,
.notice.danger-notice b {
  color: var(--danger-light);
  font-weight: 700;
}

/* ============================================
   PÁGINA DE LOGIN
   ============================================ */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(135deg, var(--bg-darker) 0%, #1a1f35 50%, var(--bg-dark) 100%);
}

.login-card {
  width: min(460px, 100%);
  padding: 40px;
  border-radius: 20px;
  border: 1px solid var(--border-color-light);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(20, 30, 48, 0.9));
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
}

.login-hero {
  text-align: center;
  margin-bottom: 32px;
}

.login-hero .logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  font-size: 40px;
}

.login-hero h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.login-hero p {
  font-size: 14px;
  color: var(--text-muted);
}

.login-card .muted {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

/* ============================================
   UTILITÁRIOS
   ============================================ */

.muted {
  color: var(--text-muted);
  font-weight: 500;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.actions form {
  display: inline-flex;
}

.kpi-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.15);
  border: 1px solid rgba(124, 58, 237, 0.3);
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-light);
}

.icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(124, 58, 237, 0.15);
  font-size: 18px;
  flex-shrink: 0;
}

.icon-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 8px;
  display: inline-block;
}

.icon-fallback {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  font-size: 18px;
}

.check-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: rgba(124, 58, 237, 0.05);
  transition: all 0.3s ease;
  cursor: pointer;
}

.check-card:hover {
  border-color: var(--primary);
  background: rgba(124, 58, 237, 0.1);
}

.check-card input {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.check-card .icon {
  overflow: hidden;
}

.check-card .icon .icon-img {
  width: 32px;
  height: 32px;
}

/* ============================================
   CHAT/BUBBLES
   ============================================ */

.chat {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bubble {
  max-width: 76%;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border-color);
  font-size: 14px;
  line-height: 1.5;
}

.bubble.me {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(6, 182, 212, 0.2));
  border-color: rgba(124, 58, 237, 0.3);
  color: var(--text-primary);
}

.bubble.support {
  align-self: flex-start;
}

.bubble small {
  display: block;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-size: 12px;
}

/* ============================================
   FILTROS E BUSCA
   ============================================ */

.searchbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin: 16px 0 24px;
}

.searchbar input {
  flex: 1;
  min-width: 240px;
  margin: 0;
}

.filter-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto auto;
  gap: 12px;
  align-items: end;
  margin: 16px 0 24px;
}

.filter-grid input,
.filter-grid select {
  margin: 0;
}

.select-filter-match {
  border-color: var(--primary) !important;
  background: rgba(124, 58, 237, 0.1) !important;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1) !important;
}

[data-select-filter],
[data-filter-target] {
  border-color: rgba(124, 58, 237, 0.3) !important;
  background: rgba(124, 58, 237, 0.08) !important;
}

.field-help {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: -12px;
  margin-bottom: 12px;
  font-weight: 500;
}

.field-help [data-filter-count] {
  color: var(--primary-light);
  font-weight: 700;
}

/* ============================================
   GRID DE CATÁLOGO
   ============================================ */

.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.clan-widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.category-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
  margin-bottom: 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.category-title::before {
  content: '';
  width: 4px;
  height: 24px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 2px;
}

/* ============================================
   LOGOUT LINK
   ============================================ */

.logout-link {
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
  color: var(--danger-light) !important;
  font-weight: 700;
}

.logout-link::before {
  content: '⏻ ';
}

.logout-link:hover {
  background: rgba(239, 68, 68, 0.24) !important;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3) !important;
}

/* ============================================
   RESPONSIVO - MOBILE
   ============================================ */

@media (max-width: 1200px) {
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 16px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px;
  }

  .brand {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
  }

  .sidebar nav {
    display: flex;
    flex-direction: row;
    gap: 4px;
    margin-bottom: 0;
    flex-wrap: wrap;
  }

  .sidebar nav a {
    padding: 8px 12px;
    font-size: 13px;
    flex: 1;
    min-width: 100px;
  }

  .user-card {
    grid-column: 1 / -1;
    margin-top: 12px;
  }

  .main {
    padding: 20px;
  }

  .topbar {
    flex-direction: column;
    gap: 12px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .filter-grid {
    grid-template-columns: 1fr;
  }

  .searchbar {
    display: block;
  }

  .searchbar input,
  .searchbar .btn {
    width: 100%;
    margin-bottom: 8px;
  }

  .bubble {
    max-width: 95%;
  }

  .table {
    font-size: 12px;
  }

  .table th,
  .table td {
    padding: 10px 8px;
  }

  .btn {
    padding: 10px 16px;
    font-size: 13px;
  }

  .card {
    padding: 16px;
  }

  .clan-widget-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .sidebar {
    grid-template-columns: 1fr;
  }

  .sidebar nav {
    flex-direction: column;
    gap: 6px;
  }

  .sidebar nav a {
    flex: 1;
    min-width: auto;
  }

  .main {
    padding: 16px;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .topbar p {
    font-size: 12px;
  }

  .card {
    padding: 14px;
  }

  .stat b {
    font-size: 32px;
  }

  .login-card {
    padding: 24px;
  }

  .login-hero .logo {
    width: 64px;
    height: 64px;
    font-size: 32px;
  }

  .login-hero h1 {
    font-size: 22px;
  }

  .grid {
    gap: 16px;
  }

  .actions {
    gap: 8px;
  }

  .table {
    font-size: 11px;
  }

  .table th,
  .table td {
    padding: 8px 6px;
  }

  .badge {
    padding: 4px 8px;
    font-size: 11px;
  }

  .btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  input,
  select,
  textarea {
    padding: 10px 12px;
    font-size: 16px;
  }

  label {
    font-size: 12px;
  }
}

/* ============================================
   SCROLLBAR CUSTOMIZADO
   ============================================ */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 58, 237, 0.5);
}

/* ============================================
   ANIMAÇÕES E TRANSIÇÕES
   ============================================ */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.card {
  animation: slideUp 0.4s ease;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .sidebar,
  .topbar,
  .btn,
  .actions {
    display: none;
  }

  body {
    background: white;
    color: black;
  }

  .card {
    border: 1px solid #ccc;
    box-shadow: none;
  }
}

/* ============================================
   LOGO OFICIAL CLASHBOT
   ============================================ */

.brand-with-image {
  justify-content: center;
  align-items: center;
  padding-bottom: 24px;
}

.brand-logo-img {
  display: block;
  width: 100%;
  max-width: 210px;
  max-height: 170px;
  height: auto;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 10px 22px rgba(6, 182, 212, 0.38));
}

.login-logo-img {
  display: block;
  width: min(230px, 82%);
  height: auto;
  margin: 0 auto 18px;
  filter: drop-shadow(0 18px 32px rgba(6, 182, 212, 0.35));
}

@media (max-width: 900px) {
  .brand-with-image {
    justify-content: flex-start;
    padding-bottom: 0;
  }

  .brand-logo-img {
    width: 100%;
    max-width: 150px;
    max-height: 105px;
  }
}

@media (max-width: 600px) {
  .brand-with-image {
    justify-content: center;
  }

  .brand-logo-img {
    width: 100%;
    max-width: 190px;
    max-height: 140px;
  }

  .login-logo-img {
    width: min(210px, 86%);
  }
}

/* Sales / orders additions */
.sales-cta-login {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: rgba(124, 58, 237, .10);
    text-align: center;
}
.sales-cta-login p { margin: 8px 0 12px; font-size: 12px; }
.ticket-status-badge.progress,
.ticket-status-badge.pending,
.ticket-status-badge.closed,
.ticket-status-badge.canceled {
    white-space: nowrap;
}

/* Anexos de tickets */
.attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.55);
    color: var(--text-primary);
    font-size: 12px;
    text-decoration: none;
}
.attachment-chip:hover {
    border-color: var(--primary-color);
    text-decoration: none;
}
.attachment-chip span {
    color: var(--text-secondary);
    font-size: 11px;
}


/* Quadro de avisos importantes */
.important-notice {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 20px;
  margin: 0 0 20px 0;
  border: 1px solid rgba(245, 158, 11, 0.38);
  border-radius: 18px;
  background: rgba(245, 158, 11, 0.10);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.16);
}

.important-notice-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 22px;
  flex: 0 0 auto;
}

.important-notice-body strong {
  display: block;
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text);
}

.important-notice-body p {
  margin: 0 0 10px 0;
  color: var(--text);
  line-height: 1.55;
}

.important-notice-body small,
.important-notice-kicker {
  color: var(--text-muted);
  font-size: 12px;
}

.important-notice-kicker {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 800;
  margin-bottom: 4px;
}

.important-notice.notice-info {
  border-color: rgba(59, 130, 246, 0.38);
  background: rgba(59, 130, 246, 0.10);
}

.important-notice.notice-warning {
  border-color: rgba(245, 158, 11, 0.38);
  background: rgba(245, 158, 11, 0.10);
}

.important-notice.notice-danger {
  border-color: rgba(239, 68, 68, 0.42);
  background: rgba(239, 68, 68, 0.12);
}

/* Integração Clash API */
.clash-live-card {
    margin-top: 8px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: rgba(255,255,255,0.04);
}
.clash-live-error {
    color: var(--warning-light);
}
.clash-live-head {
    display: flex;
    align-items: center;
    gap: 8px;
}
.clash-clan-badge {
    width: 34px;
    height: 34px;
    object-fit: contain;
    flex: 0 0 auto;
}
.clash-live-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.clash-live-stats span {
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 11px;
}
.clash-troops-details {
    margin-top: 8px;
}
.clash-troops-details summary {
    cursor: pointer;
    font-weight: 700;
    font-size: 12px;
}
.clash-troop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(94px, 1fr));
    gap: 8px;
    margin-top: 8px;
}
.clash-troop-item {
    display: grid;
    grid-template-columns: 30px 1fr;
    grid-template-rows: auto auto;
    gap: 0 6px;
    align-items: center;
    padding: 7px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: rgba(0,0,0,0.08);
    min-width: 0;
}
.clash-troop-item .icon-img,
.clash-troop-item .icon-fallback {
    grid-row: 1 / span 2;
    width: 30px;
    height: 30px;
}
.clash-troop-item span {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.clash-troop-item b {
    font-size: 11px;
    color: var(--text-muted);
}
.clash-troop-item b.max {
    color: var(--success-light);
}

/* Status de doação calculado pelo nível do clã */
.clash-live-stats .donation-highlight {
    border-color: rgba(34, 197, 94, 0.55);
    background: rgba(34, 197, 94, 0.14);
}
.clash-live-stats .donation-highlight b {
    font-size: 14px;
}
.clash-troop-item.donates-full {
    border-color: rgba(34, 197, 94, 0.68);
    background: rgba(34, 197, 94, 0.12);
}
.clash-troop-item.donates-not-full {
    border-color: rgba(239, 68, 68, 0.70);
    background: rgba(239, 68, 68, 0.12);
}
.clash-troop-item em {
    grid-column: 2;
    font-size: 10px;
    font-style: normal;
    font-weight: 800;
    margin-top: 2px;
}
.clash-troop-item.donates-full em {
    color: var(--success-light);
}
.clash-troop-item.donates-not-full em {
    color: #fca5a5;
}
.clash-troop-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    font-size: 11px;
}
.clash-troop-legend span {
    border-radius: 999px;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
}
.clash-troop-legend .legend-full {
    border-color: rgba(34, 197, 94, 0.55);
    background: rgba(34, 197, 94, 0.10);
}
.clash-troop-legend .legend-not-full {
    border-color: rgba(239, 68, 68, 0.55);
    background: rgba(239, 68, 68, 0.10);
}

/* Estatísticas e filtro avançado Clash */
.clash-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
    margin: 12px 0 18px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: rgba(255,255,255,0.035);
}
.clash-filter label {
    display: grid;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
}
.clash-filter select,
.clash-filter input[type="date"] {
    min-height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    padding: 7px 9px;
}
.clash-stats-box {
    margin-top: 10px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: rgba(0,0,0,0.10);
}
.clash-stats-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}
.clash-stats-head .donation-highlight {
    border-radius: 999px;
    padding: 5px 10px;
    border: 1px solid rgba(34, 197, 94, 0.55);
    background: rgba(34, 197, 94, 0.14);
    white-space: nowrap;
    font-size: 12px;
}
.clash-chart {
    display: flex;
    align-items: end;
    gap: 6px;
    min-height: 132px;
    overflow-x: auto;
    padding: 8px 2px 2px;
}
.clash-chart-col {
    display: grid;
    align-items: end;
    justify-items: center;
    gap: 4px;
    min-width: 34px;
    flex: 0 0 auto;
}
.clash-chart-bar {
    width: 26px;
    min-height: 4px;
    border-radius: 8px 8px 3px 3px;
    background: linear-gradient(180deg, rgba(34,197,94,.85), rgba(34,197,94,.28));
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 2px;
}
.clash-chart-bar span {
    font-size: 9px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.clash-chart-col small {
    font-size: 10px;
    color: var(--text-muted);
}

/* Correção layout mobile e gráfico de Estatística de doações */
.clan-widget-grid {
  grid-template-columns: 1fr;
  align-items: start;
}

.mini-card,
.clash-live-card,
.clash-stats-box {
  min-width: 0;
}

.clash-filter {
  display: block;
}

.clash-filter-main {
  display: grid;
  grid-template-columns: minmax(180px, 1.25fr) minmax(140px, .8fr) minmax(140px, .8fr) auto;
  gap: 10px;
  align-items: end;
}

.clash-filter-main label,
.clash-filter-main select,
.clash-filter-main input[type="date"],
.clash-filter-main .btn {
  width: 100%;
}

.clash-filter-help {
  display: block;
  margin-top: 10px;
  color: var(--text-muted);
  line-height: 1.45;
}

.clash-live-card {
  padding: 14px;
}

.clash-live-head {
  align-items: flex-start;
}

.clash-live-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.clash-live-stats span {
  border-radius: 14px;
  padding: 8px 10px;
  line-height: 1.35;
  min-width: 0;
}

.clash-live-stats .donation-highlight {
  grid-column: span 2;
}

.clash-stats-box {
  padding: 14px;
  overflow: hidden;
}

.clash-stats-head {
  align-items: flex-start;
  margin-bottom: 12px;
}

.clash-stats-period {
  font-size: 12px !important;
  line-height: 1.4;
  margin-top: 2px;
}

.clash-stats-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.clash-stats-summary div {
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 10px;
  background: rgba(255,255,255,0.035);
  min-width: 0;
}

.clash-stats-summary span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.25;
  margin-bottom: 4px;
}

.clash-stats-summary b {
  display: block;
  color: var(--success-light);
  font-size: 18px;
  line-height: 1;
}

.clash-chart,
.clash-chart-col,
.clash-chart-bar {
  display: none !important;
}

.clash-chart-list {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.clash-chart-row {
  display: grid;
  grid-template-columns: 46px minmax(80px, 1fr) minmax(48px, auto);
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.clash-chart-date {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.clash-chart-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
  min-width: 0;
}

.clash-chart-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(34,197,94,.45), rgba(34,197,94,.95));
}

.clash-chart-value {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

.clash-empty-state {
  display: grid;
  gap: 4px;
  border: 1px dashed var(--border-color);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255,255,255,0.025);
}

.clash-empty-state strong {
  color: var(--text-primary);
  font-size: 13px;
}

.clash-empty-state span {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.clash-troop-grid {
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
}

.clash-troop-item {
  grid-template-columns: 34px minmax(0, 1fr);
  padding: 9px;
}

.clash-troop-item .icon-img,
.clash-troop-item .icon-fallback {
  width: 34px;
  height: 34px;
}

@media (max-width: 900px) {
  .clash-filter-main {
    grid-template-columns: 1fr 1fr;
  }

  .clash-filter-main label:first-child,
  .clash-filter-main .btn {
    grid-column: 1 / -1;
  }

  .clash-live-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .clash-stats-summary {
    grid-template-columns: 1fr;
  }

  .clash-troop-grid {
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  }
}

@media (max-width: 600px) {
  .clash-filter-main {
    grid-template-columns: 1fr;
  }

  .clash-live-card {
    padding: 12px;
    border-radius: 16px;
  }

  .clash-live-head {
    gap: 10px;
  }

  .clash-clan-badge {
    width: 30px;
    height: 30px;
  }

  .clash-live-stats {
    grid-template-columns: 1fr;
  }

  .clash-live-stats .donation-highlight {
    grid-column: auto;
  }

  .clash-chart-list {
    max-height: 240px;
  }

  .clash-chart-row {
    grid-template-columns: 42px minmax(0, 1fr) 44px;
    gap: 6px;
  }

  .clash-chart-date,
  .clash-chart-value {
    font-size: 11px;
  }

  .clash-troop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .clash-troop-item span {
    font-size: 10px;
  }

  .clash-troop-item b,
  .clash-troop-item em {
    font-size: 10px;
  }
}

/* =========================================================
   Padronização profissional adicional
   ========================================================= */
:focus-visible {
  outline: 3px solid rgba(124, 58, 237, 0.55);
  outline-offset: 2px;
}

.sidebar nav a.active {
  background: rgba(124, 58, 237, 0.22);
  border-color: rgba(167, 139, 250, 0.45);
  color: var(--text-primary);
}

.mobile-menu-toggle {
  display: none;
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border-color);
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.96);
  color: var(--text-primary);
  font-weight: 800;
  text-align: left;
  backdrop-filter: blur(12px);
}

.table-wrap,
.responsive-table {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.inline-form { display: inline; }

.btn.danger,
button.danger {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  color: #fff;
}

.empty-state {
  border: 1px dashed var(--border-color);
  border-radius: 16px;
  padding: 20px;
  background: rgba(255,255,255,0.03);
  color: var(--text-secondary);
  text-align: center;
}

@media (max-width: 900px) {
  .mobile-menu-toggle { display: block; }

  .app-shell {
    grid-template-columns: 1fr !important;
  }

  .sidebar {
    display: none;
    position: fixed;
    inset: 48px 0 auto 0;
    z-index: 60;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    border-radius: 0 0 18px 18px;
    border-right: 0;
    border-bottom: 1px solid var(--border-color);
  }

  body.menu-open .sidebar {
    display: block;
  }

  .main {
    min-width: 0;
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
  }

  table {
    min-width: 720px;
  }
}
/* Ações da tabela de usuários */
.user-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: stretch;
  min-width: 108px;
  max-width: 118px;
}

.user-actions form {
  margin: 0;
  width: 100%;
  display: block;
}

.user-actions .btn,
.btn-user-action {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
  white-space: nowrap;
  text-transform: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  margin: 0;
}

.user-actions .btn.danger {
  font-weight: 600;
}
/* Links clicaveis em descricoes e mensagens de tickets
   Nao aplica em botoes .btn para nao alterar o botao "Abrir link de pagamento". */
.chat a:not(.btn),
.bubble a:not(.btn),
.card p a:not(.btn),
.notice a:not(.btn) {
  color: #38bdf8;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  font-weight: 700;
}

.chat a:not(.btn):hover,
.bubble a:not(.btn):hover,
.card p a:not(.btn):hover,
.notice a:not(.btn):hover {
  color: #7dd3fc;
  text-decoration-thickness: 2px;
}

/* Garante que links usados como botao mantenham o visual original. */
a.btn,
a.btn:hover,
.notice a.btn,
.notice a.btn:hover {
  color: #fff;
  text-decoration: none;
}

/* =========================================================
   Correção definitiva: alinhamento do filtro "Seus Clãs e Contas"
   ========================================================= */
.clash-filter {
  display: block !important;
}

.clash-filter-main {
  display: grid !important;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 0.62fr) minmax(150px, 0.62fr) 120px !important;
  gap: 10px !important;
  align-items: end !important;
}

.clash-filter-main label {
  display: grid !important;
  grid-template-rows: 18px 40px !important;
  gap: 4px !important;
  align-items: end !important;
  margin: 0 !important;
  min-width: 0 !important;
}

.clash-filter-main select,
.clash-filter-main input[type="date"] {
  height: 40px !important;
  min-height: 40px !important;
  max-height: 40px !important;
  line-height: 40px !important;
  margin: 0 !important;
  padding: 0 12px !important;
  box-sizing: border-box !important;
}

.clash-filter-main .btn,
.clash-filter-main button.btn {
  height: 40px !important;
  min-height: 40px !important;
  max-height: 40px !important;
  margin: 0 !important;
  padding: 0 18px !important;
  align-self: end !important;
  line-height: 1 !important;
  transform: none !important;
}

.clash-filter-main .btn:hover,
.clash-filter-main button.btn:hover {
  transform: none !important;
}

@media (max-width: 900px) {
  .clash-filter-main {
    grid-template-columns: 1fr 1fr !important;
  }

  .clash-filter-main label:first-child,
  .clash-filter-main .btn,
  .clash-filter-main button.btn {
    grid-column: 1 / -1 !important;
  }
}

@media (max-width: 600px) {
  .clash-filter-main {
    grid-template-columns: 1fr !important;
  }
}

/* =========================================================
   Dashboard organizado por prioridade operacional
   ========================================================= */
.dashboard-section {
  margin-bottom: 28px;
}

.dashboard-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.dashboard-section-head h2 {
  font-size: 20px;
  line-height: 1.2;
  margin-bottom: 4px;
}

.dashboard-grid {
  display: grid;
  gap: 18px;
  margin-bottom: 24px;
}

.dashboard-grid-priority {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dashboard-grid-status,
.dashboard-grid-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-card {
  min-height: 150px;
  overflow: hidden;
}

.dashboard-card.compact {
  min-height: 132px;
}

.dashboard-card.action {
  min-height: 138px;
}

.dashboard-card.danger {
  border-color: rgba(239, 68, 68, 0.45);
}

.dashboard-card.warning {
  border-color: rgba(245, 158, 11, 0.45);
}

.dashboard-card.primary {
  border-color: rgba(124, 58, 237, 0.55);
}

.dashboard-card.danger::before {
  background: radial-gradient(circle, rgba(239, 68, 68, 0.16), transparent);
}

.dashboard-card.warning::before {
  background: radial-gradient(circle, rgba(245, 158, 11, 0.14), transparent);
}

.dashboard-card.primary::before {
  background: radial-gradient(circle, rgba(124, 58, 237, 0.16), transparent);
}

@media (max-width: 1200px) {
  .dashboard-grid-priority {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid-status,
  .dashboard-grid-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .dashboard-grid-priority,
  .dashboard-grid-status,
  .dashboard-grid-actions {
    grid-template-columns: 1fr;
  }

  .dashboard-section-head {
    align-items: stretch;
  }

  .dashboard-section-head .btn {
    width: 100%;
  }

  .dashboard-card,
  .dashboard-card.compact,
  .dashboard-card.action {
    min-height: auto;
  }
}

/* ============================================
   PWA - BANNER DE INSTALAÇÃO
   ============================================ */

.pwa-install-banner[hidden] {
  display: none !important;
}

.pwa-install-banner {
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 760px;
  margin: 0 auto;
  padding: 16px;
  border: 1px solid rgba(167, 139, 250, 0.35);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98));
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  backdrop-filter: blur(16px);
}

.pwa-install-copy {
  min-width: 0;
}

.pwa-install-copy strong {
  display: block;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
}

.pwa-install-copy p {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.pwa-install-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pwa-install-actions .btn {
  white-space: nowrap;
}

@media (max-width: 640px) {
  .pwa-install-banner {
    left: 12px;
    right: 12px;
    bottom: 12px;
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
  }

  .pwa-install-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .pwa-install-actions .btn {
    width: 100%;
    min-width: 0;
    padding-left: 10px;
    padding-right: 10px;
    font-size: 12px;
  }
}


/* =========================================================
   MOBILE OVERHAUL - base atualizada do projeto
   Ajustes globais de responsividade, alinhamento e toque.
   ========================================================= */

:root {
  --primary-color: var(--primary);
  --text: var(--text-primary);
  --text-color: var(--text-primary);
  --card-bg: var(--bg-card);
  --tap-size: 44px;
  --mobile-gap: 12px;
  --mobile-radius: 16px;
}

html {
  width: 100%;
  min-width: 320px;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  width: 100%;
  min-width: 320px;
  overflow-x: hidden;
}

img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
}

img,
svg,
video,
canvas {
  height: auto;
}

.main,
.app-shell,
.card,
.mini-card,
.notice,
.alert,
.important-notice,
.topbar,
.actions,
.searchbar,
.filter-grid,
.kpi-row,
.dashboard-section-head,
.dashboard-grid,
.grid,
.clan-widget-grid,
.bot-account-card,
.health-card,
.email-template-item,
.topgestor-map-card,
.war-history-card,
.bubble {
  min-width: 0;
}

.card > *,
.mini-card > * {
  position: relative;
  z-index: 1;
}

.card::before,
.mini-card::before {
  z-index: 0;
}

.main {
  max-width: none;
}

.grid-5 {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.btn,
a.btn,
input[type="submit"],
input[type="button"] {
  min-height: var(--tap-size);
  max-width: 100%;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn,
a.btn,
button.btn {
  white-space: normal;
  overflow-wrap: anywhere;
}

.btn[disabled],
button[disabled],
input[disabled],
select[disabled],
textarea[disabled] {
  cursor: not-allowed;
  opacity: .65;
}

.actions,
.searchbar,
.kpi-row,
.dashboard-section-head,
.pwa-install-actions,
.topgestor-filter-actions,
.war-actions,
.bot-actions {
  display: flex;
  gap: var(--mobile-gap);
  flex-wrap: wrap;
}

.actions form,
.searchbar form,
.topgestor-filter-actions form,
.war-actions form,
.bot-actions form,
.inline-form {
  margin: 0;
}

.actions > *,
.searchbar > *,
.kpi-row > *,
.dashboard-section-head > *,
.topgestor-filter-actions > *,
.war-actions > *,
.bot-actions > * {
  min-width: 0;
}

input,
select,
textarea {
  min-height: var(--tap-size);
  max-width: 100%;
}

textarea {
  line-height: 1.45;
}

select {
  text-overflow: ellipsis;
}

label {
  max-width: 100%;
}

.field-help,
.muted,
.notice,
.alert,
.important-notice-body,
.bubble,
.card p,
.mini-card p,
td,
th {
  overflow-wrap: anywhere;
}

pre,
code,
.health-log-box,
.health-meta-table,
.email-preview-frame {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrap,
.responsive-table,
div[style*="overflow-x"] {
  max-width: 100%;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}

.table,
table {
  max-width: 100%;
}

.table th,
.table td {
  white-space: normal;
  overflow-wrap: anywhere;
}

.ticket-status-badge,
.badge,
.pill,
.attachment-chip {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.stat b {
  font-size: clamp(28px, 8vw, 42px);
  line-height: 1.05;
}

.stat span,
.stat small {
  overflow-wrap: anywhere;
}

.filter-grid,
.topgestor-filter-form,
.war-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: 12px;
  align-items: end;
}

.filter-grid input,
.filter-grid select,
.filter-grid .btn,
.filter-grid button,
.filter-grid a.btn,
.topgestor-filter-form input,
.topgestor-filter-form select,
.topgestor-filter-form .btn,
.war-form-grid input,
.war-form-grid select,
.war-form-grid .btn {
  width: 100%;
  margin: 0;
}

.searchbar input,
.lookup-row input {
  min-width: min(240px, 100%);
}

.catalog,
.bot-account-grid,
.bot-summary-grid,
.health-grid,
.health-grid-3,
.email-template-grid,
.email-actions-panel,
.email-search-results,
.topgestor-audit-grid,
.war-summary-grid,
.war-history-grid,
.steps-grid,
.grid-cards,
.sales-grid,
.clash-preview-grid,
.preview-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 16px;
}

.email-filter-tabs,
.email-template-tags,
.copy-row,
.payment-list,
.bot-account-meta,
.bot-linked-users,
.clash-troop-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.email-filter-tabs .btn,
.copy-row .btn,
.bot-inline-form .btn,
.lookup-row .btn,
.topgestor-filter-actions .btn,
.war-actions .btn {
  flex: 0 1 auto;
}

.bot-account-top,
.bot-maintenance-head,
.bot-clan-head,
.war-report-head,
.clash-preview-header,
.health-status-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.bot-account-top > *,
.bot-maintenance-head > *,
.bot-clan-head > *,
.war-report-head > *,
.clash-preview-header > *,
.health-status-line > * {
  min-width: 0;
}

.chat {
  width: 100%;
  overflow: hidden;
}

.bubble {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.bubble img,
.chat img {
  max-width: 100%;
  border-radius: 10px;
}

.attachment-list {
  min-width: 0;
}

.attachment-chip {
  min-height: 36px;
  border-radius: 12px;
}

.login-page,
.sales-wrap,
.container {
  width: 100%;
  overflow-x: hidden;
}

.login-card,
.sales-hero,
.confirm-box,
.clash-preview,
.portal-preview,
.preview-panel {
  max-width: 100%;
}

@media (hover: none) and (pointer: coarse) {
  .card:hover,
  .mini-card:hover,
  .btn:hover,
  .sidebar nav a:hover,
  .check-card:hover {
    transform: none !important;
  }

  .card:hover,
  .mini-card:hover {
    box-shadow: var(--shadow-lg);
  }
}

@media (max-width: 1200px) {
  .grid-4,
  .grid-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  body.menu-open {
    overflow: hidden;
  }

  .mobile-menu-toggle {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 120;
    border: 0;
    border-bottom: 1px solid var(--border-color-light);
    padding: 12px 16px;
    background: rgba(15, 23, 42, .98);
    color: var(--text-primary);
    font-weight: 800;
    text-align: left;
    backdrop-filter: blur(14px);
  }

  .app-shell {
    display: block !important;
    min-height: calc(100dvh - 52px);
  }

  .sidebar {
    display: none !important;
    position: fixed !important;
    inset: 52px 0 auto 0 !important;
    z-index: 110;
    width: 100% !important;
    height: auto !important;
    max-height: calc(100dvh - 52px) !important;
    padding: 14px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    border-right: 0 !important;
    border-bottom: 1px solid var(--border-color-light) !important;
    border-radius: 0 0 18px 18px !important;
    background: linear-gradient(180deg, rgba(30, 41, 59, .98), rgba(15, 23, 42, .99)) !important;
    box-shadow: 0 18px 45px rgba(0, 0, 0, .45) !important;
  }

  body.menu-open .sidebar {
    display: flex !important;
  }

  .sidebar .brand,
  .sidebar .brand-with-image {
    justify-content: center !important;
    width: 100%;
    margin: 0 0 12px 0 !important;
    padding: 0 0 12px 0 !important;
    border-bottom: 1px solid var(--border-color) !important;
  }

  .brand-logo-img {
    max-width: 170px !important;
    max-height: 96px !important;
  }

  .sidebar nav {
    width: 100%;
    flex-direction: column !important;
    gap: 8px !important;
    margin: 0 !important;
  }

  .sidebar nav a {
    width: 100%;
    min-height: var(--tap-size);
    justify-content: flex-start;
    padding: 11px 13px !important;
    transform: none !important;
  }

  .sidebar .user-card {
    width: 100%;
    margin-top: 12px !important;
  }

  .main {
    width: 100%;
    padding: 18px !important;
    overflow-x: hidden;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch !important;
    gap: 10px;
    margin-bottom: 22px;
    padding-bottom: 16px;
  }

  .topbar h1 {
    font-size: clamp(22px, 7vw, 30px);
    line-height: 1.15;
    overflow-wrap: anywhere;
  }

  .topbar p {
    font-size: 13px;
  }

  .grid,
  .grid-2,
  .grid-3,
  .grid-4,
  .grid-5,
  .dashboard-grid-priority,
  .dashboard-grid-status,
  .dashboard-grid-actions,
  .clan-widget-grid {
    grid-template-columns: 1fr !important;
  }

  .card,
  .mini-card,
  .notice,
  .alert,
  .important-notice {
    border-radius: var(--mobile-radius);
  }

  .card {
    padding: 18px !important;
  }

  .actions,
  .searchbar,
  .kpi-row,
  .dashboard-section-head,
  .bot-actions,
  .war-actions,
  .topgestor-filter-actions {
    align-items: stretch !important;
  }

  .table,
  table {
    min-width: 720px;
  }

  .table th,
  .table td {
    padding: 10px 9px;
    vertical-align: top;
  }

  .ticket-status-badge,
  .badge,
  .pill {
    align-items: center;
  }

  .bubble {
    max-width: 92% !important;
  }
}

@media (max-width: 700px) {
  body {
    font-size: 15px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .main {
    padding: 14px !important;
  }

  .login-page {
    padding: 14px;
    align-items: start;
  }

  .login-card {
    padding: 24px 18px !important;
    border-radius: 18px;
  }

  .actions,
  .searchbar,
  .filter-grid,
  .topgestor-filter-form,
  .war-form-grid,
  .lookup-row,
  .copy-row,
  .pwa-install-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100%;
  }

  .actions > *,
  .actions > form,
  .actions > a,
  .actions > button,
  .searchbar > *,
  .filter-grid > *,
  .topgestor-filter-form > *,
  .war-form-grid > *,
  .lookup-row > *,
  .copy-row > *,
  .pwa-install-actions > * {
    width: 100% !important;
  }

  .actions .btn,
  .actions button,
  .actions a.btn,
  .actions form .btn,
  .searchbar .btn,
  .filter-grid .btn,
  .filter-grid button,
  .filter-grid a.btn,
  .lookup-row .btn,
  .copy-row .btn,
  .topgestor-filter-actions .btn,
  .war-actions .btn,
  .dashboard-section-head .btn {
    width: 100% !important;
  }

  .user-actions {
    max-width: none !important;
    min-width: 132px;
  }

  .btn-user-action,
  .user-actions .btn {
    min-height: 38px;
    white-space: normal;
  }

  .card {
    padding: 15px !important;
  }

  .card h2,
  .mini-card h3,
  .dashboard-section-head h2 {
    overflow-wrap: anywhere;
  }

  .stat b {
    font-size: clamp(30px, 16vw, 42px);
  }

  .kpi-row,
  .payment-list,
  .bot-account-meta,
  .bot-linked-users,
  .email-filter-tabs,
  .email-template-tags {
    gap: 8px;
  }

  .pill,
  .badge,
  .ticket-status-badge {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .attachment-list {
    display: grid;
    grid-template-columns: 1fr;
  }

  .attachment-chip {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .important-notice {
    flex-direction: column;
    gap: 10px;
    padding: 15px !important;
  }

  .important-notice-icon {
    width: 38px;
    height: 38px;
  }

  .bubble {
    max-width: 100% !important;
    width: 100%;
    padding: 12px 13px;
  }

  .bubble.me,
  .bubble.support {
    align-self: stretch;
  }

  .catalog,
  .bot-account-grid,
  .bot-summary-grid,
  .health-grid,
  .health-grid-3,
  .email-template-grid,
  .email-actions-panel,
  .email-search-results,
  .topgestor-audit-grid,
  .war-summary-grid,
  .war-history-grid,
  .steps-grid,
  .grid-cards,
  .sales-grid,
  .clash-preview-grid,
  .preview-stats,
  .clash-live-stats,
  .clash-stats-summary {
    grid-template-columns: 1fr !important;
  }

  .clash-troop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .pwa-install-banner {
    left: 10px !important;
    right: 10px !important;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px)) !important;
    width: auto !important;
    max-width: none !important;
  }
}

@media (max-width: 420px) {
  .main {
    padding: 12px !important;
  }

  .card,
  .mini-card,
  .notice,
  .alert {
    padding: 13px !important;
    border-radius: 14px;
  }

  .btn,
  a.btn,
  button.btn {
    padding-left: 12px;
    padding-right: 12px;
    font-size: 13px;
  }

  .topbar h1 {
    font-size: 21px;
  }

  .brand-logo-img {
    max-width: 150px !important;
    max-height: 86px !important;
  }

  .clash-troop-grid {
    grid-template-columns: 1fr !important;
  }
}


/* =========================================================
   MOBILE REFINEMENTS - pacote revisado sobre o ZIP atualizado
   Escopo do menu, tabelas e componentes com rolagem segura.
   ========================================================= */

@media (max-width: 900px) {
  .sidebar nav {
    display: flex !important;
  }

  .footer-nav {
    display: flex;
    width: auto;
  }

  .card,
  .mini-card {
    max-width: 100%;
  }

  .card:has(.table),
  .card:has(table) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-wrap table,
  .responsive-table table,
  div[style*="overflow-x"] table {
    min-width: 720px;
  }

  .actions [style*="flex: 1"],
  .actions [style*="flex:1"] {
    min-width: 0;
  }
}

@media (max-width: 700px) {
  .footer-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .footer-nav a {
    width: 100%;
    justify-content: center;
  }

  .pwa-install-actions {
    grid-template-columns: 1fr !important;
  }

  .ticket-status-badge .status-dot {
    flex: 0 0 auto;
  }
}

@supports not selector(:has(*)) {
  @media (max-width: 900px) {
    .card {
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
    }
  }
}

/* ============================================
   DASHBOARD DO USUARIO - STATUS DA CONTA
   ============================================ */

.bot-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  flex: 0 0 auto;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor, 0 0 12px currentColor;
  animation: botStatusBlink 1.25s ease-in-out infinite;
}

.bot-status-online .bot-status-dot,
.user-bot-status-online .bot-status-dot {
  color: var(--success-light);
  animation-duration: 1.15s;
}

.bot-status-no_recent_donation .bot-status-dot,
.bot-status-waiting_first_check .bot-status-dot,
.bot-status-missing_tag .bot-status-dot,
.user-bot-status-waiting .bot-status-dot {
  color: var(--warning-light);
  animation-duration: 1.75s;
}

.bot-status-possible_offline .bot-status-dot,
.bot-status-api_error .bot-status-dot,
.user-bot-status-offline .bot-status-dot {
  color: var(--danger-light);
  animation-duration: .85s;
}

@keyframes botStatusBlink {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 0 0 currentColor, 0 0 12px currentColor;
  }
  50% {
    opacity: .38;
    transform: scale(.72);
    box-shadow: 0 0 0 7px transparent, 0 0 3px currentColor;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bot-status-dot {
    animation: none;
  }
}

.dashboard-user-bots-section .clash-filter {
  margin-bottom: 18px;
}

.user-bot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  align-items: start;
}

.user-bot-card {
  padding: 18px;
  overflow: visible;
}

.user-bot-card::before {
  opacity: .45;
}

.user-bot-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.user-bot-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-bot-title strong,
.user-bot-title small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-bot-title strong {
  color: var(--text-primary);
  font-size: 16px;
}

.user-bot-title small {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}

.user-bot-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 1px solid var(--border-color-light);
  background: rgba(124, 58, 237, .14);
  flex: 0 0 auto;
}

.user-bot-status-line {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 14px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-color-light);
  background: rgba(255, 255, 255, .035);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.25;
}

.user-bot-status-line strong {
  font-size: 13px;
  font-weight: 800;
  color: inherit;
}

.user-bot-status-online {
  border-color: rgba(16, 185, 129, .38);
  background: rgba(16, 185, 129, .10);
}

.user-bot-status-offline {
  border-color: rgba(239, 68, 68, .38);
  background: rgba(239, 68, 68, .10);
}

.user-bot-status-waiting {
  border-color: rgba(245, 158, 11, .38);
  background: rgba(245, 158, 11, .10);
}

.user-bot-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.user-bot-metric {
  min-width: 0;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 10px;
  background: rgba(255, 255, 255, .035);
}

.user-bot-metric span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.25;
  margin-bottom: 5px;
}

.user-bot-metric b {
  display: block;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.user-bot-metric.primary b {
  color: var(--success-light);
  font-size: 18px;
}

.user-bot-status-reason {
  margin: 0 0 12px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.user-bot-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.user-bot-details {
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

.user-bot-details summary {
  cursor: pointer;
  color: var(--primary-light);
  font-size: 13px;
  font-weight: 800;
  list-style: none;
}

.user-bot-details summary::-webkit-details-marker {
  display: none;
}

.user-bot-details summary::after {
  content: ' +';
}

.user-bot-details[open] summary::after {
  content: ' -';
}

.user-bot-details-body {
  margin-top: 10px;
}

@media (max-width: 900px) {
  .user-bot-grid {
    grid-template-columns: 1fr;
  }

  .user-bot-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .user-bot-card-head {
    flex-direction: column;
    align-items: stretch;
  }

  .user-bot-status-line,
  .user-bot-actions .btn,
  .user-bot-actions .badge {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .user-bot-metrics {
    grid-template-columns: 1fr;
  }
}


/* =========================================================
   CLASHBOT VISUAL OVERHAUL 2026 - Gamer Premium Mobile First
   Escopo: camada visual responsiva sem alterar regras de negócio.
   ========================================================= */

:root {
  --primary: #8b5cf6;
  --primary-light: #c4b5fd;
  --primary-dark: #4c1d95;
  --secondary: #22d3ee;
  --secondary-light: #67e8f9;
  --accent: #f59e0b;
  --accent-light: #fbbf24;
  --success: #22c55e;
  --success-light: #86efac;
  --danger: #ef4444;
  --danger-light: #fca5a5;
  --warning: #f59e0b;
  --warning-light: #fde68a;
  --info: #38bdf8;

  --bg-darker: #050816;
  --bg-dark: #0a1020;
  --bg-card: rgba(18, 27, 50, .84);
  --bg-card-hover: rgba(31, 45, 78, .92);
  --bg-glass: rgba(15, 23, 42, .72);
  --bg-glass-strong: rgba(15, 23, 42, .92);
  --text-primary: #f8fafc;
  --text-secondary: #d7e1ef;
  --text-muted: #99abc2;
  --border-color: rgba(148, 163, 184, .16);
  --border-color-light: rgba(196, 181, 253, .26);

  --primary-color: var(--primary);
  --text: var(--text-primary);
  --text-color: var(--text-primary);
  --card-bg: var(--bg-card);

  --radius-xs: 10px;
  --radius-sm: 14px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 30px;
  --tap-size: 46px;
  --mobile-gap: 12px;
  --mobile-radius: 18px;

  --shadow-sm: 0 6px 18px rgba(0, 0, 0, .22);
  --shadow-md: 0 12px 34px rgba(0, 0, 0, .30);
  --shadow-lg: 0 20px 55px rgba(0, 0, 0, .42);
  --shadow-xl: 0 28px 80px rgba(0, 0, 0, .55);
  --glow-primary: 0 0 34px rgba(139, 92, 246, .34);
  --glow-cyan: 0 0 32px rgba(34, 211, 238, .24);
  --glow-success: 0 0 24px rgba(34, 197, 94, .32);
  --glow-warning: 0 0 24px rgba(245, 158, 11, .30);
  --glow-danger: 0 0 24px rgba(239, 68, 68, .30);
}

* { scrollbar-width: thin; scrollbar-color: rgba(139, 92, 246, .55) rgba(15, 23, 42, .35); }

html {
  background: var(--bg-darker);
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% -8%, rgba(139, 92, 246, .28), transparent 32rem),
    radial-gradient(circle at 88% 8%, rgba(34, 211, 238, .18), transparent 28rem),
    radial-gradient(circle at 48% 110%, rgba(245, 158, 11, .10), transparent 24rem),
    linear-gradient(145deg, #050816 0%, #08111f 42%, #111827 100%);
  color: var(--text-primary);
  letter-spacing: .005em;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.022) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.9), rgba(0,0,0,.12));
}

::selection { background: rgba(34, 211, 238, .32); color: #fff; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(34, 211, 238, .62);
  outline-offset: 3px;
}

.app-shell {
  background: transparent;
  min-height: 100dvh;
  width: 100%;
  overflow-x: clip;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(14, 22, 42, .96), rgba(6, 10, 24, .98)),
    radial-gradient(circle at 40% 0%, rgba(139, 92, 246, .22), transparent 18rem);
  border-right: 1px solid rgba(196, 181, 253, .18);
  box-shadow: 18px 0 60px rgba(0, 0, 0, .38), inset -1px 0 rgba(255,255,255,.03);
  backdrop-filter: blur(20px);
}

.brand,
.brand-with-image {
  padding: 14px;
  margin-bottom: 24px;
  border: 1px solid rgba(196, 181, 253, .18);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(139, 92, 246, .16), rgba(34, 211, 238, .08));
  box-shadow: inset 0 1px rgba(255,255,255,.08), var(--shadow-sm);
}

.logo,
.user-bot-icon,
.important-notice-icon {
  background: linear-gradient(135deg, #8b5cf6 0%, #22d3ee 100%);
  box-shadow: var(--glow-primary), inset 0 1px rgba(255,255,255,.22);
}

.brand strong { letter-spacing: .02em; }
.brand span { color: var(--text-muted); }

.sidebar nav { gap: 8px; }
.sidebar nav a {
  min-height: 44px;
  border-radius: 15px;
  color: #cbd5e1;
  border: 1px solid transparent;
  background: linear-gradient(135deg, rgba(255,255,255,.025), rgba(255,255,255,0));
  isolation: isolate;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(139, 92, 246, .28), rgba(34, 211, 238, .12));
  border-color: rgba(196, 181, 253, .32);
  transform: translateX(4px);
  box-shadow: 0 12px 28px rgba(0,0,0,.20), var(--glow-primary);
}

.sidebar nav a.active::after {
  content: '';
  position: absolute;
  inset: 9px auto 9px 6px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--secondary), var(--primary-light));
  box-shadow: 0 0 14px rgba(34, 211, 238, .8);
}

.logout-link {
  color: #fecaca !important;
  background: rgba(239, 68, 68, .08) !important;
}

.user-card {
  border-radius: var(--radius-lg);
  border-color: rgba(196, 181, 253, .22);
  background:
    radial-gradient(circle at 0% 0%, rgba(34, 211, 238, .16), transparent 16rem),
    linear-gradient(135deg, rgba(139, 92, 246, .18), rgba(15, 23, 42, .82));
  box-shadow: inset 0 1px rgba(255,255,255,.08), var(--shadow-sm);
}

.main {
  flex: 1;
  width: min(100%, calc(100vw - 280px));
  padding: clamp(16px, 2.3vw, 34px);
  background: transparent;
  overflow-x: hidden;
}

.topbar {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(196, 181, 253, .22);
  border-radius: var(--radius-xl);
  padding: clamp(18px, 3vw, 30px);
  margin-bottom: clamp(18px, 3vw, 30px);
  background:
    radial-gradient(circle at 88% 20%, rgba(34, 211, 238, .18), transparent 18rem),
    linear-gradient(135deg, rgba(139, 92, 246, .22), rgba(15, 23, 42, .82) 52%, rgba(5, 8, 22, .74));
  box-shadow: var(--shadow-md), inset 0 1px rgba(255,255,255,.08);
}

.topbar::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 0 28%, rgba(255,255,255,.055) 42%, transparent 58% 100%);
}

.topbar h1 {
  font-size: clamp(24px, 5vw, 40px);
  line-height: 1.05;
  letter-spacing: -.035em;
  text-wrap: balance;
  background: linear-gradient(90deg, #fff, #dbeafe 48%, #a5f3fc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.topbar p { margin-top: 8px; color: var(--text-muted); }
.topbar [data-local-time] { color: var(--secondary-light); font-weight: 800; }

.grid,
.dashboard-grid,
.catalog,
.clan-widget-grid,
.bot-account-grid,
.bot-summary-grid,
.user-bot-grid,
.health-grid,
.email-template-grid,
.email-actions-panel,
.email-search-results,
.topgestor-audit-grid,
.war-summary-grid,
.war-history-grid,
.steps-grid,
.grid-cards,
.sales-grid,
.clash-preview-grid,
.preview-stats {
  gap: clamp(12px, 2vw, 20px);
}

.card,
.mini-card,
.dashboard-card,
.service-card,
.health-card,
.check-card,
.login-card,
.portal-card,
.notice,
.important-notice,
.clash-live-card,
.clash-stats-box,
.bot-account-card,
.user-bot-card,
.topgestor-map-card,
.email-search-card,
.email-log-item,
.war-history-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(196, 181, 253, .18);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, rgba(18, 27, 50, .90), rgba(9, 14, 30, .82)),
    radial-gradient(circle at 100% 0%, rgba(139, 92, 246, .14), transparent 16rem);
  box-shadow: var(--shadow-md), inset 0 1px rgba(255,255,255,.055);
  backdrop-filter: blur(14px);
}

.card::before,
.mini-card::before,
.dashboard-card::before,
.user-bot-card::before,
.clash-live-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  pointer-events: none;
  background:
    radial-gradient(circle at 10% 0%, rgba(34, 211, 238, .12), transparent 18rem),
    linear-gradient(110deg, transparent 0 28%, rgba(255,255,255,.04) 44%, transparent 58% 100%);
  opacity: .82;
}

.card > *,
.mini-card > *,
.dashboard-card > *,
.user-bot-card > *,
.clash-live-card > * { position: relative; z-index: 1; }

.card:hover,
.mini-card:hover,
.dashboard-card:hover,
.check-card:hover,
.user-bot-card:hover {
  transform: translateY(-3px);
  border-color: rgba(34, 211, 238, .34);
  box-shadow: var(--shadow-lg), var(--glow-cyan), inset 0 1px rgba(255,255,255,.08);
}

.card h2,
.card h3,
.mini-card h3,
.dashboard-section-head h2,
.category-title,
.section-title {
  color: #fff;
  letter-spacing: -.02em;
  text-wrap: balance;
}

.muted,
.field-help,
.card p,
.mini-card p { color: var(--text-muted); }

.stat {
  min-height: 150px;
  justify-content: space-between;
  background:
    radial-gradient(circle at 85% 15%, rgba(34, 211, 238, .15), transparent 11rem),
    linear-gradient(145deg, rgba(18,27,50,.94), rgba(9,14,30,.86));
}

.stat span {
  text-transform: uppercase;
  letter-spacing: .085em;
  color: #a9bad1;
}

.stat b {
  background: linear-gradient(90deg, #fff, #a5f3fc 55%, #c4b5fd);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
}

.btn,
a.btn,
button.btn,
input[type="submit"],
input[type="button"] {
  min-height: var(--tap-size);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid rgba(196, 181, 253, .26);
  color: #fff;
  font-weight: 850;
  letter-spacing: .015em;
  background: linear-gradient(135deg, #8b5cf6, #06b6d4);
  box-shadow: 0 12px 26px rgba(6, 182, 212, .18), 0 10px 28px rgba(139, 92, 246, .22), inset 0 1px rgba(255,255,255,.20);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, filter .18s ease;
}

.btn::before,
a.btn::before,
button.btn::before {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.26), transparent);
}

.btn:hover,
a.btn:hover,
button.btn:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,.34);
  filter: saturate(1.12) brightness(1.04);
  box-shadow: 0 16px 34px rgba(6, 182, 212, .22), 0 12px 34px rgba(139, 92, 246, .28), inset 0 1px rgba(255,255,255,.24);
}

.btn.secondary,
a.btn.secondary,
button.btn.secondary {
  color: #dbeafe;
  background: linear-gradient(135deg, rgba(51, 65, 85, .92), rgba(15, 23, 42, .90));
  border-color: rgba(148, 163, 184, .24);
  box-shadow: var(--shadow-sm), inset 0 1px rgba(255,255,255,.07);
}

.btn.danger,
a.btn.danger,
button.btn.danger {
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #f97316);
  border-color: rgba(252, 165, 165, .34);
  box-shadow: 0 14px 30px rgba(239, 68, 68, .23), inset 0 1px rgba(255,255,255,.18);
}

.btn.success,
a.btn.success,
button.btn.success {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  border-color: rgba(134, 239, 172, .34);
}

button,
.btn,
a.btn,
input,
select,
textarea { touch-action: manipulation; }

input,
select,
textarea {
  border-radius: 15px;
  border: 1px solid rgba(148, 163, 184, .22);
  color: var(--text-primary);
  background: rgba(3, 7, 18, .48);
  box-shadow: inset 0 1px rgba(255,255,255,.035);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(34, 211, 238, .52);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, .10), inset 0 1px rgba(255,255,255,.06);
}

input::placeholder,
textarea::placeholder { color: rgba(203, 213, 225, .58); }

.table-wrap,
.responsive-table,
div[style*="overflow-x"] {
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, .14);
  background: rgba(2, 6, 23, .22);
}

.table,
table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.table th,
table th {
  background: linear-gradient(135deg, rgba(139, 92, 246, .18), rgba(34, 211, 238, .10));
  color: #eaf2ff;
  font-size: 12px;
  letter-spacing: .065em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(196, 181, 253, .17);
}

.table td,
table td {
  border-bottom: 1px solid rgba(148, 163, 184, .10);
  color: var(--text-secondary);
}

.table tr:hover,
table tr:hover { background: rgba(34, 211, 238, .055); }

.badge,
.pill,
.ticket-status-badge,
.bot-status-badge,
.attachment-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 30px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, .20);
  background: rgba(15, 23, 42, .64);
  color: #dbeafe;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
  box-shadow: inset 0 1px rgba(255,255,255,.06);
}

.badge.success,
.badge.closed,
.ticket-status-badge.closed,
.bot-status-online,
.bot-status-badge.success,
.topgestor-bot-status.ok {
  color: #bbf7d0 !important;
  border-color: rgba(34, 197, 94, .34) !important;
  background: rgba(34, 197, 94, .12) !important;
}

.badge.warning,
.badge.pending,
.ticket-status-badge.pending,
.ticket-status-badge.progress,
.bot-status-no_recent_donation,
.bot-status-waiting_first_check,
.bot-status-missing_tag,
.topgestor-bot-status.warning {
  color: #fde68a !important;
  border-color: rgba(245, 158, 11, .34) !important;
  background: rgba(245, 158, 11, .12) !important;
}

.badge.danger,
.badge.error,
.badge.urgent,
.badge.canceled,
.ticket-status-badge.canceled,
.ticket-status-badge.urgent,
.bot-status-possible_offline,
.bot-status-api_error,
.topgestor-bot-status.error {
  color: #fecaca !important;
  border-color: rgba(239, 68, 68, .36) !important;
  background: rgba(239, 68, 68, .12) !important;
}

.badge.open,
.ticket-status-badge.open,
.badge.primary,
.badge.info {
  color: #bae6fd !important;
  border-color: rgba(56, 189, 248, .36) !important;
  background: rgba(56, 189, 248, .12) !important;
}

.status-dot,
.bot-status-dot,
.ticket-status-badge .status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor, 0 0 16px currentColor;
  animation: clashbotPulseDot 1.35s ease-in-out infinite;
}

@keyframes clashbotPulseDot {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 currentColor, 0 0 14px currentColor; }
  50% { opacity: .42; transform: scale(.72); box-shadow: 0 0 0 8px transparent, 0 0 4px currentColor; }
}

.alert,
.notice,
.important-notice {
  color: var(--text-secondary);
  border-radius: var(--radius-lg);
  border-color: rgba(196, 181, 253, .18);
}

.alert.success,
.notice.success {
  background: linear-gradient(135deg, rgba(34, 197, 94, .15), rgba(15, 23, 42, .78));
  border-color: rgba(34, 197, 94, .30);
}

.alert.error,
.notice.error,
.notice.danger-notice {
  background: linear-gradient(135deg, rgba(239, 68, 68, .15), rgba(15, 23, 42, .78));
  border-color: rgba(239, 68, 68, .30);
}

.alert.warning,
.notice.warning,
.important-notice.notice-warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, .15), rgba(15, 23, 42, .78));
  border-color: rgba(245, 158, 11, .30);
}

.important-notice.notice-info {
  background: linear-gradient(135deg, rgba(56, 189, 248, .15), rgba(15, 23, 42, .78));
  border-color: rgba(56, 189, 248, .30);
}

.chat {
  gap: 12px;
  padding: 4px 0;
}

.bubble {
  max-width: min(760px, 84%);
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: 22px;
  background: rgba(15, 23, 42, .72);
  box-shadow: var(--shadow-sm);
  overflow-wrap: anywhere;
}

.bubble.me {
  background: linear-gradient(135deg, rgba(139, 92, 246, .42), rgba(34, 211, 238, .18));
  border-color: rgba(196, 181, 253, .28);
}

.bubble.support {
  background: linear-gradient(135deg, rgba(22, 163, 74, .18), rgba(15, 23, 42, .82));
  border-color: rgba(134, 239, 172, .22);
}

.attachment-list,
.attachments { gap: 8px; }
.attachment-chip { background: rgba(34, 211, 238, .10); border-color: rgba(34, 211, 238, .22); }

.searchbar,
.filter-grid,
.clash-filter,
.topgestor-filter-form,
.war-form-grid,
.lookup-row,
.copy-row {
  border-radius: var(--radius-lg);
}

.clash-filter {
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, .14);
  background: rgba(2, 6, 23, .22);
}

.user-bot-status-line {
  box-shadow: inset 0 1px rgba(255,255,255,.06);
}

.user-bot-status-online { box-shadow: var(--glow-success), inset 0 1px rgba(255,255,255,.06); }
.user-bot-status-waiting { box-shadow: var(--glow-warning), inset 0 1px rgba(255,255,255,.06); }
.user-bot-status-offline { box-shadow: var(--glow-danger), inset 0 1px rgba(255,255,255,.06); }

.user-bot-metric,
.bot-monitor-box,
.clash-troop-item,
.health-status-line,
.topgestor-audit-item,
.email-test-warning,
.danger-notice,
.confirm-box,
.note-box {
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, .14);
  background: rgba(2, 6, 23, .24);
  box-shadow: inset 0 1px rgba(255,255,255,.035);
}

.clash-chart-track {
  background: rgba(15, 23, 42, .8);
  border: 1px solid rgba(148, 163, 184, .14);
}

.clash-chart-fill,
.clash-chart-bar span {
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  box-shadow: 0 0 18px rgba(34, 211, 238, .24);
}

.pwa-install-banner {
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  border-radius: 24px;
  background:
    radial-gradient(circle at 100% 0%, rgba(34, 211, 238, .18), transparent 16rem),
    linear-gradient(135deg, rgba(18, 27, 50, .96), rgba(5, 8, 22, .96));
  border-color: rgba(196, 181, 253, .30);
  box-shadow: var(--shadow-xl), var(--glow-primary), inset 0 1px rgba(255,255,255,.08);
}

.mobile-menu-toggle {
  border-radius: 999px;
  border: 1px solid rgba(196, 181, 253, .28);
  background: linear-gradient(135deg, rgba(139, 92, 246, .96), rgba(6, 182, 212, .90));
  box-shadow: var(--shadow-md), var(--glow-primary);
}

.login-page,
.sales-wrap {
  background:
    radial-gradient(circle at 20% 0%, rgba(139, 92, 246, .30), transparent 26rem),
    radial-gradient(circle at 92% 12%, rgba(34, 211, 238, .18), transparent 24rem),
    linear-gradient(145deg, #050816, #0b1221);
}

.login-card,
.sales-hero,
.hero,
.cta-section {
  border-color: rgba(196, 181, 253, .24);
  background:
    radial-gradient(circle at 85% 0%, rgba(34, 211, 238, .16), transparent 18rem),
    linear-gradient(145deg, rgba(18, 27, 50, .92), rgba(5, 8, 22, .86));
}

.footer {
  border-top: 1px solid rgba(196, 181, 253, .14);
  background: rgba(5, 8, 22, .78);
}

@media (min-width: 901px) {
  .sidebar { width: 286px; }
  .main { width: min(100%, calc(100vw - 286px)); }
  .dashboard-grid-priority { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dashboard-grid-status,
  .dashboard-grid-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1200px) {
  .grid-4,
  .grid-5,
  .dashboard-grid-priority { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

@media (max-width: 900px) {
  .app-shell { display: block; }
  .main { width: 100%; padding: 72px 16px 18px !important; }

  .mobile-menu-toggle {
    display: inline-flex !important;
    position: fixed;
    left: 12px;
    right: 12px;
    top: calc(10px + env(safe-area-inset-top, 0px));
    width: auto;
    z-index: 10001;
    min-height: 48px;
  }

  .sidebar {
    position: fixed;
    z-index: 10000;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(88vw, 340px);
    height: 100dvh;
    padding: calc(74px + env(safe-area-inset-top, 0px)) 14px calc(18px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-105%);
    transition: transform .24s ease;
    border-radius: 0 26px 26px 0;
  }

  body.menu-open .sidebar { transform: translateX(0); }
  body.menu-open::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(2, 6, 23, .66);
    backdrop-filter: blur(5px);
  }

  body.menu-open .sidebar,
  body.menu-open .mobile-menu-toggle { z-index: 10002; }

  .topbar { border-radius: 24px; }
  .topbar h1 { font-size: clamp(24px, 8vw, 34px); }

  .grid,
  .grid-2,
  .grid-3,
  .grid-4,
  .grid-5,
  .dashboard-grid,
  .dashboard-grid-priority,
  .dashboard-grid-status,
  .dashboard-grid-actions,
  .catalog,
  .bot-account-grid,
  .bot-summary-grid,
  .health-grid,
  .health-grid-3,
  .email-template-grid,
  .email-actions-panel,
  .email-search-results,
  .topgestor-audit-grid,
  .war-summary-grid,
  .war-history-grid,
  .steps-grid,
  .grid-cards,
  .sales-grid,
  .clash-preview-grid,
  .preview-stats,
  .user-bot-grid { grid-template-columns: 1fr !important; }

  .table,
  table { min-width: 720px; }

  .card:has(.table),
  .card:has(table),
  .responsive-table,
  .table-wrap,
  div[style*="overflow-x"] {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 700px) {
  body { font-size: 15px; }
  input, select, textarea { font-size: 16px; }

  .main { padding-left: 12px !important; padding-right: 12px !important; }

  .card,
  .mini-card,
  .dashboard-card,
  .notice,
  .alert,
  .important-notice,
  .clash-live-card,
  .clash-stats-box,
  .user-bot-card {
    border-radius: var(--mobile-radius);
    padding: 15px !important;
  }

  .actions,
  .searchbar,
  .filter-grid,
  .topgestor-filter-form,
  .war-form-grid,
  .lookup-row,
  .copy-row,
  .pwa-install-actions,
  .bot-actions,
  .user-bot-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100%;
  }

  .actions > *,
  .actions > form,
  .actions > a,
  .actions > button,
  .searchbar > *,
  .filter-grid > *,
  .topgestor-filter-form > *,
  .war-form-grid > *,
  .lookup-row > *,
  .copy-row > *,
  .bot-actions > *,
  .user-bot-actions > *,
  .pwa-install-actions > * { width: 100% !important; min-width: 0 !important; }

  .btn,
  a.btn,
  button.btn,
  input[type="submit"],
  input[type="button"] { width: 100%; min-height: 48px; }

  .badge,
  .pill,
  .ticket-status-badge,
  .bot-status-badge { max-width: 100%; white-space: normal; text-align: center; }

  .bubble { width: 100%; max-width: 100% !important; }
  .pwa-install-banner { left: 10px !important; right: 10px !important; max-width: none !important; }
}

@media (max-width: 420px) {
  .main { padding-left: 10px !important; padding-right: 10px !important; }
  .topbar { padding: 18px 15px; }
  .topbar h1 { font-size: 23px; }
  .clash-troop-grid { grid-template-columns: 1fr !important; }
  .user-bot-metrics { grid-template-columns: 1fr !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

/* =========================================================
   TICKET VIEW - atualizacao em tempo real e notificacoes
   ========================================================= */
.ticket-live-notice[hidden] {
  display: none !important;
}

.ticket-live-notice {
  margin: 0 0 14px 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(56, 189, 248, .35);
  background: rgba(56, 189, 248, .10);
  color: #bae6fd;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  box-shadow: 0 14px 30px rgba(0, 0, 0, .22), inset 0 1px rgba(255,255,255,.06);
  animation: ticketLiveNoticeIn .22s ease-out;
}

.ticket-live-notice.success {
  border-color: rgba(34, 197, 94, .38);
  background: rgba(34, 197, 94, .12);
  color: #bbf7d0;
}

.ticket-live-notice.warning {
  border-color: rgba(245, 158, 11, .42);
  background: rgba(245, 158, 11, .12);
  color: #fde68a;
}

.ticket-live-jump {
  animation: ticketLivePulse 1.35s ease-in-out infinite;
}

.bubble.bubble-new {
  animation: ticketBubbleNew .42s ease-out;
  border-color: rgba(56, 189, 248, .45);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, .10), 0 14px 34px rgba(56, 189, 248, .10);
}

.ticket-status-badge.ticket-status-updated {
  animation: ticketStatusUpdated .9s ease-out 2;
}

.ticket-live-locked-notice {
  border-color: rgba(245, 158, 11, .42) !important;
  background: rgba(245, 158, 11, .10) !important;
}

@keyframes ticketLiveNoticeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ticketBubbleNew {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ticketStatusUpdated {
  0%, 100% {
    transform: scale(1);
    box-shadow: inset 0 1px rgba(255,255,255,.06);
  }
  45% {
    transform: scale(1.045);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, .16), 0 0 24px rgba(56, 189, 248, .26), inset 0 1px rgba(255,255,255,.10);
  }
}

@keyframes ticketLivePulse {
  0%, 100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.15);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ticket-live-notice,
  .ticket-live-jump,
  .bubble.bubble-new,
  .ticket-status-badge.ticket-status-updated {
    animation: none !important;
  }
}

/* =========================================================
   Ticket view - cores oficiais do status da solicitacao
   Mantem o badge exibido ao cliente alinhado com a dropdown:
   Aberto=azul, Pendente=amarelo, Em atendimento=roxo,
   Encerrado=verde, Cancelado=vermelho.
   ========================================================= */
.ticket-status-badge.open {
  color: #bae6fd !important;
  border-color: rgba(56, 189, 248, .42) !important;
  background: rgba(56, 189, 248, .14) !important;
}

.ticket-status-badge.pending {
  color: #fde68a !important;
  border-color: rgba(245, 158, 11, .42) !important;
  background: rgba(245, 158, 11, .14) !important;
}

.ticket-status-badge.progress {
  color: #c4b5fd !important;
  border-color: rgba(139, 92, 246, .48) !important;
  background: rgba(139, 92, 246, .16) !important;
}

.ticket-status-badge.closed {
  color: #bbf7d0 !important;
  border-color: rgba(34, 197, 94, .42) !important;
  background: rgba(34, 197, 94, .14) !important;
}

.ticket-status-badge.canceled {
  color: #fecaca !important;
  border-color: rgba(239, 68, 68, .44) !important;
  background: rgba(239, 68, 68, .14) !important;
}

/* =========================================================
   Atalho de upgrade automático - Dashboard / Nova solicitação
   ========================================================= */
.user-bot-upgrade-btn {
  flex: 1 1 220px;
  min-width: min(100%, 220px);
  background: linear-gradient(135deg, rgba(139, 92, 246, .95), rgba(34, 211, 238, .88));
}

.user-bot-upgrade-ok,
.user-bot-upgrade-unavailable {
  flex: 1 1 220px;
  min-width: min(100%, 220px);
  text-align: center;
}

.ticket-preset-notice {
  margin-bottom: 20px;
}

@media (max-width: 700px) {
  .user-bot-upgrade-btn,
  .user-bot-upgrade-ok,
  .user-bot-upgrade-unavailable {
    width: 100%;
    flex-basis: 100%;
  }
}

/* =========================================================
   Upgrade de itens nao full dentro das estatisticas do dashboard
   ========================================================= */
.user-bot-upgrade-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(196, 181, 253, .22);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(139, 92, 246, .14), rgba(34, 211, 238, .08));
  box-shadow: inset 0 1px rgba(255,255,255,.06);
}

.user-bot-upgrade-copy {
  flex: 999 1 260px;
  min-width: 0;
}

.user-bot-upgrade-copy strong {
  display: block;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.35;
  margin-bottom: 4px;
}

.user-bot-upgrade-copy p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.user-bot-upgrade-panel .user-bot-upgrade-ok,
.user-bot-upgrade-panel .user-bot-upgrade-unavailable {
  display: block;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: rgba(2, 6, 23, .22);
  color: var(--text-secondary);
}

@media (max-width: 700px) {
  .user-bot-upgrade-panel {
    align-items: stretch;
  }

  .user-bot-upgrade-copy,
  .user-bot-upgrade-panel .btn {
    width: 100%;
  }
}

/* =========================================================
   Ticket new - itens selecionados proporcionais e mobile first
   ========================================================= */
.ticket-item-card {
  display: grid !important;
  grid-template-columns: 20px 34px minmax(0, 1fr) auto;
  align-items: center !important;
  gap: 10px !important;
  min-height: 64px;
  padding: 12px 14px !important;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.ticket-item-card input[type="checkbox"] {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  min-height: 20px !important;
  max-width: 20px !important;
  max-height: 20px !important;
  margin: 0 !important;
  padding: 0 !important;
  align-self: center !important;
  justify-self: center !important;
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  place-items: center;
  border: 2px solid rgba(196, 181, 253, .52);
  border-radius: 6px;
  background: rgba(2, 6, 23, .68);
  box-shadow: inset 0 1px rgba(255,255,255,.08), 0 0 0 1px rgba(2,6,23,.35);
  flex: 0 0 20px !important;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.ticket-item-card input[type="checkbox"]::after {
  content: '';
  width: 5px;
  height: 10px;
  border-right: 3px solid #fff;
  border-bottom: 3px solid #fff;
  transform: rotate(45deg) scale(.72);
  opacity: 0;
  margin-top: -2px;
  transition: opacity .14s ease, transform .14s ease;
}

.ticket-item-card input[type="checkbox"]:checked {
  border-color: rgba(103, 232, 249, .92);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  box-shadow: 0 0 0 3px rgba(34, 211, 238, .12), 0 0 16px rgba(34, 211, 238, .20), inset 0 1px rgba(255,255,255,.22);
}

.ticket-item-card input[type="checkbox"]:checked::after {
  opacity: 1;
  transform: rotate(45deg) scale(1);
}

.ticket-item-card .ticket-item-icon,
.ticket-item-card .icon {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  margin: 0 !important;
  align-self: center !important;
  justify-self: center !important;
  display: grid !important;
  place-items: center !important;
  overflow: hidden;
}

.ticket-item-card .ticket-item-icon .icon-img,
.ticket-item-card .icon .icon-img,
.ticket-item-card .ticket-item-icon .icon-fallback,
.ticket-item-card .icon .icon-fallback {
  width: 30px !important;
  height: 30px !important;
  max-width: 30px !important;
  max-height: 30px !important;
  object-fit: contain;
}

.ticket-item-name {
  min-width: 0;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.ticket-item-selected-badge {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(103, 232, 249, .36);
  background: rgba(34, 211, 238, .13);
  color: #bae6fd;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .035em;
  text-transform: uppercase;
  white-space: nowrap;
  justify-self: end;
}

.ticket-item-card.is-selected {
  border-color: rgba(103, 232, 249, .70) !important;
  background:
    radial-gradient(circle at 100% 0%, rgba(34, 211, 238, .18), transparent 11rem),
    linear-gradient(135deg, rgba(139, 92, 246, .22), rgba(34, 211, 238, .11)) !important;
  box-shadow: 0 0 0 1px rgba(34, 211, 238, .15), 0 12px 28px rgba(34, 211, 238, .10), inset 0 1px rgba(255,255,255,.09);
}

.ticket-item-card.is-selected .ticket-item-name {
  color: #fff;
  font-weight: 950;
}

.ticket-item-card.is-selected .ticket-item-selected-badge {
  display: inline-flex;
}

.ticket-item-card:focus-within {
  border-color: rgba(34, 211, 238, .68) !important;
  box-shadow: 0 0 0 4px rgba(34, 211, 238, .12), inset 0 1px rgba(255,255,255,.08);
}

@media (max-width: 900px) {
  .ticket-item-card {
    grid-template-columns: 20px 34px minmax(0, 1fr);
    gap: 10px !important;
    min-height: 62px;
  }

  .ticket-item-selected-badge {
    grid-column: 3;
    justify-self: start;
    margin-top: 2px;
  }
}

@media (max-width: 420px) {
  .ticket-item-card {
    grid-template-columns: 18px 30px minmax(0, 1fr);
    padding: 11px 12px !important;
    gap: 9px !important;
  }

  .ticket-item-card input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    max-width: 18px !important;
    max-height: 18px !important;
    flex-basis: 18px !important;
  }

  .ticket-item-card .ticket-item-icon,
  .ticket-item-card .icon {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
  }

  .ticket-item-card .ticket-item-icon .icon-img,
  .ticket-item-card .icon .icon-img,
  .ticket-item-card .ticket-item-icon .icon-fallback,
  .ticket-item-card .icon .icon-fallback {
    width: 27px !important;
    height: 27px !important;
    max-width: 27px !important;
    max-height: 27px !important;
  }

  .ticket-item-name {
    font-size: 12px;
  }

  .ticket-item-selected-badge {
    min-height: 22px;
    font-size: 8px;
    padding: 3px 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ticket-item-card,
  .ticket-item-card input[type="checkbox"],
  .ticket-item-card input[type="checkbox"]::after {
    transition: none !important;
  }
}

/* =========================================================
   Dashboard - CTA destacado para estatísticas/tropas da conta
   ========================================================= */
.user-bot-stats-details {
  border-top: 0 !important;
  padding-top: 0 !important;
  margin-top: 12px;
}

.user-bot-stats-summary {
  position: relative;
  display: grid !important;
  grid-template-columns: 44px minmax(0, 1fr) auto 28px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 74px;
  padding: 14px 14px;
  border: 1px solid rgba(34, 211, 238, .36);
  border-radius: 18px;
  background:
    radial-gradient(circle at 0% 0%, rgba(34, 211, 238, .18), transparent 13rem),
    linear-gradient(135deg, rgba(139, 92, 246, .18), rgba(15, 23, 42, .76));
  color: var(--text-primary) !important;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .22), 0 0 22px rgba(34, 211, 238, .10), inset 0 1px rgba(255,255,255,.08);
  cursor: pointer;
  list-style: none;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.user-bot-stats-summary::-webkit-details-marker {
  display: none;
}

.user-bot-stats-summary::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 0 32%, rgba(255,255,255,.055) 46%, transparent 62% 100%);
  opacity: .9;
}

.user-bot-stats-summary::after {
  content: none !important;
}

.user-bot-stats-summary-icon,
.user-bot-stats-summary-copy,
.user-bot-stats-summary-badge,
.user-bot-stats-summary-chevron {
  position: relative;
  z-index: 1;
}

.user-bot-stats-summary-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(135deg, rgba(139, 92, 246, .42), rgba(34, 211, 238, .22));
  border: 1px solid rgba(196, 181, 253, .28);
  box-shadow: 0 0 20px rgba(34, 211, 238, .16), inset 0 1px rgba(255,255,255,.10);
  font-size: 20px;
}

.user-bot-stats-summary-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.user-bot-stats-summary-copy strong {
  display: block;
  color: #fff;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 900;
  letter-spacing: -.01em;
}

.user-bot-stats-summary-copy small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.user-bot-stats-summary-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, .40);
  background: rgba(245, 158, 11, .14);
  color: #fde68a;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 0 18px rgba(245, 158, 11, .10), inset 0 1px rgba(255,255,255,.08);
}

.user-bot-stats-summary-chevron {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(196, 181, 253, .24);
  background: rgba(15, 23, 42, .56);
  color: var(--secondary-light);
  font-size: 18px;
  line-height: 1;
  transition: transform .18s ease, background .18s ease, color .18s ease;
}

.user-bot-stats-details[open] .user-bot-stats-summary {
  border-color: rgba(34, 197, 94, .38);
  background:
    radial-gradient(circle at 0% 0%, rgba(34, 197, 94, .16), transparent 13rem),
    linear-gradient(135deg, rgba(34, 211, 238, .16), rgba(15, 23, 42, .80));
  box-shadow: 0 16px 36px rgba(0, 0, 0, .24), 0 0 22px rgba(34, 197, 94, .10), inset 0 1px rgba(255,255,255,.08);
}

.user-bot-stats-details[open] .user-bot-stats-summary-chevron {
  transform: rotate(180deg);
  color: var(--success-light);
  background: rgba(34, 197, 94, .12);
}

.user-bot-stats-details .user-bot-details-body {
  margin-top: 14px;
}

@media (hover: hover) and (pointer: fine) {
  .user-bot-stats-summary:hover {
    transform: translateY(-1px);
    border-color: rgba(34, 211, 238, .56);
    box-shadow: 0 18px 42px rgba(0, 0, 0, .26), 0 0 26px rgba(34, 211, 238, .18), inset 0 1px rgba(255,255,255,.10);
  }
}

@media (max-width: 700px) {
  .user-bot-stats-summary {
    grid-template-columns: 40px minmax(0, 1fr) 28px;
    gap: 10px;
    min-height: 78px;
    padding: 13px;
  }

  .user-bot-stats-summary-icon {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    font-size: 19px;
  }

  .user-bot-stats-summary-copy strong {
    font-size: 14px;
  }

  .user-bot-stats-summary-copy small {
    font-size: 11px;
  }

  .user-bot-stats-summary-badge {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: center;
    white-space: normal;
    text-align: center;
  }

  .user-bot-stats-summary-chevron {
    grid-column: 3;
    grid-row: 1;
  }
}

@media (max-width: 420px) {
  .user-bot-stats-summary {
    grid-template-columns: 1fr 28px;
  }

  .user-bot-stats-summary-icon {
    display: none;
  }

  .user-bot-stats-summary-copy {
    grid-column: 1;
  }

  .user-bot-stats-summary-chevron {
    grid-column: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .user-bot-stats-summary,
  .user-bot-stats-summary-chevron {
    transition: none !important;
  }
}

/* =========================================================
   Dashboard usuario - identidade do cla/conta sem duplicidade
   ========================================================= */
.user-bot-identity {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 13px;
  align-items: start;
  width: 100%;
  min-width: 0;
}

.user-bot-clan-badge {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  border: 1px solid rgba(34, 211, 238, .28);
  background: linear-gradient(135deg, rgba(139, 92, 246, .18), rgba(34, 211, 238, .10));
  box-shadow: 0 12px 28px rgba(0, 0, 0, .24), inset 0 1px rgba(255, 255, 255, .08);
  overflow: hidden;
  flex: 0 0 auto;
}

.user-bot-clan-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 3px;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .28));
}

.user-bot-clan-badge span {
  font-size: 19px;
  font-weight: 950;
  color: var(--secondary-light);
  text-transform: uppercase;
}

.user-bot-identity-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.user-bot-clan-name,
.user-bot-account-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
  line-height: 1.22;
}

.user-bot-clan-name {
  font-size: 17px;
  font-weight: 950;
  letter-spacing: .01em;
}

.user-bot-account-name {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 900;
  color: #eaf2ff;
}

.user-bot-clan-meta,
.user-bot-account-meta {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.user-bot-account-meta {
  color: #a9bad1;
}

/* O bloco expandido complementa o card: evita repetir cabecalho, CV, nivel e doacoes atuais. */
.user-bot-details-body > .clash-live-card > .clash-live-head,
.user-bot-details-body > .clash-live-card > .clash-live-stats {
  display: none !important;
}

.user-bot-details-body > .clash-live-card {
  margin-top: 0;
}

@media (max-width: 700px) {
  .user-bot-identity {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 11px;
  }

  .user-bot-clan-badge {
    width: 48px;
    height: 48px;
    border-radius: 16px;
  }

  .user-bot-clan-name {
    font-size: 15px;
  }

  .user-bot-account-name {
    font-size: 13px;
    margin-top: 8px;
  }

  .user-bot-clan-meta,
  .user-bot-account-meta {
    font-size: 11px;
  }
}

/* =========================================================
   Dashboard usuario - badge de XP da conta
   Correção: força tamanho da imagem local para evitar renderização gigante.
   ========================================================= */
.user-bot-account-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  margin-top: 9px;
}

.user-bot-account-row.has-xp {
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 9px;
}

.user-bot-account-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.user-bot-account-row .user-bot-account-name {
  margin-top: 0;
}

.player-xp-badge {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  max-width: 44px;
  flex: 0 0 44px;
  overflow: visible;
  line-height: 1;
  isolation: isolate;
}

.player-xp-badge img {
  display: block !important;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  object-fit: contain !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, .34));
}

.player-xp-badge strong {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #fff;
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
  letter-spacing: -.04em;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .72), 0 0 5px rgba(8, 47, 73, .55);
  transform: translateY(1px);
  pointer-events: none;
}

@media (max-width: 700px) {
  .user-bot-account-row.has-xp {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 8px;
  }

  .player-xp-badge,
  .player-xp-badge img {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
  }

  .player-xp-badge strong {
    font-size: 11px;
  }
}

@media (max-width: 420px) {
  .user-bot-account-row.has-xp {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .player-xp-badge,
  .player-xp-badge img {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
  }

  .player-xp-badge strong {
    font-size: 10px;
  }
}


/* =========================================================
   Gerenciar Co-líderes - seleção por conta de bot
   ========================================================= */
.leader-account-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 12px;
  margin: 10px 0 10px;
}

.leader-account-card {
  display: block;
  margin: 0;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}

.leader-account-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.leader-account-card-body {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  min-height: 100%;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 18px;
  background:
    radial-gradient(circle at 100% 0%, rgba(139, 92, 246, .12), transparent 12rem),
    rgba(15, 23, 42, .54);
  box-shadow: inset 0 1px rgba(255,255,255,.055);
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}

.leader-account-card:hover .leader-account-card-body,
.leader-account-card input:focus-visible + .leader-account-card-body {
  border-color: rgba(34, 211, 238, .42);
  background:
    radial-gradient(circle at 100% 0%, rgba(34, 211, 238, .16), transparent 12rem),
    rgba(15, 23, 42, .72);
}

.leader-account-card.is-selected .leader-account-card-body,
.leader-account-card input:checked + .leader-account-card-body {
  border-color: rgba(34, 197, 94, .62);
  background:
    radial-gradient(circle at 100% 0%, rgba(34, 197, 94, .20), transparent 12rem),
    linear-gradient(135deg, rgba(34, 197, 94, .14), rgba(15, 23, 42, .82));
  box-shadow: 0 0 0 1px rgba(34, 197, 94, .22), 0 14px 28px rgba(34, 197, 94, .10), inset 0 1px rgba(255,255,255,.08);
}

.leader-account-card:active .leader-account-card-body {
  transform: scale(.99);
}

.leader-account-check {
  width: 24px;
  height: 24px;
  margin-top: 4px;
  border-radius: 8px;
  border: 2px solid rgba(148, 163, 184, .56);
  background: rgba(2, 6, 23, .55);
  display: grid;
  place-items: center;
  color: #fff;
  flex: 0 0 auto;
  transition: all .18s ease;
}

.leader-account-card input:checked + .leader-account-card-body .leader-account-check {
  border-color: rgba(34, 197, 94, .95);
  background: linear-gradient(135deg, #22c55e, #06b6d4);
  box-shadow: 0 0 18px rgba(34, 197, 94, .28);
}

.leader-account-card input:checked + .leader-account-card-body .leader-account-check::before {
  content: '✓';
  font-size: 15px;
  font-weight: 950;
  line-height: 1;
}

.leader-account-card-content {
  display: grid;
  gap: 13px;
  min-width: 0;
}

.leader-account-clan-row,
.leader-account-bot-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.leader-account-clan-badge {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(196, 181, 253, .20);
  background: rgba(255,255,255,.06);
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 900;
  flex: 0 0 auto;
}

.leader-account-clan-badge img {
  display: block;
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.leader-account-clan-copy,
.leader-account-bot-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.leader-account-clan-copy strong,
.leader-account-bot-copy strong {
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leader-account-clan-copy small,
.leader-account-bot-copy small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leader-player-xp-badge {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  max-width: 44px;
  flex: 0 0 44px;
  overflow: visible;
  line-height: 1;
  isolation: isolate;
}

.leader-player-xp-badge img {
  display: block !important;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  object-fit: contain !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, .34));
}

.leader-player-xp-badge strong {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #fff;
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
  letter-spacing: -.04em;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .72), 0 0 5px rgba(8, 47, 73, .55);
  transform: translateY(1px);
  pointer-events: none;
}

@media (max-width: 700px) {
  .leader-account-picker {
    grid-template-columns: 1fr;
  }

  .leader-account-card-body {
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }

  .leader-account-clan-row,
  .leader-account-bot-row {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 8px;
  }

  .leader-account-clan-badge,
  .leader-account-clan-badge img,
  .leader-player-xp-badge,
  .leader-player-xp-badge img {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
  }

  .leader-player-xp-badge strong {
    font-size: 11px;
  }
}

@media (max-width: 420px) {
  .leader-account-card-body {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .leader-account-clan-row,
  .leader-account-bot-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .leader-account-clan-badge,
  .leader-account-clan-badge img,
  .leader-player-xp-badge,
  .leader-player-xp-badge img {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
  }

  .leader-account-clan-copy strong,
  .leader-account-bot-copy strong {
    font-size: 13px;
  }

  .leader-account-clan-copy small,
  .leader-account-bot-copy small {
    font-size: 11px;
  }

  .leader-player-xp-badge strong {
    font-size: 10px;
  }
}
