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

:root {
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --bg: #F6F7FB;
  --white: #fff;
  --border: #E5E7EB;
  --text-primary: #111827;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --accent-dollars: #6D5DF6;
  --accent-units: #0D9488;
  --em-green: #62A438;
  --em-gray: #555555;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
}

html, body {
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
}

/* ── Header ──────────────────────────────────────────────────── */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.site-header-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-logo-img {
  height: 36px;
  width: auto;
  flex-shrink: 0;
}
.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Main ────────────────────────────────────────────────────── */
.main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 44px 24px 64px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

/* ── Hero ────────────────────────────────────────────────────── */
.hero h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.hero p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ── Sections ────────────────────────────────────────────────── */
.report-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.section-divider {
  height: 1px;
  background: var(--border);
}

/* ── Section header ──────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.badge-dollars { background: rgba(109,93,246,0.10); color: var(--accent-dollars); }
.badge-units   { background: rgba(13,148,136,0.10);  color: var(--accent-units); }
.badge-range   { background: #F3F4F6; color: var(--text-secondary); }

/* ── Featured card ───────────────────────────────────────────── */
.featured-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 26px 22px 30px;
  text-decoration: none;
  color: var(--text-primary);
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.18s ease, transform 0.15s ease;
}
.featured-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
}
.featured-dollars::before { background: var(--accent-dollars); }
.featured-units::before   { background: var(--accent-units); }

.featured-card:hover {
  box-shadow: 0 6px 22px rgba(0,0,0,0.10);
  transform: translateY(-1px);
}

.featured-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.featured-eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.featured-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.15;
}
.featured-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.featured-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
}
.featured-badges {
  display: flex;
  gap: 6px;
}
.featured-cta {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}
.featured-dollars .featured-cta { color: var(--accent-dollars); }
.featured-units   .featured-cta { color: var(--accent-units); }

.featured-cta svg {
  width: 14px;
  height: 14px;
  transition: transform 0.15s ease;
}
.featured-card:hover .featured-cta svg { transform: translateX(3px); }

/* ── Year grid ───────────────────────────────────────────────── */
.year-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 10px;
}

/* ── Year card ───────────────────────────────────────────────── */
.year-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 8px;
  text-decoration: none;
  color: var(--text-primary);
  text-align: center;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.year-num {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  color: var(--text-primary);
}
.year-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  font-weight: 600;
}

.section-dollars .year-card:hover {
  border-color: var(--accent-dollars);
  box-shadow: 0 0 0 3px rgba(109,93,246,0.08);
  transform: translateY(-1px);
}
.section-units .year-card:hover {
  border-color: var(--accent-units);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.08);
  transform: translateY(-1px);
}

/* ── Monthly section ─────────────────────────────────────────── */
.section-monthly { --accent-monthly: #D97706; }

.badge-monthly {
  background: rgba(217,119,6,0.1);
  color: #D97706;
}

.section-monthly .section-title { color: #D97706; }

.section-monthly .section-header::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: #D97706;
  border-radius: 3px 0 0 3px;
}

.monthly-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.monthly-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.monthly-year-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-muted);
  min-width: 36px;
  text-align: right;
  flex-shrink: 0;
}

.monthly-months {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 6px;
  flex: 1;
}

.month-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  letter-spacing: 0.2px;
  transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.1s;
}
.month-cell:hover {
  background: rgba(217,119,6,0.06);
  border-color: #D97706;
  color: #D97706;
  transform: translateY(-1px);
}

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 24px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .year-grid { grid-template-columns: repeat(4, 1fr); }
  .featured-card { padding: 18px 20px 18px 24px; }
}

@media (max-width: 600px) {
  .main { padding: 28px 16px 48px; }
  .hero h1 { font-size: 20px; }
  .featured-title { font-size: 17px; }
  .featured-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .featured-right { align-items: flex-start; }
  .monthly-months { grid-template-columns: repeat(6, 1fr); }
  .monthly-year-label { min-width: 28px; font-size: 11px; }
}

@media (max-width: 400px) {
  .year-grid { grid-template-columns: repeat(2, 1fr); }
  .monthly-months { grid-template-columns: repeat(4, 1fr); }
}

/* ── Auth user pill ──────────────────────────────────────────── */
.auth-user-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-page, #F6F7FB);
  border: 1px solid var(--border, #E5E7EB);
  border-radius: 99px;
  padding: 4px 10px 4px 5px;
  margin-left: 4px;
}
.auth-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5FA03B, #7AC244);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.auth-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary, #111827);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-logout {
  display: flex;
  align-items: center;
  color: var(--text-muted, #9CA3AF);
  margin-left: 2px;
  transition: color 0.15s;
}
.auth-logout:hover { color: #DC2626; }
.auth-logout svg { width: 14px; height: 14px; }

@media (max-width: 768px) {
  .auth-name { display: none; }
  .auth-user-pill { padding: 4px 6px 4px 5px; }
}

/* ════════════════════════════════════════════════════════════════
   NAV WRAPPER — mode tabs + cat tabs
   ════════════════════════════════════════════════════════════════ */

.nav-wrapper {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.nav-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* ── Mode tabs (En dólares / Por unidad) ── */
.mode-tabs {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.mode-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.mode-tab:hover { background: var(--bg); }

.mode-tab[data-mode="dollars"].active {
  background: rgba(109,93,246,0.1);
  color: var(--accent-dollars);
}
.mode-tab[data-mode="units"].active {
  background: rgba(13,148,136,0.1);
  color: var(--accent-units);
}

/* ── Cat tabs (Comparativo / Anual / Mensual) ── */
.cat-tabs {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.cat-tab {
  padding: 5px 13px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.cat-tab:hover { border-color: var(--text-muted); color: var(--text-primary); }

.mode-dollars .cat-tab.active {
  background: var(--accent-dollars);
  color: #fff;
  border-color: var(--accent-dollars);
}
.mode-units .cat-tab.active {
  background: var(--accent-units);
  color: #fff;
  border-color: var(--accent-units);
}

/* ── Mode-aware hover on year cards ── */
.mode-dollars .year-card:hover {
  border-color: var(--accent-dollars);
  box-shadow: 0 0 0 3px rgba(109,93,246,0.08);
  transform: translateY(-1px);
}
.mode-units .year-card:hover {
  border-color: var(--accent-units);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.08);
  transform: translateY(-1px);
}

/* ── Mobile: section show/hide ── */
@media (max-width: 768px) {
  .report-section[data-cat]:not(.cat-active) { display: none; }
  .section-divider { display: none; }
}

/* ════════════════════════════════════════════════════════════════
   YEAR CARD — updated structure with bottom slot for mobile
   ════════════════════════════════════════════════════════════════ */

.year-card-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.year-card-bottom { display: none; }
.year-cta {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ════════════════════════════════════════════════════════════════
   YEAR ACCORDION (desktop: matrix / mobile: accordion)
   ════════════════════════════════════════════════════════════════ */

.year-accordion {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Desktop: matrix row (year label + 12 months inline) */
.year-acc {
  display: flex;
  align-items: center;
  gap: 10px;
}

.year-acc-hdr {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 0;
  min-width: 36px;
  text-align: right;
  cursor: default;
  pointer-events: none;
  flex-shrink: 0;
}

.year-acc-num {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-muted);
}

.chevron { display: none; }

.year-acc-months {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 6px;
  flex: 1;
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════ */

/* Tablet */
@media (max-width: 900px) {
  .nav-inner { padding: 10px 20px; }
}

/* Mobile */
@media (max-width: 768px) {

  /* Sticky nav */
  .nav-wrapper {
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  }
  .nav-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 16px;
  }
  .mode-tabs { gap: 6px; }
  .mode-tab  { flex: 1; justify-content: center; padding: 8px 10px; font-size: 13px; }
  .cat-tabs  { gap: 6px; }
  .cat-tab   { flex: 1; text-align: center; padding: 6px 8px; font-size: 12px; }

  /* Main padding */
  .main { padding: 20px 16px 48px; gap: 24px; }

  /* Year grid: single-column horizontal cards */
  .year-grid { grid-template-columns: 1fr; gap: 8px; }

  .year-card {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    text-align: left;
  }
  .year-card-top {
    align-items: flex-start;
    gap: 2px;
  }
  .year-card-top .year-num  { font-size: 20px; }
  .year-card-top .year-label { font-size: 11px; }

  .year-card-bottom {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
  }

  /* Accordion: mobile layout */
  .year-acc {
    flex-direction: column;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    gap: 0;
  }
  .year-acc-hdr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    width: 100%;
    min-width: unset;
    text-align: left;
    cursor: pointer;
    pointer-events: auto;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s;
  }
  .year-acc.open .year-acc-hdr { border-bottom-color: var(--border); }
  .year-acc-num { font-size: 16px; color: var(--text-primary); }
  .chevron {
    display: block;
    color: var(--text-muted);
    transition: transform 0.2s;
    flex-shrink: 0;
  }
  .year-acc.open .chevron { transform: rotate(180deg); }

  .year-acc-months {
    display: none;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 12px;
  }
  .year-acc.open .year-acc-months { display: grid; }
}
