:root {
  --bg: #F4F5F7; --surface: #FFFFFF; --ink: #151922; --ink-2: #2E3644; --muted: #566072;
  --line: #E1E4EA; --line-2: #C9CED8; --accent: #2743C6; --accent-ink: #FFFFFF; --accent-soft: #E8ECFB; --accent-deep: #1B2F8F;
  --ok-bg: #DDF2E6; --ok-ink: #0F5B3A; --warn-bg: #FCEBC8; --warn-ink: #7A4A00; --bad-bg: #FBE0DC; --bad-ink: #8A2318;
  --neutral-bg: #E9EBEF; --neutral-ink: #3D4553; --code-bg: #12151C; --code-ink: #E6E9F0;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Space Grotesk", Inter, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1218; --surface: #181C25; --ink: #ECEFF4; --ink-2: #C9CFDA; --muted: #9AA3B2;
    --line: #2A303C; --line-2: #3A4252; --accent: #8FA2FF; --accent-ink: #0F1218; --accent-soft: #232B4D; --accent-deep: #C3CDFF;
    --ok-bg: #153527; --ok-ink: #8EDDB2; --warn-bg: #3D2E0C; --warn-ink: #F3CE7C; --bad-bg: #40191A; --bad-ink: #F5A9A0;
    --neutral-bg: #262C38; --neutral-ink: #C0C7D3; --code-bg: #0A0C11; --code-ink: #E6E9F0;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--sans); }
a { color: var(--accent); }
a:hover { color: var(--accent-deep); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; margin: 0; }
p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.boot { padding: 48px 24px; color: var(--muted); text-align: center; }

/* ---------- estructura */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { max-width: 1180px; margin: 0 auto; padding: 10px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; }
.brand { font-family: var(--display); font-weight: 600; font-size: 20px; color: var(--ink); text-decoration: none; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 auto; }
.nav a { padding: 10px 14px; border-radius: 8px; color: var(--muted); font-weight: 500; text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; }
.top-side { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.page { max-width: 1180px; margin: 0 auto; padding: 28px 24px 56px; display: flex; flex-direction: column; gap: 28px; }
.cols { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.main-col { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.side-col { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; }
.card h2 { font-size: 17px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.wrap { overflow-wrap: anywhere; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 8px; }
.empty { color: var(--muted); padding: 8px 0; }

/* ---------- controles */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, .textarea { width: 100%; min-height: 46px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); }
.textarea { padding: 12px 14px; resize: vertical; min-height: 84px; }
.btn { min-height: 46px; padding: 0 20px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: var(--ink); }
.btn:hover { border-color: var(--accent); color: var(--ink); }
.btn.primary { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); color: var(--accent-ink); }
.btn[disabled] { opacity: 0.55; cursor: default; }
.btn.link { border: 0; background: none; padding: 0 4px; min-height: 44px; color: var(--accent); align-self: flex-start; }
.ask-row { display: flex; flex-wrap: wrap; gap: 10px; }
.ask-row .input { flex: 1 1 260px; width: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; font-weight: 500; cursor: pointer; }
.chip-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--neutral-bg); color: var(--neutral-ink); }
.tag.ok { background: var(--ok-bg); color: var(--ok-ink); }
.tag.warn { background: var(--warn-bg); color: var(--warn-ink); }
.tag.bad { background: var(--bad-bg); color: var(--bad-ink); }
.tag.accent { background: var(--accent-soft); color: var(--accent-deep); }
.tag.plain { font-weight: 500; }

/* ---------- captura */
.capture-grid { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.capture-grid .f-input { flex: 3 1 340px; }
.capture-grid .f-note { flex: 2 1 240px; }
.file-name { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.jobs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.jobs li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; background: var(--bg); border-radius: 10px; font-size: 14px; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin 0.9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }

/* ---------- búsqueda y resultados */
.search { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 6px 0 16px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; }
.search input { flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: transparent; min-height: 46px; }
.search svg { flex: none; color: var(--muted); }
.results { display: flex; flex-direction: column; gap: 10px; }
.result { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; display: flex; flex-direction: column; gap: 8px; }
.result h3 { font-size: 18px; line-height: 1.3; }
.result h3 a { color: var(--ink); text-decoration: none; }
.result h3 a:hover { color: var(--accent); }
.result .hook { color: var(--ink-2); }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 14px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.list > li:last-child { border-bottom: 0; padding-bottom: 0; }
.list > li:first-child { padding-top: 0; }

/* ---------- detalle */
.detail-title { font-size: 28px; line-height: 1.2; letter-spacing: -0.015em; }
.prose { color: var(--ink-2); display: flex; flex-direction: column; gap: 10px; }
.prose ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.prose code { font-family: var(--mono); font-size: 0.88em; background: var(--neutral-bg); padding: 1px 5px; border-radius: 5px; }
.prose pre { margin: 0; padding: 14px 16px; background: var(--code-bg); color: var(--code-ink); border-radius: 10px; overflow-x: auto; font-family: var(--mono); font-size: 13px; line-height: 1.55; }
.prose pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.ask { background: var(--bg); border-radius: 12px; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.passage { margin: 0; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; color: var(--ink-2); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.passage .where { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; white-space: normal; }
.pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: 13px; line-height: 1.6; color: var(--ink-2); }
.notice { padding: 12px 16px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-ink); font-size: 14px; }
.notice.bad { background: var(--bad-bg); color: var(--bad-ink); }
.notice.ok { background: var(--ok-bg); color: var(--ok-ink); }

/* ---------- inicio de sesión */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login form { width: 100%; max-width: 380px; }
.login h1 { font-size: 26px; }

/* ---------- celular */
.tabbar { display: none; }
@media (max-width: 700px) {
  .top-in { padding: 10px 16px; }
  .nav { display: none; }
  .page { padding: 20px 16px 96px; gap: 22px; }
  .card { padding: 18px 16px; }
  .detail-title { font-size: 23px; }
  .btn.wide-sm { width: 100%; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); }
  .tabbar a { flex: 1 1 0; min-height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; font-weight: 600; text-decoration: none; color: var(--muted); border-radius: 10px; }
  .tabbar a[aria-current="page"] { color: var(--accent-deep); background: var(--accent-soft); }
}
