:root {
  --red: #d71920;
  --red-dark: #ae1117;
  --red-soft: #fff0f0;
  --ink: #161719;
  --ink-soft: #34373b;
  --muted: #656a70;
  --muted-light: #81878e;
  --bg: #f3f4f5;
  --panel: #fff;
  --line: #dedfe1;
  --line-strong: #c8cace;
  --success: #277553;
  --success-bg: #e9f4ee;
  --radius: 14px;
  --shadow: 0 9px 28px rgba(18, 19, 21, .055);
  --sans: Inter, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, select, input { font: inherit; }
a { color: inherit; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(18, 19, 21, .97); color: #fff;
  border-bottom: 3px solid var(--red);
  backdrop-filter: blur(10px);
}
.topbar__inner {
  max-width: 1240px; min-height: 68px; margin: 0 auto; padding: 11px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-height: 50px; }
.brand__logo { display: block; width: 50px; height: 50px; flex: none; padding: 3px; border-radius: 11px; background: #fff; object-fit: contain; }
.brand__tag { display: none; color: #b8bcc1; font-size: 11px; padding-left: 9px; border-left: 1px solid #4b4e53; }
.menu-toggle {
  width: 44px; height: 44px; border: 1px solid #45484d; border-radius: 10px;
  background: transparent; color: #fff; display: grid; place-content: center; gap: 5px; cursor: pointer;
}
.menu-toggle span:not(.sr-only) { display: block; width: 19px; height: 2px; background: currentColor; border-radius: 2px; }
.nav { display: none; width: 100%; padding: 7px 0 5px; gap: 4px; }
.nav.open { display: grid; }
.nav a {
  min-height: 44px; padding: 10px 14px; border-radius: 8px; text-decoration: none;
  color: #d8dade; display: flex; align-items: center;
}
.nav a:hover { background: #292b2f; color: #fff; }
.nav a.active { background: var(--red); color: #fff; font-weight: 650; }

.container { max-width: 1240px; margin: 0 auto; padding: 24px 14px 44px; }
.login-wrap { min-height: calc(100vh - 72px); display: grid; place-items: center; padding: 24px 14px; }
.login-panel { width: min(100%, 420px); padding: 28px; }
.login-panel h1 { font-size: 32px; }
.login-form { display: grid; gap: 12px; margin-top: 24px; }
.login-form label { font-weight: 700; font-size: 13px; }
.login-form input { min-height: 44px; width: 100%; border: 1px solid var(--line-strong); border-radius: 9px; padding: 10px 12px; font-size: 16px; }
.login-form .button { width: 100%; }
.login-error { color: #a31319; background: var(--red-soft); padding: 10px 12px; border-radius: 8px; }
.hero { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
.eyebrow { margin: 0 0 5px; color: var(--red); font-size: 11px; letter-spacing: .13em; font-weight: 800; }
h1, h2, h3, p { text-wrap: pretty; }
h1 { margin: 0; font-family: var(--serif); font-size: clamp(30px, 7vw, 46px); line-height: 1.08; font-weight: 500; }
h2 { margin: 0; font-family: var(--serif); font-size: clamp(22px, 5vw, 29px); line-height: 1.2; font-weight: 500; }
h3 { margin: 0 0 18px; font-size: 14px; font-weight: 700; }
.hero__copy { max-width: 650px; color: var(--muted); margin: 8px 0 0; }
.status-pill {
  min-height: 36px; display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px;
  border-radius: 99px; background: var(--success-bg); color: var(--success); font-size: 12px; font-weight: 700;
}
.status-pill span { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px rgba(39,117,83,.12); }
.status-pill--neutral { color: var(--muted); background: #e7e8ea; }
.status-pill--neutral span { box-shadow: 0 0 0 4px rgba(101,106,112,.12); }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.tabs { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.tabs a { min-height: 44px; border-radius: 9px; padding: 8px 5px; color: var(--muted); font-size: 12px; text-align: center; text-decoration: none; display: grid; place-items: center; }
.tabs a:hover { color: var(--ink); background: #f1f1f2; }
.tabs a.active { background: var(--ink); color: #fff; font-weight: 700; }
.select-label, .select-label select { width: 100%; }
select, input[type="month"] { min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); padding: 9px 12px; font-size: 16px; }
.filter-note { color: var(--muted); font-size: 12px; }

.kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-bottom: 18px; }
.kpi { min-width: 0; padding: 15px 13px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.kpi--featured { grid-column: 1 / -1; position: relative; overflow: hidden; background: var(--ink); color: #fff; border-color: var(--ink); padding-right: 72px; }
.kpi--featured::after { content: ""; position: absolute; right: -25px; bottom: -65px; width: 145px; height: 145px; border: 22px solid rgba(215,25,32,.62); border-radius: 50%; }
.kpi--featured > * { position: relative; z-index: 1; }
.kpi__icon { position: absolute; top: 15px; right: 15px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--red); font-size: 19px; }
.kpi__label { margin: 0 0 8px; color: var(--muted); font-size: 10px; letter-spacing: .075em; font-weight: 800; text-transform: uppercase; }
.kpi--featured .kpi__label { color: #d3d4d6; }
.kpi__value { margin: 0; font-family: var(--serif); font-size: clamp(20px, 5vw, 30px); line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi__value small { font-size: .58em; color: var(--muted); }
.kpi--featured .kpi__value small { color: #b6b9bd; }
.kpi__detail { margin: 8px 0 0; color: var(--muted-light); font-size: 11px; line-height: 1.35; }
.kpi--featured .kpi__detail { color: #afb2b7; }
.kpi__comparison { margin: 10px 0 0; font-size: 12px; font-weight: 800; line-height: 1.25; }
.kpi__comparison span { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 500; }
.kpi__comparison--good { color: var(--success); }
.kpi__comparison--bad { color: var(--red-dark); }
.kpi__comparison--neutral { color: var(--ink-soft); }
.kpi--featured .kpi__comparison--good { color: #7dd2a4; }
.kpi--featured .kpi__comparison--bad { color: #ff9a9e; }
.kpi--featured .kpi__comparison--neutral { color: #e0e1e3; }
.kpi--featured .kpi__comparison span { color: #afb2b7; }
.comparison-note { margin: -4px 0 18px; color: var(--muted); font-size: 12px; }

.panel { margin-bottom: 16px; padding: 18px 15px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
#tendencia, #conversiones, #campanas { scroll-margin-top: 90px; }
.section-heading { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
.section-heading > p { max-width: 520px; margin: 0; color: var(--muted); font-size: 13px; }
.charts-grid { display: grid; gap: 12px; }
.chart-card { padding: 16px 14px; border: 1px solid #e6e7e9; border-radius: 12px; background: #fafafa; }
.trend-grid { display: grid; gap: 12px; }
.trend-card { min-width: 0; padding: 17px 14px; border: 1px solid #e6e7e9; border-radius: 12px; background: #fafafa; }
.trend-card h3 { margin-bottom: 10px; }
.trend-chart { display: flex; align-items: flex-end; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; border-bottom: 1px solid var(--line); }
.trend-month { min-width: 74px; height: 143px; flex: 1 0 74px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; text-align: center; }
.trend-month strong { max-width: 100%; color: var(--ink-soft); font-size: 10px; font-weight: 750; white-space: nowrap; }
.trend-month small { color: var(--muted); font-size: 10px; white-space: nowrap; }
.trend-bar { width: min(48px, 65%); flex: none; border-radius: 6px 6px 2px 2px; }
.trend-bar--red { background: var(--red); }
.trend-bar--dark { background: #303337; }
.trend-bar--gold { background: #bd8b3d; }
.trend-bar--green { background: var(--success); }
.action-history { margin-top: 24px; }
.action-history h3 { margin-bottom: 10px; }
.action-history__scroll { overflow-x: auto; }
.action-history table { min-width: 560px; width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.action-history th, .action-history td { padding: 9px 11px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.action-history th:first-child { text-align: left; }
.action-history thead th { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.action-history tbody tr:last-child th, .action-history tbody tr:last-child td { border-bottom: 0; }
.bar-chart { display: grid; gap: 17px; }
.bar-row__label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; font-size: 12px; color: var(--muted); }
.bar-row__label strong { color: var(--ink); font-size: 13px; }
.bar-track { height: 10px; overflow: hidden; border-radius: 99px; background: #e6e7e9; }
.bar-track span { display: block; height: 100%; min-width: 5px; border-radius: inherit; background: linear-gradient(90deg, var(--red), #ef4b50); }
.donut-layout { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 17px; align-items: center; }
.donut { width: min(100%, 164px); aspect-ratio: 1; border-radius: 50%; background: conic-gradient(var(--red) 0 var(--donut-first), #51555a var(--donut-first) var(--donut-second), #b7bbc0 var(--donut-second) 100%); display: grid; place-items: center; }
.donut--empty { background: #e8e9ea; }
.donut__center { width: 73%; aspect-ratio: 1; border-radius: 50%; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.donut__center strong { color: var(--ink); font: 700 28px var(--sans); font-variant-numeric: tabular-nums; }
.donut__center span { margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.legend { list-style: none; width: min(100%, 280px); padding: 0; margin: 0; display: grid; gap: 10px; }
.legend li { display: grid; grid-template-columns: 9px 1fr auto; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); }
.legend i { width: 9px; height: 9px; border-radius: 3px; }
.legend strong { color: var(--ink); }
.legend__one { background: var(--red); }
.legend__two { background: #51555a; }
.legend__three { background: #b7bbc0; }

.table-wrap { overflow-x: visible; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 11px 10px; text-align: right; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table thead th { color: var(--muted); border-bottom: 2px solid var(--ink); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.data-table tbody tr { border-bottom: 1px solid var(--line); }
.data-table tfoot td { border-top: 2px solid var(--ink); background: #f6f6f7; font-weight: 800; }
.cell-note { display: block; color: var(--muted); font-size: 11px; font-weight: 400; }
.chip { display: inline-flex; align-items: center; border-radius: 99px; padding: 4px 9px; background: #eceeef; color: var(--ink-soft); font-size: 10px; letter-spacing: .04em; font-weight: 800; text-transform: uppercase; white-space: nowrap; }
.chip--live { background: var(--success-bg); color: var(--success); }

.insight { display: grid; grid-template-columns: 4px 1fr; gap: 14px; margin-top: 18px; padding: 19px 17px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--ink); color: #fff; }
.insight__bar { grid-row: 1 / span 2; border-radius: 99px; background: var(--red); }
.insight h2 { font-size: 21px; }
.insight p:last-child { margin: 8px 0 0; color: #b8bbc0; font-size: 13px; }
.insight > .chip { grid-column: 2; justify-self: start; background: #313338; color: #e0e1e3; }
.insight__month { margin: 4px 0 0; color: #b8bbc0; font-size: 12px; }
.insight h3 { margin: 18px 0 0; color: #fff; }
.insight__edit { text-decoration: none; }
.insight__edit:hover { background: #44474d; }

.admin-grid { display: grid; gap: 16px; align-items: start; }
.admin-grid .panel h2 { margin-bottom: 8px; }
.admin-copy { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.admin-form { display: grid; gap: 10px; }
.admin-form label, .admin-month label { font-size: 13px; font-weight: 700; }
.admin-form input[type="text"], .admin-form input[type="password"], .admin-form textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; color: var(--ink); font: inherit; font-size: 15px; }
.admin-form textarea { min-height: 110px; resize: vertical; }
.admin-form .button { justify-self: start; }
.form-help { margin: 0; color: var(--muted); font-size: 12px; }
.admin-check { display: flex; align-items: center; gap: 9px; margin: 5px 0; }
.admin-check input { width: 18px; height: 18px; accent-color: var(--red); }
.admin-month { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.admin-month select { max-width: 210px; }
.admin-disable { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.admin-error { border-color: var(--red); background: var(--red-soft); color: var(--red-dark); }

.connection-grid { display: grid; gap: 16px; }
.connection-title { display: flex; align-items: center; gap: 13px; margin-bottom: 18px; }
.connection-icon { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--success-bg); color: var(--success); font-size: 21px; font-weight: 800; }
.connection-title h2 { font-size: 22px; }
.notice { display: grid; gap: 2px; margin-bottom: 18px; padding: 13px 14px; border-left: 3px solid; border-radius: 7px; font-size: 13px; }
.notice--success { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.notice span { color: var(--ink-soft); }
.account-data { margin: 0 0 20px; }
.account-data div { display: flex; justify-content: space-between; gap: 20px; padding: 10px 0; border-bottom: 1px solid #ededee; }
.account-data dt { color: var(--muted); font-size: 12px; }
.account-data dd { margin: 0; text-align: right; font-size: 13px; font-weight: 700; }
.button { min-height: 44px; padding: 10px 16px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; color: var(--ink); cursor: pointer; font-weight: 700; }
.button--primary { width: 100%; background: var(--red); border-color: var(--red); color: #fff; }
.button--primary:hover { background: var(--red-dark); }
.button:disabled { opacity: .5; cursor: not-allowed; }
.prototype-message { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.next-step { background: var(--ink); color: #fff; }
.next-step h2 { font-size: 23px; }
.step-list { list-style: none; display: grid; gap: 18px; margin: 22px 0 0; padding: 0; }
.step-list li { display: grid; grid-template-columns: 30px 1fr; gap: 11px; }
.step-list li > span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--red); font-size: 12px; font-weight: 800; }
.step-list strong, .step-list small { display: block; }
.step-list strong { font-size: 13px; }
.step-list small { margin-top: 3px; color: #aeb1b5; line-height: 1.45; }
.sync-row { display: grid; gap: 12px; }
.sync-row label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.sync-state { min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.sync-state__dot { width: 10px; height: 10px; border-radius: 50%; background: #aeb1b5; box-shadow: 0 0 0 4px #eeeff0; }
.sync-state strong, .sync-state small { display: block; }
.sync-state strong { font-size: 12px; }
.sync-state small { color: var(--muted); font-size: 11px; }
.expected-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.expected-grid div { padding: 14px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafafa; }
.expected-grid span, .expected-grid strong { display: block; }
.expected-grid span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.expected-grid strong { margin-top: 4px; font-family: var(--serif); font-size: 18px; white-space: nowrap; }

.footer { max-width: 1240px; margin: 0 auto; padding: 20px 16px 30px; border-top: 1px solid var(--line); color: var(--muted); display: flex; flex-direction: column; gap: 4px; font-size: 11px; }

@media screen and (max-width: 699.98px) {
  .data-table, .data-table tbody, .data-table tfoot, .data-table tr, .data-table td { display: block; }
  .data-table thead { display: none; }
  .data-table tbody tr, .data-table tfoot tr { margin-bottom: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
  .data-table td { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; padding: 8px 0; border-bottom: 1px solid #eeeeef; text-align: right; }
  .data-table tr td:last-child { border-bottom: 0; }
  .data-table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .055em; text-align: left; text-transform: uppercase; }
  .data-table td:first-child { display: block; padding-bottom: 10px; margin-bottom: 2px; border-bottom: 2px solid var(--line); text-align: left; }
  .data-table tfoot tr { border: 2px solid var(--ink); background: #f6f6f7; }
  .data-table tfoot td { border-top: 0; background: transparent; }
  .data-table tfoot td:first-child { color: var(--red); }
}

@media (min-width: 700px) {
  .topbar__inner { min-height: 76px; padding: 12px 26px; }
  .brand__logo { width: 56px; height: 56px; }
  .brand__tag { display: inline; }
  .menu-toggle { display: none; }
  .nav { display: flex; width: auto; padding: 0; }
  .nav a { min-height: 38px; padding: 8px 15px; }
  .container { padding: 36px 26px 58px; }
  .hero { flex-direction: row; justify-content: space-between; align-items: flex-end; margin-bottom: 26px; }
  .filters { flex-wrap: nowrap; margin-bottom: 18px; }
  .tabs { width: auto; }
  .tabs a { min-height: 38px; min-width: 78px; }
  .select-label, .select-label select { width: auto; }
  select, input[type="month"] { min-height: 40px; font-size: 14px; }
  .filter-note { margin-left: auto; }
  .kpi-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .kpi { padding: 17px; }
  .kpi__value--wide { font-size: 20px; white-space: nowrap; letter-spacing: -.03em; }
  .kpi--featured { grid-column: auto; }
  .panel { padding: 24px; }
  .section-heading { flex-direction: row; align-items: flex-end; justify-content: space-between; }
  .section-heading > p { text-align: right; }
  .charts-grid { grid-template-columns: 1.12fr .88fr; }
  .trend-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-card { padding: 20px; }
  .insight { grid-template-columns: 4px 1fr auto; align-items: center; padding: 24px; }
  .insight > .chip { grid-column: 3; grid-row: 1 / span 2; }
  .connection-grid { grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); }
  .button--primary { width: auto; }
  .sync-row { grid-template-columns: 240px auto 1fr; align-items: end; }
  .sync-state { justify-self: end; }
  .expected-grid { grid-template-columns: repeat(4, 1fr); }
  .footer { padding-inline: 26px; flex-direction: row; justify-content: space-between; }
}

@media (min-width: 1050px) {
  .kpi-grid { grid-template-columns: repeat(7, 1fr); }
  .kpi__value { font-size: 23px; }
  .kpi__value--wide { font-size: 19px; }
  .kpi { min-height: 151px; }
  .donut-layout { grid-template-columns: 164px minmax(0, 1fr); justify-items: stretch; }
  .legend { width: 100%; }
  .admin-grid { grid-template-columns: minmax(300px, .8fr) minmax(0, 1.2fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
