:root {
  --bg: #f5f6fb; --surface: #ffffff; --surface-2: #eef0f7; --text: #141826; --muted: #5b6275; --line: #dfe3ee;
  --accent: #4f46e5; --accent-2: #06b6d4; --accent-soft: #eceafe; --ok: #0f9d6b; --ok-soft: #e3f6ee;
  --warn: #b45309; --warn-soft: #fdf1e2; --bad: #c2283c; --bad-soft: #fde8eb; --sim: #7c3aed; --sim-soft: #f1eafe;
  --radius: 18px; --shadow: 0 6px 24px rgba(20, 24, 38, .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
[data-mode="empresa"] { --accent: #0e7490; --accent-2: #22c55e; --accent-soft: #e0f4f7; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e111a; --surface: #161a26; --surface-2: #1d2231; --text: #eef0f7; --muted: #a2a9bc; --line: #2a3043;
    --accent-soft: #24234a; --ok-soft: #10302a; --warn-soft: #3a2a12; --bad-soft: #3a1820; --sim-soft: #2a1f45;
    --shadow: 0 6px 24px rgba(0, 0, 0, .35); color-scheme: dark;
  }
  :root:not([data-theme="light"])[data-mode="empresa"] { --accent: #22b8cf; --accent-soft: #10303a; }
  :root:not([data-theme="light"]):not([data-mode="empresa"]) { --accent: #8b85ff; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; line-height: 1.5; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); }
.app { max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 8px) 16px calc(96px + env(safe-area-inset-bottom)); }

/* Cabecera */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 1.1rem; letter-spacing: -.01em; }
.brand img { width: 34px; height: 34px; border-radius: 10px; }
.brand small { display: block; font-weight: 500; font-size: .72rem; color: var(--muted); letter-spacing: 0; }
.mode { display: flex; background: var(--surface-2); border-radius: 999px; padding: 3px; border: 1px solid var(--line); }
.mode button { border: 0; background: transparent; padding: 7px 12px; border-radius: 999px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.mode button[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }

/* Tarjetas y texto */
h1 { font-size: 1.55rem; line-height: 1.2; margin: 6px 0 4px; letter-spacing: -.02em; }
h2 { font-size: 1.05rem; margin: 22px 0 10px; }
h3 { font-size: .95rem; margin: 0 0 6px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 12px; }
.hero { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border: 0; }
.hero .muted { color: rgba(255, 255, 255, .85); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { text-align: left; }
.stat b { display: block; font-size: 1.6rem; line-height: 1.1; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 650; background: var(--accent); color: #fff; text-decoration: none; min-height: 44px; }
.btn.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn.ok { background: var(--ok); }
.btn.bad { background: transparent; color: var(--bad); border: 1px solid var(--bad); }
.btn.block { width: 100%; }
.hero .btn { background: #fff; color: var(--accent); }

/* Etiquetas */
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 650; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag.real { background: var(--ok-soft); color: var(--ok); }
.tag.sim { background: var(--sim-soft); color: var(--sim); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.acc { background: var(--accent-soft); color: var(--accent); }
.leyenda { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }

/* Transcripción */
.seg { display: grid; grid-template-columns: 52px 1fr; gap: 10px; padding: 10px 6px; border-radius: 12px; scroll-margin: 90px; }
.seg + .seg { border-top: 1px solid var(--line); }
.seg time { font-variant-numeric: tabular-nums; font-size: .8rem; color: var(--accent); font-weight: 650; padding-top: 2px; }
.seg .quien { font-size: .78rem; font-weight: 700; color: var(--muted); }
.seg.marcado { background: var(--accent-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 4px 10px; font-size: .75rem; font-variant-numeric: tabular-nums; min-height: 30px; }
.persona { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem; background: var(--accent-soft); color: var(--accent); flex: none; }

/* Informe */
.informe h3 { color: var(--accent); }
.informe ul { margin: 0; padding-left: 20px; }
.informe section + section { margin-top: 16px; }

/* Evaluación */
.claim { border-left: 4px solid var(--line); padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.claim.ok { border-color: var(--ok); }
.claim.err { border-color: var(--bad); }
.claim + .claim { margin-top: 8px; }
.alerta { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-top: 10px; background: var(--surface); }
.alerta .evid { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; font-size: .86rem; margin: 8px 0; }
.alerta .corr { border-left: 3px solid var(--ok); padding-left: 10px; font-size: .9rem; margin: 8px 0; }
.alerta .acciones { display: flex; gap: 8px; margin-top: 8px; }
.alerta .acciones .btn { flex: 1; padding: 9px; }
.estado { font-weight: 700; font-size: .82rem; }
pre.json { background: #0e111a; color: #cfe3ff; border-radius: 12px; padding: 12px; font-size: .72rem; overflow-x: auto; white-space: pre-wrap; word-break: break-word; margin: 8px 0 0; }

/* Agenda */
.tarea { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; }
.tarea + .tarea { border-top: 1px solid var(--line); }
.tarea input { width: 22px; height: 22px; accent-color: var(--accent); margin-top: 2px; flex: none; }
.tarea.hecha .t { text-decoration: line-through; color: var(--muted); }
.evento { display: grid; grid-template-columns: 74px 1fr; gap: 12px; padding: 10px 0; }
.evento + .evento { border-top: 1px solid var(--line); }
.evento .cuando { font-weight: 700; font-size: .85rem; color: var(--accent); }

/* Aprendizaje */
.ciclo { list-style: none; margin: 0; padding: 0; counter-reset: paso; }
.ciclo li { position: relative; padding: 10px 0 10px 42px; counter-increment: paso; }
.ciclo li::before { content: counter(paso); position: absolute; left: 0; top: 10px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 750; font-size: .85rem; }
.barra { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.barra i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* Navegación inferior */
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); display: flex; justify-content: center; z-index: 10; }
nav.tabs .in { display: grid; grid-template-columns: repeat(5, 1fr); width: 100%; max-width: 560px; }
nav.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 12px; text-decoration: none; color: var(--muted); font-size: .68rem; font-weight: 600; min-height: 48px; }
nav.tabs a svg { width: 22px; height: 22px; }
nav.tabs a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

.modal { position: fixed; inset: 0; background: rgba(10, 12, 20, .5); display: grid; place-items: end center; z-index: 20; padding: 16px; }
.modal .card { width: 100%; max-width: 520px; margin-bottom: calc(env(safe-area-inset-bottom) + 8px); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: .85rem; z-index: 30; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.offline { font-size: .75rem; text-align: center; color: var(--muted); margin-top: 18px; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: no-preference) { .vista { animation: entra .18s ease-out; } @keyframes entra { from { opacity: 0; transform: translateY(6px); } } }
