* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  min-height: 100vh;
}
a { color: #38bdf8; text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #0f172a; padding: .1rem .35rem; border-radius: 4px; font-size: .85em; }

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: #1e293b;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
  border: 1px solid #334155;
}
.auth-card h1 { margin: 0 0 .25rem; font-size: 1.35rem; }
.auth-card .sub { color: #94a3b8; font-size: .9rem; margin-bottom: 1.5rem; }

label { display: block; font-size: .85rem; color: #cbd5e1; margin-bottom: .35rem; }
input[type="text"], input[type="password"], input[type="date"], select {
  width: 100%;
  padding: .7rem .85rem;
  margin-bottom: 1rem;
  border: 1px solid #475569;
  border-radius: 8px;
  background: #0f172a;
  color: #f1f5f9;
  font-size: 1rem;
}
input:focus, select:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56,189,248,.2);
}
.checkbox-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1rem;
  font-size: .9rem;
  color: #cbd5e1;
  cursor: pointer;
}
.checkbox-row input { width: auto; margin: 0; }

.btn {
  display: inline-block;
  padding: .75rem 1.25rem;
  border: none;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.auth-card .btn { width: 100%; }
.btn:hover { background: #1d4ed8; text-decoration: none; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-secondary { background: #334155; color: #e2e8f0; border: 1px solid #475569; }
.btn-secondary:hover { background: #475569; }

.alert {
  padding: .75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: .9rem;
}
.alert-error { background: #450a0a; border: 1px solid #991b1b; color: #fecaca; }
.alert-ok { background: #052e16; border: 1px solid #166534; color: #bbf7d0; }

.layout-header {
  background: #1e293b;
  border-bottom: 1px solid #334155;
  padding: .85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
}
.header-left { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.header-right { display: flex; align-items: center; gap: .75rem; }
.brand { font-weight: 700; color: #f1f5f9; text-decoration: none; }
.brand:hover { text-decoration: none; color: #38bdf8; }
.nav { display: flex; gap: .35rem; flex-wrap: wrap; }
.nav-link {
  padding: .4rem .75rem;
  border-radius: 8px;
  color: #94a3b8;
  font-size: .9rem;
  text-decoration: none;
}
.nav-link:hover, .nav-link.active {
  background: #334155;
  color: #f1f5f9;
  text-decoration: none;
}

.layout-main { padding: 1.5rem; max-width: 1200px; margin: 0 auto; }
.card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 1.5rem;
}
.muted { color: #94a3b8; }
.btn-link {
  background: transparent;
  border: 1px solid #475569;
  color: #e2e8f0;
  padding: .45rem .9rem;
  border-radius: 8px;
  font-size: .9rem;
  text-decoration: none;
  display: inline-block;
}
.btn-link:hover { background: #334155; text-decoration: none; }
.btn-manual {
  border-color: #0f766e;
  color: #5eead4;
}
.btn-manual:hover { background: #134e4a; text-decoration: none; }

.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.stat-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 1.25rem;
}
.stat-label { color: #94a3b8; font-size: .85rem; }
.stat-value { font-size: 2rem; font-weight: 700; margin: .25rem 0; }
.stat-sub { color: #38bdf8; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }

.filters .filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: .75rem;
}
.filters input, .filters select { margin-bottom: 0; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th, .data-table td {
  padding: .65rem .75rem;
  border-bottom: 1px solid #334155;
  text-align: left;
  vertical-align: top;
}
.data-table th { color: #94a3b8; font-weight: 600; font-size: .8rem; text-transform: uppercase; }
.data-table tr:hover td { background: #0f172a; }

.badge {
  display: inline-block;
  padding: .2rem .5rem;
  border-radius: 6px;
  font-size: .75rem;
  background: #334155;
  color: #e2e8f0;
}
.badge-ok { background: #14532d; color: #bbf7d0; }
.badge-off { background: #450a0a; color: #fecaca; }

.actions { white-space: nowrap; }
.inline-form { display: inline; }
.link-danger {
  background: none;
  border: none;
  color: #f87171;
  cursor: pointer;
  font-size: inherit;
  padding: 0;
  text-decoration: underline;
}

.pagination { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: 1rem; }
.page-link {
  padding: .35rem .65rem;
  border-radius: 6px;
  background: #334155;
  color: #e2e8f0;
  text-decoration: none;
  font-size: .85rem;
}
.page-link.active, .page-link:hover { background: #2563eb; text-decoration: none; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.detail-full { grid-column: 1 / -1; }
.voucher-preview {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 8px;
  border: 1px solid #334155;
  margin-top: .5rem;
}

.config-bot-form .card-inner {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 1rem 1.25rem;
}
.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  cursor: pointer;
  margin: 0;
}
.toggle-row input { width: auto; margin-top: .25rem; margin-bottom: 0; }

.tabs { display: flex; gap: .5rem; flex-wrap: wrap; }
.tab {
  padding: .5rem 1rem;
  border-radius: 8px;
  background: #1e293b;
  border: 1px solid #334155;
  color: #94a3b8;
  text-decoration: none;
  font-size: .9rem;
}
.tab:hover, .tab.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  text-decoration: none;
}
.preview-box { margin-bottom: 1rem; }
input[type="file"] {
  width: 100%;
  margin-bottom: 1rem;
  color: #cbd5e1;
  font-size: .9rem;
}

/* Conexión WhatsApp */
.wa-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
}
.wa-status-pill {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1rem;
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 600;
  border: 1px solid #334155;
  background: #1e293b;
}
.wa-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}
.wa-dot.pulse { animation: wa-pulse 2s infinite; }
@keyframes wa-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(.85); }
}
.wa-qr-zone { text-align: center; padding: .5rem 0; }
.wa-qr-timer {
  display: inline-block;
  margin-bottom: 1rem;
  padding: .35rem .85rem;
  border-radius: 999px;
  background: #422006;
  color: #fbbf24;
  font-size: .82rem;
}
.wa-qr-frame {
  display: inline-block;
  padding: 1rem;
  background: #fff;
  border-radius: 12px;
  margin-bottom: 1rem;
}
.wa-qr-frame img { display: block; border-radius: 6px; }
.wa-steps {
  text-align: left;
  max-width: 380px;
  margin: 1rem auto 0;
  font-size: .88rem;
  color: #94a3b8;
  padding-left: 1.25rem;
}
.wa-steps li { margin: .35rem 0; }
.wa-banner { text-align: center; padding: 2rem 1rem; }
.wa-banner-icon {
  font-size: 3rem;
  margin-bottom: .5rem;
}
.wa-banner-icon.ok {
  width: 4rem;
  height: 4rem;
  line-height: 4rem;
  margin: 0 auto .75rem;
  border-radius: 50%;
  background: #14532d;
  color: #bbf7d0;
  font-size: 2rem;
  font-weight: 700;
}
.wa-toast-wrap {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.wa-toast {
  padding: .75rem 1rem;
  border-radius: 8px;
  background: #1e293b;
  border: 1px solid #334155;
  font-size: .88rem;
  max-width: 320px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.wa-toast.ok { border-color: #166534; }
.wa-toast.err { border-color: #991b1b; }
.btn-warn {
  background: #422006;
  border: 1px solid #b45309;
  color: #fbbf24;
}
.btn-warn:hover { background: #78350f; }
.btn-danger {
  background: #450a0a;
  border: 1px solid #991b1b;
  color: #fecaca;
}
.btn-danger:hover { background: #7f1d1d; }

@media (max-width: 640px) {
  .nav { width: 100%; }
}
