/* ── View toggle (top-right pill) ────────────── */
.view-toggle {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  font-family: var(--mono);
  font-size: 11px;
}
.view-toggle button {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  transition: background 0.12s, color 0.12s;
}
.view-toggle button:hover { color: var(--text); }
.view-toggle button.active {
  background: var(--bg-hover);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--border-strong) inset;
}

/* ── Floor plan view (v2.4 isometric) ───────── */
.floorplan-wrap { display: none; }
body.view-floorplan .workspace { display: none; }
body.view-floorplan .floorplan-wrap { display: block; }

.floorplan-shell {
  padding: 18px 22px 24px;
  min-height: calc(100vh - 53px);
  display: flex;
  flex-direction: column;
}
.floorplan-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 12px;
}
.floorplan-head h1 { font-size: 20px; font-weight: 600; }
.floorplan-head .page-sub { color: var(--text-dim); font-size: 12px; font-family: var(--mono); }

/* Canvas host — building outer wall */
.floorplan-canvas-host {
  position: relative;
  flex: 1;
  min-height: 640px;
  background:
    radial-gradient(ellipse at 50% 35%, #101010 0%, #060606 70%),
    var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 0 0 2px #1a1a1a;
}
.floorplan-canvas-host svg.fp-svg {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}
.floorplan-canvas-host.fp-grabbing svg.fp-svg { cursor: grabbing; }

/* The viewport <g> wraps everything except defs + outer bg — pan/zoom
   modify only its transform. A short transition smooths wheel/reset
   without making drag feel laggy (we toggle the class off mid-drag). */
.fp-viewport-animated { transition: transform 0.12s ease-out; }

/* Reset-view button — sibling of the canvas, top-right. Sits above
   the detail-host slot, which only fills when an agent is selected. */
.fp-reset-btn {
  position: absolute;
  top: 14px;
  left: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  padding: 6px 12px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  z-index: 28;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.fp-reset-btn:hover {
  background: var(--bg-hover);
  color: var(--accent);
  border-color: var(--accent);
}
.fp-reset-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Avatars — smooth movement between desk and meeting ── */
.fp-avatar {
  cursor: pointer;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.4s ease;
  transform-box: fill-box;
}
.fp-avatar:hover { filter: drop-shadow(0 0 4px rgba(0, 230, 118, 0.6)); }
.fp-avatar-huddle { /* standing at meeting table — same easing handles the move */ }

/* ── Working-state pulse halo ───────────────── */
.fp-pulse {
  transform-origin: center;
  transform-box: fill-box;
  animation: fpPulse 1.8s ease-out infinite;
}
@keyframes fpPulse {
  0%   { opacity: 0.65; transform: scale(0.78); }
  60%  { opacity: 0.10; transform: scale(1.18); }
  100% { opacity: 0;    transform: scale(1.45); }
}

/* ── Walk animation for huddle move (subtle bob) ── */
.fp-avatar-huddle {
  animation: fpStandBob 3.4s ease-in-out infinite;
}
@keyframes fpStandBob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-1.2px); }
}

@media (prefers-reduced-motion: reduce) {
  .fp-pulse { animation: none; opacity: 0.4; }
  .fp-avatar { transition: none; }
  .fp-avatar-huddle { animation: none; }
}

/* ── Per-desk hover affordance ──────────────── */
.fp-desk { cursor: pointer; transition: filter 0.15s; }
.fp-desk:hover { filter: brightness(1.18) drop-shadow(0 0 6px rgba(0, 230, 118, 0.35)); }

/* Plant, decor, meeting tables, rooms, atrium don't take pointer events.
   Only desks + avatars are interactive (handled by wireInteractions). */
.fp-plant, .fp-decor, .fp-meeting, .fp-room, .fp-atrium { pointer-events: none; }

/* Tooltip */
.fp-tooltip {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 8px 11px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
  z-index: 30;
  max-width: 260px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.6);
  line-height: 1.55;
}
.fp-tooltip.visible { opacity: 1; }
.fp-tooltip strong { color: var(--accent); display: block; margin-bottom: 4px; font-weight: 600; }
.fp-tooltip .t-row { display: block; color: var(--text-dim); font-size: 10px; }

/* Idle banner */
.fp-idle-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 5;
}
.fp-idle-banner.visible { opacity: 1; }

/* Detail panel host (overlay top-right) */
.fp-detail-host {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 340px;
  max-height: calc(100% - 28px);
  overflow-y: auto;
  z-index: 25;
}
.fp-detail-host:empty { display: none; }
.fp-detail-host .agent-detail { margin-top: 0; }

/* ── Live working-agent detail panel (v2.6) ─────────────── */
.fp-working-pill {
  display: inline-block;
  padding: 2px 8px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  background: var(--accent);
  color: var(--bg);
  border-radius: 999px;
  margin-right: 8px;
  vertical-align: middle;
  animation: fpWorkingPulse 1.6s ease-in-out infinite;
}
@keyframes fpWorkingPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.45); }
  50%      { box-shadow: 0 0 0 5px rgba(0, 230, 118, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .fp-working-pill { animation: none; }
}
.fp-live-row {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
  margin-bottom: 12px;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.fp-live-elapsed { color: var(--accent); font-weight: 600; }
.fp-live-eta { font-size: 10px; }
.fp-activity {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text);
  margin-bottom: 14px;
  line-height: 1.45;
}
.fp-activity strong { color: var(--accent); font-weight: 600; }
.fp-huddle-with { margin-top: 12px; }
.fp-huddle-with .detail-stat-label { margin-bottom: 6px; }
.fp-huddle-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.fp-huddle-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 3px 9px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}
.fp-huddle-chip:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Mobile fallback */
.fp-mobile-fallback {
  display: none;
  padding: 40px 24px;
  text-align: center;
  color: var(--text-dim);
  font-family: var(--mono);
}
.fp-mobile-fallback h2 { font-size: 16px; margin-bottom: 8px; color: var(--text); }
.fp-mobile-fallback p { font-size: 12px; margin-bottom: 16px; line-height: 1.6; }
.fp-mobile-fallback button {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--accent);
  padding: 10px 18px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
}
.fp-mobile-fallback button:hover { background: var(--bg-hover); }
.fp-dept-summary { display: grid; gap: 8px; margin-top: 20px; text-align: left; }
.fp-dept-summary .dept-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-very-faint);
  border-radius: 4px;
  padding: 10px 12px;
}
.fp-dept-summary .dept-row.editorial { border-left-color: var(--accent); }
.fp-dept-summary .dept-row.growth { border-left-color: var(--info); }
.fp-dept-summary .dept-row.ops { border-left-color: var(--warn); }
.fp-dept-summary .dept-row.reliability { border-left-color: var(--error); }
.fp-dept-summary .dept-name { font-size: 11px; color: var(--text); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }
.fp-dept-summary .dept-agents { font-size: 10px; color: var(--text-dim); line-height: 1.6; }

@media (max-width: 720px) {
  body.view-floorplan .floorplan-canvas-host { display: none; }
  body.view-floorplan .fp-mobile-fallback { display: block; }
}

/* ── Working-state detail panel (v2.6) ─────────── */
/* Shown when a clicked agent is currently working (last run < 60s or in a huddle).
   Reuses the .agent-detail / .detail-stats / .detail-runs structure but adds
   live elements: WORKING pill, ticking elapsed counter, current activity card. */
.agent-detail.working {
  border-color: rgba(0, 230, 118, 0.35);
  box-shadow: 0 0 0 1px rgba(0, 230, 118, 0.15), 0 8px 24px rgba(0, 0, 0, 0.4);
}
.working-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 230, 118, 0.14);
  color: var(--accent);
  border: 1px solid rgba(0, 230, 118, 0.35);
  padding: 1px 8px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-left: 8px;
  vertical-align: middle;
}
.working-pill::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.4s infinite;
}
.working-elapsed {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  margin-left: 8px;
  font-feature-settings: 'tnum';
  animation: liveTextPulse 2s ease-in-out infinite;
}
@keyframes liveTextPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.activity-card {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.activity-card .activity-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.activity-card .activity-text {
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
}
.activity-card .activity-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 4px;
}
.activity-card .activity-meta .okr {
  color: var(--accent);
  background: rgba(0, 230, 118, 0.08);
  padding: 1px 5px;
  border-radius: 3px;
  margin-right: 6px;
}

.huddle-with {
  margin-bottom: 12px;
}
.huddle-with .huddle-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.huddle-with .huddle-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.huddle-with .huddle-chip {
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10px;
}
.huddle-with .huddle-chip.self {
  color: var(--accent);
  border-color: rgba(0, 230, 118, 0.4);
  background: rgba(0, 230, 118, 0.08);
}

.eta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  padding: 6px 0;
  border-top: 1px dashed var(--border);
  margin-top: 10px;
}
.eta-row .eta-label { color: var(--text-faint); }
.eta-row .eta-value { color: var(--text); font-feature-settings: 'tnum'; }
.eta-row .eta-value.over { color: var(--warn); }
