/* =========================================================================
   Ads Master · SoftwaLabs/ads — sistema de diseño de la app y de la portada.
   Identidad del ecosistema SoftwaLabs (C:/proyectos/_shared/ecosistema/identidad-subdominios.md):
   tipografías Space Grotesk / Inter Tight / JetBrains Mono / Fraunces, neutros
   comunes, dos temas (oscuro por defecto) y UN acento propio: amarillo dorado
   (tono 47°) con icono de diana. Excepción documentada a la regla de 40°:
   queda a 25° de video (#FF7A2F) y a 32° de ai (#c4f55a) y se distingue por
   luminosidad (acento oscuro L=0,62 frente a 0,35 del naranja y 0,78 de la lima).

   Los módulos REUTILIZAN estas clases (.am-*); los nombres de los tokens
   --am-* se mantienen; solo cambian sus valores. Los módulos solo añaden CSS
   propio en su hoja. OJO: los comentarios CSS NO se anidan.

   ── CONTRASTES (WCAG 2.1, calculados con la fórmula de luminancia relativa) ──
   TEMA OSCURO
     acento  #FFC800 sobre #08080a (fondo) ......... 12,88:1
     acento  #FFC800 sobre #0d0d10 (tarjeta) ....... 12,49:1
     acento  #FFC800 sobre #131318 (zona suave) .... 11,92:1
     tinta   #261C00 sobre #FFC800 (botón) ......... 10,82:1
     acento-2 #FFE066 sobre #08080a ................ 15,35:1
     texto   #ececee sobre #08080a ................. 16,96:1
     texto-2 #b8b8bd sobre #08080a ................. 10,13:1
     texto-3 #8d8d97 sobre #08080a ................. 6,09:1 (sobre #131318: 5,63:1)
     peligro #ff7676 · aviso #ff9f43 · positivo #4ade80 · info #22d3ee: todos ≥ 7:1 sobre #08080a
   TEMA CLARO
     acento  #7A5E00 sobre #f6f5f1 (fondo) ......... 5,61:1
     acento  #7A5E00 sobre #ffffff (tarjeta) ....... 6,12:1
     acento  #7A5E00 sobre #efede6 (zona suave) .... 5,23:1
     tinta   #FFF8DC sobre #7A5E00 (botón) ......... 5,75:1
     acento-2 #5C4500 sobre #f6f5f1 ................ 8,35:1
     texto   #0a0a0c sobre #f6f5f1 ................. 18,13:1
     texto-2 #2a2a30 sobre #f6f5f1 ................. 13,07:1
     texto-3 #666670 sobre #f6f5f1 ................. 5,20:1 (sobre #efede6: 4,85:1)
     peligro #b91c1c · aviso #92400e · positivo #15803d · info #0e7490: todos ≥ 4,6:1 sobre #f6f5f1 (positivo 4,60; el resto ≥ 4,9)
   El comprobador está en tests/Identidad/test_contraste.php: si cambias un
   color, la prueba te dice si sigue cumpliendo.
   ========================================================================= */

@import url('/assets/css/fonts.css');

/* ── Tokens: tema OSCURO (por defecto) ────────────────────────────────── */
:root {
  --font-display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-body:    'Inter Tight', ui-sans-serif, system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --font-serif:   'Fraunces', ui-serif, Georgia, serif;

  /* acento de ads: amarillo dorado */
  --accent:      #FFC800;
  --accent-ink:  #261C00;
  --accent-2:    #FFE066;
  --accent-soft: rgba(255, 200, 0, 0.12);

  /* neutros del ecosistema */
  --am-bg:        #08080a;
  --am-surface:   #0d0d10;
  --am-surface-2: #131318;
  --am-surface-3: #1a1a20;
  --am-line:      #2a2a32;
  --am-line-2:    #3a3a44;
  --am-ink:       #ececee;
  --am-ink-2:     #b8b8bd;
  --am-ink-3:     #8d8d97;

  /* marca (los módulos usan --am-primary para «lo principal») */
  --am-primary:     var(--accent);
  --am-primary-600: var(--accent-2);       /* hover y texto sobre fondo suave */
  --am-primary-50:  var(--accent-soft);
  --am-primary-ink: var(--accent-ink);
  --am-primary-line: rgba(255, 200, 0, .35);

  /* positivo = beneficio (verde, siempre con signo +/▲ además del color) */
  --am-accent:     #4ade80;
  --am-accent-50:  rgba(74, 222, 128, .12);
  --am-accent-line: rgba(74, 222, 128, .35);
  --am-accent-ink: #052e12;
  --am-danger:     #ff7676;
  --am-danger-50:  rgba(255, 118, 118, .12);
  --am-danger-line: rgba(255, 118, 118, .35);
  --am-warn:       #ff9f43;
  --am-warn-50:    rgba(255, 159, 67, .12);
  --am-warn-line:  rgba(255, 159, 67, .38);
  --am-info:       #22d3ee;
  --am-info-50:    rgba(34, 211, 238, .12);
  --am-info-line:  rgba(34, 211, 238, .35);
  --am-sim:        #c4a8ff;                 /* simulación: violeta suave, nunca el acento */
  --am-sim-50:     rgba(196, 168, 255, .12);
  --am-sim-line:   rgba(196, 168, 255, .38);

  --am-radius: 10px;
  --am-radius-sm: 6px;
  --am-shadow: 0 1px 2px rgba(0,0,0,.4);
  --am-shadow-md: 0 10px 30px rgba(0,0,0,.45);
  --am-overlay: rgba(0, 0, 0, .6);
  --am-sidebar-w: 250px;
  --am-font: var(--font-body);
  color-scheme: dark;
}

/* ── Tokens: tema CLARO ───────────────────────────────────────────────── */
[data-theme="light"] {
  --accent:      #7A5E00;
  --accent-ink:  #FFF8DC;
  --accent-2:    #5C4500;
  --accent-soft: rgba(122, 94, 0, 0.10);

  --am-bg:        #f6f5f1;
  --am-surface:   #ffffff;
  --am-surface-2: #efede6;
  --am-surface-3: #e6e3d9;
  --am-line:      #e3e0d6;
  --am-line-2:    #d4d0c3;
  --am-ink:       #0a0a0c;
  --am-ink-2:     #2a2a30;
  --am-ink-3:     #666670;

  --am-primary-line: rgba(122, 94, 0, .35);

  --am-accent:     #15803d;
  --am-accent-50:  #eef8f1;
  --am-accent-line: #a7d9b5;
  --am-accent-ink: #ffffff;
  --am-danger:     #b91c1c;
  --am-danger-50:  #fdecec;
  --am-danger-line: #f1b4b4;
  --am-warn:       #92400e;
  --am-warn-50:    #fdf0e1;
  --am-warn-line:  #efc79b;
  --am-info:       #0e7490;
  --am-info-50:    #e3f4f8;
  --am-info-line:  #a5d6e2;
  --am-sim:        #6d28d9;
  --am-sim-50:     #f1eafd;
  --am-sim-line:   #d2bff5;

  --am-shadow: 0 1px 2px rgba(0,0,0,.05);
  --am-shadow-md: 0 10px 30px rgba(0,0,0,.10);
  --am-overlay: rgba(10, 10, 12, .45);
  color-scheme: light;
}

/* Sin atributo (la hoja se carga pero el script del tema no ha corrido, o no
   hay JavaScript): manda lo que pida el sistema, como en los demás subdominios. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --accent: #7A5E00; --accent-ink: #FFF8DC; --accent-2: #5C4500; --accent-soft: rgba(122, 94, 0, 0.10);
    --am-bg: #f6f5f1; --am-surface: #ffffff; --am-surface-2: #efede6; --am-surface-3: #e6e3d9;
    --am-line: #e3e0d6; --am-line-2: #d4d0c3;
    --am-ink: #0a0a0c; --am-ink-2: #2a2a30; --am-ink-3: #666670;
    --am-primary-line: rgba(122, 94, 0, .35);
    --am-accent: #15803d; --am-accent-50: #eef8f1; --am-accent-line: #a7d9b5; --am-accent-ink: #ffffff;
    --am-danger: #b91c1c; --am-danger-50: #fdecec; --am-danger-line: #f1b4b4;
    --am-warn: #92400e; --am-warn-50: #fdf0e1; --am-warn-line: #efc79b;
    --am-info: #0e7490; --am-info-50: #e3f4f8; --am-info-line: #a5d6e2;
    --am-sim: #6d28d9; --am-sim-50: #f1eafd; --am-sim-line: #d2bff5;
    --am-shadow: 0 1px 2px rgba(0,0,0,.05); --am-shadow-md: 0 10px 30px rgba(0,0,0,.10);
    --am-overlay: rgba(10, 10, 12, .45);
    color-scheme: light;
  }
}

/* ── Base ─────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--am-ink);
  background: var(--am-bg);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--am-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--am-primary); outline-offset: 2px; }
h1,h2,h3,h4 { margin: 0 0 .4em; line-height: 1.2; color: var(--am-ink); font-family: var(--font-display); letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
small { color: var(--am-ink-2); }
code, kbd, samp { font-family: var(--font-mono); background: var(--am-surface-2); padding: 1px 5px; border-radius: 4px; font-size: .85em; }
img, svg, video { max-width: 100%; }
::selection { background: var(--accent); color: var(--accent-ink); }

.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 300; background: var(--accent); color: var(--accent-ink);
  padding: 8px 14px; border-radius: 6px; font-weight: 600; }
.skip-link:focus { left: 8px; }

/* ── Marca: ● SoftwaLabs/ads (JetBrains Mono 14/600, punto de 10 px) ───── */
.topbar-brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-mono);
  font-weight: 600; font-size: 14px; letter-spacing: -.01em; color: var(--am-ink); white-space: nowrap; text-decoration: none; }
.topbar-brand:hover { text-decoration: none; }
.topbar-brand .dot { width: 10px; height: 10px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 14px var(--accent); flex: none; }
.topbar-brand .muted { color: var(--am-ink-3); }

/* Botón de tema (sol/luna) */
.theme-toggle { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--am-line); background: transparent; color: var(--am-ink-2); cursor: pointer; font-size: 16px; line-height: 1;
  transition: color .2s, border-color .2s; flex: none; }
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* ── Shell: sidebar + main ────────────────────────────────────────────── */
.am-shell { display: flex; min-height: 100vh; }
.am-sidebar {
  width: var(--am-sidebar-w); flex-shrink: 0; background: var(--am-surface);
  border-right: 1px solid var(--am-line); position: sticky; top: 0; height: 100vh;
  overflow-y: auto; display: flex; flex-direction: column;
}
.am-sidebar__brand {
  display: flex; align-items: center; gap: 10px; padding: 16px 18px; font-weight: 600;
  font-family: var(--font-mono); font-size: 14px; border-bottom: 1px solid var(--am-line); color: var(--am-ink);
}
.am-sidebar__brand .dot { width: 10px; height: 10px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 14px var(--accent); }
/* Mientras el marcado de sidebar.php diga «AdsMaster», la marca se ve como
   «SoftwaLabs/ads» solo con CSS. Cuando se use .topbar-brand, esto no se aplica. */
.am-sidebar__brand:not(.topbar-brand) { font-size: 0; gap: 0; }
.am-sidebar__brand:not(.topbar-brand) .dot { margin-right: 10px; order: 0; }
.am-sidebar__brand:not(.topbar-brand)::before { content: "SoftwaLabs"; order: 1; font-size: 14px; color: var(--am-ink); }
.am-sidebar__brand:not(.topbar-brand)::after { content: "/ads"; order: 2; font-size: 14px; color: var(--am-ink-3); }

.am-nav { padding: 10px 8px; flex: 1; }
.am-nav__group { margin: 14px 10px 4px; font-size: .68rem; text-transform: uppercase; font-family: var(--font-mono);
  letter-spacing: .08em; color: var(--am-ink-3); font-weight: 600; }
.am-nav__item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--am-radius-sm);
  color: var(--am-ink-2); font-weight: 500; margin: 1px 4px;
}
.am-nav__item:hover { background: var(--am-surface-2); text-decoration: none; color: var(--am-ink); }
.am-nav__item.is-active { background: var(--am-primary-50); color: var(--am-primary-600); }
.am-nav__item .am-ico { color: currentColor; opacity: .85; }
.am-nav__badge { margin-left: auto; background: var(--am-danger); color: var(--am-bg); border-radius: 999px;
  font-size: .68rem; padding: 1px 7px; font-weight: 700; }

.am-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.am-topbar {
  display: flex; align-items: center; gap: 14px; padding: 12px 22px; background: var(--am-bg);
  border-bottom: 1px solid var(--am-line); position: sticky; top: 0; z-index: 20; min-width: 0;
}
.am-topbar__title { font-weight: 700; font-size: 1.05rem; font-family: var(--font-display); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.am-topbar__spacer { flex: 1; }
.am-main { padding: 22px; max-width: 1280px; width: 100%; margin: 0 auto; min-width: 0; }
.am-page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.am-page-head__spacer { flex: 1; }

/* ── Modo guiado (M17) ────────────────────────────────────────────────── */
.am-guide {
  background: var(--am-info-50); border: 1px solid var(--am-info-line); color: var(--am-ink);
  border-radius: var(--am-radius); padding: 11px 14px; margin: 0 0 16px; display: flex;
  gap: 10px; align-items: flex-start; font-size: .92rem;
}
.am-guide .am-ico { flex-shrink: 0; margin-top: 1px; color: var(--am-info); }
.am-guide--warn { background: var(--am-warn-50); border-color: var(--am-warn-line); color: var(--am-ink); }
.am-guide--warn .am-ico { color: var(--am-warn); }
.am-guide__close { margin-left: auto; cursor: pointer; opacity: .7; background: none; border: 0; color: var(--am-ink-2); }

/* explicación "por qué" de una recomendación IA */
.am-why { border-left: 3px solid var(--am-primary); background: var(--am-surface-2);
  padding: 8px 12px; border-radius: 0 var(--am-radius-sm) var(--am-radius-sm) 0; font-size: .9rem; color: var(--am-ink-2); }
.am-why b { color: var(--am-ink); }
.am-risk { border-left-color: var(--am-warn); }

/* término del glosario clicable */
.am-term { border-bottom: 1px dashed var(--am-ink-3); cursor: help; }

/* ── Cards ────────────────────────────────────────────────────────────── */
.am-card { background: var(--am-surface); border: 1px solid var(--am-line); border-radius: var(--am-radius);
  box-shadow: var(--am-shadow); padding: 18px; margin-bottom: 16px; min-width: 0; }
.am-card__head { display: flex; align-items: center; gap: 10px; margin: -4px 0 12px; flex-wrap: wrap; }
.am-card__title { font-weight: 700; font-size: 1rem; font-family: var(--font-display); }
.am-card__spacer { flex: 1; }
.am-grid { display: grid; gap: 16px; }
.am-grid > * { min-width: 0; }
.am-grid--2 { grid-template-columns: repeat(2, 1fr); }
.am-grid--3 { grid-template-columns: repeat(3, 1fr); }
.am-grid--4 { grid-template-columns: repeat(4, 1fr); }

/* ── KPIs ─────────────────────────────────────────────────────────────── */
.am-kpi { background: var(--am-surface); border: 1px solid var(--am-line); border-radius: var(--am-radius);
  padding: 14px 16px; box-shadow: var(--am-shadow); min-width: 0; }
.am-kpi__label { font-size: .72rem; color: var(--am-ink-2); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; font-family: var(--font-mono); }
.am-kpi__value { font-size: 1.7rem; font-weight: 700; margin-top: 2px; color: var(--am-ink); font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.am-kpi__value--profit { color: var(--am-accent); }
.am-kpi__sub { font-size: .8rem; color: var(--am-ink-3); }
.am-kpi__delta--up { color: var(--am-accent); } .am-kpi__delta--down { color: var(--am-danger); }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.am-btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: var(--am-radius-sm);
  border: 1px solid var(--am-line-2); background: var(--am-surface); color: var(--am-ink); font-weight: 600; font-family: var(--font-body);
  cursor: pointer; font-size: .9rem; transition: background .12s, border-color .12s, color .12s; text-decoration: none; }
.am-btn:hover { background: var(--am-surface-2); border-color: var(--am-ink-3); text-decoration: none; }
.am-btn--primary { background: var(--am-primary); border-color: var(--am-primary); color: var(--am-primary-ink); }
.am-btn--primary:hover { background: var(--am-primary-600); border-color: var(--am-primary-600); color: var(--accent-ink); }
.am-btn--accent { background: var(--am-accent); border-color: var(--am-accent); color: var(--am-accent-ink); }
.am-btn--accent:hover { background: var(--am-accent); filter: brightness(1.08); }
.am-btn--danger { background: var(--am-surface); border-color: var(--am-danger-line); color: var(--am-danger); }
.am-btn--danger:hover { background: var(--am-danger-50); }
.am-btn--ghost { background: transparent; border-color: transparent; }
.am-btn--ghost:hover { background: var(--am-surface-2); border-color: transparent; }
.am-btn--sm { padding: 5px 10px; font-size: .82rem; }
.am-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Badges ───────────────────────────────────────────────────────────── */
.am-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-size: .74rem; font-weight: 700; background: var(--am-surface-2); color: var(--am-ink-2); border: 1px solid var(--am-line); }
.am-badge--draft { background: var(--am-surface-2); color: var(--am-ink-2); }
.am-badge--pending { background: var(--am-warn-50); color: var(--am-warn); border-color: var(--am-warn-line); }
.am-badge--active, .am-badge--ready, .am-badge--approved, .am-badge--done, .am-badge--verified {
  background: var(--am-accent-50); color: var(--am-accent); border-color: var(--am-accent-line); }
.am-badge--paused, .am-badge--rejected, .am-badge--error, .am-badge--failed, .am-badge--disapproved {
  background: var(--am-danger-50); color: var(--am-danger); border-color: var(--am-danger-line); }
.am-badge--info { background: var(--am-info-50); color: var(--am-info); border-color: var(--am-info-line); }
.am-badge--fake { background: var(--am-sim-50); color: var(--am-sim); border-color: var(--am-sim-line); }

/* ── Tables ───────────────────────────────────────────────────────────── */
.am-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.am-table th { text-align: left; padding: 9px 12px; color: var(--am-ink-2); font-weight: 600;
  border-bottom: 2px solid var(--am-line-2); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; font-family: var(--font-mono); }
.am-table td { padding: 10px 12px; border-bottom: 1px solid var(--am-line); vertical-align: middle; }
.am-table tr:hover td { background: var(--am-surface-2); }
.am-table__num { text-align: right; font-variant-numeric: tabular-nums; }
.am-table--wrap { overflow-x: auto; max-width: 100%; }

/* ── Score desglosado (candidatos puntuados) ─────────────────────────── */
.am-score { display: flex; flex-direction: column; gap: 5px; }
.am-score__row { display: flex; align-items: center; gap: 8px; font-size: .82rem; }
.am-score__label { width: 130px; color: var(--am-ink-2); flex-shrink: 0; }
.am-score__bar { flex: 1; height: 7px; background: var(--am-surface-3); border-radius: 999px; overflow: hidden; }
.am-score__fill { height: 100%; background: var(--am-primary); border-radius: 999px; }
.am-score__fill--good { background: var(--am-accent); }
.am-score__fill--warn { background: var(--am-warn); }
.am-score__fill--bad { background: var(--am-danger); }
.am-score__val { width: 36px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.am-score__total { font-size: 1.6rem; font-weight: 700; font-family: var(--font-display); }

/* ── Forms ────────────────────────────────────────────────────────────── */
.am-field { margin-bottom: 14px; }
.am-label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: 5px; color: var(--am-ink); }
.am-hint { font-size: .8rem; color: var(--am-ink-3); margin-top: 3px; }
.am-input, .am-select, .am-textarea {
  width: 100%; max-width: 100%; padding: 9px 11px; border: 1px solid var(--am-line-2); border-radius: var(--am-radius-sm);
  font-family: inherit; font-size: .92rem; color: var(--am-ink); background: var(--am-surface-2); }
.am-input::placeholder, .am-textarea::placeholder { color: var(--am-ink-3); }
.am-input:focus, .am-select:focus, .am-textarea:focus { outline: none; border-color: var(--am-primary); box-shadow: 0 0 0 3px var(--am-primary-50); }
.am-textarea { resize: vertical; min-height: 84px; }
.am-input--error { border-color: var(--am-danger); }
.am-error { color: var(--am-danger); font-size: .82rem; margin-top: 4px; }

/* ── Modal ────────────────────────────────────────────────────────────── */
.am-modal-backdrop { position: fixed; inset: 0; background: var(--am-overlay); display: flex;
  align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.am-modal { background: var(--am-surface); border: 1px solid var(--am-line); border-radius: var(--am-radius); box-shadow: var(--am-shadow-md);
  max-width: 620px; width: 100%; max-height: 88vh; overflow-y: auto; }
.am-modal__head { padding: 16px 20px; border-bottom: 1px solid var(--am-line); display: flex; align-items: center; }
.am-modal__body { padding: 20px; }
.am-modal__foot { padding: 14px 20px; border-top: 1px solid var(--am-line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ── Toasts (arriba derecha) ──────────────────────────────────────────── */
.am-toasts { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: min(360px, calc(100vw - 32px)); }
.am-toast { background: var(--am-ink); color: var(--am-bg); padding: 11px 15px; border-radius: var(--am-radius-sm);
  box-shadow: var(--am-shadow-md); font-size: .9rem; display: flex; gap: 9px; align-items: flex-start; animation: am-slide-in .25s ease; }
.am-toast--success { background: #14532d; color: #fff; } .am-toast--error { background: #7f1d1d; color: #fff; }
.am-toast--warn { background: #78350f; color: #fff; } .am-toast--info { background: #164e63; color: #fff; }
@keyframes am-slide-in { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Empty / helpers ──────────────────────────────────────────────────── */
.am-empty { text-align: center; padding: 42px 20px; color: var(--am-ink-3); }
.am-empty .am-ico { opacity: .5; margin-bottom: 8px; }
.am-muted { color: var(--am-ink-3); }
.am-mt { margin-top: 16px; } .am-mb { margin-bottom: 16px; }
.am-flex { display: flex; gap: 10px; align-items: center; }
.am-flex--between { justify-content: space-between; }
.am-wrap { flex-wrap: wrap; }
.am-ico { display: inline-block; vertical-align: middle; stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
.am-pill-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── Steps (wizards: setup, new-campaign) ─────────────────────────────── */
.am-steps { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.am-step { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px;
  background: var(--am-surface-2); font-size: .84rem; color: var(--am-ink-2); font-weight: 600; }
.am-step.is-active { background: var(--am-primary); color: var(--am-primary-ink); }
.am-step.is-done { background: var(--am-accent-50); color: var(--am-accent); }

/* ── Barra de progreso de tareas (AM.progress) ────────────────────────── */
.am-progressbar { margin: 10px 0; }
.am-progressbar__label { display: flex; justify-content: space-between; font-size: .82rem;
  color: var(--am-ink-2); margin-bottom: 5px; }
.am-progressbar__pct { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--am-ink); }
.am-progressbar__track { height: 8px; background: var(--am-surface-3); border-radius: 999px;
  overflow: hidden; border: 1px solid var(--am-line); }
.am-progressbar__fill { height: 100%; background: var(--am-primary); border-radius: 999px;
  transition: width .5s ease; min-width: 6px; }
.am-progressbar__fill--done { background: var(--am-accent); }
.am-progressbar__fill--error { background: var(--am-danger); }
/* modo indeterminado: no sabemos el %, la barra "respira" */
.am-progressbar--indeterminate .am-progressbar__fill {
  width: 35% !important; animation: am-indeterminate 1.4s ease-in-out infinite; }
@keyframes am-indeterminate {
  0% { margin-left: 0; } 50% { margin-left: 65%; } 100% { margin-left: 0; }
}

/* ── Pie de la app ────────────────────────────────────────────────────── */
.am-footer { max-width: 1280px; width: 100%; margin: 0 auto; padding: 18px 22px 28px; border-top: 1px solid var(--am-line);
  margin-top: 24px; color: var(--am-ink-3); font-size: .8rem; display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; }
.am-footer a { color: var(--am-ink-3); }
.am-footer a:hover { color: var(--accent); }
.am-footer__legal { display: flex; gap: 6px 16px; flex-wrap: wrap; }
.am-footer__note { flex-basis: 100%; font-size: .75rem; }
.am-footer .topbar-brand { font-size: 12px; }
.am-footer .topbar-brand .dot { width: 8px; height: 8px; box-shadow: none; }

/* ── Móvil ────────────────────────────────────────────────────────────── */
.am-burger { display: none; background: none; border: 0; cursor: pointer; color: var(--am-ink); padding: 4px; }
/* Velo del menú: se pinta con el propio shell, sin marcado extra. */
.am-shell.is-menu-open::after { content: ""; position: fixed; inset: 0; background: var(--am-overlay); z-index: 40; }

@media (max-width: 900px) {
  .am-grid--2, .am-grid--3, .am-grid--4 { grid-template-columns: 1fr; }
  .am-sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: var(--am-shadow-md); max-width: 86vw; }
  .am-shell.is-menu-open .am-sidebar { transform: none; }
  .am-burger { display: inline-flex; }
  .am-main { padding: 16px; }
  .am-topbar { padding: 10px 14px; gap: 8px; }
  .am-topbar .am-badge { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .am-topbar .am-muted { display: none; }
  .am-footer { padding: 16px; }
  /* Una tabla ancha se desplaza dentro de su caja, nunca ensancha la página. */
  .am-table { display: block; max-width: 100%; overflow-x: auto; }
}
@media (max-width: 640px) {
  .am-card { padding: 14px; }
  .am-kpi__value { font-size: 1.4rem; }
  .am-score__label { width: 96px; }
  .am-modal-backdrop { padding: 10px; }
  /* El título de página deja sitio a lo importante. */
  .am-topbar__title { font-size: .95rem; }

  /* .am-table--cards: cada fila pasa a ser una tarjeta. En el <td> hay que poner
     data-label="Nombre de la columna" para que salga la etiqueta. */
  .am-table--cards, .am-table--cards tbody, .am-table--cards tr, .am-table--cards td { display: block; width: 100%; }
  .am-table--cards { overflow: visible; }
  .am-table--cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .am-table--cards tr { background: var(--am-surface); border: 1px solid var(--am-line); border-radius: var(--am-radius);
    padding: 6px 12px; margin-bottom: 10px; }
  .am-table--cards tr:hover td { background: transparent; }
  .am-table--cards td { border-bottom: 1px solid var(--am-line); padding: 8px 0; display: flex; gap: 12px;
    justify-content: space-between; text-align: right; }
  .am-table--cards td:last-child { border-bottom: 0; }
  .am-table--cards td::before { content: attr(data-label); font-family: var(--font-mono); font-size: .7rem; text-transform: uppercase;
    letter-spacing: .05em; color: var(--am-ink-3); text-align: left; flex: none; max-width: 45%; padding-top: 2px; }
  .am-table--cards td:not([data-label])::before { content: none; }
  .am-table--cards .am-table__num { text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
