/* AAICH G1 Option B — owner-approved LIGHT + BLUE 2026-10-17.
   Additive, presentation-only. Production icon geometry is unchanged.
   Authentication, inference, persistence, Hub routing and protected state remain in existing JS. */
:root, html[data-theme="light"], html[data-theme="dark"] {
  color-scheme: light;
  --bg: #f6f9fe;
  --panel: #ffffff;
  --panel2: #f3f7ff;
  --line: #e0e9f5;
  --txt: #142747;
  --muted: #5d7193;
  --teal: #2d72e8;
  --teal2: #245fc6;
  --blue: #347fec;
  --amber: #b86d16;
  --red: #b82f53;
  --purple: #7455ca;
  --radius: 18px;
  --shadow: 0 14px 40px rgba(35,81,152,.07);
  --bg-base: #f6f9fe;
  --bg-panel: #ffffff;
  --bg-card: #ffffff;
  --bg-card-2: #f3f7ff;
  --text-primary: #142747;
  --text-strong: #091d3c;
  --text-muted: #607394;
  /* UX-2D: measured WCAG AA contrast corrections for secondary text.
     Darkened toward slate-blue within the Option B palette (all ≥ 4.5:1
     on their surfaces; see Mile 2 report for before/after ratios). */
  --text-faint: #647694;
  --accent: #2d72e8;
  --accent-soft: #e7f0ff;
  --accent-strong: #235dc0;
  --border: #e0e9f5;
  --border-strong: #c4d7ef;
  --bubble-user: #edf4ff;
  --ok: #248860;
  --warn: #af6c19;
  --warn-bg: #fff8e9;
  --warn-border: #ead5aa;
  --err: #b82f53;
  --err-border: #ebbac5;
  --code-bg: #eff4fc;
  --radius-card: 18px;
  --thread-max: 860px;
}
html { background: var(--bg); }
body {
  background: radial-gradient(ellipse at 78% -18%, #e0efff 0%, transparent 42%),
              radial-gradient(ellipse at 15% 105%, #eff6ff 0%, transparent 32%),
              var(--bg);
  color: var(--txt);
}
body:has(.login-shell) {
  min-height: 100dvh;
  background: radial-gradient(ellipse at 8% 12%, #e8f3ff, transparent 42%),
              radial-gradient(ellipse at 100% 100%, #d8eaff, transparent 45%),
              #f8fbff;
}
a { color: #1e63ce; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid #347fec; outline-offset: 3px;
}
::selection { background: #dceaff; }

/* Calm three-zone workspace; activity remains secondary. */
/* R1.2 UX rail proportions: slim the secondary Activity rail to 240px and
   give the nav rail 256px for conversation titles; the chat column keeps
   >=944px at 1440px desktop. */
.workspace { grid-template-columns: 256px minmax(0,1fr) 240px; }
body.activity-hidden .workspace { grid-template-columns: 256px minmax(0,1fr); }
/* rail-collapsed disabled - sidebar stays full width */
/* rail-collapsed disabled */
.thread-col { background: #fff; min-width: 0; }
.topbar {
  height: 68px;
  background: rgba(255,255,255,.93);
  border-bottom: 1px solid #e8edf6;
  padding: 0 clamp(18px, 2.3vw, 38px);
  backdrop-filter: blur(12px);
  /* G1-08-MOUSE-001: backdrop-filter makes .topbar a stacking context, confining the
     global-search dropdown (z-index:130) inside it; .thread-wrap (position:relative,
     later in DOM) then hit-tests above the whole topbar subtree. Raising the topbar
     itself in the root stacking order restores dropdown hit-testing. 100 stays
     below the mobile sidebar drawer (110), activity panel (115) and onboarding (320). */
  position: relative; z-index: 100;
}
.view-title { color: #627594; font-size: 13px; } /* UX-2D: 4.48→4.68:1 */
.view-title b { color: #172b4a; }
.topbar-right { gap: 7px; }
.icon-btn { color: #557195; }
.icon-btn:hover { color: #1e5fce; background: #edf4ff; border-color: #d8e7fa; }
.history-search { background: #f6f9fe; color: #142747; border-color: #e1eaf4; }
.history-search:focus { border-color: #79a6f7; }
.status-pill { background: #f5f9ff; color: #3b5c87; border: 1px solid #e1eafb; font-size: 10px; font-weight: 750; letter-spacing: .07em; }
.sign-out { color: #5a7398; border-color: #dfe8f3; }
.sign-out:hover { background: #f4f8ff; color: #1f56aa; }

/* Existing production geometric square logo, blue-softened only. */
.production-mark {
  object-fit: contain;
  background: transparent !important;
  box-shadow: none !important;
  filter: hue-rotate(40deg) saturate(1.08) brightness(1.04);
}
.sidebar {
  background: linear-gradient(180deg,#fafcff,#f5f9ff);
  border-right: 1px solid #e3ebf6;
  padding: 21px 13px 16px;
  gap: 18px;
}
.rail-brand { gap: 10px; padding: 3px 11px 9px; align-items: center; }
.rail-glyph.production-mark { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 10px; }
.rail-brand-text strong { color: #142747; font-size: 20px; letter-spacing: -.055em; line-height: 1.1; }
.rail-brand-text small { color: #60728f; font-size: 9.3px; font-weight: 650; letter-spacing: .045em; text-transform: none; line-height: 1.35; } /* UX-2D: 3.46→4.75:1 */
.nav-title { color: #627490; font-weight: 750; letter-spacing: .14em; margin-bottom: 8px; } /* UX-2D: 3.61→4.62:1 */
.nav button { color: #4c6080; padding: 10px 11px; border-radius: 10px; font-size: 12.8px; }
.nav button:hover { background: #eaf2ff; color: #1658b5; }
.nav button.active { background: #e4f0ff; color: #1d5fc9; box-shadow: inset 3px 0 #4387ed; }
.nav-tag { border-color: #d9e4f4; background: #f7faff; color: #5b7393; } /* UX-2D: 4.27→4.65:1 */
.new-chat-btn {
  background: linear-gradient(120deg,#4088f8,#2568d4);
  color: white; box-shadow: 0 8px 22px #316cce20;
}
.new-chat-btn:hover { background: linear-gradient(120deg,#4f93ff,#3078e7); }
.rail-title { color: #617490; } /* UX-2D: 3.61→4.63:1 */
.conv-list button { color: #385272; }
.conv-list button:hover { background: #e8f1ff; }
.conv-list li.active button { background: #e3eeff; border-color: #cfe2ff; }
.rail-footer { background: #fff; border: 1px solid #e2eaf6; padding: 13px; }
.rail-footer .small-cap { color: #376cad; }
.rail-footer p { color: #647894; } /* UX-2D: 4.10→4.51:1 */
.version-indicator { background: #f5f9ff; border-color: #e0eafb; color: #5e7492; } /* UX-2D: 4.35→4.53:1 */
.version-indicator:hover { border-color: #9dc0fa; color: #234c8a; }
.version-modal { background: rgba(19,39,78,.30); }
.version-modal-card { background: white; border-color: #d9e4f4; color: #142747; }
.version-modal-body code { color: #245fbd; }

/* Conversation-first canvas with breathable prose and durable composer. */
.thread-wrap { background: #fff; }
.welcome {
  max-width: var(--thread-max);
  border: 1px solid #dceafb;
  background: radial-gradient(ellipse at 85% 20%, #dcecff 0, transparent 44%),
              linear-gradient(118deg,#f5f9ff,#ffffff 74%);
  border-radius: 22px;
  box-shadow: 0 16px 45px #315fb00c;
  padding: clamp(26px,3vw,40px);
}
.welcome::before { background: none; }
.welcome h1 { color: #172b4a; }
.welcome h1 span { color: #2368d2; }
.welcome .subhead,.welcome p.subhead { color: #576f91; font-size: 14px; }
.suggestions button { background: #fff; color: #2b5c9c; border: 1px solid #d7e4f6; }
.suggestions button:hover { background: #eaf3ff; }
.bubble,.message-body { font-size: 14px; line-height: 1.76; max-width: 93%; color: #1a2d4c; }
.message[data-role="assistant"] .message-body,.bubble.ai {
  border-color: #e1e9f4; background: #fff;
  box-shadow: 0 2px 12px rgba(54,85,130,.055);
}
.message[data-role="user"] .message-body,.bubble.user {
  border-color: #dfebfb; background: #edf4ff;
}
.message .who,.bubble .who { color: #2368d2; }
/* R12-UX-012: message actions as subtle inline controls, not boxed icons.
   Buttons stay native <button>s (keyboard-focusable, aria-labelled) bound
   to their message via the turnId closure; only presentation changes. */
.message-actions { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 6px; }
.message-actions button {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  color: #627795; font-size: 12px; font-weight: 600; line-height: 1;
  padding: 7px 9px; cursor: pointer; white-space: nowrap;
}
/* The action SVGs carry only a viewBox and no width/height: without this
   rule they render at the default replaced size (~300x150px). */
.message-actions button svg { width: 15px; height: 15px; flex: 0 0 auto; }
.message-actions button:hover { color: #275eb2; background: #eaf2ff; border-color: #bcd6f8; }
.message-actions button:active { background: #dbe9fd; }
@media (pointer: coarse) {
  .message-actions button { min-height: 44px; min-width: 44px; padding: 10px 12px; }
}
.message-error { color: #9a2449; background: #fff4f6; }
.composer-wrap { background: #fff; padding: 12px clamp(16px,2.3vw,38px) 13px; }
.composer-inner { max-width: var(--thread-max); }
.composer { border: 1px solid #dfe8f5; background: #fff; padding: 5px; border-radius: 15px; box-shadow: 0 7px 25px #315fb00b; align-items: flex-end; }
.composer textarea, #input { border: none; background: transparent; color: #142747; padding: 11px 12px; font-size: 14px; min-height: 42px; line-height: 1.55; }
.composer textarea:focus,#input:focus { border-color: transparent; box-shadow: none; }
.composer:focus-within { border-color: #87b0f7; box-shadow: 0 0 0 3px #e3efff; }
.composer button[type="submit"],#send { background: linear-gradient(120deg,#4088f8,#286cdb); color: #fff; box-shadow: none; }
.composer button[type="submit"]:hover:not(:disabled),#send:hover:not(:disabled) { background: #2568d4; }
.fineprint { color: #657690; } /* UX-2D: 3.05→4.62:1 */
.activity-panel { background: #fbfdff; border-left: 1px solid #e5edf8; }
.activity-head h2 { color: #1d3250; }
.activity-title { color: #607594; font-weight: 800; }
.activity-recent li { border-bottom-color: #e6edf7; }
.activity-recent-text { color: #294464; }
.card { background: #fff; border-color: #e0e9f5; box-shadow: var(--shadow); }
.label { background: #f4f8fe; color: #516b8d; border-color: #d9e4f2; }
.label.teal,.label.blue { background: #e8f1ff; color: #205cb7; border-color: #d1e2fb; }
.btn { background: #f5f9ff; border-color: #dce7f5; color: #28558d; }
.btn:hover { background: #e9f2ff; }
.btn-primary { background: #3178e9; color: white; box-shadow: none; }
.btn-primary:hover { background: #2769cf; }
.message-body pre,.bubble pre { background: #f5f8fd; color: #2e4d77; border-color: #dce6f2; }
.message-body code,.bubble code { background: #e9f0f9; }
.version-modal-body td { border-bottom-color: #e4ebf5; }

/* Frozen owner preference is light-only for G1; no nonfunctional dark toggle. */
#themeToggle { display: none !important; }

/* Login: same light-blue system, existing User ID / password auth only. */
body:has(.login-shell) .login-shell { width: min(410px,100%); }
body:has(.login-shell) .brand-row { gap: 8px; margin-bottom: 25px; }
body:has(.login-shell) .login-glyph.production-mark { width: 58px; height: 58px; border-radius: 13px; }
body:has(.login-shell) .login-wordmark strong { color: #122746; font-size: 28px; letter-spacing: -.04em; }
body:has(.login-shell) .login-wordmark small { color: #6c82a1; font-size: 12px; font-weight: 550; letter-spacing: .06em; text-transform: none; }
body:has(.login-shell) .login-card { background: #fff; border-color: #e1e9f6; border-radius: 20px; padding: 32px 28px; box-shadow: 0 20px 65px #305da015; }
body:has(.login-shell) .login-card h1 { color: #102b50; font-size: 25px; }
body:has(.login-shell) .login-card p.sub { color: #607797; }
body:has(.login-shell) label { color: #334f73; font-weight: 650; }
body:has(.login-shell) input[type=text], body:has(.login-shell) input[type=password] {
 background: #fbfdff; border: 1px solid #d9e5f5; color: #162c4c; padding: 13px 12px;
}
body:has(.login-shell) input[type=text]:focus,body:has(.login-shell) input[type=password]:focus { border-color: #77a8f5; outline-color: #5d94eb; }
body:has(.login-shell) button[type=submit] { background: linear-gradient(110deg,#4289f6,#286cda); color: white; }
body:has(.login-shell) button[type=submit]:hover { background: #3079e7; }
body:has(.login-shell) .fineprint { color: #5f728f; } /* UX-2D: 4.03→4.66:1 */
body:has(.login-shell) .error { color: #b1244e; }

/* Responsive: preserve existing drawer JS and conversation width. */
@media (min-width: 801px) and (max-width: 1140px) {
 .workspace { grid-template-columns: 220px minmax(0,1fr); } /* R1.2: dead 3rd col removed (activity is a drawer below 1280px) */
 body.activity-hidden .workspace { grid-template-columns: 220px minmax(0,1fr); }
 .topbar { padding-inline: 18px; }
 .history-search { width: 140px; }
}
@media (max-width: 800px) {
 .workspace,.workspace:not(.ignore) { display: block; }
 .thread-col { min-height: 0; }
 .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 110; width: min(294px,86vw); height: 100dvh; border-right: 1px solid #dce5f2; border-bottom: 0; padding: 20px 13px; gap: 14px; transform: translateX(-105%); transition: transform .2s ease; overflow-y: auto; }
 .sidebar.open { transform: translateX(0); }
 .sidebar-backdrop.open { display: block; }
 .drawer-close { display: inline-grid; }
 .sidebar .nav { display: grid; overflow: visible; }
 .sidebar .nav button { width: 100%; white-space: normal; }
 .sidebar .nav-tag { display: inline; }
 .sidebar .rail-section { display: flex; flex-direction: column; }
 .sidebar .rail-footer { display: flex; }
 .sidebar .rail-footer { display: block; }
 .topbar { height: 58px; padding: 0 14px; }
 .hamburger { display: inline-grid; }
 .history-search { width: min(32vw,160px); }
 .topbar-right { gap: 3px; }
 .sign-out { display: none; }
 .activity-panel { position: fixed; inset: 0 0 0 auto; z-index: 115; width: min(330px,90vw); box-shadow: -12px 0 38px #183c721c; }
 .activity-panel:not(.open) { display: none; }
 .composer-wrap { position: sticky; bottom: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid #e7edf6; }
 .thread-wrap { padding: 22px 13px 8px; }
 .welcome { padding: 24px 20px; }
 .bubble,.message-body { max-width: 96%; }
}
@media (max-width: 420px) {
 .history-search { display: none; }
 .view-title { max-width: 180px; }
 .status-pill { padding: 7px 9px; }
 .topbar { gap: 6px; }
 .welcome h1 { font-size: 28px; }
}
@media (prefers-reduced-motion:reduce) {
 .sidebar { transition: none; }
}

/* Match Activity.isDocked(): at widths below 1280 the real JS uses drawer mode. */
@media (min-width: 801px) and (max-width: 1279px) {
 .workspace { grid-template-columns: 220px minmax(0,1fr); }
 body.activity-hidden .workspace { grid-template-columns: 220px minmax(0,1fr); }
 /* rail-collapsed disabled - sidebar stays full width */
 /* rail-collapsed disabled */
 .activity-panel { display: none; position: fixed; z-index: 115; right: 0; top: 0; bottom: 0; width: min(332px,80vw); box-shadow: -16px 0 45px #24487b24; }
 .activity-panel.open { display: flex; }
 .sidebar-backdrop.open { display: block; }
}

/* AAICH G1 Mobile Top Bar Correction — compact single-row header (2026-10-17)
   Owner requirement: compact header, no overflow at 375/390/430px */
@media (max-width: 800px) {
  .topbar {
    height: 52px;
    padding: 0 12px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .topbar-left {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
  }
  .view-title {
    font-size: 12px;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
  }
  .topbar-right {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
  }
  /* R1.2 a11y: dot-only pill on small screens, but the text stays in the
   a11y tree (visually hidden, not display:none) so AT still announces it. */
 .status-pill #statusText {
   position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
   overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
 }
  .status-pill {
    padding: 8px;
    min-width: 32px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .mobile-search-checkbox {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
  }
  .mobile-search-btn { display: inline-grid; }
  .topbar-right .search-wrap { display: none; }
  .mobile-search-checkbox:checked ~ .search-wrap {
    display: block;
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    background: #ffffff;
    padding: 10px 12px;
    border-bottom: 1px solid #e8edf6;
    box-shadow: 0 4px 12px rgba(24,60,114,.08);
    z-index: 60;
  }
  .mobile-search-checkbox:checked ~ .search-wrap .history-search {
    display: block; /* G1-08-MOUSE-001: the <=420px rule hides .history-search; the
                     explicitly toggled-open mobile search must show its input */
    width: 100%;
    max-width: none;
  }
  .mobile-search-checkbox:checked ~ .mobile-search-btn {
    color: #1e5fce;
    background: #edf4ff;
  }
  .topbar .icon-btn {
    min-width: 32px;
    min-height: 32px;
  }
}
@media (min-width: 801px) {
  .mobile-search-btn,
  .mobile-search-checkbox { display: none; }
}
@media (max-width: 430px) {
  .topbar { padding: 0 10px; gap: 6px; }
  .view-title { max-width: 120px; font-size: 11px; }
  .topbar-right { gap: 2px; }
}
@media (max-width: 375px) {
  .view-title { max-width: 100px; }
}

/* G1 mobile owner regression: dynamic IdentUI has no legacy size rules.
   Bound the runtime-inserted identity control and BOTH theme asset variants. */
.topbar-right .ident-cluster {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  min-width: 40px;
  max-width: 40px;
  max-height: 40px;
  padding: 4px;
  margin: 0;
  overflow: hidden;
  border: 1px solid #e0e9f5;
  border-radius: 11px;
  background: #f7faff;
  color: #285a9d;
  line-height: 1;
  vertical-align: middle;
  cursor: pointer;
}
.topbar-right .ident-cluster:hover { border-color: #b8d3f5; background: #edf4ff; }
.topbar-right .ident-cluster:focus-visible { outline: 2px solid #347fec; outline-offset: 2px; }
.topbar-right .ident-avatar,
.topbar-right .ident-avatar > .aai-avatar {
  display: block;
  position: relative;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  min-width: 0;
  max-width: 28px;
  max-height: 28px;
  overflow: hidden;
}
.topbar-right .ident-avatar .aai-av {
  display: none;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.topbar-right .ident-avatar .aai-av-light { display: block; }
/* Option B presentation-only: cool the existing teal SVG accents to blue; black geometry remains unchanged. */
.topbar-right .ident-avatar .aai-av-light { filter: hue-rotate(40deg) saturate(1.08) brightness(1.04); }
.topbar-right .ident-cluster .ident-text { display: none; }
/* The top bar already has a dedicated live status indicator. Suppress the duplicate avatar dot only here. */
.topbar-right .ident-avatar .aai-state-badge { display: none !important; }
@media (max-width: 800px) {
  .topbar-right .ident-cluster {
    width: 32px;
    height: 32px;
    min-width: 32px;
    max-width: 32px;
    max-height: 32px;
    padding: 4px;
    border-radius: 9px;
  }
  .topbar-right .ident-avatar,
  .topbar-right .ident-avatar > .aai-avatar {
    width: 23px;
    height: 23px;
    max-width: 23px;
    max-height: 23px;
  }
}

/* G1 Option B — mobile drawer clarity and compact status (owner review). */
@media (max-width: 800px) {
  .sidebar { gap: 9px; padding: 15px 13px 18px; }
  .sidebar .nav { gap: 2px; }
  .sidebar .nav button { padding: 9px 11px; min-height: 40px; }
  .sidebar .rail-head { gap: 8px; }
  .sidebar .new-chat-btn { min-width: 0; min-height: 42px; justify-content: center; font-size: 13px; }
  .sidebar .new-chat-label { display: inline !important; }
  /* The mobile X already closes the drawer; suppress the redundant collapse chevron. */
  .sidebar .rail-toggle { display: none !important; }
  .sidebar .drawer-close {
    display: inline-grid; flex: 0 0 42px; width: 42px; height: 42px;
    border: 1px solid #d9e5f5; border-radius: 11px; background: #f5f9ff;
    align-items: center; justify-items: center;
  }
  .sidebar .rail-footer { padding: 11px; }
}

/* Mobile: drawer dismiss action belongs in the header, never beside New chat. */
@media (max-width: 800px) {
  .sidebar { position: fixed; }
  .sidebar .rail-brand { padding-right: 48px; }
  .sidebar .rail-head { display: flex; }
  .sidebar .new-chat-btn { flex: 1 1 100%; width: 100%; }
  .sidebar .drawer-close {
    position: absolute; top: 17px; right: 13px;
    z-index: 2; margin: 0;
    width: 36px; height: 36px; min-width: 36px; min-height: 36px;
    flex: none;
  }
}

/* G1 conversation journey: avatar sizing is required outside the header, too.
   The runtime creates .assistant-avatar for messages and thinking state. */
.thread-col .message .assistant-avatar,
.thread-col .assistant-avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  min-width: 32px;
  max-width: 32px;
  max-height: 32px;
  overflow: hidden;
  border-radius: 9px;
  background: #f4f8ff;
}
.thread-col .assistant-avatar .aai-avatar {
  display: block;
  position: relative;
  width: 26px;
  height: 26px;
  max-width: 26px;
  max-height: 26px;
  overflow: hidden;
}
.thread-col .assistant-avatar .aai-av {
  display: none;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.thread-col .assistant-avatar .aai-av-light {
  display: block;
  filter: hue-rotate(40deg) saturate(1.08) brightness(1.04);
}
.thread-col .assistant-avatar .aai-state-badge { display: none !important; }

/* ================= UX Mile 2 (2026-10-19) =================
   Additive, presentation-only, Option B palette. */

/* UX-2D: skip links (WCAG 2.4.1) — visually hidden until focused. */
.skip-links { position: absolute; z-index: 400; }
.skip-link {
  position: absolute; left: 12px; top: -48px;
  padding: 10px 16px; border-radius: 10px;
  background: #142747; color: #fff; font-size: 13px; font-weight: 700;
  text-decoration: none; white-space: nowrap;
  transition: top .15s ease;
}
.skip-link:focus-visible, .skip-link:focus {
  top: 12px; outline: 2px solid #347fec; outline-offset: 2px; color: #fff;
}

/* UX-2E: assistant identity as a proper modal overlay (was an unstyled
   page-bottom div). Option B card language, shared backdrop tone. */
.ident-overlay {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center; padding: 20px;
  background: rgba(19,39,78,.30);
}
.ident-overlay[hidden] { display: none; }
.ident-panel {
  width: min(380px, 100%);
  background: #fff; border: 1px solid #d9e4f4; border-radius: 18px;
  box-shadow: 0 14px 40px rgba(35,81,152,.18);
  padding: 20px 22px; color: #142747;
}
.ident-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 15px; font-weight: 750; color: #172b4a; margin-bottom: 14px;
}
.ident-field-label { display: block; font-size: 12px; font-weight: 700; color: #4c6080; margin-bottom: 6px; }
.ident-name-input {
  width: 100%; padding: 10px 12px; font-size: 14px; color: #142747;
  background: #fbfdff; border: 1px solid #d9e5f5; border-radius: 10px;
}
.ident-name-input:focus { border-color: #77a8f5; outline: none; box-shadow: 0 0 0 3px #e3efff; }
.ident-save {
  margin-top: 12px; padding: 10px 18px; border: 0; border-radius: 10px;
  background: linear-gradient(120deg,#4088f8,#2568d4); color: #fff;
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.ident-save:hover { background: #2568d4; }
.ident-note { font-size: 11.5px; color: #647694; margin: 12px 0 0; line-height: 1.55; }

/* UX-2C: per-conversation options menu + rename/delete. */
.conv-item { position: relative; }
.conv-list .conv-open { padding-right: 34px; }
.conv-menu-btn {
  position: absolute; right: 6px; top: 8px;
  width: 26px; height: 26px; border-radius: 8px;
  display: none; place-items: center;
  background: transparent; border: 1px solid transparent;
  color: #627795; cursor: pointer;
}
.conv-menu-btn svg { width: 15px; height: 15px; }
.conv-item:hover .conv-menu-btn, .conv-item:focus-within .conv-menu-btn,
li.active .conv-menu-btn { display: grid; }
/* Touch has no hover: menu buttons are always visible in the drawer. */
@media (max-width: 800px) {
  .conv-menu-btn { display: grid; }
}
.conv-menu-btn:hover { background: #e8f1ff; color: #1d5fc9; border-color: #cfe2ff; }
.conv-menu-btn:focus-visible { display: grid; outline: 2px solid #347fec; outline-offset: 2px; }
.conv-menu {
  position: absolute; right: 4px; z-index: 120; min-width: 150px;
  background: #fff; border: 1px solid #d9e4f4; border-radius: 12px;
  box-shadow: 0 14px 40px rgba(35,81,152,.16); padding: 6px;
}
.conv-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 11px; border: 0; border-radius: 8px; background: transparent;
  color: #385272; font-size: 13px; cursor: pointer; text-align: left;
}
.conv-menu button svg { width: 15px; height: 15px; flex: 0 0 auto; }
.conv-menu button:hover { background: #eaf2ff; color: #1658b5; }
.conv-menu button.danger { color: #b82f53; }
.conv-menu button.danger:hover { background: #fff0f3; color: #9a2449; }
.conv-rename-input {
  width: 100%; padding: 6px 8px; font-size: 13px; font-weight: 600;
  color: #142747; background: #fff;
  border: 1px solid #77a8f5; border-radius: 8px; outline: none;
  box-shadow: 0 0 0 3px #e3efff;
}

/* UX-2C: delete confirmation dialog — explicit, never a silent hide. */
.conv-modal-overlay {
  position: fixed; inset: 0; z-index: 310;
  display: grid; place-items: center; padding: 20px;
  background: rgba(19,39,78,.30);
}
.conv-modal-overlay[hidden] { display: none; }
.conv-modal {
  width: min(430px, 100%);
  background: #fff; border: 1px solid #d9e4f4; border-radius: 18px;
  box-shadow: 0 14px 40px rgba(35,81,152,.18);
  padding: 22px 24px; color: #142747;
}
.conv-modal h2 { margin: 0 0 10px; font-size: 16px; font-weight: 750; color: #172b4a; }
.conv-modal-sub { font-size: 13.5px; color: #385272; line-height: 1.6; margin: 0 0 10px; }
.conv-modal-note {
  font-size: 12px; color: #647694; line-height: 1.6; margin: 0 0 18px;
  background: #f6f9fe; border: 1px solid #e1eaf4; border-radius: 10px; padding: 10px 12px;
}
.conv-modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.conv-modal-actions .btn {
  padding: 10px 18px; border-radius: 10px; border: 1px solid #dce7f5;
  background: #f5f9ff; color: #28558d; font-size: 13px; font-weight: 700; cursor: pointer;
}
.conv-modal-actions .btn:hover { background: #e9f2ff; }
.conv-modal-actions .btn-danger {
  padding: 10px 18px; border-radius: 10px; border: 0;
  background: #b82f53; color: #fff; font-size: 13px; font-weight: 700; cursor: pointer;
}
.conv-modal-actions .btn-danger:hover { background: #9a2449; }
body.modal-open { overflow: hidden; }

/* UX-2D: day dividers (previously unstyled) with AA-passing secondary text. */
.day-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 22px auto; max-width: 860px;
  color: #647694; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.day-divider::before, .day-divider::after {
  content: ""; flex: 1; height: 1px; background: #e0e9f5;
}

/* UX-2E: when the "Latest" pill floats over the thread, reserve bottom
   clearance so it never obscures message text. */
.thread-wrap.latest-pill-visible .thread { padding-bottom: 52px; }
.thread-wrap.latest-pill-visible .welcome { margin-bottom: 52px; }

/* ================= UX R1.2 Phase 2 additions (2026-10-19) =================
   Additive only, presentation-only, Option B palette. The R12-UX-012 base
   above is the reviewed implementation; these rules layer on top. */

/* Consistent minimum touch target for message actions on all pointers
   (coarse pointers get 44px from the base rule above). */
.message-actions button { min-height: 32px; }
/* Explicit visible keyboard focus for message actions. */
.message-actions button:focus-visible { outline: 2px solid #347fec; outline-offset: 2px; }
/* R1.2 copy confirmation: transient inline state, shown only after the
   clipboard write honestly succeeded (see buildAssistantActions). */
.message-actions button.copied { color: #1d7a4f; border-color: #bfe6d2; background: #eefbf3; }

/* R1.2 truthful latency: real elapsed wall-clock appended to the status
   pill while a turn is active. Decorative digits (aria-hidden in the DOM). */
.status-elapsed { color: #7d93b5; font-weight: 600; letter-spacing: .02em; }

/* ================= G1 BUILD-ALL-001 (2026-10-19) =================
   Additive only, Option B palette. New surfaces for R13-UX-003 drawer,
   FB-021 lifecycle, WL-006 global search, WL-007 export, WL-008
   onboarding, WL-002 work panel, WL-004 follow-ups, UX-EDIT-001. */

/* R13-UX-003: while the narrow drawer is open the page behind it must not
   scroll; the drawer itself keeps its own scroll (existing .sidebar rule). */
body.drawer-open { overflow: hidden; }
.sidebar .drawer-close:focus-visible { outline: 2px solid #347fec; outline-offset: 2px; }
@media (max-width: 800px) {
  .sidebar .drawer-close { background: #f5f9ff; color: #385272; }
  .sidebar .drawer-close svg { width: 18px; height: 18px; }
}

/* FB-021: pinned badge + archived section. */
.conv-flag {
  display: inline-block; margin-top: 3px; padding: 2px 8px;
  font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: #1d5fc9; background: #e4f0ff; border: 1px solid #cfe2ff; border-radius: 7px;
}
#pinnedChatList .conv-title, #archivedChatList .conv-title { font-size: 13px; }
#archivedChatList .conv-item { opacity: .78; }
.rail-section[hidden] { display: none; }

/* WL-006: global conversation search — scope toggle + results listbox. */
.search-scope-btn {
  flex: 0 0 auto; margin-right: 6px; padding: 5px 10px;
  font-size: 11.5px; font-weight: 700; color: #28558d;
  background: #eef4fd; border: 1px solid #d3e2f6; border-radius: 999px; cursor: pointer;
  white-space: nowrap;
}
.search-scope-btn:hover { background: #e2edfd; }
.search-scope-btn:focus-visible { outline: 2px solid #347fec; outline-offset: 2px; }
.global-search-results {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 130;
  width: min(380px, 88vw); max-height: 46vh; overflow-y: auto;
  background: #fff; border: 1px solid #d9e4f4; border-radius: 14px;
  box-shadow: 0 18px 44px rgba(35,81,152,.18); padding: 6px;
}
.global-search-results[hidden] { display: none; }
.gsr-row {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px;
  padding: 9px 11px; border-radius: 10px; cursor: pointer;
}
.gsr-row.active { background: #eaf2ff; }
.gsr-title { font-size: 13px; font-weight: 650; color: #172b4a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gsr-kind { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #647694; align-self: center; }
.gsr-snippet { grid-column: 1 / -1; font-size: 12px; color: #5d7193; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gsr-empty { padding: 12px; font-size: 12.5px; color: #647694; text-align: center; }

/* WL-008: first-run onboarding overlay + rail replay entry. No entrance
   animation (motion-safe by construction; the global reduced-motion rule
   also applies). */
.onboard-overlay {
  position: fixed; inset: 0; z-index: 320;
  display: grid; place-items: center; padding: 20px;
  background: rgba(19,39,78,.30);
}
.onboard-overlay[hidden] { display: none; }
.onboard-card {
  width: min(480px, 100%); max-height: 88dvh; overflow-y: auto;
  background: #fff; border: 1px solid #d9e4f4; border-radius: 18px;
  box-shadow: 0 14px 40px rgba(35,81,152,.18);
  padding: 22px 24px; color: #142747;
}
.onboard-head { display: flex; align-items: center; justify-content: space-between; }
.onboard-head h2 { margin: 0; font-size: 17px; font-weight: 750; color: #172b4a; }
.onboard-sub { font-size: 13px; color: #576f91; line-height: 1.6; margin: 10px 0 16px; }
.onboard-step {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0; border-top: 1px solid #e6edf7;
}
.onboard-step-text { flex: 1; min-width: 0; }
.onboard-step-text strong { display: block; font-size: 13.5px; color: #172b4a; margin-bottom: 3px; }
.onboard-step-text p { margin: 0; font-size: 12.5px; color: #5d7193; line-height: 1.55; }
.onboard-try { flex: 0 0 auto; }
.onboard-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.onboard-replay {
  display: block; width: 100%; margin-top: 10px; padding: 8px 10px;
  background: transparent; border: 1px solid var(--line); border-radius: 10px;
  color: #5e7492; font-size: 11.5px; font-weight: 700; cursor: pointer; text-align: left;
}
.onboard-replay:hover { border-color: #9dc0fa; color: #234c8a; }

/* WL-002 / UI-006: Work & artifacts rows inside the Activity panel. */
.work-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid #e6edf7;
}
.work-row:last-child { border-bottom: 0; }
.work-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.work-label {
  font-size: 12.5px; color: #294464; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.work-detail { font-size: 11px; color: #647694; }
.work-open {
  flex: 0 0 auto; padding: 5px 12px; border-radius: 8px;
  background: #f5f9ff; border: 1px solid #dce7f5; color: #28558d;
  font-size: 11.5px; font-weight: 700; cursor: pointer;
}
.work-open:hover { background: #e9f2ff; }
.work-subhead {
  margin: 14px 0 6px; font-size: 11px; font-weight: 800;
  letter-spacing: .03em; text-transform: uppercase; color: #607594;
}
.work-artifacts { list-style: none; margin: 0; padding: 0; }
.work-artifacts li {
  font-size: 12px; color: #385272; padding: 5px 0;
  border-bottom: 1px solid #eef3fa; overflow-wrap: anywhere;
}
.work-artifacts li:last-child { border-bottom: 0; }

/* WL-004: suggested follow-ups — labelled heuristic chips under the
   latest assistant reply. Choosing one fills the composer only. */
.followups {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 10px; max-width: 93%;
}
.followups-label {
  font-size: 10.5px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: #647694; margin-right: 2px;
}
.followup-chip {
  padding: 7px 12px; border-radius: 999px;
  background: #f5f9ff; border: 1px solid #d3e2f6; color: #28558d;
  font-size: 12px; font-weight: 600; cursor: pointer; text-align: left;
}
.followup-chip:hover { background: #e7f0ff; border-color: #bcd6f8; }
.followup-chip:focus-visible { outline: 2px solid #347fec; outline-offset: 2px; }
@media (pointer: coarse) {
  .followup-chip { min-height: 40px; padding: 9px 14px; }
}

/* UX-EDIT-001: superseded-prompt presentation. A superseded prompt stays
   readable history (dimmed, explicitly labelled) — never a second live
   thread; the replacement carries a small Edited marker. */
.msg-tag {
  display: inline-block; align-self: flex-start; margin-bottom: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
}
.msg-tag-edited { color: #1d5fc9; background: #e4f0ff; border: 1px solid #cfe2ff; }
.msg-tag-superseded { color: #8a5a12; background: #fff6e3; border: 1px solid #ead5aa; }
.message.superseded .message-body { opacity: .55; }
.message.user.superseded .message-actions button { opacity: .7; }

/* R13-UAT-P1-001: give the conversation rail its remaining vertical space;
   the list scrolls inside the rail rather than collapsing to a 52px strip. */
.sidebar .rail-section.rail-main { flex: 1 0 240px; min-height: 240px; }
.sidebar .rail-section.rail-main .conv-list { flex: 1 1 auto; min-height: 180px; }
/* Override the generic .conv-list button width/padding for the row options
   control. Its 26px hit target must not cover the conversation-open row. */
.conv-list .conv-menu-btn { width: 26px; height: 26px; padding: 0; }

/* R13-UAT-P1-002: reserve a full-width message entry row; voice preview
   status wraps on a separate row instead of squeezing the textarea. */
.composer { display: grid; grid-template-columns: minmax(0, 1fr) 44px; grid-template-rows: auto auto auto; align-content: start; align-items: center; height: auto; max-height: 190px; }
.composer #input { grid-column: 1; grid-row: 1; width: 100%; min-width: 0; box-sizing: border-box; }
.composer #send { grid-column: 2; grid-row: 1; }
.composer #voicePtt { grid-column: 1 / -1; grid-row: 2; justify-self: start; max-width: 100%; }
.composer #voicePttStatus { grid-column: 1 / -1; grid-row: 3; min-width: 0; white-space: normal; overflow-wrap: anywhere; }

/* R13-UAT-P1-002 follow-up: app.js inserts #micBtn into the form.
   Reserve its own bounded column so the icon cannot grow into the composer. */
.composer { grid-template-columns: minmax(0, 1fr) 40px 44px; }
.composer #micBtn { grid-column: 2; grid-row: 1; width: 40px; height: 40px; min-width: 40px; min-height: 40px; padding: 8px; box-sizing: border-box; display: grid; place-items: center; }
.composer #micBtn svg { width: 20px; height: 20px; max-width: 20px; max-height: 20px; flex: none; }
.composer #send { grid-column: 3; grid-row: 1; }

/* B41-UX polish: preserve identity settings while replacing legacy header artwork. */
.topbar-right #identCluster .ident-avatar { background: #eaf2ff !important; color: #28558d; position: relative; }
.topbar-right #identCluster .ident-avatar::after { content: 'AI'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 10px; font-weight: 800; letter-spacing: .02em; }
.topbar-right #identCluster .ident-avatar > * { visibility: hidden !important; }
/* Offline voice preview is a future-only control, not a composer-wide warning. */
#voicePtt:disabled, #voicePttStatus { display: none !important; }
/* Fill available viewport; keep composer at the lower edge for short chats. */
#app, .workspace { min-height: 100dvh; }
.workspace { height: 100dvh; }
.thread-col { min-height: 0; }

/* B41 consolidated UX: show only available Chat and one desktop brand. */
.rail-brand-text { display:none !important; }
.sidebar .nav-title { display:none !important; }
.sidebar #protoNav button:not([data-view="converse"]) { display:none !important; }
@media (min-width:801px) { .uxrc-header-brand { display:none !important; } }
.topbar #viewTitle,.topbar #viewTitle b { color:#183763; font-size:13px; font-weight:650; }
.thread-col .assistant-avatar .aai-av-light { filter:none !important; }
.thread-col .assistant-avatar { background:transparent !important; }

/* B4.2: premium brand scale; keep single B4.1 asset, no duplicate text. */
.rail-brand { min-height:58px; align-items:center; }
.rail-brand .rail-glyph { width:148px !important; max-width:100%; height:56px !important; object-fit:contain !important; background:none !important; box-shadow:none !important; border-radius:0 !important; }
@media (max-width:800px) { .sidebar .rail-brand .rail-glyph { width:148px !important; height:56px !important; } }
/* Restore frozen text hierarchy instead of compressed legacy styling. */
.message-body { color:#172B4D; font-size:16px; line-height:1.55; }
.thread-col .assistant-avatar .aai-av-light { filter:none !important; }

@media (max-width:800px) { .workspace > .thread-col { height:100dvh !important; min-height:100dvh !important; } }

/* B4.2 brand fidelity: never hue-shift frozen B4.1 bitmap. */
.production-mark, .rail-glyph.production-mark, .login-glyph.production-mark { filter:none !important; }
.thread-col .assistant-avatar .aai-av, .topbar-right .ident-avatar .aai-av { filter:none !important; }

/* B4.2 frozen Option C composition: compact 64px rail + 300px list + chat. */
@media (min-width:1024px) {
.workspace, body.activity-hidden .workspace { grid-template-columns:364px minmax(0,1fr); }
body:not(.activity-hidden) .workspace { grid-template-columns:364px minmax(0,1fr) 320px; }
.sidebar { display:grid; grid-template-columns:64px minmax(0,300px); grid-template-rows:80px 52px minmax(180px,1fr) minmax(60px,auto) auto; gap:0; padding:0; border-right:1px solid #C9D9F0; background:#fff; height:100dvh; }
.sidebar > div:nth-child(2) { grid-column:1;grid-row:1 / 6; background:#10213D; padding:72px 7px 12px; min-height:0; }
.sidebar #protoNav { display:flex;flex-direction:column; align-items:stretch; }
.sidebar #protoNav button[data-view='converse'] { justify-content:center; padding:0; width:50px; height:52px; font-size:0; color:#d6e7ff; background:transparent; border-radius:13px; box-shadow:none; }
.sidebar #protoNav button[data-view='converse'] svg { width:22px;height:22px; }
.sidebar #protoNav button[data-view='converse'].active { background:#1B5BD7; color:#fff; }
.sidebar .rail-brand { grid-column:2;grid-row:1; margin:0; padding:8px 16px; }
.sidebar .rail-head { grid-column:2;grid-row:2; padding:3px 13px; }
.sidebar .rail-section.rail-main { grid-column:2;grid-row:3; min-height:0; flex:none; overflow:hidden; }
.sidebar .rail-section.rail-side { grid-column:2;grid-row:4; min-height:50px; }
.sidebar .rail-footer { grid-column:2;grid-row:5; margin:5px 12px 12px; }
.sidebar .rail-brand .rail-glyph { width:172px !important; height:64px !important; }
.sidebar .conv-list { min-height:0 !important; }
.sidebar .rail-toggle { display:none !important; }
}

/* B42-D01 D02: renderer classes and Markdown tables */
.message.user {display:flex;flex-direction:column;align-items:flex-end}
.message.assistant {display:flex;flex-direction:column;align-items:flex-start}
.message.user .message-body {max-width:85%;background:#DCE9FC;border:1px solid #C9D9F0;border-radius:18px;padding:12px 14px;color:#172B4D}
.message.assistant .message-body {max-width:92%;width:100%;background:#fff;border:1px solid #C9D9F0;border-radius:18px;padding:14px;color:#172B4D}
.message-body .md-table-wrap {max-width:100%;overflow-x:auto;overflow-y:hidden}
.message-body .md-table-wrap table {border-collapse:collapse;min-width:max-content;font-size:14px;line-height:1.5}
.message-body .md-table-wrap th,.message-body .md-table-wrap td {border:1px solid #C9D9F0;padding:8px;text-align:left}
.message-body .md-table-wrap th {background:#E3EDFA;color:#10213D;font-weight:600}
@media(max-width:767px){.message.user .message-body{max-width:92%}.message.assistant .message-body{max-width:100%}}


/* B42 component system: frozen Pulse Light semantics. */
:root { --accent:#1B5BD7; --accent-strong:#154AB4; --border:#C9D9F0; --bubble-user:#DCE9FC; --ink:#172B4D; }
.workspace { background:#EEF4FC; }
.thread-wrap,.thread-col { background:#EEF4FC; }
.message,.message-body {font-size:16px;line-height:1.55}
.thread,.thread-inner,.composer-inner {max-width:820px}
.message-actions {display:flex;flex-wrap:wrap;gap:6px}
.message-actions button {min-height:40px;border-radius:999px;background:#E3EDFA;border:1px solid #C9D9F0;color:#1B5BD7;font-size:13px;font-weight:500;padding:8px 13px}
.message-actions button:focus-visible,.workspace-menu button:focus-visible,.topbar button:focus-visible {outline:2px solid #1B5BD7;outline-offset:2px}
.composer textarea,.composer #input {font-size:16px!important;line-height:24px!important;max-height:160px;min-height:48px}
.composer {max-height:none!important;border-color:#C9D9F0;border-radius:16px}
#micBtn,#voiceBtn {width:44px;min-width:44px;height:44px;border-radius:12px;background:#E3EDFA;color:#1B5BD7;border:1px solid #C9D9F0}
#send {min-width:44px;min-height:44px;border-radius:12px}
.workspace-menu[hidden]{display:none!important}
.topbar-right{position:relative}
.workspace-menu{position:absolute;z-index:500;right:8px;top:calc(100% + 8px);width:208px;display:flex;flex-direction:column;padding:7px;background:#fff;border:1px solid #C9D9F0;border-radius:14px;box-shadow:0 12px 32px #152d5050}
.workspace-menu button{border:0;background:transparent;color:#172B4D;text-align:left;padding:12px;border-radius:9px;min-height:44px;font-size:14px}
.workspace-menu button:hover{background:#E3EDFA}
.uxrc-header-brand{object-fit:contain}
@media(pointer:coarse){.message-actions button{min-height:44px;min-width:44px}}
@media(max-width:767px){
 .uxrc-header-brand{width:84px!important;height:auto!important;max-height:44px;flex:0 0 84px;object-fit:contain!important}
 .topbar-right #statusPill,.topbar-right #activityToggle,.topbar-right #identCluster,.topbar-right .sign-out{display:none!important}
 #accountBtn,#menuBtn,.mobile-search-btn{min-width:44px!important;min-height:44px!important}
 .topbar-left #viewTitle {min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 .composer textarea,.composer #input{max-height:124px}
}
@media(max-width:340px){.topbar-left #viewTitle{display:none!important}}


/* B42-D10: frozen tablet 64px rail + 250px list at 768-1023. */
@media (min-width:768px) and (max-width:1023px){
 .workspace,body.activity-hidden .workspace{display:grid!important;grid-template-columns:314px minmax(0,1fr)!important}
 body:not(.activity-hidden) .workspace{grid-template-columns:314px minmax(0,1fr)!important}
 .sidebar{display:grid!important;position:relative!important;transform:none!important;grid-template-columns:64px minmax(0,250px);grid-template-rows:80px 52px minmax(160px,1fr) minmax(50px,auto) auto;height:100dvh;width:314px!important;padding:0;gap:0;border-right:1px solid #C9D9F0;background:#fff}
 .sidebar>div:nth-child(2){grid-column:1;grid-row:1 / 6;background:#10213D;padding:72px 7px 12px;min-height:0}
 .sidebar #protoNav{display:flex;flex-direction:column}
 .sidebar #protoNav button[data-view="converse"]{justify-content:center;width:50px;height:52px;padding:0;font-size:0;color:#d6e7ff;background:transparent;border-radius:13px}
 .sidebar #protoNav button[data-view="converse"].active{background:#1B5BD7;color:#fff}
 .sidebar .rail-brand{grid-column:2;grid-row:1;margin:0;padding:8px 12px}
 .sidebar .rail-head{grid-column:2;grid-row:2;padding:3px 12px}
 .sidebar .rail-section.rail-main{grid-column:2;grid-row:3;min-height:0;overflow:hidden}
 .sidebar .rail-section.rail-side{grid-column:2;grid-row:4;min-height:0}
 .sidebar .rail-footer{grid-column:2;grid-row:5;margin:5px 10px 10px}
 .sidebar .rail-brand .rail-glyph{width:148px!important;height:62px!important}
 #menuBtn{display:none!important}
 .activity-panel{position:fixed!important;right:0;top:0;bottom:0;z-index:300;width:min(320px,90vw)}
}

@media(min-width:768px) and (max-width:900px){.topbar-right #statusPill,.topbar-right #activityToggle,.topbar-right #identCluster,.topbar-right .sign-out{display:none!important}.topbar-right .search-wrap{max-width:150px!important;min-width:0!important}.topbar-right{min-width:0!important}}

@media(min-width:768px) and (max-width:900px){.topbar-right .search-wrap input.history-search{min-width:0!important;width:100%!important;max-width:100%!important}}

/* B42 owner feedback: composer bottom spacing and visual hierarchy. */
.composer-wrap { padding-bottom: max(10px, env(safe-area-inset-bottom)) !important; }
.composer-inner > .fineprint { display: none !important; }
@media (max-width:767px) { .composer-wrap { padding-top:8px !important; padding-bottom:max(8px,env(safe-area-inset-bottom)) !important; } }

/* B42 owner visual feedback: refined rail logo, search, identity and bubble geometry. */
@media(min-width:1024px){.sidebar .rail-brand .rail-glyph{width:128px!important;height:50px!important}.sidebar .rail-brand{padding:5px 16px!important}}
@media(min-width:768px) and (max-width:1023px){.sidebar .rail-brand .rail-glyph{width:124px!important;height:50px!important}}
.topbar-right .search-wrap{display:flex;align-items:center;gap:5px;min-width:0}
.topbar-right .search-wrap .search-icon{display:none!important}
.topbar-right .search-scope-btn{flex:0 0 auto;margin:0!important;padding:7px 9px;white-space:nowrap}
.topbar-right .search-wrap .history-search{min-width:0!important;flex:1;width:100%;padding-left:8px!important}
.topbar-right #identCluster{width:auto!important;max-width:160px!important;min-width:44px!important;height:44px!important;max-height:none!important;gap:6px;padding:5px 8px!important}
.topbar-right #identCluster .ident-text{display:flex!important;min-width:0;flex-direction:column;text-align:left}
.topbar-right #identCluster .ident-name{max-width:90px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;font-weight:650}
.topbar-right #identCluster .ident-state{display:none}
.topbar-right #identCluster .ident-avatar::after{content:none!important}
.message.user .message-body{background:#DCE9FC!important;border:1px solid #C9D9F0;border-radius:20px 20px 7px 20px!important;width:fit-content!important;max-width:85%!important;overflow-wrap:anywhere;box-shadow:0 2px 9px rgba(24,65,130,.045)}
.message.assistant .message-body{background:#fff!important;border:1px solid #C9D9F0;border-radius:20px 20px 20px 7px!important;width:fit-content!important;max-width:92%!important;overflow-wrap:anywhere;box-shadow:0 3px 18px rgba(21,65,120,.045)}
.message.assistant .message-body:has(.md-table-wrap),.message.assistant .message-body:has(pre){width:100%!important}
.message.user .message-actions{justify-content:flex-end}
@media(min-width:768px) and (max-width:1100px){.topbar-right .search-wrap{max-width:160px!important}.topbar-right #identCluster{max-width:110px!important}.topbar-right #identCluster .ident-name{max-width:62px}}
@media(max-width:767px){.topbar-right #identCluster{display:none!important}.topbar-right .search-wrap{display:none}.mobile-search-checkbox:checked~.search-wrap{display:flex!important;max-width:100%!important}.message.user .message-body{max-width:92%!important}.message.assistant .message-body{max-width:100%!important}}

/* At constrained desktop widths preserve full search input without changing search semantics. */
@media(min-width:1024px) and (max-width:1279px){.topbar-right #statusPill,.topbar-right #activityToggle,.topbar-right .sign-out{display:none!important}.topbar-right .search-wrap{min-width:175px;flex:1 1 175px;max-width:255px}.topbar-right .history-search{min-width:88px!important}.topbar-right #identCluster{max-width:130px!important}.topbar-right #identCluster .ident-name{max-width:70px}}

/* B42 composer geometry: prevent empty implicit grid tracks beneath the input. */
#composer.composer{grid-template-rows:minmax(48px,auto)!important;align-content:center!important;align-items:center!important;min-height:60px!important}
#composer #input{grid-row:1!important;align-self:center!important}
#composer #send{grid-row:1!important;align-self:center!important}
#composer #voicePtt[disabled]{display:none!important}
#composer #voicePttStatus:empty{display:none!important}

/* B42 FINAL DESKTOP POLISH — no mobile/tablet layout changes. */
@media(min-width:1024px){
  #protoNav button[data-view="converse"],.nav button.active{border-radius:11px!important}
  #railToggle,.rail-toggle,.rail-active{border-radius:11px!important}
  .thinking-row{display:flex!important;align-items:center!important;gap:12px!important;flex-wrap:wrap;padding:7px 0!important;min-height:40px!important}
  .thinking-label{line-height:1.4;color:#4a6484;font-size:13px}
  .thinking-stop,.message-error button.retry{
    display:inline-flex!important;align-items:center;justify-content:center;
    border:1px solid #C9D9F0!important;border-radius:12px!important;
    background:#f5f9ff!important;color:#1B5BD7!important;
    font:600 12px/1.2 system-ui,sans-serif!important;min-height:32px!important;
    padding:7px 13px!important;box-shadow:none!important;cursor:pointer;
    transition:background .15s ease,border-color .15s ease!important;
  }
  .thinking-stop:hover,.message-error button.retry:hover{background:#e3edfa!important;border-color:#aac7ed!important}
  .thinking-stop:focus-visible,.message-error button.retry:focus-visible{outline:2px solid #1B5BD7!important;outline-offset:2px}
  .message.assistant .message-inner{min-width:0}
  .message.assistant .message-error{display:flex!important;align-items:flex-start;flex-direction:column;gap:9px!important;padding:13px 15px!important;border-radius:14px!important;max-width:min(560px,100%)!important}
  .message.assistant .assistant-avatar{margin-top:2px}
  .message.assistant:has(.thinking-row),.message.assistant:has(.message-error){margin-block:10px!important}
  #composer.composer{margin-block:0!important}
}

@media(min-width:1024px){.sidebar #protoNav button[data-view="converse"]{width:42px!important;height:42px!important;min-height:42px!important;margin:5px auto!important;border-radius:11px!important;background:transparent}.sidebar #protoNav button[data-view="converse"].active{background:#2563cf!important;box-shadow:none!important}.sidebar #protoNav button[data-view="converse"] svg{width:20px!important;height:20px!important}}


/* B4.2 final desktop remediation: remove redundant dark icon rail only on desktop. */
@media(min-width:1024px){
.workspace,body.activity-hidden .workspace{grid-template-columns:300px minmax(0,1fr)!important}
body:not(.activity-hidden) .workspace{grid-template-columns:300px minmax(0,1fr) 320px!important}
.sidebar{grid-template-columns:minmax(0,300px)!important}
.sidebar>div:nth-child(2){display:none!important}
.sidebar>.rail-brand,.sidebar>.rail-head,.sidebar>.rail-section,.sidebar>.rail-footer{grid-column:1!important}
.topbar-right{min-width:0!important;flex-wrap:nowrap!important;gap:6px!important}
.topbar-right .sign-out{white-space:nowrap!important;flex-shrink:0}
.topbar-right .search-wrap{min-width:0!important;flex:0 1 210px!important}
.topbar .topbar-left{min-width:0!important;overflow:hidden}
.topbar #viewTitle{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
}
/* Modal must escape the sidebar stacking context: the dialog is reparented to body in app.js. */
body>#versionModal{position:fixed!important;inset:0!important;z-index:2147483000!important;display:flex;align-items:center;justify-content:center;background:rgba(19,39,78,.42)!important;pointer-events:auto!important}
body>#versionModal.hidden{display:none!important}
body>#versionModal .version-modal-card{position:relative!important;z-index:1!important;max-height:85vh;overflow:auto}
body:has(>#versionModal:not(.hidden)) #app{pointer-events:none!important}
body>#versionModal button:focus-visible{outline:2px solid #2563cf;outline-offset:2px}

/* B4.2 copy-only feedback composer: real local draft, never fake submission. */
.b42-feedback-dialog{position:fixed;inset:0;z-index:2147483001;background:rgba(17,34,63,.44);display:flex;align-items:center;justify-content:center;padding:20px}
.b42-feedback-dialog.hidden{display:none}
.b42-feedback-card{width:min(470px,100%);background:#fff;border:1px solid #c9d9f0;border-radius:18px;padding:22px;color:#17335b;box-shadow:0 16px 56px #13294a33}
.b42-feedback-head{display:flex;align-items:center;justify-content:space-between;gap:16px}
.b42-feedback-head strong{font-size:17px}
.b42-feedback-head button{border:1px solid #c9d9f0;background:#f5f9ff;border-radius:9px;width:34px;height:34px}
.b42-feedback-card p{color:#566c88;font-size:13px;line-height:1.5}
.b42-feedback-card textarea{display:block;width:100%;box-sizing:border-box;min-height:115px;border:1px solid #c9d9f0;border-radius:12px;padding:12px;background:#f8fbff;color:#172b4a;resize:vertical}
.b42-feedback-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-top:13px}
#feedbackCopy{border:1px solid #2563cf;border-radius:11px;padding:9px 14px;background:#2563cf;color:#fff;font-weight:600}
#feedbackStatus{font-size:12px;color:#3e638f}
.b42-feedback-dialog :focus-visible{outline:2px solid #2563cf;outline-offset:2px}
body:has(.b42-feedback-dialog:not(.hidden)) #app{pointer-events:none}
