/* Base NotaDash (Lora + menta sobre azul petróleo, verde #287a65) con más color: cada plataforma
   tiene su tono e icono, y riesgo/privilegios llevan icono propio. Oscuro por defecto.
   Distribución: explorador en árbol + panel a ancho completo (portada, chuletas, página de manual). */

@font-face { font-family: "Lora"; src: url("/static/fonts/lora.ttf") format("truetype"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Lora"; src: url("/static/fonts/lora-italic.ttf") format("truetype"); font-weight: 400 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/static/fonts/manrope.ttf") format("truetype"); font-weight: 200 800; font-display: swap; }

:root {
  --bg: #0c1218;
  --surface: #101f26;
  --surface-2: #16212b;
  --border: #33414d;
  --border-soft: #1f2c36;
  --text: #e3eae8;
  --text-strong: #ffffff;
  --muted: #8fa3a8;
  --mint: #79ddc3;
  --mint-soft: #77cbb8;
  --primary: #287a65;
  --primary-hover: #2f8f76;
  --primary-text: #ffffff;
  --code-bg: #080d12;
  --code-text: #e3eae8;
  --ph: #f2c46d;
  --ph-missing: #ff8f87;
  --safe: #79ddc3;
  --caution: #f2c46d;
  --dangerous: #ff8f87;
  --focus: #79ddc3;
  /* colores por plataforma */
  --linux: #f5a35c;
  --windows: #5cb4f5;
  --mikrotik: #f2788f;
  --macos: #b8a6f7;
  --radius: .75rem;
  --radius-sm: 9px;
  --page-w: calc(100vw - 48px);
  --tree-w: 260px;
  --serif: "Lora", Georgia, serif;
  --sans: "Avenir Next", Avenir, "Manrope", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --border: #cfdad6;
  --border-soft: #e1e8e5;
  --text: #16242c;
  --text-strong: #0c1218;
  --muted: #5b6e73;
  --mint: #1f7a63;
  --mint-soft: #287a65;
  --code-bg: #0c1218;
  --ph: #b7791f;
  --ph-missing: #c2410c;
  --safe: #1f7a63;
  --caution: #b7791f;
  --dangerous: #c53030;
  --focus: #287a65;
  --linux: #c05d10;
  --windows: #1d6fb8;
  --mikrotik: #c2304f;
  --macos: #6a4fd0;
  color-scheme: light;
}
:root[data-theme="light"] .code, :root[data-theme="light"] .cheat-cmd { --ph: #f2c46d; --ph-missing: #ff8f87; }

/* tono de cada plataforma, reutilizable con .plat-<nombre> */
.plat-linux { --tone: var(--linux); }
.plat-windows { --tone: var(--windows); }
.plat-mikrotik { --tone: var(--mikrotik); }
.plat-macos { --tone: var(--macos); }

* { box-sizing: border-box; }
html, body { margin: 0; }
html { background: var(--bg); }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--mint); text-underline-offset: 3px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: rgba(121, 221, 195, .3); }
.mono { font-family: var(--mono); }
.ic { width: 1em; height: 1em; flex: none; vertical-align: -.125em; }

.eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase;
  color: var(--mint-soft); margin: 0 0 10px;
}
.wrap { width: var(--page-w); margin: 0 auto; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-soft);
}
.topbar-inner { width: var(--page-w); margin: 0 auto; padding: 12px 0; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text-strong); white-space: nowrap; width: calc(var(--tree-w) - 24px); }
.brand svg { color: var(--mint); flex: none; }
.brand-name { font-weight: 600; font-size: 19px; letter-spacing: -.02em; }
.brand-name .dot { color: var(--mint); }
.search { position: relative; flex: 1; max-width: 720px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; padding: 9px 40px 9px 38px;
  font: inherit; font-size: 15px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--mint-soft); box-shadow: 0 0 0 3px rgba(121, 221, 195, .12); }
.search-kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
kbd { font-family: var(--mono); font-size: 12px; color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 0 6px; background: var(--surface); }
.top-actions { display: flex; gap: 6px; align-items: center; margin-left: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none;
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent; color: var(--text);
  white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { border-color: var(--muted); background: var(--surface-2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { border-color: transparent; }
.btn-danger { color: var(--dangerous); border-color: color-mix(in srgb, var(--dangerous) 50%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--dangerous) 12%, transparent); border-color: var(--dangerous); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-icon { padding: 8px; }

/* ---------- distribución: árbol + contenido ---------- */
.layout { display: grid; grid-template-columns: var(--tree-w) minmax(0, 1fr); gap: 36px; align-items: start; }
.layout.side-hidden { grid-template-columns: 34px minmax(0, 1fr); gap: 24px; }
.layout.editing { grid-template-columns: minmax(0, 1fr); }
.layout.editing .tree-pane { display: none; }
.content { min-width: 0; padding: 26px 0 96px; }

.tree-pane {
  position: sticky; top: 62px; max-height: calc(100vh - 62px); overflow-y: auto; scrollbar-width: thin;
  padding: 22px 8px 24px 0; border-right: 1px solid var(--border-soft);
}
.tree-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.tree-head-label { font-family: var(--serif); font-size: 20px; letter-spacing: -.03em; color: var(--text-strong); }
.tree-mobile-toggle { display: none; }
.side-toggle {
  display: grid; place-items: center; width: 30px; height: 30px; cursor: pointer;
  color: var(--muted); background: transparent; border: 1px solid var(--border-soft); border-radius: 8px;
}
.side-toggle:hover { color: var(--mint); border-color: var(--mint-soft); }
.side-hidden .tree-pane { border-right: 0; }
.side-hidden .tree-head-label, .side-hidden .tree-body { display: none; }
.side-hidden .side-toggle svg { transform: scaleX(-1); }

/* filtros con icono y color */
.tree-filters { margin-bottom: 14px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 7px 10px; background: var(--surface); }
.tree-filters > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); }
.tree-filters > summary .ic { color: var(--mint); }
.tree-filters > summary::-webkit-details-marker { display: none; }
.tree-filters > summary::after { content: "›"; margin-left: auto; font-size: 15px; color: var(--muted); transition: transform .15s; }
.tree-filters[open] > summary::after { transform: rotate(90deg); }
.tf-active { display: grid; place-items: center; min-width: 18px; height: 18px; font-size: 11px; font-weight: 700; color: var(--bg); background: var(--mint); border-radius: 999px; padding: 0 5px; }
.tf-group { margin-top: 12px; }
.tf-title { display: block; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.tf-pills { display: flex; flex-wrap: wrap; gap: 5px; }
.tf-pill {
  --c: var(--muted);
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 500; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border-soft); border-radius: 8px; padding: 4px 9px;
}
.tf-pill .ic { color: var(--c); }
.tf-pill:hover { border-color: var(--c); }
.tf-pill[aria-pressed="true"] { border-color: var(--c); background: color-mix(in srgb, var(--c) 22%, transparent); color: var(--text-strong); }
.tone-risk-safe { --c: var(--safe); }
.tone-risk-caution { --c: var(--caution); }
.tone-risk-dangerous { --c: var(--dangerous); }
.tone-sudo-no { --c: var(--safe); }
.tone-sudo-si { --c: var(--caution); }
.tone-sudo-depende { --c: var(--windows); }
.tone-shell-bash, .tone-shell-zsh, .tone-shell-sh { --c: var(--linux); }
.tone-shell-cmd, .tone-shell-powershell { --c: var(--windows); }
.tone-shell-routeros { --c: var(--mikrotik); }
.side-clear { font: inherit; font-size: 12px; color: var(--mint); background: none; border: 0; padding: 10px 0 2px; cursor: pointer; }
.side-clear:hover { text-decoration: underline; }

/* árbol */
.tree { font-family: var(--mono); font-size: 13px; }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul ul { padding-left: 14px; border-left: 1px solid var(--border-soft); margin-left: 8px; }
.tree-root > li + li { margin-top: 4px; }
.tree-dir { display: flex; align-items: center; gap: 2px; border-radius: 6px; }
.tree-caret { width: 18px; flex: none; padding: 0; font: inherit; font-size: 11px; color: var(--muted); background: none; border: 0; cursor: pointer; }
.tree-caret:hover { color: var(--mint); }
.tree-dir a { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; padding: 3px 6px; color: var(--text); text-decoration: none; border-radius: 6px; }
.tree-dir a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-dir a .ic { color: var(--tone, var(--mint)); font-size: 14px; }
.tree-plat a { font-weight: 600; color: var(--tone); }
.tree-dir a:hover { background: var(--surface); }
.tree-dir.current a { background: color-mix(in srgb, var(--tone, var(--primary)) 20%, transparent); color: var(--text-strong); }
.tree-cmd {
  display: flex; align-items: center; gap: 8px; padding: 2px 8px; margin-left: 4px;
  color: var(--muted); text-decoration: none; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tree-cmd .dot { width: 6px; height: 6px; }
.tree-cmd .ic-fav { color: var(--caution); font-size: 11px; margin-left: auto; }
.tree-cmd:hover { color: var(--text); background: var(--surface); }
.tree-cmd.current { color: var(--text-strong); background: color-mix(in srgb, var(--tone, var(--primary)) 20%, transparent); }
.tree-empty { color: var(--muted); font-size: 13px; font-family: var(--sans); }

.side-help { margin-top: 26px; }
.side-title { font-size: 11px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; color: var(--mint-soft); margin: 0 0 6px; }
.side-help ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; color: var(--muted); font-size: 12.5px; }
.side-help li::before { content: "›"; color: var(--mint); margin-right: 7px; }

/* ---------- piezas comunes: etiquetas, iconos de plataforma ---------- */
.tag {
  --c: var(--muted);
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; line-height: 1.8; padding: 0 9px;
  border-radius: 7px; color: var(--text); background: color-mix(in srgb, var(--c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); white-space: nowrap; text-decoration: none;
}
.tag .ic { color: var(--c); }
a.tag:hover { border-color: var(--c); }
.tags { display: inline-flex; flex-wrap: wrap; gap: 5px; }
.tag-plain { background: var(--surface-2); border-color: var(--border-soft); color: var(--muted); }
.tag.plat-linux, .tag.plat-windows, .tag.plat-mikrotik, .tag.plat-macos { --c: var(--tone); }
.risk-safe { --c: var(--safe); } .risk-caution { --c: var(--caution); } .risk-dangerous { --c: var(--dangerous); }
.sudo-no { --c: var(--safe); } .sudo-si { --c: var(--caution); } .sudo-depende { --c: var(--windows); }

.plat-icon {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 11px;
  color: var(--tone, var(--mint)); background: color-mix(in srgb, var(--tone, var(--mint)) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone, var(--mint)) 35%, transparent);
}
.plat-icon .ic { font-size: 20px; }
.plat-icon.big { width: 48px; height: 48px; border-radius: 13px; }
.plat-icon.big .ic { font-size: 24px; }

.cat-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 8px;
  font-size: 13px; color: var(--text); text-decoration: none; background: var(--surface-2); border: 1px solid var(--border-soft);
}
.cat-chip .ic { color: var(--tone, var(--mint)); }
.cat-chip:hover { border-color: var(--tone, var(--mint)); color: var(--text-strong); }

/* ---------- portada ---------- */
.intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; padding: 14px 0 28px; flex-wrap: wrap; }
.intro h1 { font-family: var(--serif); font-weight: 400; font-size: 50px; letter-spacing: -.055em; line-height: 1.04; margin: 0; color: var(--text-strong); }
.intro h1 em { display: block; font-style: italic; color: var(--mint); }
.intro-sub { max-width: 420px; color: var(--muted); margin: 0; }
.plat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.plat-card {
  border-radius: 14px; padding: 18px 20px 20px; background: var(--surface);
  border: 1px solid var(--border-soft); border-top: 3px solid var(--tone);
}
.plat-card-head { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; margin-bottom: 16px; }
.plat-card-head > span:nth-child(2) { flex: 1; min-width: 0; }
.plat-name { display: block; font-family: var(--serif); font-size: 28px; letter-spacing: -.04em; line-height: 1.1; color: var(--text-strong); }
.plat-blurb { display: block; font-size: 13px; color: var(--muted); }
.plat-go { font-size: 20px; color: var(--muted); transition: transform .15s, color .15s; }
.plat-card-head:hover .plat-go { color: var(--tone); transform: translateX(3px); }
.plat-card-head:hover .plat-name { color: var(--tone); }
.plat-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.home-sec { margin-top: 36px; }
.home-sec > h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-family: var(--serif); font-weight: 400; font-size: 24px; letter-spacing: -.04em; color: var(--text-strong); }
.home-sec > h2 .ic { color: var(--caution); font-size: 20px; }
.home-sec:last-of-type > h2 .ic { color: var(--mint); }
.mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.mini-card {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border-soft); border-left: 3px solid var(--tone);
}
.mini-card .ic { color: var(--tone); }
.mini-card:hover { border-color: var(--tone); }
.mini-name { font-family: var(--mono); font-size: 13.5px; color: var(--text-strong); white-space: nowrap; }
.mini-title { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-hint { display: flex; align-items: center; gap: 8px; margin-top: 30px; color: var(--muted); font-size: 14px; }
.home-hint .ic { color: var(--caution); }

/* ---------- chuleta (carpeta y búsqueda) ---------- */
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--mint); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.view-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.view-title { font-family: var(--serif); font-weight: 400; font-size: 40px; letter-spacing: -.05em; line-height: 1.1; margin: 0; color: var(--text-strong); }
.view-title em { font-style: italic; color: var(--tone, var(--mint)); }
.cat-jump { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.cheat-section { margin-top: 36px; }
.cheat-section > h2 { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; font-family: var(--serif); font-weight: 400; font-size: 26px; letter-spacing: -.04em; }
.cheat-section > h2 a { display: inline-flex; align-items: center; gap: 10px; color: var(--text-strong); text-decoration: none; }
.cheat-section > h2 a .ic { color: var(--tone); font-size: 22px; }
.cheat-section > h2 a:hover { color: var(--tone); }
.cheat-section > h2 .mono { font-size: 12px; letter-spacing: 0; color: var(--muted); }
.cheat-section > h2::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border), transparent); align-self: center; }
.cheat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.cheat {
  display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: inherit; min-width: 0;
  padding: 14px 16px 16px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--border-soft); border-top: 3px solid var(--tone, var(--mint));
  transition: border-color .15s, transform .15s;
}
.cheat:hover { border-color: color-mix(in srgb, var(--tone) 60%, var(--border-soft)); transform: translateY(-1px); }
.cheat-head { display: flex; align-items: center; gap: 10px; }
.cheat-name { font-family: var(--mono); font-size: 16px; font-weight: 600; color: var(--tone, var(--mint)); }
.cheat-icons { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.mini { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); }
.mini .ic { font-size: 13px; }
.cheat-title { color: var(--text); font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cheat-cmd {
  display: block; padding: 9px 12px; border-radius: 8px;
  font-family: var(--mono); font-size: 13px; line-height: 1.55; color: var(--ph); background: var(--code-bg);
  white-space: pre-wrap; word-break: break-word;
}
.cheat-opts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; font-size: 13px; }
.cheat-opts code { font-family: var(--mono); color: var(--ph); white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.cheat-opts span { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cheat-more { font-size: 12px; color: var(--tone, var(--mint)); }

.fav-btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font: inherit; font-size: 13px;
  color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 4px;
}
.fav-btn:hover { color: var(--caution); }
.fav-btn[aria-pressed="true"] { color: var(--caution); }
.fav-btn[aria-pressed="true"] .ic { fill: currentColor; }

/* ---------- página de manual ---------- */
.man-head { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 18px; }
.man-head > div { flex: 1; min-width: 0; }
.man h1 { font-family: var(--serif); font-weight: 400; font-size: 42px; letter-spacing: -.05em; line-height: 1.08; margin: 0 0 8px; color: var(--text-strong); }
.man-lead { font-size: 16px; margin: 0; max-width: 100ch; color: var(--text); }
.man-head .fav-btn { border-color: var(--border-soft); padding: 7px 12px; }
.man-cmd .code.main { font-size: 16px; padding: 18px 76px 18px 20px; border-color: color-mix(in srgb, var(--tone) 55%, transparent); }
.man-cmd .prompt { color: var(--tone, var(--mint)); user-select: none; }
.man-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 40px; align-items: start; margin-top: 8px; }
.man-main { min-width: 0; }
.man-sec { padding: 22px 0 6px; border-top: 1px solid var(--border-soft); margin-top: 18px; }
.man-sec:first-child { border-top: 0; margin-top: 0; }
.man-sec > h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--tone, var(--mint)); }
.man-body { min-width: 0; display: grid; gap: 12px; }
.man .opts-title { display: none; }
.man .opts-grid { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
.man-side { position: sticky; top: 84px; display: grid; gap: 14px; padding-top: 22px; }
.facts { margin: 0; display: grid; gap: 10px; padding: 16px 18px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border-soft); }
.fact { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; align-items: center; }
.fact dt { font-size: 12px; color: var(--muted); }
.fact dd { margin: 0; min-width: 0; }
.man-callouts { display: grid; gap: 8px; }
.side-box { padding: 14px 18px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border-soft); }
.side-box h3 { margin: 0 0 8px; font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.related { display: flex; flex-wrap: wrap; gap: 6px 14px; font-family: var(--mono); font-size: 13px; }
.related a { text-decoration: none; color: var(--tone, var(--mint)); }
.related a:hover { text-decoration: underline; }
.page-actions { display: flex; gap: 8px; }
.back { display: inline-flex; margin-bottom: 14px; }

/* ---------- piezas compartidas ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; line-height: 1.7; padding: 0 8px;
  border-radius: 6px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border-soft);
  white-space: nowrap; text-decoration: none;
}
.badge-safe, .badge-caution, .badge-dangerous, .badge-sudo-si, .badge-sudo-depende { background: transparent; border-color: currentColor; }
.badge-safe { color: var(--safe); }
.badge-caution { color: var(--caution); }
.badge-dangerous { color: var(--dangerous); font-weight: 600; }
.badge-sudo-si { color: var(--caution); }
.badge-sudo-depende { color: var(--mint-soft); border-style: dashed; }
.page-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot-safe { background: var(--safe); }
.dot-caution { background: var(--caution); }
.dot-dangerous { background: var(--dangerous); }

.callout { border: 1px solid; border-radius: var(--radius-sm); padding: 10px 14px; font-size: 14px; }
.callout.dangerous { color: var(--dangerous); border-color: color-mix(in srgb, var(--dangerous) 55%, transparent); background: color-mix(in srgb, var(--dangerous) 8%, transparent); }
.callout.caution { color: var(--caution); border-color: color-mix(in srgb, var(--caution) 55%, transparent); background: color-mix(in srgb, var(--caution) 8%, transparent); }
.callout.sudo { color: var(--text); border-color: var(--border); background: var(--surface); }
.callout.sudo strong { color: var(--mint); }

.code {
  position: relative; background: var(--code-bg); color: var(--code-text);
  border-radius: var(--radius-sm); padding: 14px 64px 14px 16px; margin: 0;
  font: 14px/1.65 var(--mono); white-space: pre-wrap; word-break: break-word;
  border: 1px solid var(--border-soft);
}
.code.small { font-size: 13px; padding: 10px 64px 10px 14px; }
.code.main { border-color: color-mix(in srgb, var(--primary) 70%, transparent); }
.code .copy {
  position: absolute; top: 8px; right: 8px;
  font: 500 12px var(--sans); cursor: pointer; padding: 4px 10px; border-radius: 7px;
  background: #16212b; color: #e3eae8; border: 1px solid #33414d;
}
.code .copy:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.prompt { color: var(--mint); user-select: none; }
.ph { color: var(--ph); }
.ph-missing { color: var(--ph-missing); text-decoration: underline dotted; }
.opt { color: #6b7f86; }

.params { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px 16px; }
.param label { display: flex; gap: 8px; align-items: baseline; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.param label code { font-family: var(--mono); color: var(--ph); background: var(--code-bg); padding: 1px 7px; border-radius: 5px; font-weight: 500; }
.param .req { color: var(--dangerous); }
.param .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.param input, .param select {
  width: 100%; font: 14px var(--mono); color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 11px;
}
.param input:focus, .param select:focus { outline: none; border-color: var(--mint-soft); box-shadow: 0 0 0 3px rgba(121, 221, 195, .12); }

.opts { display: grid; gap: 8px; }
.opts-title { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; color: var(--mint-soft); }
.opts-title small { font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); }
.opts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 3px 18px; }
.opt-item {
  display: grid; grid-template-columns: 16px minmax(64px, max-content) minmax(0, 1fr); gap: 10px; align-items: baseline;
  padding: 6px 9px; border-radius: 8px; text-align: left; font: inherit; font-size: 13.5px; color: var(--text);
  background: transparent; border: 1px solid transparent;
}
.opt-item code { grid-column: 2; grid-row: 1; font-family: var(--mono); font-size: 13px; color: var(--ph); white-space: nowrap; }
.opt-item > span:nth-of-type(1) { grid-column: 3; grid-row: 1; color: var(--muted); }
.opt-item .opt-mark { grid-column: 1; grid-row: 1; }
.opt-click { cursor: pointer; }
.opt-click:hover { background: var(--surface-2); border-color: var(--border-soft); }
.opt-click:hover > span:nth-of-type(1) { color: var(--text); }
.opt-mark::before { content: "+"; color: var(--mint); font-family: var(--mono); font-weight: 700; }
.opt-click[aria-pressed="true"] { background: color-mix(in srgb, var(--primary) 22%, transparent); border-color: color-mix(in srgb, var(--primary) 60%, transparent); }
.opt-click[aria-pressed="true"] > span:nth-of-type(1) { color: var(--text); }
.opt-click[aria-pressed="true"] .opt-mark::before { content: "✓"; }

.empty { color: var(--muted); padding: 40px 0; }
.examples { display: grid; gap: 14px; }
.example p { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.notes { white-space: pre-wrap; margin: 0; font-size: 14px; }
.refs { margin: 0; padding-left: 18px; font-size: 13px; }
.refs a { word-break: break-all; }

/* ---------- editor ---------- */
.editor > h1 { font-family: var(--serif); font-weight: 400; font-size: 40px; letter-spacing: -.05em; line-height: 1.1; margin: 0 0 30px; color: var(--text-strong); }
.editor > h1 em { font-style: italic; color: var(--mint); }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 460px); gap: 40px; align-items: start; }
.editor-form { min-width: 0; }
.step { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 0 16px; padding: 24px 0; border-top: 1px solid var(--border-soft); }
.step:first-child { border-top: 0; padding-top: 0; }
.step-head { display: contents; }
.step-n {
  grid-row: span 2; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font: 400 16px var(--serif); color: var(--mint); border: 1px solid color-mix(in srgb, var(--mint) 45%, transparent);
}
.step-head > div { grid-column: 2; }
.step-head h2 { font-family: var(--serif); font-weight: 400; font-size: 22px; letter-spacing: -.03em; margin: 2px 0; color: var(--text-strong); }
.step-head p { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; }
.step-body { grid-column: 2; display: grid; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text); }
.field-hint { font-size: 12px; color: var(--muted); }
.field input, .field textarea, .step-body > textarea, .param-row input, .example-row input, .example-row textarea, .option-row input, .option-row select {
  width: 100%; font: inherit; font-size: 14px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 12px;
}
.field textarea, .step-body > textarea { resize: vertical; }
.field input:focus, .field textarea:focus, .step-body > textarea:focus, .param-row input:focus, .example-row input:focus, .example-row textarea:focus, .option-row input:focus, .option-row select:focus {
  outline: none; border-color: var(--mint-soft); box-shadow: 0 0 0 3px rgba(121, 221, 195, .12);
}
.editor .mono, .option-row input.mono { font-family: var(--mono); }
.editor .command-input { font-family: var(--mono); font-size: 15px; background: var(--code-bg); color: var(--code-text); padding: 14px 16px; }
.muted { color: var(--muted); font-size: 13.5px; margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  font: inherit; font-size: 13.5px; font-weight: 500; color: var(--muted);
  padding: 6px 13px; border-radius: 999px; border: 1px solid var(--border); background: transparent;
}
.pill:hover { color: var(--text); border-color: var(--muted); }
.pill[aria-pressed="true"] { color: var(--text-strong); border-color: var(--primary); background: color-mix(in srgb, var(--primary) 30%, transparent); }
.param-table { display: grid; gap: 6px; }
.param-row { display: grid; grid-template-columns: 130px minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 64px; gap: 8px; align-items: center; }
.param-row input, .option-row input, .option-row select { padding: 7px 10px; font-size: 13.5px; }
.param-head { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.param-name { font-family: var(--mono); font-size: 13px; color: var(--ph); background: var(--code-bg); padding: 6px 9px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; }
.param-req { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.param-req input { width: auto; accent-color: var(--primary); }
.options-edit, .examples-edit { display: grid; gap: 8px; }
.option-row { display: grid; grid-template-columns: 160px minmax(0, 1fr) 190px 32px; gap: 8px; align-items: center; }
.example-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 32px; gap: 8px; align-items: start; }
.example-row textarea { resize: vertical; min-height: 38px; }
.form-error { color: var(--dangerous); white-space: pre-wrap; font-size: 14px; border: 1px solid color-mix(in srgb, var(--dangerous) 50%, transparent); border-radius: var(--radius-sm); padding: 10px 14px; background: color-mix(in srgb, var(--dangerous) 8%, transparent); }
.editor-actions { display: flex; gap: 8px; position: sticky; bottom: 0; padding: 16px 0; background: linear-gradient(transparent, var(--bg) 30%); }
.push-right { margin-left: auto; }
.preview { position: sticky; top: 84px; max-height: calc(100vh - 104px); overflow-y: auto; scrollbar-width: thin; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface); padding: 18px 20px 20px; }
.preview-label { margin: 0 0 14px; display: inline-block; background: var(--bg); padding: 2px 10px; border-radius: 999px; border: 1px solid var(--border-soft); font-size: 11px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; color: var(--mint-soft); }
.preview-body { display: grid; gap: 12px; }
.preview-body h3 { font-family: var(--serif); font-weight: 400; font-size: 26px; letter-spacing: -.04em; line-height: 1.15; margin: 0; color: var(--text-strong); }
.preview-body h3.placeholder { color: var(--muted); font-style: italic; }
.preview-body .eyebrow, .preview-body .page-badges { margin: 0; }
.preview-body .desc { margin: 0; color: var(--text); font-size: 14px; }
.preview-body .params, .preview-body .opts-grid { grid-template-columns: 1fr; }
.preview-id { margin: 0; font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ---------- diálogo / toast ---------- */
dialog {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 28px;
  background: var(--surface); color: var(--text); width: min(400px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(4, 8, 12, .7); }
dialog h2 { font-family: var(--serif); font-weight: 400; font-size: 28px; letter-spacing: -.04em; margin: 0 0 16px; color: var(--text-strong); }
dialog input { width: 100%; font: inherit; font-size: 16px; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
dialog input:focus { outline: none; border-color: var(--mint-soft); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #fff; padding: 9px 18px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35); z-index: 50;
}
.visually-hidden { position: fixed; left: -9999px; top: 0; opacity: 0; }

/* ---------- pantallas medianas ---------- */
@media (max-width: 1280px) {
  .cheat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor-grid { grid-template-columns: 1fr; }
  .preview { position: static; max-height: none; order: -1; }
  .man-grid { grid-template-columns: 1fr; }
  .man-side { position: static; padding-top: 0; }
}

/* ---------- móvil ---------- */
@media (max-width: 860px) {
  :root { --page-w: calc(100vw - 32px); }
  .topbar-inner { flex-wrap: wrap; gap: 10px; }
  .brand { width: auto; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .search-kbd { display: none; }

  .layout, .layout.side-hidden { display: block; }
  .tree-pane { position: static; max-height: none; overflow: visible; border-right: 0; padding: 12px 0 0; }
  .tree-head { margin-bottom: 0; }
  .tree-head-label, .side-toggle, .side-help { display: none; }
  .tree-mobile-toggle {
    display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
    font: inherit; font-size: 14px; font-weight: 600; color: var(--text); background: transparent;
    padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border);
  }
  .tree-mobile-toggle::before { content: "▸"; color: var(--mint); font-family: var(--mono); }
  .tree-mobile-toggle[aria-expanded="true"]::before { content: "▾"; }
  .tree-body, .side-hidden .tree-body { display: none; }
  .tree-open .tree-body { display: block; padding: 12px 0 4px; border-bottom: 1px solid var(--border-soft); }
  .content { padding-top: 18px; }

  .intro h1 { font-size: 36px; }
  .view-title, .man h1, .editor > h1 { font-size: 30px; }
  .plat-grid, .cheat-grid, .mini-grid, .man .opts-grid, .opts-grid { grid-template-columns: 1fr; }
  .man-head { flex-wrap: wrap; }
  .man-head .plat-icon { display: none; }
  .step { grid-template-columns: 1fr; }
  .step-n { display: none; }
  .step-head > div, .step-body { grid-column: 1; }
  .param-head { display: none; }
  .param-row { grid-template-columns: 1fr 1fr; padding: 10px; border: 1px dashed var(--border); border-radius: var(--radius-sm); }
  .param-name, .param-row > input:nth-of-type(1) { grid-column: 1 / -1; }
  .option-row { grid-template-columns: 1fr 32px; }
  .option-row input:nth-child(2), .option-row select { grid-column: 1; }
  .example-row { grid-template-columns: 1fr 32px; }
  .example-row textarea { grid-column: 1; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
