/* ===========================================================
   Consiliarius Cockpit · panels rodeando el chat (frame layout)
   ===========================================================
   Top bar (full width) - sessions / status / demo / pitch
   Left rail              | Center (chat)            | Right rail
                          |                          |
   Bottom bar (full width) - outputs / lenses / investors / time-lapse
*/

:root {
  /* Mapeo a tokens Lopettia (lopettia-tokens.css) */
  --bg-deep:       var(--lp-ink);
  --bg-mid:        var(--lp-ink-2);
  --bg-soft:       var(--lp-glass);
  --border-soft:   var(--lp-line);
  --accent-glow:   var(--lp-coral-glow);
  --neon:          var(--lp-matrix);
}

.cockpit-body {
  margin: 0;
  height: 100vh;
  background:
    radial-gradient(ellipse at top left, rgba(31, 42, 68, 0.6) 0%, transparent 60%),
    radial-gradient(ellipse at bottom right, rgba(0, 212, 184, 0.10) 0%, transparent 50%),
    var(--bg-deep);
  color: #e6e9f2;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

.cockpit-grid {
  height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  grid-template-rows: 64px 48px 1fr 220px;
  grid-template-areas:
    "top      top      top"
    "modules  modules  modules"
    "left     center   right"
    "bottom   bottom   bottom";
  gap: 10px;
  padding: 10px;
  box-sizing: border-box;
}

/* ===== Zone wrappers with glassmorphism ===== */
.zone {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  position: relative;
  overflow: auto;
}
/* Top no debe clippear sus dropdowns */
.zone-top.zone { overflow: visible; }

.zone::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(224, 169, 95, 0.06) 0%, transparent 30%, transparent 70%, rgba(0, 212, 184, 0.06) 100%);
}

/* zone-top va sobre cualquier panel (dropdowns del header no deben
   quedar tapados por zone-right/left que tienen overflow:auto y crean
   su propio stacking context). */
.zone-top { grid-area: top; display: flex; align-items: center; gap: 16px; padding: 0 18px; overflow: visible; position: relative; z-index: 500; }
.zone-modules { grid-area: modules; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 18px; overflow: visible; position: relative; z-index: 400; }
.zone-modules.zone { overflow: visible; }
.zone-modules .top-modules { flex: 1; }
.zone-modules .modules-pitch-link {
  flex-shrink: 0;
  font-size: 12px;
  padding: 6px 14px;
  background: rgba(224, 169, 95, 0.15);
  color: var(--accent, #e0a95f);
  border: 1px solid rgba(224, 169, 95, 0.4);
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.15s ease;
}
.zone-modules .modules-pitch-link:hover { background: rgba(224, 169, 95, 0.25); }

/* Inline language switcher slot inside topbar */
.topbar-lang-slot { flex-shrink: 0; }
.zone-left { grid-area: left; padding: 14px; position: relative; z-index: 1; }
.zone-right { grid-area: right; padding: 14px; position: relative; z-index: 1; }
.zone-center { grid-area: center; display: flex; flex-direction: column; padding: 0; position: relative; z-index: 1; }
.zone-bottom { grid-area: bottom; display: grid; grid-template-columns: 1.4fr 1.2fr 1fr 1.1fr; gap: 12px; padding: 12px; position: relative; z-index: 1; }

/* ===== Top bar ===== */
.brand-mini {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.brand-mini .logo {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, #e0a95f, #d59750);
  color: #1f2a44;
  border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 18px;
  box-shadow: 0 0 18px var(--accent-glow);
}

.brand-mini .brand-logomark {
  width: 40px; height: 40px;
  filter: drop-shadow(0 0 12px var(--lp-matrix-glow));
}
.brand-mini h1 {
  margin: 0; font-size: 16px; letter-spacing: 0.4px;
  background: linear-gradient(90deg, #e0a95f, #f5d8a7);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-mini p { margin: 0; font-size: 10px; }

.top-modules {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.top-modules .module-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px; font-weight: 700;
  line-height: 1;
  color: rgba(255, 255, 255, 0.6);
  position: relative;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
  margin: 0;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  text-align: center;
  vertical-align: middle;
  box-sizing: border-box;
}
.top-modules .module-dot.in-progress {
  border-color: var(--accent);
  color: #fff;
  background: rgba(224, 169, 95, 0.15);
}
.top-modules .module-dot.done {
  background: var(--neon);
  border-color: var(--neon);
  color: #052e16;
  box-shadow: 0 0 10px rgba(0, 212, 184, 0.5);
}
.top-modules .module-dot::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 32px;
  font-size: 10px;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
  background: rgba(15, 23, 42, 0.9);
  padding: 4px 8px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
  z-index: 10;
}
.top-modules .module-dot:hover::after { opacity: 1; }

.top-actions {
  display: flex; gap: 8px; align-items: center; flex-shrink: 0;
}
.top-actions .pill { font-size: 11px; padding: 4px 10px; }
.top-actions .block-mini {
  background: rgba(255, 255, 255, 0.04);
  color: #e6e9f2;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12px;
  max-width: 180px;
}
/* El dropdown nativo del select hereda colores del SO si no los forzamos.
   Sobre fondo oscuro de la app, el texto queda casi invisible. */
.top-actions .block-mini option {
  background: #0A1628;
  color: #e6e9f2;
}
.top-actions .block-mini option:checked,
.top-actions .block-mini option:hover {
  background: #00D4B8;
  color: #0A1628;
}
.top-actions .accent {
  background: linear-gradient(135deg, #e0a95f, #d59750);
  color: #1f2a44;
  border: none;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(224, 169, 95, 0.35);
}
.top-actions .accent:hover { transform: translateY(-1px); box-shadow: 0 0 24px rgba(224, 169, 95, 0.5); }
.top-actions .link-pill {
  font-size: 12px;
  padding: 6px 12px;
  background: rgba(0, 212, 184, 0.12);
  color: var(--neon);
  border: 1px solid rgba(0, 212, 184, 0.4);
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
}
.top-actions .link-pill:hover { background: rgba(0, 212, 184, 0.2); }

/* ===== War Room CTA · destacado vs link-pills ===== */
.top-actions .war-room-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 7px 14px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.2px;
  background: linear-gradient(135deg, #FFB454 0%, #f59e0b 100%);
  color: #1a1a1a;
  border: 1px solid rgba(255, 180, 84, 0.6);
  box-shadow: 0 0 12px rgba(255, 180, 84, 0.4), 0 2px 8px rgba(0,0,0,0.3);
  position: relative;
  animation: war-room-glow 2.6s ease-in-out infinite;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.top-actions .war-room-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 22px rgba(255, 180, 84, 0.7), 0 4px 14px rgba(0,0,0,0.4);
}
.war-room-cta-emoji { font-size: 14px; line-height: 1; }
.war-room-cta-text { font-size: 12px; }
.war-room-cta-badge {
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0,0,0,0.35);
  color: #FFB454;
  letter-spacing: 0.6px;
}
@keyframes war-room-glow {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 180, 84, 0.4), 0 2px 8px rgba(0,0,0,0.3); }
  50%      { box-shadow: 0 0 22px rgba(255, 180, 84, 0.65), 0 2px 8px rgba(0,0,0,0.3); }
}

/* ===== Workspace navigation buttons (right zone) ===== */
.cell-workspace { padding: 14px; }
.cell-workspace h3 { margin-bottom: 4px; }
.workspace-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  margin-bottom: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  position: relative;
  transition: transform 0.12s ease, background 0.12s ease;
}
.workspace-btn:hover { transform: translateX(2px); }
.workspace-btn[hidden] { display: none; }

.workspace-btn-templates {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #93c5fd;
}
.workspace-btn-templates:hover { background: rgba(59, 130, 246, 0.2); }

.workspace-btn-shark {
  background: rgba(236, 72, 153, 0.12);
  border: 1px solid rgba(236, 72, 153, 0.35);
  color: #f9a8d4;
}
.workspace-btn-shark:hover { background: rgba(236, 72, 153, 0.2); }

.workspace-btn-war {
  background: linear-gradient(135deg, rgba(255,180,84,0.2) 0%, rgba(245,158,11,0.12) 100%);
  border: 1px solid rgba(255, 180, 84, 0.5);
  color: #FFB454;
  font-weight: 700;
}
.workspace-btn-war:hover { background: linear-gradient(135deg, rgba(255,180,84,0.3) 0%, rgba(245,158,11,0.18) 100%); }

.workspace-badge-new {
  margin-left: auto;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0,0,0,0.35);
  color: #FFB454;
  letter-spacing: 0.6px;
}

.workspace-btn-imp {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.workspace-btn-imp:hover { background: rgba(16, 185, 129, 0.2); }

.workspace-count {
  margin-left: auto;
  background: #10b981;
  color: #1a1a1a;
  font-weight: 800;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

/* ===== Improvements pill (War Room feedback) ===== */
.top-actions .cockpit-imp-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  background: rgba(255, 180, 84, 0.12);
  color: #FFB454;
  border: 1px solid rgba(255, 180, 84, 0.4);
  animation: imp-pulse 2.4s ease-in-out infinite;
}
.top-actions .cockpit-imp-pill:hover {
  background: rgba(255, 180, 84, 0.2);
  transform: translateY(-1px);
}
.cockpit-imp-emoji { font-size: 13px; }
.cockpit-imp-count {
  background: #FFB454;
  color: #1a1a1a;
  font-weight: 800;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}
.cockpit-imp-label { font-size: 11px; }
@keyframes imp-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 180, 84, 0); }
  50%      { box-shadow: 0 0 16px 0 rgba(255, 180, 84, 0.4); }
}

/* ===== Improvements modal ===== */
.cockpit-imp-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cockpit-imp-modal[hidden] { display: none !important; }
.cockpit-imp-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}
.cockpit-imp-card {
  position: relative;
  background: #0a0f1a;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 24px 28px;
  max-width: 800px;
  width: 92%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}
.cockpit-imp-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: transparent;
  border: 0;
  color: var(--text-muted, #9aa3b2);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}
.cockpit-imp-close:hover { color: #fff; }
.cockpit-imp-header h2 { margin: 0 0 6px; color: #fff; }
.cockpit-imp-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 18px 0;
}
.cockpit-imp-item {
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-left-width: 4px;
}
.cockpit-imp-item-pending   { border-left-color: #3b82f6; }
.cockpit-imp-item-working   { border-left-color: #FFB454; background: rgba(255,180,84,0.04); }
.cockpit-imp-item-addressed { border-left-color: #10b981; opacity: 0.8; }
.cockpit-imp-item-dismissed { border-left-color: #6b7280; opacity: 0.5; }
.cockpit-imp-item-head {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.cockpit-imp-cat {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
}
.cockpit-imp-cat.cat-data_gap       { background: rgba(245,158,11,0.15); color: #fbbf24; }
.cockpit-imp-cat.cat-narrative      { background: rgba(139,92,246,0.15); color: #a78bfa; }
.cockpit-imp-cat.cat-validation     { background: rgba(20,184,166,0.15); color: #2dd4bf; }
.cockpit-imp-cat.cat-metric         { background: rgba(59,130,246,0.15); color: #60a5fa; }
.cockpit-imp-cat.cat-differentiation { background: rgba(236,72,153,0.15); color: #f472b6; }
.cockpit-imp-cat.cat-risk           { background: rgba(239,68,68,0.15); color: #f87171; }
.cockpit-imp-module {
  font-size: 11px;
  color: var(--text-muted, #9aa3b2);
  text-decoration: none;
  padding: 3px 8px;
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.08);
}
.cockpit-imp-module:hover { background: rgba(0,212,184,0.15); color: #00d4b8; }
.cockpit-imp-status {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  margin-left: auto;
}
.cockpit-imp-status.status-pending   { background: rgba(59,130,246,0.15); color: #60a5fa; }
.cockpit-imp-status.status-working   { background: rgba(255,180,84,0.2); color: #FFB454; }
.cockpit-imp-status.status-addressed { background: rgba(16,185,129,0.15); color: #34d399; }
.cockpit-imp-status.status-dismissed { background: rgba(107,114,128,0.2); color: #9ca3af; }
.cockpit-imp-text {
  margin: 0 0 10px;
  color: #e5e7eb;
  font-size: 13px;
  line-height: 1.55;
}
.cockpit-imp-note {
  margin: 8px 0 12px;
  padding: 10px 12px;
  border-left: 3px solid #FFB454;
  background: rgba(255,180,84,0.06);
  border-radius: 0 6px 6px 0;
}
.cockpit-imp-note-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #FFB454;
  margin-bottom: 4px;
}
.cockpit-imp-note p {
  margin: 0;
  color: #e5e7eb;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.cockpit-imp-no-note { margin: 6px 0 10px; }
.cockpit-imp-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.cockpit-imp-status-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
  color: var(--text-muted, #9aa3b2);
  cursor: pointer;
}
.cockpit-imp-status-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
.cockpit-imp-status-btn.active.status-pending   { background: rgba(59,130,246,0.2); border-color: rgba(59,130,246,0.5); color: #60a5fa; }
.cockpit-imp-status-btn.active.status-working   { background: rgba(255,180,84,0.2); border-color: rgba(255,180,84,0.5); color: #FFB454; }
.cockpit-imp-status-btn.active.status-addressed { background: rgba(16,185,129,0.2); border-color: rgba(16,185,129,0.5); color: #34d399; }
.cockpit-imp-status-btn.active.status-dismissed { background: rgba(107,114,128,0.25); border-color: rgba(107,114,128,0.5); color: #9ca3af; }
.cockpit-imp-foot {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* ===== Generic cell (left/right rails) ===== */
.cell {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}

.cell h3 {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--accent);
  font-weight: 600;
}

.cell-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e6e9f2;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.cell-btn:hover {
  background: rgba(0, 212, 184, 0.10);
  border-color: rgba(0, 212, 184, 0.3);
  transform: translateX(2px);
}

.cell-btn.block, .block { width: 100%; }

/* ===== Center / chat ===== */
.zone-center .messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.zone-center .reformular-bar {
  padding: 10px 18px 0;
  background: rgba(0, 0, 0, 0.15);
}
.reformular-cta {
  width: 100%;
  background: linear-gradient(135deg, rgba(0, 212, 184, 0.15), rgba(96, 165, 250, 0.12));
  border: 1px solid rgba(0, 212, 184, 0.40);
  border-radius: 10px;
  padding: 10px 16px;
  color: #e6e9f2;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 120ms, border-color 120ms, transform 120ms;
}
.reformular-cta:hover {
  background: linear-gradient(135deg, rgba(0, 212, 184, 0.25), rgba(96, 165, 250, 0.20));
  border-color: var(--lp-matrix, #00D4B8);
  transform: translateY(-1px);
}
.reformular-emoji { font-size: 18px; flex-shrink: 0; }
.reformular-text { font-weight: 700; font-size: 14px; color: #00D4B8; }
.reformular-hint { font-size: 11px; color: #8a96b3; margin-left: auto; font-style: italic; }
@media (max-width: 700px) { .reformular-hint { display: none; } }

.zone-center .composer {
  display: flex;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--border-soft);
  background: rgba(0, 0, 0, 0.15);
}

.zone-center .composer textarea {
  flex: 1;
  resize: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: rgba(255, 255, 255, 0.04);
  color: #e6e9f2;
}
.zone-center .composer textarea:focus { border-color: var(--neon); }

/* Mic button para dictado por voz dentro del composer */
.mic-btn {
  width: 44px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: #e6e9f2;
  font-size: 18px;
  cursor: pointer;
  transition: background 120ms, transform 120ms, box-shadow 120ms;
  align-self: stretch;
}
.mic-btn:hover { background: rgba(255, 255, 255, 0.08); }
.mic-btn.recording {
  background: var(--coral, #F38281);
  color: #fff;
  border-color: var(--coral, #F38281);
  box-shadow: 0 0 0 4px rgba(243, 130, 129, 0.25);
  animation: mic-pulse 1.2s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(243, 130, 129, 0.25); }
  50%      { box-shadow: 0 0 0 8px rgba(243, 130, 129, 0.10); }
}
.mic-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.mic-btn-unsupported { font-size: 11px; }

.zone-center .quick-actions {
  display: flex;
  gap: 6px;
  padding: 8px 18px 12px;
  flex-wrap: wrap;
  background: rgba(0, 0, 0, 0.15);
  border-top: 1px solid var(--border-soft);
}

.zone-center .quick-actions button {
  background: rgba(255, 255, 255, 0.05);
  color: #c8cdda;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  cursor: pointer;
}
.zone-center .quick-actions button:hover { background: rgba(0, 212, 184, 0.1); border-color: var(--neon); }

/* Adapt msg bubbles for dark theme */
.zone-center .msg.user {
  background: linear-gradient(135deg, #1f2a44, #2c3a60);
  color: #fff;
}
.zone-center .msg.assistant {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-soft);
  color: #e6e9f2;
}
.zone-center .msg.system {
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: #fde68a;
}

/* ===== Right rail · Agora radial ===== */
.personas-radial {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}

.personas-radial .persona-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.personas-radial .persona-btn:hover {
  border-color: var(--persona-color, var(--accent));
  box-shadow: 0 0 10px var(--persona-color, var(--accent));
  transform: translateY(-2px);
}

.personas-radial .persona-btn .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800; font-size: 12px;
  color: #fff;
  margin-bottom: 2px;
}

.personas-radial .persona-btn .info { display: flex; flex-direction: column; line-height: 1.1; }
.personas-radial .persona-btn .name { font-weight: 700; font-size: 11px; }
.personas-radial .persona-btn .role { font-size: 9px; opacity: 0.7; }

/* ===== Bottom row cells ===== */
.cell-h {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cell-h h3 {
  margin: 0 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--accent);
}

.cell-h .output-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 6px;
}

.cell-h .output-buttons button {
  background: rgba(255, 255, 255, 0.05);
  color: #e6e9f2;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell-h .output-buttons button.primary {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #e0a95f, #d59750);
  color: #1f2a44;
  border: none;
  font-weight: 700;
}
.cell-h .output-buttons button:hover { border-color: var(--neon); }

.cell-h .outputs {
  list-style: none; margin: 6px 0 0; padding: 0;
  flex: 1; overflow-y: auto;
  font-size: 11px;
}

.cell-h .outputs li {
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  margin-bottom: 3px;
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.cell-h .outputs a {
  color: var(--neon);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* ===== Misc adjustments ===== */
.muted { color: rgba(255, 255, 255, 0.55); }
.small { font-size: 11px; }

button.primary {
  background: linear-gradient(135deg, #e0a95f, #d59750);
  color: #1f2a44;
  font-weight: 700;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
button.primary:hover { box-shadow: 0 0 12px var(--accent-glow); }

/* Scrollbar in dark theme */
.cockpit-body ::-webkit-scrollbar { width: 8px; }
.cockpit-body ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
.cockpit-body ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 212, 184, 0.4);
}

/* ===== User menu ===== */
.user-menu {
  position: relative;
  z-index: 9999;  /* el dropdown debe quedar sobre cualquier panel */
}
.user-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--lp-text);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}
.user-pill:hover { background: rgba(0, 212, 184, 0.10); border-color: var(--lp-matrix); }
.user-pill-caret { font-size: 10px; opacity: 0.7; transition: transform 0.15s; }
.user-pill[aria-expanded="true"] .user-pill-caret { transform: rotate(180deg); }

.logout-pill {
  background: rgba(243, 130, 129, 0.10);
  border: 1px solid rgba(243, 130, 129, 0.35);
  color: var(--lp-coral, #F38281);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  margin-left: 6px;
  font-family: inherit;
  font-weight: 600;
}
.logout-pill:hover { background: rgba(243, 130, 129, 0.20); border-color: var(--lp-coral, #F38281); }

.tier-pill {
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--lp-matrix);
  color: var(--lp-ink);
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.tier-pill.premium { background: var(--lp-coral); }
.tier-pill.free { background: rgba(255, 255, 255, 0.16); color: var(--lp-text-mute); }

.user-drop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--lp-ink-2, #0F1E36);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  min-width: 200px;
  padding: 6px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.65);
  z-index: 10000;  /* sobre todo: panels, modales no-fullscreen, etc. */
  animation: user-drop-in 0.14s ease-out;
}
@keyframes user-drop-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.user-drop a, .user-drop button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--lp-text);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
}
.user-drop a:hover, .user-drop button:hover { background: rgba(0, 212, 184, 0.10); color: var(--lp-matrix); }

/* Smaller devices: stack zones */
@media (max-width: 1100px) {
  .cockpit-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto auto auto;
    grid-template-areas:
      "top"
      "modules"
      "left"
      "center"
      "right"
      "bottom";
  }
  .zone-bottom { grid-template-columns: 1fr 1fr; }
}

/* Phone-first (< 720px): focus = chat + workspace + Agora · stacked
   Hide secondary zones unless user toggles "Más opciones" */
@media (max-width: 720px) {
  /* Allow page to scroll naturally on mobile */
  html, body.cockpit-body {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .cockpit-grid {
    height: auto;
    min-height: 100vh;
    gap: 6px;
    padding: 6px;
    padding-bottom: 80px; /* space for floating "Más opciones" FAB */
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto auto auto;
    /* New mobile order: top, modules, chat first, then right (workspace+agora), then left (hidden by default), then bottom (hidden by default) */
    grid-template-areas:
      "top"
      "modules"
      "center"
      "right"
      "left"
      "bottom";
  }
  /* Zones: don't trap scroll · let page-level scroll handle it */
  .zone, .zone-top, .zone-left, .zone-right, .zone-center, .zone-bottom, .zone-modules {
    overflow: visible !important;
    height: auto;
  }
  /* Chat messages still scrolls internally for long conversations */
  .zone-center .messages {
    max-height: 60vh;
    overflow-y: auto;
  }
  /* Hide secondary zones by default · revealed when body.mobile-advanced */
  body:not(.mobile-advanced) .zone-left { display: none; }
  body:not(.mobile-advanced) .zone-bottom { display: none; }
  /* In right zone, keep ONLY workspace + agora · hide Q&A, Scenarios, Live Model */
  body:not(.mobile-advanced) .zone-right > section.cell:not(.cell-workspace):not(.cell-agora) {
    display: none;
  }
  /* Floating "Más opciones" toggle button injected by JS */
  .mobile-more-fab {
    position: fixed;
    bottom: 14px;
    right: 14px;
    z-index: 9000;
    background: linear-gradient(135deg, rgba(0,212,184,0.95) 0%, rgba(0,212,184,0.85) 100%);
    color: #052e16;
    border: 0;
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .mobile-more-fab:hover { transform: translateY(-1px); }
  body.mobile-advanced .mobile-more-fab {
    background: linear-gradient(135deg, rgba(255,180,84,0.95) 0%, rgba(245,158,11,0.95) 100%);
    color: #1a1a1a;
  }
  /* Topbar: tighter · permitir wrap · garantizar "+ Nueva" visible */
  .zone-top {
    padding: 8px 10px;
    gap: 6px;
    flex-wrap: wrap;
    min-height: auto;
    height: auto;
  }
  .brand-mini { flex: 0 0 auto; max-width: 50%; }
  .brand-mini h1 { font-size: 14px; }
  .brand-mini p { display: none; }
  .brand-mini .logo, .brand-mini .brand-logomark { width: 32px; height: 32px; }
  .top-actions {
    flex: 1 1 100%;     /* segunda fila completa */
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    order: 2;            /* después de brand */
  }
  .top-actions .pill { font-size: 10px; padding: 3px 6px; flex-shrink: 0; }
  .top-actions .link-pill { font-size: 10px; padding: 4px 8px; flex-shrink: 0; }
  .top-actions .block-mini, .top-actions select {
    font-size: 11px;
    padding: 4px 6px;
    max-width: 110px;    /* mas angosto para que quepa "+ Nueva" */
    min-width: 0;
    flex: 0 1 auto;
  }
  /* "+ Nueva" SIEMPRE visible · prioridad maxima */
  .top-actions #btn-new-session {
    font-size: 12px;
    padding: 6px 12px;
    flex-shrink: 0;
    order: -1;          /* primero en la fila */
    font-weight: 800;
  }
  .top-actions #btn-delete-session { flex-shrink: 0; font-size: 10px; }
  .top-actions .user-pill { font-size: 11px; flex-shrink: 0; }
  /* Hide secondary topbar items on phone */
  .top-actions #user-email-mini { display: none; }
  .top-actions #btn-user-logout-top { display: none; }
  .top-actions #trial-pill, .top-actions #health-pill { font-size: 9px; }
  /* Language switcher slot: que no monopolice */
  .topbar-lang-slot { flex-shrink: 0; order: 99; margin-left: auto; }

  /* Module dots: scroll horizontally so all 7 fit */
  .zone-modules { padding: 4px 8px; gap: 8px; }
  .zone-modules .top-modules {
    flex-wrap: nowrap;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    flex: 1;
    min-width: 0;
    padding-bottom: 2px;
  }
  .top-modules .module-dot { width: 24px; height: 24px; font-size: 11px; flex-shrink: 0; }
  .zone-modules .modules-pitch-link { font-size: 11px; padding: 4px 10px; }

  /* Side panels: padding tightening */
  .zone-left, .zone-right { padding: 6px; }
  /* Visibility controlled by body.mobile-advanced rules above */

  /* Chat zone takes most of the screen */
  .zone-center {
    min-height: 60vh;
  }
  .composer textarea { font-size: 13px; }
  .quick-actions { gap: 4px; flex-wrap: wrap; }
  .quick-actions button { font-size: 11px; padding: 3px 7px; }

  /* Bottom: stack tight */
  .zone-bottom { grid-template-columns: 1fr; padding: 6px; gap: 6px; }
  .cell-h { padding: 10px; }
  .cell-h h3 { font-size: 13px; margin-bottom: 6px; }

  /* AI disclaimer: stick to bottom */
  #ai-disclaimer { font-size: 11px; padding: 8px 10px; }

  /* Cells: tighter */
  .cell { padding: 10px; margin-bottom: 6px; }
  .cell h3 { font-size: 13px; margin-bottom: 6px; }
  .cell-btn { font-size: 11px; padding: 6px 8px; }
}

/* Mobile XS · super narrow */
@media (max-width: 380px) {
  .top-actions .link-pill, .top-actions .war-room-cta { display: none; }
  .top-actions #btn-new-session, .top-actions #btn-delete-session { font-size: 10px; padding: 3px 6px; }
}

/* ============================================================ */
/* Module viewer modal (click dot -> see/edit module answers)  */
/* ============================================================ */
.mv-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}
.mv-modal {
  background: var(--lp-ink-2, #0F1E36);
  border: 1px solid var(--lp-line, rgba(255,255,255,0.1));
  border-radius: 14px;
  padding: 0;
  max-width: 760px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}
.mv-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--lp-line, rgba(255,255,255,0.06));
}
.mv-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--lp-matrix, #00D4B8);
  color: var(--lp-ink, #0A1628);
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
}
.mv-head h2 {
  margin: 0;
  font-size: 18px;
  color: var(--lp-text, #fff);
  flex: 1;
  letter-spacing: -0.2px;
}
.mv-close {
  background: transparent;
  border: 0;
  color: var(--lp-text-3, #8189A0);
  font-size: 20px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.mv-close:hover { background: var(--lp-glass, rgba(255,255,255,0.06)); color: var(--lp-text, #fff); }
.mv-sub {
  margin: 0;
  padding: 0 24px 16px;
  color: var(--lp-text-mute, rgba(240,243,251,0.55));
  font-size: 13px;
}
.mv-fields {
  flex: 1;
  overflow-y: auto;
  padding: 0 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.mv-field { display: flex; flex-direction: column; }
.mv-field-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.mv-field-name {
  color: var(--lp-text, #fff);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  flex: 1;
}
.mv-field-key {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-family: var(--lp-font-mono, monospace);
  color: var(--lp-text-mute, rgba(240,243,251,0.55));
  white-space: nowrap;
}
.mv-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  border-radius: 6px;
  border: 1px solid var(--lp-line, rgba(255,255,255,0.1));
  background: var(--lp-ink, #0A1628);
  color: var(--lp-text, #fff);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.55;
  resize: vertical;
}
.mv-field textarea:focus {
  outline: none;
  border-color: var(--lp-matrix, #00D4B8);
  box-shadow: 0 0 0 3px rgba(0, 212, 184, 0.15);
}
.mv-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 14px 24px;
  border-top: 1px solid var(--lp-line, rgba(255,255,255,0.06));
}
.mv-diff { flex: 1; }
.mv-cancel,
.mv-save {
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.mv-cancel {
  background: transparent;
  border: 1px solid var(--lp-line, rgba(255,255,255,0.12));
  color: var(--lp-text, #fff);
}
.mv-cancel:hover { border-color: var(--lp-line-strong, rgba(255,255,255,0.32)); }
.mv-save {
  background: linear-gradient(135deg, var(--lp-matrix, #00D4B8), var(--lp-matrix-2, #00B89F));
  color: var(--lp-ink, #0A1628);
  border: 0;
}
.mv-save:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* Module dots are now buttons · keep their style normalized */
.module-dot {
  cursor: pointer;
  font-family: inherit;
  user-select: none;
}
.module-dot:hover {
  transform: scale(1.1);
  filter: brightness(1.15);
}
.module-dot:focus-visible {
  outline: 2px solid var(--lp-matrix, #00D4B8);
  outline-offset: 2px;
}
