/* The rango app, rebuilt small for the live demo. Colours, radii and
   components are copied from src/ui/app.css so the demo looks like the real thing.
   Every class is prefixed "rg-" to stay clear of the website's own styles.
   Never name a class or an id "ad-…", "ads…", "banner…" or "sponsor…": ad blockers
   hide such elements on every site (the demo was an empty box with EasyList on). */

.demo-frame { position: relative; border: 1px solid var(--line-strong); background: #151514; container: demo / inline-size; }
.demo-frame::before, .demo-frame::after { content: ""; position: absolute; z-index: 2; width: 11px; height: 11px; border: 1px solid var(--text); pointer-events: none; }
.demo-frame::before { left: -1px; top: -1px; border-right: 0; border-bottom: 0; }
.demo-frame::after { right: -1px; bottom: -1px; border-left: 0; border-top: 0; }
.demo-bar { display: flex; align-items: center; gap: 12px; height: 34px; padding: 0 14px; border-bottom: 1px solid var(--line); font-size: 11.5px; color: var(--faint); white-space: nowrap; overflow: hidden; }
.demo-bar .demo-dots { letter-spacing: 0.3em; color: var(--ghost); }
.demo-bar .demo-tag { margin-left: auto; color: var(--accent); overflow: hidden; text-overflow: ellipsis; }
.demo-fallback { padding: 28px; color: var(--muted); font: 15px/1.6 var(--sans); }
/* The frame and its title bar switch with the app's sun / moon button (same values as the app's light theme below). */
.demo-frame, .demo-bar, .demo-bar span { transition: background 200ms, color 200ms, border-color 200ms; }
.demo-frame[data-theme="light"] { background: #f3f3f1; }
.demo-frame[data-theme="light"] .demo-bar { border-bottom-color: rgba(29, 29, 27, 0.09); color: #6b6a65; }
.demo-frame[data-theme="light"] .demo-bar .demo-dots { color: #a3a29d; }
.demo-frame[data-theme="light"] .demo-bar .demo-tag { color: #b45309; }

.rg {
  --bg: #1b1b1a; --side: #151514; --surface: #222221; --sunken: #181817; --text: #ebeae6; --muted: #9d9b95; --faint: #64635e;
  --line: rgba(255, 255, 255, 0.075); --line-strong: rgba(255, 255, 255, 0.13); --hover: rgba(255, 255, 255, 0.045); --active: rgba(255, 255, 255, 0.08);
  --focus: #60a5fa; --accent: #f6ad55; --accent-strong: #f0912f; --accent-bg: #2f2418; --ok: #68d391; --warn: #f6c453; --err: #fc8181;
  --add: #7cc79b; --add-bg: #1b2e22; --del: #f1918c; --del-bg: #3a2120; --bubble: #2a2a28;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  --btn-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); --primary-shadow: 0 1px 2px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  --p0: #7fb2df; --p1: #7fc79e; --p2: #b99be0; --av-ink: #151514;
  --ease: cubic-bezier(0.2, 0, 0, 1); --sw: 224px; --pw: 324px;
  position: relative; display: grid; grid-template-columns: var(--sw) minmax(0, 1fr) var(--pw); height: 648px; padding: 8px 8px 8px 0;
  background: var(--side); color: var(--text); font: 400 14px/1.55 var(--sans); letter-spacing: 0; overflow: hidden; color-scheme: dark;
  transition: grid-template-columns 220ms var(--ease), padding 220ms var(--ease), background 200ms;
}
.rg[data-theme="light"] {
  --bg: #fbfbfa; --side: #f3f3f1; --surface: #ffffff; --sunken: #f5f5f3; --text: #1d1d1b; --muted: #6b6a65; --faint: #a3a29d;
  --line: rgba(29, 29, 27, 0.09); --line-strong: rgba(29, 29, 27, 0.16); --hover: rgba(29, 29, 27, 0.05); --active: rgba(29, 29, 27, 0.08);
  --focus: #3b82f6; --accent: #b45309; --accent-strong: #ea8a1a; --accent-bg: #fdf3e6; --ok: #2f855a; --warn: #b7791f; --err: #c53030;
  --add: #2b6a45; --add-bg: #e9f4ec; --del: #ad3632; --del-bg: #fcecec; --bubble: #efeeea;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.06);
  --btn-shadow: 0 1px 1px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.05); --primary-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  --p0: #3b6fa0; --p1: #3f7d5c; --p2: #7a55a3; --av-ink: #fff; color-scheme: light;
}
.rg.no-side { --sw: 0px; padding-left: 8px; }
.rg.no-panel { --pw: 0px; }
.rg *, .rg *::before, .rg *::after { box-sizing: border-box; }
.rg button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.rg button:focus-visible, .rg textarea:focus-visible, .rg input:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px color-mix(in srgb, var(--focus) 70%, transparent); }
.rg svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.rg b { color: inherit; font-weight: 600; }
.rg code { font-family: var(--mono); font-size: 12.5px; background: var(--active); padding: 1px 5px; border-radius: 4px; color: inherit; white-space: normal; }
.rg p { margin: 0 0 10px; } .rg p:last-child { margin-bottom: 0; }
.rg ::selection { background: color-mix(in srgb, var(--focus) 40%, transparent); color: inherit; }
.rg * { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text) 18%, transparent) transparent; }
.rg-grow { flex: 1; }
.rg-muted { color: var(--muted); }
.rg-mono { font-family: var(--mono); font-size: 12px; }

/* ---------- sidebar */
.rg-side { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.rg-side > * { min-width: 224px; }
.rg.no-side .rg-side { visibility: hidden; }
.rg-side-top { padding: 6px 10px; }
.rg-new { width: 100%; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); font-weight: 500; font-size: 13.5px; box-shadow: var(--btn-shadow); transition: background 150ms var(--ease); }
.rg-new:hover { background: var(--hover); }
.rg-new svg { width: 15px; height: 15px; }
.rg-new kbd { margin-left: auto; font: 11px var(--sans); color: var(--faint); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.rg-list { flex: 1; overflow-y: auto; padding: 6px 8px 12px; min-height: 0; }
.rg-proj-head { width: 100%; display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 500; text-align: left; margin-top: 4px; }
.rg-proj-head:hover { background: var(--hover); color: var(--text); }
.rg-proj-head > svg { width: 12px; height: 12px; }
.rg-person { margin-top: 6px; }
.rg-person-head { width: 100%; display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px 0 10px; min-width: 0; border: 0; border-radius: 8px; background: transparent; font-size: 13px; font-weight: 500; text-align: left; cursor: default; }
.rg-person-head .rg-pmeta { color: var(--faint); font-weight: 400; font-size: 11.5px; }
.rg-person-head .rg-pcount { margin-left: auto; color: var(--faint); font-weight: 400; font-size: 11.5px; }
.rg-av { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; font-weight: 600; letter-spacing: 0.02em; color: var(--av-ink); flex: none; }
.rg-av.sm { width: 16px; height: 16px; }
.rg-av.c0 { background: var(--p0); } .rg-av.c1 { background: var(--p1); } .rg-av.c2 { background: var(--p2); }
.rg-av.pending { background: transparent; border: 1px dashed var(--line-strong); color: var(--muted); }
.rg-srow { width: 100%; display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 4px 8px 4px 38px; border: 0; border-radius: 8px; background: transparent; text-align: left; font-size: 13.5px; transition: background 120ms var(--ease); }
.rg-srow:hover { background: var(--hover); }
.rg-srow[aria-current="true"] { background: var(--active); }
.rg-srow .rg-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rg-srow .rg-when { color: var(--faint); font-size: 11.5px; white-space: nowrap; }
.rg-person-empty { padding: 2px 8px 4px 38px; font-size: 12.5px; color: var(--faint); }
.rg-ind { width: 14px; height: 14px; flex: none; display: grid; place-items: center; }
.rg-ind i { display: block; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.rg-ind.idle i { background: transparent; border: 1.5px solid var(--faint); }
.rg-ind.working i { background: var(--ok); }
.rg-ind.permission i { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 25%, transparent); }
.rg-spin { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--line-strong); border-top-color: var(--text); animation: rg-spin 0.8s linear infinite; flex: none; }
@keyframes rg-spin { to { transform: rotate(360deg); } }
.rg-side-foot { border-top: 1px solid var(--line); padding: 8px 10px; display: flex; align-items: center; gap: 8px; }
.rg-foot-btn { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px 0 10px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 13px; }
.rg-foot-btn:hover { background: var(--hover); color: var(--text); }
.rg-conn { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.rg-conn i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

/* ---------- main */
.rg-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; transition: background 200ms; }
.rg-bar { height: 48px; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 8px; border-bottom: 1px solid var(--line); min-width: 0; }
.rg-heading { flex: 0 1 auto; min-width: 0; display: flex; align-items: baseline; margin: 0 4px; white-space: nowrap; font-size: 14px; }
.rg-crumb { flex: none; color: var(--muted); }
.rg-crumb::after { content: "/"; margin: 0 8px; color: var(--faint); }
.rg-title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.rg-where { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px 0 8px; border: 0; border-radius: 999px; background: var(--active); color: var(--muted); font: 500 11.5px var(--mono); white-space: nowrap; position: relative; }
.rg-where:hover { color: var(--text); }
.rg-where svg { width: 13px; height: 13px; }
.rg-where .up { color: var(--ok); }
.rg-tools { margin-left: auto; display: flex; gap: 2px; flex: none; }
.rg-icon { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--muted); position: relative; transition: background 150ms var(--ease), color 150ms var(--ease); flex: none; }
.rg-icon:hover { background: var(--hover); color: var(--text); }
.rg-icon[aria-pressed="true"] { background: var(--active); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.rg-icon.sm { width: 26px; height: 26px; border-radius: 8px; }
.rg-icon.has-dot::after { content: ""; position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-strong); box-shadow: 0 0 0 2px var(--bg); }
.rg-lang { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; }
.rg-icon.flip svg { animation: rg-flip 280ms var(--ease); }
@keyframes rg-flip { from { transform: rotate(-90deg) scale(0.6); opacity: 0; } }

.rg-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.rg-thread { max-width: 760px; margin: 0 auto; padding: 22px 24px 20px; }
.rg-user { display: flex; justify-content: flex-end; margin: 18px 0 14px; }
.rg-user:first-child { margin-top: 0; }
.rg-user > div { background: var(--bubble); border-radius: 14px; padding: 9px 14px; max-width: 85%; white-space: pre-wrap; overflow-wrap: anywhere; }
.rg-ai { margin: 10px 0; overflow-wrap: anywhere; }
.rg-ai.streaming > :last-child::after { content: ""; display: inline-block; width: 7px; height: 14px; margin-left: 2px; vertical-align: -2px; background: var(--text); opacity: 0.6; animation: rg-blink 1s steps(2) infinite; }
@keyframes rg-blink { 50% { opacity: 0; } }
.rg-thinking { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin: 10px 0; }
.rg-tool, .rg-ghead { width: calc(100% + 16px); display: flex; align-items: center; gap: 8px; min-height: 28px; padding: 3px 8px; margin: 2px 0 2px -8px; border: 0; border-radius: 6px; background: transparent; text-align: left; color: var(--muted); font-size: 13px; }
button.rg-ghead:hover { background: var(--hover); color: var(--text); }
.rg-tool .rg-st, .rg-ghead .rg-st { width: 14px; display: grid; place-items: center; color: var(--ok); }
.rg-tool .rg-st svg, .rg-ghead .rg-st svg { width: 14px; height: 14px; }
.rg-ghead .rg-chev { transform: rotate(-90deg); transition: transform 150ms ease; color: var(--muted); }
.rg-tgroup.open .rg-chev { transform: none; }
.rg-tname { color: var(--text); font-weight: 500; white-space: nowrap; }
.rg-tsum { font-family: var(--mono); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.rg-gcount { color: var(--faint); font-size: 12px; white-space: nowrap; margin-left: auto; }
.rg-glist { margin: 2px 0 4px 6px; padding-left: 12px; border-left: 1px solid var(--line-strong); }
.rg-tgroup:not(.open) .rg-glist { display: none; }
.rg-note { display: flex; align-items: flex-start; gap: 8px; margin: 14px 0; padding: 8px 12px; border-radius: 12px; background: var(--accent-bg); color: var(--accent); font-size: 13px; animation: rg-note 900ms var(--ease); }
.rg-note svg { width: 14px; height: 14px; margin-top: 3px; }
@keyframes rg-note { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-strong) 60%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }
.rg-perm { margin: 12px 0; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); padding: 14px 16px; box-shadow: var(--shadow); }
.rg-perm .rg-ph { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.rg-perm .rg-pc { font-family: var(--mono); font-size: 12.5px; background: var(--sunken); border-radius: 10px; padding: 8px 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.rg-perm .rg-pa { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.rg-perm.done { box-shadow: none; padding: 8px 12px; border-color: var(--line); }
.rg-perm.done .rg-ph { margin-bottom: 4px; }
.rg-in { animation: rg-in 240ms var(--ease); }
@keyframes rg-in { from { opacity: 0; transform: translateY(4px); } }

.rg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 13px; font-weight: 500; letter-spacing: -0.005em; white-space: nowrap; box-shadow: var(--btn-shadow); transition: background 150ms var(--ease), transform 80ms var(--ease), opacity 150ms; }
.rg-btn:hover { background: color-mix(in srgb, var(--surface) 88%, var(--text)); }
.rg-btn:active:not(:disabled) { transform: scale(0.97); }
.rg-btn.primary { background: var(--text); color: var(--bg); border-color: transparent; box-shadow: var(--primary-shadow); }
.rg-btn.primary:hover { background: color-mix(in srgb, var(--text) 86%, var(--bg)); }
.rg-btn.small { height: 28px; padding: 0 12px; font-size: 12.5px; }
.rg-btn:disabled { opacity: 0.42; cursor: default; box-shadow: none; }
.rg-btn svg { width: 15px; height: 15px; }

/* composer */
.rg-composer-wrap { flex: none; padding: 6px 24px 18px; }
.rg-try { display: flex; align-items: center; gap: 8px; max-width: 760px; margin: 0 auto 8px; font: 11.5px var(--mono); color: var(--faint); min-width: 0; }
.rg-try button { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 4px 10px; border: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 999px; background: transparent; color: var(--accent); font: 11.5px var(--mono); transition: background 150ms; }
.rg-try button:hover { background: var(--accent-bg); }
.rg-try[hidden] { display: none; }
.rg-composer { container: rgcomp / inline-size; position: relative; max-width: 760px; margin: 0 auto; border: 1px solid var(--line-strong); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease); }
.rg-composer:focus-within { border-color: color-mix(in srgb, var(--text) 30%, transparent); }
.rg-composer textarea { display: block; width: 100%; height: 48px; resize: none; border: 0; outline: 0; background: transparent; color: inherit; font: inherit; padding: 13px 16px 4px; line-height: 1.5; box-shadow: none !important; }
.rg-composer textarea::placeholder { color: var(--faint); }
.rg-comp-foot { display: flex; align-items: center; gap: 6px; padding: 6px 10px 10px 10px; min-width: 0; }
/* As in the app: when the composer gets narrow, secondary labels give way. */
@container rgcomp (max-width: 520px) { .rg-uring { display: none; } }
@container rgcomp (max-width: 430px) { .rg-chip.agent { display: none; } }
@container rgcomp (max-width: 340px) { .rg-pick-btn:not(.model) .rg-ml { display: none; } }
.rg-chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--active); color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; }
.rg-chip .rg-sep { opacity: 0.55; }
.rg-pick { display: inline-flex; }
.rg-pick-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 500; white-space: nowrap; transition: background 150ms var(--ease), color 150ms var(--ease); }
.rg-pick-btn:hover, .rg-pick-btn[aria-expanded="true"] { background: var(--hover); color: var(--text); }
.rg-pick-btn svg { width: 14px; height: 14px; }
.rg-pick-btn svg:last-child { width: 12px; height: 12px; opacity: 0.7; }
.rg-pick-btn[data-mode="auto"] { color: var(--accent); }
.rg-pick-btn[data-mode="plan"] { color: var(--focus); }
/* Menus hang above the composer's foot and never leave the composer: demo.js lines
   them up with their button, then pulls them back inside when room is short. */
.rg-menu { position: absolute; right: 8px; bottom: 56px; z-index: 30; width: 300px; max-width: calc(100% - 16px); padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow); animation: rg-in 140ms var(--ease); }
.rg-menu-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 4px 10px 6px; font-size: 12px; font-weight: 600; }
.rg-menu-head span { font-weight: 400; font-size: 11.5px; color: var(--faint); }
.rg-opt { width: 100%; display: flex; align-items: center; gap: 11px; padding: 7px 10px; border: 0; border-radius: 10px; background: transparent; text-align: left; transition: background 120ms var(--ease); }
.rg-opt:hover { background: var(--hover); }
.rg-opt[aria-selected="true"] { background: var(--active); }
.rg-opt .rg-ot { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rg-opt .rg-ol { font-size: 13px; font-weight: 500; }
.rg-opt .rg-od { font-size: 12px; color: var(--muted); line-height: 1.35; }
.rg-opt .rg-oc { width: 16px; flex: none; display: grid; place-items: center; }
.rg-opt .rg-oc svg { width: 15px; height: 15px; stroke-width: 2; }
.rg-mode-ico { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--active); color: var(--muted); }
.rg-mode-ico svg { width: 15px; height: 15px; }
.rg-opt[data-mode="auto"] .rg-mode-ico { background: var(--accent-bg); color: var(--accent); }
.rg-opt[data-mode="plan"] .rg-mode-ico { background: color-mix(in srgb, var(--focus) 14%, transparent); color: var(--focus); }
.rg-uring { width: 32px; height: 32px; display: grid; place-items: center; color: var(--focus); flex: none; }
.rg-uring svg { width: 20px; height: 20px; }
.rg-uring circle { fill: none; stroke-width: 2.4; }
.rg-uring .bg { stroke: var(--line-strong); }
.rg-uring .fg { stroke: currentColor; stroke-linecap: round; }
.rg-send { width: 34px; height: 34px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--text); color: var(--bg); box-shadow: var(--primary-shadow); flex: none; transition: transform 100ms var(--ease), opacity 150ms, background 150ms; }
.rg-send:hover:not(:disabled) { transform: scale(1.05); }
.rg-send:disabled { opacity: 0.3; cursor: default; box-shadow: none; }
.rg-send.stop { background: var(--active); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); opacity: 1; }

/* a teammate's session: only what rango shares */
.rg-card { max-width: 620px; margin: 0 auto; padding: 26px 24px; }
.rg-card h4 { margin: 0 0 4px; font: 600 17px/1.3 var(--sans); letter-spacing: -0.015em; }
.rg-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.rg-info { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 20px; padding: 10px 12px; border-radius: 12px; background: var(--active); color: var(--muted); font-size: 13px; }
.rg-info svg { width: 14px; height: 14px; margin-top: 3px; }

/* terminal drawer */
.rg-term { flex: none; height: 148px; border-top: 1px solid var(--line); background: var(--sunken); display: flex; flex-direction: column; }
.rg-term-head { height: 34px; flex: none; display: flex; align-items: center; gap: 4px; padding: 0 8px; border-bottom: 1px solid var(--line); }
.rg-ttab { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--active); color: var(--text); font-size: 12.5px; font-weight: 500; }
.rg-ttab svg { width: 13px; height: 13px; }
.rg-term pre { flex: 1; margin: 0; padding: 8px 12px; overflow: auto; font: 12px/1.55 var(--mono); color: var(--muted); white-space: pre; }
.rg-term pre b { color: var(--ok); font-weight: 400; }
.rg-term pre i { font-style: normal; display: inline-block; width: 7px; height: 13px; vertical-align: -2px; background: var(--text); opacity: 0.7; animation: rg-blink 1s steps(2) infinite; }

/* ---------- right panel */
.rg-panel { margin-left: 8px; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; transition: background 200ms; }
.rg.no-panel .rg-panel { display: none; }
.rg-tabs { height: 48px; flex: none; display: flex; align-items: center; gap: 1px; padding: 0 6px; border-bottom: 1px solid var(--line); }
.rg-ptab { position: relative; height: 28px; padding: 0 9px; white-space: nowrap; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; transition: background 150ms var(--ease), color 150ms var(--ease); }
.rg-ptab:hover { color: var(--text); background: var(--hover); }
.rg-ptab[aria-selected="true"] { background: var(--active); color: var(--text); }
.rg-ptab.has-dot::after { content: ""; position: absolute; top: 3px; right: 2px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-strong); box-shadow: 0 0 0 2px var(--bg); }
.rg-tabs .rg-icon { margin-left: auto; flex: none; }
.rg-body { flex: 1; overflow-y: auto; padding: 14px 14px 16px; min-height: 0; font-size: 13px; }
.rg-sec + .rg-sec { margin-top: 22px; }
.rg-sec-title { font-size: 12px; font-weight: 500; color: var(--muted); margin: 0 0 8px; display: flex; align-items: center; gap: 6px; }
.rg-empty { color: var(--muted); font-size: 13px; }
.rg-cl { border-left: 2px solid var(--accent-strong); background: var(--accent-bg); border-radius: 0 12px 12px 0; padding: 8px 10px; margin-bottom: 6px; }
.rg-cl.fresh { animation: rg-cl 1400ms var(--ease); }
@keyframes rg-cl { 0% { background: color-mix(in srgb, var(--accent-strong) 55%, var(--accent-bg)); transform: translateX(6px); opacity: 0; } 25% { transform: none; opacity: 1; } }
.rg-cl .rg-cp { font-family: var(--mono); font-size: 12.5px; font-weight: 600; overflow-wrap: anywhere; }
.rg-cl .rg-cw { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.rg-cl .rg-cw .lbl { color: var(--accent); }
.rg-cl .rg-cact { margin-top: 6px; }
.rg-diff { margin: 8px 0 0; padding: 6px 0; overflow: auto; font: 12px/1.55 var(--mono); background: var(--sunken); border: 1px solid var(--line); border-radius: 8px; white-space: pre; }
.rg-diff span { display: block; padding: 0 10px; min-width: max-content; }
.rg-diff .add { background: var(--add-bg); color: var(--add); }
.rg-diff .del { background: var(--del-bg); color: var(--del); }
.rg-diff .hunk { color: var(--muted); }
.rg-mate { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; min-width: 0; }
.rg-mate .rg-mt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rg-mate .rg-ms { font-size: 12px; color: var(--muted); white-space: nowrap; }
.rg-brief { display: block; width: 100%; min-height: 92px; resize: vertical; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: inherit; font: 13px/1.5 var(--sans); }
.rg-brief:focus { outline: none; border-color: color-mix(in srgb, var(--focus) 55%, var(--line-strong)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent) !important; }
.rg-row { display: flex; gap: 6px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--muted); }
.rg-field { display: flex; gap: 6px; margin-top: 8px; }
.rg-field input { flex: 1; min-width: 0; height: 32px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: inherit; font: 13px var(--sans); }
.rg-field input::placeholder { color: var(--faint); }
.rg-copyline { margin-top: 8px; display: flex; gap: 6px; align-items: center; }
.rg-copyline code { flex: 1; min-width: 0; font: 11.5px var(--mono); background: var(--sunken); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rg-hint { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.rg-env { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; min-width: 0; }
.rg-env svg { color: var(--muted); }
.rg-env span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rg-env small { font-size: 12px; color: var(--muted); }
.rg-ctx-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; margin-bottom: 8px; }
.rg-ctx-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--active); margin-bottom: 12px; }
.rg-ctx-bar span { display: block; height: 100%; }
.rg-ctx-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 46px; gap: 8px; align-items: center; padding: 3px 0; font-size: 13px; }
.rg-ctx-row i { width: 10px; height: 10px; border-radius: 3px; }
.rg-ctx-row .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; }
.rg-k-msg { background: #3b82f6; } .rg-k-skill { background: #d69e2e; } .rg-k-sys { background: #ea7a3a; } .rg-k-prompt { background: #8b8a85; } .rg-k-free { border: 1px solid var(--line-strong); }
.rg-files { list-style: none; margin: 0 0 12px; padding: 0; }
.rg-files li { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; font-family: var(--mono); font-size: 12px; }
.rg-files .fp { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.rg-files .ct { color: var(--accent); }
.rg-plus { color: var(--add); } .rg-minus { color: var(--del); }
.rg-git-state { font-size: 13px; margin: 0 0 10px; }
.rg-git-state .br { font-family: var(--mono); font-size: 12.5px; background: var(--active); padding: 1px 6px; border-radius: 4px; }
.rg-git-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.rg-git-msg { font-size: 12.5px; margin: 8px 0 0; color: var(--ok); }
.rg-commit { display: flex; gap: 10px; padding: 3px 0; font-size: 12.5px; align-items: baseline; }
.rg-commit .sha { font-family: var(--mono); color: var(--faint); font-size: 11.5px; }
.rg-commit .subj { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rg-commit .by { color: var(--muted); white-space: nowrap; font-size: 12px; }
.rg-branch { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 12.5px; }
.rg-branch .nm { font: 500 11.5px var(--mono); }
.rg-branch .sub { color: var(--muted); font-size: 12px; margin-left: auto; white-space: nowrap; }

.rg-toast { position: absolute; left: 50%; bottom: 18px; z-index: 40; transform: translateX(-50%); max-width: min(420px, calc(100% - 32px)); padding: 10px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow); font-size: 13px; text-align: center; animation: rg-in 220ms var(--ease); }
.rg-scrim { display: none; }

/* ---------- narrow frame: the sidebar and the panel float over the page, as in the app */
@container demo (max-width: 980px) {
  .rg { grid-template-columns: minmax(0, 1fr); padding: 0; height: min(78svh, 640px); }
  .rg.no-side { padding: 0; }
  .rg-main { border: 0; border-radius: 0; }
  .rg-side, .rg.no-side .rg-side { position: absolute; z-index: 21; left: 0; top: 0; bottom: 0; width: min(264px, 84%); visibility: visible; background: var(--side); box-shadow: var(--shadow); transform: translateX(-105%); transition: transform 180ms ease; }
  .rg:not(.no-side) .rg-side { transform: none; }
  .rg-side > * { min-width: 0; }
  .rg-panel { position: absolute; z-index: 21; right: 0; top: 0; bottom: 0; margin: 0; width: min(340px, 92%); border-radius: 0; border-width: 0 0 0 1px; box-shadow: var(--shadow); }
  .rg:not(.no-side) .rg-scrim, .rg:not(.no-panel) .rg-scrim { display: block; position: absolute; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.4); border: 0; }
  .rg-thread { padding: 18px 16px; }
  .rg-composer-wrap { padding: 6px 12px 12px; }
  .rg-crumb { display: none; }
}
@container demo (max-width: 560px) {
  .rg-where { display: none; }
  .demo-bar .demo-title, .demo-bar .demo-dots { display: none; }
  .demo-bar .demo-tag { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .rg *, .rg { transition: none !important; animation: none !important; } }
