:root {
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #1e293b;
  --text: #f8fafc;
  --muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.18);
  --accent: #22c55e;
  --accent-2: #38bdf8;
  --bev-bg: rgba(56, 189, 248, 0.16);
  --bev-fg: #7dd3fc;
  --phev-bg: rgba(250, 204, 21, 0.16);
  --phev-fg: #fde047;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
}

[data-theme="light"] {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --muted: #475569;
  --border: rgba(15, 23, 42, 0.12);
  --accent: #16a34a;
  --accent-2: #0284c7;
  --bev-bg: rgba(2, 132, 199, 0.12);
  --bev-fg: #0369a1;
  --phev-bg: rgba(202, 138, 4, 0.14);
  --phev-fg: #854d0e;
  --shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

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

.brand-badge {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #061018;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: 10px;
  letter-spacing: 0.02em;
}

h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2.6vw, 1.9rem);
}

.subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.visit-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.88rem;
  box-shadow: var(--shadow);
}

.visit-pill strong {
  color: var(--accent);
}

.btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.88rem;
  font-family: inherit;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.btn:hover {
  border-color: var(--accent-2);
}

.btn-primary {
  background: var(--accent);
  color: #06120b;
  border-color: transparent;
}

.btn-small {
  padding: 5px 10px;
  font-size: 0.78rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.promo-card {
  margin-bottom: 18px;
  overflow: hidden;
}

.promo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.promo-tag {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-2);
}

.promo-viewport {
  overflow: hidden;
  width: 100%;
}

.promo-track {
  display: flex;
  gap: 14px;
  width: max-content;
  animation: marqueeScroll 36s linear infinite;
}

.promo-card.paused .promo-track,
.promo-viewport:hover .promo-track {
  animation-play-state: paused;
}

@keyframes marqueeScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.flyer-slide {
  width: 310px;
  flex: 0 0 auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: block;
}

.flyer-slide img {
  display: block;
  width: 100%;
  height: 155px;
  object-fit: cover;
  background: #0f172a;
}

.flyer-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.flyer-title {
  font-weight: 700;
  font-size: 0.96rem;
}

.flyer-desc {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.flyer-cta-row,
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--accent-2);
  color: #041019;
}

.cta-btn.wa {
  background: #22c55e;
  color: #051209;
}

.cta-btn.ig {
  background: #e11d48;
  color: #ffffff;
}

.grid-main {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.card-head h2,
.side-card h2 {
  margin: 0;
  font-size: 1.15rem;
}

.version-pill {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.spec-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  margin-bottom: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-full {
  grid-column: 1 / -1;
}

label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

input,
select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.95rem;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.result-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.res-label {
  font-size: 0.78rem;
  color: var(--muted);
}

.res-val {
  font-size: 1.3rem;
  font-weight: 800;
}

.res-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

.sync-status {
  margin: 10px 0 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-2);
}

.hint-text,
.muted-label {
  color: var(--muted);
  font-size: 0.84rem;
  margin: 0 0 12px;
}

.side-actions {
  margin-bottom: 14px;
}

.catalog-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.catalog-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.catalog-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.catalog-controls input {
  width: 240px;
}

.filter-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.filter-btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.filter-btn:hover {
  border-color: var(--accent-2);
  transform: translateY(-1px);
}

.filter-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #051018;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.25);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pill-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.pill-bev {
  background: var(--bev-bg);
  color: var(--bev-fg);
  border: 1px solid rgba(56, 189, 248, 0.28);
}

.pill-phev {
  background: var(--phev-bg);
  color: var(--phev-fg);
  border: 1px solid rgba(250, 204, 21, 0.28);
}

.pill-autonomy {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(34, 197, 94, 0.14);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.28);
}

[data-theme="light"] .pill-autonomy {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
  border-color: rgba(22, 163, 74, 0.25);
}

.catalog-cards {
  display: none;
  gap: 12px;
}

.info-card-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.98rem;
}

.info-card-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  font-size: 0.84rem;
}

.info-card-meta > div {
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

[data-theme="light"] .info-card-meta > div {
  background: #ffffff;
}

.info-card-meta span {
  color: var(--muted);
  font-size: 0.75rem;
}

.info-card-notes {
  font-size: 0.82rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

/* Tablet y móvil: convertir el catálogo en cards y acomodar controles */
@media (max-width: 1024px) {
  .grid-main {
    grid-template-columns: 1fr;
  }
  .table-wrap {
    display: none;
  }
  .catalog-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .catalog-controls {
    width: 100%;
    justify-content: space-between;
  }
  .catalog-controls input {
    flex: 1 1 220px;
    width: auto;
  }
}

@media (max-width: 640px) {
  .form-grid,
  .results-grid,
  .catalog-cards {
    grid-template-columns: 1fr;
  }
  .catalog-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .catalog-controls input {
    width: 100%;
  }
  .filter-group {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
}
