:root {
  --navy: #1f2b4d;
  --navy-soft: #2f3d6b;
  --ink: #26314f;
  --muted: #6b7699;
  --line: rgba(47, 61, 107, 0.12);
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.88);
  --shadow: 0 10px 30px rgba(31, 43, 77, 0.14), 0 2px 6px rgba(31, 43, 77, 0.08);
  /* Shared overlay metrics: every glass panel uses the same padding, radius and control height. */
  --overlay-pad: 4px 6px;
  --overlay-radius: 14px;
  --overlay-inset: 16px;
  --control-h: 28px;
  --header-h: 40px;
  --working: #3fbf7f;
  --idle: #9aa6c4;
  --reviewing: #a77bff;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  background: #e7ebfa;
}

button {
  font: inherit;
  color: inherit;
}

.app {
  position: relative;
  width: 100%;
  height: 100%;
}

.scene-container {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(1200px 700px at 30% 20%, #ffffff 0%, rgba(255, 255, 255, 0) 60%),
    radial-gradient(900px 600px at 85% 85%, #e9defe 0%, rgba(233, 222, 254, 0) 60%),
    linear-gradient(160deg, #eef2ff 0%, #dfe6fa 55%, #d4dcf5 100%);
}

/* Night backdrop fades in over the day gradient; --night is set from the real-time clock. */
.scene-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(1100px 650px at 30% 15%, rgba(92, 104, 190, 0.55) 0%, rgba(92, 104, 190, 0) 60%),
    linear-gradient(160deg, #1d2348 0%, #151a38 55%, #10142c 100%);
  opacity: var(--night, 0);
  transition: opacity 6s ease;
  pointer-events: none;
}

.office-canvas {
  width: 100%;
  height: 100%;
  touch-action: none;
}

.label-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.label-scaler {
  transform-origin: 50% 50%;
  transform: scale(0.75);
}

/* ------------------------------------------------------------------ overlay */

.overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

.overlay > * {
  pointer-events: auto;
}

.glass {
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: var(--shadow);
  border-radius: var(--overlay-radius);
  padding: var(--overlay-pad);
}

/* header */

.office-header {
  position: absolute;
  top: var(--overlay-inset);
  left: var(--overlay-inset);
  right: var(--overlay-inset);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.office-header > * {
  pointer-events: auto;
}

.office-header.is-collapsed {
  justify-content: flex-end;
}

.office-header__bar {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  height: var(--header-h);
}

.office-header__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 8px;
  flex-shrink: 0;
}

.office-header__divider {
  align-self: stretch;
  width: 1px;
  margin: 2px;
  background: var(--line);
  flex-shrink: 0;
}

.brand-logo {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: #4f8cff;
  flex-shrink: 0;
}

.brand-logo--lg {
  width: 80px;
  height: 80px;
  border-radius: 18px;
}

.brand-text {
  line-height: 1.15;
  white-space: nowrap;
}

.brand-text h1 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 750;
  letter-spacing: -0.01em;
  color: var(--navy);
}

.brand-text p {
  margin: 0;
  font-size: 10.5px;
  color: var(--muted);
}

.sim-pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f2a516;
  box-shadow: 0 0 0 0 rgba(242, 165, 22, 0.6);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(242, 165, 22, 0.55);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(242, 165, 22, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(242, 165, 22, 0);
  }
}

.office-header__controls {
  display: flex;
  align-items: center;
  gap: 4px;
  height: var(--header-h);
  flex-shrink: 0;
}

.env-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--control-h);
  padding: 0 10px 0 3px;
  border: 1px solid rgba(79, 140, 255, 0.16);
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(255, 214, 120, 0.22), rgba(127, 191, 255, 0.18));
  color: var(--navy-soft);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.4s, border-color 0.4s;
}

.env-chip:hover {
  border-color: rgba(79, 140, 255, 0.4);
}

.env-chip__icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.75);
  color: #f2a516;
}

.env-chip__time {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--navy);
}

.env-chip__label {
  font-weight: 500;
  opacity: 0.75;
}

.env-chip.is-night {
  background: linear-gradient(135deg, rgba(58, 71, 133, 0.18), rgba(167, 123, 255, 0.16));
}

.env-chip.is-night .env-chip__icon {
  color: #6c78c9;
}

.env-chip--cloudy .env-chip__icon {
  color: #7d8aa8;
}

.env-chip--rain .env-chip__icon {
  color: #3d8bdb;
}

.env-chip--storm .env-chip__icon {
  color: #8a63e6;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--control-h);
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--navy-soft);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.icon-btn:hover {
  background: rgba(79, 140, 255, 0.1);
}

.icon-btn.is-active {
  background: var(--navy);
  color: #fff;
}

.icon-btn--ghost {
  height: var(--control-h);
  width: var(--control-h);
  padding: 0;
  justify-content: center;
}

.icon-btn:focus-visible,
.primary-btn:focus-visible,
.legend-row:focus-visible {
  outline: 2px solid #4f8cff;
  outline-offset: 2px;
}

/* stats */

.office-stats {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--control-h);
  padding: 0 9px;
  border-radius: 10px;
  white-space: nowrap;
}

.stat-card + .stat-card {
  border-left: 1px solid var(--line);
  border-radius: 0;
}

.stat-card__icon {
  display: grid;
  place-items: center;
  color: var(--stat-color);
}

.stat-card__value {
  font-size: 15px;
  font-weight: 750;
  color: var(--navy);
}

.stat-card__label {
  font-size: 11.5px;
  color: var(--muted);
}

.office-stats__note {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #8a5a00;
  background: rgba(255, 201, 77, 0.22);
  white-space: nowrap;
  cursor: help;
}

.office-stats__note.is-live {
  color: #1f8a52;
  background: rgba(47, 191, 114, 0.16);
}

.office-stats__note.is-live .sim-pill__dot {
  background: #2fbf72;
  animation: none;
}

.office-stats__note.is-live.is-stale {
  color: #b5541b;
  background: rgba(255, 159, 67, 0.2);
}

.office-stats__note.is-live.is-stale .sim-pill__dot {
  background: #ff9f43;
}

/* status chips */

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.status-chip--working {
  color: #1d7a4c;
  background: rgba(63, 191, 127, 0.16);
}

.status-chip--idle {
  color: #5d6888;
  background: rgba(154, 166, 196, 0.22);
}

.status-chip--reviewing {
  color: #6c45d8;
  background: rgba(167, 123, 255, 0.18);
}

/* legend */

.agent-legend {
  position: absolute;
  left: var(--overlay-inset);
  bottom: var(--overlay-inset);
  width: 290px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: width 0.28s cubic-bezier(0.22, 1, 0.36, 1), padding 0.2s ease;
}

/* Collapsed: chip sits at the bottom-left, only as wide as the label. */
.agent-legend.is-closed {
  width: max-content;
  max-width: min(290px, calc(100% - var(--overlay-inset) * 2));
  padding: 4px 6px;
}

.agent-legend__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  padding: 6px 8px;
  border: none;
  background: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  white-space: nowrap;
}

.agent-legend:not(.is-closed) .agent-legend__toggle {
  width: 100%;
}

.agent-legend__count {
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(79, 140, 255, 0.14);
  color: #2c5bd6;
}

.agent-legend__chevron {
  flex-shrink: 0;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.agent-legend:not(.is-closed) .agent-legend__chevron {
  margin-left: auto;
}

/* Closed: chevron points up (list will open above). Open: points down toward the chip. */
.agent-legend.is-closed .agent-legend__chevron {
  transform: rotate(180deg);
}

.agent-legend ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: min(52vh, 420px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.legend-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.legend-row:hover,
.legend-row.is-hovered {
  background: rgba(255, 255, 255, 0.85);
}

.legend-row.is-selected {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.legend-row__swatch {
  width: 12px;
  height: 26px;
  border-radius: 6px;
  background: var(--accent);
  flex-shrink: 0;
}

.legend-row--boss .legend-row__swatch {
  display: grid;
  place-items: center;
  color: #ffd27a;
}

.legend-row--boss {
  margin-bottom: 4px;
  background: rgba(255, 210, 122, 0.14);
}

.legend-row__activity {
  display: inline-flex;
  color: var(--accent);
}

.legend-row__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.legend-row__text strong {
  font-size: 12px;
  color: var(--navy);
}

.legend-row__text small {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* detail panel */

.detail-panel {
  --panel-top: calc(var(--overlay-inset) + var(--header-h) + 10px);
  position: absolute;
  top: var(--panel-top);
  right: var(--overlay-inset);
  width: 340px;
  max-height: calc(100% - var(--panel-top) - var(--overlay-inset));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--glass-strong);
  border-top: 4px solid var(--accent);
  animation: slide-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 3;
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes panel-rise {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes panel-drop {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes modal-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modal-pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Shared open reveal for collapsible overlay panels */
.panel-reveal {
  display: flex;
  flex-direction: column;
  gap: 6px;
  transform-origin: center bottom;
  animation: panel-rise 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.panel-reveal--up {
  transform-origin: center bottom;
  animation-name: panel-rise;
}

.panel-reveal--down {
  transform-origin: center top;
  animation-name: panel-drop;
}

.detail-panel__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0 2px 4px;
}

.detail-panel__avatar {
  width: 48px;
  height: 44px;
  border-radius: 15px;
  background: color-mix(in srgb, var(--accent) 22%, white);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
  box-shadow: inset 0 -6px 0 rgba(31, 43, 77, 0.06);
}

.avatar-eye {
  width: 7px;
  height: 12px;
  border-radius: 4px;
  background: var(--navy);
}

.detail-panel__title {
  flex: 1;
  min-width: 0;
}

.detail-panel__title h2 {
  margin: 0;
  font-size: 18px;
  color: var(--navy);
}

.detail-panel__title p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.detail-panel__status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
}

.detail-activity {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 12%, white);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}

.detail-activity__icon {
  display: inline-grid;
  place-items: center;
  width: var(--control-h);
  height: var(--control-h);
  flex-shrink: 0;
  border-radius: 9px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 45%, white);
}

.detail-activity small {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail-activity strong {
  font-size: 13.5px;
  color: var(--navy);
}

.detail-block {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
}

.detail-block h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 7px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.detail-block__task {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--navy);
}

.detail-block__muted {
  margin: 0;
  font-size: 12px;
  color: var(--ink);
}

.progress {
  height: 9px;
  border-radius: 999px;
  background: rgba(47, 61, 107, 0.1);
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent));
  transition: width 0.5s ease;
}

.progress__meta {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  font-size: 12px;
  color: var(--muted);
}

.progress__meta strong {
  color: var(--navy);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.detail-metric {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  padding: 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  color: var(--accent);
}

.detail-metric__icon {
  display: flex;
  margin-top: 2px;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
}

.detail-metric strong {
  display: block;
  font-size: 14px;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

.detail-metric small {
  font-size: 10px;
  color: var(--muted);
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: transform 0.12s, background 0.15s;
}

.primary-btn:hover {
  background: var(--navy-soft);
}

.primary-btn:active {
  transform: scale(0.98);
}

.detail-panel__disclaimer {
  display: flex;
  gap: 7px;
  margin: 0;
  padding: 10px;
  border-radius: 12px;
  font-size: 11.5px;
  line-height: 1.4;
  color: #7a5a12;
  background: rgba(255, 201, 77, 0.16);
}

.detail-panel__disclaimer svg {
  flex-shrink: 0;
  margin-top: 1px;
}

/* hints */

.control-hints {
  position: absolute;
  bottom: var(--overlay-inset);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.control-hints > span {
  display: inline-flex;
  align-items: center;
  height: var(--control-h);
  padding: 0 6px;
}

kbd {
  font-size: 10px;
  font-weight: 650;
  padding: 2px 6px;
  margin-right: 3px;
  border-radius: 6px;
  background: rgba(47, 61, 107, 0.08);
  color: var(--navy-soft);
}

/* ------------------------------------------------------------------ 3D labels */

.agent-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 5px 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 16px rgba(31, 43, 77, 0.18);
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  pointer-events: auto;
  transition: transform 0.15s, box-shadow 0.15s;
}

.agent-label.is-hovered,
.agent-label.is-selected {
  transform: scale(1.06);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent), 0 10px 26px rgba(31, 43, 77, 0.22);
}

.agent-label__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
  flex-shrink: 0;
}

.agent-label__name {
  font-size: 12.5px;
  font-weight: 750;
  color: var(--navy);
}

.agent-label__activity {
  display: inline-flex;
  color: var(--accent);
}

.agent-label .status-chip {
  font-size: 9px;
  padding: 2px 7px;
}

.agent-tooltip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(31, 43, 77, 0.9);
  color: #fff;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 6px 16px rgba(31, 43, 77, 0.25);
}

/* ------------------------------------------------------------------ loading */

.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #eef2ff 0%, #dfe6fa 100%);
  transition: opacity 0.6s ease, visibility 0.6s;
}

.loading-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--navy-soft);
  font-weight: 600;
}

.loading-card p {
  margin: 0;
}

.loading-bar {
  width: 180px;
  height: 6px;
  border-radius: 999px;
  background: rgba(47, 61, 107, 0.12);
  overflow: hidden;
}

.loading-bar span {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4f8cff, #a77bff);
  animation: loading 1.2s ease-in-out infinite;
}

@keyframes loading {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(250%);
  }
}

/* ------------------------------------------------------------------ prediction panel */

.prediction-panel {
  position: absolute;
  right: var(--overlay-inset);
  bottom: var(--overlay-inset);
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  font-size: 12px;
}

.prediction-panel__head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.prediction-panel__price {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--navy-soft);
}

.prediction-panel__boss {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(79, 140, 255, 0.12);
  color: #2c5bd6;
  font-weight: 600;
  align-self: flex-start;
}

.prediction-panel__boss.phase-watching,
.prediction-panel__boss.phase-to-dashboard {
  background: rgba(242, 165, 22, 0.16);
  color: #b26f00;
}

.prediction-panel__boss.phase-happy {
  background: rgba(47, 191, 114, 0.16);
  color: #1f8a52;
}

.prediction-panel__boss.phase-sad {
  background: rgba(239, 79, 95, 0.14);
  color: #c4303f;
}

.prediction-panel__current {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 4px 8px;
  padding: 7px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
}

.prediction-panel__current .pred-meta {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 10px;
}

.prediction-panel__empty {
  margin: 0;
  color: var(--muted);
}

.prediction-panel__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.prediction-panel__list li {
  display: grid;
  grid-template-columns: 62px 1fr auto auto;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  border-radius: 7px;
}

.prediction-panel__list li.is-tracked {
  background: rgba(242, 165, 22, 0.12);
}

.pred-dir {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 800;
  font-size: 10px;
}

.pred-dir.is-long {
  color: #1f9d5c;
}

.pred-dir.is-short {
  color: #d63a4a;
}

.pred-id,
.pred-time {
  font-size: 10px;
  color: var(--navy-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pred-time {
  color: var(--muted);
}

.pred-outcome {
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 10px;
  text-align: center;
}

.pred-outcome.is-correct {
  background: rgba(47, 191, 114, 0.16);
  color: #1f8a52;
}

.pred-outcome.is-wrong {
  background: rgba(239, 79, 95, 0.14);
  color: #c4303f;
}

.pred-outcome.is-pending {
  background: rgba(242, 165, 22, 0.16);
  color: #b26f00;
}

.pred-outcome.is-void {
  background: rgba(154, 166, 196, 0.2);
  color: var(--muted);
}

.prediction-panel__all {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--navy-soft);
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.prediction-panel__all:hover:not(:disabled) {
  background: #fff;
  border-color: rgba(79, 140, 255, 0.45);
  color: #2c5bd6;
}

.prediction-panel__all:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ------------------------------------------------------------------ prediction history dialog */

.prediction-history__backdrop {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--overlay-inset);
  background: rgba(31, 43, 77, 0.28);
  z-index: 10;
  animation: modal-fade 0.2s ease-out;
}

.prediction-history {
  width: min(760px, 100%);
  max-height: min(620px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  background: var(--glass-strong);
  font-size: 12px;
  animation: modal-pop 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.prediction-history__head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.prediction-history__count {
  color: var(--muted);
  font-size: 11px;
}

.prediction-history__close {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--navy-soft);
  cursor: pointer;
}

.prediction-history__close:hover {
  background: rgba(47, 61, 107, 0.08);
}

.prediction-history__table-wrap {
  overflow: auto;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
}

.prediction-history__table {
  width: 100%;
  border-collapse: collapse;
}

.prediction-history__table th,
.prediction-history__table td {
  padding: 6px 10px;
  text-align: left;
  white-space: nowrap;
}

.prediction-history__table th {
  position: sticky;
  top: 0;
  background: #f4f6fb;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.prediction-history__table tbody tr + tr td {
  border-top: 1px solid var(--line);
}

.prediction-history__table tr.is-tracked td {
  background: rgba(242, 165, 22, 0.12);
}

.prediction-history__table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.prediction-history__table td.pred-id,
.prediction-history__table td.pred-time {
  font-size: 11px;
}

.prediction-history__pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.prediction-history__pager > span:first-child {
  margin-right: auto;
}

.prediction-history__pager button {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--navy-soft);
  cursor: pointer;
}

.prediction-history__pager button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ------------------------------------------------------------------ responsive */

/* SMC / ICT desk + ForexFactory calendar (right side, above the prediction panel) */
.intel-panel {
  position: absolute;
  right: var(--overlay-inset);
  top: calc(var(--overlay-inset) + 48px);
  width: 300px;
  max-height: calc(100% - var(--overlay-inset) * 2 - 64px - 200px);
  overflow-y: auto;
  scrollbar-width: thin;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 10px;
  font-size: 11px;
  transition: width 0.28s cubic-bezier(0.22, 1, 0.36, 1), padding 0.2s ease;
}

/* Collapsed: shrink-wrap so the header chip does not stretch across the band. */
.intel-panel.is-closed {
  width: max-content;
  max-width: min(300px, calc(100% - var(--overlay-inset) * 2));
  max-height: none;
  overflow: visible;
  padding: 6px 10px;
}

.intel-panel__head {
  /* Stay chip-sized and pinned to the right so the label does not jump when the panel opens. */
  display: inline-flex;
  align-items: center;
  align-self: flex-end;
  gap: 6px;
  width: auto;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 12px;
  color: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.intel-panel__chevron {
  flex-shrink: 0;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.intel-panel.is-closed .intel-panel__chevron {
  transform: rotate(-90deg);
}

.intel-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
}

.intel-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.intel-chip {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(31, 43, 77, 0.08);
  color: var(--navy-soft);
}

.intel-chip.is-bull {
  background: rgba(47, 191, 114, 0.16);
  color: #1f8a52;
}

.intel-chip.is-bear {
  background: rgba(239, 79, 95, 0.14);
  color: #c4303f;
}

.intel-chip.is-muted {
  color: var(--muted);
}

.intel-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 8px;
}

.intel-checklist li {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--muted);
}

.intel-checklist li.is-ok {
  color: #1f8a52;
  font-weight: 700;
}

.intel-note {
  margin: 0;
  font-size: 10px;
  color: var(--muted);
}

.intel-note.is-warn {
  color: #c4303f;
  font-weight: 700;
}

.intel-subhead {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--navy-soft);
}

.intel-events {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.intel-events li {
  display: grid;
  grid-template-columns: 8px 62px 28px 1fr auto;
  align-items: center;
  gap: 5px;
  font-size: 10px;
}

.intel-events li.is-past {
  opacity: 0.5;
}

.intel-impact {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: #c9cfdc;
}

.intel-impact.is-high {
  background: #e5484d;
}

.intel-impact.is-medium {
  background: #f2a516;
}

.intel-events__time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.intel-events__cur {
  font-weight: 800;
  color: var(--navy-soft);
}

.intel-events__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.intel-events__fc {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pred-levels {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pred-levels .is-tp {
  color: #1f8a52;
}

.pred-levels .is-sl {
  color: #c4303f;
}

.intel-perf {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin: 4px 0;
}

.intel-perf span {
  display: flex;
  flex-direction: column;
  padding: 4px 6px;
  border-radius: 8px;
  background: rgba(79, 140, 255, 0.07);
}

.intel-perf small {
  font-size: 9px;
  color: var(--ink-soft, #6b7697);
  white-space: nowrap;
}

.intel-perf strong {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.intel-perf .is-up,
.is-r-up {
  color: #1f8a52;
}

.intel-perf .is-down,
.is-r-down {
  color: #c4303f;
}

.intel-spark {
  display: block;
  width: 100%;
  height: 30px;
  margin: 2px 0 4px;
}

.intel-spark path {
  fill: none;
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}

.intel-spark path.is-up {
  stroke: #2fbf72;
}

.intel-spark path.is-down {
  stroke: #ef4f5f;
}

.intel-spark__zero {
  stroke: rgba(107, 118, 151, 0.35);
  stroke-dasharray: 3 3;
  vector-effect: non-scaling-stroke;
}

.role-read__verdict {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.role-read__lines {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 3px;
  font-size: 11.5px;
}

.role-read__lines li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.role-read__lines span {
  color: var(--ink-soft, #6b7697);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-read__lines strong {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.role-read--up {
  color: #1f8a52;
}

.role-read--down {
  color: #c4303f;
}

.role-read--warn {
  color: #b7791f;
}

.role-read--neutral {
  color: var(--ink);
}

@media (max-width: 1280px) {
  .stat-card__label {
    display: none;
  }
}

@media (max-width: 1100px) {
  .control-hints {
    display: none;
  }

  .icon-btn__text,
  .env-chip__label {
    display: none;
  }

  .icon-btn {
    padding: 0 7px;
  }
}

@media (max-width: 900px) {
  :root {
    --overlay-inset: 12px;
  }

  .brand-text p {
    display: none;
  }

  .agent-legend {
    width: 250px;
  }

  .detail-panel {
    top: auto;
    bottom: var(--overlay-inset);
    width: 300px;
    max-height: calc(100% - 200px);
    z-index: 2;
  }
}

@media (max-width: 760px) {
  .office-stats__note,
  .brand-text {
    display: none;
  }
}

@media (max-width: 640px) {
  .agent-legend,
  .intel-panel,
  .prediction-panel {
    display: none;
  }

  .detail-panel {
    left: var(--overlay-inset);
    width: auto;
    max-height: 46%;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}
