/* JudeAI chat shell — parity pass.
   A calm, complete application shell using Jude Glass tokens and the existing DOM/behaviour. */

body[data-chat-shell="parity-v1"] {
  --jude-type: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif;
  --shell-measure: 760px;
  --shell-composer: 800px;
  --shell-rail: 300px;
  --shell-header: 60px;
  --shell-radius-sm: 9px;
  --shell-radius-control: 12px;
  --shell-radius-card: 16px;
  --shell-radius-panel: 20px;
  --shell-ease: cubic-bezier(.2, .8, .2, 1);
  background:
    radial-gradient(900px 620px at 100% 100%, color-mix(in srgb, var(--c-glow-bg) 74%, transparent), transparent 68%),
    radial-gradient(720px 420px at 70% 16%, color-mix(in srgb, var(--c-accent-deep) 20%, transparent), transparent 72%),
    var(--c-app);
  font-family: var(--jude-type);
  font-size: 17px;
  line-height: 1.52;
  font-weight: 400;
  font-kerning: normal;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: subpixel-antialiased;
  letter-spacing: 0;
}
:root[data-theme="dark"] body[data-chat-shell="parity-v1"] {
  background:
    radial-gradient(1000px 760px at 100% 100%, rgba(8,99,150,.30), transparent 70%),
    radial-gradient(760px 540px at 67% 18%, rgba(19,167,230,.08), transparent 72%),
    linear-gradient(126deg, transparent 0 46%, rgba(11,72,104,.12) 47% 54%, transparent 55%),
    #071722;
}
:root[data-theme="electric"] body[data-chat-shell="parity-v1"] {
  background:
    radial-gradient(920px 720px at 100% 100%, rgba(0,173,229,.38), transparent 68%),
    radial-gradient(720px 500px at 72% 14%, rgba(114,228,255,.16), transparent 70%),
    linear-gradient(126deg, rgba(0,42,61,.18), rgba(0,105,143,.10)),
    #014461;
}

/* Brand ink (docs/brand/BRAND.md, colour C). No grey text: primary text is white on the dark
   themes and night on Light; secondary text is blue; words on a button are night. Problems
   are said in the same calm ink, never red. Each pair meets WCAG AA or better on every
   surface of its theme. */
:root,
:root body[data-chat-shell="parity-v1"] {
  --c-ink: #ffffff;
  /* Electric draws on brighter blues, where #8bebff falls below 4.5:1 on a selected row, so
     its secondary ink is the paler brand blue that keeps AA on every Electric surface. */
  --c-ink-2: #eef8fd;
  --c-ink-3: #e8f5fc;
  --c-ink-4: #e8f5fc;
  --c-ink-5: #e8f5fc;
  --c-ink-on-accent: #041019;
  --c-bad: #ffffff;
  --c-danger: #ffffff;
  --j-danger: #ffffff;
  --c-bad-bg: #0a2a40;
  --c-bad-edge: #42dcff;
}
:root[data-theme="dark"],
:root[data-theme="dark"] body[data-chat-shell="parity-v1"] {
  --c-ink: #ffffff;
  --c-ink-2: #edf6fb;
  --c-ink-3: #e6f2f9;
  --c-ink-4: #e6f2f9;
  --c-ink-5: #e6f2f9;
  --c-ink-on-accent: #041019;
  --c-bad: #ffffff;
  --c-danger: #ffffff;
  --j-danger: #ffffff;
  --c-bad-bg: #0a2a40;
  --c-bad-edge: #16c7f2;
}
:root[data-theme="light"],
:root[data-theme="light"] body[data-chat-shell="parity-v1"] {
  --c-ink: #041019;
  --c-ink-2: #0e2230;
  --c-ink-3: #102a3a;
  --c-ink-4: #102a3a;
  --c-ink-5: #102a3a;
  --c-ink-on-accent: #041019;
  --c-bad: #041019;
  --c-danger: #041019;
  --j-danger: #041019;
  --c-bad-bg: #e8f8ff;
  --c-bad-edge: #0a80c4;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="system"],
  :root[data-theme="system"] body[data-chat-shell="parity-v1"] {
    --c-ink: #041019;
    --c-ink-2: #0e2230;
    --c-ink-3: #102a3a;
    --c-ink-4: #102a3a;
    --c-ink-5: #102a3a;
    --c-ink-on-accent: #041019;
    --c-bad: #041019;
    --c-danger: #041019;
    --j-danger: #041019;
    --c-bad-bg: #e8f8ff;
    --c-bad-edge: #0a80c4;
  }
}

body[data-chat-shell="parity-v1"] .app {
  width: 100%;
  max-width: 100vw;
  min-width: 0;
  overflow: hidden;
  background: transparent;
}
body[data-chat-shell="parity-v1"] :is(button, input, textarea, select) { font-family: var(--jude-type); }
body[data-chat-shell="parity-v1"] :is(#chat, #messages, .compose, #form) { min-width: 0; }

body[data-chat-shell="parity-v1"] .skip-to-chat {
  position: fixed;
  z-index: 1000;
  left: 16px;
  top: 12px;
  transform: translateY(-160%);
  padding: 10px 14px;
  border: 2px solid var(--c-cyan);
  border-radius: var(--shell-radius-control);
  background: var(--c-surface-strong);
  color: var(--c-ink);
  text-decoration: none;
}
body[data-chat-shell="parity-v1"] .skip-to-chat:focus { transform: none; }

/* Global interaction language */
body[data-chat-shell="parity-v1"] :is(button, a, input, textarea, select, summary):focus-visible {
  outline: 2px solid var(--c-cyan);
  outline-offset: 3px;
}
body[data-chat-shell="parity-v1"] :is(button, .rail-row, .plugin-row, .menu-row) {
  transition: background-color 180ms var(--shell-ease), border-color 180ms var(--shell-ease), color 180ms var(--shell-ease), opacity 180ms var(--shell-ease);
}
/* A disabled control is shown by a dashed edge and blue ink, never by fading its words. */
body[data-chat-shell="parity-v1"] button:disabled {
  cursor: not-allowed;
  opacity: 1;
  color: var(--c-ink-3);
  border-style: dashed;
}
body[data-chat-shell="parity-v1"] button.primary:disabled {
  background: transparent;
  border: 1px dashed var(--c-border-strong);
  box-shadow: none;
  color: var(--c-ink-3);
}
body[data-chat-shell="parity-v1"] .quiet {
  border-color: var(--c-border);
  border-radius: var(--shell-radius-control);
  background: transparent;
  color: var(--c-ink-2);
}
body[data-chat-shell="parity-v1"] .quiet:hover {
  border-color: var(--c-border-strong);
  background: var(--c-surface-hover);
  color: var(--c-ink);
}
body[data-chat-shell="parity-v1"] .primary {
  border-color: color-mix(in srgb, var(--c-cyan) 55%, transparent);
  border-radius: var(--shell-radius-control);
  background: linear-gradient(180deg, var(--c-accent-bright), var(--c-accent-mid));
  box-shadow: inset 0 1px 0 var(--c-edge-strong), 0 8px 22px var(--c-drop);
  color: var(--c-ink-on-accent);
  font-weight: 650;
}

/* Top bar: one brand anchor and two obvious shell actions. */
body[data-chat-shell="parity-v1"] .app { padding-inline: 20px; }
body[data-chat-shell="parity-v1"] .app > header {
  height: var(--shell-header);
  border-bottom: 1px solid var(--c-border);
}
body[data-chat-shell="parity-v1"] .brand { gap: 9px; font-size: 17px; font-weight: 650; }
body[data-chat-shell="parity-v1"] .brand .judeai-logo { width: 31px; height: 31px; border-radius: 9px; }
body[data-chat-shell="parity-v1"] header .pill.icon-pill,
body[data-chat-shell="parity-v1"] header .icon-btn {
  width: 36px;
  height: 36px;
  min-height: 36px;
  border-color: transparent;
}
body[data-chat-shell="parity-v1"] header .pill.icon-pill:hover,
body[data-chat-shell="parity-v1"] header .icon-btn:hover {
  border-color: var(--c-border);
  background: var(--c-surface-hover);
}

/* Rail and chat history: destinations first, history second, account last. */
body[data-chat-shell="parity-v1"] #rail {
  width: var(--shell-rail);
  gap: 3px;
  padding: 12px 13px 10px;
  border-right: 1px solid var(--c-border);
  background: var(--c-sunk);
}
body[data-chat-shell="parity-v1"] .rail-id { min-height: 46px; }
body[data-chat-shell="parity-v1"] .rail-brand {
  min-height: 38px;
  margin: 0;
  padding: 4px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--c-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
body[data-chat-shell="parity-v1"] .rail-brand:hover { background: var(--c-surface-hover); }
body[data-chat-shell="parity-v1"] .rail-brand:active { transform: translateY(1px); }
body[data-chat-shell="parity-v1"] .rail-brand .judeai-logo { width: 26px; height: 26px; }
body[data-chat-shell="parity-v1"] .rail-brand strong { font-size: 17px; font-weight: 600; }
body[data-chat-shell="parity-v1"] .rail-primary {
  min-height: 46px;
  padding: 8px 9px;
  border: 0;
  border-radius: 8px;
  font-size: 16.5px;
  font-weight: 520;
}
body[data-chat-shell="parity-v1"] .rail-primary:hover { background: var(--c-surface-hover); }
body[data-chat-shell="parity-v1"] .rail-new-mark { width: 27px; height: 27px; border-color: transparent; }
body[data-chat-shell="parity-v1"] .rail-nav { gap: 1px; padding-block: 2px 6px; }
body[data-chat-shell="parity-v1"] .rail-nav-row {
  min-height: 44px;
  padding: 8px 9px;
  border-radius: 8px;
  color: var(--c-ink-2);
  font-size: 16.5px;
  font-weight: 450;
  text-decoration: none;
}
body[data-chat-shell="parity-v1"] .rail-nav-row .ji { width: 18px; height: 18px; }
body[data-chat-shell="parity-v1"] .rail-nav-row:hover { background: var(--c-surface-hover); color: var(--c-ink); }
body[data-chat-shell="parity-v1"] .rail-nav-row:is(.on, [aria-current="page"]) {
  background: transparent;
  color: var(--c-ink);
  font-weight: 640;
}
body[data-chat-shell="parity-v1"] .rail-group > summary {
  padding: 18px 8px 7px;
  color: var(--c-ink-4);
  font-size: 12.5px;
  font-weight: 560;
  letter-spacing: .075em;
}
body[data-chat-shell="parity-v1"] .rail-row {
  min-height: 50px;
  border-radius: 8px;
}
body[data-chat-shell="parity-v1"] .rail-row:hover { background: var(--c-surface-hover); }
body[data-chat-shell="parity-v1"] .rail-row.current {
  background: var(--c-surface-selected);
  box-shadow: none;
}
body[data-chat-shell="parity-v1"] .rail-open { padding: 12px 9px; }
body[data-chat-shell="parity-v1"] .rail-title {
  font-size: 16.5px;
  font-weight: 450;
  line-height: 1.4;
  letter-spacing: .008em;
}
body[data-chat-shell="parity-v1"] .rail-kind { display: none; }
body[data-chat-shell="parity-v1"] .rail-more { opacity: 0; }
body[data-chat-shell="parity-v1"] .rail-row:is(:hover, :focus-within, .current) .rail-more { opacity: 1; }
body[data-chat-shell="parity-v1"] .rail-bulk {
  border-color: var(--c-border-strong);
  background: var(--c-surface);
}
body[data-chat-shell="parity-v1"] .rail-foot {
  padding-top: 5px;
  border-color: var(--c-border);
}
body[data-chat-shell="parity-v1"] .rail-account { min-height: 50px; padding-block: 7px; }
body[data-chat-shell="parity-v1"] .rail-avatar { width: 30px; height: 30px; }

/* A real companion browser: conversation and live work remain visible together. */
body[data-chat-shell="parity-v1"] #browser-pane {
  --browser-width: clamp(440px, 46vw, 760px);
  position: fixed;
  z-index: 42;
  inset: 0 0 0 auto;
  display: grid;
  grid-template-rows: 58px 56px minmax(0, 1fr) 34px;
  width: var(--browser-width);
  border-left: 1px solid var(--c-border-strong);
  background: var(--c-app);
  box-shadow: -24px 0 70px rgba(0, 8, 14, .28);
}

body[data-chat-shell="parity-v1"] #bank-workspace-pane {
  position: fixed;
  z-index: 36;
  inset: 0 0 0 min(390px, 28vw);
  display: grid;
  grid-template-rows: 54px minmax(0, 1fr);
  background: var(--c-bg);
  border-left: 1px solid var(--c-line);
}
body[data-chat-shell="parity-v1"] #bank-workspace-pane[hidden] { display: none; }
body[data-chat-shell="parity-v1"] #bank-workspace-pane > header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--c-line);
  background: var(--c-surface);
}
body[data-chat-shell="parity-v1"] #bank-workspace-pane > header strong { font-size: 15px; }
body[data-chat-shell="parity-v1"] #bank-workspace-pane > header span { color: var(--c-muted); font-size: 12px; }
body[data-chat-shell="parity-v1"] #bank-workspace-close { margin-left: auto; }
body[data-chat-shell="parity-v1"] #bank-workspace-frame { width: 100%; height: 100%; border: 0; background: #001522; }
@media (max-width: 900px) {
  body[data-chat-shell="parity-v1"] #bank-workspace-pane { inset: 0; }
}
body[data-chat-shell="parity-v1"].browser-pane-open .app {
  width: calc(100% - clamp(440px, 46vw, 760px));
}
body[data-chat-shell="parity-v1"].browser-pane-expanded #browser-pane { --browser-width: min(76vw, 1120px); }
body[data-chat-shell="parity-v1"].browser-pane-expanded .app { width: calc(100% - min(76vw, 1120px)); }
body[data-chat-shell="parity-v1"] .browser-tabs,
body[data-chat-shell="parity-v1"] .browser-toolbar,
body[data-chat-shell="parity-v1"] .browser-status {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-inline: 12px;
  border-bottom: 1px solid var(--c-border);
  background: color-mix(in srgb, var(--c-surface-strong) 92%, transparent);
  backdrop-filter: blur(18px) saturate(130%);
}
body[data-chat-shell="parity-v1"] .browser-tabs-space { flex: 1; }
body[data-chat-shell="parity-v1"] .browser-tab {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  max-width: 290px;
  padding: 9px 13px;
  border: 1px solid var(--c-border);
  border-radius: 13px;
  background: var(--c-surface-selected);
  color: var(--c-ink);
  font-size: 14px;
}
body[data-chat-shell="parity-v1"] .browser-tab > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body[data-chat-shell="parity-v1"] .browser-tab-mark {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 7px;
  background: linear-gradient(150deg, var(--c-accent-bright), var(--c-cyan));
  color: #03141e;
  font-size: 11px;
}
body[data-chat-shell="parity-v1"] .browser-tool {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--c-ink-2);
  font-size: 20px;
  cursor: pointer;
}
body[data-chat-shell="parity-v1"] .browser-tool:hover { border-color: var(--c-border); background: var(--c-surface-hover); color: var(--c-ink); }
body[data-chat-shell="parity-v1"] .browser-toolbar { border-bottom-color: var(--c-border-strong); }
body[data-chat-shell="parity-v1"] #browser-address-form { flex: 1; min-width: 0; }
body[data-chat-shell="parity-v1"] #browser-address {
  width: 100%;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--c-border-strong);
  border-radius: 999px;
  outline: 0;
  background: var(--c-field);
  color: var(--c-ink);
  text-align: center;
}
body[data-chat-shell="parity-v1"] #browser-address:focus { border-color: var(--c-cyan); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-cyan) 15%, transparent); text-align: left; }
body[data-chat-shell="parity-v1"] .browser-stage { position: relative; min-height: 0; overflow: auto; background: #020609; }
body[data-chat-shell="parity-v1"] #browser-image { display: block; width: 100%; min-height: 100%; object-fit: contain; object-position: top; }
body[data-chat-shell="parity-v1"] .browser-empty,
body[data-chat-shell="parity-v1"] .browser-busy {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 32px;
  text-align: center;
  color: var(--c-ink-2);
  background: radial-gradient(circle at 50% 42%, rgba(19,167,230,.13), transparent 36%), var(--c-app);
}
body[data-chat-shell="parity-v1"] .browser-empty-mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 1px solid var(--c-border-strong);
  border-radius: 18px;
  background: linear-gradient(145deg, var(--c-accent-mid), var(--c-sunk));
  box-shadow: 0 18px 48px var(--c-drop), 0 0 30px rgba(19,167,230,.16);
  color: var(--c-cyan-soft);
  font-size: 28px;
  font-weight: 700;
}
body[data-chat-shell="parity-v1"] .browser-empty strong { color: var(--c-ink); font-size: 20px; }
body[data-chat-shell="parity-v1"] .browser-empty p { max-width: 30ch; margin: 0; }
body[data-chat-shell="parity-v1"] .browser-busy { grid-template-columns: repeat(3, 8px); align-content: center; background: color-mix(in srgb, var(--c-app) 88%, transparent); backdrop-filter: blur(10px); z-index: 2; }
body[data-chat-shell="parity-v1"] .browser-busy span { width: 8px; height: 8px; border-radius: 50%; background: var(--c-cyan); animation: browser-pulse 1s ease-in-out infinite alternate; }
body[data-chat-shell="parity-v1"] .browser-busy span:nth-child(2) { animation-delay: .16s; }
body[data-chat-shell="parity-v1"] .browser-busy span:nth-child(3) { animation-delay: .32s; }
body[data-chat-shell="parity-v1"] .browser-busy b { grid-column: 1 / -1; margin-top: 8px; color: var(--c-ink); font-size: 13px; font-weight: 520; }
@keyframes browser-pulse { to { opacity: .3; transform: translateY(-4px); } }
body[data-chat-shell="parity-v1"] .browser-status { justify-content: space-between; border-top: 1px solid var(--c-border); border-bottom: 0; color: var(--c-ink-3); font-size: 11px; }
body[data-chat-shell="parity-v1"] .browser-status button { border: 0; background: transparent; color: var(--c-cyan-soft); cursor: pointer; }

@media (min-width: 901px) {
  body[data-chat-shell="parity-v1"].with-rail .app {
    grid-template-columns: var(--shell-rail) minmax(0, 1fr);
  }
}

/* The Chats rail is a true application edge, not a card inside the chat canvas. */
@media (min-width: 1025px) {
  body[data-chat-shell="parity-v1"].with-rail .app {
    padding-inline: 0;
  }
  body[data-chat-shell="parity-v1"].with-rail #rail {
    grid-row: 1 / -1;
    min-height: 100dvh;
    align-self: stretch;
    margin: 0;
  }
}

@media (min-width: 901px) and (max-width: 1180px) {
  body[data-chat-shell="parity-v1"] {
    --shell-measure: min(100%, 700px);
    --shell-composer: min(100%, 740px);
  }
  body[data-chat-shell="parity-v1"] main { padding-inline: 18px; }
  body[data-chat-shell="parity-v1"] .compose { padding-inline: 18px; }
}

/* Conversation: a stable reading column with visibly different authorship. */
body[data-chat-shell="parity-v1"] main {
  --measure: min(100%, var(--shell-measure));
  padding: 0 20px 28px;
  scroll-padding-block: 24px 160px;
}
body[data-chat-shell="parity-v1"] #welcome {
  gap: 18px;
  padding-bottom: clamp(44px, 9vh, 104px);
}
body[data-chat-shell="parity-v1"] #welcome .judeai-logo {
  width: 88px;
  height: 88px;
  border-radius: 20%;
  box-shadow: 0 18px 44px rgba(3, 16, 25, .32), 0 0 32px rgba(19, 167, 230, .14);
}
body[data-chat-shell="parity-v1"] #welcome h1 {
  font-size: clamp(27px, 3vw, 34px);
  font-weight: 520;
  letter-spacing: -.03em;
}
body[data-chat-shell="parity-v1"] #welcome-note { max-width: 42ch; line-height: 1.5; }
body[data-chat-shell="parity-v1"] #messages { max-width: var(--shell-measure); padding-block: 18px 10px; }
body[data-chat-shell="parity-v1"] .turn {
  max-width: 100%;
  margin: 18px 0 26px;
  color: var(--c-ink);
  font-size: 17.5px;
  font-weight: 460;
  line-height: 1.62;
}
body[data-chat-shell="parity-v1"] .turn.user {
  width: fit-content;
  max-width: min(78%, 680px);
  margin-left: auto;
  padding: 11px 16px;
  border: 1px solid var(--c-cyan-16);
  border-radius: 18px 18px 5px 18px;
  background: color-mix(in srgb, var(--c-raised) 72%, transparent);
  box-shadow: inset 0 1px 0 var(--c-ink-wash);
}
body[data-chat-shell="parity-v1"] .turn.assistant,
body[data-chat-shell="parity-v1"] .turn.assistant.file-answer {
  padding: 0 !important;
  border: 0;
  border-radius: 0;
  background: transparent;
}
body[data-chat-shell="parity-v1"] .turn.assistant .by {
  display: none;
}
body[data-chat-shell="parity-v1"] .answer-body { color: var(--c-ink); }
body[data-chat-shell="parity-v1"] .answer-body :is(p, li) { font-weight: 460; }
body[data-chat-shell="parity-v1"] .answer-body > :first-child { margin-top: 0; }
body[data-chat-shell="parity-v1"] .answer-body > :last-child { margin-bottom: 0; }
body[data-chat-shell="parity-v1"] .turn :is(h1, h2, h3, h4) {
  margin-top: 1.35em;
  line-height: 1.25;
  letter-spacing: -.018em;
}
body[data-chat-shell="parity-v1"] .turn pre,
body[data-chat-shell="parity-v1"] .turn .table-scroll {
  border-color: var(--c-border);
  border-radius: var(--shell-radius-control);
}
body[data-chat-shell="parity-v1"] .message-tools {
  gap: 3px;
  margin-top: 11px;
}
body[data-chat-shell="parity-v1"] .message-tools .quiet {
  min-height: 36px;
  padding: 5px 9px;
  border-color: transparent;
  color: var(--c-ink-3);
  font-size: 13.5px;
  font-weight: 520;
}
body[data-chat-shell="parity-v1"] .turn.assistant:is(:hover, :focus-within) .message-tools { opacity: 1; }
body[data-chat-shell="parity-v1"] .message-tools .quiet:hover { color: var(--c-ink); }

/* Work, approval, failures and retry: honest state before technical detail. */
body[data-chat-shell="parity-v1"] .run {
  max-width: var(--shell-measure);
  margin: 14px 0 18px;
  padding: 4px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
body[data-chat-shell="parity-v1"] .run[data-tone="review"] .doing { color: var(--c-warn); }
body[data-chat-shell="parity-v1"] .run[data-tone="failure"] .doing { color: var(--c-bad); }
body[data-chat-shell="parity-v1"] .run[data-tone="success"] .doing { color: var(--c-good); }
body[data-chat-shell="parity-v1"] .run[data-tone="paused"] .doing { color: var(--c-warn); }
body[data-chat-shell="parity-v1"] .doing { gap: 8px; color: var(--c-ink); }
body[data-chat-shell="parity-v1"] .doing .said { font-weight: 620; }
body[data-chat-shell="parity-v1"] .doing .step { color: var(--c-ink-2); opacity: 1; }
body[data-chat-shell="parity-v1"] .meter { margin-top: 4px; color: var(--c-ink-3); opacity: 1; }
body[data-chat-shell="parity-v1"] .run-actions { gap: 5px; margin-top: 4px; }
body[data-chat-shell="parity-v1"] .run .detail {
  min-height: 36px;
  padding: 5px 8px;
  color: var(--c-ink-2);
  opacity: 1;
  text-decoration: none;
}
body[data-chat-shell="parity-v1"] .run .detail:hover { color: var(--c-ink); text-decoration: none; }
body[data-chat-shell="parity-v1"] .run-card.approval {
  max-width: none;
  margin-top: 12px;
  border-color: var(--c-warn-edge);
  border-radius: var(--shell-radius-card);
  background: color-mix(in srgb, var(--c-warn-bg) 72%, var(--c-surface-strong));
  box-shadow: none;
}
body[data-chat-shell="parity-v1"] .run-card.approval .head b { font-size: 15px; }
body[data-chat-shell="parity-v1"] .run-card.approval .actions .pill:first-child {
  border-color: var(--c-cyan-48);
  background: var(--c-accent-deep);
  color: var(--c-ink-on-accent);
}
body[data-chat-shell="parity-v1"] #request-queue {
  max-width: var(--shell-measure);
  margin-inline: auto;
  border: 1px solid var(--c-border);
  border-radius: var(--shell-radius-control);
  background: var(--c-surface);
  opacity: 1;
}

/* Composer: the persistent primary action, with secondary controls progressively disclosed. */
body[data-chat-shell="parity-v1"] .compose {
  position: relative;
  z-index: 20;
  max-width: var(--shell-composer);
  padding: 7px 0 max(12px, env(safe-area-inset-bottom));
  /* The conversation scrolls in its own area above, so the box needs no backing panel of its own. */
  background: transparent;
}
body[data-chat-shell="parity-v1"] #form {
  border-color: var(--c-border-strong);
  border-radius: 24px;
  background: color-mix(in srgb, var(--c-compose) 94%, transparent);
  box-shadow: inset 0 1px 0 var(--c-edge), 0 10px 34px var(--c-drop);
}
body[data-chat-shell="parity-v1"] #form:focus-within {
  border-color: var(--c-cyan-48);
  box-shadow: inset 0 1px 0 var(--c-edge), 0 0 0 1px var(--c-cyan-10), 0 12px 38px var(--c-drop);
}
body[data-chat-shell="parity-v1"] #form textarea {
  color: var(--c-ink);
  line-height: 1.45;
}
body[data-chat-shell="parity-v1"] #form textarea { font-size: 17px; font-weight: 470; }
body[data-chat-shell="parity-v1"] #form textarea::placeholder { color: var(--c-ink-4); opacity: 1; }
body[data-chat-shell="parity-v1"] #form .icon-btn:not(.accent) { border-color: transparent; background: transparent; }
body[data-chat-shell="parity-v1"] #form .icon-btn:not(.accent):hover { background: var(--c-surface-hover); }
body[data-chat-shell="parity-v1"] #engine-menu.has-lightning-toggle { position: relative; }
body[data-chat-shell="parity-v1"] #engine-menu.has-lightning-toggle #engine .effort-bolt { display: none !important; }
body[data-chat-shell="parity-v1"] .lightning-toggle {
  position: absolute;
  z-index: 3;
  top: 5px;
  left: 5px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--c-cyan);
  font: 17px/1 system-ui, sans-serif;
  filter: none;
  transition: opacity 180ms var(--shell-ease), color 180ms var(--shell-ease), background-color 180ms var(--shell-ease);
}
body[data-chat-shell="parity-v1"] .lightning-toggle::before {
  content: "";
  position: absolute;
  width: 44px;
  height: 44px;
}
body[data-chat-shell="parity-v1"] .lightning-toggle:hover { background: var(--c-surface-hover); }
body[data-chat-shell="parity-v1"] .lightning-toggle[data-on="false"] {
  color: var(--c-ink-4);
  opacity: .16;
  filter: none;
}
body[data-chat-shell="parity-v1"] .lightning-toggle[data-on="false"]:is(:hover, :focus-visible) {
  color: var(--c-cyan);
  opacity: .82;
}
body[data-chat-shell="parity-v1"] #engine-menu.has-lightning-toggle #engine {
  position: relative;
}
body[data-chat-shell="parity-v1"] #engine-menu.has-lightning-toggle #engine.pill.compact {
  width: 184px;
  height: 40px;
  min-height: 40px;
  padding: 0 11px 0 43px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 14px;
  grid-template-rows: 1fr;
  column-gap: 5px;
  row-gap: 0;
  border-radius: 13px;
  transition: width 180ms var(--shell-ease), height 180ms var(--shell-ease), border-radius 180ms var(--shell-ease);
}
body[data-chat-shell="parity-v1"] #engine-menu.has-lightning-toggle #engine .effort-model {
  grid-column: 1;
  grid-row: 1;
  align-self: center;
}
body[data-chat-shell="parity-v1"] #engine-menu.has-lightning-toggle #engine .effort-level {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
}
body[data-chat-shell="parity-v1"] #engine-menu.has-lightning-toggle #engine .caret {
  grid-column: 3;
  grid-row: 1;
}
body[data-chat-shell="parity-v1"] #engine-menu.has-lightning-toggle #engine .effort-track {
  display: none;
}
body[data-chat-shell="parity-v1"] #engine-menu.has-lightning-toggle #engine[aria-expanded="true"] {
  width: 190px;
  height: 54px;
  min-height: 54px;
  padding: 6px 11px 8px 43px;
  grid-template-rows: 20px 10px;
  border-radius: 17px;
}
body[data-chat-shell="parity-v1"] #engine-menu.has-lightning-toggle #engine[aria-expanded="true"] .effort-track {
  grid-column: 1 / -1;
  grid-row: 2;
  display: block;
}
body[data-chat-shell="parity-v1"] #engine-menu.has-lightning-toggle:focus-within #engine:not([aria-expanded="true"]) {
  border-color: var(--c-border-strong);
}
body[data-chat-shell="parity-v1"] #form .row { min-height: 48px; }
body[data-chat-shell="parity-v1"] #send.icon-btn.accent {
  border-color: var(--c-edge-strong);
  box-shadow: 0 5px 16px var(--c-drop);
}
body[data-chat-shell="parity-v1"] #project-chip { background: var(--c-surface); }
body[data-chat-shell="parity-v1"] .permission-control { margin-top: 4px; }
body[data-chat-shell="parity-v1"] .permission-control > button { color: var(--cmp-ink-2); }
body[data-chat-shell="parity-v1"] .foot { color: var(--cmp-ink-2); }
body[data-chat-shell="parity-v1"] #latest {
  float: none;
  position: absolute;
  right: 10px;
  top: -42px;
  margin: 0;
  min-height: 34px;
  border-color: var(--c-border-strong);
  border-radius: 999px;
  background: var(--c-surface-strong);
  box-shadow: var(--c-shadow);
}
body[data-chat-shell="parity-v1"] #status {
  width: fit-content;
  max-width: calc(100% - 16px);
  min-height: 0;
  margin: 0 8px 8px;
  padding: 7px 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--shell-radius-control);
  background: var(--c-surface-strong);
  color: var(--c-ink-2);
  font-size: 13px;
  line-height: 1.4;
}
body[data-chat-shell="parity-v1"] #status[data-tone="empty"] { display: none; }
body[data-chat-shell="parity-v1"] #status[data-tone="error"] { border-color: var(--c-bad-edge); background: var(--c-bad-bg); color: var(--c-ink); }
body[data-chat-shell="parity-v1"] #status[data-tone="warning"] { border-color: var(--c-warn-edge); background: var(--c-warn-bg); color: var(--c-ink); }
body[data-chat-shell="parity-v1"] #status[data-tone="success"] { border-color: color-mix(in srgb, var(--c-good) 45%, transparent); background: var(--c-good-bg); color: var(--c-ink); }

/* Popovers and dialogs: one component language and one obvious dismissal. */
body[data-chat-shell="parity-v1"] .popover {
  width: min(360px, calc(100vw - 24px));
  padding: 8px;
  border-color: var(--c-cyan-30);
  border-radius: 15px;
  background: color-mix(in srgb, var(--c-compose) 98%, var(--c-accent-deep) 2%);
  box-shadow: 0 18px 56px var(--c-shade-8), inset 0 1px 0 var(--c-edge);
  backdrop-filter: blur(22px) saturate(135%);
}
body[data-chat-shell="parity-v1"] .menu-section {
  padding: 10px 10px 6px;
  color: var(--c-ink-4);
  font-size: 12.5px;
  font-weight: 560;
  letter-spacing: .075em;
  text-transform: uppercase;
}
body[data-chat-shell="parity-v1"] .menu-row {
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 11px;
  min-height: 56px;
  padding: 9px 10px;
  border-radius: 12px;
}
body[data-chat-shell="parity-v1"] .menu-row .ji { width: 19px; height: 19px; color: var(--c-ink-2); }
body[data-chat-shell="parity-v1"] .menu-title {
  font-size: 16.5px;
  font-weight: 520;
  line-height: 1.3;
  letter-spacing: .008em;
}
body[data-chat-shell="parity-v1"] .menu-hint {
  margin-top: 3px;
  color: var(--c-ink-4);
  font-size: 14px;
  line-height: 1.35;
  letter-spacing: .004em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body[data-chat-shell="parity-v1"] .menu-row:is([aria-checked="true"], [aria-selected="true"], .chosen) {
  background: var(--c-surface-selected);
}
body[data-chat-shell="parity-v1"] .permission-option {
  min-height: 52px;
  padding: 8px 10px;
  border-radius: 10px;
}
body[data-chat-shell="parity-v1"] .permission-option strong {
  color: var(--c-ink);
  font-size: 14px;
  font-weight: 540;
  line-height: 1.3;
}
body[data-chat-shell="parity-v1"] .permission-option small {
  margin-top: 3px;
  color: var(--c-ink-4);
  font-size: 12px;
  line-height: 1.35;
}
body[data-chat-shell="parity-v1"] .permission-option.current {
  background: var(--c-surface-selected);
  color: var(--c-ink);
}
body[data-chat-shell="parity-v1"] dialog {
  width: min(480px, calc(100vw - 28px));
  padding: 22px;
  border-color: var(--c-border-strong);
  border-radius: var(--shell-radius-panel);
  background: var(--c-surface-strong);
  box-shadow: 0 28px 90px var(--c-shade-10);
}
body[data-chat-shell="parity-v1"] dialog::backdrop { background: var(--c-scrim); backdrop-filter: blur(6px); }
body[data-chat-shell="parity-v1"] .panel-heading {
  position: sticky;
  z-index: 2;
  top: -22px;
  margin: -22px -22px 14px;
  padding: 18px 22px 12px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface-strong);
}
body[data-chat-shell="parity-v1"] .panel-heading h2 { font-size: 21px; letter-spacing: -.025em; }
body[data-chat-shell="parity-v1"] .panel-heading button {
  width: 36px;
  min-height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  font-size: 23px;
}
body[data-chat-shell="parity-v1"] .settings-head {
  margin-top: 22px;
  color: var(--c-ink-3);
  font-size: 12px;
  font-weight: 700;
}
body[data-chat-shell="parity-v1"] :is(#door, #security) input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--shell-radius-control);
  background: var(--c-field);
}

/* Narrow and touch layouts: keep the message first, actions reachable, sheets full width. */
@media (max-width: 1024px) {
  body[data-chat-shell="parity-v1"] #browser-pane { width: 100%; }
  body[data-chat-shell="parity-v1"].browser-pane-open .app,
  body[data-chat-shell="parity-v1"].browser-pane-expanded .app { width: 100%; }
  body[data-chat-shell="parity-v1"] .app,
  body[data-chat-shell="parity-v1"].with-rail .app {
    grid-template-columns: 0 minmax(0, 1fr) !important;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
  }
  body[data-chat-shell="parity-v1"] .app > header,
  body[data-chat-shell="parity-v1"].with-rail > .app > header {
    display: flex;
    grid-column: 1 / -1;
  }
  body[data-chat-shell="parity-v1"].with-rail header > .brand { visibility: visible; }
  body[data-chat-shell="parity-v1"] #chat,
  body[data-chat-shell="parity-v1"].with-rail #chat { grid-column: 2; grid-row: 2; }
  body[data-chat-shell="parity-v1"] .compose,
  body[data-chat-shell="parity-v1"].with-rail .compose { grid-column: 2; grid-row: 3; }
  body[data-chat-shell="parity-v1"] #rail {
    position: fixed;
    z-index: 45;
    inset: 0 auto 0 0;
    width: min(340px, 90vw);
    height: 100dvh;
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
    opacity: 1;
    visibility: hidden;
    transform: translateX(-101%);
    background: var(--c-sunk);
    box-shadow: 0 0 60px var(--c-shade-10);
    transition: transform 220ms var(--shell-ease), visibility 0s linear 220ms;
  }
  body[data-chat-shell="parity-v1"].with-rail #rail {
    visibility: visible;
    transform: none;
    transition: transform 220ms var(--shell-ease);
  }
  body[data-chat-shell="parity-v1"] .rail-scrim:not([hidden]) { display: block !important; }
}

@media (max-width: 900px) {
  body[data-chat-shell="parity-v1"] .app { padding-inline: 14px; }
  body[data-chat-shell="parity-v1"] #rail {
    width: min(340px, 90vw);
    padding-inline: 12px;
    background: var(--c-app);
  }
  body[data-chat-shell="parity-v1"] main { padding-inline: 8px; }
}

@media (max-width: 600px) {
  body[data-chat-shell="parity-v1"] { --shell-header: 54px; }
  body[data-chat-shell="parity-v1"] .app { padding-inline: 10px; }
  body[data-chat-shell="parity-v1"] .app > header { border-bottom: 0; }
  body[data-chat-shell="parity-v1"] header .brand strong { font-size: 15px; }
  body[data-chat-shell="parity-v1"] main { padding: 0 2px 18px; }
  body[data-chat-shell="parity-v1"] #messages { padding-top: 10px; }
  body[data-chat-shell="parity-v1"] .turn { margin-block: 14px 22px; }
  body[data-chat-shell="parity-v1"] .turn.user { max-width: 88%; border-radius: 18px 18px 5px 18px; }
  body[data-chat-shell="parity-v1"] .message-tools { flex-wrap: wrap; opacity: 1; }
  body[data-chat-shell="parity-v1"] .message-tools .quiet { min-height: 40px; }
  body[data-chat-shell="parity-v1"] .run { margin-inline: 0; padding: 4px 0; }
  body[data-chat-shell="parity-v1"] .compose { padding-top: 5px; }
  body[data-chat-shell="parity-v1"] #status { max-width: 100%; margin-inline: 0; }
  body[data-chat-shell="parity-v1"] dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    padding: 18px;
    border-radius: 18px;
  }
  body[data-chat-shell="parity-v1"] .panel-heading {
    top: -18px;
    margin: -18px -18px 12px;
    padding: 15px 18px 11px;
  }
  body[data-chat-shell="parity-v1"] .popover {
    width: auto;
    border-radius: var(--shell-radius-panel) var(--shell-radius-panel) 0 0;
  }
}

@media (hover: none) {
  body[data-chat-shell="parity-v1"] .rail-more,
  body[data-chat-shell="parity-v1"] .message-tools { opacity: 1; }
  body[data-chat-shell="parity-v1"] .lightning-toggle[data-on="false"] { opacity: .28; }
}

@media (prefers-reduced-motion: reduce) {
  body[data-chat-shell="parity-v1"] *,
  body[data-chat-shell="parity-v1"] *::before,
  body[data-chat-shell="parity-v1"] *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  body[data-chat-shell="parity-v1"] :is(#form, .popover, dialog, #status) {
    background: var(--c-panel);
    backdrop-filter: none;
  }
}

@media (forced-colors: active) {
  body[data-chat-shell="parity-v1"] :is(.rail-row.current, #form, .popover, dialog, #status) {
    border: 1px solid CanvasText;
  }
  body[data-chat-shell="parity-v1"] .rail-row.current { border-left-width: 3px; }
}

/* The message box, as on 22 September: a tall writing area, with every control on its bottom
   edge inside the box. + and the effort pill sit bottom left, voice and send bottom right.
   The writing area starts at 104px (84px on phones) and grows with the text to 40% of the
   screen; past that the text scrolls inside the box and the page itself never moves.
   Colours are the brand's colour C: white ink and #8bebff on dark, night ink and #075b80 on light. */
body[data-chat-shell="parity-v1"] {
  --cmp-bg: #0a2a40;
  --cmp-edge: rgba(66, 220, 255, .52);
  --cmp-edge-focus: #42dcff;
  --cmp-ring: rgba(66, 220, 255, .22);
  --cmp-ink: #ffffff;
  --cmp-ink-2: #8bebff;
  --cmp-pill: rgba(4, 16, 25, .42);
  --cmp-pill-edge: rgba(66, 220, 255, .30);
  --cmp-hover: rgba(66, 220, 255, .12);
  --cmp-accent: #42dcff;
  --cmp-accent-2: #16c7f2;
  --cmp-on-accent: #041019;
  --cmp-drop: rgba(4, 16, 25, .34);
}
:root[data-theme="electric"] body[data-chat-shell="parity-v1"] {
  --cmp-bg: rgba(10, 42, 64, .86);
  --cmp-edge: rgba(66, 220, 255, .62);
  --cmp-pill: rgba(4, 16, 25, .36);
}
:root[data-theme="light"] body[data-chat-shell="parity-v1"] {
  --cmp-bg: #ffffff;
  --cmp-edge: rgba(22, 199, 242, .62);
  --cmp-edge-focus: #16c7f2;
  --cmp-ring: rgba(22, 199, 242, .20);
  --cmp-ink: #041019;
  --cmp-ink-2: #075b80;
  --cmp-pill: #e8f8ff;
  --cmp-pill-edge: rgba(22, 199, 242, .42);
  --cmp-hover: rgba(22, 199, 242, .12);
  --cmp-drop: rgba(7, 91, 128, .12);
}
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] body[data-chat-shell="parity-v1"] {
    --cmp-bg: #ffffff;
    --cmp-edge: rgba(22, 199, 242, .62);
    --cmp-edge-focus: #16c7f2;
    --cmp-ring: rgba(22, 199, 242, .20);
    --cmp-ink: #041019;
    --cmp-ink-2: #075b80;
    --cmp-pill: #e8f8ff;
    --cmp-pill-edge: rgba(22, 199, 242, .42);
    --cmp-hover: rgba(22, 199, 242, .12);
    --cmp-drop: rgba(7, 91, 128, .12);
  }
}
body[data-chat-shell="parity-v1"] #form {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 10px 10px;
  border: 1px solid var(--cmp-edge);
  border-radius: 26px;
  background: var(--cmp-bg);
  box-shadow: 0 12px 34px var(--cmp-drop);
  color: var(--cmp-ink);
}
body[data-chat-shell="parity-v1"] #form:focus-within {
  border-color: var(--cmp-edge-focus);
  box-shadow: 0 0 0 3px var(--cmp-ring), 0 12px 34px var(--cmp-drop);
}
body[data-chat-shell="parity-v1"] #form .row {
  display: grid;
  grid-template-columns: auto auto auto minmax(0, 1fr) auto auto;
  grid-template-rows: auto var(--j-ctl);
  column-gap: 8px;
  row-gap: 6px;
  align-items: center;
  min-height: 0;
}
body[data-chat-shell="parity-v1"] #form .row > #message { grid-column: 1 / -1; grid-row: 1; }
body[data-chat-shell="parity-v1"] #form .row > #media-menu,
body[data-chat-shell="parity-v1"] #form .row > #plus { grid-column: 1; grid-row: 2; }
body[data-chat-shell="parity-v1"] #form .row > #model-menu {
  grid-column: 2;
  grid-row: 2;
  justify-self: start;
  height: var(--j-ctl);
}
body[data-chat-shell="parity-v1"] #form .row > #engine-menu {
  grid-column: 3;
  grid-row: 2;
  justify-self: start;
  order: 0;
  height: var(--j-ctl);
  margin: 0;
}
body[data-chat-shell="parity-v1"] #form .row > #voice { grid-column: 5; grid-row: 2; }
body[data-chat-shell="parity-v1"] #form .row > #send { grid-column: 6; grid-row: 2; }
body[data-chat-shell="parity-v1"] #form .row > #message {
  display: block;
  width: 100%;
  min-height: 104px;
  max-height: 40dvh;
  overflow-y: auto;
  padding: 6px 8px 2px;
  border: 0;
  background: transparent;
  color: var(--cmp-ink);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.45;
  resize: none;
  scrollbar-color: var(--cmp-pill-edge) transparent;
}
body[data-chat-shell="parity-v1"] #form .row > #message::placeholder { color: var(--cmp-ink-2); opacity: 1; }
body[data-chat-shell="parity-v1"] #form .icon-btn:not(.accent) { color: var(--cmp-ink-2); border-color: transparent; background: transparent; }
body[data-chat-shell="parity-v1"] #form .icon-btn:not(.accent):hover { color: var(--cmp-ink); background: var(--cmp-hover); }
body[data-chat-shell="parity-v1"] #form #send.icon-btn.accent {
  border-color: transparent;
  background: linear-gradient(180deg, var(--cmp-accent), var(--cmp-accent-2));
  color: var(--cmp-on-accent);
  box-shadow: 0 4px 14px var(--cmp-drop);
}
body[data-chat-shell="parity-v1"] #form #model-menu #model.pill.compact {
  width: auto;
  height: var(--j-ctl);
  min-height: var(--j-ctl);
  padding: 0 11px 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--cmp-pill-edge);
  border-radius: 999px;
  background: var(--cmp-pill);
  color: var(--cmp-ink);
  font-size: 13px;
  font-weight: 650;
}
body[data-chat-shell="parity-v1"] #form #model-menu #model.pill.compact:hover { border-color: var(--cmp-edge-focus); background: var(--cmp-hover); }
body[data-chat-shell="parity-v1"] #form #model-menu #model-label { max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body[data-chat-shell="parity-v1"] #form #model-menu .popover { left: 0; right: auto; transform-origin: bottom left; }
/* The effort pill: the lightning mark, the effort level and a caret, on the box's bottom edge.
   While its menu is open the stepped track shows beside the level, so the row keeps its height. */
body[data-chat-shell="parity-v1"] #form #engine-menu #engine.pill.compact,
body[data-chat-shell="parity-v1"] #form #engine-menu.has-lightning-toggle #engine.pill.compact {
  width: auto;
  height: var(--j-ctl);
  min-height: var(--j-ctl);
  padding: 0 11px 0 12px;
  display: inline-grid;
  grid-template-columns: auto auto 13px;
  grid-template-rows: 1fr;
  align-items: center;
  column-gap: 6px;
  row-gap: 0;
  border: 1px solid var(--cmp-pill-edge);
  border-radius: 999px;
  background: var(--cmp-pill);
  box-shadow: none;
  color: var(--cmp-ink);
  font-size: 13px;
}
body[data-chat-shell="parity-v1"] #form #engine-menu.has-lightning-toggle #engine.pill.compact { padding-left: 34px; }
body[data-chat-shell="parity-v1"] #form #engine-menu #engine.pill.compact:hover { border-color: var(--cmp-edge-focus); background: var(--cmp-hover); }
body[data-chat-shell="parity-v1"] #form #engine-menu #engine .effort-model { display:inline;grid-column:1;grid-row:1;color:var(--cmp-ink);font-size:13px;font-weight:650;max-width:120px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap }
body[data-chat-shell="parity-v1"] #form #engine-menu #engine .effort-level { grid-column: 2; grid-row: 1; color: var(--cmp-ink-2); font-size: 13px; font-weight: 600; line-height: 20px; }
body[data-chat-shell="parity-v1"] #form #engine-menu #engine .caret { grid-column: 3; grid-row: 1; color: var(--cmp-ink-2); opacity: 1; }
body[data-chat-shell="parity-v1"] #form #engine-menu #engine .effort-track { display: none; }
body[data-chat-shell="parity-v1"] #form #engine-menu #engine.pill.compact[aria-expanded="true"],
body[data-chat-shell="parity-v1"] #form #engine-menu.has-lightning-toggle #engine.pill.compact[aria-expanded="true"] { grid-template-columns: auto auto 13px 84px; }
body[data-chat-shell="parity-v1"] #form #engine-menu #engine[aria-expanded="true"] .effort-track {
  grid-column: 4;
  grid-row: 1;
  display: block;
  height: 8px;
  align-self: center;
}
body[data-chat-shell="parity-v1"] #form #engine-menu #engine .effort-thumb { width: 14px; height: 14px; background: var(--cmp-ink); }
body[data-chat-shell="parity-v1"] #form #engine-menu .lightning-toggle {
  top: 1px;
  left: 1px;
  width: 34px;
  height: 34px;
  color: var(--cmp-accent);
  filter: none;
}
body[data-chat-shell="parity-v1"] #form #engine-menu .lightning-toggle .ji { width: 17px; height: 17px; fill: currentColor; stroke: currentColor; stroke-width: 1.2; }
body[data-chat-shell="parity-v1"] #form #engine-menu .lightning-toggle[data-on="false"] { color: var(--cmp-ink-2); opacity: .45; }
body[data-chat-shell="parity-v1"] #form #engine-menu .lightning-toggle[data-on="false"] .ji { fill: none; }
body[data-chat-shell="parity-v1"] #form #engine-menu .lightning-toggle[data-on="false"]:is(:hover, :focus-visible) { color: var(--cmp-accent); opacity: 1; }
/* The menu opens upwards from the pill, which now sits at the left of the box. */
body[data-chat-shell="parity-v1"] #form #engine-menu .popover {
  left: 0;
  right: auto;
  transform-origin: bottom left;
  max-height: calc(100dvh - 160px);
  overflow-y: auto;
}
body[data-chat-shell="parity-v1"] #form #plus-menu {
  max-height: min(620px, calc(100dvh - 330px));
  overflow-y: auto;
  overscroll-behavior: contain;
}
/* The composer's menus use the brand's secondary ink, not grey, wherever they are shown. */
body[data-chat-shell="parity-v1"] :is(#runtime-menu, #plus-menu, #permission-menu) :is(.menu-section, .menu-hint, .menu-note, .permission-option small) { color: var(--cmp-ink-2); }
/* Compact Add menu: reference layout, with the same Jude inks as the composer. */
body[data-chat-shell="parity-v1"] #plus-menu {
  width: min(390px, calc(100vw - 24px));
  padding: 5px;
  border-radius: 16px;
  border-color: var(--c-cyan-30);
  background: var(--cmp-bg, var(--c-compose));
  color: var(--cmp-ink, var(--c-ink));
}
body[data-chat-shell="parity-v1"] #plus-menu .menu-section {
  padding: 7px 7px 4px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
body[data-chat-shell="parity-v1"] #plus-menu .menu-row {
  grid-template-columns: 16px minmax(0, 1fr) 14px;
  gap: 7px;
  min-height: 30px;
  padding: 5px 7px;
  border-radius: 999px;
  color: inherit;
}
body[data-chat-shell="parity-v1"] #plus-menu .menu-row > .ji {
  width: 15px;
  height: 15px;
  color: var(--cmp-accent, var(--c-cyan));
}
body[data-chat-shell="parity-v1"] #plus-menu .menu-text {
  flex-direction: row;
  align-items: baseline;
  gap: 7px;
  overflow: hidden;
}
body[data-chat-shell="parity-v1"] #plus-menu .menu-title {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
}
body[data-chat-shell="parity-v1"] #plus-menu .menu-hint {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0;
}
body[data-chat-shell="parity-v1"] #plus-menu .menu-row:is(:hover, :focus-visible, [aria-checked="true"]) {
  background: var(--cmp-hover, var(--c-cyan-08));
}
body[data-chat-shell="parity-v1"] #plus-menu .menu-row:focus-visible {
  outline: 2px solid var(--cmp-accent, var(--c-cyan));
  outline-offset: -2px;
}
@media (pointer: coarse) {
  body[data-chat-shell="parity-v1"] #plus-menu .menu-row { min-height: 44px; }
}
@media (max-width: 600px) {
  body[data-chat-shell="parity-v1"] #plus-menu { width: auto; }
  body[data-chat-shell="parity-v1"] #plus-menu .menu-text { flex-wrap: wrap; gap: 2px 7px; }
  body[data-chat-shell="parity-v1"] #plus-menu .menu-hint { white-space: normal; }
}
@media (max-width: 600px) {
  body[data-chat-shell="parity-v1"] #form { padding: 8px 8px 8px; border-radius: 22px; }
  body[data-chat-shell="parity-v1"] #form .row { column-gap: 6px; }
  body[data-chat-shell="parity-v1"] #form .row > #message { min-height: 84px; font-size: 16px; padding: 4px 6px 2px; }
  body[data-chat-shell="parity-v1"] #form #engine-menu .popover { max-height: none; }
  body[data-chat-shell="parity-v1"] #form #plus-menu { max-height: 82dvh; }
}
body[data-chat-shell="parity-v1"] .composer-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  max-width: min(100%, 900px);
  margin: 4px auto 0;
}
body[data-chat-shell="parity-v1"] .composer-options .permission-control {
  width: auto;
  margin: 0;
}
body[data-chat-shell="parity-v1"] .reply-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 4px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--cmp-ink-2);
  font-size: 12px;
}
body[data-chat-shell="parity-v1"] .reply-toggle:hover { background: var(--cmp-hover); color: var(--cmp-ink); }
body[data-chat-shell="parity-v1"] .reply-toggle strong { min-width: 20px; color: var(--c-ink-3); font-size: 10px; letter-spacing: .08em; }
body[data-chat-shell="parity-v1"] .reply-switch {
  position: relative;
  width: 28px;
  height: 16px;
  flex: none;
  border: 1px solid var(--c-cyan-48);
  border-radius: 999px;
  background: var(--c-accent-deep);
}
body[data-chat-shell="parity-v1"] .reply-switch span {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c-ink);
  transition: transform 160ms var(--shell-ease);
}
body[data-chat-shell="parity-v1"] .reply-toggle[aria-checked="false"] .reply-switch { background: transparent; border-color: var(--c-border-strong); }
body[data-chat-shell="parity-v1"] .reply-toggle[aria-checked="false"] .reply-switch span { transform: translateX(-12px); background: var(--c-ink-3); }
body[data-chat-shell="parity-v1"] .reply-toggle[aria-checked="false"] strong { color: var(--cmp-ink-2); }

@media (max-width: 600px) {
  body[data-chat-shell="parity-v1"] .composer-options { gap: 2px; }
  body[data-chat-shell="parity-v1"] .reply-toggle,
  body[data-chat-shell="parity-v1"] .permission-control > button { padding-inline: 5px; }
}

/* In-page questions and confirmations (JudeHere in chat.js). They open under the control that
   asked, in the page's own calm style: no pop-up, no toast, no red. */
.here-ask {
  display: grid;
  gap: 8px;
  max-width: min(100%, 560px);
  margin: 8px 0;
  padding: 12px 14px;
  border: 1px solid var(--c-border-strong);
  border-radius: 12px;
  background: var(--c-surface-strong);
  color: var(--c-ink);
  font-size: 14px;
  line-height: 1.45;
  white-space: normal;
}
.here-ask .here-message { margin: 0; color: var(--c-ink); }
.here-ask .here-label { margin: 2px 0 -4px; color: var(--c-ink-2); font-size: 13px; font-weight: 600; }
.here-ask .here-input {
  width: 100%;
  min-height: 40px;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--c-line-strong);
  border-radius: 10px;
  background: var(--c-field);
  color: var(--c-ink);
  font: inherit;
}
.here-ask .here-input:focus { border-color: var(--c-cyan); outline: 2px solid var(--c-cyan-16); outline-offset: 1px; }
.here-ask .here-note { margin: 0; color: var(--c-ink-2); font-size: 13px; }
.here-ask .here-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.here-ask .here-actions button { min-height: 36px; margin: 0; padding: 6px 14px; border-radius: 10px; font-size: 14px; }
#rail .here-ask { margin: 6px 4px; font-size: 13px; }


.rail-nav { max-height: 52vh; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.rail-nav .so-head { display: flex; align-items: center; justify-content: space-between; width: 100%; margin: 8px 0 2px; padding: 4px 8px; border: 0; background: var(--c-sunk, transparent); color: var(--c-ink-2); font: inherit; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; position: sticky; top: 0; z-index: 1; }
.rail-nav .so-head:hover { color: var(--c-ink); }
.rail-nav .so-head svg { width: 14px; height: 14px; transition: transform .12s; }
.rail-nav .so-head[aria-expanded="false"] svg { transform: rotate(-90deg); }
.rail-nav .so-folded, .rail-nav .so-hidden { display: none !important; }
#so-menu { position: fixed; z-index: 60; width: min(360px, 94vw); max-height: 76vh; overflow-y: auto; padding: 12px; border: 1px solid var(--c-line); border-radius: 12px; background: var(--c-panel); box-shadow: 0 12px 40px rgba(0,8,14,.35); display: grid; gap: 6px; }
#so-menu[hidden] { display: none; }
#so-menu h3 { margin: 8px 0 2px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--c-ink-2); }
#so-menu .so-row { display: flex; align-items: center; gap: 6px; font-size: 13px; }
#so-menu .so-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#so-menu .so-off span { color: var(--c-ink-2); text-decoration: line-through; }
#so-menu p { margin: 0; font-size: 12px; color: var(--c-ink-2); }
#so-menu .so-foot { display: flex; gap: 8px; margin-top: 8px; }
/* Each sidebar area remains reachable inside the viewport. */
body[data-chat-shell="parity-v1"] #rail{min-height:0;max-height:100dvh;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}
body[data-chat-shell="parity-v1"] #rail>*{flex-shrink:0}
body[data-chat-shell="parity-v1"] #rail .rail-nav{max-height:none;overflow:visible}
body[data-chat-shell="parity-v1"] #rail #rail-list{min-height:80px;max-height:none;overflow:visible;flex:1 0 auto}
body[data-chat-shell="parity-v1"] #rail .rail-foot{position:sticky;bottom:-10px;background:var(--c-sunk);z-index:3;margin-top:auto}
