:root {
  --bg-main: #0b0f19;
  --bg-card: rgba(18, 24, 38, 0.85);
  --bg-card-hover: rgba(28, 36, 56, 0.95);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(99, 102, 241, 0.4);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --accent-ig: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  --accent-fb: #1877f2;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  --glow-primary: 0 0 20px rgba(99, 102, 241, 0.25);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(236, 72, 153, 0.08) 0px, transparent 50%);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

/* Header */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: var(--glow-primary);
}

.logo-text h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-text span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Chrome Status Badge */
.chrome-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background-color: var(--success);
  box-shadow: 0 0 10px var(--success);
}

.status-dot.offline {
  background-color: var(--warning);
  box-shadow: 0 0 10px var(--warning);
}

/* Glass Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  transition: all 0.25s ease;
  margin-bottom: 2rem;
}

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

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 1rem;
}

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

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.input-group label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 500;
}

input, select, textarea {
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  color: white;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-sm {
  padding: 0.42rem 0.75rem;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* Action Group */
.action-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  min-width: 135px;
}

/* Progress Bar Component */
.progress-container {
  width: 100%;
  margin-top: 0.5rem;
  display: none;
}

.progress-container.active {
  display: block;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: 0.3rem;
  color: #94a3b8;
}

.progress-track {
  width: 100%;
  height: 7px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899);
  border-radius: 999px;
  width: 0%;
  transition: width 0.4s ease;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

.progress-fill.animated {
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

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

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

.table-responsive table {
  min-width: 800px;
}

th {
  padding: 0.9rem 1rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

td {
  padding: 1.1rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.92rem;
  vertical-align: middle;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-ig {
  background: rgba(225, 48, 108, 0.15);
  color: #f472b6;
  border: 1px solid rgba(225, 48, 108, 0.3);
}

.badge-fb {
  background: rgba(24, 119, 242, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(24, 119, 242, 0.3);
}

.badge-google {
  background: rgba(66, 133, 244, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(66, 133, 244, 0.35);
}

.badge-status {
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
}

.badge-status.pendente {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.badge-status.processando {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  animation: pulse 1.5s infinite;
}

.badge-status.concluido {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.badge-status.erro {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: rgba(18, 24, 38, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text-primary);
}

.metric-sub {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
}

/* Profile Details Header */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 2rem;
}

.profile-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary);
  box-shadow: var(--glow-primary);
  background: #1e293b;
}

.profile-info h2 {
  font-size: 1.6rem;
  font-weight: 700;
}

/* Post Cards */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.post-card {
  background: rgba(18, 24, 38, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
}

.post-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-hover);
}

.post-thumb {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: #1e293b;
}

.post-body {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.post-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
}

.post-caption {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.post-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

/* ==========================================================================
   Modais Interativos & Progresso em Tempo Real (In-App Modal)
   ========================================================================== */
.app-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 7, 13, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.app-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.app-modal-card {
  background: rgba(18, 24, 38, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), var(--glow-primary);
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  transform: scale(0.92) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-modal-overlay.active .app-modal-card {
  transform: scale(1) translateY(0);
}

.app-modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.app-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: color 0.2s;
}

.app-modal-close:hover {
  color: var(--text-primary);
}

.app-modal-body {
  padding: 1.5rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.6;
}

.app-modal-footer {
  padding: 1rem 1.5rem 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: rgba(11, 15, 25, 0.4);
}

/* Lista de Canais do Progresso no Modal */
.modal-channel-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.modal-channel-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  transition: border-color 0.2s;
}

.modal-channel-item.active {
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.05);
}

.modal-channel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
}

.modal-channel-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  min-width: 0;
}

.modal-channel-identificador {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.modal-channel-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.modal-channel-badge.pending {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.modal-channel-badge.running {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.4);
}

.modal-channel-badge.done {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.modal-channel-badge.error {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.modal-channel-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: #94a3b8;
}

.modal-channel-etapa {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.modal-channel-bar-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.2rem;
}

.modal-channel-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* Regras Responsivas Globais Mobile */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden !important;
    width: 100% !important;
  }
  .container {
    padding: 0.75rem 0.5rem !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  .navbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
    padding-bottom: 0.75rem !important;
    margin-bottom: 1rem !important;
  }
  .crm-kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem !important;
    margin-bottom: 1rem !important;
  }
  .kpi-card {
    padding: 0.75rem !important;
    gap: 0.5rem !important;
  }
  .kpi-icon-box {
    width: 36px !important;
    height: 36px !important;
    font-size: 1.1rem !important;
  }
  .kpi-value {
    font-size: 1.2rem !important;
  }
  .tabs-index-hub {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.4rem !important;
    padding: 0.4rem !important;
    margin-bottom: 1rem !important;
  }
  .index-tab-btn {
    padding: 0.5rem 0.6rem !important;
    gap: 0.4rem !important;
  }
  .index-tab-icon {
    width: 32px !important;
    height: 32px !important;
    font-size: 1rem !important;
  }
  .index-tab-title {
    font-size: 0.8rem !important;
  }
  .index-tab-sub {
    display: none !important;
  }
  .filter-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.6rem !important;
    padding: 0.75rem !important;
  }
  .filter-search-box {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
  .table-responsive {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .app-modal {
    width: 94% !important;
    max-width: 94% !important;
    padding: 1.25rem 1rem !important;
  }
  .dacab-accordion-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 0.85rem 0.95rem !important;
    gap: 0.45rem !important;
    min-height: auto !important;
    text-align: left !important;
  }
  .dacab-accordion-title {
    font-size: 0.92rem !important;
    font-weight: 700 !important;
    color: #f8fafc !important;
    display: flex !important;
    align-items: flex-start !important;
    gap: 0.5rem !important;
    width: 100% !important;
    line-height: 1.4 !important;
    word-break: normal !important;
    white-space: normal !important;
  }
  .dacab-accordion-title span:first-child {
    font-size: 1.15rem !important;
    line-height: 1.2 !important;
    flex-shrink: 0 !important;
  }
  .dacab-accordion-meta {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    gap: 0.5rem !important;
    padding-top: 0.35rem !important;
    border-top: 1px dashed rgba(255, 255, 255, 0.08) !important;
  }
  .dacab-accordion-meta .badge {
    font-size: 0.76rem !important;
    padding: 0.25rem 0.6rem !important;
    max-width: calc(100% - 35px) !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  .dacab-accordion-arrow {
    font-size: 0.85rem !important;
    margin-left: auto !important;
    padding: 0.15rem !important;
  }
}

/* ==========================================
   APP MODALS & DIALOGS
   ========================================== */
.app-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(11, 15, 25, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 1rem;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.app-modal-overlay.active,
.app-modal-overlay[style*="display: flex"],
.app-modal-overlay[style*="display:flex"] {
  opacity: 1 !important;
  visibility: visible !important;
}

.app-modal-card,
.app-modal-box {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  width: 100%;
  max-width: 580px;
  padding: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 24px rgba(99, 102, 241, 0.2);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-sizing: border-box;
  animation: modalScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.app-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.85rem;
}

.app-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.app-modal-close {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  font-size: 1rem;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.app-modal-close:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.app-modal-body {
  font-size: 0.92rem;
  color: #cbd5e1;
  line-height: 1.6;
}

.app-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 1rem;
}



