/* Oficina Virtual — «consola de control»: tinta cálida, un solo acento lima señal, IBM Plex Sans + Plex Mono para datos y rótulos;
   esquinas casi rectas, líneas finas, sin sombras. El mapa es una vista opcional. */
:root {
  /* nombres heredados: --yellow = acento como texto, --yellow-btn = acento como relleno, --holo = info/enlaces */
  --space: #0f0f0d; --panel: #151513; --panel2: #1a1a17; --panel3: #23231f; --line: #292925; --line2: #3a3a34;
  --yellow: #d4ff3a; --yellow-btn: #d4ff3a; --on-accent: #12140a; --holo: #8fcbff; --holo-btn: #8fcbff; --red: #ff6250; --green: #62dc8e; --orange: #ffb547; --purple: #c6a8ff;
  --text: #ecebe5; --muted: #8e8c83; --faint: #5f5e57; --px: 3px;
  --fs-xs: 11px; --fs-sm: 12px; --fs-md: 13px; --fs-base: 14px;
  --r: 6px; --r-sm: 4px; --glass: var(--panel); --shadow: 0 10px 30px rgba(0,0,0,.45); --ring: color-mix(in srgb, var(--yellow) 40%, transparent);
  --f-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif; --f-pixel: var(--f-body); --f-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  --side-w: 232px;
  --floor: #181815; --floor2: #1c1c19; --wall: #33332d;
  --input-bg: #121210;
  --hud-bg: var(--panel); --dock-bg: var(--panel); --drawer-bg: var(--space);
  --floor-base: #131311;
  --kcol-bg: var(--panel);
  --kcol-over-bg: color-mix(in srgb, var(--yellow) 8%, var(--panel));
  --perm-bg: #2a1512;
  --spark-bg: #0b0b09;
  --login-box-bg: var(--panel);
  --holo-toast-bg: #1d1d1a; --holo-toast-text: #d6d4cc; --holo-toast-title: #fff; --holo-err-bg: #2c1714;
  --dialog-backdrop: rgba(6,6,5,.7);
  --bg-stars: none;
  color-scheme: dark;
}
[data-theme="blanco"], [data-theme="crema"] {
  --space: #f2f0ea; --panel: #faf9f5; --panel2: #f5f3ee; --panel3: #e9e6de; --line: #dcd8ce; --line2: #c6c1b5;
  --yellow: #4d6a00; --yellow-btn: #c9f02f; --on-accent: #12140a; --holo: #1f5fbf; --holo-btn: #1f5fbf; --red: #c9372a; --green: #1d8a4e; --orange: #b56a00; --purple: #6a46c9;
  --text: #171612; --muted: #67645b; --faint: #9a968b;
  --floor: #e9e6de; --floor2: #e3dfd6; --wall: #bdb7aa;
  --input-bg: #fffefb; --floor-base: #ece9e2; --kcol-bg: #f5f3ee;
  --perm-bg: #fff0ed; --spark-bg: #1f1e1a; --login-box-bg: #faf9f5;
  --holo-toast-bg: #faf9f5; --holo-toast-text: #3b3933; --holo-toast-title: #171612; --holo-err-bg: #fff3f1;
  --dialog-backdrop: rgba(23,22,18,.35); --shadow: 0 10px 30px rgba(40,36,24,.12);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--space); color: var(--text); font: var(--fs-base)/1.5 var(--f-body); -webkit-font-smoothing: antialiased; }
a { color: var(--holo); }
h1 { font: 600 20px/1.3 var(--f-body); color: var(--text); margin: 0 0 16px; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
h2 { font: 600 15px/1.35 var(--f-body); color: var(--text); margin: 22px 0 10px; }
h3, .lbl-up { font: 600 var(--fs-xs)/1.4 var(--f-body); text-transform: uppercase; letter-spacing: .06em; }
h3 { color: var(--muted); margin: 16px 0 8px; }
.pixel { font-family: var(--f-body); font-weight: 600; }
small, .muted { color: var(--muted); font-size: var(--fs-sm); }
code, pre { font-family: var(--f-mono); font-size: 12.5px; }
code { background: var(--panel3); padding: 1px 5px; border-radius: 4px; }
pre code { background: none; padding: 0; }
kbd { font: var(--fs-xs) var(--f-mono); border: 1px solid var(--line2); border-radius: 4px; padding: 0 4px; color: var(--muted); }
[hidden] { display: none !important; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.col-flex { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.right { margin-left: auto; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-red { color: var(--red); } .t-orange { color: var(--orange); } .t-green { color: var(--green); }
::selection { background: color-mix(in srgb, var(--yellow) 35%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }

/* ---------- paneles ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; position: relative; }
.panel.y { border-color: color-mix(in srgb, var(--yellow) 30%, var(--line)); }
.panel.h { border-color: color-mix(in srgb, var(--holo) 30%, var(--line)); }
.panel.r { border-color: color-mix(in srgb, var(--red) 45%, var(--line)); background: color-mix(in srgb, var(--red) 6%, var(--panel)); }
details > summary { cursor: pointer; }

/* ---------- botones ---------- */
.btn {
  /* por defecto, secundario; color solo con intención: .y principal (uno por vista), .g aprobar, .r peligro, .warn delicado (desplegar) */
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px; font: 500 var(--fs-md)/1.2 var(--f-body); color: var(--text); background: var(--panel2);
  border: 1px solid var(--line2); border-radius: var(--r-sm); padding: 7px 12px; cursor: pointer; margin: 2px; transition: background .12s, border-color .12s, filter .12s;
}
.btn:hover { background: var(--panel3); }
.btn:active { transform: translateY(1px); }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
.btn.y { background: var(--yellow-btn); border-color: transparent; color: var(--on-accent); }
.btn.r { background: var(--red); border-color: transparent; color: #fff; } .btn.g { background: var(--green); border-color: transparent; color: #fff; } .btn.o { background: var(--orange); border-color: transparent; color: #fff; }
.btn.y:hover, .btn.r:hover, .btn.g:hover, .btn.o:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line2); }
.btn.ghost:hover { background: var(--panel3); }
.btn.warn { background: transparent; color: var(--orange); border-color: color-mix(in srgb, var(--orange) 60%, transparent); } /* acciones delicadas: desplegar */
.btn.sm { font-size: var(--fs-sm); padding: 4px 9px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- formularios ---------- */
input, select, textarea { font: var(--fs-base) var(--f-body); color: var(--text); background: var(--input-bg); border: 1px solid var(--line2); border-radius: var(--r-sm); padding: 8px 10px; width: 100%; min-width: 0; transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px var(--ring); outline: none; }
textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--yellow-btn); margin: 0 6px 0 2px; }
label.l, div.l { display: block; font-size: var(--fs-sm); font-weight: 500; color: var(--muted); margin: 12px 0 5px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }

/* ---------- chips y estados ---------- */
.chip { font-size: var(--fs-sm); padding: 1px 8px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 6px; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.st-pendiente { color: var(--muted); } .st-bloqueada { color: var(--muted); opacity: .8; } .st-en_cola { border-color: color-mix(in srgb, var(--purple) 50%, transparent); color: var(--purple); }
.st-en_curso { border-color: color-mix(in srgb, var(--holo) 50%, transparent); color: var(--holo); } .st-esperando { border-color: color-mix(in srgb, var(--orange) 55%, transparent); color: var(--orange); }
.st-revision { border-color: color-mix(in srgb, var(--orange) 55%, transparent); color: var(--orange); } .st-completada { border-color: color-mix(in srgb, var(--green) 50%, transparent); color: var(--green); }
.st-pausada_cuota { border-color: color-mix(in srgb, var(--purple) 50%, transparent); color: var(--purple); } .st-fallida { border-color: color-mix(in srgb, var(--red) 55%, transparent); color: var(--red); }
.pri-alta { color: var(--red); } .pri-media { color: var(--orange); } .pri-baja { color: var(--muted); }
@keyframes blink { 50% { opacity: .45; } }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot.ok { background: var(--green); } .dot.warn { background: var(--orange); } .dot.bad { background: var(--red); } .dot.off { background: var(--line2); }
.dot.blink { animation: blink 1.2s ease-in-out infinite; }

/* ---------- barra de progreso (antes «sable») ---------- */
.saber { display: flex; align-items: center; height: 8px; min-width: 120px; }
.saber .hilt { display: none; }
.saber .track { flex: 1; height: 6px; background: var(--panel3); border-radius: 3px; overflow: hidden; }
.saber .blade { height: 100%; background: var(--c, var(--yellow)); border-radius: 3px; transition: width .4s ease; }

/* ---------- estructura: barra lateral + contenido ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); height: 100vh; height: 100dvh; }
.side { display: flex; flex-direction: column; gap: 1px; min-height: 0; padding: 18px 12px 12px; background: var(--space); border-right: 1px solid var(--line); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 2px; padding: 0 8px 18px; color: var(--text); text-decoration: none; font: 600 17px/1 var(--f-mono); letter-spacing: -.03em; }
.brand-cursor { width: 8px; height: 17px; background: var(--yellow-btn); margin-left: 3px; animation: blink 1.1s steps(1) infinite; }
.side-proj { display: block; padding: 0 0 10px; }
.side-proj span { display: block; font: 500 10px var(--f-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--faint); padding: 0 8px 5px; }
.side select { font-size: var(--fs-md); padding: 7px 8px; background-color: var(--panel); }
.side-group { font: 500 10px var(--f-mono); text-transform: uppercase; letter-spacing: .12em; color: var(--faint); padding: 16px 8px 6px; }
.side a.nav, .side button.nav { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 6px 8px; border: 0; border-radius: var(--r-sm); background: none; color: var(--muted); font: 450 var(--fs-base) var(--f-body); text-decoration: none; text-align: left; cursor: pointer; transition: color .12s, background .12s; }
.nav-k { width: 18px; flex: none; display: inline-flex; justify-content: flex-start; font: 500 10.5px var(--f-mono); color: var(--faint); letter-spacing: .02em; }
.side a.nav:hover, .side button.nav:hover { color: var(--text); background: var(--panel2); }
.side a.nav:hover .nav-k { color: var(--muted); }
.side a.nav[aria-current] { color: var(--text); background: var(--panel2); font-weight: 500; }
.side a.nav[aria-current]::before { content: ''; position: absolute; left: -12px; top: 6px; bottom: 6px; width: 3px; background: var(--yellow-btn); border-radius: 0 2px 2px 0; }
.side a.nav[aria-current] .nav-k { color: var(--yellow); }
.side .nav .n { margin-left: auto; background: var(--red); color: #fff; font: 600 10px/16px var(--f-mono); min-width: 18px; height: 16px; padding: 0 5px; border-radius: 3px; text-align: center; }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 1px; }
.side-new { justify-content: center; margin: 0 0 4px; }
.me-btn { display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 6px 8px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text); font: 500 var(--fs-base) var(--f-body); cursor: pointer; text-align: left; }
.me-btn:hover, .me-btn[aria-expanded="true"] { background: var(--panel2); }
.me-btn small { display: block; font: 400 10.5px var(--f-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
.main-area { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.map-bar { display: flex; gap: 10px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); flex: none; min-width: 0; }
.map-bar select { width: auto; max-width: 240px; padding: 5px 8px; font-size: var(--fs-md); }
.hud-att { min-width: 0; flex: 1; } .hud-att:empty { display: none; }
.queue-paused { flex: none; background: var(--red); color: #fff; font-size: var(--fs-md); padding: 6px 16px; display: flex; align-items: center; gap: 10px; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 14px; height: 14px; vertical-align: -2px; }
.bell { position: relative; }
.bell .n { background: var(--red); color: #fff; font: 600 var(--fs-xs)/16px var(--f-body); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; text-align: center; }
.tabbar { display: none; }
.menu { position: fixed; bottom: var(--menu-bottom, 70px); left: var(--menu-left, 12px); z-index: 45; background: var(--panel); min-width: 250px; max-width: calc(100vw - 16px); max-height: min(75vh, 620px); overflow-y: auto; padding: 6px;
  border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 1px; animation: pop-in .14s ease-out; }
@keyframes pop-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.menu-head { display: flex; gap: 10px; align-items: center; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-head b { display: block; font-weight: 600; }
.menu-sep { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 10px 4px; }
.menu a, .menu button { font: var(--fs-base) var(--f-body); color: var(--text); background: none; border: 0; border-radius: var(--r-sm); text-align: left; padding: 8px 10px; cursor: pointer; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.menu .ic { color: var(--muted); }
.menu a:hover, .menu button:hover, .menu [aria-current] { background: var(--panel3); }
.menu [aria-current] .ic { color: var(--yellow); }
.menu .danger { color: var(--red); margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 var(--r-sm) var(--r-sm); }
.menu .danger .ic { color: var(--red); }
.switch { margin-left: auto; width: 32px; height: 18px; border-radius: 999px; background: var(--line2); position: relative; flex: none; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
[aria-checked="true"] > .switch { background: var(--green); }
[aria-checked="true"] > .switch::after { transform: translateX(14px); }

/* ---------- contenido (antes panel lateral sobre el mapa) ---------- */
.drawer { flex: 1; min-height: 0; overflow: auto; background: var(--space); }
.drawer main { padding: 26px 32px 56px; max-width: 1480px; margin: 0 auto; min-width: 0; outline: none; }
.avatar { border-radius: 28%; flex: none; vertical-align: middle; }

/* ---------- login ---------- */
.login { position: fixed; inset: 0; overflow: auto; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(60% 50% at 50% 0%, color-mix(in srgb, var(--yellow) 14%, transparent), transparent), var(--space); }
.crawl { display: none; }
.login-box { width: min(92vw, 400px); padding: 28px; box-shadow: var(--shadow); }
.login-box h1 { justify-content: center; text-align: center; font-size: 20px; }
.login-sub { text-align: center; color: var(--muted); margin: -8px 0 18px; }
.err { color: var(--red); min-height: 22px; margin-top: 8px; }

/* ---------- mapa de la oficina (vista opcional) ---------- */
.map { flex: 1; min-height: 0; padding: 12px 16px 24px; overflow: auto; box-sizing: border-box; }
.station-layout { max-width: 1760px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; position: relative; }
.station-top-row { display: flex; gap: 8px; align-items: stretch; width: 100%; flex: none; }
.station-main { flex: 1 1 0; min-width: 0; }
.floor {
  max-width: 1680px; margin: 0 auto; padding: 6px 8px;
  background: var(--floor-base);
  box-shadow: 0 0 0 1px var(--wall), var(--shadow);
  border-radius: 16px; display: flex; flex-direction: column; gap: 0; position: relative;
}
.station-layout .floor { max-width: 100%; margin: 0; }
.station-aside {
  width: 320px; flex: none; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 0; display: flex; flex-direction: column; overflow: hidden;
  min-height: 0;
}
.station-aside-head {
  padding: 6px 8px 6px 12px; background: var(--panel2); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; flex: none;
}
.station-aside-body { overflow-y: auto; padding: 4px; display: flex; flex-direction: column; gap: 4px; flex: 1 1 0; min-height: 0; }
.aside-title { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-md); font-weight: 600; }
.run-item {
  background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 8px; text-decoration: none;
  color: inherit; display: flex; flex-direction: column; gap: 2px; transition: border-color .12s, background .12s;
}
.run-item:hover { border-color: var(--yellow); background: var(--panel3); }
.run-item.running { border-color: color-mix(in srgb, var(--green) 60%, var(--line)); }
.run-item .run-desc { font-size: var(--fs-xs); font-weight: 500; color: var(--text); }
.run-item .run-meta { font-size: var(--fs-xs); color: var(--muted); }
.run-status { font-size: var(--fs-xs); display: inline-flex; align-items: center; gap: 3px; }
.station-tab-btn {
  position: absolute; right: 16px; top: 8px; z-index: 20; background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 8px 12px; cursor: pointer; font: 500 var(--fs-sm) var(--f-body); display: inline-flex; align-items: center; gap: 6px;
}
.station-tab-btn:hover { background: var(--panel3); border-color: var(--yellow); }
.attention { display: flex; gap: 6px; align-items: center; overflow-x: auto; scrollbar-width: thin; padding: 2px 0; }
.attention > b { font-size: var(--fs-sm); white-space: nowrap; color: var(--yellow); }
.att-item { flex: none; max-width: 280px; display: inline-flex; gap: 4px; align-items: center; font-size: var(--fs-sm); color: var(--text); background: var(--panel); border-style: solid; border-width: 1px 1px 1px 3px; border-radius: var(--r-sm); padding: 2px 3px 2px 8px; }
.att-item a { color: inherit; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; padding: 3px 0; }
.att-item em { font: normal 600 var(--fs-xs) var(--f-body); text-transform: uppercase; color: var(--muted); margin-right: 6px; }
.att-item:hover { background: var(--panel3); }
.att-btn { flex: none; font: 600 var(--fs-xs) var(--f-body); color: var(--text); background: var(--panel3); border: 1px solid var(--line2); border-radius: 6px; padding: 3px 7px; min-height: 24px; cursor: pointer; }
.att-btn:hover { border-color: var(--yellow); }
.station-kanban-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 8px 10px; display: flex; flex-direction: column;
}
.station-kanban-head {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px;
  margin-bottom: 5px; padding-bottom: 4px; border-bottom: 1px solid var(--line); flex: none;
}
.wing { display: flex; flex-wrap: wrap; gap: 6px; }
.room2 { flex: 1 1 240px; min-height: 94px; position: relative; cursor: pointer; padding: 32px 8px 6px; border-radius: 10px; display: flex; flex-direction: column;
  background: repeating-conic-gradient(var(--floor) 0 25%, var(--floor2) 0 50%) 0 0 / 22px 22px;
  box-shadow: inset 0 0 0 3px var(--wall), inset 0 8px 0 var(--wall), inset 0 0 0 5px color-mix(in srgb, var(--c) 58%, transparent), inset 0 18px 28px color-mix(in srgb, var(--c) 8%, transparent);
  overflow: hidden; }
.room2:hover { box-shadow: inset 0 0 0 3px var(--wall), inset 0 8px 0 var(--wall), inset 0 0 0 5px var(--c), inset 0 18px 28px color-mix(in srgb, var(--c) 12%, transparent); }
.room2::after { content: ''; position: absolute; left: 50%; width: 44px; margin-left: -22px; height: 5px; background: var(--floor-base); box-shadow: 0 0 0 1px var(--wall); z-index: 3; } /* puerta al pasillo */
.room2::before { content: ''; position: absolute; left: 50%; width: 6px; height: 3px; margin-left: -3px; background: var(--green); box-shadow: 0 0 5px var(--green); border-radius: 1px; z-index: 5; } /* led puerta */
.wing:first-child .room2::after { bottom: 0; } .wing:last-child .room2::after { top: 0; }
.wing:first-child .room2::before { bottom: 2px; } .wing:last-child .room2::before { top: 2px; }

/* Suelo técnico de Desarrollo / Hangar con entramado de aleación */
.room-dev {
  background:
    radial-gradient(circle at 10% 20%, rgba(255,140,66,0.04) 0%, transparent 40%),
    repeating-linear-gradient(0deg, rgba(16,20,44,0.6) 0 2px, transparent 2px 24px),
    repeating-linear-gradient(90deg, rgba(16,20,44,0.6) 0 2px, transparent 2px 24px),
    repeating-conic-gradient(var(--floor) 0 25%, var(--floor2) 0 50%) 0 0 / 24px 24px;
}
/* Suelo ceremonial de Documentación / Biblioteca con losas geométricas */
.room-doc {
  background:
    radial-gradient(circle at 90% 20%, rgba(79,195,247,0.05) 0%, transparent 40%),
    repeating-linear-gradient(45deg, rgba(42,50,99,0.2) 0 1px, transparent 1px 16px),
    repeating-conic-gradient(var(--floor) 0 25%, var(--floor2) 0 50%) 0 0 / 20px 20px;
}
[data-theme="blanco"] .room-dev, [data-theme="crema"] .room-dev {
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,0.04) 0 2px, transparent 2px 24px),
    repeating-linear-gradient(90deg, rgba(0,0,0,0.04) 0 2px, transparent 2px 24px),
    repeating-conic-gradient(var(--floor) 0 25%, var(--floor2) 0 50%) 0 0 / 24px 24px;
}
[data-theme="blanco"] .room-doc, [data-theme="crema"] .room-doc {
  background:
    repeating-linear-gradient(45deg, rgba(0,0,0,0.04) 0 1px, transparent 1px 16px),
    repeating-conic-gradient(var(--floor) 0 25%, var(--floor2) 0 50%) 0 0 / 20px 20px;
}
/* Suelo táctico de Análisis / Sala de Mando con retícula de radar */
.room-ana {
  background:
    radial-gradient(circle at 50% 50%, rgba(61,220,132,0.06) 0%, transparent 60%),
    repeating-radial-gradient(circle at 50% 50%, rgba(61,220,132,0.1) 0 1px, transparent 1px 28px),
    repeating-conic-gradient(var(--floor) 0 25%, var(--floor2) 0 50%) 0 0 / 22px 22px;
}
[data-theme="blanco"] .room-ana, [data-theme="crema"] .room-ana {
  background:
    radial-gradient(circle at 50% 50%, rgba(43,138,62,0.06) 0%, transparent 60%),
    repeating-radial-gradient(circle at 50% 50%, rgba(43,138,62,0.1) 0 1px, transparent 1px 28px),
    repeating-conic-gradient(var(--floor) 0 25%, var(--floor2) 0 50%) 0 0 / 22px 22px;
}

.plaque { position: absolute; top: 5px; left: 8px; right: 8px; display: flex; align-items: center; gap: 6px; z-index: 4; min-height: 24px; padding: 2px 8px 2px 4px; background: var(--panel); border-radius: 6px; border-left: 3px solid var(--c); box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.plaque-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 0 2px; color: inherit; cursor: pointer; min-width: 0; }
.plaque b, .plaque small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; } /* en salas angostas se recorta, no se parte */
.plaque small { flex: 0 6 auto; } /* el subtítulo cede antes que el nombre */
.plaque .pend { white-space: nowrap; background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--text); border-radius: 999px; padding: 0 7px; }
/* franja de pared: adornos arriba, los escritorios quedan libres debajo */
.wall { position: relative; z-index: 2; display: flex; justify-content: flex-end; align-items: flex-end; gap: 8px; min-height: 36px; margin: 0 -8px; padding: 0 12px 2px; border-bottom: 2px solid color-mix(in srgb, var(--wall) 70%, transparent); background: linear-gradient(color-mix(in srgb, var(--wall) 35%, transparent), transparent); }
.wall .deco-item { position: relative; }
.wall .sprite { max-height: 32px; width: auto; }
.wall .deco-item:nth-child(n+3) { display: none; } /* dos adornos por sala: no compiten con la placa */
.wall .deco-bubble { top: 105%; bottom: auto; left: auto; right: 0; animation-name: decoBubbleDown; }
@keyframes decoBubbleDown { 0% { opacity: 0; } 12%, 82% { opacity: 1; } 100% { opacity: 0; } }
.room-link { display: flex; align-items: center; gap: 6px; min-width: 0; width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--text); font: var(--fs-sm) var(--f-body); padding: 4px 8px; cursor: pointer; text-align: left; margin: 2px 0; }
.room-link:hover { border-color: var(--yellow); }
.room-link small { margin-left: auto; flex: none; }
.plaque b { font: 600 var(--fs-sm) var(--f-body); color: var(--text); }
.plaque small { font-size: var(--fs-xs); }
.desks2 { flex: 1; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-end; align-content: safe center; /* safe: si no cabe, no se sube bajo la placa */ justify-content: center; padding: 8px 8px 6px; z-index: 2; position: relative; }
.desk { position: relative; flex-direction: column; align-items: center; width: 92px; background: none; border: 0; padding: 0; color: inherit; cursor: pointer; font: inherit; display: flex; transition: transform 0.1s ease; }
.desk:hover { transform: translateY(-2px); }
.desk .who { height: 38px; display: flex; align-items: flex-end; position: relative; margin-bottom: -4px; z-index: 2; }
.desk .who .sprite { max-height: 38px; width: auto; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5)); }
.desk > .sprite { max-height: 30px; width: auto; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.3)); }
.desk-mug { position: absolute; right: 8px; bottom: 12px; z-index: 4; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6)); animation: mugSteam 2.5s ease-in-out infinite alternate; }
@keyframes mugSteam {
  0% { transform: translateY(0); filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6)) brightness(1); }
  100% { transform: translateY(-1px); filter: drop-shadow(0 2px 4px rgba(255,140,66,0.3)) brightness(1.2); }
}
.desk .lbl { font-size: var(--fs-xs); line-height: 1.15; text-align: center; color: var(--text); max-width: 92px; margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-weight: 600; background: var(--panel); padding: 1px 5px; border-radius: 4px; }
.desk:hover .lbl { color: var(--text); }
.desk.free { opacity: .35; cursor: default; }
.desk.en_curso > .sprite { animation: screen 1.2s steps(2) infinite; }
.desk.en_curso { filter: drop-shadow(0 0 8px rgba(61,220,132,0.35)); }
@keyframes screen { 50% { filter: brightness(1.6); } }
.more { font: 600 var(--fs-xs) var(--f-body); color: var(--muted); align-self: center; }
.hint { color: var(--muted); font-size: var(--fs-xs); }
.bubble { position: absolute; top: -14px; right: -8px; background: var(--orange); color: #fff; font: 700 var(--fs-xs)/1 var(--f-body); padding: 3px 6px; border-radius: 999px; animation: bob 1.2s ease-in-out infinite; z-index: 5; }
.bubble.z { background: var(--panel3); color: var(--muted); animation: none; }
.bubble.o { background: var(--orange); }
@keyframes bob { 50% { transform: translateY(-2px); } }
@keyframes avatarIdle { 50% { transform: translateY(-2px); } }

/* ---------- sala de agentes: un puesto por agente (qué hace, en qué, cuota) ---------- */
.agents-zone { --c: var(--holo); position: relative; margin-top: 6px; padding: 34px 8px 8px; border-radius: 10px;
  background: repeating-conic-gradient(var(--floor) 0 25%, var(--floor2) 0 50%) 0 0 / 22px 22px;
  box-shadow: inset 0 0 0 3px var(--wall), inset 0 8px 0 var(--wall), inset 0 0 0 5px color-mix(in srgb, var(--c) 40%, transparent); }
.agents-zone .plaque { gap: 8px; }
.agents-zone .plaque .btn { margin: 0; padding: 2px 10px; }
.agents-zone .plaque .btn .n { background: var(--yellow-btn); color: #111; border-radius: 999px; padding: 0 6px; font-size: var(--fs-xs); }
.zone-legend { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ws-row { display: flex; align-items: flex-end; justify-content: center; gap: 10px; overflow-x: auto; padding: 4px 2px 2px; }
.ws-row .deco-item { position: relative; flex: none; }
.ws-row .deco-item .sprite { max-height: 44px; width: auto; }
.ws { position: relative; flex: 0 1 160px; min-width: 112px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 6px 6px;
  background: color-mix(in srgb, var(--panel) 60%, transparent); border: 1px solid var(--line); border-radius: var(--r-sm); color: inherit; font: inherit; cursor: pointer; transition: border-color .12s, transform .1s; }
.ws:hover { border-color: var(--yellow); transform: translateY(-2px); }
.ws .who { height: 38px; display: flex; align-items: flex-end; position: relative; margin-bottom: -4px; z-index: 2; }
.ws .who .sprite { max-height: 38px; width: auto; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); }
.ws > .sprite { max-height: 30px; width: auto; }
.ws-name { font-weight: 600; font-size: var(--fs-sm); margin-top: 2px; }
.ws-what { font-size: var(--fs-xs); color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-what em { font-style: normal; font-weight: 600; color: var(--text); }
.ws-quota { width: 70%; height: 4px; margin-top: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.ws-quota i { display: block; height: 100%; }
.ws-tok { font-size: var(--fs-xs); color: var(--muted); }
.ws-en_curso { border-color: color-mix(in srgb, var(--green) 55%, var(--line)); }
.ws-en_curso .ws-what { color: var(--text); }
.ws-en_curso .who .sprite { animation: avatarIdle 1s steps(2) infinite alternate; } /* solo se mueve quien trabaja */
.ws-esperando { border-color: var(--yellow); }
.ws-esperando .ws-what { color: var(--yellow); }
.ws-sleeping { opacity: .75; }
.ws-sleeping .who .sprite { filter: grayscale(1) brightness(.7); }
.ws-me { border-style: dashed; }
.lim-badge { font: 600 var(--fs-xs) var(--f-body); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line2); background: var(--panel2); display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; line-height: 1.1; }
.lim-badge.ok { border-color: var(--green); color: var(--green); }
.lim-badge.warn { border-color: var(--yellow); color: var(--yellow); }
.lim-badge.bad { border-color: var(--red); color: var(--red); }
.lim-badge.off { border-color: var(--line); color: var(--muted); }

.deco-item { position: absolute; pointer-events: auto; z-index: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5)); transition: transform 0.15s ease, filter 0.15s ease; }
.deco-item:hover { transform: scale(1.1); }
.deco-interactive { cursor: pointer; outline: none; }
.deco-interactive:hover, .deco-interactive:focus-visible {
  transform: scale(1.18) translateY(-2px);
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.7)) brightness(1.2);
  z-index: 8;
}
.deco-interactive:focus-visible { outline: 1px dashed var(--yellow); }
.interact-pop { animation: interactHop 0.25s steps(2); }
@keyframes interactHop { 50% { transform: scale(1.3) translateY(-4px); } }

.deco-bubble {
  position: absolute; bottom: 105%; left: 50%; transform: translateX(-50%);
  background: var(--panel); color: var(--text); border: 1px solid var(--line2);
  box-shadow: var(--shadow);
  font: 600 var(--fs-xs) var(--f-body); padding: 4px 8px; white-space: nowrap; pointer-events: none; border-radius: 6px;
  z-index: 40; border-radius: 2px;
  animation: decoBubbleFade 2.4s ease forwards;
}
@keyframes decoBubbleFade {
  0% { opacity: 0; transform: translate(-50%, 6px) scale(0.85); }
  12% { opacity: 1; transform: translate(-50%, -4px) scale(1); }
  82% { opacity: 1; transform: translate(-50%, -4px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -14px) scale(0.9); }
}

.deco-gonk:hover { animation: gonkWiggle 0.35s ease infinite; }
@keyframes gonkWiggle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px) rotate(1.5deg); }
}

.room-rug { position: absolute; top: 40px; left: 10px; right: 10px; bottom: 8px; border-radius: 8px; pointer-events: none; z-index: 0; opacity: .85; }
.rug-doc {
  background: repeating-linear-gradient(0deg, rgba(79,195,247,0.06) 0 12px, transparent 12px 24px),
              repeating-linear-gradient(90deg, rgba(79,195,247,0.06) 0 12px, transparent 12px 24px),
              radial-gradient(ellipse at center, rgba(79, 163, 255, 0.22) 0%, transparent 75%);
  border: 1px solid rgba(79, 163, 255, 0.45);
  box-shadow: inset 0 0 12px rgba(79, 163, 255, 0.15);
}
.rug-dev {
  background: repeating-linear-gradient(45deg, rgba(255,140,66,0.12) 0 8px, transparent 8px 16px),
              radial-gradient(ellipse at center, rgba(255, 122, 26, 0.25) 0%, transparent 75%);
  border: 1px dashed rgba(255, 122, 26, 0.5);
  box-shadow: inset 0 0 15px rgba(255, 122, 26, 0.15);
}
.rug-ana {
  background: repeating-radial-gradient(circle at center, rgba(61,220,132,0.12) 0 2px, transparent 2px 20px),
              radial-gradient(ellipse at center, rgba(61,220,132,0.2) 0%, transparent 75%);
  border: 1px solid rgba(61,220,132,0.45);
  box-shadow: inset 0 0 14px rgba(61,220,132,0.15);
}
.more-rooms-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-top: 12px; }
.more-room-card { background: var(--panel2); border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: var(--r); padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; color: var(--text); font: var(--fs-md) var(--f-body); text-align: left; }
.more-room-card:hover { border-color: var(--yellow); border-top-color: var(--c); }
.agent-head { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.agent-head .sprite { max-height: 64px; width: auto; filter: drop-shadow(0 4px 10px color-mix(in srgb, var(--c) 45%, transparent)); }
.more-room-card .card-head { display: flex; align-items: center; gap: 8px; }
.more-room-card .card-head b { font: 600 var(--fs-md) var(--f-body); color: var(--text); }
.more-room-card .card-meta { font-size: var(--fs-xs); color: var(--muted); }
.consoles { display: flex; gap: 5px; flex-wrap: wrap; padding-top: 8px; }
.consoles .sprite { max-height: 20px; width: auto; }

/* ---------- tablas ---------- */
table.grid { width: 100%; border-collapse: collapse; }
table.grid th { font-size: var(--fs-sm); font-weight: 600; text-align: left; color: var(--muted); padding: 8px 6px; border-bottom: 2px solid var(--line); position: sticky; top: 0; background: var(--panel); }
table.grid td { padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid tr.click:hover td { background: var(--panel3); cursor: pointer; }
.table-wrap { overflow-x: auto; }

/* ---------- kanban ---------- */
.kanban { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.kcol-tabs { display: none; } /* solo en móvil */
.kcol { flex: 1 0 170px; min-width: 0; background: var(--kcol-bg); border: 1px solid var(--line); border-radius: 10px; min-height: 120px; display: flex; flex-direction: column; transition: flex-basis .12s; }
.kcol.over { border-color: var(--yellow); background: var(--kcol-over-bg); }
/* vacía: tira vertical con nombre y 0; al arrastrar encima se abre */
.kcol.empty { flex: 0 0 34px; }
.kcol.empty.over { flex-basis: 140px; }
.kcol.empty .kcol-head { writing-mode: vertical-rl; border-bottom: 0; padding: 8px 0; align-items: center; justify-content: flex-start; gap: 8px; }
.kcol.empty .kcol-body { display: none; }
.kcol.att { border-color: color-mix(in srgb, var(--orange) 55%, var(--line)); }
.kcol.att .kcol-head { color: var(--text); background: color-mix(in srgb, var(--orange) 14%, transparent); border-radius: 10px 10px 0 0; }
.kcol-head { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); padding: 3px 6px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; flex: none; }
.kcol-body { padding: 4px; display: flex; flex-direction: column; gap: 3px; flex: 1 1 0; min-height: 0; overflow-y: auto; }
.kcard {
  background: var(--panel2); border: 1px solid var(--line2); border-left: 3px solid var(--c, var(--line2)); border-radius: 6px;
  padding: 4px 6px; cursor: grab; display: flex; flex-direction: column; gap: 1px; flex: none;
}
.kcard:hover { border-color: var(--yellow); border-left-color: var(--c, var(--yellow)); }
.kcard.dragging { opacity: .4; }
.kmove { display: none; margin-top: 4px; padding: 4px 8px; font-size: var(--fs-sm); }
@media (pointer: coarse) { .kmove { display: block; } }
.kcard:focus-visible .kmove, .kcard:has(:focus-visible) .kmove { display: block; } /* mover con teclado */
.kcard a.t { display: block; color: inherit; text-decoration: none; }
.kcard .t { font-size: var(--fs-md); font-weight: 500; line-height: 1.25; margin: 1px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kcard .meta { display: flex; gap: 4px; flex-wrap: nowrap; align-items: center; font-size: var(--fs-xs); color: var(--muted); line-height: 1.25; overflow: hidden; white-space: nowrap; }
.kcard .meta .sprite { max-height: 12px; max-width: 12px; flex-shrink: 0; }
.kcard .chip { font-size: var(--fs-xs); padding: 0 5px; line-height: 15px; border-width: 1px; }
.drawer .kanban { min-height: 460px; }
.drawer .kcol { min-height: 380px; }
.drawer .kcol-body { max-height: calc(100vh - 240px); }

/* ---------- consola / chat ---------- */
.console { background: #0b0d11; color: #c9d4e3; font: 12.5px/1.55 var(--f-mono); padding: 12px 14px; height: 380px; overflow: auto; white-space: pre-wrap; word-break: break-word; border: 1px solid var(--line); border-radius: var(--r); }
.console.fullscreen {
  position: fixed; inset: 12px; z-index: 1000; height: calc(100vh - 24px) !important; max-height: none !important;
  box-shadow: 0 0 0 1px var(--line2), 0 12px 40px rgba(0,0,0,0.6);
}
.console .w { color: #f0b35a; } .console .s { color: #7cc0ff; } .console .e { color: #b3bcff; }
.diff-file { margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--panel2); }
.diff-file summary { padding: 8px 12px; font: 600 var(--fs-md) var(--f-body); cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--panel3); user-select: none; }
.diff-file summary:hover { background: var(--panel); }
.diff-file .diff-body { margin: 0; padding: 10px; max-height: 520px; overflow: auto; border: 0; border-top: 1px solid var(--line); font-family: var(--f-mono); font-size: 12.5px; background: #0b0d11; color: #c9d4e3; }
.station-kanban-box.collapsed .kanban, .station-kanban-box.collapsed .kcol-tabs { display: none !important; }
.station-kanban-box.collapsed { padding-bottom: 4px; }
.chat { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow: auto; padding: 6px; }
.chat { gap: 14px; }
.msg { max-width: 92%; padding: 2px; line-height: 1.6; }
.msg.usuario { align-self: flex-end; max-width: 80%; background: var(--panel3); border-radius: 14px 14px 4px 14px; padding: 9px 13px; }
.msg.agente { align-self: flex-start; }
.msg.sistema { align-self: center; color: var(--muted); font-size: var(--fs-sm); max-width: 95%; background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; }
.msg.sistema .who { display: none; }
.msg.consulta { border-left: 3px solid var(--orange); padding-left: 12px; }
.msg .who { font-size: var(--fs-xs); color: var(--muted); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.msg pre { background: #0b0d11; color: #c9d4e3; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; overflow: auto; margin: 8px 0; }
.msg p { margin: 0 0 6px; white-space: pre-wrap; word-break: break-word; }
.perm { border: 1px solid color-mix(in srgb, var(--red) 55%, transparent); background: var(--perm-bg); padding: 10px; }
.cantina { display: grid; grid-template-columns: 240px 1fr; gap: 14px; }
.chat-list { max-height: 75vh; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.chat-item { padding: 9px 10px; border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; cursor: pointer; }
.chat-item:hover { background: var(--panel2); } .chat-item.on { background: var(--panel3); border-color: var(--line2); }
button.chat-item { display: block; width: 100%; text-align: left; font: inherit; color: inherit; }
.chat-item a, .inbox-item a, tr.click a { color: inherit; text-decoration: none; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { font: 500 var(--fs-md) var(--f-body); background: none; color: var(--muted); border: 0; border-bottom: 2px solid transparent; margin-bottom: -2px; padding: 8px 12px; cursor: pointer; }
.tabs button.on { color: var(--text); border-bottom-color: var(--yellow); }
.tabs button:hover { color: var(--text); }

/* ---------- puente ---------- */
.agent-card { border-color: color-mix(in srgb, var(--c) 35%, var(--line)); }
.limit { display: grid; grid-template-columns: 110px 1fr 70px; gap: 8px; align-items: center; font-size: var(--fs-md); margin: 4px 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; font-size: var(--fs-md); }
.kv b { color: var(--muted); font-weight: normal; }
.spark { display: flex; gap: 1px; align-items: flex-end; height: 40px; background: var(--spark-bg); padding: 2px; }
.spark i { flex: 1; background: var(--c, var(--holo)); min-width: 2px; }

/* ---------- consejo ---------- */
.matrix { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; gap: 8px; }
.matrix .q { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px; min-height: 120px; }
.matrix .q h3 { margin-top: 0; }
.prop { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px; }
.prop.convertida, .prop.aceptada { border-color: var(--green); } .prop.descartada { opacity: .5; } .prop.pospuesta { border-style: dashed; }
.votes { font: 600 var(--fs-sm) var(--f-body); color: var(--yellow); }

/* ---------- diálogos / paleta / hologramas / bandeja ---------- */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line2); border-radius: 14px; box-shadow: 0 24px 64px rgba(0,0,0,.45); padding: 22px; width: min(96vw, 760px); max-height: 92vh; }
dialog[open] { animation: pop-in .16s ease-out; }
dialog::backdrop { background: var(--dialog-backdrop); backdrop-filter: blur(3px); }
.palette { width: min(94vw, 580px); padding: 0; margin-top: 12vh; border-top-width: 1px; overflow: hidden; }
.palette input { border: 0; border-bottom: 2px solid var(--line); padding: 14px 16px; font-size: 16px; background: transparent; }
.palette input:focus-visible { outline: none; }
#palList { max-height: 50vh; overflow: auto; padding: 6px; }
.pal-item { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; cursor: pointer; border-radius: var(--r-sm); }
.pal-item.on, .pal-item:hover { background: var(--panel3); }
.pal-item.on span { color: var(--text); font-weight: 500; }
.holo-wrap { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 10px; z-index: 50; width: min(92vw, 360px); }
.holo { background: var(--holo-toast-bg); border: 1px solid var(--line2); border-left: 3px solid var(--holo); border-radius: var(--r); box-shadow: var(--shadow); color: var(--holo-toast-text); padding: 10px 14px; animation: holo-in .2s ease-out; }
.holo b { font-size: var(--fs-md); font-weight: 600; color: var(--holo-toast-title); display: block; margin-bottom: 3px; }
.holo.err { border-color: var(--red); background-color: var(--holo-err-bg); }
@keyframes holo-in { from { opacity: 0; transform: translateX(30px); } }
.inbox { position: fixed; top: 0; right: 0; bottom: 0; width: min(96vw, 420px); background: var(--drawer-bg); border-left: 1px solid var(--line); box-shadow: -24px 0 60px rgba(0,0,0,.45); z-index: 35; padding: 16px 16px 90px; overflow: auto; animation: drawer-in .2s ease-out; }
.inbox-item { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 10px; margin: 6px 0; cursor: pointer; background: var(--panel2); }
.inbox-reply { display: flex; gap: 6px; margin-top: 8px; }
.inbox-reply input { padding: 5px 8px; font-size: var(--fs-md); }
.perm { border-radius: var(--r-sm); }
.inbox-item:hover { border-color: var(--line2); background: var(--panel3); }
.empty { color: var(--muted); padding: 20px; text-align: center; }

/* ---------- selector de tema ---------- */
.theme-picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 12px 0 16px; }
.theme-card {
  display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 2px solid var(--line); border-radius: var(--r);
  background: var(--panel2); cursor: pointer; transition: border-color .15s, box-shadow .15s; position: relative;
}
.theme-card:hover { border-color: var(--yellow); }
.theme-card.on { border-color: var(--yellow); box-shadow: 0 0 0 3px var(--ring); background: var(--panel); }
.theme-card b { font-weight: 600; font-size: var(--fs-md); color: var(--text); }
.theme-swatch { height: 52px; border: 1px solid var(--line2); border-radius: var(--r-sm); display: block; position: relative; overflow: hidden; margin-bottom: 4px; }
.theme-swatch.dark-swatch { background: #0e1014; }
.theme-swatch.dark-swatch::after { content: ''; position: absolute; right: 8px; bottom: 8px; width: 14px; height: 14px; background: #6b78f5; border-radius: 4px; box-shadow: -18px 0 0 #222731; }
.theme-swatch.light-swatch { background: #f5f6f8; }
.theme-swatch.light-swatch::after { content: ''; position: absolute; right: 8px; bottom: 8px; width: 14px; height: 14px; background: #4b57d6; border-radius: 4px; box-shadow: -18px 0 0 #e3e6eb; }
.avatar-card { align-items: center; text-align: center; }
.avatar-card .sprite { margin-bottom: 6px; }

/* ---------- adaptaciones y mejoras del tema crema / hueso ---------- */
[data-theme="blanco"] .rug-doc, [data-theme="crema"] .rug-doc { background: radial-gradient(ellipse at center, rgba(79, 163, 255, 0.2) 0%, transparent 75%); border-color: rgba(79, 163, 255, 0.5); }
[data-theme="blanco"] .rug-dev, [data-theme="crema"] .rug-dev { background: radial-gradient(ellipse at center, rgba(255, 122, 26, 0.2) 0%, transparent 75%); border-color: rgba(255, 122, 26, 0.5); }
[data-theme="blanco"] .rug-ana, [data-theme="crema"] .rug-ana { background: radial-gradient(ellipse at center, rgba(43, 138, 62, 0.15) 0%, transparent 75%); border-color: rgba(43, 138, 62, 0.4); }
[data-theme="blanco"] .st-bloqueada, [data-theme="crema"] .st-bloqueada { border-color: #9c8e7e; color: #665747; }
[data-theme="blanco"] .st-pausada_cuota, [data-theme="crema"] .st-pausada_cuota { border-color: #8b5cf6; color: #7c3aed; }
[data-theme="blanco"] .desk.free, [data-theme="crema"] .desk.free { opacity: .45; }
[data-theme="blanco"] .plaque b, [data-theme="crema"] .plaque b { color: color-mix(in srgb, var(--c) 40%, var(--text)); }

@media (max-width: 820px) {
  .map { padding: 10px 8px calc(84px + env(safe-area-inset-bottom)); overflow-y: auto; overflow-x: hidden; }
  .floor { padding: 6px; box-shadow: 0 0 0 2px #000, 0 0 0 5px var(--wall); }
  .wing { gap: 6px; }
  .room2 {
    flex: 1 1 calc(50% - 6px); min-width: 135px; min-height: 140px; padding: 30px 6px 6px;
    background-size: 20px 20px;
    box-shadow: inset 0 0 0 3px var(--wall), inset 0 6px 0 var(--wall), inset 0 0 0 4px color-mix(in srgb, var(--c) 35%, transparent);
  }
  .room2:hover { box-shadow: inset 0 0 0 3px var(--wall), inset 0 8px 0 var(--wall), inset 0 0 0 5px var(--c); }
  .room2::after { width: 30px; margin-left: -15px; height: 4px; }
  .plaque { top: 4px; left: 6px; right: 6px; gap: 4px; padding: 2px 4px; }
  .plaque b { font: 600 var(--fs-sm) var(--f-body); white-space: nowrap; flex: none; } /* la pixel no cabe legible en la placa angosta */
  .plaque small { display: none; }
  .plaque .pend { display: inline-block !important; font-size: var(--fs-xs); background: rgba(0,0,0,.6); padding: 0 4px; }
  .plaque .right { margin-left: auto; }
  [data-theme="blanco"] .plaque .pend, [data-theme="crema"] .plaque .pend { background: rgba(255,255,255,.8); color: var(--text); }
  .zone-legend { display: none; }
  .ws-row { justify-content: flex-start; }
  .ws { flex: 0 0 116px; }
  .desks2 { gap: 6px 8px; justify-content: center; padding: 24px 4px 6px; }
  .desk { width: 64px; }
  .desk .who { height: 32px; margin-bottom: -3px; }
  .desk .who .sprite { max-height: 32px; }
  .desk > .sprite { max-height: 25px; }
  .desk .lbl { max-width: 64px; font-size: var(--fs-xs); -webkit-line-clamp: 1; margin-top: 1px; }
  .consoles { gap: 5px; padding-top: 6px; justify-content: center; }
  .wall { min-height: 28px; gap: 4px; }
  .wall .sprite { max-height: 22px; }
  .station-aside, .station-tab-btn { display: none !important; }
  .station-layout { display: flex; flex-direction: column; gap: 8px; }
  .station-top-row { display: block; }
  .station-kanban-box { padding: 6px 8px; margin-top: 4px; }
  .station-kanban-head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: min(84vw, 300px); z-index: 60; transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow); }
  body.side-open .side { transform: none; }
  body.side-open::after { content: ''; position: fixed; inset: 0; background: var(--dialog-backdrop); z-index: 55; }
  .drawer main { padding: 16px 14px calc(84px + env(safe-area-inset-bottom)); }
  .map-bar { flex-wrap: wrap; padding: 8px 10px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); }
  .tabbar > a, .tabbar > button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border: 0; background: none; color: var(--muted); font: 500 var(--fs-xs) var(--f-body); text-decoration: none; cursor: pointer; position: relative; border-radius: var(--r-sm); }
  .tabbar [aria-current] { color: var(--text); } .tabbar [aria-current] .ic { color: var(--yellow); }
  .tabbar .tab-y .ic { background: var(--yellow-btn); color: var(--on-accent); border-radius: 9px; width: 34px; height: 26px; padding: 4px 8px; }
  .tabbar .n { position: absolute; top: 2px; left: calc(50% + 6px); background: var(--red); color: #fff; font: 600 10px/15px var(--f-body); min-width: 15px; height: 15px; border-radius: 999px; padding: 0 3px; }
  .holo-wrap { bottom: calc(78px + env(safe-area-inset-bottom)); }
  .cantina { grid-template-columns: 1fr; }
  .kcol { flex-basis: 82vw; scroll-snap-align: start; }
  .kanban { scroll-snap-type: x mandatory; }
  .kcol-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin-bottom: 6px; }
  .kcol-tabs button { flex: none; font: 500 var(--fs-sm) var(--f-body); color: var(--text); background: var(--panel3); border: 1px solid var(--line2); border-radius: 999px; padding: 4px 10px; min-height: 28px; }
  .matrix { grid-template-columns: 1fr; }
}

@media (min-width: 821px) {
  /* la estación ocupa toda la altura en cualquier pantalla: salas y tablero reparten el espacio con mínimos;
     solo si la pantalla no alcanza esos mínimos aparece scroll */
  .map {
    height: auto;
    padding: 12px 16px 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }
  .station-layout {
    flex: 1 1 0;
    min-height: 680px; /* = mínimos de la fila de salas + tablero */
    width: 100%;
    max-width: 1760px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
  }
  .station-top-row { /* mapa 2,2 : tablero 1,3 */
    flex: 2.2 1 0;
    min-height: 420px; /* salas de al menos ~240 px + sala de agentes */
    display: flex;
    gap: 8px;
    align-items: stretch;
    width: 100%;
  }
  .station-main {
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  .station-main .floor {
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 6px 8px;
  }
  .station-main .wing {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    gap: 6px;
  }
  .station-main .agents-zone { flex: none; }
  .station-main .room2 {
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  .station-main .desks2 {
    flex: 1 1 0;
    min-height: 0;
    padding-top: 4px;
  }
  .station-aside {
    width: 320px;
    flex: none;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .station-aside-body {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
  }
  .station-kanban-box {
    flex: 1.3 1 0;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    padding: 5px 8px 6px;
  }
  .station-kanban-box.collapsed { flex: none; min-height: 0; } /* oculto: las salas se quedan con el alto */
  .station-kanban-head {
    flex: none;
    margin-bottom: 3px;
    padding-bottom: 2px;
  }
  .station-kanban-box .kanban {
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
  }
  .station-kanban-box .kcol {
    height: 100%;
    min-height: 0;
    max-height: none;
    display: flex;
    flex-direction: column;
  }
  .station-kanban-box .kcol-head {
    flex: none;
    padding: 2px 6px;
    font-size: var(--fs-xs);
  }
  .station-kanban-box .kcol-body {
    flex: 1 1 0;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    padding: 3px;
    display: flex;
    flex-direction: column;
    gap: 3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
  .deco-bubble { animation: none !important; opacity: 1; transform: translateX(-50%); }
}

/* Repositorios (encima de Ejecuciones) */
.repo-box { flex: none; max-height: 55%; display: flex; flex-direction: column; border-bottom: 1px solid var(--line); }
.repo-body { overflow-y: auto; padding: 4px; display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.repo { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 8px; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); }
.repo .run-meta { font-size: var(--fs-xs); color: var(--muted); }
.repo-kv { display: grid; grid-template-columns: max-content 1fr; gap: 3px 8px; align-items: center; font-size: var(--fs-xs); }
.repo-kv > span { color: var(--muted); }
.repo-kv > b { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.repo-kv .btn { margin: 0; }
.repo-page { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px; padding: 0; }
.repo-br { border-top: 1px dashed var(--line); padding-top: 4px; display: flex; flex-direction: column; gap: 2px; }
.repo-br a { color: var(--text); text-decoration: none; font-size: var(--fs-xs); }
.repo-br a:hover { color: var(--yellow); }
.repo-br .btn { align-self: flex-start; }

/* tarea: metadatos como texto (solo el modo Editar va resaltado) y acciones poco usadas en «⋯ Más» */
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0; font-size: var(--fs-md); color: var(--muted); }
.task-meta b { color: var(--text); font-weight: 600; }
.task-meta .sprite { vertical-align: middle; }
.more-menu { position: relative; }
.more-menu > summary { list-style: none; }
.more-menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; z-index: 6; top: calc(100% + 4px); left: 0; min-width: 190px; display: flex; flex-direction: column; padding: 4px; background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r-sm); box-shadow: var(--shadow); }
.menu-pop .btn { justify-content: flex-start; }

/* formularios: lo secundario plegado */
details.opts { margin: 12px 0 4px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; }
details.opts > summary { cursor: pointer; font-size: var(--fs-md); color: var(--muted); }
details.opts[open] > summary { margin-bottom: 4px; }
.check-list { max-height: 150px; overflow-y: auto; border: 1px solid var(--line2); border-radius: var(--r-sm); padding: 4px 8px; background: var(--input-bg); font-size: var(--fs-md); }
.check-list label { padding: 2px 0; }

/* Harness de agentes */
.hx-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.hx-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hx-card { display: flex; flex-direction: column; gap: 3px; text-align: left; width: 100%; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: inherit; cursor: pointer; font: inherit; }
.hx-card:hover, .hx-card.on { border-color: var(--yellow); }
.hx-card small { opacity: .75; }
.hx-prev { font-size: var(--fs-sm, 12px); opacity: .85; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hx-ctx { display: flex; align-items: center; gap: 6px; }
.hx-bar { flex: 1; height: 6px; min-width: 60px; background: var(--panel3); border-radius: 3px; overflow: hidden; }
.hx-bar i { display: block; height: 100%; background: var(--green); }
.hx-ctx.mid .hx-bar i { background: var(--orange); }
.hx-ctx.hi .hx-bar i { background: var(--red); }
.hx-ctx.est .hx-bar i { background: var(--muted) !important; }

/* ---------- identidad «consola de control»: rótulos y datos en mono, chips rectos, medidor segmentado ---------- */
h1 { font: 600 22px/1.25 var(--f-body); letter-spacing: -.02em; }
h2 { font-weight: 600; letter-spacing: -.01em; }
h3, .lbl-up, label.l, div.l, table.grid th, .kcol-head, .menu-sep, .station-kanban-head b { font-family: var(--f-mono); font-weight: 500; font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
label.l, div.l { margin: 14px 0 6px; }
.chip { font: 500 11px/1.6 var(--f-mono); border-radius: 3px; padding: 0 7px; background: transparent; letter-spacing: .01em; }
.btn { border-radius: var(--r-sm); font-weight: 500; letter-spacing: -.005em; }
.btn.y { font-weight: 600; }
.panel { border-radius: var(--r); }
.msg .who { font: 500 10.5px var(--f-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.msg.usuario { border-radius: var(--r) var(--r) 2px var(--r); }
.holo { border-left-color: var(--yellow-btn); border-radius: var(--r-sm); }
dialog { border-radius: var(--r); }
small, .muted { letter-spacing: .005em; }
.tabs button { font-weight: 500; }
.tabs button.on { border-bottom-color: var(--yellow-btn); }
.kcard { border-radius: var(--r-sm); }
.kcol { border-radius: var(--r); }
.chat-item small, .run-meta, .ws-tok, .hx-card small { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .02em; }
/* tarjetas de chat del harness */
.hx-grid { gap: 12px; }
.hx-col { gap: 8px; }
.hx-col > h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; }
.hx-card { border-radius: var(--r-sm); padding: 11px 12px; background: var(--panel); border-color: var(--line); gap: 5px; transition: border-color .12s, background .12s; }
.hx-card:hover { border-color: var(--line2); background: var(--panel2); }
.hx-card.on { border-color: var(--yellow-btn); background: var(--panel2); box-shadow: inset 3px 0 0 var(--yellow-btn); }
.hx-card b { font-weight: 600; letter-spacing: -.01em; }
.hx-prev { color: var(--muted); opacity: 1; }
/* medidor de contexto: segmentos, como un instrumento */
.hx-bar { height: 7px; border-radius: 0; background: repeating-linear-gradient(90deg, var(--panel3) 0 5px, transparent 5px 7px); }
.hx-bar i { border-radius: 0; background: repeating-linear-gradient(90deg, var(--green) 0 5px, transparent 5px 7px) !important; }
.hx-ctx.mid .hx-bar i { background: repeating-linear-gradient(90deg, var(--orange) 0 5px, transparent 5px 7px) !important; }
.hx-ctx.hi .hx-bar i { background: repeating-linear-gradient(90deg, var(--red) 0 5px, transparent 5px 7px) !important; }
.hx-ctx.est .hx-bar i { background: repeating-linear-gradient(90deg, var(--faint) 0 5px, transparent 5px 7px) !important; }
.hx-ctx small { font: 500 10.5px var(--f-mono); color: var(--muted); white-space: nowrap; }
.saber .track { border-radius: 0; background: repeating-linear-gradient(90deg, var(--panel3) 0 5px, transparent 5px 7px); }
.saber .blade { border-radius: 0; background: repeating-linear-gradient(90deg, var(--c, var(--yellow-btn)) 0 5px, transparent 5px 7px); }
/* cabecera de página: rótulo mono encima del título */
.drawer main > h1:first-child, .drawer main > .row:first-child h1 { margin-bottom: 18px; }
.drawer main > p.muted:first-of-type { max-width: 72ch; }
h1 > .ic { display: none; }

/* ---------- toque terminal: títulos y navegación en mono con prompt, rejilla de puntos y brillo de fósforo; el texto largo sigue en Plex Sans ---------- */
h1 { font: 600 21px/1.25 var(--f-mono); letter-spacing: -.03em; }
h1::before { content: '>'; color: var(--yellow); margin-right: 10px; font-weight: 500; text-shadow: 0 0 10px color-mix(in srgb, var(--yellow) 55%, transparent); }
h2 { font-family: var(--f-mono); letter-spacing: -.02em; }
.login-box h1::before { content: none; }
.side a.nav, .side button.nav, .me-btn { font-family: var(--f-mono); font-size: 13px; letter-spacing: -.01em; }
.side a.nav[aria-current] { color: var(--yellow); }
.side a.nav[aria-current]::after { content: '_'; margin-left: 1px; animation: blink 1.1s steps(1) infinite; }
.brand-cursor { box-shadow: 0 0 12px color-mix(in srgb, var(--yellow-btn) 70%, transparent); }
.btn.y { font-family: var(--f-mono); font-size: 12.5px; letter-spacing: -.01em; box-shadow: 0 0 0 1px color-mix(in srgb, var(--yellow-btn) 40%, transparent), 0 0 18px color-mix(in srgb, var(--yellow-btn) 18%, transparent); }
.drawer, .map { background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--text) 7%, transparent) 1px, transparent 0); background-size: 22px 22px; }
.hx-card b, .chat-item b, .kcard .t { font-family: var(--f-mono); font-size: 13px; letter-spacing: -.02em; }
.lbl-up.live::before { content: '● '; color: var(--green); animation: blink 1.6s ease-in-out infinite; }
::selection { background: var(--yellow-btn); color: var(--on-accent); }
[data-theme="blanco"] h1::before, [data-theme="crema"] h1::before { text-shadow: none; }

/* harness: 4 columnas lado a lado, cada una con su propio scroll y el nombre del agente fijo arriba */
@media (min-width: 1100px) { .hx-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.hx-col { max-height: max(420px, calc(100vh - 230px)); overflow-y: auto; overscroll-behavior: contain; padding-top: 0; }
.hx-col > h3 { position: sticky; top: 0; z-index: 1; background: var(--panel); margin: 0 -16px 4px; padding: 14px 16px 8px; border-bottom: 1px solid var(--line); }
@media (max-width: 820px) { .hx-col { max-height: 62vh; } }
