/* =============================================================
   CalculaVisitas — hoja de estilo única
   1 Tokens · 2 Reset · 3 Utilidades · 4 Tipografía · 5 Componentes
   6 Secciones · 7 Anuncios · 8 Responsive · 9 Reduced motion
   ============================================================= */

/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  color-scheme: light;
  --bg:        #f4f6fb;
  --bg-grad:   radial-gradient(1200px 600px at 15% -10%, #e5e9ff 0%, rgba(229,233,255,0) 60%),
               radial-gradient(900px 500px at 95% 0%, #e2f7f5 0%, rgba(226,247,245,0) 55%);
  --surface:   #ffffff;
  --surface-2: #f8f9fd;
  --surface-3: #eef1f8;
  --text:      #101423;
  --text-2:    #4a5169;
  --muted:     #737b93;
  --border:    #e2e6f1;
  --border-2:  #d4daea;
  --accent:    #4f5dff;
  --accent-2:  #7b5cff;
  --accent-ink:#ffffff;
  --accent-soft: rgba(79, 93, 255, .10);
  --good:      #12a36b;
  --shadow-sm: 0 1px 2px rgba(16,20,35,.05), 0 2px 8px rgba(16,20,35,.05);
  --shadow-md: 0 4px 12px rgba(16,20,35,.07), 0 16px 40px rgba(16,20,35,.07);
  --shadow-lg: 0 12px 28px rgba(16,20,35,.10), 0 40px 80px rgba(16,20,35,.10);

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --r-sm: 8px;  --r-md: 12px;  --r-lg: 18px;  --r-xl: 26px;
  --gutter: clamp(1rem, 4vw, 2rem);
  --maxw: 1180px;
  --ease-out: cubic-bezier(.16,1,.3,1);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg:        #080b16;
  --bg-grad:   radial-gradient(1200px 600px at 12% -10%, rgba(79,93,255,.20) 0%, rgba(79,93,255,0) 60%),
               radial-gradient(900px 500px at 95% 0%, rgba(32,213,200,.13) 0%, rgba(32,213,200,0) 55%);
  --surface:   #101728;
  --surface-2: #151d33;
  --surface-3: #1b2440;
  --text:      #edf1fa;
  --text-2:    #b6bfd8;
  --muted:     #8a95b4;
  --border:    #232d4a;
  --border-2:  #2e3a5e;
  --accent:    #7b88ff;
  --accent-2:  #9d7bff;
  --accent-ink:#0a0e1c;
  --accent-soft: rgba(123, 136, 255, .14);
  --good:      #2fd39a;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,.4), 0 16px 40px rgba(0,0,0,.35);
  --shadow-lg: 0 12px 28px rgba(0,0,0,.5), 0 40px 80px rgba(0,0,0,.45);
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.62;
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  min-height: 100vh;
}
img, svg, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.14; letter-spacing: -.022em; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* =============================================================
   3. Utilidades
   ============================================================= */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.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;
}
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 999;
  padding: .6rem 1rem; background: var(--accent); color: var(--accent-ink);
  border-radius: var(--r-sm); font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   4. Tipografía general
   ============================================================= */
h1 { font-size: clamp(1.42rem, 4.4vw, 3.1rem); font-weight: 800; }
h2 { font-size: clamp(1.45rem, 3vw, 2.1rem); font-weight: 750; }
h3 { font-size: 1.06rem; font-weight: 650; letter-spacing: -.01em; }
.section { padding-block: clamp(2.6rem, 6vw, 4.4rem); }
.section > h2 { margin-bottom: .5rem; }
.section-lead { color: var(--text-2); max-width: 62ch; margin-bottom: 2rem; }

/* =============================================================
   5. Cabecera
   ============================================================= */
.site-header {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 1.2rem; height: 62px; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; letter-spacing: -.02em; font-size: 1.05rem; }
.brand b { font-weight: 800; color: var(--accent); }
.brand-mark { width: 26px; height: 26px; flex: none; }
.brand-mark rect { fill: var(--accent); }
.brand-mark path { stroke: var(--accent-ink); }
.site-nav { margin-left: auto; display: none; gap: 1.35rem; font-size: .92rem; color: var(--text-2); }
.site-nav a { padding: .25rem 0; border-bottom: 2px solid transparent; transition: color .2s var(--ease-out), border-color .2s var(--ease-out); }
.site-nav a:hover { color: var(--text); border-bottom-color: var(--accent); }
.theme-toggle {
  margin-left: auto; width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text-2);
  transition: color .2s, border-color .2s, transform .2s var(--ease-out);
}
.site-nav + .theme-toggle { margin-left: 0; }
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }

/* =============================================================
   6. Hero
   ============================================================= */
.hero { padding-block: clamp(.9rem, 4vw, 2.8rem) 1rem; text-align: center; }
.eyebrow {
  display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--accent);
  background: var(--accent-soft); padding: .28rem .75rem; border-radius: 999px; margin-bottom: .7rem;
}
.hero h1 { max-width: 20ch; margin-inline: auto; }
.hero-sub { color: var(--text-2); max-width: 62ch; margin: .7rem auto 0; font-size: clamp(.88rem, 1.6vw, 1.08rem); line-height: 1.5; }

/* =============================================================
   7. La tarjeta-herramienta
   ============================================================= */
.tool-wrap { padding-bottom: .5rem; }
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.tool-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
.panel { padding: clamp(1.15rem, 3vw, 1.9rem); min-width: 0; }
.panel-controls { background: var(--surface-2); border-bottom: 1px solid var(--border); }
.panel-title {
  font-size: .76rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 1.15rem;
}

.field { margin-bottom: 1.35rem; }
.field:last-child { margin-bottom: 0; }
.field label, .label-as-legend {
  display: block; font-size: .88rem; font-weight: 600; margin-bottom: .45rem; color: var(--text);
}
.hint { font-weight: 400; color: var(--muted); }
.help { font-size: .79rem; color: var(--muted); margin-top: .45rem; line-height: 1.45; }

.views-row { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.views-row input { min-width: 0; }
input[type="text"], select {
  width: 100%; padding: .7rem .85rem;
  border: 1px solid var(--border-2); border-radius: var(--r-md);
  background: var(--surface); color: var(--text);
  font: inherit; font-variant-numeric: tabular-nums;
  transition: border-color .18s, box-shadow .18s;
}
#views { font-size: 1.22rem; font-weight: 700; letter-spacing: -.01em; }
input[type="text"]:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.views-unit { font-size: .8rem; color: var(--muted); white-space: nowrap; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%23888' stroke-width='1.7' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .85rem center;
  padding-right: 2.1rem; cursor: pointer;
}

/* Sliders */
.slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; margin-top: .8rem;
  border-radius: 999px; background: var(--surface-3); cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--surface);
  box-shadow: 0 1px 6px rgba(0,0,0,.28);
  transition: transform .15s var(--ease-out);
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.14); }
.slider::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--surface);
  box-shadow: 0 1px 6px rgba(0,0,0,.28);
}
.slider-accent { background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%); opacity: .95; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }
.chip {
  font-size: .78rem; font-weight: 600; padding: .32rem .68rem;
  border: 1px solid var(--border-2); border-radius: 999px;
  color: var(--text-2); background: var(--surface);
  transition: all .18s var(--ease-out);
}
.chip:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

.segmented {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  padding: 4px; background: var(--surface-3); border-radius: var(--r-md);
}
.seg {
  display: flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem .3rem; border-radius: 9px;
  font-size: .87rem; font-weight: 600; color: var(--text-2);
  transition: background .2s var(--ease-out), color .2s, box-shadow .2s;
}
.seg-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.seg-dot[data-dot="youtube"] { background: #ff4d4d; }
.seg-dot[data-dot="shorts"]  { background: #ffb020; }
.seg-dot[data-dot="tiktok"]  { background: #20d5c8; }
.seg.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.field-head { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; min-width: 0; }
.field-head label { min-width: 0; }
.field-head label { margin-bottom: .45rem; }
.rpm-out {
  font-size: 1.12rem; font-weight: 800; color: var(--accent);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.rpm-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem; flex-wrap: wrap; }
.rpm-foot .help { min-width: 0; flex: 1 1 60%; }
.link-btn {
  font-size: .78rem; font-weight: 600; color: var(--accent);
  text-decoration: underline; text-underline-offset: 2px; margin-top: .45rem; white-space: nowrap;
}
.field-inline { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .6rem 1rem; }
.field-inline label { margin-bottom: 0; }
.field-inline select { width: auto; min-width: 140px; padding-block: .45rem; }
.field-inline .help { grid-column: 1 / -1; margin-top: 0; }

/* Resultados */
.kpi {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 1rem 1.1rem;
}
.kpi-hero {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  border-color: transparent; color: #fff; padding: 1.25rem 1.3rem;
}
.kpi-label { display: block; font-size: .78rem; font-weight: 600; letter-spacing: .02em; color: var(--muted); }
.kpi-hero .kpi-label { color: rgba(255,255,255,.82); }
.kpi-value {
  display: block; margin-top: .2rem;
  font-size: 1.42rem; font-weight: 800; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; line-height: 1.15;
}
.kpi-hero .kpi-value { font-size: clamp(2rem, 6.5vw, 2.9rem); }
.kpi-sub { display: block; margin-top: .3rem; font-size: .8rem; color: rgba(255,255,255,.85); }
.kpi-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: .5rem; margin-top: .6rem; }
.kpi-row .kpi {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: .8rem; padding: .7rem .9rem; min-width: 0;
}
.kpi-row .kpi-label { min-width: 0; }
.kpi-row .kpi-value { margin-top: 0; font-size: 1.05rem; white-space: nowrap; }

/* Gráficos */
.chart-block {
  margin-top: 1.2rem; padding: 1rem;
  border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2);
}
.chart-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .9rem; }
.chart-title { font-size: .93rem; font-weight: 700; }
.tabs { display: flex; gap: 3px; padding: 3px; background: var(--surface-3); border-radius: 999px; }
.tab {
  font-size: .76rem; font-weight: 600; padding: .3rem .7rem; border-radius: 999px;
  color: var(--muted); transition: background .2s, color .2s;
}
.tab.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.chart-holder { position: relative; }
#chart { width: 100%; height: 260px; touch-action: pan-y; }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none;
  transform: translate(-50%, -115%);
  background: var(--text); color: var(--bg);
  padding: .38rem .6rem; border-radius: 8px;
  font-size: .76rem; font-weight: 600; white-space: nowrap;
  box-shadow: var(--shadow-md);
}
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: .45rem; padding: 0; margin-top: .8rem; }
.legend li {
  display: flex; align-items: center; gap: .4rem;
  font-size: .78rem; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border);
  padding: .3rem .6rem; border-radius: 999px;
}
.legend li.is-current { border-color: var(--accent); color: var(--text); font-weight: 600; }
.legend .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.legend b { font-variant-numeric: tabular-nums; }
.chart-note { font-size: .76rem; color: var(--muted); margin-top: .6rem; }

/* Acciones */
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.2rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.15rem; border-radius: var(--r-md);
  font-size: .93rem; font-weight: 650; letter-spacing: -.01em;
  transition: transform .18s var(--ease-out), box-shadow .18s, background .18s, opacity .18s;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary {
  flex: 1 1 260px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff; box-shadow: var(--shadow-md);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-primary[disabled] { opacity: .6; cursor: progress; transform: none; }
.btn-ghost { border: 1px solid var(--border-2); color: var(--text-2); background: var(--surface); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost.is-done { color: var(--good); border-color: var(--good); }

.tool-error {
  margin-top: .8rem; padding: .65rem .85rem; border-radius: var(--r-md);
  font-size: .84rem; font-weight: 600;
  background: rgba(220, 60, 60, .12); color: #d4453f;
  border: 1px solid rgba(220, 60, 60, .3);
}
html[data-theme="dark"] .tool-error { color: #ff8f8a; }

.privacy-badge {
  margin-top: 1rem; font-size: .8rem; color: var(--text-2);
  background: var(--accent-soft); border-radius: var(--r-md); padding: .6rem .8rem;
}
.limits { margin-top: .55rem; font-size: .75rem; color: var(--muted); line-height: 1.5; }
.noscript-msg {
  margin: 0 clamp(1.15rem,3vw,1.9rem) clamp(1.15rem,3vw,1.9rem);
  padding: .8rem 1rem; border-radius: var(--r-md);
  background: #fff3cd; color: #6a4b00; font-size: .88rem; font-weight: 600;
}

/* =============================================================
   8. Secciones de contenido
   ============================================================= */
.steps { list-style: none; padding: 0; display: grid; gap: 1rem; grid-template-columns: 1fr; counter-reset: s; }
.step {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 1.5rem 1.3rem 1.3rem; box-shadow: var(--shadow-sm);
}
.step-num {
  position: absolute; top: -14px; left: 1.3rem;
  width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 50%; font-size: .85rem; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  box-shadow: var(--shadow-sm);
}
.step-icon { width: 26px; height: 26px; color: var(--accent); margin-bottom: .7rem; }
.step h3 { margin-bottom: .35rem; }
.step p { font-size: .88rem; color: var(--text-2); }

.section-prose { max-width: 78ch; }
.section-prose h3 { margin: 1.6rem 0 .4rem; font-size: 1.12rem; }
.section-prose p { color: var(--text-2); margin-bottom: .7rem; }
.section-prose strong { color: var(--text); font-weight: 650; }

.cards { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 1.25rem; box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease-out), box-shadow .2s, border-color .2s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-2); }
.card h3 { margin-bottom: .4rem; }
.card p { font-size: .88rem; color: var(--text-2); }

.table-scroll {
  overflow-x: auto; border: 1px solid var(--border);
  border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-sm);
}
.rpm-table { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 460px; }
.rpm-table th, .rpm-table td { padding: .72rem 1rem; text-align: right; }
.rpm-table th:first-child, .rpm-table td:first-child { text-align: left; }
.rpm-table thead th {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
.rpm-table tbody tr + tr { border-top: 1px solid var(--border); }
.rpm-table tbody tr:hover { background: var(--accent-soft); }
.rpm-table td { font-variant-numeric: tabular-nums; color: var(--text-2); }
.rpm-table td:first-child { color: var(--text); font-weight: 550; }
.table-note { font-size: .78rem; color: var(--muted); margin-top: .8rem; }

.faq {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); margin-bottom: .6rem; overflow: hidden;
}
.faq summary {
  list-style: none; cursor: pointer; padding: .95rem 2.6rem .95rem 1.1rem;
  font-weight: 620; font-size: .95rem; position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: 1.15rem; top: 50%;
  width: 9px; height: 9px; margin-top: -6px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .22s var(--ease-out);
}
.faq[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.faq summary:hover { color: var(--accent); }
.faq-body { padding: 0 1.1rem 1.05rem; }
.faq-body p { font-size: .89rem; color: var(--text-2); }

/* =============================================================
   9. Pie
   ============================================================= */
.site-footer { border-top: 1px solid var(--border); margin-top: 2rem; padding-block: 2rem 2.6rem; background: var(--surface); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 1.4rem; justify-content: space-between; align-items: flex-start; }
.footer-tag { font-size: .84rem; color: var(--muted); margin-top: .5rem; max-width: 40ch; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 1.1rem; font-size: .87rem; color: var(--text-2); }
.footer-nav a:hover { color: var(--accent); }
.footer-legal { font-size: .74rem; color: var(--muted); margin-top: 1.6rem; max-width: 90ch; }

/* =============================================================
   10. Huecos de anuncios (placeholders — sin código de terceros)
   ============================================================= */
.ad-slot {
  position: relative;
  display: grid; place-items: center;
  border: 1px dashed var(--border-2); border-radius: var(--r-md);
  background: repeating-linear-gradient(45deg, transparent, transparent 9px, var(--surface-2) 9px, var(--surface-2) 18px);
  color: var(--muted);
}
.ad-tag {
  font-size: .68rem; font-weight: 700; letter-spacing: .16em;
  padding: .2rem .55rem; border-radius: 5px;
  background: var(--surface); border: 1px solid var(--border-2);
}
.ad-slot--leader     { min-height: 100px; margin-block: 1.4rem; }
.ad-slot--incontent  { min-height: 260px; margin-block: 1.2rem; }
.ad-slot--modal      { width: 100%; min-height: 250px; margin-block: .9rem; }
.ad-slot--toast      { width: 100%; min-height: 84px; border-radius: var(--r-sm); }

.ad-modal {
  border: 0; padding: 0; border-radius: var(--r-xl);
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg); max-width: min(92vw, 380px); width: 100%;
}
.ad-modal::backdrop { background: rgba(6,9,20,.62); backdrop-filter: blur(3px); }
.ad-modal-inner { position: relative; padding: 1.5rem 1.4rem 1.3rem; text-align: center; }
.ad-modal-close {
  position: absolute; top: .6rem; right: .7rem;
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.35rem; line-height: 1;
  color: var(--muted); background: var(--surface-2); border: 1px solid var(--border);
  transition: color .18s, border-color .18s;
}
.ad-modal-close:hover { color: var(--text); border-color: var(--border-2); }
.ad-modal-kicker { font-size: .95rem; font-weight: 700; }
.ad-modal-cta { width: 100%; }
.ad-modal-note { font-size: .74rem; color: var(--muted); margin-top: .6rem; }

.ad-toast {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 60;
  width: min(300px, calc(100vw - 2rem));
  padding: .7rem .75rem .75rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  animation: toastIn .45s var(--ease-out) both;
}
.ad-toast-close {
  position: absolute; top: -9px; right: -9px;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.1rem; line-height: 1;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-sm);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* =============================================================
   11. Responsive
   ============================================================= */
@media (min-width: 540px) {
  .kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
  .kpi-row .kpi { display: block; padding: 1rem 1.1rem; }
  .kpi-row .kpi-value { margin-top: .2rem; font-size: clamp(.95rem, 2.4vw, 1.22rem); }
  .field-inline { grid-template-columns: auto auto 1fr; }
  .field-inline .help { grid-column: auto; margin-top: 0; }
}
@media (min-width: 720px) {
  .steps { grid-template-columns: repeat(3, 1fr); }
  .cards { grid-template-columns: repeat(2, 1fr); }
  #chart { height: 290px; }
}
@media (min-width: 960px) {
  .site-nav { display: flex; }
  .theme-toggle { margin-left: 1.2rem; }
  .tool-grid { grid-template-columns: minmax(320px, 380px) minmax(0, 1fr); }
  .panel-controls { border-bottom: 0; border-right: 1px solid var(--border); }
  .cards { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1280px) {
  #chart { height: 300px; }
}

/* =============================================================
   12. Reduced motion — solo efectos intrusivos
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ad-toast { animation: none; }
}

/* =============================================================
   13. Impresión
   ============================================================= */
@media print {
  .site-header, .ad-slot, .ad-toast, .ad-modal, .actions, .skip-link { display: none !important; }
  body { background: #fff; }
  .tool-card { box-shadow: none; }
}
