/* The raw Claude Code terminal (raw.js). Tokens only.
   A look may set the terminal's colours (each falls back to the shell tokens when unset):
   --term-bg, --term-fg, --term-cursor, --term-selection, --term-ansi-0 … --term-ansi-15
   (0 black, 1 red, 2 green, 3 yellow, 4 blue, 5 magenta, 6 cyan, 7 white, 8–15 the bright ones). */
.conv.raw-on > #log { display: none; }
/* Raw in place of the conversation: ONE header in total — the conversation's own title row steps aside. */
.conv.raw-on > #job { display: none; }
.raw .raw-back { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; margin-left: 4px; border: 1px solid var(--rule-2); border-radius: var(--r); background: transparent; color: var(--ink-2); font: 600 13px/16px var(--sans); white-space: nowrap; cursor: pointer; }
.raw .raw-back:hover { color: var(--ink); background: var(--panel-2); }
.raw .raw-back svg.ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.raw .raw-back[hidden] { display: none; }
/* The conversation's title row: one slim row, 44 px, whatever the look pads it with. */
#conv > #job.job { box-sizing: border-box; height: 44px; min-height: 0; padding-top: 0; padding-bottom: 0; align-items: center; }
#conv > #job.job .meta { color: var(--ink-3); font: var(--meta); }

.raw { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--well); border-bottom: 1px solid var(--rule); }
.raw.rawside { position: absolute; inset: 0; z-index: 5; border-bottom: 0; border-left: 1px solid var(--rule); }
/* The toolbar (.rh.raw-bar): ONE slim row that never wraps — title · typing switch · (space) · state · view
   controls · overflow. The terminal gets every remaining pixel. Structure is held at .raw .raw-bar so a look's
   plain .rh rule restyles colour and type but cannot make it tall or let it wrap; a look that wants another
   height sets --raw-bar-h. Hooks: .raw-bar[data-attention] > b.raw-title, button.rt.raw-type[aria-pressed],
   span.rs.raw-state[data-state=live|typing|connecting|reconnecting|loading|look-only|elsewhere|moved|error]
   (i.lamp, span.tx, button), button.raw-ic[data-act=side|expand|more] > svg[data-icon], .raw-menu > button.raw-mi. */
.raw { --raw-bar-h: 40px; position: relative; }
.rh { background: var(--sys); border-bottom: 1px solid var(--rule); }
.raw .raw-bar { flex: none; display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; row-gap: 0; box-sizing: border-box; height: var(--raw-bar-h); min-height: 0; padding-top: 0; padding-bottom: 0; padding-left: 12px; padding-right: 4px; overflow: hidden; }
.rh > b { flex: none; display: flex; align-items: center; gap: 8px; font: 700 15px/20px var(--cond); color: var(--ink); white-space: nowrap; }
.rh > b svg.ic { width: 18px; height: 18px; color: var(--ink-2); }
.rh .sp { flex: 1 1 0; min-width: 0; }
/* the typing switch: off by default, unmistakable when on (knob position AND accent; the frame round the terminal too) */
.rt { flex: none; display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px 0 8px; border: 1px solid var(--rule-2); border-radius: var(--r); font: 600 14px/16px var(--cond); color: var(--ink-2); white-space: nowrap; }
.rt .sw { position: relative; width: 28px; height: 16px; border: 1px solid var(--rule-2); border-radius: 8px; background: var(--well); flex: none; }
.rt .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); }
.rt.on { border-color: var(--accent); color: var(--ink); background: var(--panel); }      /* accent, not amber: amber means "needs you" only */
.rt.on .sw { background: var(--accent); border-color: var(--accent); }
.rt.on .sw::after { left: 14px; background: var(--on-accent); }
.rt:disabled { opacity: .5; }
/* the state: a lamp while live, words only when it needs him */
.rh .rs { flex: 0 1 auto; min-width: 0; display: inline-flex; align-items: center; gap: 8px; font: var(--meta); color: var(--ink-2); white-space: nowrap; }
.rh .rs .tx { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rh .rs .lamp, .rh .rs .btn { flex: none; }
.rh .rs[data-state="live"], .rh .rs[data-state="typing"] { padding: 0 4px; }
.rh .rs[data-state="elsewhere"], .rh .rs[data-state="moved"], .rh .rs[data-state="error"] { color: var(--stop); font-weight: 600; }
.rh .rs .btn.sm { height: 28px; padding: 0 10px; }
/* icon buttons */
.raw-ic { flex: none; width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border: 0; border-radius: var(--r); background: none; color: var(--ink-2); cursor: pointer; }
.raw-ic svg.ic { width: 18px; height: 18px; }
.raw-ic svg .f { fill: currentColor; stroke: none; }
.raw-ic:hover, .raw-ic[aria-expanded="true"] { color: var(--ink); background: var(--panel-2); }
.raw-ic:focus-visible, .raw-mi:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* the overflow menu: lifts over the terminal from its button */
.raw-menu { position: absolute; z-index: 6; top: calc(var(--raw-bar-h) + 4px); right: 8px; min-width: 216px; display: flex; flex-direction: column; padding: 4px; background: var(--panel); border: 1px solid var(--rule-2); border-radius: var(--r);
  box-shadow: 0 12px 32px color-mix(in srgb, var(--sys) 55%, transparent); }
.raw-mi { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 36px; padding: 0 12px; border: 0; border-radius: var(--r); background: none; font: var(--ui); color: var(--ink); text-align: left; white-space: nowrap; cursor: pointer; }
.raw-mi em { font: var(--meta); font-style: normal; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.raw-mi:hover, .raw-mi:focus { background: var(--panel-2); }
.raw-mi[aria-disabled="true"] { color: var(--ink-3); cursor: default; }
.raw-mi[aria-disabled="true"]:hover { background: none; }
/* the terminal sits on the well; when the phone keyboard shortens the well, the bottom rows stay in view */
.rwrap { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: 4px 0 4px 8px; background: var(--well); }
.rterm { flex: none; min-height: 0; }
/* line lost: the last screen stays in place, dimmed, until the new line's replay redraws it — never an empty pane */
.rwrap[data-stale] .rterm { opacity: .45; filter: grayscale(1); transition: opacity .2s; }
.rwrap.replaying .rterm { opacity: 0; }   /* not visibility:hidden — that would take keyboard focus away */
.raw .xterm { padding: 0; }
.raw .xterm .xterm-viewport { background: var(--well) !important; overflow-y: hidden; }
.rkeys { flex: none; display: flex; gap: 4px; padding: 4px 6px; background: var(--sys); border-top: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; }
.rk { flex: 1 0 auto; min-width: 40px; height: 40px; padding: 0 8px; border: 1px solid var(--rule-2); border-radius: var(--r); background: var(--panel); color: var(--ink); font: 600 15px/20px var(--sans); text-align: center; }
.rk.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
/* the toggles */
.job .rawbtn { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; margin-left: 12px; border: 1px solid var(--rule-2); border-radius: var(--r); font: 600 14px/16px var(--cond); color: var(--ink-2); white-space: nowrap; align-self: center; }
.job .rawbtn svg.ic { width: 16px; height: 16px; }
.job .rawbtn.on { border-color: var(--accent); color: var(--ink); }
.job .meta + .rawbtn { margin-left: 12px; }
.job b + .rawbtn { margin-left: auto; }
.phone .sys .ob.on { color: var(--accent); }
/* phone: the same single row, 44 px targets; the title keeps only its glyph when the state has words */
.phone .raw { --raw-bar-h: 44px; }
.phone .raw .raw-bar { padding-left: 12px; padding-right: 0; gap: 6px; }
.phone .rh > b { font-size: 16px; }
.phone .rt { height: 44px; }
.phone .raw-ic { width: 44px; height: 44px; }
.phone .raw-mi { min-height: 44px; }
.phone .rh .rs .btn.sm { position: relative; height: 32px; }
.phone .rh .rs .btn.sm::before { content: ""; position: absolute; inset: -6px 0; }   /* a 44 px touch target */
.phone .rwrap { padding-left: 4px; }
.phone.raw-typing #cmp { display: none; }
.phone .rkeys { gap: 3px; overflow: hidden; }
.phone .rk { flex: 1 1 0; height: 44px; min-width: 0; padding: 0 2px; font-size: 14px; }
/* the Terminal app's panes on the phone (apps/termhost.js): the same eight keys under each shell, 44 px each */
.phone .tpane .tkeys { gap: 2px; padding: 4px 2px; margin: 0; background: var(--well); border-top: 1px solid var(--rule); }
.phone .tpane .tkeys .rk { height: 44px; min-width: 0; padding: 0; }
/* Expand: the layout is the piece model's (pieces.css, #main[data-max]); body.raw-max stays as a hook. */
/* R-9: the question for an image pasted into a shell pane (core/termimg.js), drawn in the pane over the terminal */
.tpane .rwrap { position: relative; }
.timg { position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px;
  background: var(--panel); color: var(--ink); border: 1px solid var(--rule-2); border-radius: var(--r); box-shadow: 0 6px 24px rgb(0 0 0 / .35); }
.timg-q { flex: 1 1 220px; margin: 0; font: 500 14px/20px var(--sans); overflow-wrap: anywhere; }
.timg[data-state=refused] .timg-q { color: var(--ink); }
.timg-b { display: flex; gap: 8px; flex: none; }
.phone .timg .btn { min-height: 44px; }
