:root {
  --bg-main: #0a0e17;
  --bg-card: #131b2a;
  --bg-card-hover: #172235;
  --border-color: #202d44;
  --primary-green: #25d366;
  --primary-teal: #00a884;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --status-green: #10b981;
  --status-yellow: #f59e0b;
  --status-red: #ef4444;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Navbar */
.navbar {
  background-color: #0f172a;
  border-bottom: 1px solid var(--border-color);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #00a884, #25d366);
  color: #0a0e17;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.subdomain-badge {
  font-size: 0.75rem;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  display: inline-block;
  margin-top: 2px;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1e293b;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  border: 1px solid var(--border-color);
}

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

.status-dot.connected { background-color: var(--status-green); box-shadow: 0 0 8px var(--status-green); }
.status-dot.qr_ready { background-color: var(--status-yellow); box-shadow: 0 0 8px var(--status-yellow); }
.status-dot.disconnected { background-color: var(--status-red); }

.btn-toggle-bot {
  background: #1e293b;
  border: 1px solid #334155;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-toggle-bot.active {
  background: rgba(37, 211, 102, 0.15);
  border-color: var(--primary-green);
  color: var(--primary-green);
}

/* Dashboard Grid */
.dashboard-container {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 20px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
}

/* Tarjetas */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
}

.card-header {
  padding: 16px 20px;
  background-color: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f1f5f9;
}

.badge {
  font-size: 0.72rem;
  font-weight: 600;
  background: #1e293b;
  color: #94a3b8;
  padding: 3px 8px;
  border-radius: 6px;
}

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

.card-body {
  padding: 20px;
  flex: 1;
}

.card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.4;
}

/* Botones de Acción */
.btn-action-small {
  background: var(--primary-teal);
  color: #ffffff;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}

.btn-action-small:hover {
  background: var(--primary-green);
  color: #0a0e17;
}

/* Tarjeta QR */
.qr-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.qr-container {
  width: 220px;
  height: 220px;
  background: #ffffff;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.qr-container img {
  width: 100%;
  height: 100%;
  display: block;
}

.qr-placeholder {
  color: #334155;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.qr-instructions {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: left;
  width: 100%;
  background: #0f172a;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.qr-instructions ol {
  padding-left: 20px;
  margin-top: 6px;
  line-height: 1.5;
}

.connected-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 0;
}

.connected-icon {
  font-size: 3rem;
  color: var(--primary-green);
  margin-bottom: 6px;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--status-red);
  color: var(--status-red);
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 14px;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: var(--status-red);
  color: #ffffff;
}

/* Tarjeta Tasa */
.rate-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0f172a;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.currency-prefix, .currency-suffix {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.rate-input-group input {
  flex: 1;
  background: transparent;
  border: none;
  color: #38bdf8;
  font-size: 1.3rem;
  font-weight: 700;
  outline: none;
  text-align: center;
}

.btn-save-rate {
  background: #38bdf8;
  color: #0f172a;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-save-rate:hover {
  background: #0284c7;
  color: #ffffff;
}

.rate-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #0f172a;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.rate-preview-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.rate-preview-item strong {
  color: var(--primary-green);
}

/* Formularios */
label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
}

input[type="text"], input[type="number"], input[type="password"] {
  width: 100%;
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 9px 12px;
  color: #ffffff;
  font-size: 0.88rem;
  outline: none;
}

input:focus {
  border-color: var(--primary-teal);
}

.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.form-col {
  flex: 1;
}

.form-col.full {
  flex: 100%;
}

/* Catálogo List */
.catalog-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.catalog-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #0f172a;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.catalog-name {
  font-weight: 600;
  font-size: 0.88rem;
  flex: 1;
}

.catalog-price-input {
  width: 80px !important;
  text-align: right;
  color: var(--primary-green) !important;
  font-weight: 700;
}

/* Gemini API Input */
.input-with-icon {
  display: flex;
  position: relative;
}

.btn-eye {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.helper-text {
  font-size: 0.74rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.helper-text a {
  color: #38bdf8;
  text-decoration: none;
}

/* Toggle Switch */
.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #334155;
  transition: 0.3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary-green);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Live Feed */
.live-feed {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feed-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
  color: var(--text-dim);
  font-size: 0.85rem;
  gap: 10px;
}

.feed-empty i {
  font-size: 2rem;
}

.feed-item {
  background: #0f172a;
  border-left: 3px solid var(--primary-green);
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.feed-meta {
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
  font-size: 0.72rem;
}

.feed-user {
  color: #93c5fd;
}

.feed-reply {
  color: #cbd5e1;
  padding-left: 8px;
  border-left: 2px solid #334155;
  margin-top: 4px;
}

.pulse-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--primary-green);
  font-weight: 700;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--primary-green);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--primary-teal);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

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

/* ======================================================== */
/* SAAS MULTI-TENANT & SUSCRIPCIÓN BANNER */
/* ======================================================== */

.btn-stock-toggle {
  border: none;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-stock-toggle.in-stock {
  background: rgba(37, 211, 102, 0.15);
  color: #25d366;
  border: 1px solid rgba(37, 211, 102, 0.35);
}

.btn-stock-toggle.in-stock:hover {
  background: rgba(37, 211, 102, 0.25);
}

.btn-stock-toggle.out-of-stock {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.btn-stock-toggle.out-of-stock:hover {
  background: rgba(239, 68, 68, 0.25);
}

.catalog-item-row.item-out-of-stock {
  opacity: 0.75;
}

.sub-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  font-size: 0.88rem;
  font-weight: 600;
  border-bottom: 1px solid transparent;
  gap: 12px;
  flex-wrap: wrap;
}

.sub-banner.trial {
  background: rgba(37, 211, 102, 0.12);
  border-bottom-color: rgba(37, 211, 102, 0.3);
  color: #25d366;
}

.sub-banner.active-vip {
  background: rgba(56, 189, 248, 0.12);
  border-bottom-color: rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}

.sub-banner.expired {
  background: rgba(239, 68, 68, 0.16);
  border-bottom-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.sub-banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-sub-action {
  background: #f59e0b;
  color: #0a0e17;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.15s, opacity 0.15s;
}

.btn-sub-action:hover {
  transform: scale(1.02);
  opacity: 0.95;
}

.user-shop-badge {
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 5px 12px;
  border-radius: 20px;
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #202d44;
}

.btn-user-logout {
  background: transparent;
  border: 1px solid #334155;
  color: #94a3b8;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-user-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #fca5a5;
}

/* ======================================================== */
/* MODAL BINANCE PAY */
/* ======================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.show {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  background: #131b2a;
  border: 1px solid #202d44;
  border-radius: 16px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7), 0 0 40px rgba(245, 158, 11, 0.15);
  overflow: hidden;
  animation: modalEnter 0.25s ease-out;
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 18px 24px;
  background: #0f172a;
  border-bottom: 1px solid #202d44;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.1rem;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}

.btn-close-modal:hover {
  color: #f8fafc;
}

.modal-body {
  padding: 24px;
}

.binance-info-box {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.binance-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.binance-info-row:last-child {
  margin-bottom: 0;
}

.binance-info-label {
  font-size: 0.82rem;
  color: #94a3b8;
}

.binance-info-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 6px;
}

.copy-badge {
  background: #1e293b;
  border: 1px solid #334155;
  color: #38bdf8;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
}

.binance-instructions {
  font-size: 0.82rem;
  color: #94a3b8;
  line-height: 1.5;
  margin-bottom: 20px;
}

.binance-instructions ol {
  padding-left: 20px;
  margin-top: 6px;
}

.binance-instructions li {
  margin-bottom: 4px;
}

.binance-verify-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.binance-verify-form input {
  background: #0a0e17;
  border: 1px solid #202d44;
  border-radius: 10px;
  padding: 12px 14px;
  color: #f8fafc;
  font-size: 0.95rem;
  outline: none;
}

.binance-verify-form input:focus {
  border-color: #f59e0b;
}

.btn-verify-binance {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0a0e17;
  border: none;
  padding: 13px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.binance-msg {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  display: none;
  margin-top: 12px;
}

.binance-msg.success {
  background: rgba(37, 211, 102, 0.15);
  border: 1px solid rgba(37, 211, 102, 0.4);
  color: #86efac;
  display: block;
}

.binance-msg.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  display: block;
}

