/* Terminal owns its inner scroll surfaces; the window keeps its Fluent chrome. */
.wm-body:has(> .term) { overflow: hidden; padding: 0; }
.term { display: flex; flex-direction: column; height: 100%; min-height: 0; min-width: 0;
  background: var(--glass-strong); color: var(--text); overflow: hidden; container-type: inline-size; }
.term [hidden] { display: none !important; }
.term button, .term summary { font: inherit; cursor: pointer; }
.term button:disabled { cursor: default; opacity: .45; }
.term :is(button, summary, input):focus-visible { outline: 2px solid var(--accent-border); outline-offset: -2px; }
.term svg { width: 16px; height: 16px; flex-shrink: 0; }
.term-toolbar { display: flex; align-items: center; justify-content: space-between; min-height: 48px;
  padding: 0 8px 0 16px; gap: 12px; background: var(--bg); border-bottom: 1px solid var(--glass-border); }
.term-profile { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.term-profile svg { color: var(--text-dim); }
.term-tools { position: relative; font-size: 13px; }
.term-tools summary { display: flex; align-items: center; gap: 12px; list-style: none; min-height: 44px;
  padding: 0 12px; border-radius: var(--radius-sm); user-select: none; }
.term-tools summary::-webkit-details-marker { display: none; }
.term-tools summary:hover, .term-tools[open] summary { background: var(--surface-hover); }
.term-tools summary:active { background: var(--surface-pressed); }
.term-menu { position: absolute; right: 0; top: calc(100% + 4px); width: min(320px, calc(100cqw - 16px));
  z-index: 3; padding: 4px; background: var(--glass-strong); color: var(--text); border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.term-menu > button { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 10px;
  color: var(--text); background: transparent; border: 0; border-radius: var(--radius-sm); text-align: left; }
.term-menu button:hover:not(:disabled), .term-icon:hover:not(:disabled) { background: var(--surface-hover); }
.term-menu button:active:not(:disabled), .term-icon:active:not(:disabled) { background: var(--surface-pressed); }
.term-menu kbd { margin-left: auto; color: var(--text-dim); font: 11px var(--font); }
.term-font { display: flex; align-items: center; gap: 4px; padding: 4px 6px 0; border-top: 1px solid var(--glass-border); }
.term-font > span { flex: 1; }
.term-font button, .term-icon { width: 44px; min-width: 44px; height: 44px; padding: 0; display: inline-flex;
  align-items: center; justify-content: center; background: transparent; color: var(--text); border: 0; border-radius: var(--radius-sm); }
.term-font output { min-width: 36px; text-align: center; font-variant-numeric: tabular-nums; }
.term-search { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 4px 8px;
  background: var(--bg); border-bottom: 1px solid var(--glass-border); }
.term-search input { flex: 1 1 120px; width: 120px; min-width: 0; min-height: 36px; padding: 6px 10px;
  border: 1px solid var(--glass-border); border-bottom-color: var(--text-faint); border-radius: var(--radius-sm);
  color: var(--text); background: var(--surface-input); font: 14px var(--font); }
.term-search input::-webkit-search-cancel-button { display: none; }
.term-search-result { color: var(--text-dim); font-size: 12px; min-width: 78px; text-align: center; }
.term-stage { flex: 1; min-height: 0; min-width: 0; position: relative; padding: 10px 8px 8px 12px; background: var(--console-bg); color: var(--console-text); }
.term-screen { height: 100%; min-height: 0; min-width: 0; }
.term .xterm { height: 100%; }
.term .xterm-viewport { scrollbar-width: thin; scrollbar-color: var(--console-muted) var(--console-bg); }
.term .xterm-viewport::-webkit-scrollbar { width: 8px; }
.term .xterm-viewport::-webkit-scrollbar-track { background: var(--console-bg); }
.term .xterm-viewport::-webkit-scrollbar-thumb { background: var(--console-muted); }
.term-latest { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center;
  justify-content: center; gap: 8px; min-height: 44px; max-width: calc(100% - 24px); white-space: nowrap; padding: 8px 14px; }
.term-footer { display: flex; align-items: center; gap: 12px; flex-shrink: 0; min-height: 45px; padding: 0 12px;
  border-top: 1px solid var(--glass-border); color: var(--text-dim); font-size: 12px; }
.term-connection { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 0; }
.term-connection::before { content: ''; width: 6px; height: 6px; border-radius: var(--radius-xs); background: var(--text-faint); flex-shrink: 0; }
.term-connection[data-state=connected]::before { background: var(--success); }
.term-connection[data-state=reconnecting]::before { background: var(--warning); }
.term-connection[data-state=error] { color: var(--danger); }
.term-dimensions { white-space: nowrap; font: 11px var(--mono); }
.term-restart { min-height: 44px; }
.term-action-status, .term-image-status { flex: 0 0 22px; height: 22px; margin: 0; padding: 2px 12px;
  overflow: auto; overflow-wrap: anywhere; white-space: normal; text-align: left; font-size: 11px; line-height: 18px; color: var(--text-dim); }
.term-action-status.error, .term-image-status.error { color: var(--danger); }
.term-image-status { flex-basis: 40px; height: 40px; }
.term-image-status:focus-visible { outline: 2px solid var(--accent-border); outline-offset: -2px; }
@container (max-width: 480px) {
  .term-search input { font-size: 16px; }
  .term-search-result { min-width: 70px; }
  .term-menu kbd { display: none; }
  .term-dimensions { display: none; }
}
@media (prefers-reduced-motion: reduce) { .term *, .term *::before, .term *::after { animation: none !important; transition: none !important; } }
@media (forced-colors: active) {
  .term .xterm-viewport { scrollbar-color: auto; }
  .term .xterm-viewport::-webkit-scrollbar-thumb { background: ButtonText; }
  .term .xterm-viewport::-webkit-scrollbar-track { background: Canvas; }
  .term-connection::before { background: CanvasText; }
}
