/* The maintenance hatch lives above the original power badge. The bot uses
   the panel's existing top rim and header seam; it never brings its own floor. */
.ai-control.robot-dock-present {
  margin-top: 84px;
  overflow: visible;
}
.ai-control.robot-dock-present > .control-top {
  position: relative;
  min-height: 94px;
  border-radius: inherit;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.ai-control.robot-dock-present .robot-core {
  position: relative;
  z-index: 9;
}
.robot-power-dock {
  position: absolute;
  z-index: 7;
  pointer-events: none;
  overflow: visible;
  isolation: isolate;
  --power: 0;
}
.robot-power-dock[hidden] { display: none !important; }
.robot-power-dock *, .robot-power-dock *::before, .robot-power-dock *::after {
  box-sizing: border-box;
  pointer-events: none;
}
.robot-power-dock .robot-hatch {
  z-index: 1;
  border: 2px solid #6c858e;
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(90deg, #02080d 0 60%, #0d2631);
  box-shadow: inset 0 0 0 3px #071018, inset -6px 0 9px #000, 0 0 0 1px #0a1a24, 3px 0 0 #020b12;
}
.robot-power-dock .robot-hatch::before {
  content: '';
  position: absolute;
  z-index: 2;
  left: 5px;
  right: 5px;
  top: 3px;
  height: 3px;
  background: #d1a253;
  box-shadow: 0 0 7px #e7b45d55;
}
.robot-power-dock .robot-hatch > div {
  background: repeating-linear-gradient(0deg, #1a3542 0 6px, #102430 7px 9px, #526b74 10px 11px);
}
.robot-power-dock .robot-hatch small {
  left: 5px;
  bottom: 4px;
  font: 5px/1 'IBM Plex Mono', monospace;
  letter-spacing: .02em;
  color: #b7cfcb;
}
.robot-dock-cable {
  position: absolute;
  left: 0;
  width: 100%;
  overflow: visible;
  z-index: 2;
}
.robot-dock-cable path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.robot-dock-cable .robot-cable-shadow { stroke: #010609; stroke-width: 7; }
.robot-dock-cable .robot-cable-wire { stroke: #426572; stroke-width: 4; }
.robot-dock-cable .robot-cable-current {
  stroke: #acffe1;
  stroke-width: 1.3;
  stroke-dasharray: 3 27;
  opacity: calc(var(--power) * .75);
}
.robot-power-dock .robot-reactor {
  z-index: 3;
  border: 1px solid #76919a;
  border-top-color: #aec2c4;
  border-bottom: 3px solid #05121a;
  border-radius: 8px 8px 2px 2px;
  background:
    radial-gradient(circle at 5px 6px, #c9d7cd 0 1px, #081822 1.3px 2.6px, transparent 2.9px),
    radial-gradient(circle at calc(100% - 5px) 6px, #c9d7cd 0 1px, #081822 1.3px 2.6px, transparent 2.9px),
    linear-gradient(90deg, #102632, #395462 16%, #213f4d 72%, #112732);
  box-shadow: inset 0 1px #e5fff93b, inset 3px 0 #acc4bd16, inset -3px 0 #0710197d, 3px 0 0 #06131c, 0 0 calc(var(--power) * 14px) #77ffd41c;
}
.robot-power-dock .robot-reactor::before {
  content: '';
  position: absolute;
  left: 9px;
  right: 9px;
  top: -5px;
  height: 5px;
  border: 1px solid #899b91;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  background: repeating-linear-gradient(90deg, #ddb366 0 4px, #443d30 4px 6px);
}
.robot-reactor-ring {
  position: absolute;
  left: 9px;
  top: 13px;
  width: 36px;
  height: 36px;
  border: 3px solid #92a8a7;
  border-top-color: #cfddcc;
  border-right-color: #516c75;
  border-radius: 50%;
  background: repeating-conic-gradient(from 15deg, #718a86 0deg 7deg, #152c36 7deg 45deg);
  box-shadow: 0 0 0 2px #091a23, inset 0 0 0 3px #07161f, 1px 2px 0 #030b10;
}
.robot-reactor-eye {
  position: absolute;
  left: 19px;
  top: 23px;
  width: 16px;
  height: 16px;
  border: 2px solid #84b5ae;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 36%, #d5fbea, #518778 48%, #0b252c 72%);
  filter: saturate(calc(.15 + var(--power) * .85)) brightness(calc(.6 + var(--power) * .75));
  box-shadow: 0 0 calc(var(--power) * 9px) #75ffd8b3, inset 0 0 4px #befee099;
}
.robot-power-dock .robot-reactor > span {
  position: absolute;
  left: 0;
  right: 0;
  top: 53px;
  text-align: center;
  font: 5px/1 'IBM Plex Mono', monospace;
  font-weight: 600;
  letter-spacing: .12em;
  color: #d8d0a7;
}
.robot-power-dock .robot-reactor > b {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 4px;
  height: 4px;
  border-top: 1px solid #08131c;
  background: repeating-linear-gradient(90deg, #0b1b24 0 3px, #6b817c 3px 4px, #223d46 4px 6px);
}
.robot-power-dock .robot-reactor > i {
  width: 13px;
  height: 15px;
  border: 2px solid #b3b69d;
  border-radius: 3px;
  background: #041019;
  box-shadow: inset 0 0 0 2px #274652, 0 0 0 1px #06121b;
}
.robot-power-dock .robot-reactor > i::after {
  inset: 4px 2px;
  border-radius: 1px;
  background: #ace6ce;
}
.robot-dock-plug {
  position: absolute;
  width: 15px;
  height: 12px;
  z-index: 6;
  border: 1px solid #bdd4c9;
  border-radius: 2px;
  background: linear-gradient(#e1b766 0 2px, #4b6366 2px 4px, #1e3a45 4px 8px, #0c202a 8px);
  box-shadow: -3px 0 0 -1px #08131b, inset 2px 0 #cce3d73b, 0 1px 1px #000;
}
.robot-dock-plug > i {
  position: absolute;
  right: -4px;
  width: 4px;
  height: 2px;
  background: #cad7c8;
  top: 2px;
  box-shadow: 0 1px #667e7e;
}
.robot-dock-plug > i + i { top: 7px; }
.robot-power-dock[data-plugged=true] .robot-dock-plug > i { opacity: 0; }
.robot-power-dock .robot-unit { z-index: 5; filter: drop-shadow(1px 3px 2px #0006); }
.robot-power-dock .robot-sprite {
  filter: saturate(calc(1 - var(--sleep, 0) * .34)) brightness(calc(1 - var(--sleep, 0) * .13));
}
.robot-sleep-eyes {
  position: absolute;
  left: 52.2%;
  top: 25.4%;
  width: 12.3%;
  height: 7.1%;
  border-radius: 18%;
  background: #071316;
  opacity: var(--sleep, 0);
  transform: rotate(-3deg);
}
.robot-sleep-eyes::before, .robot-sleep-eyes::after {
  content: '';
  position: absolute;
  top: 54%;
  width: 29%;
  height: 1px;
  background: #d6ae5e;
  box-shadow: 0 1px #695f30;
}
.robot-sleep-eyes::before { left: 8%; }
.robot-sleep-eyes::after { right: 7%; }
.robot-snooze {
  position: absolute;
  left: 61%;
  top: -3%;
  width: 29px;
  height: 35px;
  opacity: var(--sleep, 0);
  transform: scaleX(var(--facing, 1)) rotate(-3deg);
  color: #b7e0d9;
  text-shadow: 1px 1px 0 #061922, 0 0 7px #7cdaca33;
  font: 10px/1 'IBM Plex Mono', monospace;
  font-weight: 600;
}
.robot-snooze i { position: absolute; bottom: 0; left: 0; font-style: normal; opacity: 0; }
.robot-power-dock[data-sleeping=true] .robot-snooze i { animation: robot-dock-snore 3s ease-out infinite; }
.robot-power-dock[data-sleeping=true] .robot-snooze i:nth-child(2) { animation-delay: 1s; }
.robot-power-dock[data-sleeping=true] .robot-snooze i:nth-child(3) { animation-delay: 2s; }
.robot-dock-contact {
  position: absolute;
  z-index: 8;
  width: 5px;
  height: 5px;
  transform: translate(-50%, -50%) rotate(45deg);
  background: #eaffd5;
  box-shadow: 0 0 4px 3px #bdffab, 0 0 18px 9px #9dffc65e;
}
.robot-dock-contact::before, .robot-dock-contact::after {
  content: '';
  position: absolute;
  inset: -8px 1px;
  background: #caffb8;
}
.robot-dock-contact::after { transform: rotate(90deg); }
@keyframes robot-dock-snore {
  0% { opacity: 0; transform: translate(0, 5px) scale(.65); }
  18% { opacity: .85; }
  72% { opacity: .7; }
  100% { opacity: 0; transform: translate(17px, -23px) scale(1.15); }
}

/* Below the wide layout, the controls keep the left of their existing row;
   a clear right pocket lets the resting bot and reactor remain part of it. */
.ai-control.robot-dock-present.robot-dock-compact > .control-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 13px;
  min-height: 164px;
}
.ai-control.robot-dock-present.robot-dock-compact .control-brand {
  flex: 0 0 100%;
  width: 100%;
}
.ai-control.robot-dock-present.robot-dock-compact .control-actions {
  display: grid;
  grid-template-columns: minmax(0, max-content) max-content;
  align-content: center;
  align-items: center;
  justify-content: start;
  gap: 7px;
  flex: 0 0 calc(100% - 144px);
  width: calc(100% - 144px);
  min-width: 0;
  min-height: 74px;
  margin: 0;
}
.ai-control.robot-dock-present.robot-dock-compact .control-actions .demo-label {
  grid-column: 1 / -1;
  width: fit-content;
  margin: 0;
  font-size: 9px;
}
.ai-control.robot-dock-present.robot-dock-compact .control-actions .small-button {
  justify-content: center;
  min-width: 0;
  min-height: 37px;
  gap: 5px;
  padding: 7px;
  font-size: 10px;
  line-height: 1.3;
  white-space: normal;
}
.ai-control.robot-dock-present.robot-dock-compact .control-actions .stop-flow {
  min-height: 37px;
  padding: 7px;
  font-size: 10px;
}
.ai-control.board-focused.robot-dock-present {
  top: 86px;
  margin-top: 0;
  overflow: visible;
}
.robot-board-viewport { display: contents; }
.ai-control.board-focused > .robot-board-viewport {
  --robot-canvas-height: clamp(480px, calc(100dvh - 390px), 690px);
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #557a97 #091c2e;
  border-radius: 0 0 10px 10px;
}
.ai-control.board-focused > .robot-board-viewport > * { flex-shrink: 0; }
.ai-control.board-focused .robot-board-viewport > .control-grid {
  flex: 0 0 auto;
  min-height: 0;
  height: calc(var(--robot-canvas-height) + 132px);
  overflow: hidden;
}
.ai-control.board-focused .robot-board-viewport .workflow-canvas {
  flex: 0 0 auto;
  height: var(--robot-canvas-height);
  min-height: 480px;
}
.ai-control.board-focused .robot-board-viewport > .demo-disclaimer { display: none; }
.robot-board-viewport > .demo-disclaimer { font-size: 9px; line-height: 1.6; color: #7798b5; margin: 0; padding: 0 17px 15px; }
@media (max-width: 760px) {
  .ai-control.board-focused .robot-board-viewport > .control-grid { height: auto; overflow: visible; }
  .ai-control.board-focused .robot-board-viewport .workflow-area { flex: 0 0 auto; min-height: 0; }
  .ai-control.board-focused .robot-board-viewport .workflow-canvas { height: 360px; min-height: 360px; }
}
.ai-control.board-focused.robot-dock-present .control-brand .control-logo {
  display: grid;
  flex-shrink: 0;
}
.ai-control.board-focused.robot-dock-present.robot-dock-compact > .control-top {
  min-height: 143px;
  gap: 5px;
}
.ai-control.board-focused.robot-dock-present.robot-dock-compact .control-actions {
  min-height: 73px;
}
@media (max-width: 420px) {
  .ai-control.robot-dock-present { margin-top: 80px; }
  .ai-control.board-focused.robot-dock-present { margin-top: 0; top: 78px; }
  .ai-control.robot-dock-present.robot-dock-compact .control-actions {
    flex-basis: calc(100% - 140px);
    width: calc(100% - 140px);
    gap: 6px;
  }
  .ai-control.robot-dock-present.robot-dock-compact .control-actions .small-button,
  .ai-control.robot-dock-present.robot-dock-compact .control-actions .stop-flow { font-size: 9px; padding-inline: 6px; }
  .ai-control.robot-dock-present.robot-dock-compact .control-actions .icon { width: 12px; height: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .robot-power-dock .robot-cable-current { animation: none; }
  .robot-power-dock[data-sleeping=true] .robot-snooze i { animation: none; opacity: .75; }
  .robot-power-dock[data-sleeping=true] .robot-snooze i:nth-child(1) { transform: translate(0, 3px) scale(.75); }
  .robot-power-dock[data-sleeping=true] .robot-snooze i:nth-child(2) { transform: translate(7px, -6px) scale(.9); }
  .robot-power-dock[data-sleeping=true] .robot-snooze i:nth-child(3) { transform: translate(16px, -16px); }
}
