:root {
  --bg: #0b0d11;
  --panel: #111419;
  --panel-2: #151920;
  --panel-3: #1b2028;
  --border: #1f252e;
  --border-2: #2a313c;
  --text: #e4e9f0;
  --muted: #8a95a5;
  --dim: #5a6474;
  --accent: #58c4ec;
  --accent-soft: rgba(88, 196, 236, 0.1);
  --ok: #46c98a;
  --warn: #e8b04f;
  --err: #f0607a;
  --radius: 8px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
  --sans: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13.5px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-weight: 400; }
.spacer { flex: 1; }
.ic { flex: none; display: block; }
code { font-family: var(--mono); font-size: 0.92em; color: #c9d4e2; background: var(--panel-3); padding: 1px 5px; border-radius: 4px; }
.is-desktop .web-only, .is-local .web-only { display: none !important; }

/* ───────── Barra superior y menús ───────── */
.topbar {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 14px 0 16px;
  border-bottom: 1px solid var(--border);
  background: #0d1014;
  position: relative;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding-right: 14px; border-right: 1px solid var(--border); height: 26px; }
.logo { width: 24px; height: 24px; color: var(--text); }
.logo.big { width: 46px; height: 46px; }
.brand-name { font-weight: 700; letter-spacing: 0.24em; font-size: 13px; }

.menubar { display: flex; align-items: center; gap: 2px; }
.mb-item { position: relative; }
.mb-btn {
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: #b7c1ce;
  font-size: 13px;
}
.mb-btn:hover, .mb-btn.on { background: var(--panel-3); color: var(--text); }
.mb-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 270px;
  padding: 5px;
  background: #13171d;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}
.mb-menu button {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  background: none;
  text-align: left;
  color: #d3dbe6;
}
.mb-menu button:hover:not(:disabled) { background: var(--panel-3); color: var(--text); }
.mb-menu button:disabled { opacity: 0.38; cursor: default; }
.mb-menu button .ic { color: var(--muted); }
.mb-menu button span small { display: block; color: var(--dim); font-size: 11.5px; margin-top: 1px; }
.mb-menu kbd { font: 11px var(--mono); color: var(--dim); }
.mb-menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 4px; }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.status {
  display: inline-flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 10px;
  border: 1px solid var(--border-2); border-radius: 6px;
  background: none;
  font-size: 12px; color: var(--muted);
  white-space: nowrap;
}
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.status.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(70, 201, 138, 0.15); }
.status.warn .dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(232, 176, 79, 0.15); }
.status:hover { border-color: #3a4352; color: var(--text); }

/* ───────── Botones y controles ───────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border-radius: 7px;
  border: 1px solid var(--border-2);
  background: var(--panel-3);
  font-weight: 500;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
  transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover:not(:disabled) { border-color: #3a4352; background: #222832; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: #e6ebf1; border-color: #e6ebf1; color: #0b0d11; font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: #ffffff; border-color: #ffffff; }
.btn.ghost { background: transparent; }
.btn.danger { background: rgba(240, 96, 122, 0.1); border-color: rgba(240, 96, 122, 0.45); color: #ffb3c0; }
.btn.small { height: 28px; padding: 0 10px; font-size: 12.5px; }
.icon-btn {
  width: 30px; height: 30px;
  display: inline-grid; place-items: center;
  border-radius: 6px;
  border: 1px solid var(--border-2);
  background: transparent;
  color: #b7c1ce;
}
.icon-btn:hover { background: var(--panel-3); color: var(--text); }
.icon-btn.small { width: 24px; height: 24px; border-color: transparent; }

/* ───────── Distribución ───────── */
.layout {
  height: calc(100vh - 48px);
  display: grid;
  grid-template-columns: 330px 1fr;
  min-height: 0;
}
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-right: 1px solid var(--border);
  background: #0d1014;
  min-height: 0;
  overflow-y: auto;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.card-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 9px;
}
textarea, .select, input[type="text"], input[type="password"] {
  width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border-2);
  background: #0a0c0f;
  outline: none;
}
textarea { resize: vertical; min-height: 104px; padding: 10px 11px; line-height: 1.5; }
.select { height: 32px; padding: 0 8px; margin-top: 8px; color: var(--muted); }
input[type="text"], input[type="password"] { height: 34px; padding: 0 10px; }
textarea:focus, .select:focus, input[type="text"]:focus, input[type="password"]:focus { border-color: #4a5566; box-shadow: 0 0 0 3px rgba(88, 196, 236, 0.08); }
.field { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 10px; }
.field-label { color: var(--muted); font-size: 12.5px; }
.seg { display: inline-flex; padding: 2px; border-radius: 7px; border: 1px solid var(--border-2); background: #0a0c0f; }
.seg button { border: 0; background: none; padding: 4px 10px; border-radius: 5px; font-size: 12.5px; color: var(--muted); }
.seg button.on { background: var(--panel-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-2); }
.seg.small button { padding: 3px 9px; font-size: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.check input, .toggle input { accent-color: var(--accent); }
.actions { display: flex; gap: 8px; }
.actions .btn { flex: 1; }

/* Proceso */
.stages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.stage {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 7px 4px;
  border-radius: 6px;
  position: relative;
}
.stage + .stage::before { content: ''; position: absolute; left: 18px; top: -6px; height: 10px; border-left: 1px solid var(--border-2); }
.stage-icon {
  width: 28px; height: 22px;
  border-radius: 5px;
  display: grid; place-items: center;
  font: 600 10.5px var(--mono);
  border: 1px solid var(--border-2);
  color: var(--dim);
  background: #0a0c0f;
}
.stage b { display: block; font-size: 12.5px; font-weight: 600; }
.stage small { display: block; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.stage .stage-time { font: 11px var(--mono); color: var(--dim); white-space: nowrap; }
.stage.running { background: var(--accent-soft); }
.stage.running .stage-icon { border-color: var(--accent); color: var(--accent); }
.stage.running .stage-icon::after {
  content: ''; position: absolute; left: 4px; top: 50%; width: 28px; height: 22px; margin-top: -11px;
  border-radius: 5px; box-shadow: 0 0 0 1px var(--accent); animation: pulse 1.2s ease-in-out infinite;
}
.stage.done .stage-icon { border-color: rgba(70, 201, 138, 0.45); color: var(--ok); }
.stage.error .stage-icon { border-color: rgba(240, 96, 122, 0.5); color: var(--err); }
.stage.error small { color: #ffb3c0; white-space: normal; }
.stage.skipped, .stage.stopped { opacity: 0.55; }
.stage .retry { grid-column: 2 / 4; justify-self: start; }

/* Actividad */
.log-card { flex: 1; min-height: 180px; display: flex; flex-direction: column; }
.log { flex: 1; overflow-y: auto; font-size: 12px; display: flex; flex-direction: column; gap: 3px; min-height: 0; }
.log-empty { color: var(--dim); font-size: 12px; }
.log-row { display: grid; grid-template-columns: 52px 1fr; gap: 8px; align-items: baseline; animation: fadeIn .2s ease both; }
.log-tag { font: 500 9.5px var(--mono); letter-spacing: 0.04em; text-transform: uppercase; padding: 1px 4px; border-radius: 3px; text-align: center; color: var(--muted); border: 1px solid var(--border-2); }
.log-text { color: #c3ccd8; word-break: break-word; }
.log-text a { text-decoration: none; }
.log-text a:hover { text-decoration: underline; }
.log-row.search .log-tag { color: var(--accent); border-color: rgba(88, 196, 236, 0.35); }
.log-row.think .log-text { color: var(--muted); font-style: italic; }
.log-row.part .log-tag { color: var(--warn); border-color: rgba(232, 176, 79, 0.35); }
.log-row.view .log-tag { color: #6fd6b5; border-color: rgba(111, 214, 181, 0.35); }
.log-row.done .log-tag { color: var(--ok); border-color: rgba(70, 201, 138, 0.4); }
.log-row.error .log-tag { color: var(--err); border-color: rgba(240, 96, 122, 0.45); }
.log-row.error .log-text { color: #ffb3c0; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { opacity: 0.35; } }

/* ───────── Zona de trabajo ───────── */
.workspace { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tabs { display: flex; gap: 22px; padding: 0 18px; border-bottom: 1px solid var(--border); background: #0d1014; height: 42px; align-items: stretch; }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 2px;
  border: 0; border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--text); }
.tab-n { font: 500 10.5px var(--mono); color: var(--dim); }
.tab.on .tab-n { color: var(--accent); }
.tab.live::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.panels { flex: 1; position: relative; min-height: 0; }
.panel { position: absolute; inset: 0; display: none; }
.panel.on { display: flex; flex-direction: column; }

.empty-state { height: 100%; display: grid; place-content: center; justify-items: center; text-align: center; color: var(--muted); padding: 24px; }
.empty-state p { margin: 12px 0 4px; color: var(--text); font-weight: 500; }
.empty-state span { font-size: 13px; max-width: 420px; }
.empty-icon { color: var(--dim); }

/* Investigación */
.research { flex: 1; overflow-y: auto; padding: 24px 28px 40px; }
.r-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.r-head h1 { margin: 0 0 6px; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.r-head p { margin: 0; color: #bcc6d3; max-width: 760px; }
.r-tag { font-size: 11px; padding: 3px 9px; border-radius: 5px; border: 1px solid var(--border-2); color: var(--muted); white-space: nowrap; text-transform: uppercase; letter-spacing: 0.08em; }
.r-dims { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 8px; max-width: 640px; }
.r-dim { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 11px 14px; }
.r-dim span { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; }
.r-dim b { font: 500 22px var(--mono); }
.r-dim b small { font-size: 12px; color: var(--muted); margin-left: 3px; }
.r-note { color: var(--muted); font-size: 12.5px; margin: 0 0 20px; max-width: 760px; }
.r-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.r-card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
.r-card h3 { margin: 0 0 10px; font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.r-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.r-list li b { display: block; font-weight: 600; font-size: 13px; }
.r-list li span { color: #a9b4c3; font-size: 12.5px; }
.r-list li em { color: var(--accent); font-style: normal; font-size: 11px; font-family: var(--mono); }
.r-bullets { margin: 0; padding-left: 18px; color: #c3ccd8; display: flex; flex-direction: column; gap: 5px; }
.swatch-row { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: center; }
.swatch { width: 28px; height: 28px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.12); }
.r-sources a { text-decoration: none; font-size: 12.5px; }
.r-sources a:hover { text-decoration: underline; }
.r-sources small { color: var(--dim); font-family: var(--mono); font-size: 11px; display: block; }
.live-search { max-width: 760px; }
.live-search h2 { margin: 0 0 4px; font-size: 18px; font-weight: 600; }
.live-search > p { color: var(--muted); margin: 0 0 18px; }
.live-list { display: flex; flex-direction: column; gap: 6px; }
.live-item { display: flex; gap: 12px; align-items: baseline; padding: 9px 12px; border: 1px solid var(--border); border-radius: 7px; background: var(--panel); animation: fadeIn .25s ease both; }
.live-item .k { font: 500 10px var(--mono); color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; min-width: 64px; }
.live-item.src .k { color: var(--muted); }
.live-item.think { border-style: dashed; color: var(--muted); font-style: italic; }
.live-item.think .k { color: var(--dim); font-style: normal; }

/* Planos */
.panel-toolbar { display: flex; align-items: center; gap: 12px; padding: 8px 16px; border-bottom: 1px solid var(--border); background: var(--panel); }
.toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.hint { font-size: 12px; color: var(--dim); }
.sheet-wrap, .blueprint-bg { background: radial-gradient(ellipse at 50% 40%, #0f2240 0%, #0a1426 60%, #080e1a 100%); }
.sheet-wrap { flex: 1; overflow: auto; display: grid; place-items: center; padding: 20px; }
.sheet { position: relative; }
.sheet-view {
  position: absolute;
  padding: 0;
  border: 1px solid rgba(120, 170, 255, 0.2);
  border-radius: 3px;
  background: #0b1a30;
  overflow: hidden;
  transition: border-color .15s;
}
.sheet-view:hover { border-color: rgba(120, 190, 255, 0.7); z-index: 2; }
.sheet-view svg { width: 100%; height: 100%; display: block; }
.sheet-view.is-pending { border-style: dashed; }
.bp-el { animation: bpIn .55s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(min(var(--i), 120) * 18ms); }
@keyframes bpIn { from { opacity: 0; } to { opacity: 1; } }
.sheet-legend, .sheet-titleblock {
  position: absolute;
  border: 1px solid rgba(120, 170, 255, 0.2);
  border-radius: 3px;
  background: rgba(11, 26, 48, 0.75);
  padding: 10px 12px;
  color: #cfe3ff;
  font-size: 11.5px;
  overflow: hidden;
}
.legend-title { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: #9fd0ff; margin-bottom: 6px; }
.legend-row { display: flex; align-items: center; gap: 8px; margin: 3px 0; color: #b9cbe6; }
.ln { width: 28px; height: 0; border-top: 2px solid; display: inline-block; }
.ln-visible { border-color: #eaf2ff; }
.ln-hidden { border-color: #7fb0ff; border-top-style: dashed; }
.ln-center { border-color: #ffb547; border-top-style: dashed; border-top-width: 1px; }
.ln-detail { border-color: #8fb9f5; border-top-width: 1px; }
.ln-dim { border-color: #5fe3c0; border-top-width: 1px; }
.ln-overlay { border-color: #ff4f9a; border-top-width: 6px; opacity: .6; }
.tb-name { font-weight: 700; font-size: 13px; color: #eaf2ff; margin-bottom: 6px; }
.tb-row { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-family: var(--mono); margin-bottom: 6px; }
.tb-row span { color: #7d9cc6; font-size: 10.5px; text-transform: uppercase; }
.tb-row b { color: #eaf2ff; margin-right: 6px; }
.tb-row em { color: #7d9cc6; font-style: normal; }
.tb-note { color: #a9bfdf; font-size: 11px; margin: 2px 0; }
.tb-foot { margin-top: 6px; color: #6e8cb8; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }

/* Visor 3D */
.viewport { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 38%, #252c37 0%, #14181f 52%, #0b0d11 100%); }
.viewport canvas { display: block; width: 100%; height: 100%; outline: none; }
.vp-toolbar {
  position: absolute; top: 12px; left: 12px;
  display: flex; align-items: center; gap: 4px;
  padding: 4px;
  border-radius: 8px;
  background: rgba(13, 16, 20, 0.85);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  z-index: 3;
}
.vp-sep { width: 1px; height: 20px; background: var(--border-2); margin: 0 4px; }
.tbtn { width: 30px; height: 28px; display: grid; place-items: center; border-radius: 6px; border: 1px solid transparent; background: none; color: var(--muted); }
.tbtn:hover { color: var(--text); background: var(--panel-3); }
.tbtn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: rgba(88, 196, 236, 0.3); }
.build-hud {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 6px;
  background: rgba(13, 16, 20, 0.9);
  border: 1px solid rgba(88, 196, 236, 0.4);
  color: #c4ecfb;
  font: 500 12px var(--mono);
  z-index: 3;
}
.vp-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; color: var(--dim); pointer-events: none; }
.vp-empty p { margin: 10px 0 0; color: var(--muted); }
.vp-stats { position: absolute; left: 14px; bottom: 14px; font: 11px var(--mono); color: var(--dim); z-index: 2; pointer-events: none; }
.outliner {
  position: absolute; top: 12px; right: 12px;
  width: 268px; max-height: calc(100% - 150px);
  display: flex; flex-direction: column;
  border-radius: 8px;
  background: rgba(13, 16, 20, 0.9);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  z-index: 3;
}
.outliner-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 12px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border); }
.outliner.collapsed .outliner-body { display: none; }
.outliner.collapsed .outliner-head .ic { transform: rotate(-90deg); }
.outliner-body { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; }
.tree { padding: 6px; font-size: 12.5px; }
.tree-node { display: flex; align-items: center; gap: 6px; width: 100%; padding: 3px 6px; border: 0; border-radius: 5px; background: none; text-align: left; color: #c3ccd8; }
.tree-node:hover { background: var(--panel-3); }
.tree-node.sel { background: var(--accent-soft); color: var(--accent); }
.tree-node .ico { font: 500 9px var(--mono); color: var(--dim); width: 28px; flex: none; text-transform: uppercase; }
.tree-node .nm { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-node .ct { font: 10.5px var(--mono); color: var(--warn); }
.tree-children { padding-left: 12px; border-left: 1px solid var(--border); margin-left: 12px; }
.part-info { border-top: 1px solid var(--border); padding: 10px 12px; font-size: 12px; color: #b4bfcd; }
.part-info b { color: var(--text); font-size: 13px; display: block; margin-bottom: 4px; }
.part-info code { background: none; padding: 0; color: var(--muted); font-size: 11px; }
.part-info .kv { display: grid; grid-template-columns: 76px 1fr; gap: 3px 8px; margin-top: 6px; }
.part-info .kv span { color: var(--dim); }
.part-info .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; border: 1px solid rgba(255,255,255,.2); }
.anim-bar {
  position: absolute; left: 50%; bottom: 62px; transform: translateX(-50%);
  width: min(720px, calc(100% - 40px));
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(13, 16, 20, 0.9);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  z-index: 3;
}
.anim-bar select { height: 28px; border-radius: 6px; border: 1px solid var(--border-2); background: var(--panel-3); padding: 0 6px; font-size: 12.5px; max-width: 220px; }
.anim-bar input[type="range"] { flex: 1; accent-color: var(--accent); }
.anim-bar .time { font: 11.5px var(--mono); color: var(--muted); min-width: 60px; text-align: right; }
.icon-btn.play { width: 30px; height: 30px; border-radius: 50%; background: #e6ebf1; color: #0b0d11; border-color: #e6ebf1; }
.icon-btn.play:hover { background: #fff; }
.command {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  width: min(820px, calc(100% - 40px));
  display: flex; align-items: center; gap: 8px;
  padding: 5px;
  border-radius: 9px;
  background: rgba(13, 16, 20, 0.92);
  border: 1px solid var(--border-2);
  backdrop-filter: blur(8px);
  z-index: 3;
}
.command input[type="text"] { flex: 1; min-width: 0; height: 30px; border-color: transparent; background: transparent; }
.command input[type="text"]:focus { box-shadow: none; border-color: transparent; }

/* Modales */
.modal { position: fixed; inset: 0; background: rgba(3, 5, 8, 0.72); display: grid; place-items: center; z-index: 100; padding: 24px; }
.modal-box { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border-2); border-radius: 12px; overflow: hidden; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5); }
.modal-box.wide { width: min(1200px, 100%); height: min(860px, 100%); }
.modal-box.dialog { width: min(520px, 100%); max-height: 100%; }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--border); }
.modal-head b { font-weight: 600; }
.modal-body { flex: 1; min-height: 0; padding: 14px; }
.modal-body svg { width: 100%; height: 100%; display: block; }
.dialog-body { padding: 16px; overflow-y: auto; }
.dialog-foot { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); background: #0f1216; }
.form-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.form-help { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }
.key-row { display: flex; gap: 8px; }
.note { font-size: 12.5px; padding: 9px 11px; border-radius: 7px; margin-bottom: 14px; border: 1px solid var(--border-2); color: #c3ccd8; }
.note.ok { border-color: rgba(70, 201, 138, 0.35); background: rgba(70, 201, 138, 0.06); }
.guide { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 9px; color: #c3ccd8; }
.about { display: flex; align-items: center; gap: 14px; }
.about b { display: block; letter-spacing: 0.24em; font-size: 16px; }
.about span { color: var(--muted); font-size: 12.5px; }

/* Aviso */
.toast {
  position: fixed; left: 50%; bottom: 24px;
  transform: translate(-50%, 16px);
  opacity: 0;
  padding: 9px 14px;
  border-radius: 8px;
  background: var(--panel-3);
  border: 1px solid var(--border-2);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  font-size: 13px;
  transition: opacity .18s, transform .18s;
  pointer-events: none;
  z-index: 200;
  max-width: min(560px, calc(100% - 32px));
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(240, 96, 122, 0.5); color: #ffc2cd; }
.toast.ok { border-color: rgba(70, 201, 138, 0.45); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #232a34; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 1100px) {
  #btnDownload { font-size: 0; gap: 0; width: 30px; padding: 0; }
  .status-text { display: none; }
}
@media (max-width: 980px) {
  body { overflow: auto; }
  .layout { grid-template-columns: 1fr; height: auto; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); overflow: visible; }
  .log-card { max-height: 260px; }
  .workspace { height: 78vh; }
  .outliner { width: 210px; }
}
@media (max-width: 640px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .brand { border-right: 0; padding-right: 0; }
  .brand-name { display: none; }
  .mb-btn { padding: 0 7px; }
  .mb-menu { position: fixed; left: 8px; right: 8px; top: 52px; min-width: 0; }
  .status { display: none; }
  .r-dims { grid-template-columns: 1fr; }
  .outliner { display: none; }
  .research { padding: 16px; }
  .tabs { gap: 14px; padding: 0 12px; }
}
