/* Shared presentation layer. Calculations, permissions and saved data stay in their modules. */
:root {
  --radius-card: 16px;
  --shadow-card: 0 2px 8px -5px #31185416;
  --table-stripe: color-mix(in srgb, var(--panel-soft) 64%, var(--surface));
}
:root[data-theme="dark"] { --shadow-card: 0 2px 8px -5px #08041170; }
h4 { margin: 0; }
.app-main :is(h2,h3,h4) { text-wrap: pretty; }
.app-main :is(p,li) { overflow-wrap: anywhere; }
.app-main .hint { line-height: 1.6; }
.app-main :is(.panel,.store-costs,.store-ad,.exp-group) { box-shadow: none; }
.app-main .panel { padding: clamp(16px, 2vw, 24px); }
.app-main .panel > h3 { line-height: 1.3; letter-spacing: -.025em; }
.app-main .panel > h3:first-child { margin-top: 0; }
.app-main .panel > .hint + :is(form,fieldset,dl,.table-wrap) { margin-top: 14px; }
.app-main :is(.eyebrow,.ad-tag,.result-tag) { font-family: inherit; font-size: 10px; font-weight: 750; letter-spacing: .07em; }
.app-main :is(.section-heading,.store-history-heading) { gap: 12px; }
.app-main :is(.scale-heading,.funnel-heading,.offers-heading,.experiments-heading,.practice-heading),
.app-main :is(#historial,#caso,#glosario) > .section-heading {
  padding: 0 0 18px;
  margin-bottom: 20px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: none;
  box-shadow: none;
}
.app-main :is(.scale-heading,.funnel-heading,.offers-heading,.experiments-heading,.practice-heading) h2,
.app-main :is(#historial,#caso,#glosario) > .section-heading h2 {
  margin-top: 6px;
  font-size: clamp(25px, 2.5vw, 32px);
  line-height: 1.2;
  letter-spacing: -.035em;
}
.app-main :is(.scale-heading,.funnel-heading,.offers-heading,.experiments-heading) > p:last-child {
  max-width: 72ch;
  margin-top: 9px;
  font-size: 14px;
  line-height: 1.65;
}
.app-main .practice-heading > .section-heading { margin-bottom: 0; }
.workspace-area-title { font-size: 24px; line-height: 1.2; }
.workspace-location { margin-bottom: 18px; }
.workspace-tools,.campaign-navigation { box-shadow: none; }

/* A clear primary action, with quieter reference and reset controls. */
.app-main :is(.chip,.quiet-button) { min-height: 36px; line-height: 1.4; }
.app-main :is(.chip,.quiet-button,.primary-button,.text-button) { max-width: 100%; }
.app-main .chip { background: var(--surface); border-color: var(--input-line); }
.app-main .chip:hover:not(:disabled) { background: var(--soft-accent); border-color: var(--accent-edge); }
.app-main .chip[aria-pressed="true"] { background: var(--mid-accent); color: var(--accent-dark); }
.app-main .primary-button { box-shadow: 0 3px 10px -6px var(--button-glow); line-height: 1.45; }
.app-main .primary-button:hover:not(:disabled) { transform: translateY(-1px); }
.app-main :is(.scale-field,.funnel-field,.offer-field,.exp-field,.store-field) { line-height: 1.5; }
.app-main :is(.scale-field,.funnel-field,.offer-field,.exp-field,.store-field) :is(input:not([type="checkbox"]):not([type="radio"]),textarea,select) { min-height: 44px; }
.app-main :is(.scale-input-grid,.ops-input-grid,.offer-fields,.funnel-fields,.store-field-grid,.exp-fields) { gap: 14px; }
.app-main :is(.scale-status,.offer-status,.exp-status,.ops-status,[data-funnel-status]):empty { display: none; }
.app-main :is(.scale-origin,.funnel-source-note,.offer-source-note) { max-width: 85ch; font-size: 12px; }
.scale-toolbar,.offer-toolbar,.funnel-toolbar { row-gap: 10px; }
.scale-status { margin-block: 8px 16px; }
.scale-save { gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.scale-save .hint { flex-basis: 100%; margin: 0; }
.scale-limits h4 { font-size: 13px; line-height: 1.5; font-weight: 700; }
.scale-limits article { display: flex; flex-direction: column; align-items: flex-start; }
.scale-limits article > .chip { margin-top: auto; }
.scale-limits article > .hint { margin-bottom: 12px; }
.ops-off { background: var(--panel-soft); border-style: dashed; }
.ops-off p { max-width: 65ch; line-height: 1.65; }
.app-main :is(.ops-heading,.shock-heading) { padding: 16px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; box-shadow: none; }
.app-main :is(.ops-heading,.shock-heading) h3 { margin-top: 8px; font-size: 22px; line-height: 1.3; letter-spacing: -.025em; }
.app-main :is(.ops-heading,.shock-heading) > p:not(.eyebrow) { max-width: 78ch; margin-top: 9px; line-height: 1.6; }
.scale-workspace:has([data-scale-screen="operations"]:not([hidden])) .ops-launch { display: none; }
.scale-workspace:has([data-scale-screen="operations"]:not([hidden])) [data-ops-scope] { display: none; }
.ops-tabs { margin-top: 16px; }
.account-pagination:has(button):not(:has(button:not(:disabled))) { display: none; }
.workspace-main-links > a { display: grid; align-content: center; gap: 3px; }
.workspace-main-links > a small { font-size: 10px; line-height: 1.4; color: var(--muted); font-weight: 500; }
.workspace-tools a[data-locked="true"]::after { content: 'Completo'; margin-left: 7px; padding: 2px 5px; border: 1px solid var(--input-line); border-radius: 5px; color: var(--muted); font-size: 9px; font-weight: 650; }
.workspace-data-context { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 5px; margin-block: 10px 16px; min-width: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.workspace-data-context > strong { color: var(--body-text); font-weight: 700; }
.workspace-data-context > [data-context-name] { overflow-wrap: anywhere; }
.workspace-data-context > [data-context-currency] { white-space: nowrap; }
.workspace-data-context .info-trigger { margin: 0; }
.workspace-empty { padding: 18px; border: 1px dashed var(--input-line); border-radius: 12px; background: var(--panel-soft); }
.workspace-empty h3 { margin: 0; font-size: 17px; line-height: 1.4; }
.workspace-empty p { max-width: 65ch; margin-top: 8px; font-size: 13px; line-height: 1.65; color: var(--muted); }
.store-history-heading .primary-button { text-decoration: none; }
#store-history-description:empty { display: none; }
.import-library { margin-top: 22px; }
.import-library[data-empty="true"] { border-style: dashed; background: var(--panel-soft); }
.import-library[data-empty="true"] h3 { font-size: 17px; }
.import-library[data-empty="true"] .import-library-list { display: none; }
.import-library[data-empty="true"] [data-trial-refresh] { background: none; }

/* Campaign links select one working pane instead of jumping through two stacked panes. */
#laboratorio[data-campaign-view] { display: block; padding-top: 18px; }
#laboratorio[data-campaign-view="editor"] > section { max-width: 880px; margin-inline: auto; }
#laboratorio[data-campaign-view="results"] > section { max-width: 100%; }
.campaign-results-heading { justify-content: space-between; align-items: center; flex-wrap: wrap; }
.campaign-results-heading .chip { display: inline-flex; align-items: center; text-decoration: none; }
.app-main .mobile-results-link { display: inline-flex; align-items: center; margin-top: 14px; }

/* Keep secondary references and optional layers available without preceding the task. */
.scale-reference-actions { position: relative; flex: 0 1 auto; max-width: 100%; }
.scale-reference-actions > summary { min-height: 40px; display: flex; align-items: center; gap: 9px; padding: 9px 12px; border: 1px solid var(--input-line); border-radius: 10px; background: var(--surface); color: var(--body-text); font-size: 12px; font-weight: 700; list-style: none; }
.scale-reference-actions > summary::-webkit-details-marker { display: none; }
.scale-reference-actions > summary::after { content: '⌄'; margin-left: auto; font-size: 16px; line-height: 1; }
.scale-reference-actions[open] > summary::after { transform: rotate(180deg); }
.scale-reference-content { position: absolute; z-index: 8; right: 0; top: calc(100% + 7px); width: min(420px,calc(100vw - 48px)); display: flex; flex-wrap: wrap; gap: 10px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 12px 30px #0002; }
.scale-reference-content .scale-origin { flex-basis: 100%; margin: 0; }
.scale-layers { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-soft); }
.scale-layers > summary { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 5px 14px; padding: 13px 15px; list-style: none; }
.scale-layers > summary::-webkit-details-marker { display: none; }
.scale-layers > summary::after { content: '+'; grid-column: 2; grid-row: 1; font-size: 19px; color: var(--accent-dark); line-height: 1; }
.scale-layers[open] > summary::after { content: '−'; }
.scale-layers > summary > strong { font-size: 13px; }
.scale-layer-state { grid-column: 1; color: var(--muted); font-size: 11px; line-height: 1.5; }
.scale-layer-state .hint { margin: 0; font-size: inherit; line-height: inherit; }
.scale-layer-state b { font-weight: 650; }
.scale-layers-body { padding: 0 14px 14px; }
.scale-layers-body .shock-shortcut,.scale-layers-body .ops-launch { margin: 0; padding: 12px 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; }
.scale-layers-body .ops-launch { justify-content: flex-start; }
.scale-layers-body [data-ops-scope] { margin: 0; }

/* Keep the first exercise prominent; reserve the richer gradient for entry and plan. */
.hero { padding: clamp(20px, 2.6vw, 32px); border-radius: 20px; box-shadow: none; }
.hero::before { opacity: .08; }
.hero h1 { font-size: clamp(32px, 3.6vw, 46px); line-height: 1.1; letter-spacing: -.045em; }
.hero-copy > p:not(.eyebrow) { font-size: 14px; line-height: 1.65; }
.quick-test { border-color: var(--input-line); box-shadow: 0 10px 26px -22px #30134880; }
.quick-test h2 { font-size: clamp(20px, 2vw, 25px); letter-spacing: -.03em; }
.budget { background: var(--soft-accent); color: var(--ink); border-color: var(--line); box-shadow: none; }
.budget-heading,.budget-caption,.budget-explainer { color: var(--body-text); }
.budget-value,.target-link { color: var(--accent-dark); }
.budget-value { font-size: clamp(24px, 2.4vw, 30px); letter-spacing: -.035em; }
.budget-icon { stroke: var(--accent); }
.target-link:focus-visible { outline-color: var(--accent); }
.hero-access,#acceso-simulador,body[data-analysis-view="escalado"] #acceso-analisis { display: none; }
.exp-context [data-exp-upgrade] { display: none; }
.exp-design-locked { display: none; }
.exp-layout:has(> .exp-design-locked) { grid-template-columns: minmax(0,1fr); }
.exp-layout:has(> .exp-design-locked) .exp-guide ol { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 24px; }
.exp-access-grid .exp-premium-card { background: var(--panel-soft); box-shadow: none; }
.exp-premium-card .primary-button { background: var(--surface); color: var(--accent-dark); border: 1px solid var(--accent-edge); }
.exp-premium-card .primary-button:hover { background: var(--mid-accent); }
.exp-guide,.exp-model-note { background: var(--panel-soft); }

/* Wide reports remain inside a clearly marked, keyboard-accessible scroll region. */
.table-scroll-note { display: flex; align-items: center; gap: 7px; margin: 14px 0 7px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.table-scroll-note::before { content: '↔'; font-size: 16px; color: var(--accent-dark); }
.data-table-scroll { max-width: 100%; max-height: min(65dvh,560px); overflow: auto; overscroll-behavior-inline: contain; border: 1px solid var(--line); border-radius: 12px; scrollbar-width: thin; scrollbar-color: var(--accent-edge) var(--panel-soft); }
.data-table-scroll table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; font-variant-numeric: tabular-nums; }
.app-main .data-table-scroll table :is(th,td) { padding: 12px 13px; line-height: 1.5; border-bottom: 1px solid var(--line); }
.data-table-scroll thead th { position: sticky; z-index: 2; top: 0; background: var(--panel-soft); color: var(--body-text); font-size: 11px; font-weight: 730; box-shadow: 0 1px var(--line); }
.data-table-scroll :is(th,td):first-child { position: sticky; left: 0; z-index: 1; width: auto; max-width: 210px; min-width: 96px; white-space: normal; overflow-wrap: anywhere; text-align: left; background: var(--surface); box-shadow: 1px 0 var(--line); }
.data-table-scroll thead th:first-child { z-index: 3; background: var(--panel-soft); }
.data-table-scroll tbody tr:nth-child(even) > * { background: var(--table-stripe); }
.data-table-scroll tbody tr:hover > *,.data-table-scroll tbody tr:focus-within > * { background: var(--soft-accent); }
.data-table-scroll tbody tr[data-selected="true"] > * { background: var(--mid-accent); }
.data-table-scroll tbody tr:last-child > * { border-bottom: 0; }
.data-table-scroll .chip { min-height: 34px; padding: 6px 10px; white-space: nowrap; }
.data-table-scroll.import-table :is(th,td):first-child { min-width: 42px; max-width: 42px; width: 42px; }
.data-table-scroll.import-table td:nth-child(2) { min-width: 160px; max-width: 240px; white-space: normal; overflow-wrap: anywhere; }
.app-main :is(.scale-kpis,.ops-kpis,.exp-metrics,.offer-metrics,.funnel-metrics,.store-numbers) dd { line-height: 1.3; letter-spacing: -.025em; }
.app-main .metric-number-long { font-size: clamp(14px,1.8vw,19px); overflow-wrap: anywhere; }

@media(max-width:840px) {
  .workspace-location { margin-bottom: 12px; }
  .workspace-area-title { font-size: 22px; }
  .app-main :is(.scale-heading,.funnel-heading,.offers-heading,.experiments-heading,.practice-heading),
  .app-main :is(#historial,#caso,#glosario) > .section-heading { padding-bottom: 14px; margin-bottom: 16px; }
}
@media(max-width:650px) {
  body[data-workspace-tool="scale"] .workspace-location { display: none; }
  .app-main .scale-heading { padding-bottom: 12px; margin-bottom: 14px; }
  .app-main .scale-heading h2 { font-size: 22px; }
  .app-main .scale-heading > p:last-child { font-size: 13px; line-height: 1.5; }
  .scale-toolbar { gap: 8px; align-items: center; }
  .scale-toolbar > .scale-field { flex-basis: 100%; }
  .scale-reference-actions > summary { min-height: 34px; padding: 6px 10px; font-size: 11px; }
  .scale-reference-content { position: static; width: 100%; margin-top: 8px; box-shadow: none; }
  .scale-reference-actions[open] { width: 100%; }
  .scale-status { margin-block: 6px 10px; font-size: 11px; }
  .scale-quick > .scale-field { grid-row: 1; }
  .scale-quick-heading { grid-row: 2; }
  .scale-quick-heading > .eyebrow { display: none; }
  .scale-quick-heading h3 { font-size: 18px; margin-top: 0; }
  .scale-quick-heading .hint { font-size: 12px; margin-top: 6px; }
  .scale-quick .scale-field input { min-height: 48px; }
  .app-main :is(.scale-heading,.funnel-heading,.offers-heading,.experiments-heading,.practice-heading) h2,
  .app-main :is(#historial,#caso,#glosario) > .section-heading h2 { font-size: 25px; }
  .app-main :is(.scale-field,.funnel-field,.offer-field,.exp-field,.store-field) :is(input:not([type="checkbox"]):not([type="radio"]),textarea,select) { font-size: 16px; }
  .app-main :is(.chip,.quiet-button) { min-height: 40px; }
  .hero { padding: 16px; gap: 14px; }
  .hero h1 { margin-block: 8px 10px; font-size: 33px; }
  .hero-copy > p:not(.eyebrow) { font-size: 13px; line-height: 1.55; }
  .quick-test { padding: 15px; }
  .quick-test h2 { font-size: 19px; }
  .quick-metrics { margin-top: 12px; }
  .budget { padding: 11px 13px; }
  .exp-layout:has(> .exp-design-locked) .exp-guide ol { grid-template-columns: minmax(0,1fr); gap: 14px; }
  .app-main .data-table-scroll table :is(th,td) { padding: 10px 11px; }
  .data-table-scroll :is(th,td):first-child { max-width: 160px; }
  .table-scroll-note { margin-top: 12px; }
}
@media(prefers-reduced-motion:reduce) {
  .app-main .primary-button:hover:not(:disabled) { transform: none; }
}
