:root {
  --bg: #0b0f19;
  --bg-sidebar: #0e1322;
  --bg-card: #131929;
  --bg-card-hover: #172033;
  
  --border: #1e263d;
  --border-focus: #2563eb;
  
  --blue: #0066ff;
  --blue-glow: rgba(0, 102, 255, 0.25);
  --cyan: #00d2ff;
  --purple: #8b5cf6;
  --pink: #ec4899;
  
  --green: #10b981;
  --green-glow: rgba(16, 185, 129, 0.2);
  --red: #ef4444;
  
  --text: #f8fafc;
  --text-muted: #64748b;
  --text-sub: #94a3b8;
  
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Fira Code', monospace;
  --radius: 12px;
}

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

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ----------------------------------------------------
   LAYOUT CLEAN (SIDEBAR + MAIN)
---------------------------------------------------- */
.app-container {
  display: flex;
  width: 100vw;
  min-height: 100vh;
}

/* Sidebar Compacta */
.sidebar {
  width: 210px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 50;
}

.sidebar-top {
  padding: 1.25rem 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
  box-shadow: 0 0 15px var(--blue-glow);
}

.logo-text {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.sidebar-nav {
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  color: var(--text-sub);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.nav-btn.active {
  background: var(--blue);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px var(--blue-glow);
}

.sidebar-status {
  margin-top: auto;
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ----------------------------------------------------
   MAIN VIEW CLEAN
---------------------------------------------------- */
.main-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
}

/* Header Compacto em 1 Linha Única */
.top-nav {
  background: rgba(14, 19, 34, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 40;
}

.top-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.op-dropdown {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease;
}

.op-dropdown:focus {
  border-color: var(--blue);
}

.period-tabs {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-sub);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn.active {
  background: var(--blue);
  color: #fff;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-sm {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-sub);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.42rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-sm:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.btn-blue {
  background: var(--blue);
  color: #fff;
  border: none;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.42rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 2px 10px var(--blue-glow);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-blue:hover {
  filter: brightness(1.1);
}

/* ----------------------------------------------------
   CONTEÚDO PRINCIPAL (CLEAN & ESPAÇOSO)
---------------------------------------------------- */
.content-body {
  padding: 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* TOP 4 KPIS APENAS (DIRETO AO PONTO) */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.kpi-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: border-color 0.2s ease;
}

.kpi-item:hover {
  border-color: rgba(59, 130, 246, 0.3);
}

.kpi-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.kpi-number {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
}

.kpi-number.green {
  color: var(--green);
}

.kpi-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ----------------------------------------------------
   O FUNIL FLUIDO DE CONVERSÃO (DESTAQUE CENTRAL)
---------------------------------------------------- */
.main-row {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1rem;
}

.clean-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
}

/* Donut */
.donut-center-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  height: 180px;
}

.donut-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.donut-inner small {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.donut-inner strong {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  display: block;
}

.donut-pills {
  display: flex;
  justify-content: center;
  gap: 0.85rem;
  font-size: 0.78rem;
  color: var(--text-sub);
}

.donut-pill {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-pix { background: #0066ff; }
.dot-card { background: #00df8f; }
.dot-boleto { background: #f5a623; }

/* FUNIL DE CONVERSÃO FLUIDO (NEON STREAM) */
.funnel-box {
  position: relative;
  width: 100%;
  height: 190px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.funnel-svg {
  position: absolute;
  top: 25px;
  left: 0;
  width: 100%;
  height: 140px;
  z-index: 5;
  filter: drop-shadow(0 0 12px rgba(0, 102, 255, 0.3));
}

.funnel-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  z-index: 10;
  pointer-events: none;
}

.funnel-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  border-right: 1px dashed rgba(255, 255, 255, 0.08);
  padding: 0.25rem 0;
  pointer-events: auto;
  cursor: pointer;
  position: relative;
}

.funnel-col:last-child {
  border-right: none;
}

.funnel-col:hover {
  background: rgba(255, 255, 255, 0.02);
}

.f-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-sub);
}

.f-pct {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
  transition: transform 0.15s ease;
}

.funnel-col:hover .f-pct {
  transform: scale(1.12);
  color: var(--cyan);
}

.f-count {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-mono);
}

/* Tooltip do Funil */
.f-tooltip {
  position: absolute;
  bottom: 65px;
  background: #182033;
  border: 1px solid rgba(59, 130, 246, 0.4);
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  font-size: 0.72rem;
  color: #fff;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: all 0.15s ease;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.6);
  z-index: 25;
  white-space: nowrap;
}

.funnel-col:hover .f-tooltip {
  opacity: 1;
  transform: translateY(0);
}

/* ----------------------------------------------------
   TABELA LIMPA DE VENDAS RECENTES (GGCHECKOUT)
---------------------------------------------------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.clean-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.82rem;
}

.clean-table th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.clean-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.clean-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.pill-capi {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

/* ----------------------------------------------------
   MODAL FLUTUANTE (FIXO & BLINDADO CONTRA OVERFLOW)
---------------------------------------------------- */
.modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.75) !important;
  backdrop-filter: blur(8px) !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 99999 !important;
}

.modal-overlay.active {
  display: flex !important;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 90%;
  max-width: 580px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7);
}

.snippet-box {
  background: #080c14;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #60a5fa;
  position: relative;
  word-break: break-all;
}

.copy-button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: #fff;
  font-size: 0.72rem;
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  cursor: pointer;
}

.copy-button:hover {
  background: var(--blue);
}

/* Responsivo */
@media (max-width: 1024px) {
  .main-row { grid-template-columns: 1fr; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .sidebar { width: 60px; }
  .logo-text, .nav-btn span, .sidebar-status { display: none; }
  .nav-btn { justify-content: center; }
  .top-nav { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
}

/* ----------------------------------------------------
   ESTILOS DO GESTOR DE 10 OPERAÇÕES & PIXELS
---------------------------------------------------- */
.info-guide-banner {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12) 0%, rgba(16, 185, 129, 0.08) 100%);
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.guide-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}

.guide-step-card {
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.guide-step-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.guide-step-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.2rem;
}

.guide-step-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.ops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.op-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  transition: border-color 0.2s, transform 0.2s;
}

.op-card:hover {
  border-color: rgba(37, 99, 235, 0.5);
  transform: translateY(-2px);
}

.op-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.op-badge-id {
  background: rgba(37, 99, 235, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(37, 99, 235, 0.3);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
}

.op-status-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.badge-active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-inactive {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.op-name {
  font-size: 0.98rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.op-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.op-field-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.op-field-value {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text);
  word-break: break-all;
}

.op-code-box {
  position: relative;
  background: #080c14;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.55rem 3.5rem 0.55rem 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #60a5fa;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.op-code-box .btn-mini-copy {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: #fff;
  font-size: 0.68rem;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  cursor: pointer;
}

.op-code-box .btn-mini-copy:hover {
  background: var(--blue);
}

.op-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-op-configure {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: #fff;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.15s;
}

.btn-op-configure:hover {
  background: var(--blue);
  border-color: var(--blue);
}

.btn-op-test {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all 0.15s;
}

.btn-op-test:hover {
  background: rgba(16, 185, 129, 0.25);
}

/* Formulário de Configuração */
.form-grid {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-field-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: #e2e8f0;
}

.form-field-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.form-field-input {
  background: #080c14;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  color: #fff;
  font-size: 0.84rem;
  outline: none;
  transition: border-color 0.15s;
}

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

.form-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
