/* Independent overlays are anchored to the office viewport. */
.office-panel {
  --edge: clamp(10px, 1vw, 18px);
  --left-width: clamp(180px, 15vw, 246px);
  --right-width: clamp(205px, 18vw, 292px);
  --surface: rgba(255, 255, 255, 0.96);
  --outline: 1px solid rgba(58, 66, 63, 0.12);
  --shadow: 0 3px 16px rgba(20, 30, 28, 0.09);
  color: #202622;
}
body:not(.command-view-open) .topbar {
  left: 1vw;
  top: 1vw;
  height: 36px;
  padding: 0 10px;
  gap: 8px;
  background: white;
  border-radius: 10px;
}
.topbar .brand {
  font-size: 14px;
  gap: 6px;
}
.topbar .brand-mark {
  width: 22px;
  height: 22px;
  font-size: 14px;
}
.topbar .workspace-path,
.topbar .dataset-tag {
  display: none;
}
.workspace .scene-actions {
  left: calc(1vw + 170px);
  top: 1vw;
  right: auto;
  height: 36px;
  padding: 2px 5px;
  border-radius: 9px;
}
.workspace .scene-actions button {
  font-size: 11px;
  padding: 4px 6px;
}
#team-counts,
.office-panel #approval,
.office-panel #team-panel,
.office-panel .task-identity,
.workspace .scene-activity,
.camera-hint {
  position: absolute;
  z-index: 5;
  margin: 0;
  background: var(--surface);
  border: var(--outline);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
#team-counts {
  left: 50%;
  top: var(--edge);
  transform: translateX(-50%);
  height: 36px;
  gap: 13px;
}
#hud-left {
  position: absolute;
  z-index: 6;
  left: var(--edge);
  top: calc(var(--edge) + 46px);
  width: var(--left-width);
  max-height: calc(100% - 244px);
  overflow: auto;
  scrollbar-width: thin;
  display: grid;
  gap: 7px;
}
#hud-left > * {
  width: 100%;
  margin: 0;
  background: var(--surface);
  border: var(--outline);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
#hud-left .flow-dock {
  position: static;
  height: auto;
  padding: 10px;
}
#hud-left .flow-dock header {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
#hud-left h2 {
  font-size: 13px;
  color: #343b36;
}
#hud-left #stage-count {
  margin-left: auto;
  font-size: 10px;
}
#hud-left #open-run-flow {
  font-size: 10px;
  padding: 3px 5px;
}
#hud-left #stage-strip {
  position: static;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  margin: 6px 0 0;
  padding: 0;
  width: 100%;
  background: transparent;
  border: 0;
}
#hud-left .stage-card {
  display: flex;
  align-items: center;
  text-align: left;
  gap: 9px;
  width: 100%;
  padding: 5px 8px;
  min-height: 32px;
  border: 0;
  background: transparent;
}
#hud-left .stage-card:after {
  display: none;
}
#hud-left .stage-card.selected,
#hud-left .stage-card:hover {
  background: #f1f3f1;
}
#hud-left .stage-card .step-icon {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 6px;
  background: #eef1ee;
  color: #3b463e;
  font-size: 12px;
}
#hud-left .stage-card.selected .step-icon {
  background: #242c26;
  color: white;
}
#hud-left .stage-card strong {
  font-size: 13px;
  color: #29312c;
}
#hud-left .stage-card small {
  display: block;
  color: #718078;
  font-size: 10px;
}
#hud-left .hud-fold {
  padding: 10px 13px;
  font-size: 13px;
  color: #2a322d;
}
.hud-fold summary {
  cursor: pointer;
  font-weight: 600;
}
.hud-fold summary span {
  margin-left: 6px;
  color: #748077;
}
.hud-fold button {
  display: block;
  background: #f1f4f1;
  border: 0;
  color: #34463a;
  margin-top: 6px;
  padding: 6px 9px;
  border-radius: 5px;
  cursor: pointer;
}
#finished-list {
  font-size: 12px;
}
#pending-inbox {
  padding: 8px;
  color-scheme: light;
}
#pending-inbox .pending-body {
  max-height: 28vh;
  overflow: auto;
}
.office-panel #approval:not([hidden]) {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 8px;
  top: calc(var(--edge) + 46px);
  left: 50%;
  transform: translateX(-50%);
  width: min(390px, 38vw);
  padding: 9px 11px;
}
#approval .eyebrow {
  grid-row: span 2;
  background: #eda940;
  font-size: 0;
  width: 24px;
  height: 24px;
  border-radius: 7px;
}
#approval h3,
#approval p {
  margin: 0;
  color: #303731;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
#approval h3 {
  font-size: 13px;
}
#approval p {
  grid-column: 2;
  font-size: 11px;
  color: #647068;
}
#approval .approval-actions {
  grid-column: 3;
  grid-row: 1/3;
  display: flex;
  gap: 5px;
  margin: 0;
}
#approval button {
  border: 0;
  border-radius: 7px;
  width: auto;
  min-height: 27px;
  padding: 4px 8px;
  font-size: 12px;
  color: #303731;
  background: #eef1ef;
}
#approval #approve {
  background: #19221c;
  color: white;
}
.office-panel #team-panel {
  right: var(--edge);
  top: var(--edge);
  width: var(--right-width);
  overflow: hidden;
}
#team-panel .team-panel-header {
  padding: 12px 15px;
}
#team-panel .team-panel-header p {
  margin: 5px 0 0;
}
#team-panel .team-member {
  padding: 9px 12px;
  min-height: 44px;
}
#team-panel .team-member-text strong {
  font-size: 13px;
  color: #303832;
}
#team-panel .team-member-text small {
  font-size: 11px;
}
.office-panel .task-identity {
  right: var(--edge);
  bottom: var(--edge);
  width: var(--right-width);
  padding: 13px 15px;
}
.task-identity :is(header, footer, p) {
  margin: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  color: #606b63;
  font-size: 12px;
}
.task-identity p {
  margin: 8px 0 0;
}
.task-identity p strong {
  font-size: 24px;
  color: #202622;
}
.task-identity progress {
  width: 100%;
  height: 5px;
  accent-color: #233529;
  margin: 6px 0 10px;
}
.workspace .scene-activity {
  left: var(--edge);
  bottom: var(--edge);
  width: clamp(230px, 20vw, 320px);
  padding: 9px 12px;
}
.office-panel .scene-activity #activity {
  max-height: 104px;
  overflow: auto;
  margin-top: 6px;
}
.office-panel .scene-activity #activity li {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  padding: 3px 0;
  line-height: 16px;
}
.camera-hint {
  bottom: var(--edge);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  font-size: 11px;
  color: #646e68;
  pointer-events: none;
}
#work-details {
  max-height: 80dvh;
  overflow: auto;
  color-scheme: light;
  color: #283b2e;
  background: #fff;
}
#work-details details,
#work-details .history-row {
  margin-top: 14px;
}
#work-details .metric,
#work-details .result-notes {
  background: #eef3ef;
  color: #26372b;
}
#work-details .metric strong {
  color: #26372b;
}
.office-panel > .error-banner {
  position: absolute;
  left: 50%;
  top: 120px;
  transform: translateX(-50%);
  z-index: 8;
}
@media (max-width: 1040px) {
  #team-counts {
    top: 54px;
  }
  .office-panel #approval:not([hidden]) {
    top: 96px;
  }
}
@media (max-width: 760px) {
  .office-panel {
    --edge: 7px;
  }
  body:not(.command-view-open) .topbar {
    top: 7px;
    left: 7px;
  }
  .workspace .scene-actions {
    left: auto;
    top: 7px;
    right: 7px;
  }
  #team-counts {
    top: 50px;
    height: 27px;
    gap: 8px;
  }
  .office-panel #approval:not([hidden]) {
    top: 83px;
    width: min(360px, 95vw);
  }
  #toggle-panels {
    display: block;
    position: absolute;
    z-index: 7;
    top: 51px;
    left: 7px;
    background: white;
    border-radius: 7px;
    padding: 5px;
  }
  #hud-left {
    display: none;
    top: 130px;
    max-height: calc(100% - 180px);
  }
  #hud-left.expanded {
    display: grid;
  }
  .office-panel #team-panel {
    top: auto;
    bottom: 7px;
    width: min(40vw, 190px);
    max-height: 29vh;
    overflow: auto;
  }
  #team-panel .team-panel-header {
    padding: 6px 9px;
  }
  #team-panel .team-panel-header p,
  .office-panel .task-identity,
  .camera-hint {
    display: none;
  }
  .workspace .scene-activity {
    width: 54vw;
  }
}
.workspace .scene-actions {
  left: calc(1vw + 278px);
}
.team-panel-header h3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.team-panel-header h3 small {
  font-size: 10px;
  font-weight: 400;
}
.zoom-tools {
  position: absolute;
  z-index: 5;
  bottom: var(--edge);
  right: calc(var(--edge) + var(--right-width) + 8px);
  display: grid;
  background: white;
  border: var(--outline);
  border-radius: 9px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.zoom-tools button {
  color: #343e38;
  background: white;
  border: 0;
  width: 28px;
  height: 26px;
  cursor: pointer;
}
.zoom-tools button:hover {
  background: #edf1ed;
}
@media (max-width: 760px) {
  .workspace .scene-actions {
    left: auto;
  }
  .zoom-tools {
    bottom: 31vh;
    right: 7px;
  }
}
.budget-values {
  display: grid;
  gap: 5px;
  margin: 0 0 10px;
  font-size: 11px;
  color: #5d6761;
}
.budget-values span {
  display: flex;
  justify-content: space-between;
}
.budget-values b {
  font-weight: 500;
  color: #27362d;
}
#work-details {
  width: min(520px, 92vw);
  padding: 20px;
}
#work-details
  :is(
    .role-summary,
    .result-header h4,
    .evidence p,
    .evidence ul,
    .metric span,
    .result-notes summary,
    .result-notes p,
    .section-title h3,
    .empty-state h3,
    .empty-state p
  ) {
  color: #405347;
}
#work-details #task-mode {
  font-size: 12px;
  color: #67796e;
}
#work-details .history-row select {
  max-width: 100%;
}
#office-tools {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
#hud-left .stage-card small:before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 4px;
  vertical-align: 2px;
  border-radius: 50%;
  background: #a5aca7;
}
#hud-left .stage-card.done small:before,
#hud-left .stage-card.completed small:before {
  background: #68a776;
}
#hud-left .stage-card.awaiting_approval small:before {
  background: #d49f43;
}
#hud-left .stage-card.running small:before {
  background: #66aabd;
}
#hud-left .stage-card.failed small:before {
  background: #cc706c;
}

/* Typography and controls shared by the floating office panels. */
.office-panel
  :is(
    #hud-left,
    #team-panel,
    .task-identity,
    .scene-activity,
    .scene-actions,
    #team-counts
  ) {
  font-family:
    -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    sans-serif;
  font-variant-numeric: tabular-nums;
}
.office-panel
  :is(#hud-left, #team-panel, .scene-actions, .zoom-tools)
  button:focus-visible {
  outline: 2px solid #34775c;
  outline-offset: -2px;
}
#hud-left .flow-dock {
  padding: 12px;
}
#hud-left .flow-dock header {
  justify-content: space-between;
  padding: 0 2px 6px;
}
#hud-left h2,
#team-panel h3 {
  font-size: 14px;
  line-height: 20px;
  font-weight: 650;
}
#hud-left #stage-count {
  font-size: 11px;
  color: #586960;
}
#hud-left .stage-card {
  position: relative;
  gap: 10px;
  min-height: 41px;
  padding: 4px 8px;
  border-radius: 8px;
}
#hud-left .stage-card .step-icon {
  display: grid;
  place-items: center;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font:
    600 12px/1 -apple-system,
    sans-serif;
  color: #4c5e55;
  background: #ebefed;
}
#hud-left .stage-card:is(.done, .completed) .step-icon {
  background: #e0efe6;
  color: #266645;
}
#hud-left .stage-card.selected {
  background: #ecf4ef;
}
#hud-left .stage-card.selected .step-icon {
  background: #275942;
  color: white;
}
#hud-left .stage-card strong {
  line-height: 18px;
  font-weight: 600;
}
#hud-left .stage-card small {
  font-size: 11px;
  line-height: 16px;
}
#hud-left #open-run-flow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-top: 7px;
  padding: 7px 10px;
  color: #315e48;
  border: 0;
  border-radius: 7px;
  background: #edf4ef;
  line-height: 16px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
}
#hud-left #open-run-flow:hover {
  background: #dfebe3;
}
.hud-chevron {
  display: inline-block;
  width: 7px;
  height: 7px;
  border: solid currentColor;
  border-width: 1.5px 1.5px 0 0;
  transform: rotate(45deg);
  margin-right: 3px;
}
#team-panel .team-member-open {
  flex: 0 0 7px;
  color: #72867b;
  opacity: 1;
}
#team-panel .team-member:hover .team-member-open {
  color: #174e36;
}
#team-panel .team-member {
  gap: 10px;
  min-height: 48px;
}
#team-panel .team-member-text strong {
  font-weight: 600;
  line-height: 19px;
}
#team-panel .team-member-text small {
  line-height: 16px;
  color: #59695f;
}
#team-panel .team-member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--member-color) 15%, white);
}
#team-panel .team-member-avatar i {
  width: 23px;
  height: 19px;
  border-radius: 7px;
  border: 3px solid var(--member-color);
  background: #253641;
  box-sizing: border-box;
}
#team-panel .team-member-avatar i:before,
#team-panel .team-member-avatar i:after {
  top: 4px;
  width: 3px;
  height: 5px;
  border-radius: 2px;
  background: #edfff9;
}
#team-panel .team-member-avatar b {
  right: -1px;
  bottom: 0;
  width: 8px;
  height: 8px;
  border: 2px solid white;
}
.office-panel .task-identity {
  padding: 14px 16px;
}
.task-identity header {
  font-weight: 600;
  color: #384c40;
}
.task-identity p {
  justify-content: flex-start;
  gap: 7px;
  margin: 10px 0 3px;
}
.task-identity p strong {
  font-size: 29px;
  line-height: 1.1;
  letter-spacing: -0.035em;
}
.task-identity progress {
  appearance: none;
  display: block;
  height: 5px;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #e5ebe7;
  margin: 9px 0 13px;
}
.task-identity progress::-webkit-progress-bar {
  background: #e5ebe7;
}
.task-identity progress::-webkit-progress-value {
  background: #477960;
  border-radius: 8px;
}
.task-identity progress::-moz-progress-bar {
  background: #477960;
}
.task-identity .budget-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.budget-values span {
  display: grid;
  gap: 3px;
  color: #607168;
}
.budget-values b {
  font-size: 14px;
  font-weight: 600;
  color: #253a2e;
}
.task-identity footer {
  padding-top: 9px;
  border-top: 1px solid #e0e7e2;
  font-size: 11px;
}
.zoom-tools button + button {
  border-top: 1px solid #e1e7e3;
}

.topbar #new-task {
  background: #215c40;
  color: white;
  border: 0;
  border-radius: 7px;
  padding: 5px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}
.topbar #new-task:hover { background: #16492f; }
.topbar #new-task:disabled { background: #607768; cursor: default; }
@media (max-width: 480px) {
  .topbar .connection { display: none; }
  .topbar #new-task { padding-inline: 8px; }
}
