.terminal-controls { display: none; }
.terminal-sheet.raw-view .terminal-controls {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0; padding: 2px 0 4px;
}
.terminal-controls button {
  min-height: 36px; padding: 5px 10px; border: 1px solid #aa9ab9;
  border-radius: 6px; background: #f5eef8; color: #453351;
  font: 600 12px ui-monospace, monospace;
}
.terminal-controls .terminal-expand { margin-left: auto; }
.terminal-controls button:disabled { cursor: default; }
.terminal-sheet.raw-view.terminal-fullscreen {
  width: 100%; max-width: none; height: 100dvh; max-height: 100dvh;
  margin: 0; border-radius: 0;
}
@media (max-width: 600px) { .terminal-controls button { min-height: 44px; } }

/* The casing is outside xterm's measured content box. No glass overlay,
   scanlines, transforms or text shadows: terminal cells stay pixel-aligned. */
.terminal-sheet.raw-view #terminal {
  position: relative;
  /* FitAddon reads the host's computed height/width, not its client box. */
  box-sizing: content-box;
  isolation: isolate;
  min-width: 0;
  margin: 6px 0 0;
  padding: 20px 22px 34px;
  border: 2px solid;
  border-color: #f7f0ff #81758e #74677f #e4d9ed;
  border-radius: 24px 24px 19px 19px;
  background: linear-gradient(145deg, #e6ddea, #bdb0c8 48%, #a394b0);
  box-shadow: inset 0 2px 2px #fff9, inset 0 -3px 5px #4c3c6255,
    0 3px 0 #685a77, 0 7px 14px #2b203329;
}
.terminal-sheet.raw-view #terminal > .xterm {
  border-radius: 8px;
  background: #1e1e2e;
  box-shadow: 0 -3px 0 3px #64596e, 0 3px 0 3px #aa9caf,
    0 0 0 6px #72657b, 0 1px 0 7px #f6edff66;
  /* Do not clip the screen/cursor: FitAddon measures this content box. */
}
.terminal-sheet.raw-view #terminal::before {
  content: "VAPOR / TERMINAL";
  position: absolute;
  bottom: 8px;
  left: 22px;
  color: #493b57;
  font: 700 9px/1 ui-monospace, monospace;
  letter-spacing: .16em;
  pointer-events: none;
}
.terminal-sheet.raw-view #terminal::after {
  content: "";
  position: absolute;
  bottom: 8px;
  right: 22px;
  width: 72px;
  height: 8px;
  background: radial-gradient(circle at 67px 4px, #b7ffe0 0 2px, #47735e 2.5px 3.5px, transparent 4px),
    repeating-linear-gradient(90deg, #73647e 0 2px, transparent 2px 5px) left center / 45px 6px no-repeat;
  pointer-events: none;
}
/* The light follows the existing socket connection state, not agent activity. */
.terminal-sheet.raw-view.offline #terminal::after {
  background: radial-gradient(circle at 67px 4px, #ffcf8a 0 2px, #8d6542 2.5px 3.5px, transparent 4px),
    repeating-linear-gradient(90deg, #73647e 0 2px, transparent 2px 5px) left center / 45px 6px no-repeat;
}
.terminal-sheet.raw-view .keybar {
  gap: 7px;
  padding: 12px 2px 8px;
}
.terminal-sheet.raw-view .keybar button {
  min-height: 36px;
  border-radius: 7px;
  border: 1px solid #aa9ab9;
  background: linear-gradient(#fffafc, #e7ddec);
  box-shadow: inset 0 1px #fff, 0 2px 0 #9b8ba9;
  color: #453351;
  font: 600 11px ui-monospace, monospace;
}
.terminal-sheet.raw-view .keybar button:active {
  background: #d9cce2;
  box-shadow: inset 0 1px 2px #68507844;
}
@media (max-width: 600px) {
  .terminal-sheet.raw-view #terminal {
    padding: 7px 6px 23px;
    border-radius: 17px 17px 14px 14px;
  }
  .terminal-sheet.raw-view #terminal > .xterm {
    border-radius: 5px;
    box-shadow: 0 -1px 0 2px #64596e, 0 1px 0 2px #aa9caf, 0 0 0 3px #72657b;
  }
  .terminal-sheet.raw-view #terminal::before { left: 14px; bottom: 7px; font-size: 8px; }
  .terminal-sheet.raw-view #terminal::after { right: 14px; bottom: 6px; }
  .terminal-sheet.raw-view .keybar { gap: 5px; }
  .terminal-sheet.raw-view .keybar button { min-height: 44px; }
}
@media (forced-colors: active) {
  .terminal-sheet.raw-view #terminal,
  .terminal-sheet.raw-view #terminal > .xterm { border-color: CanvasText; box-shadow: none; }
  .terminal-sheet.raw-view #terminal::before { color: CanvasText; }
  .terminal-sheet.raw-view #terminal::after { display: none; }
}
