/* The reading pane uses the same width rules in split and full-screen views. */
@media (min-width:1100px) {
  .pilot-shell .chats-page #inbox {grid-template-columns:var(--inbox-dialogs) 6px minmax(0,1fr) 6px var(--inbox-product)}
  .pilot-shell #conversation-list {grid-column:1}
  .pilot-shell .divider-dialogs {grid-column:2}
  .pilot-shell .chat-pane {grid-column:3}
  .pilot-shell .divider-product {grid-column:4}
  .pilot-shell #context-pane {grid-column:5}
}
.pilot-shell #detail {
  --thread-ink: var(--ink);
  --thread-muted: #58677a;
  --thread-blue: var(--action);
  --thread-pad: clamp(14px, 3%, 38px);
  container: thread / inline-size;
  color: var(--thread-ink);
  background: #fff;
}
.pilot-shell .chat-header {
  min-height: 46px;
  padding: 4px var(--thread-pad);
  gap: 14px;
  background: #fff;
  border: 0;
  border-bottom: 1px solid #e9edf1;
}
.pilot-shell .chat-person {gap: 9px; flex: 1}
.pilot-shell .chat-person .customer-avatar {width: 34px; height: 34px; font-size: 12px}
.pilot-shell .chat-person h2 {color: var(--thread-ink); font-size: 16px; font-weight: 670; letter-spacing: -.035em; line-height: 1.2}
.pilot-shell .chat-person p {margin-top: 2px; color: var(--thread-muted); font-size: 12px; line-height: 1.25}
.pilot-shell .chat-actions {gap: 3px}
.pilot-shell :is(.chat-notes, .pilot-mode) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 8px;
  background: transparent;
  color: #526173;
  font-size: 12px;
  font-weight: 550;
  border-radius: 6px;
}
.pilot-shell .pilot-mode[data-state=on] {background: #edf0ff; color: #374ca8}
.pilot-shell .pilot-mode[data-state=paused] {background: #f2f3f5; color: #454e5e}
.pilot-shell .pilot-mode svg {display: block; width: 15px; height: 15px}
.pilot-shell .pilot-mode::after {content: ''; width: 4px; height: 4px; margin: -2px 1px 0; border: solid currentColor; border-width: 0 1px 1px 0; transform: rotate(45deg)}
.pilot-shell :is(.chat-notes, .pilot-mode):hover,
.pilot-shell .chat-actions .icon-button:hover {background: #eef1f7; color: #24354c; text-decoration: none}
.pilot-shell .chat-actions .icon-button {width: 32px; height: 32px; color: #647286}
.pilot-shell .notes-count {color: var(--thread-blue)}
.pilot-shell .unread-dot {display:inline-block;flex:0 0 8px;width:8px;height:8px;border-radius:50%;background:#3565d4;font-size:0;align-self:center}
.pilot-shell .active .unread-dot {background:#2857c6}
.pilot-shell .thread-find {display:flex;align-items:center;flex-wrap:wrap;gap:4px;padding:5px var(--thread-pad);background:white;border-bottom:1px solid var(--line)}
.thread-find input {flex:1 1 100px;width:0;min-width:80px;padding:5px 7px}
.thread-find .icon-button {width:27px;height:27px}
.thread-find .find-prev svg {transform:rotate(90deg)}
.thread-find .find-next svg {transform:rotate(-90deg)}
.thread-find :is(.find-count,.find-note,.find-older) {font-size:12px;color:var(--quiet)}
.thread-find .find-note:empty {display:none}
.pilot-shell #messages mark {background:#fff0ac;color:inherit;border-radius:2px}
.pilot-shell #messages .find-current mark {background:#ffc960;color:#30270c}

.pilot-shell .messages {
  display: flex;
  flex-direction: column;
  padding: 7px max(var(--thread-pad), calc((100% - 1040px) / 2)) 15px;
  background-color: #fafbfd;
  background-image: radial-gradient(circle, #dfe5ed .75px, transparent .95px);
  background-size: 18px 18px;
  color: var(--thread-ink);
  scrollbar-gutter: stable;
}
/* Short threads end next to the reply field. Long histories keep their natural scroll range. */
.pilot-shell .messages::before {content: ''; margin-top: auto}
.pilot-shell .messages > * {flex-shrink: 0}
.pilot-shell .date-divider {
  width: fit-content;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px auto;
  color: #5d687a;
  font-size: 11px;
  font-weight: 550;
  line-height: 1.2;
}
.pilot-shell .date-divider::before,
.pilot-shell .date-divider::after {content: ''; width: 20px; height: 1px; background: #dce1e8}
.pilot-shell .message-row {gap: 4px; margin: 0}
.pilot-shell .message-row + .message-row {margin-top: 3px}
.pilot-shell .message-row:not(.outgoing) + .outgoing,
.pilot-shell .message-row.outgoing + .message-row:not(.outgoing) {margin-top: 8px}
.pilot-shell .message-row .message-bubble {
  max-width: min(83%, 62ch);
  min-width: 0;
  padding: 7px 12px;
  border: 0;
  border-radius: 12px 12px 12px 4px;
  box-shadow: none;
  font-size: 14px;
  line-height: 1.45;
  color: var(--thread-ink);
}
.pilot-shell .message-row:not(.outgoing) .message-bubble {background: #f0f2f5}
.pilot-shell .message-row.outgoing .message-bubble {background: #e7edff; color: #20345a; border-radius: 12px 12px 4px 12px}
.pilot-shell .message-bubble .message-time {
  color: #5a6a7c;
  margin-left: 8px;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.pilot-shell .message-bubble a {color: #314da9; text-underline-offset: 2px}
.pilot-shell .message-comment {border-radius: 6px; min-height: 30px; color: #64748a}
.pilot-shell .message-comment:hover {background: #eef1f6; color: var(--thread-blue)}
.pilot-shell .message-system {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 2px 6px;
  max-width: min(94%, 67ch);
  margin: 4px auto;
  padding: 5px 10px;
  border-radius: 6px;
  text-align: left;
  line-height: 1.45;
  font-size: 12px;
  color: #615184;
  background: #f3eff8;
  overflow-wrap: anywhere;
}
.message-system svg {align-self: center; grid-column: 1}
.message-system span {white-space: pre-line; grid-column: 2}
.message-system time {grid-column: 3; color: #736886}
.message-system .event-source {grid-column: 2; grid-row: 1; font-size: 10px}
.message-system:has(.event-source) svg {grid-row: 1}
.message-system:has(.event-source) time {grid-row: 1}
.message-system:has(.event-source) span {grid-row: 2; grid-column: 2 / -1}
.pilot-shell .thread-load-note,
.pilot-shell .pilot-empty {color: #626f7f}
.pilot-shell .thread-load-note {margin: 6px auto}

.pilot-shell .pilot-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  padding: 10px var(--thread-pad) 8px;
  color: var(--thread-ink);
  border: 0;
  border-top: 1px solid #e9edf1;
}
.pilot-editor > :is(.editor-warning, .editor-suggestion, .editor-attachment, .editor-writing, .editor-status) {grid-column: 1 / -1}
.pilot-editor .editor-writing {
  grid-row: 4;
  display: flex;
  align-items: end;
  gap: 6px;
  min-height: 40px;
  padding: 4px 5px 4px 10px;
  border-radius: 10px;
  background: #f1f3f7;
}
.pilot-editor .editor-writing:focus-within {background: #eef2fa}
.pilot-editor .editor-input {
  min-width: 0;
  min-height: 32px;
  padding: 6px 2px;
  background: transparent;
  color: var(--thread-ink);
  font-size: 14px;
  line-height: 20px;
  border: 0;
  outline: 0;
}
.pilot-editor .editor-input:focus-visible {outline: 2px solid #7185db; outline-offset: 0; border-radius: 4px}
.pilot-editor .editor-input::placeholder {color: #5d6a7c; opacity: 1}
.pilot-editor .send-button {
  flex: none;
  min-height: 32px;
  background: var(--thread-blue);
  color: white;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
}
.pilot-editor .send-button:not(:disabled):hover {background: #3049b5}
.pilot-editor .send-button:disabled {background: #e1e6ee; color: #68788c; opacity: 1}
.pilot-editor .editor-warning {grid-row: 1; margin: 0 0 5px}
.pilot-editor .editor-suggestion {grid-row: 2; flex-wrap: wrap; gap: 5px 8px; margin: 0 0 5px; padding: 4px 0; color: #2d405d}
.pilot-editor .draft-copy {flex: 1 1 168px; min-width: 0; display: grid; gap: 2px}
.pilot-editor .editor-suggestion .draft {max-height: 7em; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.4; color: #38495f}
.pilot-editor .draft-label {color: #454f91; font-size: 12px; font-weight: 650}
.pilot-editor .editor-suggestion[data-tone=notice] {background: #faf4e7; border-radius: 6px; padding: 8px 10px}
.pilot-editor .editor-suggestion[data-tone=notice] .draft-label {color: #78501d}
.pilot-editor .editor-suggestion .button {min-height: 28px; padding: 3px 7px; border: 0; border-radius: 5px; color: #384da3; background: #eef1ff; font-size: 12px}
.pilot-editor .editor-suggestion .button:hover {background: #e0e6fd}
.pilot-editor .editor-attachment {grid-row: 3; margin: 0 0 5px; background: #eef1f5}
.pilot-editor .editor-toolbar {grid-area: 5 / 1 / 6 / -1; flex-wrap: wrap; margin: 2px 0 0}
.pilot-editor .editor-generate {margin-left: auto; padding: 4px 7px; min-height: 30px; border: 0; font-size: 12px; color: #384da3; background: #eef1ff}
.pilot-editor .editor-generate:not(:disabled):hover {background: #e0e6fd}
.pilot-editor .editor-generate[aria-busy=true] {opacity: 1; cursor: progress}
.pilot-editor .editor-generate[aria-busy=true] svg {display: none}
.pilot-editor .editor-generate[aria-busy=true]::before {
  content: ''; width: 13px; height: 13px; box-sizing: border-box; border-radius: 50%;
  border: 2px solid #b3bee8; border-top-color: currentColor;
}
@media (prefers-reduced-motion: no-preference) {
  .pilot-editor .editor-generate[aria-busy=true]::before {animation: draft-spin .8s linear infinite}
  @keyframes draft-spin {to {transform: rotate(1turn)}}
}
.pilot-editor .editor-tools {gap: 2px}
.pilot-editor .editor-tools :is(.icon-button, .editor-listing) {background: transparent; color: #53647b; border-radius: 6px}
.pilot-editor .editor-tools :is(.icon-button, .editor-listing):hover {background: #edf0f6; color: #354d86}
.pilot-editor .editor-listing {font-size: 12px; font-weight: 550}
.pilot-editor .editor-status {grid-row: 6}
.pilot-editor .emoji-palette {left: var(--thread-pad); bottom: 41px}
.pilot-editor .editor-warning {color: #774619; flex-wrap: wrap}

.pilot-shell .context-pane {padding: 16px; background: #f7f8fa; color: #263449}
.pilot-shell .context-caption {margin: 0 0 12px; color: #566477; font-size: 12px; font-weight: 600; letter-spacing: 0}
.pilot-shell .listing-overview .context-product-image {
  width: 100%;
  height: auto;
  max-height: 162px;
  aspect-ratio: 1.45;
  object-fit: contain;
  border-radius: 9px;
  margin: 0 0 10px;
  background: #eaecf0;
}
.pilot-shell .listing-identity h3 {margin: 0; font-size: 17px; letter-spacing: -.035em; line-height: 1.25; color: #202b3c}
.pilot-shell .listing-identity .context-price {margin: 3px 0 1px; color: #2b3851; font-size: 18px; font-weight: 600; letter-spacing: -.04em; font-variant-numeric: tabular-nums}
.pilot-shell .context-link {margin: 5px 0 0; color: #3d55b8; font-size: 12px; font-weight: 550}
.pilot-shell .context-link:hover {text-decoration: underline; text-underline-offset: 2px}
.pilot-shell .context-section {padding: 11px 0 0; margin-top: 13px; border: 0; border-top: 1px solid #e1e5ea}
.pilot-shell .context-section h4 {margin: 0 0 4px; color: #3d4b5d; font-size: 12px; font-weight: 650}
.pilot-shell .context-section > strong {font-size: 13px; font-weight: 600}
.pilot-shell .context-footnote {color: #596777; font-size: 12px; line-height: 1.45}
.pilot-shell .measurement-row {gap: 8px; padding: 4px 0; font-size: 12px; color: #3f5067; font-variant-numeric: tabular-nums}
.pilot-shell .measurement-row strong {color: #25364c; font-weight: 600}
.pilot-shell .measurement-row span {text-align: right}
.pilot-shell .chat-orders > p:not(.context-footnote) {margin: 4px 0; font-size: 13px; line-height: 1.4}
.pilot-shell .chat-orders small {font-size: 12px}
.pilot-shell .chat-orders .button {margin-top: 5px; min-height: 28px; padding: 4px 0; color: #3d55b8; background: transparent; border: 0}
.pilot-shell .chat-orders .button:hover {text-decoration: underline; text-underline-offset: 2px}
.pilot-shell #product-dialog .listing-overview {display: flex; align-items: center; gap: 14px}
.pilot-shell #product-dialog .listing-overview img {width: 82px; height: 96px; margin: 0; flex: none}

.pilot-shell :is(.comments-sheet, .mode-sheet) {color: #263449; background: white}
.pilot-shell .comments-sheet {border-radius: 0}
.pilot-shell :is(.comments-sheet, .mode-sheet) .dialog-header {padding: 16px 20px 11px}
.pilot-shell :is(.comments-sheet, .mode-sheet) .dialog-header h2 {color: #202c3f; font-size: 21px; font-weight: 650; letter-spacing: -.045em}
.pilot-shell #comments-body, .pilot-shell #mode-body {padding: 4px 20px 20px}
.pilot-shell .comment-context {margin-bottom: 15px; color: #59677a}
.pilot-shell .comment-form > textarea, .pilot-shell .comments-sheet :is(select, textarea) {background: #f0f2f6; color: #263449; border-radius: 7px}
.pilot-shell .comment-quote {padding: 8px 10px; background: #f2f4fa; border-radius: 6px; color: #455673; line-height: 1.45}
.pilot-shell .comment-byline strong, .pilot-shell .comment-text {color: #263449}
.pilot-shell .comment-correction {color: #45599b}
.pilot-shell :is(.comments-sheet, .mode-sheet) .text-action {color: #3d55b8}
.pilot-shell .comments-sheet .button.primary {background: var(--action); border-color: transparent; color: white}
.pilot-shell .comments-sheet .button.primary:disabled {background: #e1e6ee; color: #68788c; opacity: 1}
.pilot-shell .mode-info strong, .pilot-shell .mode-setting strong {color: #293951}
.pilot-shell .mode-sheet p {color: #536174}

.pilot-shell .mode-options {padding: 0; margin: 0; border: 0; min-width: 0}
.pilot-shell .mode-option {display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; cursor: pointer}
.pilot-shell .mode-option input {width: 17px; height: 17px; margin: 2px 0 0; flex: none; accent-color: var(--action)}
.pilot-shell .mode-include {display:flex; align-items:baseline; gap:8px; margin:6px 0; font-size:13px; cursor:pointer}
.pilot-shell .mode-include input {width:15px; height:15px; accent-color:var(--action)}
.mode-include small {margin-left:6px; color:#526076}
.pilot-editor .editor-suggestion[data-tone=auto] .draft-label {color:#26614f}
.pilot-shell .mode-option strong, .pilot-shell .mode-option small {display: block}
.pilot-shell .mode-option strong {font-size: 15px}
.pilot-shell .mode-option small, .mode-notice {font-size: 13px; line-height: 1.45; color: #526076}
.mode-buttons, .edit-reason-tools {display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap}
.mode-buttons {margin-top: 12px}
.pilot-shell .pilot-mode[data-state=auto] {background: #def2e9; color: #17634b}
.pilot-shell .ai-decision {align-self: flex-start; flex: none; margin: 1px 0 8px; max-width: min(100%, 42rem); padding: 7px 10px; background: #f0f1fc; color: #444e74; border-radius: 6px}
.pilot-shell .ai-decision[data-action=handoff] {background: #faf2df; color: #664b22}
.ai-decision-heading {display: flex; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; font-size: 12px}
.ai-decision-heading small {font-size: 11px}
.ai-decision-heading time {margin-left: auto; font-size: 11px; font-variant-numeric: tabular-nums}
.earlier-decisions {align-self: flex-start; width: fit-content; max-width: 100%}
.earlier-decisions h3 {margin: 8px 0; font-size: 13px}
.ai-decision p {margin: 3px 0; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere}
.ai-decision .text-action {padding: 2px 0; min-height: 0; font-size: 12px; color: inherit; text-decoration: underline; text-underline-offset: 2px}
.ai-sender {display: block; font-size: 11px; font-weight: 650; color: #23614b}
.pilot-editor .edit-reason {flex: 1 0 100%; min-width: 0; display: grid; gap: 4px}
.edit-reason label {display: grid; gap: 3px; font-size: 12px}
.pilot-shell .edit-reason textarea, .pilot-shell .edit-reason select {width: 100%; padding: 5px 8px; background: #f0f2f6; color: #29364b; border: 0; border-radius: 5px; font: inherit}
.pilot-shell .edit-reason select {width: auto; font-size: 12px}
.dictation {display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px}
.dictation .text-action {display: inline-flex; align-items: center; gap: 4px; color: #40559d}
.dictation svg {width: 15px; height: 15px}
.dictation-status {color: #536174; font-size: 12px}
.dictation button[aria-pressed=true] {color: #a13434}

@container thread (max-width: 600px) {
  .pilot-shell .chat-actions .chat-notes .tool-caption {display: none}
  .pilot-shell .chat-header {gap: 6px}
  .pilot-shell .chat-person {gap: 6px}
  .pilot-shell .chat-notes {padding: 5px}
  .pilot-shell .message-row .message-bubble {max-width: 86%}
  .pilot-shell .messages {scrollbar-gutter: auto}
}
@container thread (max-width: 440px) {
  .pilot-shell .chat-actions .pilot-mode {justify-content: center; padding: 4px; gap: 4px; font-size: 11px}
  .pilot-shell .chat-actions .pilot-mode svg {display: none}
  .pilot-shell .chat-actions {gap: 1px}
  .pilot-shell .chat-header {min-height: 50px; padding: 5px 8px}
  .pilot-shell .chat-person h2 {font-size: 15px}
  .pilot-shell .chat-person p {font-size: 11px}
  .pilot-editor .send-button {width: 34px; padding: 4px}
  .pilot-editor .send-button span {display: none}
  .pilot-shell .message-row .message-bubble {padding: 6px 10px; max-width: 87%}
  .pilot-editor .editor-input {font-size: 16px}
}
@container thread (max-width: 355px) {
  .pilot-shell .chat-person .customer-avatar {width: 27px; height: 27px}
  .pilot-shell .chat-actions .icon-button {width: 26px}
}
@media (pointer: coarse) {
  .pilot-shell .chat-actions :is(.icon-button, .chat-notes, .pilot-mode),
  .pilot-shell .mobile-back,
  .pilot-editor .editor-tools :is(.icon-button, .editor-listing),
  .pilot-editor .editor-suggestion .button, .pilot-editor .editor-generate {min-height: 36px}
}
@media (max-height: 550px) {
  .pilot-shell .pilot-editor {max-height: 46dvh; overflow-y: auto}
}
