/* Codebase Intelligence / Lupa · diseño «Observatorio»
   Superficies planas por capas, líneas finas, un acento de señal y ámbar solo para lo inferido
   y los avisos. Geist (interfaz) y Geist Mono (código) van incluidas: funciona sin conexión. */

@font-face { font-family: 'Geist'; src: url('fonts/geist.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('fonts/geist-mono.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }

:root,
[data-theme='dark'] {
  --bg: #0A0E15;
  --surface: #0E131C;
  --panel: #131A25;
  --panel-2: #19212F;
  --line: #222B3A;
  --line-2: #303B50;
  --text: #E8EDF5;
  --text-2: #A9B4C7;
  --muted: #7F8BA3;
  --accent: #5CB8FF;
  --accent-ink: #03111E;
  --accent-soft: rgba(92, 184, 255, 0.12);
  --amber: #F2B84B;
  --amber-soft: rgba(242, 184, 75, 0.12);
  --ok: #3FD08F;
  --ok-soft: rgba(63, 208, 143, 0.12);
  --err: #FF7A7A;
  --err-soft: rgba(255, 122, 122, 0.12);
  --code: #0B1018;
  --hl: rgba(242, 184, 75, 0.14);
  --kw: #C69CFF;
  --str: #9FE0A0;
  --num: #FFB27A;
  --fn: #7CC4FF;
  --com: #7A879F;
  --type: #F2CF7A;
  --prop: #8FD0E8;
  --overlay: rgba(2, 4, 10, 0.62);
  --pop-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

[data-theme='light'] {
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --panel: #FFFFFF;
  --panel-2: #EEF1F5;
  --line: #E1E5EC;
  --line-2: #CBD2DD;
  --text: #121826;
  --text-2: #3E4A60;
  --muted: #5E6A80;
  --accent: #0B6BD3;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(11, 107, 211, 0.09);
  --amber: #9A5B00;
  --amber-soft: rgba(214, 140, 20, 0.12);
  --ok: #0E7A4A;
  --ok-soft: rgba(14, 122, 74, 0.10);
  --err: #C4314B;
  --err-soft: rgba(196, 49, 75, 0.09);
  --code: #FAFBFC;
  --hl: rgba(255, 196, 0, 0.20);
  --kw: #7A3FE0;
  --str: #12804A;
  --num: #B4500F;
  --fn: #1557C0;
  --com: #6A7489;
  --type: #8A5A00;
  --prop: #0E6A86;
  --overlay: rgba(18, 24, 38, 0.38);
  --pop-shadow: 0 24px 60px rgba(20, 30, 60, 0.18);
}

[data-theme='ocean'] {
  --bg: #04161F;
  --surface: #061F2B;
  --panel: #0A2A3A;
  --panel-2: #0E3446;
  --line: #15445A;
  --line-2: #1D5770;
  --text: #E3F4F8;
  --text-2: #A6CBD6;
  --muted: #7FA9B7;
  --accent: #3FD5C8;
  --accent-ink: #022320;
  --accent-soft: rgba(63, 213, 200, 0.13);
  --amber: #FFD166;
  --amber-soft: rgba(255, 209, 102, 0.13);
  --ok: #5EF2B0;
  --ok-soft: rgba(94, 242, 176, 0.12);
  --err: #FF8A96;
  --err-soft: rgba(255, 138, 150, 0.12);
  --code: #031822;
  --hl: rgba(255, 209, 102, 0.16);
  --kw: #8FD7FF;
  --str: #A3F7BF;
  --num: #FFD166;
  --fn: #6EC9F0;
  --com: #7AA4B3;
  --type: #FFC266;
  --prop: #9DE3F0;
  --overlay: rgba(1, 10, 16, 0.62);
  --pop-shadow: 0 24px 60px rgba(0, 10, 20, 0.5);
}

/* nombres antiguos que aún usan algunos componentes */
:root, [data-theme] {
  --border: var(--line);
  --border-strong: var(--line-2);
  --warn: var(--amber);
  --sel: var(--accent-soft);
  --code-bg: var(--code);
  --hl-line: var(--hl);
  --panel-solid: var(--panel);
  --accent-2: var(--accent);
  --accent-3: var(--accent);
  --tok-kw: var(--kw);
  --tok-str: var(--str);
  --tok-num: var(--num);
  --tok-com: var(--com);
  --tok-fn: var(--fn);
  --tok-type: var(--type);
  --tok-prop: var(--prop);
  --glow: none;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body {
  font-family: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg);
  overflow: hidden; -webkit-font-smoothing: antialiased;
}
code, pre, .mono, kbd { font-family: 'Geist Mono', 'Cascadia Code', Consolas, monospace; }
::selection { background: var(--accent-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
a { color: var(--accent); cursor: pointer; text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, h4 { letter-spacing: -0.2px; }

/* ---------- estructura */
.app { display: grid; grid-template-columns: 228px 1fr; grid-template-rows: 56px 1fr; height: 100vh; }
.topbar {
  grid-column: 1 / 3; display: flex; align-items: center; gap: 14px; padding: 0 20px; z-index: 5;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; white-space: nowrap; }
.brand .logo { width: 22px; height: 22px; color: var(--accent); flex: none; }
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; letter-spacing: 0.2px; }
.topbar .divider { width: 1px; height: 22px; background: var(--line); }
.topbar .spacer { flex: 1; }
.topbar .trust { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.topbar .trust svg { color: var(--ok); }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 13px; border: 0; cursor: pointer; padding: 0; }
.sidebar { display: flex; flex-direction: column; justify-content: space-between; padding: 14px 10px; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
.nav-main, .nav-low { display: flex; flex-direction: column; gap: 2px; }
.nav-low { border-top: 1px solid var(--line); padding-top: 10px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; min-height: 40px; padding: 0 12px; border-radius: 9px;
  color: var(--text-2); cursor: pointer; user-select: none; font-size: 14px; transition: background 0.12s, color 0.12s;
}
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--panel-2); color: var(--text); font-weight: 500; }
.nav-item.active svg { color: var(--accent); }
.nav-item.disabled { opacity: 0.4; pointer-events: none; }
.main { position: relative; overflow: hidden; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.view { position: relative; flex: 1; overflow: auto; padding: 28px 40px 40px; min-height: 0; }
.view.full { padding: 0; overflow: hidden; }
.view-title { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 20px; }
.view-title h1 { font-size: 24px; margin: 0; font-weight: 600; }
.view-title .sub { color: var(--text-2); font-size: 13px; }
.theme-toggle { display: flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.theme-toggle button { width: 34px; height: 30px; min-height: 30px; padding: 0; justify-content: center; border: 0; border-radius: 7px; background: transparent; color: var(--muted); }
.theme-toggle button.primary { background: var(--panel-2); color: var(--text); box-shadow: none; }

/* ---------- componentes */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.panel.pad { padding: 20px 22px; }
.panel h3 { margin: 0 0 12px; font-size: 15px; color: var(--text); font-weight: 600; }
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.stat { padding: 16px 18px; }
.stat .v { font-size: 26px; font-weight: 600; }
.stat .l { color: var(--text-2); font-size: 12.5px; }
.stat .v.acc { color: var(--accent); }

button, .btn {
  font: inherit; color: var(--text); background: transparent; border: 1px solid var(--line-2); border-radius: 9px;
  min-height: 38px; padding: 0 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  transition: border-color 0.12s, background 0.12s;
}
button:hover:not(:disabled) { background: var(--panel-2); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); }
button.danger { color: var(--err); }
button.danger-solid { background: var(--err); color: #fff; border-color: transparent; font-weight: 600; }
button.ghost { border-color: transparent; color: var(--text-2); }
button.ghost:hover:not(:disabled) { color: var(--text); }
button.sm { min-height: 32px; padding: 0 10px; font-size: 12.5px; }
button.big { min-height: 46px; padding: 0 20px; font-size: 15px; border-radius: 11px; }
button svg { width: 15px; height: 15px; flex: none; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 9px;
  min-height: 38px; padding: 0 11px; outline: none;
}
textarea { padding: 9px 11px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type='checkbox'] { min-height: 0; width: 16px; height: 16px; accent-color: var(--accent); }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--line); color: var(--text-2); background: var(--panel-2); white-space: nowrap;
}
.chip.click { cursor: pointer; }
.chip.click:hover { border-color: var(--accent); color: var(--text); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: transparent; color: var(--amber); border: 1px dashed var(--amber); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.info { background: var(--accent-soft); color: var(--accent); }
.badge.src { background: transparent; color: var(--text-2); border: 1px solid var(--line-2); font-weight: 500; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.empty { text-align: center; color: var(--text-2); padding: 48px 24px; }
.empty h2 { color: var(--text); font-weight: 600; font-size: 18px; margin: 0 0 6px; }
.empty p { margin: 0 auto 16px; max-width: 520px; }
.error-box { border: 1px solid var(--err); background: var(--err-soft); color: var(--text); padding: 12px 14px; border-radius: 10px; white-space: pre-wrap; }
.warn-box { border: 1px solid var(--amber); background: var(--amber-soft); color: var(--text); padding: 12px 14px; border-radius: 10px; white-space: pre-wrap; }
.ok-box { border: 1px solid var(--ok); background: var(--ok-soft); color: var(--text); padding: 12px 14px; border-radius: 10px; }
.web-note { margin: 14px 40px 0; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text-2); font-size: 13px; }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11.5px; letter-spacing: 0.4px; text-transform: uppercase; padding: 10px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; }
table.data td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: var(--panel-2); }
.table-wrap { overflow: auto; max-height: 460px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
pre.sql, pre.snippet { margin: 8px 0 0; padding: 10px 14px; background: var(--code); border: 1px solid var(--line); border-radius: 10px; overflow: auto; font-size: 12.5px; line-height: 1.65; color: var(--text-2); white-space: pre-wrap; word-break: break-word; max-height: 280px; }
.progress { height: 4px; background: var(--panel-2); border-radius: 9px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); transition: width 0.2s; }
.kbd { font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-2); color: var(--muted); }
.toast { position: fixed; bottom: 20px; right: 20px; z-index: 150; max-width: 460px; box-shadow: var(--pop-shadow); }
.tabs { display: flex; align-items: center; gap: 4px; padding: 0 40px; border-bottom: 1px solid var(--line); }
.tab { background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; min-height: 44px; padding: 0 14px; color: var(--text-2); gap: 8px; }
.tab:hover:not(:disabled) { background: transparent; color: var(--text); }
.tab.active { color: var(--text); font-weight: 500; border-bottom-color: var(--accent); }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--panel-2); }
.segmented button { border: 0; min-height: 32px; border-radius: 8px; color: var(--text-2); }
.segmented button.on { background: var(--panel); color: var(--text); font-weight: 500; }

/* ---------- selector de proyectos */
.switcher { position: relative; display: flex; align-items: center; gap: 12px; }
.switcher-btn {
  display: flex; align-items: center; gap: 10px; min-height: 40px; min-width: 240px; max-width: 460px; padding: 0 12px;
  border-radius: 10px; background: var(--panel); border: 1px solid var(--line); color: var(--text); font-size: 14px;
}
.switcher-btn:hover:not(:disabled) { background: var(--panel); border-color: var(--line-2); }
.switcher-btn.open { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.switcher-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; flex: 1; }
.switcher-btn > svg:last-child { color: var(--muted); transition: transform 0.15s; }
.switcher-btn.open > svg:last-child { transform: rotate(180deg); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.35; } 100% { opacity: 1; } }
.switcher-progress { display: flex; flex-direction: column; gap: 4px; width: 220px; font-size: 12px; color: var(--muted); }
.switcher-menu {
  position: absolute; top: calc(100% + 8px); left: 0; width: 560px; max-width: calc(100vw - 40px); z-index: 40; padding: 8px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--pop-shadow); animation: drop 0.12s ease-out;
}
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.switcher-list { max-height: 60vh; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.switcher-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.switcher-item:hover { background: var(--panel-2); }
.switcher-item.active { background: var(--accent-soft); }
.switcher-item .icon-box { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 9px; background: var(--panel-2); color: var(--text-2); }
.switcher-item.active .icon-box { background: var(--panel); color: var(--accent); }
.switcher-item-main { flex: 1; min-width: 0; }
.switcher-item-name { font-weight: 600; }
.switcher-item-sub { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-item-actions { display: flex; gap: 2px; }
.switcher-item-actions button { width: 36px; min-height: 36px; padding: 0; justify-content: center; border: 0; color: var(--text-2); }
.switcher-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 6px 4px; border-top: 1px solid var(--line); margin-top: 6px; }
.switcher-foot .muted { margin-left: auto; font-size: 12px; }

/* ---------- inicio */
.welcome { display: flex; flex-direction: column; gap: 36px; }
.welcome-hero { text-align: center; padding: 64px 20px 8px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.welcome-hero h1 { font-size: 34px; margin: 0; letter-spacing: -0.6px; font-weight: 600; }
.welcome-hero p { max-width: 640px; color: var(--text-2); font-size: 16px; line-height: 1.55; margin: 0 0 10px; }
.welcome-orb { width: 52px; height: 52px; color: var(--accent); }
.welcome-recent { max-width: 1120px; width: 100%; margin: 0 auto; }
.welcome-recent h3 { color: var(--muted); font-size: 12px; letter-spacing: 0.4px; text-transform: uppercase; margin: 0 0 12px; }
.project-card { padding: 18px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.project-card:hover { border-color: var(--line-2); background: var(--panel-2); }
.project-card.active { border-color: var(--accent); }
.project-card .name { font-size: 15px; font-weight: 600; }
.project-card .path { font-size: 12px; color: var(--muted); word-break: break-all; }

/* ---------- código */
.split { display: grid; grid-template-columns: 280px 1fr; height: 100%; min-height: 0; }
.split.three { grid-template-columns: 270px 1fr 260px; }
.pane { overflow: auto; border-right: 1px solid var(--line); min-height: 0; background: var(--surface); }
.pane:last-child { border-right: none; border-left: 1px solid var(--line); }
.tree { padding: 8px; font-size: 13px; font-family: 'Geist Mono', Consolas, monospace; }
.tree-row { display: flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 8px; border-radius: 7px; cursor: pointer; white-space: nowrap; color: var(--text-2); }
.tree-row:hover { background: var(--panel-2); color: var(--text); }
.tree-row.sel { background: var(--accent-soft); color: var(--text); }
.tree-row .twist { width: 12px; color: var(--muted); font-size: 10px; flex: none; }
.tree-row svg { flex: none; }
.tree-row > span:nth-child(3) { overflow: hidden; text-overflow: ellipsis; }
.tree-row .count { margin-left: auto; color: var(--muted); font-size: 11px; }
.outline-row { display: flex; gap: 8px; align-items: baseline; min-height: 28px; padding: 4px 12px; cursor: pointer; font-size: 12.5px; color: var(--text-2); border-radius: 7px; margin: 0 6px; }
.outline-row:hover { background: var(--panel-2); color: var(--text); }
.kind { font-family: 'Geist Mono', Consolas, monospace; font-size: 10px; padding: 0 5px; border-radius: 4px; border: 1px solid var(--line-2); color: var(--muted); text-transform: uppercase; }
.code-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--panel); font-size: 13px; }
.code-wrap { height: calc(100% - 57px); overflow: hidden; }
.cm-editor { height: 100%; background: var(--code) !important; font-size: 13px; }
.cm-editor .cm-scroller { font-family: 'Geist Mono', 'Cascadia Code', Consolas, monospace; line-height: 1.7; }
.cm-hl-line { background: var(--hl) !important; box-shadow: inset 3px 0 0 var(--amber); }

/* ---------- preguntar */
.ask-layout { display: grid; grid-template-rows: 1fr auto; height: 100%; min-height: 0; }
.ask-stream { overflow: auto; padding: 32px 40px 28px; display: flex; flex-direction: column; gap: 40px; }
.ask-stream > * { width: 100%; max-width: 1120px; margin: 0 auto; }
.ask-input { padding: 14px 40px 20px; border-top: 1px solid var(--line); background: var(--surface); }
.ask-input > * { max-width: 1120px; margin-left: auto; margin-right: auto; }
.ask-box { display: flex; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; padding: 6px 6px 6px 16px; }
.ask-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ask-box svg { color: var(--muted); }
.ask-box input { flex: 1; border: none; background: transparent; font-size: 15px; box-shadow: none !important; padding: 0; }
.ask-hint { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--muted); }

.qa { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.qa-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.qa-rail { flex: 1 1 260px; max-width: 320px; display: flex; flex-direction: column; gap: 16px; }
.q-head { display: flex; flex-direction: column; gap: 10px; }
.q-head .eyebrow { font-size: 12px; color: var(--muted); letter-spacing: 0.4px; text-transform: uppercase; }
.q-head h1 { margin: 0; font-size: 26px; line-height: 1.25; font-weight: 600; }
.q-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.q-meta .sep { color: var(--line-2); }
.answer { padding: 22px 24px; display: flex; flex-direction: column; gap: 18px; }
.answer .lead { margin: 0; font-size: 15px; }
.answer .block { display: flex; flex-direction: column; gap: 10px; }
.answer .block h2 { margin: 0; font-size: 13px; font-weight: 600; color: var(--text-2); }
.answer ul.plain { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.finding { display: flex; gap: 14px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--panel-2); }
.sev { flex: none; min-width: 104px; text-align: center; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; }
.sev-5, .sev-4 { background: var(--err-soft); color: var(--err); }
.sev-3 { background: var(--amber-soft); color: var(--amber); }
.sev-2, .sev-1 { background: var(--accent-soft); color: var(--accent); }
.check-row { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); }
.check-row svg { flex: none; margin-top: 3px; color: var(--ok); }
.answer ol.next { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); }
.answer .notfound { color: var(--text-2); }
.card-section { padding: 0; overflow: hidden; }
.card-section > summary { list-style: none; cursor: pointer; }
.card-section > summary::-webkit-details-marker { display: none; }
.card-section header { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); color: var(--text-2); }
.card-section:not([open]) header { border-bottom: 0; }
.card-section header svg { transition: transform 0.12s; }
.card-section:not([open]) header svg { transform: rotate(-90deg); }
.card-section header h2 { margin: 0; font-size: 15px; font-weight: 600; flex: 1; color: var(--text); }
.card-section header .count { font-size: 12px; color: var(--muted); }
.card-section > .body { padding: 14px 20px; display: flex; flex-direction: column; gap: 8px; }
.card-section .more { width: 100%; min-height: 44px; border: 0; border-top: 1px solid var(--line); border-radius: 0; justify-content: center; color: var(--text-2); }
.ev { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ev:last-child { border-bottom: 0; }
.ev .ic { color: var(--text-2); padding-top: 2px; }
.ev .ic svg { width: 16px; height: 16px; }
.ev .lbl { font-weight: 500; word-break: break-word; }
.ev .det { color: var(--text-2); font-size: 12.5px; }
.ev .loc { font-size: 12.5px; }
.ev .loc a { font-family: 'Geist Mono', Consolas, monospace; }
.ev .badges { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }
.flow { display: flex; flex-direction: column; gap: 0; }
.flow-step { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding-bottom: 12px; }
.flow-step::before { content: ''; position: absolute; left: 16px; top: 34px; bottom: 0; width: 2px; background: var(--line-2); }
.flow-step:last-child::before { display: none; }
.flow-step .node { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--accent); z-index: 1; }
.flow-step .node svg { width: 16px; height: 16px; }
.flow-step .body { padding: 8px 14px 10px; border-radius: 10px; background: var(--panel-2); min-width: 0; }
.flow-step .layer { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.flow-step .via { font-size: 12px; color: var(--muted); margin: 2px 0; }
.flow-step .via.inf { color: var(--amber); }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; }
.rail-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.rail-card h2 { margin: 0; font-size: 13px; font-weight: 600; color: var(--text-2); }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { text-align: right; }
.src-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; text-align: center; }
.src-grid div { padding: 10px 4px; border-radius: 10px; background: var(--panel-2); }
.src-grid b { display: block; font-size: 20px; font-weight: 600; }
.src-grid span { font-size: 11.5px; color: var(--muted); }
.legend-row { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--text-2); }
.next-q { justify-content: flex-start; text-align: left; width: 100%; min-height: 44px; height: auto; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); line-height: 1.35; }
.next-q:hover:not(:disabled) { border-color: var(--accent); background: var(--panel-2); }
.ask-empty { padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.ask-empty h2 { margin: 0; font-size: 20px; font-weight: 600; }
.ask-empty p { margin: 0; color: var(--text-2); max-width: 720px; }

/* ---------- galaxia */
.galaxy { position: absolute; inset: 0; background: radial-gradient(ellipse 60% 55% at 50% 50%, #0F1A3A 0%, #070B1A 55%, #04060C 100%); cursor: grab; }
[data-theme='light'] .galaxy { background: radial-gradient(ellipse 60% 55% at 50% 50%, #18234F 0%, #0A1030 55%, #070B18 100%); }
[data-theme='ocean'] .galaxy { background: radial-gradient(ellipse 60% 55% at 50% 50%, #08406A 0%, #032340 55%, #010B16 100%); }
.galaxy-hud { position: absolute; top: 20px; left: 20px; z-index: 3; display: flex; flex-direction: column; gap: 10px; width: 300px; }
.galaxy-info { position: absolute; top: 20px; right: 20px; z-index: 3; width: 350px; max-height: calc(100% - 40px); display: flex; }
.galaxy-legend { position: absolute; bottom: 16px; left: 20px; z-index: 3; display: flex; gap: 8px; flex-wrap: wrap; max-width: calc(100% - 420px); }
.hud-card {
  background: rgba(6, 10, 26, 0.72); border: 1px solid rgba(140, 170, 255, 0.18); border-radius: 14px; padding: 16px; color: #E6ECFF;
  backdrop-filter: blur(14px); display: flex; flex-direction: column; gap: 12px;
}
.galaxy-info .hud-card { overflow: hidden; background: rgba(6, 10, 26, 0.8); }
.hud-card button { color: #E6ECFF; border-color: rgba(140, 170, 255, 0.28); }
.hud-card button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.06); }
.hud-card button.primary { background: #5CB8FF; color: #03111E; border-color: transparent; }
.hud-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.hud-sub { font-size: 12px; color: rgba(214, 224, 255, 0.7); }
.hud-hint { font-size: 11.5px; color: rgba(214, 224, 255, 0.55); }
.hud-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.hud-search { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(140, 170, 255, 0.18); color: rgba(214, 224, 255, 0.6); }
.hud-search input { flex: 1; min-height: 0; border: none; background: transparent; color: #E6ECFF; padding: 0; box-shadow: none !important; font-size: 13px; }
.hud-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 10px; border-radius: 999px; font-size: 12px; cursor: pointer; user-select: none;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(140, 170, 255, 0.28); color: #DDE6FF;
}
.hud-chip:hover { border-color: rgba(140, 200, 255, 0.55); }
.hud-chip.on { background: rgba(92, 184, 255, 0.2); border-color: rgba(92, 184, 255, 0.6); color: #FFFFFF; }
.hud-chip.off { opacity: 0.4; }
.hud-chip.static { cursor: default; }
.related { display: flex; flex-direction: column; gap: 2px; overflow: auto; max-height: 40vh; border-top: 1px solid rgba(140, 170, 255, 0.15); padding-top: 8px; }
.related-item { display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 6px; border-radius: 8px; cursor: pointer; font-size: 12.5px; }
.related-item:hover { background: rgba(255, 255, 255, 0.06); }
.related-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #DFE7FF; }
.scene-tooltip { display: flex; flex-direction: column; gap: 2px; font-family: 'Geist', sans-serif; font-size: 12.5px; background: rgba(4, 7, 20, 0.92); color: #E6ECFF; padding: 8px 11px; border-radius: 10px; border: 1px solid rgba(140, 170, 255, 0.3); }
.scene-tooltip span { color: rgba(214, 224, 255, 0.7); font-size: 11.5px; font-family: 'Geist Mono', monospace; }

/* ---------- base de datos */
.db-view { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.db-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 28px 40px 16px; }
.db-head h1 { margin: 0; font-size: 24px; font-weight: 600; flex: 1; }
.db-head .sub { color: var(--text-2); font-size: 13px; }
.db-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
.db-body > .view { overflow: visible; }
.conn-layout { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-start; }
.conn-cards { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.conn-side { flex: 1 1 280px; max-width: 360px; display: flex; flex-direction: column; gap: 16px; }
.conn-card { overflow: hidden; }
.conn-card.sel { border-color: var(--accent); }
.conn-card .conn-top { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.conn-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.conn-title .icon-box { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--panel-2); color: var(--accent); flex: none; }
.conn-title .names { display: flex; flex-direction: column; gap: 1px; flex: 1 1 220px; min-width: 0; }
.conn-title h2 { margin: 0; font-size: 17px; font-weight: 600; }
.conn-title .line1 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.conn-title .where { font-family: 'Geist Mono', Consolas, monospace; font-size: 12.5px; color: var(--muted); word-break: break-all; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.status.on { color: var(--ok); }
.status.off { color: var(--muted); }
.status .dot { background: currentColor; }
.engine-tag { font-size: 11.5px; padding: 2px 8px; border-radius: 6px; background: var(--panel-2); color: var(--text-2); white-space: nowrap; }
.prot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.prot > span:first-child { font-size: 12px; color: var(--muted); margin-right: 4px; }
.prot-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-size: 12px; }
.prot-chip svg { width: 12px; height: 12px; }
.priv { margin: 0 22px 20px; border: 1px solid var(--amber); border-radius: 12px; background: var(--amber-soft); overflow: hidden; }
.priv-head { padding: 16px 18px; display: flex; gap: 12px; align-items: flex-start; }
.priv-head > svg { flex: none; color: var(--amber); width: 20px; height: 20px; margin-top: 1px; }
.priv-head h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; color: var(--text); }
.priv-head p { margin: 0; color: var(--text-2); }
.priv-groups { padding: 0 18px 16px 50px; display: flex; flex-direction: column; gap: 10px; }
.priv-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.priv-group > span:first-child { width: 160px; font-size: 12.5px; color: var(--text-2); }
.priv-group code { padding: 2px 8px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); font-size: 12px; }
.priv-group .more { font-size: 12px; color: var(--muted); }
.priv details { border-top: 1px solid var(--line); padding-top: 8px; }
.priv summary { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; color: var(--text-2); font-size: 13px; cursor: pointer; list-style: none; }
.priv summary::-webkit-details-marker { display: none; }
.priv summary svg { transition: transform 0.12s; }
.priv details[open] summary svg { transform: rotate(90deg); }
.priv details pre { margin: 8px 0 0; padding: 10px 12px; max-height: 160px; overflow: auto; white-space: pre-wrap; word-break: break-word; border-radius: 8px; background: var(--code); border: 1px solid var(--line); font-size: 11.5px; color: var(--text-2); }
.priv-fix { padding: 16px 18px 18px; background: var(--panel); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.priv-fix h3 { margin: 0; font-size: 14px; font-weight: 600; }
.priv-fix ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; color: var(--text-2); }
.copy-block { margin-top: 8px; display: flex; gap: 8px; align-items: flex-start; padding: 10px 10px 10px 14px; border-radius: 10px; background: var(--code); border: 1px solid var(--line); }
.copy-block pre { margin: 0; flex: 1; min-width: 0; white-space: pre-wrap; word-break: break-word; font-size: 12.5px; line-height: 1.7; color: var(--text); }
.copy-block button { flex: none; }
.conn-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); }
.layer-row { display: flex; gap: 10px; align-items: flex-start; }
.layer-row .mark { flex: none; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; }
.layer-row .mark.ok { background: var(--ok-soft); color: var(--ok); }
.layer-row .mark.warn { background: var(--amber-soft); color: var(--amber); }
.layer-row .mark.idle { background: var(--panel-2); color: var(--muted); }
.layer-row .mark svg { width: 12px; height: 12px; }
.layer-row b { display: block; font-weight: 500; }
.layer-row span { font-size: 12.5px; color: var(--text-2); }
.detected { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px dashed var(--line-2); border-radius: 10px; }
.detected-main { flex: 1; min-width: 0; overflow: hidden; }
.table-list { padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.table-item { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 10px; border-radius: 8px; cursor: pointer; color: var(--text-2); font-size: 13px; font-family: 'Geist Mono', Consolas, monospace; }
.table-item:hover { background: var(--panel-2); color: var(--text); }
.table-item.sel { background: var(--accent-soft); color: var(--text); }
.console-editor { height: 200px; border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; }

/* ---------- web: acceso, subida y ventanas propias */
.login-page { min-height: 100vh; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 64px; padding: 48px 32px; overflow: auto; }
.login-intro { flex: 1 1 380px; max-width: 520px; display: flex; flex-direction: column; gap: 20px; }
.login-intro .mark { display: flex; align-items: center; gap: 12px; font-size: 28px; font-weight: 600; }
.login-intro .mark svg { color: var(--accent); }
.login-intro h1 { margin: 0; font-size: 34px; line-height: 1.15; letter-spacing: -0.6px; font-weight: 600; }
.login-intro p { margin: 0; font-size: 16px; color: var(--text-2); }
.login-intro ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; color: var(--text-2); }
.login-intro li { display: flex; gap: 10px; }
.login-intro li svg { flex: none; color: var(--ok); margin-top: 3px; }
.login-card { flex: 0 1 400px; padding: 30px 28px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--pop-shadow); }
.login-card h2 { margin: 0; font-size: 20px; font-weight: 600; }
.login-card input { min-height: 44px; font-size: 15px; }
.login-card p { margin: 0; }
.upload-overlay, .dlg-backdrop { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; background: var(--overlay); backdrop-filter: blur(4px); animation: fade 0.12s ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.upload-card, .dlg-card {
  width: min(560px, calc(100% - 32px)); padding: 26px 28px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line-2);
  box-shadow: var(--pop-shadow); display: flex; flex-direction: column; gap: 14px; animation: drop 0.14s ease-out;
}
.dlg-card { width: min(460px, calc(100% - 32px)); padding: 22px 24px; }
.upload-card h2, .dlg-card h2 { margin: 0; font-size: 19px; font-weight: 600; }
.upload-card p, .dlg-card p { margin: 0; }
.dlg-card p { color: var(--text-2); line-height: 1.5; }
.upload-summary { color: var(--text-2); }
.upload-step { font-size: 13px; min-height: 20px; }
.upload-note { font-size: 12px; color: var(--muted); }
.upload-card .progress { height: 8px; }
.upload-actions, .dlg-actions { display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.drop-zone {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 34px 16px; border-radius: 14px; text-align: center;
  border: 2px dashed var(--accent); background: var(--accent-soft); color: var(--text-2); transition: background 0.12s, transform 0.12s; outline: none;
}
.drop-zone svg { color: var(--accent); }
.drop-zone b { color: var(--text); font-size: 16px; }
.drop-zone span { font-size: 12.5px; }
.drop-zone.over, .drop-zone:focus-visible { transform: scale(1.01); background: var(--panel-2); }
input.invalid { border-color: var(--err) !important; box-shadow: 0 0 0 3px var(--err-soft); }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; }
  .topbar { flex-wrap: wrap; padding: 8px 16px; }
  .brand { width: auto; }
  .sidebar { flex-direction: row; overflow-x: auto; padding: 6px 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-main, .nav-low { flex-direction: row; }
  .nav-low { border-top: 0; padding-top: 0; }
  .view, .db-head { padding-left: 16px; padding-right: 16px; }
  .tabs { padding: 0 16px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .split, .split.three { grid-template-columns: 1fr; }
}
