/* ---------- Fuentes (autoalojadas) ---------- */
@font-face { font-family: 'Courier Prime'; font-weight: 400; font-style: normal; font-display: swap; src: url(/fonts/courier-prime-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Courier Prime'; font-weight: 700; font-style: normal; font-display: swap; src: url(/fonts/courier-prime-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-style: normal; font-display: swap; src: url(/fonts/inter-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-style: normal; font-display: swap; src: url(/fonts/inter-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-style: normal; font-display: swap; src: url(/fonts/jetbrains-mono-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 700; font-style: normal; font-display: swap; src: url(/fonts/jetbrains-mono-latin-700-normal.woff2) format('woff2'); }

/* ---------- Tokens: tema claro (por defecto) ---------- */
:root {
  --green: #00ff00;
  --cyan: #00ffff;
  --magenta: #ff00ff;
  --yellow: #ffff00;
  --orange: #ff6600;

  --bg: #ffffff;
  --bg-side: #fafafa;
  --bg-elev: #ffffff;
  --fg: #0e0e10;
  --fg-2: #1f2328;
  --muted: #57606a;
  --border: #d0d7de;
  --soft: #e5e9ee;
  --hover: #f3f5f7;

  --accent: var(--green);
  --on-accent: #0e0e10;
  --title-fx: linear-gradient(transparent 64%, var(--green) 64%, var(--green) 92%, transparent 92%); /* marcador verde bajo el titulo */

  /* prioridades (tonos legibles sobre blanco) */
  --p1: #d100d1;
  --p2: #ff6600;
  --p3: #0097a7;
  --p4: #8b949e;
  --late: #ff6600;

  --font-body: 'Courier Prime', 'Courier New', Courier, 'Liberation Mono', monospace;
  --font-display: 'Inter', 'Helvetica Neue', Arial, sans-serif;

  --r1: 4px; --r2: 8px; --r3: 12px;
  color-scheme: light;
}

/* ---------- Tokens: tema oscuro ---------- */
:root[data-theme='dark'] {
  --bg: #0d1117;
  --bg-side: #0d1117;
  --bg-elev: #161b22;
  --fg: #ffffff;
  --fg-2: #c9d1d9;
  --muted: #8b949e;
  --border: #21262d;
  --soft: #21262d;
  --hover: #161b22;

  --title-fx: none;
  --p1: #ff00ff;
  --p2: #ff6600;
  --p3: #00ffff;
  --p4: #8b949e;

  --font-body: 'JetBrains Mono', Consolas, 'SF Mono', monospace;
  --font-display: 'JetBrains Mono', Consolas, 'SF Mono', monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font: 15px/1.6 var(--font-body); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
input, select, textarea { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r2); padding: 8px 10px; width: 100%; }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; border-color: var(--fg); }
:root[data-theme='dark'] input:focus-visible { border-color: var(--green); }

/* ---------- Estructura ---------- */
.layout { display: grid; grid-template-columns: 280px 1fr; height: 100dvh; }
.side { background: var(--bg-side); border-right: 1px solid var(--border); padding: 18px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; padding: 2px 10px 16px; font-size: 20px; letter-spacing: -0.01em; }
.brand img { width: 24px; height: 24px; border-radius: var(--r1); }
.brand .cur { color: var(--fg); background: var(--green); width: 0.6em; height: 3px; display: inline-block; margin-left: -7px; align-self: flex-end; margin-bottom: 7px; }

.nav { color: var(--fg); text-decoration: none; display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: var(--r1); text-align: left; }
.nav:hover { background: var(--hover); }
.nav.active { background: var(--green); color: var(--on-accent); font-weight: 700; }
.nav .ico { width: 18px; text-align: center; color: var(--muted); font-weight: 700; }
.nav.active .ico, .nav.active .count { color: var(--on-accent); }
.nav .count { margin-left: auto; color: var(--muted); font-size: 12px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; margin: 0 4px; }
.side h3 { margin: 20px 10px 4px; font-family: var(--font-body); font-size: 12px; font-weight: 700; text-transform: lowercase; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.side h3::before { content: '.'; color: var(--fg); margin-right: 1px; }
.side h3 span { flex: 1; }
.side h3 button { font-size: 18px; color: var(--muted); line-height: 1; padding: 0 6px; border-radius: var(--r1); }
.side h3 button:hover { background: var(--hover); color: var(--fg); }
.side .search { margin: 0 4px 10px; width: calc(100% - 8px); }
.side .foot { margin-top: auto; padding: 14px 10px 0; color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.side .foot button { color: var(--muted); border: 1px solid var(--border); border-radius: var(--r1); padding: 2px 8px; font-size: 12px; }
.side .foot button:hover { color: var(--fg); border-color: var(--fg); }

.main { overflow-y: auto; }
.main-inner { max-width: 780px; margin: 0 auto; padding: 32px 28px 120px; }
.topbar { display: none; }
.view-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.view-head h1 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 30px; line-height: 1.15; letter-spacing: -0.01em; background-image: var(--title-fx); padding: 0 2px; }
:root[data-theme='dark'] .view-head h1 { color: var(--green); }
.view-head .sub { color: var(--muted); font-size: 13px; }
.group-head { margin: 26px 0 6px; padding-bottom: 6px; border-bottom: 1px solid var(--border); font-family: var(--font-display); font-size: 15px; font-weight: 700; display: flex; gap: 8px; align-items: baseline; }
.group-head::before { content: '>'; color: var(--fg); font-family: var(--font-body); background: var(--green); color: var(--on-accent); border-radius: var(--r1); padding: 0 5px; font-size: 12px; align-self: center; line-height: 1.5; }
.group-head.overdue::before { background: var(--late); }
.group-head small { color: var(--muted); font-weight: 400; font-family: var(--font-body); }
.group-head small:last-child { margin-left: auto; }

/* ---------- Captura rapida ---------- */
.add { margin: 8px 0 14px; }
.add input { padding: 12px 14px; border-radius: var(--r3); font-size: 15px; }
.add .hint { color: var(--muted); font-size: 12px; margin-top: 8px; min-height: 22px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: var(--r1); padding: 0 7px; font-size: 12px; border: 1px solid var(--border); color: var(--fg-2); white-space: nowrap; line-height: 1.6; }
.chip.date { border-color: var(--border); }
.chip.date.today { background: var(--green); border-color: var(--green); color: var(--on-accent); font-weight: 700; }
.chip.date.tomorrow { border-color: var(--orange); color: var(--fg); }
.chip.date.overdue { background: var(--late); border-color: var(--late); color: #0e0e10; font-weight: 700; }
.chip.lbl::before { content: '@'; color: var(--p1); font-weight: 700; }
.chip.proj::before { content: '#'; color: var(--p3); font-weight: 700; }
.chip.secchip::before { content: '/'; color: var(--p2); font-weight: 700; }
.chip.target { background: var(--green); border-color: var(--green); color: var(--on-accent); font-weight: 700; cursor: pointer; }
.chip.target::before { content: '>'; color: var(--on-accent); }

/* ---------- Tareas ---------- */
.task { display: flex; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--soft); border-radius: var(--r1); align-items: flex-start; }
.task:hover { background: var(--hover); }
.task.sub { margin-left: 30px; }
.task .body { flex: 1; min-width: 0; cursor: pointer; }
.task .title { word-break: break-word; }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.task .meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 4px; font-size: 12px; color: var(--muted); }
.task .desc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.check { flex: none; width: 20px; height: 20px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--p4); display: grid; place-items: center; transition: background .12s; color: var(--p4); }
.check svg { opacity: 0; width: 12px; height: 12px; stroke: currentColor; }
.check:hover svg { opacity: .8; }
.check.p1 { border-color: var(--p1); color: var(--p1); background: color-mix(in srgb, var(--p1) 12%, transparent); }
.check.p2 { border-color: var(--p2); color: var(--p2); background: color-mix(in srgb, var(--p2) 12%, transparent); }
.check.p3 { border-color: var(--p3); color: var(--p3); background: color-mix(in srgb, var(--p3) 12%, transparent); }
.check.checked { background: var(--green); border-color: var(--green); color: var(--on-accent); }
.check.checked svg { opacity: 1; }
.empty { text-align: center; color: var(--muted); padding: 64px 0; }
.empty b { display: block; color: var(--fg); font-family: var(--font-display); font-size: 17px; margin-bottom: 6px; }
.empty b::before { content: '< '; color: var(--fg); background: var(--green); color: var(--on-accent); padding: 0 4px; border-radius: var(--r1); }
.empty b::after { content: ' />'; background: var(--green); color: var(--on-accent); padding: 0 4px; border-radius: var(--r1); }

/* ---------- Secciones ---------- */
.sec { margin-top: 26px; }
.sec-head { display: flex; align-items: baseline; gap: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.sec-name { font-family: var(--font-display); font-weight: 700; font-size: 16px; min-width: 0; overflow-wrap: anywhere; }
.sec-head small { color: var(--muted); }
.sec-actions { margin-left: auto; display: flex; gap: 4px; opacity: .55; transition: opacity .12s; }
.sec:hover .sec-actions, .sec-actions:focus-within { opacity: 1; }
.sec-btn { color: var(--muted); border: 1px solid transparent; border-radius: var(--r1); padding: 0 7px; font-size: 12px; line-height: 1.7; }
.sec-btn:hover { color: var(--fg); border-color: var(--border); background: var(--hover); }
.sec-empty { color: var(--muted); font-size: 13px; padding: 12px 6px; }
@media (hover: none) { .sec-actions { opacity: 1; } }

/* ---------- Panel de detalle ---------- */
.scrim { position: fixed; inset: 0; background: rgba(13, 17, 23, .45); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100%); background: var(--bg-elev); border-left: 1px solid var(--border); z-index: 21; padding: 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.drawer .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.drawer label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.drawer .title-in { font-family: var(--font-display); font-size: 19px; font-weight: 700; border: 0; padding: 4px 0; background: transparent; border-radius: 0; }
.drawer .title-in:focus-visible { outline: none; border-bottom: 3px solid var(--green); }
.drawer .actions { display: flex; gap: 8px; margin-top: auto; padding-top: 14px; }
.btn { border-radius: var(--r2); padding: 8px 14px; border: 1px solid var(--border); background: transparent; }
.btn:hover { border-color: var(--fg); }
.btn.primary { background: var(--green); border-color: var(--green); color: var(--on-accent); font-weight: 700; }
.btn.primary:hover { filter: brightness(.92); }
.btn.danger { color: var(--fg); }
.btn.danger:hover { border-color: var(--late); color: var(--late); }
.btn.grow { flex: 1; }
.subs { display: flex; flex-direction: column; gap: 2px; }
.subs .task { padding: 6px 2px; border: 0; }

/* ---------- Login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login form { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--border); border-radius: var(--r3); padding: 28px 26px; background: var(--bg-elev); }
.login h1 { margin: 0 0 6px; display: flex; align-items: center; gap: 10px; font-family: var(--font-display); letter-spacing: -0.01em; }
.login h1 img { border-radius: var(--r1); }
.login .err { color: var(--late); min-height: 20px; font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: var(--r2); z-index: 40; font-size: 14px; display: flex; gap: 14px; align-items: center; max-width: calc(100vw - 32px); }
.toast::before { content: '>'; background: var(--green); color: #0e0e10; border-radius: var(--r1); padding: 0 5px; font-weight: 700; }
.toast button { color: inherit; text-decoration: underline; }
:root[data-theme='dark'] .toast { background: var(--bg-elev); color: var(--fg); border: 1px solid var(--green); }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 30; transform: translateX(-100%); transition: transform .2s; border-right: 1px solid var(--border); background: var(--bg-side); }
  .layout.nav-open .side { transform: none; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 5; font-family: var(--font-display); font-weight: 700; }
  .topbar button { font-size: 22px; line-height: 1; padding: 2px 8px; }
  .main-inner { padding: 16px 14px 120px; }
  .view-head h1 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Menu ocultable ---------- */
.hide-side { margin-left: auto; color: var(--muted); font-size: 20px; line-height: 1; padding: 2px 8px; border-radius: var(--r1); opacity: .5; }
.hide-side:hover { opacity: 1; background: var(--hover); }
@media (min-width: 821px) {
  .layout.side-hidden { grid-template-columns: 1fr; }
  .layout.side-hidden .side { display: none; }
}
.side-toggle { position: fixed; top: 12px; left: 12px; z-index: 15; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: var(--r2); background: var(--bg); color: var(--fg); font-size: 18px; line-height: 1; }
.side-toggle:hover { border-color: var(--fg); }
@media (max-width: 820px) { .hide-side, .side-toggle { display: none; } }

/* ---------- Boton kb (muy sutil) ---------- */
.kb-btn { color: var(--muted); text-decoration: none; font-size: 12px; opacity: .4; padding: 2px 4px; border-radius: var(--r1); }
.kb-btn:hover { opacity: 1; background: var(--hover); }
.kb-btn.on { opacity: 1; color: var(--on-accent); background: var(--green); font-weight: 700; padding: 2px 8px; }

/* ---------- Knowledge base ---------- */
.kb-back { display: inline-block; color: var(--muted); text-decoration: none; font-size: 13px; margin-bottom: 12px; }
.kb-back:hover { color: var(--fg); }
.md { line-height: 1.7; }
.md h2, .md h3, .md h4, .md h5, .md h6 { font-family: var(--font-display); margin: 1.6em 0 .4em; line-height: 1.25; }
.md h2 { font-size: 22px; } .md h3 { font-size: 18px; } .md h4, .md h5, .md h6 { font-size: 15px; }
.md p { margin: 0 0 1em; }
.md ul, .md ol { margin: 0 0 1em; padding-left: 1.4em; }
.md li::marker { color: var(--fg); font-weight: 700; }
.md code { background: var(--hover); border: 1px solid var(--soft); border-radius: var(--r1); padding: 0 5px; font-size: .92em; }
.md pre { background: var(--hover); border: 1px solid var(--border); border-radius: var(--r2); padding: 12px 14px; overflow-x: auto; margin: 0 0 1em; }
.md pre code { background: none; border: 0; padding: 0; }
.md blockquote { margin: 0 0 1em; padding: 4px 16px; border-left: 3px solid var(--green); color: var(--fg-2); }
.md a { color: var(--fg); text-decoration: underline; text-decoration-color: var(--green); text-decoration-thickness: 2px; text-underline-offset: 2px; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1.5em 0; }
/* ---------- Nota de seccion ---------- */
.sec-note { color: var(--muted); font-size: 13px; white-space: pre-wrap; padding: 8px 6px 2px; border-left: 3px solid var(--green); margin: 8px 0 4px 2px; padding-left: 12px; }

/* ---------- Centro de ayuda ---------- */
.main-inner.wide { max-width: 1040px; }
.help-search { padding: 12px 14px; border-radius: var(--r3); font-size: 15px; margin-bottom: 18px; }
.help-count { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.help-feature-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 8px; }
.help-card { display: block; color: inherit; text-decoration: none; border: 1px solid var(--border); border-radius: var(--r3); padding: 16px 18px; background: var(--bg-elev); transition: border-color .12s; }
.help-card:hover { border-color: var(--fg); }
.help-card.feature { background: var(--green); border-color: var(--green); color: #0e0e10; }
.help-card.feature .hc-sum { color: #0e0e10; opacity: .8; }
.help-card.feature:hover { filter: brightness(.94); }
.hc-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; line-height: 1.3; }
.hc-sum { color: var(--muted); font-size: 13px; margin-top: 6px; }
.help-cat { margin-top: 30px; }
.help-cat h2 { font-family: var(--font-display); font-size: 17px; margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.help-cat h2::before { content: '.'; margin-right: 1px; }
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.help-result { display: block; color: inherit; text-decoration: none; border-bottom: 1px solid var(--soft); padding: 14px 4px; }
.help-result:hover { background: var(--hover); }
.help-result .chip { margin: 6px 0 4px; }
mark { background: var(--green); color: #0e0e10; border-radius: 2px; padding: 0 1px; }
.kb-back { display: inline-block; color: var(--muted); text-decoration: none; font-size: 13px; margin-bottom: 12px; }
.kb-back:hover { color: var(--fg); }

.article { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 40px; align-items: start; }
.art-title { font-family: var(--font-display); font-size: 32px; line-height: 1.15; letter-spacing: -0.01em; margin: 10px 0 6px; background-image: var(--title-fx); display: inline; padding: 0 2px; }
:root[data-theme='dark'] .art-title { color: var(--green); }
.art-sum { color: var(--muted); font-size: 16px; margin: 14px 0 28px; }
.toc { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; border-left: 1px solid var(--border); padding-left: 14px; }
.toc b { margin-bottom: 6px; color: var(--muted); font-weight: 700; font-size: 12px; }
.toc button { text-align: left; color: var(--fg-2); padding: 3px 0; line-height: 1.35; }
.toc button:hover { color: var(--fg); text-decoration: underline; text-decoration-color: var(--green); text-decoration-thickness: 2px; }
.art-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 48px; }
.art-nav a { display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; border: 1px solid var(--border); border-radius: var(--r3); padding: 12px 16px; }
.art-nav a:hover { border-color: var(--fg); }
.art-nav a.next { text-align: right; }
.art-nav small { color: var(--muted); }

.md h2 { scroll-margin-top: 20px; }
.md .table-wrap { overflow-x: auto; margin: 0 0 1.2em; }
.md-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.md-table th { text-align: left; font-family: var(--font-display); font-size: 13px; border-bottom: 2px solid var(--fg); padding: 8px 12px 8px 0; white-space: nowrap; }
.md-table td { border-bottom: 1px solid var(--border); padding: 8px 12px 8px 0; vertical-align: top; }
.md kbd, kbd { font-family: var(--font-body); font-size: .85em; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: var(--r1); padding: 0 6px; background: var(--hover); }
.callout { display: flex; gap: 12px; border: 1px solid var(--border); border-left: 4px solid var(--green); border-radius: var(--r2); padding: 12px 16px; margin: 0 0 1.2em; background: var(--bg-elev); }
.callout b { flex: none; font-family: var(--font-display); }
.callout.warn { border-left-color: var(--orange); }
.callout.info { border-left-color: var(--p3); }
.codeblock { position: relative; margin: 0 0 1.2em; }
.codeblock pre { margin: 0; padding-right: 70px; white-space: pre-wrap; word-break: break-word; }
.codeblock .copy { position: absolute; top: 8px; right: 8px; font-size: 12px; color: var(--muted); border: 1px solid var(--border); border-radius: var(--r1); padding: 0 8px; background: var(--bg); }
.codeblock .copy:hover { color: var(--fg); border-color: var(--fg); }

.qa { border: 1px solid var(--border); border-radius: var(--r3); padding: 16px; margin: 0 0 1.4em; background: var(--bg-elev); }
.qa-title { font-family: var(--font-display); font-weight: 700; margin-bottom: 10px; }
.qa-title::before { content: '>'; background: var(--green); color: #0e0e10; border-radius: var(--r1); padding: 0 5px; margin-right: 8px; font-family: var(--font-body); font-size: 12px; }
.qa-examples { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.qa-examples .chip { cursor: pointer; }
.qa-examples .chip:hover { border-color: var(--fg); }
.qa-out { border-top: 1px dashed var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 4px; min-height: 40px; }
.qa-row { display: flex; gap: 12px; align-items: center; font-size: 14px; }
.qa-k { width: 84px; color: var(--muted); flex: none; font-size: 12px; }
.qa-v { display: flex; gap: 6px; flex-wrap: wrap; }
.qa-empty { color: var(--muted); font-size: 13px; }

.checklist { border: 1px solid var(--border); border-radius: var(--r3); padding: 16px; margin: 0 0 1.4em; background: var(--bg-elev); }
.cl-head { display: flex; justify-content: space-between; margin-bottom: 8px; }
.cl-bar { height: 6px; background: var(--soft); border-radius: 3px; margin-bottom: 10px; overflow: hidden; }
.cl-bar i { display: block; height: 100%; background: var(--green); }
.cl-item { display: flex; gap: 12px; align-items: flex-start; padding: 8px 4px; color: inherit; text-decoration: none; border-radius: var(--r1); }
.cl-item:hover { background: var(--hover); }
.cl-item small { display: block; color: var(--muted); }
.cl-box { flex: none; width: 20px; height: 20px; border: 2px solid var(--p4); border-radius: 50%; display: grid; place-items: center; font-size: 12px; margin-top: 2px; }
.cl-item.done .cl-box { background: var(--green); border-color: var(--green); color: #0e0e10; font-weight: 700; }
.cl-item.done b { text-decoration: line-through; color: var(--muted); }

@media (max-width: 960px) { .article { grid-template-columns: 1fr; } .toc { display: none; } }
@media (max-width: 820px) { .help-feature-row { grid-template-columns: 1fr; } .art-title { font-size: 26px; } .art-nav { grid-template-columns: 1fr; } }

/* ---------- Tareas: arrastrar, eliminar, vistas ---------- */
.task { position: relative; }
.del { flex: none; align-self: flex-start; margin-top: 1px; width: 24px; height: 24px; border-radius: var(--r1); color: var(--muted); opacity: 0; font-size: 13px; line-height: 1; }
.task:hover .del, .del:focus-visible { opacity: .7; }
.del:hover { opacity: 1 !important; color: var(--late); background: var(--hover); }
@media (hover: none) { .del { opacity: .55; width: 32px; height: 32px; } }
.tblock { display: block; }
.drop { min-height: 6px; }
body.dragging { user-select: none; cursor: grabbing; }
body.dragging .drop { min-height: 40px; }
.ghost { position: fixed; z-index: 100; pointer-events: none; background: var(--bg-elev); border: 1px solid var(--fg); border-radius: var(--r2); opacity: .95; }
.ghost .del { opacity: 0; }
.ph { border: 2px dashed var(--green); border-radius: var(--r2); margin: 2px 0; background: color-mix(in srgb, var(--green) 10%, transparent); }
.drag-src { height: 0 !important; overflow: hidden; visibility: hidden; margin: 0; padding: 0; border: 0; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin: 4px 0 6px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r2); overflow: hidden; }
.seg-btn { padding: 5px 12px; font-size: 13px; color: var(--fg-2); }
.seg-btn:hover { background: var(--hover); }
.seg-btn.on { background: var(--green); color: var(--on-accent); font-weight: 700; }
.sort { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
.sort select { width: auto; padding: 5px 8px; font-size: 13px; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.on { background: var(--green); border-color: var(--green); color: var(--on-accent); font-weight: 700; }

.sec-name { cursor: pointer; }
.sec.collapsed .sec-head { border-bottom-style: dashed; }
.sec.collapsed .sec-name { color: var(--muted); }

/* ---------- Botones sutiles del menu ---------- */
.subtle { display: inline-flex; gap: 2px; }

/* ---------- Repositorio de MDs ---------- */
.md-drop { border: 2px dashed transparent; border-radius: var(--r3); transition: border-color .12s; }
.md-drop.dropping { border-color: var(--green); background: color-mix(in srgb, var(--green) 6%, transparent); }
.md-hint { color: var(--muted); font-size: 13px; margin: -4px 0 14px; }
.md-search { padding: 12px 14px; border-radius: var(--r3); margin-bottom: 14px; }
.md-item { display: block; color: inherit; text-decoration: none; border: 1px solid var(--border); border-radius: var(--r3); padding: 14px 16px; margin-bottom: 10px; background: var(--bg-elev); }
.md-item:hover { border-color: var(--fg); }
.md-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.md-item .meta, .kb-meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.kb-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.kb-snip { color: var(--muted); font-size: 13px; margin: 4px 0 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kb-meta { margin: -4px 0 14px; }
.id-chip { font-family: var(--font-body); font-size: 12px; border: 1px solid var(--border); border-radius: var(--r1); padding: 0 6px; color: var(--fg-2); background: var(--hover); }
button.id-chip { cursor: copy; }
button.id-chip:hover { border-color: var(--fg); }
.doc-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.kb-title-in { font-family: var(--font-display); font-size: 26px; font-weight: 700; border: 0; border-bottom: 2px solid var(--border); border-radius: 0; padding: 6px 0; background: transparent; margin-bottom: 12px; }
.kb-title-in:focus-visible { outline: none; border-bottom-color: var(--green); }
.md-body-in { font-family: var(--font-body); line-height: 1.55; min-height: 420px; resize: vertical; border-radius: var(--r3); font-size: 14px; }
.share-box { border: 1px solid var(--border); border-left: 4px solid var(--green); border-radius: var(--r2); padding: 12px 16px; margin: 0 0 16px; background: var(--bg-elev); display: flex; flex-direction: column; gap: 8px; }
.share-box small { color: var(--muted); }
.share-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
.share-row input { padding: 5px 8px; font-size: 13px; }
.raw { counter-reset: ln; font-size: 13px; line-height: 1.55; white-space: pre; overflow-x: auto; padding-right: 70px; word-break: normal; }
.raw .ln::before { counter-increment: ln; content: counter(ln); display: inline-block; width: 3.2em; margin-right: 1em; text-align: right; color: var(--muted); user-select: none; }
.share-foot { color: var(--muted); font-size: 12px; margin-top: 48px; border-top: 1px solid var(--border); padding-top: 12px; }
@media (max-width: 820px) { .share-row { grid-template-columns: 1fr; } .doc-actions { margin-left: 0; } }

/* ---------- Diagonal de seccion: interruptor que se acuesta al plegar ---------- */
.sec-slash { flex: none; width: 24px; height: 24px; border-radius: var(--r1); background: var(--green); display: grid; place-items: center; align-self: center; margin-right: 2px; transition: background .2s, box-shadow .2s; }
.sec-slash i { display: block; width: 3px; height: 14px; background: var(--on-accent); border-radius: 1px; transform: rotate(25deg); transition: transform .25s cubic-bezier(.3, .7, .3, 1), background .2s; }
.sec-slash:hover { filter: brightness(.93); }
.sec-slash.shut { background: transparent; box-shadow: none; }
.sec-slash.shut i { transform: rotate(90deg); background: var(--fg); }
.sec-note { cursor: pointer; }
.sec-note:hover { background: var(--hover); }
.sec-note .md { line-height: 1.55; font-size: 13px; }
.sec-note .md p, .sec-note .md ul, .sec-note .md ol { margin: 0 0 .4em; }
.sec-note .md > :last-child { margin-bottom: 0; }

/* ---------- Modal de texto ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; }
.modal-scrim { position: absolute; inset: 0; background: rgba(13, 17, 23, .5); }
.modal { position: relative; width: min(640px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--r3); padding: 22px 24px; display: flex; flex-direction: column; gap: 10px; }
.modal h2 { margin: 0; font-family: var(--font-display); font-size: 19px; letter-spacing: -0.01em; }
.modal-label { margin: 0; color: var(--muted); font-size: 13px; }
.modal-input { font-size: 16px; padding: 10px 12px; }
.modal-text { min-height: 260px; font-family: var(--font-body); font-size: 14px; line-height: 1.55; resize: vertical; border-radius: var(--r2); padding: 12px 14px; }
.modal-hint { color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* ---------- Paleta de busqueda (Cmd/Ctrl + K) ---------- */
.search-btn { display: flex; align-items: center; gap: 8px; width: calc(100% - 8px); margin: 0 4px 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r2); background: var(--bg); color: var(--muted); text-align: left; }
.search-btn:hover { border-color: var(--fg); color: var(--fg); }
.search-btn span { flex: 1; }
kbd { font-family: var(--font-body); font-size: .8em; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: var(--r1); padding: 0 6px; background: var(--hover); color: var(--fg-2); }
.pal-wrap { position: fixed; inset: 0; z-index: 80; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.pal-scrim { position: absolute; inset: 0; background: rgba(13, 17, 23, .5); }
.pal { position: relative; width: min(660px, 100%); max-height: min(560px, 76dvh); display: flex; flex-direction: column; background: var(--bg-elev); border: 1px solid var(--fg); border-radius: var(--r3); overflow: hidden; }
.pal-top { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.pal-mag { color: var(--muted); font-size: 18px; }
.pal-input { border: 0; background: transparent; padding: 4px 0; font-size: 16px; border-radius: 0; }
.pal-input:focus-visible { outline: none; }
.pal-list { overflow-y: auto; padding: 6px; }
.pal-group { padding: 10px 10px 4px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: lowercase; }
.pal-group::before { content: '.'; color: var(--fg); }
.pal-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r1); cursor: pointer; }
.pal-item.sel { background: var(--green); color: var(--on-accent); }
.pal-item.sel .pal-sub, .pal-item.sel .pal-ico { color: var(--on-accent); opacity: .8; }
.pal-item.sel mark { background: #0e0e10; color: var(--green); }
.pal-ico { flex: none; width: 18px; text-align: center; color: var(--muted); font-weight: 700; }
.pal-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-sub { color: var(--muted); font-size: 12px; white-space: nowrap; max-width: 45%; overflow: hidden; text-overflow: ellipsis; }
.pal-empty { padding: 28px 10px; text-align: center; color: var(--muted); }
.pal-foot { display: flex; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.pal-foot kbd { margin-right: 2px; }
.topbar-title { flex: 1; }
.top-search { font-size: 20px; line-height: 1; padding: 2px 10px; color: var(--muted); }
@media (max-width: 820px) { .pal-wrap { padding-top: 8vh; } .pal-sub { display: none; } .pal-foot { display: none; } }

.upload-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Cabecera de seccion en pantallas angostas + menu emergente ---------- */
.sec-add-m, .sec-more { display: none; }
.pop { position: fixed; z-index: 90; min-width: 210px; background: var(--bg-elev); border: 1px solid var(--fg); border-radius: var(--r2); padding: 4px; display: flex; flex-direction: column; }
.pop-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--r1); text-align: left; min-height: 40px; }
.pop-item:hover, .pop-item:focus-visible { background: var(--green); color: var(--on-accent); outline: none; }
.pop-item.danger:hover, .pop-item.danger:focus-visible { background: var(--late); color: #0e0e10; }
.pop-ico { flex: none; width: 22px; text-align: center; font-weight: 700; color: var(--muted); }
.pop-item:hover .pop-ico, .pop-item:focus-visible .pop-ico { color: inherit; }
@media (max-width: 820px) {
  .sec-head { align-items: center; gap: 8px; padding-bottom: 8px; }
  .sec-name { flex: 1; line-height: 1.3; }
  .sec-head small { flex: none; }
  .sec-actions { display: none; }
  .sec-add-m, .sec-more { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: var(--r2); font-size: 18px; line-height: 1; color: var(--fg); }
  .sec-add-m:active, .sec-more:active, .sec-more[aria-expanded='true'] { background: var(--green); border-color: var(--green); color: var(--on-accent); }
}

/* Tareas arrastrables desde cualquier parte */
.task.draggable { cursor: grab; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.task.draggable .body, .task.draggable button { cursor: pointer; }
body.dragging .task.draggable, body.dragging .task.draggable .body { cursor: grabbing; }

/* ---------- Modal de nueva tarea ---------- */
.nt { width: min(640px, 100%); }
.nt-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.nt-pane { display: flex; flex-direction: column; gap: 10px; min-height: 190px; }
.nt-quick { font-size: 18px; padding: 14px 16px; border-radius: var(--r3); }
.nt-preview { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 26px; font-size: 13px; }
.nt-help { color: var(--muted); }
.nt-dest { margin-left: auto; color: var(--muted); font-size: 12px; }
.nt-dest b { color: var(--fg); }
.nt-title { font-family: var(--font-display); font-size: 19px; font-weight: 700; border: 0; border-bottom: 2px solid var(--border); border-radius: 0; padding: 6px 0; background: transparent; }
.nt-title:focus-visible { outline: none; border-bottom-color: var(--green); }
.nt-desc { resize: vertical; font-size: 14px; }
.nt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.nt-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.nt-field select, .nt-field input { font-size: 14px; color: var(--fg); }
.nt-actions { align-items: center; justify-content: space-between; flex-wrap: wrap; }
.nt-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 560px) { .nt-grid { grid-template-columns: 1fr; } .nt-actions { flex-direction: column; align-items: stretch; } .nt-btns { justify-content: stretch; } .nt-btns .btn { flex: 1; } }

/* ---------- Crear desde la captura rapida + papelera ---------- */
.chip.newchip { border-style: dashed; border-color: var(--green); color: var(--fg); font-weight: 700; }
.chip.hintchip { border-color: var(--orange); color: var(--fg); }
.trash-row { display: flex; gap: 14px; align-items: center; justify-content: space-between; padding: 12px 6px; border-bottom: 1px solid var(--soft); border-radius: var(--r1); }
.trash-row:hover { background: var(--hover); }
.trash-main { min-width: 0; flex: 1; }
.trash-main .title { word-break: break-word; }
.trash-main .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-top: 4px; font-size: 12px; color: var(--muted); }
.trash-soon { color: var(--late); font-weight: 700; }
.trash-actions { display: flex; gap: 8px; flex: none; }
@media (max-width: 560px) { .trash-row { flex-direction: column; align-items: stretch; } .trash-actions .btn { flex: 1; } }

/* ---------- Plegado inmediato ---------- */
.sec.collapsed .sec-note, .sec.collapsed .sec-empty { display: none; }

/* ---------- Dos personas: menu y pantalla de compartir ---------- */
.nav-tag { font-size: 11px; color: var(--muted); }
.nav.active .nav-tag { color: var(--on-accent); }
.nav .nav-tag { margin-left: auto; }
.nav .nav-tag + .count { margin-left: 8px; }
.h3-actions { display: inline-flex; align-items: center; gap: 2px; }
.h3-link { color: var(--muted); text-decoration: none; font-size: 14px; line-height: 1; padding: 2px 6px; border-radius: var(--r1); }
.h3-link:hover, .h3-link.on { background: var(--hover); color: var(--fg); }
.h3-link.on { background: var(--green); color: var(--on-accent); }
.whoami { display: flex; align-items: center; gap: 6px; padding: 10px 10px 0; font-size: 12px; color: var(--muted); margin-top: auto; }
.whoami + .foot { margin-top: 0; }
.share-sec { margin-top: 28px; }
.share-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.share-head h2 { margin: 0; font-family: var(--font-display); font-size: 18px; }
.share-bulk { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.share-row { display: flex; align-items: center; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--soft); border-radius: var(--r1); }
.share-row:hover { background: var(--hover); }
.share-name { flex: 1; min-width: 0; color: var(--fg); text-decoration: none; font-weight: 700; overflow-wrap: anywhere; }
.share-name:hover { text-decoration: underline; text-decoration-color: var(--green); text-decoration-thickness: 2px; }
.share-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.share-state { font-size: 12px; color: var(--muted); min-width: 130px; text-align: right; }
.share-row.on .share-state { color: var(--fg); font-weight: 700; }
.switch { flex: none; width: 44px; height: 24px; border-radius: 999px; border: 2px solid var(--border); background: var(--bg); position: relative; transition: background .15s, border-color .15s; }
.switch i { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch.on { background: var(--green); border-color: var(--green); }
.switch.on i { transform: translateX(20px); background: var(--on-accent); }
@media (max-width: 560px) { .share-row { flex-wrap: wrap; } .share-state { min-width: 0; text-align: left; flex: 1; } .share-count { order: 3; } }
