/* LiminalOS autonomous carrier workbench — final layout overrides.
   Loaded after theme.css so the grid is stable across themes. */

html.cyberclaw-light .main.cockpit {
  grid-template-columns: minmax(0, 3fr) minmax(0, 4fr) minmax(0, 3fr);
  grid-template-rows: repeat(2, minmax(0, 1fr));
  grid-template-areas:
    "left center right"
    "left physical physical";
}

html.cyberclaw-light .left-rail,
html.cyberclaw-light .left-rail.answer-final-mode {
  grid-template-rows: clamp(170px, 22vh, 220px) minmax(0, 1fr);
}

html.cyberclaw-light .task-panel,
html.cyberclaw-light .task-input-body,
html.cyberclaw-light .question-box {
  min-height: 0;
}

html.cyberclaw-light .right {
  grid-area: auto;
  grid-column: 3;
  grid-row: 1 / 3;
  z-index: 1;
  display: grid;
  grid-template-rows: minmax(0, 3fr) minmax(0, 3fr) minmax(0, 4fr);
  align-content: stretch;
  min-width: 0;
  min-height: 0;
  overflow: hidden !important;
}

html.cyberclaw-light .right > .panel {
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: auto !important;
  align-self: stretch !important;
  overflow: hidden;
}

html.cyberclaw-light .right .skill-resource-panel .callbody,
html.cyberclaw-light .right .rag-panel .info-space-body {
  min-height: 0;
  overflow: hidden;
}

html.cyberclaw-light .right .skill-resource-panel .skill-table-wrap,
html.cyberclaw-light .right .rag-panel .info-space-body .space-pane {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  overflow: auto;
  scrollbar-gutter: stable;
}

html.cyberclaw-light .right .rag-panel .info-space-body .observe-list,
html.cyberclaw-light .right .rag-panel .info-space-body .rag-list {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  overflow: auto;
}

html.cyberclaw-light .right .rag-panel .info-space-body .space-pane {
  display: flex;
}

html.cyberclaw-light .physical-modules {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 3fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

html.cyberclaw-light .physical-modules .scene-module {
  grid-column: 1;
}

html.cyberclaw-light .physical-modules > .panel {
  min-width: 0;
  min-height: 0;
  height: 100% !important;
  overflow: hidden;
}

html.cyberclaw-light .physical-modules .agent-space-body {
  min-height: 0;
  overflow: hidden;
}

html.cyberclaw-light .physical-modules .agent-pane {
  min-height: 0;
  height: auto !important;
  overflow: auto;
  scrollbar-gutter: stable;
}

html.cyberclaw-light .physical-modules .agent-space-module .entity-card-grid {
  padding-bottom: 8px;
}

/* The real WebRTC layer supplies the first-person picture. */
.webrtc-stage-placeholder {
  display: none !important;
}

.webrtc-only-frame {
  background: #02060d !important;
  border: 0 !important;
  box-shadow: none !important;
}

.live-camera-box[data-state="probing"],
.live-camera-box[data-state="error"] {
  background: transparent !important;
}

@media (max-width: 1360px), (max-height: 760px) {
  html.cyberclaw-light .main.cockpit {
    grid-template-columns: minmax(0, 3fr) minmax(0, 4fr) minmax(0, 3fr);
    grid-template-rows: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "left center right"
      "left physical physical";
  }

  html.cyberclaw-light .left-rail,
  html.cyberclaw-light .left-rail.answer-final-mode {
    grid-template-rows: clamp(150px, 23vh, 190px) minmax(0, 1fr);
  }
}

/* Agent metric cards: battery / speed / mode / location stay on one row. */
/* Keep the device heading and its four metric cards visually grouped. */
html.cyberclaw-light .agent-space-module .entity-card-grid {
  grid-auto-rows: max-content !important;
}
html.cyberclaw-light .agent-space-module .entity-card {
  min-height: 0;
  align-content: start;
  row-gap: 4px;
}
html.cyberclaw-light .agent-space-module .entity-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 6px;
}
html.cyberclaw-light .agent-space-module .entity-metric {
  min-width: 0;
  padding-inline: 7px;
}
html.cyberclaw-light .agent-space-module .entity-metric b {
  min-width: 0;
  font-size: 13px;
  line-height: 1.25;
}
html.cyberclaw-light .agent-space-module .entity-metric-location b {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 1360px), (max-height: 760px) {
  html.cyberclaw-light .agent-space-module .entity-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 5px;
  }
  html.cyberclaw-light .agent-space-module .entity-metric {
    padding-inline: 6px;
  }
  html.cyberclaw-light .agent-space-module .entity-metric b {
    font-size: 12px;
  }
}

/* Compact skill counters aligned to the right side of the title bar. */
html.cyberclaw-light .skill-resource-panel {
  position: relative;
}
html.cyberclaw-light .right .skill-resource-panel:not(:fullscreen) .callbody {
  grid-template-rows: auto minmax(0, 1fr) !important;
}
html.cyberclaw-light .right .skill-resource-panel .skill-summary {
  position: absolute !important;
  top: 10px;
  right: 12px;
  z-index: 4;
  width: auto !important;
  max-width: calc(100% - 152px);
  min-width: 0;
  min-height: 24px !important;
  height: 24px !important;
  margin: 0;
  padding: 0 !important;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  box-shadow: none;
  scrollbar-width: none;
}
html.cyberclaw-light .right .skill-resource-panel .skill-summary::-webkit-scrollbar {
  display: none;
}
html.cyberclaw-light .right .skill-resource-panel .skill-summary .skill-stat-list {
  display: flex !important;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  width: max-content !important;
  min-width: 100%;
  height: 24px !important;
  min-height: 24px !important;
  gap: 4px !important;
  overflow: visible !important;
}
html.cyberclaw-light .right .skill-resource-panel .skill-summary .skill-stat-list > i {
  display: none !important;
}
html.cyberclaw-light .right .skill-resource-panel .skill-summary .skill-stat-list > span {
  display: inline-flex !important;
  flex: 0 0 auto !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: center;
  width: auto !important;
  min-width: 0 !important;
  height: 22px !important;
  min-height: 22px !important;
  gap: 3px !important;
  padding: 0 6px !important;
  border: 1px solid var(--ui-line-soft);
  border-radius: 7px;
  background: var(--ui-surface-2);
  color: var(--ui-ink-3);
  font-size: 9px !important;
  font-weight: 650;
  line-height: 1 !important;
  white-space: nowrap !important;
}
html.cyberclaw-light .right .skill-resource-panel .skill-summary .skill-stat-list > span b {
  order: initial !important;
  font-size: 11px !important;
  font-weight: 800;
  line-height: 1 !important;
}
html.cyberclaw-light .right .skill-resource-panel .skill-summary .summary-dot {
  width: 6px;
  height: 6px;
  margin: 0 1px 0 0 !important;
}
@media (max-width: 1360px), (max-height: 760px) {
  html.cyberclaw-light .right .skill-resource-panel .skill-summary {
    top: 8px;
    right: 9px;
    max-width: calc(100% - 138px);
  }
  html.cyberclaw-light .right .skill-resource-panel .skill-summary .skill-stat-list > span {
    padding-inline: 5px !important;
    font-size: 8.5px !important;
  }
  html.cyberclaw-light .right .skill-resource-panel .skill-summary .skill-stat-list > span b {
    font-size: 10.5px !important;
  }
}

/* Phase 5: map edge detection results onto the first-person WebRTC image. */
.live-camera-box .detection-overlay-layer {
  position: absolute;
  inset: 0;
  z-index: 12;
  overflow: hidden;
  pointer-events: none;
}
.live-camera-box .detection-overlay-meta {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 5px 9px;
  border: 1px solid rgba(125, 211, 252, .45);
  border-radius: 7px;
  background: rgba(2, 12, 27, .78);
  color: #dff7ff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .2px;
  backdrop-filter: blur(6px);
}
.live-camera-box .detection-overlay-box {
  position: absolute;
  box-sizing: border-box;
  min-width: 2px;
  min-height: 2px;
  border: 2px solid var(--detection-color, #22d3ee);
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(2, 12, 27, .7), inset 0 0 14px rgba(0, 0, 0, .08);
}
.live-camera-box .detection-overlay-box > span {
  position: absolute;
  top: -2px;
  left: -2px;
  max-width: max(100%, 130px);
  padding: 3px 6px;
  border-radius: 3px 3px 3px 0;
  background: var(--detection-color, #22d3ee);
  color: #04111f;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
  transform: translateY(-100%);
}
.live-camera-box .detection-overlay-box.label-inside > span {
  top: 2px;
  left: 2px;
  transform: none;
}

/* Cross-platform viewport normalization (macOS / Windows).
   Preserve the existing 3:4:3, 3:3:4 and 1:1 layout ratios while fluidly
   scaling only spacing and typography chrome. */
html.cyberclaw-light {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Helvetica Neue", Arial, sans-serif;
}
html.cyberclaw-light *,
html.cyberclaw-light *::before,
html.cyberclaw-light *::after {
  box-sizing: border-box;
}
html.cyberclaw-light .main.cockpit {
  --workspace-gap: clamp(7px, .6vw, 12px);
  gap: var(--workspace-gap);
  padding: var(--workspace-gap);
}
html.cyberclaw-light .left-rail,
html.cyberclaw-light .right,
html.cyberclaw-light .physical-modules {
  gap: var(--workspace-gap);
}
html.cyberclaw-light .panel,
html.cyberclaw-light .panel > .body,
html.cyberclaw-light .entity-card,
html.cyberclaw-light .entity-metric {
  min-width: 0;
}
@media (max-width: 1366px), (max-height: 768px) {
  html.cyberclaw-light .main.cockpit {
    --workspace-gap: 7px;
  }
  html.cyberclaw-light .panel > .title,
  html.cyberclaw-light .physical-module-title,
  html.cyberclaw-light .video-title {
    padding-inline: clamp(9px, 1vw, 13px);
  }
}

/* Skill card: move executor and policy beside the skill name. */
html.cyberclaw-light .right .skill-resource-panel:not(:fullscreen) .call-row {
  grid-template-columns: minmax(0, 1fr) minmax(148px, .9fr) auto;
  grid-template-rows: 24px 24px;
  grid-template-areas:
    "head metrics state"
    "fields fields fields";
  min-height: 68px;
  height: 68px;
  gap: 6px 8px;
  align-content: center;
}
html.cyberclaw-light .right .skill-resource-panel:not(:fullscreen) .call-main {
  min-width: 0;
}
html.cyberclaw-light .right .skill-resource-panel:not(:fullscreen) .call-metrics {
  grid-area: metrics;
  min-width: 0;
  width: 100%;
  height: 24px;
  align-self: center;
}
html.cyberclaw-light .right .skill-resource-panel:not(:fullscreen) .call-metrics > span {
  min-width: 0;
  height: 24px;
  padding-inline: 7px;
}
html.cyberclaw-light .right .skill-resource-panel:not(:fullscreen) .call-duration {
  flex: 1 1 50%;
}
html.cyberclaw-light .right .skill-resource-panel:not(:fullscreen) .call-frequency {
  flex: 1 1 50%;
}
html.cyberclaw-light .right .skill-resource-panel:not(:fullscreen) .call-metrics .metric-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 1366px), (max-height: 768px) {
  html.cyberclaw-light .right .skill-resource-panel:not(:fullscreen) .call-row {
    grid-template-columns: minmax(0, 1fr) minmax(136px, .86fr) auto;
    gap-inline: 6px;
  }
  html.cyberclaw-light .right .skill-resource-panel:not(:fullscreen) .call-metrics > span {
    gap: 4px;
    padding-inline: 5px;
  }
}
