/* AudienciaX — hoja de estilos común.
   Tokens de color validados con el script de contraste/CVD en claro y oscuro. */

:root {
  color-scheme: light;
  --page: #f9f9f7; --panel: #ffffff; --line: #e3e6ea;
  --text: #0b0b0b; --text-2: #52514e; --muted: #898781;
  --grid: #e1e0d9; --axis: #c3c2b7;
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --accent: #2a78d6; --accent-ink: #ffffff;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #4a3aa7; --series-8: #e34948;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d; --panel: #171a21; --line: #2c2c2a;
    --text: #ffffff; --text-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835;
    --accent: #3987e5;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --panel: #171a21; --line: #2c2c2a;
  --text: #ffffff; --text-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835;
  --accent: #3987e5;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--page); color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); }
main { max-width: 940px; margin: 0 auto; padding: 2rem 1rem 3rem; }

/* ---------- barra superior ---------- */
.topbar { border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 20; }
.topbar .inner { max-width: 940px; margin: 0 auto; padding: .7rem 1rem; display: flex; align-items: center; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .45rem; font-weight: 700; color: var(--text); text-decoration: none; }
.brand .ik { color: var(--accent); font-size: 1.15rem; }
.brand b { color: var(--accent); font-weight: 700; }
.topbar .links { margin-left: auto; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.topbar .links a { color: var(--text-2); text-decoration: none; font-size: .88rem; padding: .35rem .6rem; border-radius: 7px; }
.topbar .links a:hover { background: rgba(127,127,127,.1); }
.topbar .links a.on { color: var(--text); font-weight: 600; }
.topbar .links a.cta { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.topbar .links a.ghost { border: 1px solid var(--line); }

/* ---------- tipografía ---------- */
h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 .6rem; letter-spacing: -.02em; }
h2 { font-size: 1.15rem; margin: 2rem 0 .8rem; }
.lead { color: var(--text-2); font-size: 1.02rem; max-width: 40rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
code { background: rgba(127,127,127,.15); padding: .1rem .35rem; border-radius: 4px; font-size: .85em; }

/* ---------- bloques ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 1.25rem; overflow: hidden; }
.panel > h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
              margin: 0; padding: .8rem 1rem; border-bottom: 1px solid var(--line);
              display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.panel > h3 .hint { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 400; }
.pad { padding: 1rem; }

.grid-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .85rem 1rem; }
.tile .label { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
               display: flex; align-items: center; gap: .35rem; }
.tile .value { font-size: 1.6rem; font-weight: 600; margin-top: .2rem; line-height: 1.15; }
.tile .value small { font-size: .78rem; font-weight: 400; color: var(--muted); }
.tile .delta { font-size: .8rem; margin-top: .15rem; color: var(--text-2); }
.up { color: var(--good); } .down { color: var(--critical); }

.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem;
         border-radius: 999px; font-size: .75rem; font-weight: 600; border: 1px solid currentColor; }
.badge.ok { color: var(--good); } .badge.warn { color: var(--warning); } .badge.err { color: var(--critical); }

/* ---------- formularios ---------- */
form.stack { display: flex; flex-direction: column; gap: .75rem; }
label { font-size: .85rem; color: var(--text-2); font-weight: 600; display: block; margin-bottom: .25rem; }
input[type=text], input[type=email], input[type=password] {
  width: 100%; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 9px;
  background: var(--page); color: var(--text); font: inherit;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1.1rem; border: 0; border-radius: 9px; background: var(--accent);
  color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
button.sec, .btn.sec { background: transparent; color: var(--text-2); border: 1px solid var(--line); }
button:hover, .btn:hover { filter: brightness(1.06); }
.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 220px; }

.notice { border-radius: 10px; padding: .7rem .9rem; font-size: .9rem; margin-bottom: 1rem;
          border: 1px solid currentColor; display: flex; gap: .5rem; align-items: flex-start; }
.notice.err { color: var(--critical); }
.notice.ok  { color: var(--good); }
.notice.info { color: var(--accent); }
.notice span { color: var(--text); }

/* ---------- tablas ---------- */
table { width: 100%; border-collapse: collapse; font-size: .87rem; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: .72rem; text-transform: uppercase;
     letter-spacing: .04em; padding: .55rem 1rem; border-bottom: 1px solid var(--line); }
td { padding: .6rem 1rem; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.acc { display: inline-flex; align-items: center; gap: .45rem; }
.acc i.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }

/* ---------- gráficas ---------- */
.chart-wrap { position: relative; overflow-x: auto; }
.chart { width: 100%; height: auto; display: block; min-width: 520px; }
.grid { stroke: var(--grid); stroke-width: 1; }
.crosshair { stroke: var(--axis); stroke-width: 1; stroke-dasharray: 3 3; }
.baseline { stroke: var(--axis); stroke-width: 1; }
.tick { fill: var(--muted); font-size: 10px; }
.tick-y { text-anchor: end; font-variant-numeric: tabular-nums; }
.direct-label { fill: var(--text-2); font-size: 11px; font-weight: 600; }
.tip { position: absolute; pointer-events: none; background: var(--panel); color: var(--text);
       border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; font-size: .8rem;
       box-shadow: 0 4px 16px rgba(0,0,0,.18); display: none; z-index: 5; white-space: nowrap; }
.tip .row { display: flex; align-items: center; gap: .4rem; }
.tip .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tip .n { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: .75rem; padding: 0 1rem 1rem; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--text-2); }
.legend i.sw { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.ranges { display: flex; gap: .4rem; margin-left: auto; }
.ranges a { font-size: .75rem; color: var(--muted); text-decoration: none; padding: .1rem .45rem;
            border: 1px solid var(--line); border-radius: 999px; }
.ranges a.on { color: var(--text); border-color: var(--axis); font-weight: 600; }

.hours { display: flex; align-items: flex-end; gap: 3px; height: 96px; padding: 1rem 1rem .25rem; }
.hours .h { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.hours .bar { border-radius: 4px 4px 0 0; background: var(--series-1); min-height: 2px; }
.hours .bar.off { background: var(--axis); }
.hourlabels { display: flex; gap: 3px; padding: 0 1rem .9rem; }
.hourlabels span { flex: 1; text-align: center; font-size: 9px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- score de auditoría ---------- */
.score-hero { display: flex; align-items: center; gap: 1.5rem; padding: 1.5rem; flex-wrap: wrap; }
.dial { position: relative; width: 132px; height: 132px; flex: none; }
.dial svg { transform: rotate(-90deg); }
.dial .num { position: absolute; inset: 0; display: flex; flex-direction: column;
             align-items: center; justify-content: center; }
.dial .num b { font-size: 2rem; line-height: 1; font-weight: 700; }
.dial .num span { font-size: .7rem; color: var(--muted); }
.score-hero .say { flex: 1; min-width: 240px; }
.score-hero .say h3 { margin: 0 0 .3rem; font-size: 1.15rem; }

.bars .row { display: flex; align-items: center; gap: .7rem; padding: .45rem 1rem; }
.bars .row .lbl { width: 42%; font-size: .85rem; color: var(--text-2); }
.bars .row .track { flex: 1; height: 8px; background: var(--grid); border-radius: 999px; overflow: hidden; }
.bars .row .fill { height: 100%; border-radius: 999px; background: var(--series-2); }
.bars .row .pct { width: 3.2rem; text-align: right; font-size: .82rem; font-variant-numeric: tabular-nums; color: var(--text-2); }

.split3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; padding: 1rem; }
.split3 .b { text-align: center; padding: .7rem; border: 1px solid var(--line); border-radius: 10px; }
.split3 .b b { display: block; font-size: 1.35rem; }
.split3 .b span { font-size: .78rem; color: var(--muted); }

/* ---------- landing ---------- */
.hero { text-align: center; padding: 2.5rem 0 1.5rem; }
.hero h1 { font-size: 2.3rem; }
.hero .lead { margin: 0 auto 1.5rem; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .9rem; }
.feature { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem; }
.feature .ik { font-size: 1.3rem; color: var(--accent); }
.feature h3 { margin: .5rem 0 .3rem; font-size: 1rem; }
.feature p { margin: 0; color: var(--text-2); font-size: .89rem; }
.empty { padding: 1.5rem 1rem; color: var(--muted); text-align: center; font-size: .88rem; }

footer { border-top: 1px solid var(--line); margin-top: 2rem; }
footer .inner { max-width: 940px; margin: 0 auto; padding: 1.2rem 1rem; display: flex;
                gap: 1rem; flex-wrap: wrap; font-size: .82rem; color: var(--text-2); }
footer .inner .muted { margin-left: auto; }

.item { padding: .75rem 1rem; border-bottom: 1px solid var(--line); display: flex; gap: .7rem; align-items: flex-start; }
.item:last-child { border-bottom: 0; }
.item > .ik { margin-top: .15rem; flex: none; }
.item .ik.ok { color: var(--good); } .item .ik.err { color: var(--critical); } .item .ik.warn { color: var(--warning); }
.item .body { min-width: 0; flex: 1; }
.item .text { overflow-wrap: anywhere; }
.item .meta { color: var(--muted); font-size: .77rem; margin-top: .22rem; display: flex; gap: .6rem; flex-wrap: wrap; }
.item .meta a { color: var(--accent); text-decoration: none; }
.errmsg { color: var(--critical); font-size: .8rem; margin-top: .25rem; overflow-wrap: anywhere; }
