/* JotaJota Office Network R5 · interfaz de las ocho oficinas */
:root {
  --jj-bg: #080d18;
  --jj-panel: rgba(17, 26, 43, .94);
  --jj-panel-2: rgba(25, 37, 58, .92);
  --jj-line: rgba(123, 167, 222, .18);
  --jj-text: #edf4ff;
  --jj-muted: #91a2bb;
  --jj-cyan: #54d9f4;
  --jj-violet: #a78bfa;
  --jj-blue: #60a5fa;
  --jj-amber: #fbbf24;
  --jj-pink: #f472b6;
  --jj-green: #4ade80;
  --jj-orange: #fb923c;
  --jj-red: #fb7185;
}
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--jj-bg); color: var(--jj-text); }
body { display: block; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
#app-container.jj-office-app { position: relative; isolation: isolate; display: block; width: 100%; max-width: none; height: 100dvh; max-height: 100dvh; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at 50% 42%, #15233b 0, #0b1424 48%, #080d18 100%); }
#oficina.jj-office-dashboard { position: relative; display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 0; flex: none; overflow: hidden; padding: clamp(12px, 2.2vw, 28px) clamp(12px, 3vw, 42px) 14px; background: transparent; }
.jj-office-dashboard::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .12; background-image: linear-gradient(rgba(142,180,230,.13) 1px, transparent 1px), linear-gradient(90deg, rgba(142,180,230,.13) 1px, transparent 1px); background-size: 44px 44px; mask-image: linear-gradient(to bottom, black, transparent 88%); }
.jj-office-topbar, .jj-office-heading, .jj-network-stage, .jj-office-bottomline { position: relative; z-index: 1; }
.jj-office-topbar { display: flex; align-items: center; gap: 16px; min-height: 54px; padding-bottom: 10px; border-bottom: 1px solid var(--jj-line); }
.jj-brand { display: flex; align-items: center; gap: 11px; min-width: 210px; }
.jj-brand-mark { width: 42px; height: 42px; overflow: hidden; flex: 0 0 auto; border-radius: 13px; background: linear-gradient(145deg, #173b53, #192445); border: 1px solid rgba(84,217,244,.32); box-shadow: 0 0 24px rgba(84,217,244,.12); }
.jj-brand-mark img { width: 100%; height: 100%; object-fit: contain; object-position: center 20%; }
.jj-brand-copy { display: flex; flex-direction: column; gap: 3px; line-height: 1; }
.jj-brand-copy strong { font-size: 15px; letter-spacing: .13em; font-weight: 850; }
.jj-brand-copy strong span { color: var(--jj-cyan); }
.jj-brand-copy small { color: #8296b3; font-size: 9px; letter-spacing: .12em; }
.jj-topbar-status { display: flex; align-items: center; gap: 8px; margin-left: auto; color: #b4c5dc; font-size: 11px; white-space: nowrap; }
.jj-live-dot, .jj-network-pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #67e8a5; box-shadow: 0 0 0 4px rgba(103,232,165,.1), 0 0 14px rgba(103,232,165,.55); }
.jj-office-controls { display: flex; flex-direction: row; align-items: center; gap: 6px; padding: 0; border: 0; background: none; }
.jj-office-controls button { width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(154,181,218,.2); border-radius: 10px; background: rgba(23,37,59,.7); color: #dceaff; cursor: pointer; font-size: 14px; transition: background .18s, transform .18s, border-color .18s; }
.jj-office-controls button:hover { background: rgba(57,86,126,.65); border-color: rgba(84,217,244,.55); transform: translateY(-1px); }
.jj-office-controls button:focus-visible, .jj-office-card:focus-visible, .jj-chat-launcher:focus-visible { outline: 2px solid var(--jj-cyan); outline-offset: 3px; }
#btn-llama-ai { color: var(--jj-cyan); }
#btn-llama-ai.is-active { opacity: 1; border-color: rgba(84,217,244,.8); background: linear-gradient(135deg, rgba(0,145,184,.62), rgba(66,82,180,.55)) !important; box-shadow: 0 0 15px rgba(84,217,244,.2); }
#btn-cerebro { color: #f6c879; }
.jj-office-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: clamp(14px, 2.4vh, 24px) 0 clamp(10px, 1.8vh, 18px); }
.jj-office-heading > div:first-child { max-width: 760px; }
.jj-eyebrow { margin: 0 0 7px; color: var(--jj-cyan); font-size: 9px; font-weight: 800; letter-spacing: .2em; }
.jj-office-heading h1 { margin: 0; color: #f4f8ff; font-size: clamp(19px, 2.3vw, 29px); line-height: 1.12; letter-spacing: -.035em; font-weight: 760; }
.jj-office-subtitle { max-width: 780px; margin: 7px 0 0; color: #8fa2bd; font-size: clamp(10px, 1.05vw, 12px); line-height: 1.5; }
.jj-network-pill { display: flex; flex: 0 0 auto; align-items: center; gap: 9px; padding: 9px 12px; border: 1px solid rgba(84,217,244,.22); border-radius: 999px; background: rgba(19,45,66,.46); color: #b8d8ec; font-size: 9px; letter-spacing: .12em; white-space: nowrap; }
.jj-network-pill b { color: #557b9b; font-size: 11px; }
.jj-network-pulse { width: 6px; height: 6px; }
.jj-network-stage { flex: 1 1 auto; min-height: 0; display: flex; align-items: stretch; justify-content: center; padding: 2px 0 4px; }
.jj-office-grid { position: relative; z-index: 1; isolation: isolate; width: min(100%, 1120px); height: 100%; max-height: 760px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); gap: clamp(8px, 1.4vw, 16px); }
.jj-network-lines { position: absolute; z-index: 0; inset: 0; width: 100%; height: 100%; overflow: visible; }
.jj-network-lines path { fill: none; stroke: rgba(84,217,244,.24); stroke-width: 2; stroke-dasharray: 7 9; vector-effect: non-scaling-stroke; }
.jj-network-lines circle { fill: rgba(84,217,244,.28); stroke: rgba(84,217,244,.8); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.jj-office-card { --office-accent: #54d9f4; position: relative; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; min-height: 0; overflow: hidden; padding: clamp(8px, 1.1vw, 14px); text-align: left; color: var(--jj-text); border: 1px solid rgba(144,177,221,.22); border-radius: 15px; background: linear-gradient(145deg, rgba(18,34,54,.96), rgba(11,19,34,.98)); box-shadow: 0 12px 28px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.04); cursor: pointer; transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; }
.jj-office-card::before { content: ""; position: absolute; inset: 0; z-index: -2; background: linear-gradient(180deg, rgba(7,15,28,.12), rgba(7,15,28,.8)), url('../img/oficina.png') center 44% / cover no-repeat; opacity: .31; transform: scale(1.02); }
.jj-office-card::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(circle at 78% 12%, color-mix(in srgb, var(--office-accent) 19%, transparent), transparent 42%); }
.jj-office-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--office-accent) 65%, white 5%); box-shadow: 0 15px 34px rgba(0,0,0,.3), 0 0 20px color-mix(in srgb, var(--office-accent) 11%, transparent); }
.jj-office-card.is-selected { border-color: var(--office-accent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--office-accent) 35%, transparent), 0 0 22px color-mix(in srgb, var(--office-accent) 17%, transparent); }
.jj-office-card.is-running { border-color: color-mix(in srgb, var(--office-accent) 75%, white 5%); }
.jj-office-card.is-running .jj-agent-avatar { animation: jj-agent-working 1.35s ease-in-out infinite; }
@keyframes jj-agent-working { 0%,100% { transform: translateY(0); filter: drop-shadow(0 0 8px color-mix(in srgb, var(--office-accent) 25%, transparent)); } 50% { transform: translateY(-4px); filter: drop-shadow(0 0 16px color-mix(in srgb, var(--office-accent) 60%, transparent)); } }
.jj-office-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 7px; }
.jj-agent-title-wrap { min-width: 0; }
.jj-agent-office-number { color: var(--office-accent); font-size: 8px; font-weight: 850; letter-spacing: .17em; }
.jj-agent-name { margin-top: 3px; overflow: hidden; color: #f3f7ff; font-size: clamp(10px, 1.12vw, 14px); font-weight: 760; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }
.jj-agent-subtitle { margin-top: 3px; overflow: hidden; color: #8fa5c1; font-size: clamp(7px, .76vw, 9px); text-overflow: ellipsis; white-space: nowrap; }
.jj-agent-icon { display: grid; flex: 0 0 auto; place-items: center; width: 26px; height: 26px; border: 1px solid color-mix(in srgb, var(--office-accent) 35%, transparent); border-radius: 8px; background: color-mix(in srgb, var(--office-accent) 11%, transparent); color: var(--office-accent); font-size: 16px; }
.jj-office-card-main { display: flex; align-items: center; justify-content: center; flex: 1; min-height: 0; }
.jj-agent-avatar { display: flex; flex: 0 0 auto; align-items: flex-end; justify-content: center; width: clamp(56px, 8vw, 92px); height: clamp(65px, 11vh, 116px); max-width: 42%; overflow: visible; filter: drop-shadow(0 8px 12px rgba(0,0,0,.45)); }
.jj-agent-avatar-image { display: block; width: 100%; height: 100%; max-width: 100%; object-fit: contain; object-position: center bottom; image-rendering: pixelated; }
.jj-agent-character { display: block; margin-top: 4px; color: color-mix(in srgb, var(--office-accent) 82%, white 18%); font-size: 7px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jj-agent-brief { max-width: 56%; margin-left: 7px; color: #b7c5d8; font-size: clamp(7px, .8vw, 10px); line-height: 1.38; }
.jj-agent-brief strong { display: block; margin-bottom: 4px; color: var(--office-accent); font-size: 8px; letter-spacing: .08em; text-transform: uppercase; }
.jj-office-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 5px; padding-top: 6px; border-top: 1px solid rgba(153,178,215,.12); }
.jj-office-state { display: inline-flex; align-items: center; gap: 5px; min-width: 0; color: #91a4bd; font-size: 8px; }
.jj-office-state::before { content: ""; width: 5px; height: 5px; flex: 0 0 auto; border-radius: 50%; background: #7b8da6; }
.jj-office-card[data-state="running"] .jj-office-state::before { background: #69e5a8; box-shadow: 0 0 9px #69e5a8; }
.jj-office-card[data-state="done"] .jj-office-state::before { background: var(--office-accent); }
.jj-office-card[data-state="error"] .jj-office-state::before { background: #fb7185; }
.jj-office-task-count { color: #657e9e; font-size: 8px; white-space: nowrap; }
.jj-office-hub { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; min-height: 0; overflow: hidden; padding: 10px; border: 1px solid rgba(84,217,244,.5); border-radius: 18px; background: radial-gradient(circle at 50% 25%, rgba(46,122,160,.23), transparent 55%), linear-gradient(145deg, rgba(20,49,70,.98), rgba(10,21,39,.99)); box-shadow: 0 0 0 5px rgba(84,217,244,.035), 0 0 35px rgba(84,217,244,.14), inset 0 1px 0 rgba(255,255,255,.06); }
.jj-office-hub::before, .jj-office-hub::after { content: ""; position: absolute; width: 118%; height: 1px; top: 50%; background: linear-gradient(90deg, transparent, rgba(84,217,244,.35), transparent); }
.jj-office-hub::after { transform: rotate(90deg); }
.jj-hub-avatar-wrap { position: relative; z-index: 1; width: clamp(56px, 8vh, 82px); height: clamp(56px, 8vh, 82px); display: grid; place-items: center; overflow: hidden; border: 1px solid rgba(84,217,244,.45); border-radius: 50%; background: rgba(8,19,34,.86); box-shadow: 0 0 25px rgba(84,217,244,.16); }
.jj-hub-avatar-wrap img { height: 112%; width: auto; object-fit: contain; object-position: center top; transform: translateY(7%); }
.jj-hub-title { position: relative; z-index: 1; margin-top: 7px; color: white; font-size: clamp(9px, 1vw, 12px); font-weight: 850; letter-spacing: .1em; text-align: center; }
.jj-hub-subtitle { position: relative; z-index: 1; margin-top: 4px; color: #9cc8dc; font-size: 8px; text-align: center; }
.jj-hub-state { position: relative; z-index: 1; display: flex; align-items: center; gap: 5px; margin-top: 8px; padding: 4px 7px; border: 1px solid rgba(84,217,244,.2); border-radius: 999px; background: rgba(5,20,35,.65); color: #a8ddeb; font-size: 7px; letter-spacing: .1em; }
.jj-hub-state i { width: 5px; height: 5px; border-radius: 50%; background: #67e8a5; }
.jj-office-loading { grid-column: 1 / -1; grid-row: 1 / -1; display: grid; place-items: center; color: #a6b6cc; border: 1px dashed var(--jj-line); border-radius: 18px; }
.jj-office-bottomline { display: flex; align-items: center; gap: clamp(12px, 2.5vw, 34px); min-height: 48px; padding-top: 8px; border-top: 1px solid var(--jj-line); }
.jj-bottom-stat { display: flex; align-items: center; gap: 8px; }
.jj-bottom-icon { display: grid; place-items: center; width: 27px; height: 27px; border: 1px solid rgba(84,217,244,.18); border-radius: 9px; background: rgba(32,63,88,.36); color: var(--jj-cyan); font-size: 13px; }
.jj-bottom-stat b, .jj-bottom-stat small { display: block; }
.jj-bottom-stat b { color: #dce9f8; font-size: 10px; font-weight: 750; }
.jj-bottom-stat small { margin-top: 2px; color: #7186a2; font-size: 7px; letter-spacing: .08em; }
.jj-office-bottom-note { margin-left: auto; color: #6e829e; font-size: 9px; text-align: right; }

/* Chat flotante, fuera del flujo del tablero */
#panel-control.jj-chat-drawer { position: fixed; z-index: 120; right: max(14px, env(safe-area-inset-right)); bottom: calc(86px + env(safe-area-inset-bottom)); display: none; flex-direction: column; gap: 0; width: min(440px, calc(100vw - 28px)); height: min(650px, calc(100dvh - 112px - env(safe-area-inset-bottom))); max-height: none; min-height: 260px; padding: 0; overflow: hidden; border: 1px solid rgba(102,164,209,.34); border-radius: 19px; background: rgba(9,17,31,.98); box-shadow: 0 22px 80px rgba(0,0,0,.55), 0 0 35px rgba(44,158,203,.12); backdrop-filter: blur(24px); }
#panel-control.jj-chat-drawer.is-open { display: flex; animation: jj-chat-in .2s ease-out; }
@keyframes jj-chat-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
.jj-chat-header { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 10px 13px; border-bottom: 1px solid rgba(148,177,213,.15); background: linear-gradient(100deg, rgba(19,54,77,.7), rgba(20,30,51,.8)); }
.jj-chat-avatar { width: 39px; height: 39px; overflow: hidden; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid rgba(84,217,244,.3); border-radius: 12px; background: #10263a; }
.jj-chat-avatar img { width: 100%; height: 116%; object-fit: contain; object-position: center top; transform: translateY(6%); }
.jj-chat-title { display: flex; flex-direction: column; min-width: 0; gap: 3px; }
.jj-chat-title strong { color: #f1f7ff; font-size: 12px; }
.jj-chat-title small { overflow: hidden; color: #8fa6c1; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
#jj-chat-close { width: 31px; height: 31px; margin-left: auto; border: 1px solid rgba(154,181,218,.18); border-radius: 9px; background: rgba(4,13,25,.5); color: #d6e7fa; font-size: 22px; line-height: 1; cursor: pointer; }
#panel-control #estado-escucha { flex: 0 0 auto; padding: 5px; }
#panel-control #chat-container { flex: 1 1 auto; width: 100%; max-height: none; min-height: 0; padding: 9px; overflow: auto; background: transparent; border-radius: 0; }
#panel-control #chat-messages { gap: 9px; padding: 4px; }
#panel-control .mensaje { max-width: 90%; padding: 9px 12px; font-size: 12px; line-height: 1.45; }
#panel-control .mensaje.usuario { background: linear-gradient(135deg, #117f9d, #275dc0); }
#panel-control .mensaje.jota { background: rgba(37,57,82,.7); border-color: rgba(125,160,201,.17); }
#panel-control .mensaje.sistema { color: #f3cf81; }
#panel-control #operation-status { flex: 0 0 auto; margin: 0 12px 8px; }
#panel-control #input-area { display: grid; grid-template-columns: 36px 36px minmax(0,1fr) 58px; gap: 6px; flex: 0 0 auto; align-items: center; width: 100%; padding: 10px 11px max(11px, env(safe-area-inset-bottom)); border-top: 1px solid rgba(148,177,213,.15); background: rgba(10,20,36,.98); }
#panel-control #input-area > button { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(84,217,244,.19); border-radius: 11px; background: rgba(22,46,68,.78); color: #d9eff9; cursor: pointer; }
#panel-control #chat-input { min-width: 0; width: 100%; height: 39px; padding: 0 13px; border: 1px solid rgba(84,217,244,.23); border-radius: 12px; background: rgba(3,12,23,.78); color: #eff7ff; font-size: 12px; }
#panel-control #btn-enviar { width: 58px; height: 39px; border: 0; border-radius: 12px; background: linear-gradient(135deg, #0a9cb9, #285fbe); color: white; font-weight: 750; font-size: 11px; cursor: pointer; }
.jj-chat-launcher { position: fixed; z-index: 130; right: max(18px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 9px; height: 52px; padding: 5px 15px 5px 6px; border: 1px solid rgba(84,217,244,.45); border-radius: 999px; background: linear-gradient(130deg, rgba(16,45,67,.98), rgba(24,42,75,.98)); color: #e5f7ff; box-shadow: 0 10px 32px rgba(0,0,0,.4), 0 0 25px rgba(84,217,244,.17); cursor: pointer; transition: transform .18s, box-shadow .18s; }
.jj-chat-launcher:hover { transform: translateY(-2px); box-shadow: 0 14px 38px rgba(0,0,0,.45), 0 0 30px rgba(84,217,244,.25); }
.jj-launcher-orbit { position: absolute; top: 2px; left: 34px; color: #72e7f9; font-size: 12px; text-shadow: 0 0 8px #72e7f9; }
.jj-launcher-label { font-size: 11px; font-weight: 750; white-space: nowrap; }
.jj-chat-launcher.is-open { opacity: .72; }
.jj-legacy-presence { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); pointer-events: none; }
.jj-legacy-presence #personaje-container { width: 1px; height: 1px; }
.jj-office-inspector { position: fixed; z-index: 90; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(560px, calc(100vw - 24px)); padding: 12px 14px; border: 1px solid rgba(84,217,244,.28); border-radius: 14px; background: rgba(10,20,35,.96); box-shadow: 0 12px 40px rgba(0,0,0,.45); }
.jj-office-inspector[hidden] { display: none; }
.jj-inspector-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.jj-inspector-top strong { font-size: 12px; }
.jj-inspector-top button, .jj-inspector-assign { border: 1px solid rgba(84,217,244,.28); border-radius: 9px; padding: 7px 10px; color: #dff7ff; background: rgba(25,76,99,.5); cursor: pointer; font-size: 10px; }
.jj-office-inspector p { margin: 7px 0; color: #9db0c8; font-size: 10px; line-height: 1.45; }
.jj-inspector-capabilities { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.jj-inspector-capabilities span { padding: 4px 7px; border: 1px solid rgba(147,176,215,.15); border-radius: 999px; color: #9fb3cd; font-size: 8px; }

/* El modal de ayuda y el panel de diagnóstico conservan su funcionamiento. */
#modal-ayuda { z-index: 160; }
#admin-panel { z-index: 170; }

@media (min-width: 1100px) and (min-height: 760px) {
  .jj-office-grid { max-height: 790px; }
  .jj-agent-avatar { height: clamp(92px, 13vh, 140px); }
}
@media (max-width: 760px) {
  #oficina.jj-office-dashboard { padding: 10px 10px max(9px, env(safe-area-inset-bottom)); }
  .jj-office-topbar { gap: 8px; min-height: 46px; }
  .jj-brand { min-width: 0; gap: 7px; }
  .jj-brand-mark { width: 34px; height: 34px; border-radius: 10px; }
  .jj-brand-copy strong { font-size: 12px; }
  .jj-brand-copy small { font-size: 7px; }
  .jj-topbar-status { display: none; }
  .jj-office-controls { gap: 4px; }
  .jj-office-controls button { width: 29px; height: 29px; border-radius: 8px; font-size: 12px; }
  .jj-office-heading { padding: 12px 0 8px; align-items: flex-start; }
  .jj-office-heading h1 { font-size: clamp(16px, 3.3vw, 22px); }
  .jj-office-subtitle { max-width: 100%; margin-top: 5px; font-size: 9px; }
  .jj-network-pill { display: none; }
  .jj-office-grid { gap: 6px; }
  .jj-office-card { padding: 7px; border-radius: 11px; }
  .jj-agent-name { font-size: clamp(8px, 1.7vw, 11px); }
  .jj-agent-subtitle { font-size: 6px; }
  .jj-agent-icon { width: 20px; height: 20px; border-radius: 6px; font-size: 12px; }
  .jj-agent-avatar { height: clamp(48px, 8.8vh, 80px); max-width: 43%; }
  .jj-agent-brief { font-size: 6px; max-width: 55%; }
  .jj-agent-brief strong { font-size: 6px; }
  .jj-office-state { font-size: 6px; }
  .jj-office-task-count { font-size: 6px; }
  .jj-office-card-foot { padding-top: 4px; }
  .jj-office-hub { border-radius: 12px; padding: 4px; }
  .jj-hub-avatar-wrap { width: clamp(43px, 6.8vh, 62px); height: clamp(43px, 6.8vh, 62px); }
  .jj-hub-title { font-size: 8px; }
  .jj-hub-subtitle { font-size: 6px; }
  .jj-hub-state { margin-top: 5px; padding: 3px 5px; font-size: 6px; }
  .jj-office-bottomline { min-height: 39px; gap: 9px; }
  .jj-bottom-icon { width: 22px; height: 22px; border-radius: 7px; font-size: 10px; }
  .jj-bottom-stat { gap: 5px; }
  .jj-bottom-stat b { font-size: 8px; }
  .jj-bottom-stat small { font-size: 6px; }
  .jj-office-bottom-note { display: none; }
}
@media (max-width: 420px) {
  .jj-office-controls button { width: 26px; height: 28px; font-size: 11px; }
  .jj-brand-copy small { letter-spacing: .06em; }
  .jj-office-grid { gap: 5px; }
  .jj-office-card { padding: 5px; }
  .jj-agent-icon { width: 18px; height: 18px; }
  .jj-agent-brief { display: none; }
  .jj-agent-avatar { max-width: 62%; height: clamp(48px, 9vh, 72px); }
  .jj-office-card-main { justify-content: center; }
  .jj-agent-subtitle { display: none; }
  .jj-office-state { font-size: 5.5px; }
  .jj-office-task-count { font-size: 5.5px; }
  .jj-office-bottomline { justify-content: space-between; }
  .jj-bottom-stat small { letter-spacing: 0; }
  #panel-control.jj-chat-drawer { right: 8px; bottom: calc(74px + env(safe-area-inset-bottom)); width: calc(100vw - 16px); height: min(610px, calc(100dvh - 95px - env(safe-area-inset-bottom))); }
  .jj-chat-launcher { right: 12px; bottom: max(11px, env(safe-area-inset-bottom)); height: 46px; padding-right: 13px; }
  .jj-launcher-chat-icon { width: 31px; height: 31px; font-size: 17px; }
}
@media (max-height: 620px) {
  .jj-office-heading { padding: 9px 0 7px; }
  .jj-office-heading h1 { font-size: 17px; }
  .jj-office-subtitle { margin-top: 4px; font-size: 8px; }
  .jj-office-grid { gap: 6px; }
  .jj-agent-avatar { height: clamp(43px, 8vh, 68px); }
  .jj-office-bottomline { min-height: 34px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; } }


/* R5.0.1 · Corrección de capas y accesibilidad móvil
   - Anula el posicionamiento absoluto/vertical heredado de #floating-buttons.
   - Mantiene la botonera dentro de la cabecera, por encima del tablero.
   - Eleva el inspector para que no quede tapado por el lanzador de chat.
*/
.jj-office-topbar { position: relative; z-index: 3; }
#floating-buttons.jj-office-controls {
  position: static;
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
  z-index: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: 6px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
}
#floating-buttons.jj-office-controls button {
  flex: 0 0 34px;
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(154,181,218,.2);
  border-radius: 10px;
  background: rgba(23,37,59,.7);
  color: #dceaff;
  font-size: 14px;
}
.jj-office-inspector {
  bottom: calc(80px + env(safe-area-inset-bottom));
  z-index: 110;
  max-height: min(46dvh, 360px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
@media (max-width: 540px) {
  .jj-office-topbar {
    z-index: 3;
    flex-wrap: wrap;
    row-gap: 7px;
    min-height: 0;
  }
  .jj-brand { flex: 1 1 auto; }
  #floating-buttons.jj-office-controls {
    flex: 0 0 100%;
    width: 100%;
    justify-content: flex-end;
    gap: 6px;
    margin-left: 0;
  }
  #floating-buttons.jj-office-controls button {
    flex-basis: 32px;
    width: 32px;
    min-width: 32px;
    height: 32px;
    border-radius: 9px;
    font-size: 13px;
  }
  .jj-office-inspector {
    bottom: calc(70px + env(safe-area-inset-bottom));
    width: calc(100vw - 24px);
    max-height: min(48dvh, 340px);
    padding: 11px 12px;
  }
}


/* R5.0.3 · Visual Office Experience
   - Despacho central interactivo de JotaJota, separado del chat.
   - Mensajes breves por oficina, informes individuales y registro de orquestación.
   - Barra de chat inferior de ancho completo; no tapa las tarjetas.
*/
#oficina.jj-office-dashboard { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
.jj-office-card { padding-bottom: 9px; }
.jj-agent-avatar { display: flex; align-items: flex-end; justify-content: center; flex: 0 0 auto; width: clamp(56px, 8vw, 92px); height: clamp(65px, 11vh, 116px); max-width: 42%; overflow: visible; }
.jj-agent-avatar-fallback { display: grid; place-items: center; width: 100%; height: 100%; border: 1px solid color-mix(in srgb, var(--office-accent) 36%, transparent); border-radius: 19px; background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--office-accent) 25%, transparent), rgba(7,15,28,.7) 72%); color: var(--office-accent); font-size: clamp(28px, 4vw, 44px); text-shadow: 0 0 18px color-mix(in srgb, var(--office-accent) 55%, transparent); }
.jj-agent-avatar-image { display: block; width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain; object-position: center bottom; image-rendering: pixelated; filter: drop-shadow(0 8px 12px rgba(0,0,0,.45)); }
.jj-agent-character { display: block; margin-top: 4px; color: color-mix(in srgb, var(--office-accent) 82%, white 18%); font-size: 7px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jj-office-card.is-running .jj-agent-avatar-fallback { animation: jj-agent-working 1.35s ease-in-out infinite; }
.jj-agent-bubble { display: block; align-self: flex-start; max-width: 100%; overflow: hidden; padding: 4px 8px; border: 1px solid color-mix(in srgb, var(--office-accent) 34%, transparent); border-radius: 9px 9px 9px 3px; background: color-mix(in srgb, var(--office-accent) 11%, rgba(8,15,29,.92)); color: #e5f3ff; font-size: clamp(7px, .72vw, 9px); line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,.2); animation: jj-bubble-in .22s ease-out both; }
@keyframes jj-bubble-in { from { opacity: 0; transform: translateY(4px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.jj-agent-progress { display: block; height: 3px; overflow: hidden; border-radius: 99px; background: rgba(160,185,220,.12); }
.jj-agent-progress i { display: block; height: 100%; border-radius: inherit; background: var(--office-accent); box-shadow: 0 0 9px var(--office-accent); }
.jj-office-card[data-state="queued"] .jj-office-state::before { background: #fbbf24; box-shadow: 0 0 8px rgba(251,191,36,.55); }
.jj-office-hub { width: 100%; height: 100%; font: inherit; color: var(--jj-text); text-align: left; cursor: pointer; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.jj-office-hub:hover { transform: translateY(-3px); border-color: rgba(84,217,244,.82); box-shadow: 0 0 0 5px rgba(84,217,244,.06), 0 0 42px rgba(84,217,244,.23); }
.jj-office-hub:focus-visible { outline: 2px solid var(--jj-cyan); outline-offset: 3px; }
.jj-office-hub.is-running { animation: jj-hub-pulse 2.2s ease-in-out infinite; }
@keyframes jj-hub-pulse { 0%,100% { box-shadow: 0 0 0 5px rgba(84,217,244,.035), 0 0 28px rgba(84,217,244,.14); } 50% { box-shadow: 0 0 0 6px rgba(84,217,244,.08), 0 0 43px rgba(84,217,244,.28); } }
.jj-hub-kicker { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 6px; color: #8fe6f5; font-size: clamp(6px, .68vw, 8px); font-weight: 850; letter-spacing: .1em; text-align: center; }
.jj-hub-kicker i { width: 6px; height: 6px; border-radius: 50%; background: #6be6ac; box-shadow: 0 0 9px #6be6ac; }
.jj-hub-main { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: clamp(5px, .8vw, 10px); width: 100%; margin-top: 6px; }
.jj-hub-avatar-wrap { flex: 0 0 auto; width: clamp(45px, 6.3vh, 68px); height: clamp(45px, 6.3vh, 68px); }
.jj-hub-avatar-wrap img { max-width: 100%; }
.jj-hub-copy { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.jj-hub-copy strong { color: #f3fbff; font-size: clamp(9px, 1vw, 12px); font-weight: 900; letter-spacing: .12em; }
.jj-hub-copy small { color: #89dce9; font-size: clamp(6px, .62vw, 8px); font-weight: 800; line-height: 1.25; }
.jj-hub-goal { display: -webkit-box; overflow: hidden; color: #a9bdd1; font-size: clamp(6px, .68vw, 8px); line-height: 1.25; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.jj-hub-latest { position: relative; z-index: 1; display: block; width: 100%; margin-top: 6px; padding: 5px 7px; overflow: hidden; border: 1px solid rgba(84,217,244,.15); border-radius: 8px; background: rgba(2,13,25,.54); color: #b9d5e5; font-size: clamp(6px, .66vw, 8px); line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.jj-hub-open { position: relative; z-index: 1; display: block; margin-top: 5px; color: #65dff1; font-size: clamp(6px, .62vw, 8px); font-weight: 850; letter-spacing: .08em; text-align: center; }
.jj-hub-open b { font-size: 11px; }
.jj-office-inspector { bottom: calc(72px + env(safe-area-inset-bottom)); max-height: min(66dvh, 560px); padding: 14px; overflow-y: auto; overscroll-behavior: contain; }
.jj-inspector-section { margin-top: 11px; padding-top: 9px; border-top: 1px solid rgba(148,177,213,.13); }
.jj-inspector-section h4 { margin: 0 0 6px; color: #b9d5ef; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.jj-inspector-section p { margin: 5px 0; }
.jj-inspector-status { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; margin-top: 9px; padding: 8px 10px; border: 1px solid rgba(84,217,244,.2); border-radius: 10px; background: rgba(22,55,78,.35); }
.jj-inspector-status b { color: #8ee7c0; font-size: 11px; }
.jj-inspector-status span { color: #8da8c1; font-size: 9px; }
.jj-inspector-deliverable, .jj-inspector-goal { color: #d6e6f8 !important; }
.jj-inspector-evidence { display: inline-block; color: #83e1b4; font-size: 8px; }
.jj-inspector-evidence.is-muted { color: #8a9bb0; }
.jj-inspector-events, .jj-inspector-office-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.jj-inspector-events li { display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 7px; align-items: start; color: #c4d5e8; font-size: 9px; line-height: 1.4; }
.jj-inspector-events li time { color: #6f8aa9; font-variant-numeric: tabular-nums; }
.jj-inspector-events .is-empty { display: block; color: #8397b0; }
.jj-inspector-office-list li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid rgba(148,177,213,.08); font-size: 9px; }
.jj-inspector-office-list b { color: #d9e8fa; }
.jj-inspector-office-list span { color: #8eabc5; text-align: right; }
.jj-inspector-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.jj-inspector-actions button { flex: 1 1 auto; min-height: 32px; padding: 6px 9px; border: 1px solid rgba(84,217,244,.25); border-radius: 9px; background: rgba(18,59,80,.62); color: #e3f8ff; font-size: 9px; font-weight: 700; cursor: pointer; }
.jj-inspector-actions button:hover { border-color: rgba(84,217,244,.6); background: rgba(25,84,110,.75); }
.jj-inspector-report { margin-top: 10px; padding: 9px; border: 1px solid rgba(148,177,213,.15); border-radius: 10px; background: rgba(3,10,20,.75); }
.jj-inspector-report[hidden] { display: none; }
.jj-inspector-report pre { max-height: 260px; margin: 0; overflow: auto; color: #c7d8e9; font: 9px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.jj-chat-launcher { left: clamp(12px, 3vw, 42px); right: clamp(12px, 3vw, 42px); bottom: max(10px, env(safe-area-inset-bottom)); width: auto; height: 54px; justify-content: center; padding: 5px 18px; border-radius: 15px; }
.jj-launcher-chat-icon { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border: 1px solid rgba(84,217,244,.28); border-radius: 10px; background: rgba(84,217,244,.1); font-size: 19px; }
.jj-launcher-label { font-size: 12px; letter-spacing: .04em; }
#panel-control.jj-chat-drawer { bottom: calc(72px + env(safe-area-inset-bottom)); }
@media (max-width: 760px) {
  #oficina.jj-office-dashboard { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .jj-office-grid { grid-template-rows: repeat(3, minmax(0, 1fr)); }
  .jj-agent-avatar { width: 43px; height: 56px; max-width: 38%; }
  .jj-agent-avatar-fallback { border-radius: 11px; font-size: 24px; }
  .jj-agent-brief { max-width: 64%; }
  .jj-agent-bubble { max-width: 100%; font-size: 6px; padding: 3px 5px; }
  .jj-hub-avatar-wrap { width: clamp(36px, 6vh, 48px); height: clamp(36px, 6vh, 48px); }
  .jj-hub-main { gap: 4px; }
  .jj-office-inspector { bottom: calc(70px + env(safe-area-inset-bottom)); width: calc(100vw - 20px); max-height: min(65dvh, 520px); padding: 11px; }
  #panel-control.jj-chat-drawer { bottom: calc(70px + env(safe-area-inset-bottom)); right: 8px; width: calc(100vw - 16px); height: min(610px, calc(100dvh - 86px - env(safe-area-inset-bottom))); }
  .jj-chat-launcher { left: 10px; right: 10px; bottom: max(8px, env(safe-area-inset-bottom)); height: 48px; }
}
@media (max-width: 420px) {
  .jj-agent-avatar { width: 38px; height: 48px; max-width: 38%; }
  .jj-agent-character { font-size: 5px; }
  .jj-agent-avatar-fallback { font-size: 21px; }
  .jj-office-card-main { justify-content: center; }
  .jj-agent-brief { display: block; max-width: 62%; }
  .jj-hub-kicker { font-size: 5.5px; letter-spacing: .06em; }
  .jj-hub-avatar-wrap { width: 33px; height: 33px; }
  .jj-hub-copy strong { font-size: 8px; }
  .jj-hub-copy small, .jj-hub-goal, .jj-hub-latest, .jj-hub-open { font-size: 5.5px; }
  .jj-hub-latest { margin-top: 4px; padding: 3px 4px; }
}

.jj-inspector-empty-note { color: #8fa8c1; font-size: 9px; line-height: 1.45; }


/* R5.0.6 · lanzador e iframe del campus 3D */
.jj-heading-actions{display:flex;align-items:center;gap:10px;flex:0 0 auto}
.jj-office-3d-toggle{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:40px;padding:0 15px;border:1px solid rgba(84,217,244,.42);border-radius:11px;background:linear-gradient(135deg,rgba(15,67,84,.9),rgba(33,54,92,.92));color:#dffaff;font:inherit;font-size:11px;font-weight:850;letter-spacing:.04em;cursor:pointer;box-shadow:0 6px 18px rgba(0,0,0,.2),inset 0 1px 0 rgba(255,255,255,.06);transition:transform .18s,border-color .18s,box-shadow .18s}
.jj-office-3d-toggle:hover{transform:translateY(-2px);border-color:rgba(84,217,244,.85);box-shadow:0 9px 24px rgba(0,0,0,.28),0 0 20px rgba(84,217,244,.13)}
.jj-office-3d-toggle[aria-pressed="true"]{border-color:#70e2b0;background:linear-gradient(135deg,rgba(18,88,69,.94),rgba(25,63,82,.95));color:#caffea}
.jj-office-3d-overlay{position:fixed;inset:0;z-index:150;background:#080e17;overflow:hidden}
.jj-office-3d-overlay[hidden]{display:none!important}
#jj-office-3d-frame{display:block;width:100%;height:100%;border:0;background:#080e17}
body.jj-office-3d-open{overflow:hidden}
body.jj-office-3d-open #oficina{visibility:hidden;pointer-events:none}
body.jj-office-3d-open #jj-chat-launcher,body.jj-office-3d-open #panel-control,body.jj-office-3d-open #jj-office-inspector{visibility:hidden;pointer-events:none}
@media(max-width:760px){.jj-heading-actions{gap:0}.jj-heading-actions .jj-network-pill{display:none}.jj-office-3d-toggle{min-height:35px;padding:0 11px;font-size:10px}}
@media(max-width:540px){.jj-office-heading{align-items:center}.jj-office-3d-toggle{min-height:32px;padding:0 9px;border-radius:9px;font-size:9px}.jj-office-3d-toggle span{display:inline}}
