/* ============================================================
   WhatsApp Bot Dashboard — Design System
   Dark theme, glassmorphism, gradients, micro-animations
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Orbitron:wght@500;700;800&display=swap');

/* ---- Reset & Base ---- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #05070f;
  --bg-secondary: #0a1020;
  --bg-card: rgba(9, 16, 31, 0.78);
  --bg-card-hover: rgba(12, 22, 40, 0.94);
  --bg-glass: rgba(0, 255, 231, 0.04);
  --border-color: rgba(0, 255, 231, 0.14);
  --border-glow: rgba(0, 255, 231, 0.35);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-primary: #00f5ff;
  --accent-primary-light: #7cfcff;
  --accent-secondary: #c500ff;
  --accent-green: #00ff9f;
  --accent-green-glow: rgba(16, 185, 129, 0.2);
  --accent-red: #ff4d9d;
  --accent-red-glow: rgba(239, 68, 68, 0.2);
  --accent-yellow: #ffd84d;
  --accent-yellow-glow: rgba(245, 158, 11, 0.2);
  --accent-blue: #4d8dff;

  --gradient-primary: linear-gradient(135deg, #00f5ff, #3b82f6, #c500ff);
  --gradient-green: linear-gradient(135deg, #10b981, #059669);
  --gradient-card: linear-gradient(135deg, rgba(0, 245, 255, 0.08), rgba(197, 0, 255, 0.08));

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-cyber: 'Orbitron', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  text-shadow: 0 0 1px rgba(255, 255, 255, 0.08);
}

/* ---- Background Effect ---- */
@media (min-width: 768px) {
  body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
      radial-gradient(circle at 16% 22%, rgba(0, 245, 255, 0.2) 0%, transparent 34%),
      radial-gradient(circle at 86% 14%, rgba(197, 0, 255, 0.18) 0%, transparent 36%),
      radial-gradient(circle at 70% 80%, rgba(77, 141, 255, 0.16) 0%, transparent 40%),
      radial-gradient(circle at 24% 88%, rgba(0, 255, 159, 0.12) 0%, transparent 36%);
    z-index: -4;
    animation: bgShift 42s ease-in-out infinite alternate;
  }

  body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
      linear-gradient(rgba(0, 245, 255, 0.05) 1px, transparent 1px),
      linear-gradient(90deg, rgba(0, 245, 255, 0.05) 1px, transparent 1px);
    background-size: 44px 44px;
    opacity: 0.12;
    pointer-events: none;
    z-index: -3;
    mask-image: radial-gradient(circle at 50% 35%, black 0%, transparent 88%);
  }
}

/* Mobile: efeitos simplificados */
@media (max-width: 767px) {
  body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgba(0, 245, 255, 0.1) 0%, transparent 70%);
    z-index: -4;
  }
}

.bg-fx-smoke,
.bg-fx-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

/* Desktop: efeitos completos */
@media (min-width: 768px) {
  .bg-fx-smoke {
    z-index: -2;
    opacity: 0.24;
    filter: blur(34px);
    background:
      radial-gradient(circle at 18% 30%, rgba(0, 245, 255, 0.34) 0%, transparent 34%),
      radial-gradient(circle at 75% 24%, rgba(197, 0, 255, 0.26) 0%, transparent 32%),
      radial-gradient(circle at 56% 78%, rgba(0, 255, 159, 0.22) 0%, transparent 28%);
    animation: smokeDrift 36s ease-in-out infinite alternate;
  }

  .bg-fx-particles {
    z-index: -1;
    opacity: 0.26;
    background:
      radial-gradient(circle, rgba(124, 252, 255, 0.9) 1.1px, transparent 1.6px) 0 0 / 120px 120px,
      radial-gradient(circle, rgba(197, 0, 255, 0.65) 0.9px, transparent 1.4px) 24px 38px / 150px 150px,
      radial-gradient(circle, rgba(0, 255, 159, 0.6) 1px, transparent 1.5px) 48px 76px / 170px 170px;
    animation: particlesFloat 52s linear infinite;
  }
}

/* Mobile: desabilita efeitos pesados */
@media (max-width: 767px) {
  .bg-fx-smoke,
  .bg-fx-particles {
    display: none;
  }
}

body.scanline-on .app-container {
  position: relative;
}

/* Desktop: scanline effect */
@media (min-width: 768px) {
  body.scanline-on .app-container::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.1;
    background: repeating-linear-gradient(to bottom,
        rgba(0, 245, 255, 0.09) 0px,
        rgba(0, 245, 255, 0.09) 1px,
        transparent 1px,
        transparent 3px);
    animation: scanMove 16s linear infinite;
  }
}

@keyframes bgShift {
  0% {
    transform: translate(0, 0);
  }

  100% {
    transform: translate(-5%, -3%);
  }
}

@keyframes scanMove {
  0% {
    transform: translateY(-12px);
  }

  100% {
    transform: translateY(12px);
  }
}

@keyframes smokeDrift {
  0% {
    transform: translate3d(-2%, -1%, 0) scale(1);
  }

  50% {
    transform: translate3d(2%, 1%, 0) scale(1.06);
  }

  100% {
    transform: translate3d(-1%, 2%, 0) scale(1.02);
  }
}

@keyframes particlesFloat {
  0% {
    transform: translate3d(0, 0, 0);
  }

  50% {
    transform: translate3d(-24px, 18px, 0);
  }

  100% {
    transform: translate3d(0, 0, 0);
  }
}

/* ---- Layout ---- */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* ---- Header ---- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  padding: 20px 28px;
  background: linear-gradient(135deg, rgba(5, 14, 28, 0.88), rgba(8, 22, 42, 0.78));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-md);
  position: relative;
}

.header::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(120deg, rgba(0, 245, 255, 0.5), rgba(197, 0, 255, 0.35), rgba(0, 255, 159, 0.45));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  width: 48px;
  height: 48px;
  background: var(--gradient-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: var(--shadow-glow);
}

.header-title {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-cyber);
  letter-spacing: 1.4px;
  text-transform: uppercase;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 16px rgba(0, 245, 255, 0.5);
}

.header-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  transition: var(--transition);
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.3);
}

.status-badge.connected {
  background: var(--accent-green-glow);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.disconnected {
  background: var(--accent-red-glow);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.connected .status-dot {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.disconnected .status-dot {
  background: var(--accent-red);
  box-shadow: 0 0 8px var(--accent-red);
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.5;
    transform: scale(0.85);
  }
}

/* ---- Metric Cards ---- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.metric-card {
  background: linear-gradient(135deg, rgba(7, 16, 31, 0.92), rgba(9, 19, 35, 0.76));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  backdrop-filter: blur(12px);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  will-change: transform;
}

/* Desktop: efeitos de borda animados */
@media (min-width: 768px) {
  .metric-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(125deg,
        transparent 0%,
        transparent 36%,
        rgba(124, 252, 255, 0.82) 48%,
        transparent 60%,
        transparent 100%);
    background-size: 240% 240%;
    animation: borderSweep 15s linear infinite;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
  }
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 3px 3px 0 0;
}

.metric-card:nth-child(1)::before {
  background: var(--gradient-primary);
}

.metric-card:nth-child(2)::before {
  background: var(--gradient-green);
}

.metric-card:nth-child(3)::before {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.metric-card:nth-child(4)::before {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow), 0 0 22px rgba(0, 245, 255, 0.18);
}

.metric-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.metric-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---- Main Grid ---- */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

/* ---- Card / Panel ---- */
.panel {
  background: linear-gradient(160deg, rgba(8, 16, 31, 0.92), rgba(6, 14, 24, 0.84));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  overflow: hidden;
  transition: var(--transition);
  position: relative;
  will-change: transform;
}

/* Desktop: efeitos de borda animados */
@media (min-width: 768px) {
  .panel::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(130deg,
        transparent 0%,
        transparent 34%,
        rgba(0, 245, 255, 0.7) 47%,
        rgba(197, 0, 255, 0.5) 50%,
        transparent 63%,
        transparent 100%);
    background-size: 240% 240%;
    animation: borderSweep 13s linear infinite;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
  }
}

.panel:hover {
  border-color: rgba(0, 245, 255, 0.4);
  box-shadow: 0 0 20px rgba(0, 245, 255, 0.14);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.panel-title {
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-cyber);
  text-transform: uppercase;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #c9f9ff;
  letter-spacing: 1px;
}

@keyframes borderSweep {
  0% {
    background-position: 0% 0%;
  }

  100% {
    background-position: 220% 220%;
  }
}

.panel-body {
  padding: 24px;
}

/* ---- Forms ---- */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input,
.form-textarea,
.form-datetime {
  width: 100%;
  padding: 12px 16px;
  background: rgba(4, 12, 24, 0.72);
  border: 1px solid rgba(0, 245, 255, 0.2);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  transition: var(--transition);
  outline: none;
}

.form-input:focus,
.form-textarea:focus,
.form-datetime:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 245, 255, 0.16), 0 0 12px rgba(0, 245, 255, 0.3);
}

.form-textarea {
  resize: vertical;
  min-height: 90px;
}

.form-datetime {
  color-scheme: dark;
}

/* Toggle Switch */
.toggle-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 10px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.toggle-container:hover {
  border-color: var(--accent-primary);
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-secondary);
  border-radius: 999px;
  border: 1px solid var(--border-color);
  transition: var(--transition);
  cursor: pointer;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition);
}

.toggle-switch input:checked+.toggle-slider {
  background: var(--accent-primary);
  border-color: var(--accent-primary-light);
}

.toggle-switch input:checked+.toggle-slider::before {
  transform: translateX(19px);
  background: white;
}

.toggle-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.schedule-fields {
  display: none;
  animation: slideDown 0.3s ease;
}

.schedule-fields.active {
  display: block;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  outline: none;
}

.btn-primary {
  width: 100%;
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 0 16px rgba(0, 245, 255, 0.28), 0 6px 14px rgba(0, 0, 0, 0.35);
  letter-spacing: 0.3px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(0, 245, 255, 0.52), 0 8px 22px rgba(0, 0, 0, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-danger {
  padding: 6px 14px;
  font-size: 0.75rem;
  background: transparent;
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
}

.btn-danger:hover {
  background: var(--accent-red-glow);
}

/* ---- Tables ---- */
.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #8ed9ff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 12px 16px;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background: linear-gradient(90deg, rgba(0, 245, 255, 0.08), rgba(197, 0, 255, 0.06));
}

/* Status pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.status-pill.sent {
  background: var(--accent-green-glow);
  color: var(--accent-green);
}

.status-pill.pending {
  background: var(--accent-yellow-glow);
  color: var(--accent-yellow);
}

.status-pill.failed {
  background: var(--accent-red-glow);
  color: var(--accent-red);
}

.status-pill.sending {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary-light);
}

/* Truncated text */
.text-truncate {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.phone-display {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.82rem;
  color: var(--accent-secondary);
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 0.88rem;
}

/* ---- Toast Notification ---- */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 3.7s forwards;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 380px;
}

.toast.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-green);
}

.toast.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--accent-red);
}

.toast.info {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--accent-primary-light);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

/* ---- Full-width Section ---- */
.full-width-section {
  margin-bottom: 32px;
}

/* ---- Tab Bar ---- */
.tab-bar {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 245, 255, 0.2);
}

.tab-btn {
  padding: 8px 18px;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn.active {
  background: linear-gradient(120deg, rgba(0, 245, 255, 0.85), rgba(77, 141, 255, 0.9));
  color: #05101f;
  box-shadow: 0 0 14px rgba(0, 245, 255, 0.42);
}

.tab-btn:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

/* ---- Spinner ---- */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .main-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  /* Reduz animações em mobile - exceto se lite mode estiver ativo */
  body:not(.lite-mode) * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  /* Mantém apenas animações essenciais */
  body:not(.lite-mode) .spinner,
  body:not(.lite-mode) .status-dot,
  body:not(.lite-mode) .toast {
    animation-duration: revert !important;
    animation-iteration-count: revert !important;
  }
}

@media (max-width: 560px) {
  .app-container {
    padding: 12px;
  }

  .header {
    flex-direction: column;
    gap: 14px;
    text-align: center;
    padding: 16px;
  }

  .header-left {
    flex-direction: column;
    gap: 8px;
  }

  .header-actions {
    width: 100%;
    flex-direction: column;
    gap: 8px;
  }

  .btn-header-connect,
  .btn-header-clean {
    width: 100%;
  }

  .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .metric-card {
    padding: 14px 16px;
  }

  .metric-value {
    font-size: 1.4rem;
  }

  .groups-grid {
    grid-template-columns: 1fr;
  }

  .panel-body {
    padding: 16px;
  }

  .form-group {
    margin-bottom: 14px;
  }

  .toast-container {
    top: 12px;
    right: 12px;
    left: 12px;
  }

  .toast {
    max-width: 100%;
  }
}

/* ---- Header Profile Avatar ---- */
.header-avatar {
  position: relative;
}

.header-profile-img {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 2px solid var(--accent-primary);
  box-shadow: var(--shadow-glow);
}

/* ---- Target Toggle ---- */
.target-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.target-btn {
  flex: 1;
  padding: 10px 16px;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.target-btn.active {
  background: linear-gradient(120deg, rgba(0, 245, 255, 0.85), rgba(77, 141, 255, 0.9));
  color: #05101f;
  box-shadow: 0 0 10px rgba(0, 245, 255, 0.35);
}

.target-btn:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

/* ---- Group Selector Dropdown ---- */
.group-selector {
  position: relative;
  cursor: pointer;
}

.group-selector-placeholder {
  padding: 12px 16px;
  background: rgba(4, 12, 24, 0.72);
  border: 1px solid rgba(0, 245, 255, 0.2);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: var(--transition);
}

.group-selector:hover .group-selector-placeholder {
  border-color: var(--accent-primary);
}

.group-selected-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
}

.group-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  background: rgba(6, 14, 25, 0.98);
  border: 1px solid rgba(0, 245, 255, 0.24);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 100;
}

.group-dropdown.open {
  display: block;
  animation: slideDown 0.2s ease;
}

.group-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: var(--transition);
}

.group-dropdown-item:hover {
  background: linear-gradient(90deg, rgba(0, 245, 255, 0.08), rgba(197, 0, 255, 0.07));
}

.group-dropdown-info {
  flex: 1;
  min-width: 0;
}

.group-dropdown-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-dropdown-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.group-dropdown-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.group-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.group-avatar-fallback-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

/* ---- Groups Grid ---- */
.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
}

.group-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(6, 14, 24, 0.72);
  border: 1px solid rgba(0, 245, 255, 0.14);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.group-card:hover {
  border-color: var(--accent-primary);
  background: linear-gradient(120deg, rgba(0, 245, 255, 0.08), rgba(197, 0, 255, 0.06));
  transform: translateY(-1px);
  box-shadow: 0 0 14px rgba(0, 245, 255, 0.2);
}

.group-card-avatar {
  position: relative;
  flex-shrink: 0;
}

.group-card-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
}

.group-card-fallback {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.group-card-info {
  flex: 1;
  min-width: 0;
}

.group-card-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-card-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Group Count Badge */
.group-count {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Dest Display */
.dest-display {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Scrollbar styling for groups */
.groups-grid::-webkit-scrollbar,
.group-dropdown::-webkit-scrollbar {
  width: 6px;
}

.groups-grid::-webkit-scrollbar-track,
.group-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.groups-grid::-webkit-scrollbar-thumb,
.group-dropdown::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.groups-grid::-webkit-scrollbar-thumb:hover,
.group-dropdown::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ---- Media Upload ---- */
.media-upload {
  border: 2px dashed rgba(0, 245, 255, 0.26);
  border-radius: var(--radius-sm);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  position: relative;
  background: rgba(4, 12, 24, 0.38);
}

.media-upload:hover {
  border-color: var(--accent-primary);
  background: rgba(0, 245, 255, 0.06);
}

.media-upload.dragover {
  border-color: var(--accent-primary-light);
  background: rgba(0, 245, 255, 0.1);
  box-shadow: 0 0 20px rgba(0, 245, 255, 0.2);
}

.media-upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.media-upload-icon {
  font-size: 1.8rem;
  opacity: 0.6;
}

.media-upload-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.media-upload-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.media-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}

.media-preview-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.media-preview-name {
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 500;
}

.media-preview-size {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-glass);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
}

.media-remove-btn {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: transparent;
  color: var(--accent-red);
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.media-remove-btn:hover {
  background: var(--accent-red-glow);
}

/* ---- Ban Alert ---- */
.ban-alert {
  margin-bottom: 24px;
  padding: 18px 24px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: var(--radius-lg);
  animation: banPulse 2s ease-in-out infinite;
}

@keyframes banPulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }

  50% {
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
  }
}

.ban-alert-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ban-alert-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.ban-alert-info {
  flex: 1;
}

.ban-alert-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-red);
  margin-bottom: 4px;
}

.ban-alert-msg {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.ban-alert-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---- Routines ---- */
.routines-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.routine-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: var(--transition);
  gap: 16px;
}

.routine-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.routine-card.routine-disabled {
  opacity: 0.5;
}

.routine-card-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.routine-time-badge {
  background: var(--gradient-primary);
  color: white;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  letter-spacing: 1px;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.routine-card-info {
  flex: 1;
  min-width: 0;
}

.routine-card-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.routine-card-dest {
  font-size: 0.78rem;
  color: var(--accent-secondary);
  margin-bottom: 4px;
}

.routine-card-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.routine-card-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.routine-card-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ---- Extra Buttons ---- */
.btn-accent {
  padding: 8px 18px;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 0 14px rgba(0, 245, 255, 0.28), 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-header-connect {
  white-space: nowrap;
}

.btn-header-clean {
  white-space: nowrap;
  border-color: rgba(0, 245, 255, 0.35);
  color: #bdefff;
}

.btn-header-clean:hover {
  border-color: rgba(0, 245, 255, 0.7);
}

.btn-accent:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(0, 245, 255, 0.52), 0 4px 14px rgba(99, 102, 241, 0.45);
}

.btn-toggle-on {
  padding: 6px 14px;
  font-size: 0.75rem;
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-yellow);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
}

.btn-toggle-on:hover {
  background: rgba(245, 158, 11, 0.2);
}

.btn-toggle-off {
  padding: 6px 14px;
  font-size: 0.75rem;
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-sm);
}

.btn-toggle-off:hover {
  background: rgba(16, 185, 129, 0.2);
}

.btn-secondary {
  padding: 10px 20px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
}

/* ---- Modal ---- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-content {
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: linear-gradient(160deg, rgba(8, 16, 31, 0.96), rgba(6, 14, 24, 0.94));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  font-family: var(--font-cyber);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.modal-close {
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--accent-red-glow);
  color: var(--accent-red);
  border-color: rgba(239, 68, 68, 0.3);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ---- Empty State Sub ---- */
.empty-state-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
  opacity: 0.7;
}

/* ---- Responsive Routines ---- */
@media (max-width: 560px) {
  .routine-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .routine-card-actions {
    align-self: flex-end;
  }

  .ban-alert-content {
    flex-direction: column;
    text-align: center;
  }
}

/* ---- License Screen ---- */
.license-screen {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 26, 0.95);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.license-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  width: 90%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(99, 102, 241, 0.1);
  animation: slideUp 0.4s ease;
}

.license-icon {
  font-size: 3rem;
  margin-bottom: 20px;
}

.license-box h2 {
  font-size: 1.5rem;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.license-box p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.license-error {
  margin-top: 16px;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  display: none;
}

/* ============================================================
   LITE MODE - Desativa todos os efeitos visuais
   ============================================================ */

body.lite-mode {
  background: #0a0e1a !important;
}

/* Remove todos os backgrounds animados */
body.lite-mode::before,
body.lite-mode::after,
body.lite-mode .bg-fx-smoke,
body.lite-mode .bg-fx-particles,
body.lite-mode.scanline-on .app-container::after {
  display: none !important;
  opacity: 0 !important;
}

/* Remove animações de borda dos cards */
body.lite-mode .metric-card::after,
body.lite-mode .panel::before,
body.lite-mode .header::before {
  display: none !important;
  opacity: 0 !important;
}

/* Simplifica backgrounds */
body.lite-mode .header {
  background: rgba(10, 18, 32, 0.95) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

body.lite-mode .metric-card {
  background: rgba(12, 20, 35, 0.9) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
}

body.lite-mode .panel {
  background: rgba(10, 18, 32, 0.95) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

/* Remove hover effects pesados */
body.lite-mode .metric-card:hover,
body.lite-mode .panel:hover {
  transform: none !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4) !important;
}

/* Simplifica botões */
body.lite-mode .btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #3b82f6) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
}

body.lite-mode .btn-primary:hover {
  transform: none !important;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4) !important;
}

body.lite-mode .btn-accent {
  background: linear-gradient(135deg, #0ea5e9, #3b82f6) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
}

body.lite-mode .btn-accent:hover {
  transform: none !important;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4) !important;
}

/* Remove blur effects */
body.lite-mode .header,
body.lite-mode .metric-card,
body.lite-mode .panel,
body.lite-mode .modal-content {
  backdrop-filter: none !important;
}

/* Simplifica títulos */
body.lite-mode .header-title {
  background: none !important;
  -webkit-text-fill-color: #00d9ff !important;
  text-shadow: none !important;
}

body.lite-mode .panel-title {
  color: #7dd3fc !important;
}

/* Remove animações de pulse */
body.lite-mode .status-dot {
  animation: none !important;
}

/* Simplifica ban alert */
body.lite-mode .ban-alert {
  animation: none !important;
  box-shadow: none !important;
}

/* Simplifica group cards */
body.lite-mode .group-card:hover {
  transform: none !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

/* Simplifica routine cards */
body.lite-mode .routine-time-badge {
  background: linear-gradient(135deg, #0ea5e9, #3b82f6) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
}

/* Remove transições desnecessárias */
body.lite-mode *:not(.modal-overlay):not(.modal-content):not(.toast):not(.spinner) {
  transition: opacity 0.15s ease, background-color 0.15s ease, border-color 0.15s ease !important;
}

/* Desativa todas as animações exceto essenciais */
body.lite-mode *:not(.spinner):not(.toast) {
  animation: none !important;
}

body.lite-mode .spinner {
  animation: spin 0.6s linear infinite !important;
}

body.lite-mode .toast {
  animation: toastIn 0.2s ease, toastOut 0.2s ease 3.8s forwards !important;
}

/* Simplifica forms */
body.lite-mode .form-input:focus,
body.lite-mode .form-textarea:focus,
body.lite-mode .form-datetime:focus {
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.3) !important;
}

/* Simplifica media upload */
body.lite-mode .media-upload.dragover {
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.5) !important;
}

/* Simplifica tab buttons */
body.lite-mode .tab-btn.active {
  background: linear-gradient(120deg, #0ea5e9, #3b82f6) !important;
  box-shadow: none !important;
}

/* Simplifica target buttons */
body.lite-mode .target-btn.active {
  background: linear-gradient(120deg, #0ea5e9, #3b82f6) !important;
  box-shadow: none !important;
}

/* Simplifica table hover */
body.lite-mode .data-table tbody tr:hover {
  background: rgba(14, 165, 233, 0.08) !important;
}

/* Simplifica modal */
body.lite-mode .modal-content {
  background: rgba(10, 18, 32, 0.98) !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6) !important;
}

/* Simplifica license screen */
body.lite-mode .license-box {
  background: rgba(12, 20, 35, 0.95) !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6) !important;
}

/* Remove logo glow */
body.lite-mode .header-logo {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
}

