/* ============================================================
   PRISMA · CS — sistema de diseño
   ============================================================ */
:root {
  --primary: #6366f1;
  --primary-2: #8b5cf6;
  --accent: #14b8a6;
  --grad: linear-gradient(120deg, #6366f1 0%, #8b5cf6 52%, #14b8a6 100%);
  --danger: #ef4444;
  --ok: #10b981;
  --warn: #f59e0b;
  --radius: 14px;
  --radius-lg: 20px;
  --maxw: 1180px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --display: 'Fraunces', Georgia, serif;
}
:root[data-theme="light"] {
  --bg: #f5f6fb; --bg-2: #eceefb; --surface: #ffffff; --surface-2: #f6f7fc;
  --border: #e5e7f2; --border-2: #d9dcec;
  --text: #191c2b; --text-2: #626a80; --text-3: #8b92a8;
  --shadow: 0 6px 28px rgba(40,44,90,.09); --shadow-sm: 0 2px 10px rgba(40,44,90,.07);
  --chat-user: #eef0ff;
}
:root[data-theme="dark"] {
  --bg: #0c0e15; --bg-2: #090b11; --surface: #161923; --surface-2: #1d212d;
  --border: #282d3b; --border-2: #333a4a;
  --text: #e8eaf2; --text-2: #98a0b4; --text-3: #6b7284;
  --shadow: 0 10px 34px rgba(0,0,0,.45); --shadow-sm: 0 2px 12px rgba(0,0,0,.35);
  --chat-user: #232842;
}

* { box-sizing: border-box; }
/* El atributo `hidden` debe ganar a cualquier `display` de componente (modales, paneles). */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--text);
  line-height: 1.55; -webkit-font-smoothing: antialiased; font-size: 15px;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5rem; }
p { margin: 0 0 .8rem; }
.muted { color: var(--text-2); }
.small { font-size: .82rem; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
code { background: var(--surface-2); padding: .1rem .35rem; border-radius: 6px; font-size: .88em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 1.2rem;
  padding: .7rem clamp(1rem, 4vw, 2rem); background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.05rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--grad); color: #fff; font-weight: 800; box-shadow: var(--shadow-sm);
}
.brand-mark.big { width: 52px; height: 52px; border-radius: 15px; font-size: 1.6rem; }
.brand-dot { color: var(--accent); }
.nav-links { display: flex; gap: .3rem; margin-left: .5rem; }
.nav-links a { color: var(--text-2); padding: .4rem .8rem; border-radius: 9px; font-weight: 500; }
.nav-links a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav-links a.active { color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.user-chip { font-size: .84rem; color: var(--text-2); padding: .3rem .6rem; background: var(--surface-2);
  border-radius: 99px; border: 1px solid var(--border); }
.icon-btn { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; width: 34px;
  height: 34px; cursor: pointer; font-size: 1rem; color: var(--text); display: grid; place-items: center; }
.icon-btn:hover { border-color: var(--primary); }
.theme-icon-dark { display: none; } [data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: inline; }

.container { max-width: var(--maxw); margin: 0 auto; padding: clamp(1.2rem, 3vw, 2.4rem) clamp(1rem, 4vw, 2rem) 4rem; }

/* ---------- Buttons ---------- */
.btn-primary, .btn-ghost {
  font-family: inherit; font-weight: 600; font-size: .92rem; border-radius: 11px; cursor: pointer;
  padding: .62rem 1.15rem; border: 1px solid transparent; transition: transform .08s, box-shadow .15s, background .15s;
}
.btn-primary { background: var(--grad); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(99,102,241,.35); text-decoration: none; }
.btn-primary:active { transform: translateY(0); }
.btn-primary.block { width: 100%; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.btn-ghost.small, .btn-primary.small { padding: .4rem .75rem; font-size: .84rem; border-radius: 9px; }
.btn-ghost.danger:hover { border-color: var(--danger); color: var(--danger); }
.pill { display: inline-block; font-size: .74rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
  color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); padding: .3rem .7rem;
  border-radius: 99px; margin-bottom: 1rem; }
.alert.error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger);
  padding: .6rem .8rem; border-radius: 10px; font-size: .88rem; margin-bottom: .4rem; }
.stack { display: flex; flex-direction: column; gap: .3rem; }
.stack label, .fld { display: flex; flex-direction: column; gap: .3rem; font-weight: 500; font-size: .88rem; margin-bottom: .7rem; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }

input, textarea, select {
  font-family: inherit; font-size: .92rem; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: .55rem .7rem; width: 100%; transition: border .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
textarea { resize: vertical; }
label { font-weight: 500; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; position: relative; overflow: hidden; }
.login-aurora { position: fixed; inset: -30%; background:
  radial-gradient(40% 40% at 25% 30%, rgba(99,102,241,.35), transparent 70%),
  radial-gradient(40% 45% at 75% 65%, rgba(20,184,166,.30), transparent 70%),
  radial-gradient(35% 35% at 60% 20%, rgba(139,92,246,.25), transparent 70%);
  filter: blur(20px); z-index: -1; animation: float 14s ease-in-out infinite alternate; }
@keyframes float { to { transform: translateY(24px) scale(1.05); } }
.login-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 2.2rem; box-shadow: var(--shadow); }
.login-brand { display: flex; gap: .9rem; align-items: center; margin-bottom: 1.4rem; }
.login-brand h1 { font-size: 1.4rem; margin: 0; }
.login-brand p { font-size: .84rem; color: var(--text-2); margin: .15rem 0 0; }
.login-form { display: flex; flex-direction: column; gap: .35rem; }
.login-form label { font-size: .84rem; margin-top: .5rem; }
.login-form button { margin-top: 1rem; }
.login-feats { list-style: none; padding: 0; margin: 1.4rem 0 0; display: flex; flex-direction: column; gap: .5rem;
  font-size: .85rem; color: var(--text-2); }

/* ---------- Hero (dashboard) ---------- */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 2rem; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: clamp(1.4rem, 3vw, 2.6rem); box-shadow: var(--shadow); margin-bottom: 2rem;
  position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0; background: var(--grad); opacity: .05; pointer-events: none; }
.hero-text h1 { font-family: var(--display); font-weight: 600; font-size: clamp(1.7rem, 3.2vw, 2.5rem); margin: .2rem 0 .6rem; }
.hero-text p { color: var(--text-2); max-width: 46ch; }
.hero-cta { display: flex; gap: .7rem; margin-top: 1.2rem; flex-wrap: wrap; }
.hero-flow { display: flex; flex-direction: column; gap: .5rem; }
.hero-flow-step { display: flex; align-items: center; gap: .7rem; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 12px; padding: .55rem .8rem; font-size: .86rem; font-weight: 500;
  animation: slidein .5s both; animation-delay: calc(var(--i) * .07s); }
@keyframes slidein { from { opacity: 0; transform: translateX(16px); } }
.hfs-emoji { font-size: 1.15rem; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 .2rem .9rem; }
.section-head h2 { font-size: 1.2rem; }

/* ---------- Cards ---------- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.1rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .15s, border-color .15s; }
.project-card { color: var(--text); display: flex; flex-direction: column; gap: .5rem; }
.project-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); text-decoration: none; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.tag { font-size: .72rem; font-weight: 600; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent);
  padding: .22rem .55rem; border-radius: 99px; }
.stage-badge { font-size: .74rem; color: var(--text-2); }
.project-card h3 { font-size: 1.05rem; margin: 0; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .86rem; margin: 0; }
.progress-line { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: .3rem 0; }
.progress-line span { display: block; height: 100%; background: var(--grad); border-radius: 99px; transition: width .3s; }
.card-stats { display: flex; gap: 1rem; font-size: .8rem; color: var(--text-2); }

.empty { text-align: center; padding: 3rem 1rem; background: var(--surface); border: 1px dashed var(--border-2);
  border-radius: var(--radius-lg); }
.empty-emoji { font-size: 2.6rem; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,12,20,.55); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 100; padding: 1rem; }
.modal { width: min(520px, 100%); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.4rem 1.5rem; box-shadow: var(--shadow); max-height: 90vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.modal-head h3 { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }

/* ---------- Learn ---------- */
.learn-hero { max-width: 800px; margin: 0 auto 1rem; text-align: center; }
.learn-hero h1 { font-family: var(--display); font-weight: 600; font-size: clamp(1.7rem, 3.4vw, 2.5rem); }
.learn-hero p { color: var(--text-2); }
.learn-layout { display: grid; grid-template-columns: 230px 1fr; gap: 2rem; margin-top: 2rem; align-items: start; }
.learn-toc { position: sticky; top: 70px; }
.toc-inner { display: flex; flex-direction: column; gap: .1rem; font-size: .85rem; }
.toc-title { font-weight: 700; text-transform: uppercase; font-size: .72rem; letter-spacing: .05em; color: var(--text-3); margin-bottom: .4rem; }
.learn-toc a { color: var(--text-2); padding: .3rem .5rem; border-radius: 8px; }
.learn-toc a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.toc-sub { padding-left: 1rem !important; font-size: .82rem; }
.learn-body h2 { font-size: 1.4rem; margin: 2.2rem 0 .6rem; padding-top: .4rem; }
.learn-body h2:first-child { margin-top: 0; }
.learn-stage { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.3rem 1.5rem; margin-bottom: 1rem; box-shadow: var(--shadow-sm); }
.ls-head { display: flex; gap: .9rem; align-items: center; margin-bottom: .6rem; }
.ls-emoji { font-size: 1.8rem; }
.ls-fase { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); font-weight: 600; }
.ls-head h3 { margin: 0; font-size: 1.15rem; }
.ls-resumen { font-weight: 500; }
.cs-box { background: color-mix(in srgb, var(--accent) 8%, var(--surface-2)); border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
  border-radius: 12px; padding: .8rem 1rem; margin-top: .8rem; }
.cs-box-title { font-weight: 700; font-size: .86rem; margin: 0 0 .3rem; color: color-mix(in srgb, var(--accent) 80%, var(--text)); }
.cs-box ul { margin: 0; padding-left: 1.1rem; font-size: .88rem; }
.cs-box li { margin-bottom: .3rem; }
.source-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem; }
.source-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .9rem 1rem; box-shadow: var(--shadow-sm); }
.source-head { display: flex; justify-content: space-between; }
.source-card p { font-size: .82rem; color: var(--text-2); margin: .3rem 0 0; }
.flow-mini { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; text-align: center; }
.fm-phase { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--primary); font-weight: 700; }
.fm-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: .7rem; margin: .3rem 0; font-size: .88rem; }
.fm-arrow { color: var(--text-3); font-size: 1.2rem; }
.check-sec { margin-bottom: 1rem; }
.check-sec h4 { font-size: .95rem; color: var(--primary); margin-bottom: .4rem; }
.check-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.check-list li { display: flex; gap: .6rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .55rem .7rem; font-size: .86rem; }
.check-n { display: grid; place-items: center; min-width: 24px; height: 24px; border-radius: 7px; background: var(--surface-2); font-weight: 700; font-size: .78rem; color: var(--primary); }
.learn-cta { text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; margin-top: 2rem; box-shadow: var(--shadow-sm); }

/* ---------- Project workspace ---------- */
.proj { max-width: 1320px; margin: 0 auto; padding: 1rem clamp(1rem, 3vw, 1.8rem) 3rem; }
.proj-topbar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.proj-crumb { display: flex; align-items: center; gap: .5rem; flex: 1; min-width: 260px; color: var(--text-3); font-size: .85rem; }
.title-input { font-size: 1.1rem; font-weight: 700; border: 1px solid transparent; background: transparent; padding: .35rem .5rem; border-radius: 9px; }
.title-input:hover { border-color: var(--border); }
.proj-topbar-right { display: flex; align-items: center; gap: .5rem; }
.save-ind { font-size: .78rem; color: var(--ok); opacity: 0; transition: opacity .3s; }
.save-ind.show { opacity: 1; }
.save-ind.saving { color: var(--text-3); opacity: 1; }
.area-select { width: auto; font-size: .82rem; padding: .35rem .5rem; }

.stepper { display: flex; gap: .5rem; overflow-x: auto; padding: .3rem .1rem 1rem; margin-bottom: .4rem; scrollbar-width: thin; }
.step { flex: 0 0 auto; display: flex; align-items: center; gap: .5rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: .5rem .8rem; cursor: pointer; font-family: inherit; color: var(--text-2); font-size: .85rem; transition: all .12s; white-space: nowrap; }
.step:hover { border-color: var(--primary); }
.step-num { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); font-weight: 700; font-size: .76rem; }
.step-emoji { display: none; }
.step.active { background: var(--grad); color: #fff; border-color: transparent; box-shadow: var(--shadow-sm); }
.step.active .step-num { background: rgba(255,255,255,.25); color: #fff; }
.step.done .step-num { background: var(--ok); color: #fff; }
.step.done { border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); }

.workspace { display: grid; grid-template-columns: 1fr 380px; gap: 1.3rem; align-items: start; }
.ws-main { min-width: 0; }
.stage-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: clamp(1.1rem, 2.2vw, 1.8rem); box-shadow: var(--shadow-sm); }
.stage-head { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.stage-emoji { font-size: 2.2rem; line-height: 1; }
.stage-fase { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); font-weight: 700; }
.stage-head h2 { font-size: 1.35rem; margin: .1rem 0; }
.stage-resumen { color: var(--text-2); margin: 0; font-size: .92rem; }
.teach { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 1.3rem; }
.teach summary { cursor: pointer; padding: .7rem 1rem; font-weight: 600; font-size: .9rem; list-style: none; }
.teach summary::-webkit-details-marker { display: none; }
.teach summary::before { content: "▸ "; color: var(--primary); }
.teach[open] summary::before { content: "▾ "; }
.teach-body { padding: 0 1.2rem 1rem; font-size: .9rem; }
.teach-body p { color: var(--text-2); }

.fld-title { font-weight: 700; font-size: .92rem; margin: 1.2rem 0 .6rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.callout { background: color-mix(in srgb, var(--primary) 8%, var(--surface-2)); border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border));
  border-radius: 10px; padding: .7rem .9rem; font-size: .86rem; margin: .8rem 0; }

/* list editor */
.list-editor { margin-bottom: 1.1rem; }
.le-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: .9rem; margin-bottom: .5rem; }
.chip-add { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); border: 1px dashed color-mix(in srgb, var(--primary) 40%, transparent);
  border-radius: 8px; padding: .3rem .6rem; font-size: .8rem; font-family: inherit; cursor: pointer; font-weight: 600; }
.chip-add:hover { background: color-mix(in srgb, var(--primary) 20%, transparent); }
.le-items { display: flex; flex-direction: column; gap: .5rem; }
.le-item { display: flex; gap: .5rem; align-items: center; }
.le-item input { flex: 1; }
.le-del { background: transparent; border: 1px solid var(--border); border-radius: 8px; width: 32px; height: 34px; cursor: pointer; color: var(--text-3); flex: 0 0 auto; }
.le-del:hover { border-color: var(--danger); color: var(--danger); }

.picoc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.picoc-grid label { display: flex; flex-direction: column; gap: .25rem; font-size: .82rem; font-weight: 600; }
.picoc-grid .wide { grid-column: 1 / -1; }

.source-check { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .5rem; margin-bottom: 1.2rem; }
.src-chk { display: flex; align-items: center; gap: .5rem; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: .5rem .7rem; font-size: .85rem; cursor: pointer; font-weight: 500; }
.src-chk input { width: auto; }
.src-chk:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface-2)); }

.ss-items { display: flex; flex-direction: column; gap: .7rem; }
.ss-item { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: .7rem; display: grid;
  grid-template-columns: 1fr 110px 34px; gap: .5rem; align-items: start; }
.ss-item .ss-source { grid-column: 1 / 2; }
.ss-item textarea { grid-column: 1 / 3; font-family: ui-monospace, monospace; font-size: .82rem; }
.ss-item .ss-count { grid-column: 2 / 3; }
.ss-item .le-del { grid-column: 3 / 4; grid-row: 1 / 3; height: auto; }

.flow-inputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .7rem; margin: .5rem 0; }
.flow-in { display: flex; flex-direction: column; gap: .25rem; font-size: .8rem; font-weight: 600; color: var(--text-2); }
.flow-in input { max-width: 140px; }

/* flow diagram (generado por JS) */
.flow-diagram { display: flex; flex-direction: column; gap: 0; margin: .6rem 0; }
.fd-step { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: center; }
.fd-phase-label { grid-column: 1 / -1; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--primary); font-weight: 700; margin-top: .6rem; }
.fd-box { background: var(--surface); border: 2px solid var(--primary); border-radius: 12px; padding: .7rem .9rem; font-size: .86rem; box-shadow: var(--shadow-sm); }
.fd-box b { font-size: 1.05rem; }
.fd-ex { background: var(--surface-2); border: 1px dashed var(--border-2); border-radius: 10px; padding: .55rem .8rem; font-size: .82rem; color: var(--text-2); }
.fd-arrow { grid-column: 1 / 2; text-align: center; color: var(--primary); font-size: 1.2rem; height: 22px; }
.fd-box.include { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }

/* referencias */
.ref-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.ref-tabs { display: flex; gap: .3rem; flex-wrap: wrap; }
.rt { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: .35rem .6rem; font-size: .8rem;
  font-family: inherit; cursor: pointer; color: var(--text-2); display: flex; gap: .3rem; align-items: center; }
.rt.active { background: var(--primary); color: #fff; border-color: transparent; }
.rt-n { background: rgba(0,0,0,.12); border-radius: 99px; padding: 0 .4rem; font-size: .72rem; font-weight: 700; }
.rt.active .rt-n { background: rgba(255,255,255,.25); }
.ref-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.ref-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.ref-table td { padding: .6rem .7rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.ref-table tr:last-child td { border-bottom: none; }
.ref-meta { color: var(--text-3); font-size: .78rem; }
.ref-status { font-size: .72rem; font-weight: 700; padding: .15rem .5rem; border-radius: 99px; white-space: nowrap; }
.st-pending { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.st-included { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.st-excluded { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.st-maybe { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); }
.ref-acts { display: flex; gap: .25rem; flex-wrap: wrap; }
.ref-acts button { border: 1px solid var(--border); background: var(--surface); border-radius: 7px; padding: .2rem .45rem; font-size: .74rem; cursor: pointer; color: var(--text-2); }
.ref-acts button:hover { border-color: var(--primary); color: var(--primary); }
.ref-empty { text-align: center; padding: 1.5rem; }

/* importación + cribado por pares */
.cribado-tools { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .8rem; }
.import-btn { background: color-mix(in srgb, var(--accent) 12%, transparent); color: color-mix(in srgb, var(--accent) 85%, var(--text));
  border: 1px dashed color-mix(in srgb, var(--accent) 40%, transparent); border-radius: 10px; padding: .5rem .85rem;
  font-size: .84rem; font-weight: 600; cursor: pointer; }
.import-btn:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.peer-toggle { display: flex; align-items: center; gap: .45rem; font-size: .84rem; font-weight: 600; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: .45rem .75rem; cursor: pointer; }
.peer-toggle input { width: auto; }
.peer-toggle:has(input:checked) { border-color: var(--primary); color: var(--primary); }
.import-info { font-size: .82rem; }
.import-info.ok { color: var(--ok); } .import-info.err { color: var(--danger); } .import-info.working { color: var(--text-2); }

.ref-head th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-3);
  padding: .3rem .7rem; border-bottom: 1px solid var(--border); font-weight: 700; }
.ref-conflict { background: color-mix(in srgb, var(--warn) 9%, transparent); }
.dec-sel { width: auto; min-width: 108px; padding: .3rem .4rem; font-size: .82rem; border-radius: 8px; }
.dec-sel.dec-included { border-color: color-mix(in srgb, var(--ok) 55%, var(--border)); }
.dec-sel.dec-excluded { border-color: color-mix(in srgb, var(--danger) 55%, var(--border)); }
.dec-sel.dec-maybe { border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); }

.kappa-card { background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 10%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border)); border-radius: var(--radius);
  padding: 1rem 1.2rem; margin-bottom: 1rem; box-shadow: var(--shadow-sm); }
.kappa-head { font-weight: 700; font-size: .92rem; margin-bottom: .5rem; }
.kappa-row { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.kappa-big { font-size: 1.7rem; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.kappa-meta { font-size: .85rem; color: var(--text-2); flex: 1; min-width: 180px; }
.kappa-meta b { color: var(--text); }
.kappa-conf { color: var(--warn); font-weight: 700; }
.kappa-scale { position: relative; height: 8px; border-radius: 99px; margin: .8rem 0 .3rem;
  background: linear-gradient(90deg, #ef4444, #f59e0b, #10b981); }
.kappa-scale i { position: absolute; top: -3px; width: 3px; height: 14px; background: var(--text); border-radius: 2px; box-shadow: 0 0 0 2px var(--surface); }
.kappa-note { margin-top: .3rem; }

/* checklist interactivo */
.check-progress { font-size: .8rem; background: var(--surface-2); border-radius: 99px; padding: .1rem .6rem; color: var(--primary); font-weight: 700; }
.checklist .check-sec h4 { font-size: .9rem; }
.check-item { display: flex; gap: .55rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: .5rem .7rem; margin-bottom: .4rem; font-size: .85rem; cursor: pointer; font-weight: 400; }
.check-item input { width: auto; margin-top: .15rem; }
.check-item:has(input:checked) { border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); background: color-mix(in srgb, var(--ok) 6%, var(--surface)); }

/* quick actions */
.quick-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: 1.4rem; padding-top: 1rem; border-top: 1px dashed var(--border); }
.qa-label { font-size: .84rem; font-weight: 700; color: var(--text-2); }
.qa-chip { background: color-mix(in srgb, var(--accent) 10%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  color: color-mix(in srgb, var(--accent) 85%, var(--text)); border-radius: 99px; padding: .4rem .8rem; font-size: .82rem;
  font-family: inherit; cursor: pointer; font-weight: 600; transition: all .12s; }
.qa-chip:hover { background: var(--accent); color: #fff; transform: translateY(-1px); }

/* ---------- Chat ---------- */
.ws-chat { position: sticky; top: 68px; height: calc(100vh - 84px); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-sm); }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 6%, var(--surface)), var(--surface)); }
.chat-agent { display: flex; gap: .6rem; align-items: center; }
.chat-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--grad); font-size: 1.2rem; box-shadow: var(--shadow-sm); }
.chat-agent b { font-size: .95rem; }
.chat-sub { display: block; font-size: .74rem; color: var(--text-3); }
.chat-scroll { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .8rem; }
.chat-welcome { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: .8rem; font-size: .85rem; color: var(--text-2); }
.msg { max-width: 92%; font-size: .88rem; }
.msg.user { align-self: flex-end; }
.msg.user .msg-content { background: var(--chat-user); border-radius: 14px 14px 4px 14px; padding: .6rem .85rem; }
.msg.assistant { align-self: flex-start; width: 100%; }
.msg.assistant .msg-content { background: transparent; }
.msg-role { font-size: .72rem; color: var(--text-3); margin-bottom: .2rem; font-weight: 600; }
.msg-content { line-height: 1.5; }
.msg-content p { margin: 0 0 .5rem; }
.msg-content ul, .msg-content ol { margin: .3rem 0 .6rem; padding-left: 1.2rem; }
.msg-content li { margin-bottom: .2rem; }
.msg-content h1, .msg-content h2, .msg-content h3 { font-size: .95rem; margin: .6rem 0 .3rem; }
.msg-content pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: .6rem; overflow-x: auto; font-size: .82rem; }
.msg-content table { border-collapse: collapse; font-size: .82rem; margin: .4rem 0; width: 100%; }
.msg-content th, .msg-content td { border: 1px solid var(--border); padding: .3rem .5rem; }
.typing { display: inline-flex; gap: .25rem; padding: .4rem 0; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); animation: blink 1.2s infinite both; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.chat-input-wrap { display: flex; gap: .5rem; padding: .7rem; border-top: 1px solid var(--border); align-items: flex-end; }
#chatInput { resize: none; max-height: 120px; border-radius: 12px; }
.chat-send { background: var(--grad); color: #fff; border: none; border-radius: 11px; width: 42px; height: 42px; font-size: 1.1rem; cursor: pointer; flex: 0 0 auto; }
.chat-send:disabled { opacity: .5; cursor: default; }

/* ---------- Report ---------- */
.report { background: #fff; color: #16181f; }
.report-wrap { max-width: 840px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.report-actions { display: flex; justify-content: space-between; margin-bottom: 1.5rem; }
.report-head { border-bottom: 3px solid var(--primary); padding-bottom: 1rem; margin-bottom: 1.5rem; }
.report-head h1 { font-family: var(--display); font-size: 1.8rem; }
.report-wrap h2 { font-size: 1.2rem; margin-top: 1.6rem; color: var(--primary); border-bottom: 1px solid #e5e7f2; padding-bottom: .3rem; }
.report-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.report-table { width: 100%; border-collapse: collapse; font-size: .85rem; margin: .5rem 0; }
.report-table th, .report-table td { border: 1px solid #e5e7f2; padding: .4rem .6rem; text-align: left; }
.report-table th { background: #f5f6fb; }
.report-flow { text-align: center; }
.rf-phase { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--primary); font-weight: 700; margin-top: .5rem; }
.rf-box { border: 2px solid var(--primary); border-radius: 10px; padding: .6rem; margin: .3rem auto; max-width: 460px; font-size: .88rem; }
.rf-final { border-color: var(--accent); background: #ecfdf9; }
.rf-arrow { color: var(--primary); }
.report-check-sec { font-size: .95rem; margin: .8rem 0 .3rem; }
.report-check { list-style: none; padding: 0; font-size: .85rem; columns: 2; }
.report-check li { margin-bottom: .25rem; break-inside: avoid; }
.report-sub { font-size: 1.02rem; margin: 1rem 0 .3rem; color: #16181f; }
.report-chip { display: inline-block; background: #eef0ff; color: #4f46e5; border-radius: 99px; padding: .15rem .6rem; margin: .15rem .25rem .15rem 0; font-size: .82rem; font-weight: 600; }
.report-foot { margin-top: 2.5rem; border-top: 1px solid #e5e7f2; padding-top: 1rem; font-size: .8rem; text-align: center; }
.report-cta { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; margin-top: 1.6rem; padding: 1.1rem 1.2rem;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 10%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border)); border-radius: var(--radius); }
@media print { .no-print { display: none; } body.report { background: #fff; } .report-wrap { padding: 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .workspace { grid-template-columns: 1fr; }
  .ws-chat { position: static; height: 560px; }
  .hero { grid-template-columns: 1fr; }
  .learn-layout { grid-template-columns: 1fr; }
  .learn-toc { display: none; }
}
@media (max-width: 640px) {
  .two-col, .picoc-grid, .row-2, .report-2col { grid-template-columns: 1fr; }
  .report-check { columns: 1; }
  .nav-links { display: none; }
  .ss-item { grid-template-columns: 1fr 34px; }
}
