/* Each AI's terminal (ui/views/terminal.js): a real terminal in the AI's own view, dark in both themes like any
   terminal, colourful and easy to read (Maro, 2026-11-12). Square corners per Marochy; the palette is the terminal's
   own so ANSI colours and the auto-colouring read the same everywhere. */
.term-pane, .shell-page {
  --term-bg: #0b0c10; --term-bar: #14161d; --term-line: #1c1f29; --term-fg: #e6e8ef; --term-dim: #8a90a2;
  --t-red: #ff6b7a; --t-green: #5ee08a; --t-yellow: #f5d061; --t-blue: #6aa8ff; --t-magenta: #c792ff; --t-cyan: #4fd8e8;
  --t-gray: #7d8396; --t-white: #f2f4f8; --t-orange: #ffad66;
}
.term-pane {
  min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--term-bg);
  border: 1px solid var(--term-line); margin: 10px 16px 6px; box-shadow: 0 10px 30px rgb(0 0 0 / 35%);
}
.term-bar { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 12px; background: var(--term-bar); border-bottom: 1px solid var(--term-line); }
.term-dots { display: inline-flex; gap: 6px; }
.term-dots i { width: 10px; height: 10px; border-radius: 50%; background: #ff5f57; }
.term-dots i:nth-child(2) { background: #febc2e; }
.term-dots i:nth-child(3) { background: #28c840; }
.term-title { color: var(--term-dim); font: 12px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term-bar .grow { flex: 1; }
.term-follow { padding: 2px 8px; border: 1px solid var(--term-line); background: transparent; color: var(--term-dim); font: 11px var(--mono); cursor: pointer; }
.term-follow.on { color: var(--t-green); border-color: color-mix(in srgb, var(--t-green) 45%, var(--term-line)); }
.term-scroll { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 14px 16px 22px; color: var(--term-fg); font: 13px/1.6 var(--mono); scrollbar-color: #2a2e3b transparent; }
.term-idle { margin: 0; color: var(--term-dim); }

.term-block { padding: 2px 0 12px; }
.term-block + .term-block { border-top: 1px dashed var(--term-line); padding-top: 12px; }
.term-line { display: flex; align-items: baseline; gap: 0; min-width: 0; }
.term-ps { flex: none; white-space: nowrap; }
.t-user { color: var(--t-green); font-weight: 600; }
.t-cwd { color: var(--t-blue); font-weight: 600; }
.t-caret { color: var(--t-magenta); font-weight: 700; margin-right: .6ch; }
.term-block[data-state="fail"] .t-caret { color: var(--t-red); }
.term-cmd { flex: 1 1 auto; min-width: 0; color: var(--term-fg); font: inherit; overflow-wrap: anywhere; }
.term-meta { display: inline-flex; align-items: center; gap: 8px; flex: none; margin-left: 12px; color: var(--term-dim); font-size: 11px; white-space: nowrap; }
.term-run { display: inline-flex; align-items: center; gap: 6px; color: var(--t-yellow); }
.term-run .rail-spin { width: 10px; height: 10px; }
.term-tag { padding: 0 5px; border: 1px solid var(--term-line); color: var(--t-cyan); font-size: 10px; text-transform: uppercase; }
.term-exit { padding: 0 6px; font-weight: 600; }
.term-exit.ok { color: var(--t-green); background: color-mix(in srgb, var(--t-green) 12%, transparent); }
.term-exit.fail { color: var(--t-red); background: color-mix(in srgb, var(--t-red) 14%, transparent); }
.term-exit.stopped { color: var(--t-yellow); background: color-mix(in srgb, var(--t-yellow) 12%, transparent); }
.term-out { margin: 6px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--term-line); color: #c9cdd8; font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 4; max-height: min(55vh, 520px); overflow: auto; }
.term-block[data-state="running"] .term-out { border-left-color: color-mix(in srgb, var(--t-yellow) 55%, var(--term-line)); }
.term-block[data-state="fail"] .term-out { border-left-color: color-mix(in srgb, var(--t-red) 55%, var(--term-line)); }
.term-out[hidden] { display: none; }
.term-note { margin: 6px 0 0 14px; color: var(--term-dim); font-size: 11px; }
.term-note[hidden] { display: none; }

/* Command highlighting (term-color.mjs commandRuns). */
.t-program { color: var(--t-green); font-weight: 700; }
.t-arg { color: var(--term-fg); }
.t-flag { color: var(--t-yellow); }
.t-string { color: var(--t-orange); }
.t-op { color: var(--t-magenta); font-weight: 700; }
.t-path { color: var(--t-cyan); }
.t-var { color: var(--t-magenta); }
/* ANSI and auto colours (term-color.mjs). */
.t-black { color: #4b5063; } .t-red { color: var(--t-red); } .t-green { color: var(--t-green); } .t-yellow { color: var(--t-yellow); }
.t-blue { color: var(--t-blue); } .t-magenta { color: var(--t-magenta); } .t-cyan { color: var(--t-cyan); } .t-white { color: var(--t-white); }
.t-gray { color: var(--t-gray); } .t-bred { color: #ff8f9b; } .t-bgreen { color: #8af0ad; } .t-byellow { color: #ffe08a; }
.t-bblue { color: #93c1ff; } .t-bmagenta { color: #dbb5ff; } .t-bcyan { color: #8ae9f3; } .t-bwhite { color: #ffffff; }
.t-bold { font-weight: 700; } .t-dim { opacity: .65; } .t-italic { font-style: italic; } .t-underline { text-decoration: underline; }

/* Chat | Terminal in the chat header. */
.pane-switch { display: inline-flex; flex: none; }
/* The terminal takes the transcript's place and its height. */
.chat > .term-pane { flex: 1 1 auto; }
.pane-switch button { display: inline-flex; align-items: center; gap: 6px; min-width: 0; min-height: 28px; padding: 0 10px; font-size: 12px; }
.pane-switch .pane-prompt { color: var(--accent); font: 700 11px var(--mono); }
.pane-switch .pane-count { padding: 0 5px; border: 1px solid var(--border); color: var(--muted); font: 10px var(--mono); }
.pane-switch button.running .pane-prompt { color: var(--gold); animation: pane-pulse 1.2s ease-in-out infinite; }
.pane-switch button.failed .pane-count { color: var(--red); border-color: color-mix(in srgb, var(--red) 50%, var(--border)); }
@keyframes pane-pulse { 50% { opacity: .35; } }
.chat.showing-term .term-pane { margin-bottom: 6px; }

@media (max-width: 680px) {
  .term-pane { margin: 6px 8px; }
  .term-scroll { padding: 10px; font-size: 12px; }
  .term-line { flex-wrap: wrap; }
  .term-meta { margin-left: 0; }
}

/* The AI's name stays readable next to the switch. */
.chat-head .ch-who { flex: 0 1 auto; min-width: 90px; }
/* With Chat | Terminal in the header, the token/usage text gives way first so every button stays visible. */
.chat-head .ch-tokens { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head > .grow { flex: 1 1 0; min-width: 0; }
.chat-head > button, .chat-head > .status-pill, .chat-head > .mainchip { flex: none; }

/* Command and response, told apart at a glance (Maro, 2026-11-12): each command is a card; what the AI ran sits on
   its own lighter band, and what came back sits below on a darker panel with its own label. */
.term-scroll { padding: 14px 14px 22px; }
.term-block { padding: 0; margin: 0 0 14px; border: 1px solid var(--term-line); background: #0e1016; }
.term-block + .term-block { border-top: 1px solid var(--term-line); padding-top: 0; }
.term-line { padding: 9px 12px 9px 10px; background: linear-gradient(90deg, #191c28, #13151d); border-left: 3px solid var(--t-magenta); align-items: center; }
.term-line::before { content: "AI RAN"; flex: none; margin-right: 10px; padding: 1px 6px; border: 1px solid color-mix(in srgb, var(--t-magenta) 45%, transparent); color: var(--t-magenta); font: 600 9.5px var(--mono); letter-spacing: .08em; }
.term-block[data-state="running"] .term-line { border-left-color: var(--t-yellow); }
.term-block[data-state="running"] .term-line::before { color: var(--t-yellow); border-color: color-mix(in srgb, var(--t-yellow) 45%, transparent); content: "RUNNING"; }
.term-block[data-state="fail"] .term-line { border-left-color: var(--t-red); }
.term-block[data-state="ok"] .term-line { border-left-color: var(--t-green); }
.term-cmd { font-size: 13.5px; }
.term-out { position: relative; margin: 0; padding: 26px 14px 12px 16px; border-left: 3px solid #23283a; background: #08090c; color: #c4c9d6; }
.term-out::before { content: "OUTPUT"; position: absolute; top: 7px; left: 16px; color: var(--term-dim); font: 600 9.5px var(--mono); letter-spacing: .08em; }
.term-block[data-state="running"] .term-out { border-left-color: color-mix(in srgb, var(--t-yellow) 40%, #23283a); }
.term-block[data-state="fail"] .term-out { border-left-color: color-mix(in srgb, var(--t-red) 50%, #23283a); }
.term-note { margin: 0; padding: 6px 16px 8px; background: #08090c; }
