/*
 * Technical-component compatibility layer.
 *
 * The established Coherence visual system remains owned by styles.css. This
 * file styles only the new functional controls introduced during final UAT so
 * reliability, accessibility, and workflow fixes cannot globally restyle the
 * product shell.
 */

:root {
  --component-panel: rgba(5, 7, 11, 0.985);
  --component-line: rgba(154, 177, 211, 0.2);
  --component-line-strong: rgba(65, 144, 255, 0.42);
  --component-text: #f3f6fb;
  --component-muted: #9ba8ba;
  --component-dim: #747f90;
  --component-blue: #5c9fff;
  --component-green: #68d59c;
  --component-shadow: 0 24px 72px rgba(0, 0, 0, 0.58);
}

/* Reliability Advisor and repair record: saved first-class product surfaces. */

.guided-thread {
  position: relative;
  gap: 0;
  padding: 4px 0 2px 18px;
}

.guided-thread::before {
  content: "";
  position: absolute;
  inset: 8px auto 8px 0;
  width: 1px;
  background: linear-gradient(180deg, #67a9ff 0%, rgba(46, 134, 255, 0.16) 82%, transparent 100%);
  box-shadow: 0 0 18px rgba(74, 156, 255, 0.28);
}

.guided-thread-body {
  gap: 15px;
  padding: 0;
}

.guided-thread-message,
.guided-conversation-turn p {
  max-width: 780px;
  color: #d9e3f0;
  font-size: 13.5px;
  line-height: 1.68;
}

.guided-conversation {
  gap: 18px;
  padding: 0;
}

.guided-conversation-turn,
.guided-conversation-turn.user,
.guided-conversation-turn.helper {
  width: 100%;
  max-width: 780px;
  padding: 0;
  border: 0;
  background: transparent;
}

.guided-conversation-turn.user {
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
}

.guided-conversation-label {
  margin-bottom: 5px;
  color: #72adff;
  font-size: 9.5px;
  font-weight: 760;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.guided-thread .guided-boundary-note {
  max-width: 720px;
  padding-top: 2px;
  color: #7e8999 !important;
  font-size: 11px !important;
  font-weight: 520;
}

@media (min-width: 901px) {
  .workspace {
    --right-rail-open-width: 320px;
  }

  .session-sidebar {
    padding: 0;
    background:
      radial-gradient(circle at 100% 0%, rgba(37, 119, 231, 0.09), transparent 42%),
      #010203;
  }

  .session-content {
    height: calc(100vh - 74px);
    padding: 22px 20px 34px;
  }
}

.repair-audit-panel {
  gap: 22px;
}

.repair-audit-header {
  position: relative;
  gap: 8px;
  margin: 0;
  padding: 2px 0 20px;
  border-bottom: 1px solid rgba(116, 174, 255, 0.18);
}

.repair-audit-header::before {
  content: "";
  width: 28px;
  height: 2px;
  margin-bottom: 4px;
  background: #4e9cff;
  box-shadow: 0 0 14px rgba(78, 156, 255, 0.55);
}

.repair-audit-header strong {
  color: #f3f7fd;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.repair-audit-header p {
  max-width: 270px;
  margin: 0;
  color: #9aa7ba;
  font-size: 12px;
  line-height: 1.55;
}

.repair-audit-header > span {
  order: 4;
  color: #6f7d91;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.repair-audit-presence {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
}

.repair-audit-presence > span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #65d89b;
  box-shadow: 0 0 11px rgba(101, 216, 155, 0.58);
}

.repair-audit-presence > strong {
  color: #a5b2c3;
  font-size: 10.5px;
  font-weight: 590;
}

.repair-audit-modes {
  display: flex;
  align-items: center;
  gap: 4px;
}

.repair-audit-scopes {
  margin-top: 6px;
}

.repair-audit-views {
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.repair-audit-mode {
  min-height: 28px;
  padding: 4px 8px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: #758398;
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 620;
}

.repair-audit-mode[data-active="true"] {
  border-bottom-color: #4e9cff;
  color: #d9e8fb;
}

.repair-audit-mode:hover,
.repair-audit-mode:focus-visible {
  color: #eef5ff;
  outline: 0;
}

.repair-audit-learn-more {
  order: 3;
  color: #71adff;
  font-size: 11px;
  text-decoration: none;
}

.repair-audit-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 0 0 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.repair-audit-stat {
  gap: 5px;
  min-height: 54px;
  padding: 8px 7px 9px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
}

.repair-audit-stat + .repair-audit-stat {
  border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.repair-audit-stat strong {
  color: #edf4ff;
  font-size: 18px;
  font-weight: 600;
}

.repair-audit-stat span {
  color: #7f8da2;
  font-size: 9px;
  font-weight: 720;
  letter-spacing: 0.1em;
}

.repair-audit-stat[data-active="true"] {
  border-bottom-color: #4e9cff;
  background: linear-gradient(180deg, rgba(63, 142, 255, 0.08), transparent);
  color: #72adff;
}

.repair-audit-subheader {
  grid-column: 1 / -1;
  margin: 15px 0 8px;
  color: #77859a;
  font-size: 9.5px;
}

.repair-audit-substats {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.repair-audit-substats .repair-audit-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  width: auto;
  padding: 5px 8px;
  border: 1px solid rgba(123, 151, 188, 0.18);
  border-radius: 999px;
}

.repair-audit-substats .repair-audit-stat strong {
  order: 2;
  font-size: 9px;
}

.repair-audit-substats .repair-audit-stat span {
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: none;
}

.repair-audit-substats .repair-audit-stat[data-active="true"] {
  border-color: rgba(93, 163, 255, 0.55);
  background: rgba(49, 128, 238, 0.1);
}

.repair-audit-range {
  grid-column: 1 / -1;
  margin: 12px 0 0;
  color: #69778a;
  font-size: 10px;
}

.repair-audit-list {
  position: relative;
  gap: 0;
  padding-left: 17px;
}

.repair-audit-brief {
  display: grid;
  gap: 6px;
  margin: 0 0 22px -17px;
  padding: 14px 0 15px 17px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(90deg, rgba(55, 136, 248, 0.07), transparent 86%);
}

.repair-audit-brief strong {
  color: #dce7f5;
  font-size: 11px;
  font-weight: 650;
}

.repair-audit-brief p {
  max-width: 260px;
  margin: 0;
  color: #8290a3;
  font-size: 10.5px;
  line-height: 1.52;
}

.repair-audit-list::before {
  content: "";
  position: absolute;
  inset: 3px auto 4px 3px;
  width: 1px;
  background: linear-gradient(180deg, rgba(80, 158, 255, 0.38), rgba(255, 255, 255, 0.04));
}

.repair-audit-item {
  position: relative;
  gap: 7px;
  padding: 0 0 22px;
  border: 0;
}

.repair-audit-item::before {
  content: "";
  position: absolute;
  top: 6px;
  left: -17px;
  width: 7px;
  height: 7px;
  border: 1px solid #4e9cff;
  border-radius: 50%;
  background: #02050a;
  box-shadow: 0 0 10px rgba(78, 156, 255, 0.32);
}

.repair-audit-item[data-current="true"]::before {
  background: #4e9cff;
}

.repair-audit-item-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.repair-audit-turn {
  color: #6ca8fb;
  font-size: 9px;
  font-weight: 720;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.repair-audit-item strong {
  color: #dce6f4;
  font-size: 10px;
  font-weight: 620;
}

.repair-audit-reason {
  color: #9ca9bb;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.09em;
}

.repair-audit-chat {
  overflow: hidden;
  color: #647287;
  font-size: 9.5px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repair-audit-item p {
  color: #8d99aa;
  font-size: 11.5px;
  line-height: 1.55;
}

.repair-audit-evidence {
  color: #68778b;
  font-size: 9.5px;
  line-height: 1.5;
}

.repair-audit-open-record {
  justify-self: start;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #72adff;
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 650;
  text-decoration: underline;
  text-decoration-color: rgba(114, 173, 255, 0.34);
  text-underline-offset: 4px;
}

.repair-audit-source {
  display: grid;
  gap: 7px;
  margin-left: -17px;
  padding: 0 0 21px 17px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.repair-audit-source > a,
.repair-audit-source > strong {
  color: #a9ccfa;
  font-size: 11.5px;
  font-weight: 630;
  line-height: 1.4;
  text-decoration-color: rgba(100, 166, 255, 0.38);
  text-underline-offset: 3px;
}

.repair-audit-source > span {
  overflow: hidden;
  color: #68788e;
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repair-audit-source > p {
  margin: 0;
  color: #8390a2;
  font-size: 10px;
  line-height: 1.45;
}

.response-record-modal {
  z-index: 720;
}

.response-record-modal .modal-backdrop {
  background: rgba(0, 0, 0, 0.86);
  backdrop-filter: blur(12px);
}

.response-record-panel {
  position: relative;
  width: min(1160px, calc(100vw - 56px));
  max-height: calc(100dvh - 48px);
  gap: 0;
  padding: 0;
  border: 1px solid rgba(99, 159, 239, 0.23);
  border-radius: 2px;
  background:
    radial-gradient(circle at 96% 0%, rgba(37, 119, 231, 0.11), transparent 31%),
    #020304;
  box-shadow: 0 42px 120px rgba(0, 0, 0, 0.72);
}

.response-record-panel > .icon-button {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 4;
  margin: 0;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(2, 4, 8, 0.88);
}

.response-record-body {
  display: grid;
  gap: 28px;
  padding: 28px 34px 40px;
}

.response-record-path {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-right: 46px;
  color: #68778b;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.response-record-path span + span::before {
  content: "›";
  margin-right: 7px;
  color: #3d4b5f;
}

.response-record-path [aria-current="page"] {
  color: #7eb7ff;
}

.response-record-hero {
  display: grid;
  gap: 8px;
  max-width: 760px;
  padding: 18px 0 3px;
}

.response-record-hero > span,
.response-record-prompt > span {
  color: #64a6ff;
  font-size: 9.5px;
  font-weight: 760;
  letter-spacing: 0.16em;
}

.response-record-hero h2 {
  color: #f5f8fc;
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.02;
}

.response-record-hero p {
  margin: 0;
  color: #98a8bc;
  font-size: 13px;
}

.response-record-prompt {
  display: grid;
  gap: 9px;
  padding: 17px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.response-record-prompt p {
  max-width: 920px;
  margin: 0;
  color: #cbd5e2;
  font-size: 14px;
  line-height: 1.6;
}

.response-record-comparison .word-diff-summary {
  margin-bottom: 14px;
  color: #718096;
}

.response-record-comparison .word-diff-panes {
  gap: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.response-record-comparison .word-diff-panes section {
  min-height: 260px;
  padding: 22px;
  border: 0;
  background: #030507;
}

.response-record-comparison .word-diff-panes section > strong {
  color: #9badc4;
  font-size: 10px;
  font-weight: 740;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.response-record-comparison .word-diff-pane {
  color: #c5cfdd;
  font-size: 13px;
  line-height: 1.7;
}

.response-record-notes,
.response-record-body > .response-review-support {
  display: grid;
  gap: 8px;
  max-width: 900px;
  padding: 18px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.response-record-notes strong,
.response-record-body > .response-review-support > strong {
  color: #e3eaf3;
  font-size: 12px;
  font-weight: 650;
}

.response-record-notes p,
.response-record-body > .response-review-support p,
.response-record-body > .response-review-support li {
  color: #8795a8;
  font-size: 11.5px;
  line-height: 1.6;
}

.response-record-error {
  color: #ff9fb2 !important;
}

@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  .response-record-panel {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
  }

  .response-record-body {
    gap: 22px;
    padding: 22px 18px 30px;
  }

  .response-record-comparison .word-diff-panes {
    grid-template-columns: 1fr;
  }

  .response-record-comparison .word-diff-panes section {
    min-height: 0;
    padding: 17px;
  }

  .repair-audit-header p {
    max-width: none;
    font-size: 12px;
  }

  .repair-audit-mode {
    font-size: 11.5px;
  }

  .repair-audit-stat span {
    font-size: 9.5px;
  }

  .repair-audit-range {
    font-size: 10.5px;
  }

  .repair-audit-reason,
  .repair-audit-evidence {
    font-size: 10.5px;
  }

  .repair-audit-item p,
  .repair-audit-empty {
    font-size: 11.5px;
    line-height: 1.55;
  }
}

.repair-audit-load-older {
  justify-self: start;
  margin-top: 4px;
  color: #aacbfa;
  font-size: 11px;
  font-weight: 650;
}

/* Editorial repair comparison: full-width, quiet, and readable. */

.response-review-compare.word-diff,
.response-record-comparison.word-diff {
  display: block;
  width: 100%;
}

.response-review-compare .word-diff-panes,
.response-record-comparison .word-diff-panes {
  width: 100%;
  gap: 0;
  background: transparent;
}

.response-review-compare .word-diff-panes section,
.response-record-comparison .word-diff-panes section {
  min-height: 0;
  padding: 8px 24px 8px 0;
  border: 0;
  background: transparent;
}

.response-review-compare .word-diff-panes section + section,
.response-record-comparison .word-diff-panes section + section {
  padding: 8px 0 8px 24px;
  border-left: 1px solid rgba(255, 255, 255, 0.09);
}

.response-review-compare .word-diff-panes section:first-child > strong,
.response-record-comparison .word-diff-panes section:first-child > strong {
  color: #d893a1;
}

.response-review-compare .word-diff-panes section:last-child > strong,
.response-record-comparison .word-diff-panes section:last-child > strong {
  color: #8fd1ad;
}

.response-review-compare .word-diff-pane,
.response-record-comparison .word-diff-pane {
  margin-top: 13px;
  color: #b9c4d3;
  line-height: 1.72;
}

.response-review-compare.word-diff del,
.response-record-comparison.word-diff del {
  padding: 0;
  background: transparent;
  color: #c98996;
  text-decoration-color: rgba(224, 128, 148, 0.62);
  text-decoration-thickness: 1px;
}

.response-review-compare.word-diff ins,
.response-record-comparison.word-diff ins {
  padding: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
  text-decoration-color: rgba(104, 213, 156, 0.46);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.response-review-compare.word-diff .word-diff-summary,
.response-record-comparison.word-diff .word-diff-summary {
  color: #738095;
  font-size: 10px;
  letter-spacing: 0.02em;
}

.response-review-compare.original-unavailable .word-diff-summary,
.response-record-comparison.original-unavailable .word-diff-summary {
  display: none;
}

.response-review-compare.original-unavailable .word-diff-panes,
.response-record-comparison.original-unavailable .word-diff-panes {
  grid-template-columns: minmax(180px, 0.72fr) minmax(0, 1.35fr);
}

.response-review-compare.original-unavailable del,
.response-record-comparison.original-unavailable del {
  color: #778395;
  font-style: italic;
  text-decoration: none;
}

@media (max-width: 1040px) {
  .response-review-compare .word-diff-panes,
  .response-review-compare.original-unavailable .word-diff-panes {
    grid-template-columns: 1fr;
  }

  .response-review-compare .word-diff-panes section,
  .response-review-compare .word-diff-panes section + section {
    padding: 14px 0;
    border-left: 0;
  }

  .response-review-compare .word-diff-panes section + section {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
}

[hidden] {
  display: none !important;
}

.coherence-icon {
  display: block;
  width: 17px;
  height: 17px;
  pointer-events: none;
}

/* The command palette remains keyboard-accessible without adding new top-rail chrome. */
.top-command-button {
  display: none;
}

.top-rail-center {
  grid-column: 2;
  position: relative;
  display: grid;
  justify-items: center;
  gap: 3px;
  min-width: 0;
}

.family-workspace-menu {
  position: relative;
  z-index: 230;
}

.family-workspace-menu > summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
  border: 0;
  background: transparent;
  color: #f4f7fb;
  cursor: pointer;
  font-size: 13px;
  font-weight: 710;
  letter-spacing: 0.01em;
  list-style: none;
  padding: 0 3px;
}

.family-workspace-menu > summary::-webkit-details-marker {
  display: none;
}

.family-workspace-menu > summary:focus-visible {
  outline: 2px solid rgba(57, 130, 249, 0.88);
  outline-offset: 4px;
}

.family-workspace-chevron {
  width: 6px;
  height: 6px;
  border-right: 1px solid #8c9ab0;
  border-bottom: 1px solid #8c9ab0;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 140ms ease;
}

.family-workspace-menu[open] .family-workspace-chevron {
  transform: translateY(2px) rotate(225deg);
}

.family-workspace-menu-list {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  width: min(330px, calc(100vw - 28px));
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(0, 0, 0, 0.98);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.58);
  padding: 7px;
  transform: translateX(-50%);
}

.family-workspace-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 58px;
  color: #eef3fa;
  text-decoration: none;
  padding: 9px 10px;
}

a.family-workspace-row:hover,
a.family-workspace-row:focus-visible {
  background: rgba(57, 130, 249, 0.11);
  outline: 0;
}

.family-workspace-row + .family-workspace-row {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.family-workspace-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.family-workspace-copy strong {
  font-size: 13px;
  font-weight: 690;
}

.family-workspace-copy em {
  overflow: hidden;
  color: #8e9aab;
  font-size: 11px;
  font-style: normal;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.family-workspace-state {
  color: #7f8da2;
  font-size: 9px;
  font-weight: 760;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.family-workspace-row.current .family-workspace-state {
  color: #5c9dff;
}

.family-workspace-row.unavailable {
  color: #9aa4b3;
  opacity: 0.62;
}

.family-workspace-loading {
  display: block;
  color: #8e9aab;
  font-size: 12px;
  padding: 16px;
}

.top-rail-center .top-plan-label {
  grid-column: auto;
  max-width: min(42vw, 280px);
  font-size: 9px;
}

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  background: #000;
  color: var(--component-text);
}

.boot-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
}

.boot-mark img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.boot-screen strong {
  font-size: 18px;
}

.boot-screen span {
  max-width: 32rem;
  color: var(--component-muted);
  text-align: center;
}

.boot-screen button {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--component-line-strong);
  background: transparent;
  color: var(--component-text);
}

.composer-actions {
  grid-template-columns: 44px 44px minmax(0, 1fr) 44px 44px;
  gap: 8px;
}

.composer-left-controls {
  display: contents;
}

#documentAttachButton,
#dictationButton {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  min-height: 44px;
}

#documentAttachButton {
  grid-column: 1;
  justify-self: start;
}

#dictationButton {
  grid-column: 2;
  justify-self: start;
}

#modelsMenu {
  grid-column: 3;
  justify-self: center;
  max-width: 100%;
}

#modelsMenu summary {
  min-height: 44px;
  padding-inline: 8px;
}

.context-meter-wrap {
  position: relative;
  grid-column: 4;
  justify-self: center;
}

#contextWindowMeter {
  grid-column: 4;
  min-width: 44px;
  min-height: 44px;
}

#sendButton {
  grid-column: 5;
  justify-self: end;
}

.context-summary-popover {
  position: absolute;
  z-index: 230;
  left: 50%;
  bottom: calc(100% + 12px);
  width: min(320px, calc(100vw - 28px));
  padding: 14px;
  border: 1px solid var(--component-line-strong);
  background: var(--component-panel);
  box-shadow: var(--component-shadow);
  transform: translateX(-50%);
}

.context-summary-popover strong,
.context-summary-popover p,
.context-summary-popover em {
  display: block;
}

.context-summary-popover p {
  margin: 8px 0;
  color: var(--component-muted);
  font-size: 12px;
  line-height: 1.45;
}

.context-summary-popover em {
  color: var(--component-dim);
  font-size: 10px;
  font-style: normal;
  line-height: 1.45;
}

.context-summary-popover button {
  min-height: 34px;
  margin-top: 12px;
  padding: 0 10px;
  border: 1px solid var(--component-line);
  background: transparent;
  color: var(--component-blue);
}

.jump-to-latest {
  position: fixed;
  z-index: 16;
  left: 50%;
  bottom: 146px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid var(--component-line-strong);
  border-radius: 999px;
  background: rgba(3, 6, 11, 0.96);
  color: var(--component-blue);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.42);
  transform: translateX(-50%);
}

.jump-to-latest .coherence-icon {
  transform: rotate(180deg);
}

/* Rich answers retain the established message typography. */
.message-text:has(> :is(p, h3, h4, ul, ol, pre, blockquote)) {
  white-space: normal;
}

.message-text p {
  margin: 0 0 0.85em;
}

.message-text p:last-child {
  margin-bottom: 0;
}

.message-text :where(h3, h4) {
  margin: 1.25em 0 0.5em;
  color: var(--component-text);
  line-height: 1.25;
}

.message-text :where(ul, ol) {
  margin: 0.75em 0;
  padding-left: 1.35em;
}

.message-text li + li {
  margin-top: 0.32em;
}

.message-text code {
  padding: 0.12em 0.35em;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.9em;
}

.message-text pre {
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--component-line);
  background: #05070b;
}

.message-text pre code {
  padding: 0;
  background: none;
}

.message-text blockquote {
  margin: 0.9em 0;
  padding-left: 13px;
  border-left: 2px solid var(--component-blue);
  color: var(--component-muted);
}

.message-text a {
  color: var(--component-blue);
  text-underline-offset: 3px;
}

.word-diff-summary {
  margin: 0 0 10px;
  color: var(--component-dim);
  font-size: 11px;
}

.word-diff-panes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.word-diff-panes section {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--component-line);
  background: rgba(255, 255, 255, 0.018);
}

.word-diff-pane {
  margin-top: 9px;
  color: var(--component-muted);
  font-size: 13px;
  line-height: 1.58;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.word-diff del {
  padding: 1px 2px;
  background: rgba(255, 111, 141, 0.16);
  color: #ffc1ce;
}

.word-diff ins {
  padding: 1px 2px;
  background: rgba(104, 213, 156, 0.16);
  color: #bdf2d4;
  text-decoration: none;
}

.word-diff-complete-record {
  margin-top: 12px;
  color: var(--component-muted);
  font-size: 12px;
}

.word-diff-complete-record > summary {
  width: fit-content;
  cursor: pointer;
  color: var(--component-blue);
  text-underline-offset: 3px;
}

.word-diff-complete-panes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.word-diff-complete-panes section {
  min-width: 0;
}

.word-diff-complete-panes pre {
  max-height: min(48vh, 520px);
  margin: 8px 0 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--component-line);
  background: rgba(255, 255, 255, 0.018);
  color: var(--component-muted);
  font: inherit;
  line-height: 1.58;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .word-diff-complete-panes {
    grid-template-columns: 1fr;
  }
}

.command-palette {
  position: fixed;
  inset: 0;
  z-index: 6000;
  display: grid;
  place-items: start center;
  padding-top: min(18vh, 150px);
}

.command-palette-scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.command-palette-panel {
  position: relative;
  width: min(620px, calc(100vw - 28px));
  overflow: hidden;
  border: 1px solid var(--component-line-strong);
  background: var(--component-panel);
  box-shadow: var(--component-shadow);
}

.command-palette-search {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 15px;
  border-bottom: 1px solid var(--component-line);
  color: var(--component-dim);
}

.command-palette-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--component-text);
  font-size: 15px;
}

.command-palette-list {
  max-height: min(420px, 55vh);
  padding: 8px;
  overflow: auto;
}

.command-palette-item {
  width: 100%;
  min-height: 46px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--component-muted);
  text-align: left;
}

.command-palette-item[data-active="true"] {
  background: rgba(57, 130, 249, 0.13);
  color: var(--component-text);
}

.command-palette-panel footer,
.command-palette-empty {
  padding: 10px 14px;
  border-top: 1px solid var(--component-line);
  color: var(--component-dim);
  font-size: 10px;
}

.action-dialog-panel {
  width: min(460px, calc(100vw - 28px));
  padding: 24px;
  border-color: var(--component-line-strong);
  background: var(--component-panel);
  box-shadow: var(--component-shadow);
}

.action-dialog-panel h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.action-dialog-panel p {
  color: var(--component-muted);
  line-height: 1.5;
}

.action-dialog-panel label {
  display: grid;
  gap: 7px;
  margin: 18px 0;
  color: var(--component-muted);
  font-size: 12px;
}

/* New settings disclosures inherit the restrained, line-based settings language. */
.settings-disclosure {
  display: block;
  border-top: 1px solid rgba(255, 255, 255, 0.085);
}

.settings-disclosure:last-child {
  border-bottom: 1px solid rgba(255, 255, 255, 0.085);
}

.settings-disclosure > summary {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  list-style: none;
  padding: 10px 0;
}

.settings-disclosure > summary::-webkit-details-marker {
  display: none;
}

.settings-disclosure > summary > span:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.settings-disclosure > summary strong,
.settings-disclosure > summary em {
  display: block;
  min-width: 0;
}

.settings-disclosure > summary strong {
  color: #e7ecf4;
  font-size: 13px;
  font-weight: 650;
}

.settings-disclosure > summary em {
  color: #8f98a8;
  font-size: 11.5px;
  font-style: normal;
  line-height: 1.35;
}

.settings-disclosure-marker {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  justify-self: end;
  color: #8bbcff;
}

.settings-disclosure-marker .coherence-icon {
  width: 14px;
  height: 14px;
}

.settings-disclosure-body {
  display: grid;
  gap: 0;
  padding: 0 0 22px;
}

.settings-inline-status,
.settings-muted {
  margin: 0;
  color: #8f98a8;
  font-size: 11px;
  line-height: 1.45;
}

.settings-inline-status[data-tone="success"] {
  color: var(--component-green);
}

.settings-inline-status[data-tone="error"] {
  color: #ff8fa8;
}

.settings-inline-link,
.settings-help-links a {
  color: #8bbcff;
  text-underline-offset: 3px;
}

.settings-help-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.locked-setting {
  display: inline-flex;
  align-items: center;
  width: max-content;
  color: var(--component-green);
  font-size: 11px;
  font-weight: 650;
}

.account-action-close {
  position: absolute;
  top: 16px;
  right: 16px;
}

/* Final settings productization. These rules preserve the saved black/blue
   baseline while making every consumer settings workflow explicit and usable. */
.settings-nav-account {
  display: block;
}

.profile-app-menu summary .app-menu-avatar {
  border-radius: 999px;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

@media (min-width: 901px) and (hover: hover) and (pointer: fine) {
  .top-rail {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .brand-home-link {
    justify-self: start;
  }

  .top-plan-label {
    justify-self: center;
  }

  .top-hamburger-button {
    justify-self: end;
  }
}

/* Phone/coarse-pointer rails reserve actual space for each control. The desktop
   centered layout must not let a full-width brand overflow its narrow track. */
@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  .top-rail {
    grid-template-columns: minmax(0, 1fr) auto 40px;
    gap: 8px;
  }

  .brand-home-link {
    min-width: 0;
    max-width: 100%;
  }

  .brand-logo {
    width: 176px;
    max-width: 100%;
    height: auto;
    max-height: 30px;
  }
}

.settings-edit-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.settings-edit-commit {
  display: flex;
  align-items: center;
  gap: 16px;
}

.settings-form[data-settings-editing="false"] :is(input, select, textarea):disabled,
.settings-preferences-form[data-settings-editing="false"] :is(input, select, textarea):disabled,
.settings-personalization-form[data-settings-editing="false"] :is(input, select, textarea):disabled,
.settings-privacy-form[data-settings-editing="false"] :is(input, select, textarea):disabled,
.settings-memory-form[data-settings-editing="false"] :is(input, select, textarea):disabled {
  opacity: 1;
  color: #c7cfdb;
  cursor: default;
  -webkit-text-fill-color: #c7cfdb;
}

.settings-profile-form {
  display: block;
  padding-top: 0;
}

.settings-profile-form .settings-edit-toolbar {
  margin-bottom: 0;
}

.settings-profile-form[data-settings-editing="false"] [data-settings-edit-control] {
  display: none;
}

.settings-profile-hero {
  grid-template-columns: 56px minmax(0, 1fr) auto;
  padding: 18px 0;
}

.settings-profile-hero .settings-avatar-large {
  width: 48px;
  height: 48px;
}

.settings-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 18px 0 2px;
}

.settings-form-grid .settings-field:last-child {
  grid-column: 1 / -1;
}

.settings-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.settings-status-badge {
  display: inline-flex !important;
  width: max-content;
  margin: 0 !important;
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  color: #aab4c3 !important;
  font-size: 10px !important;
  font-weight: 680;
  line-height: 1.2 !important;
  white-space: nowrap;
}

.settings-status-badge[data-tone="success"] {
  border-color: rgba(104, 213, 156, 0.28);
  color: #76dca5 !important;
}

.settings-status-badge[data-tone="muted"] {
  color: #778294 !important;
}

.settings-security-overview,
.settings-privacy-summary,
.settings-credit-row,
.settings-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  padding: 16px 0;
}

.settings-security-overview > div,
.settings-privacy-summary > div,
.settings-credit-row > div,
.settings-action-row > div {
  display: grid;
  gap: 4px;
}

.settings-security-overview strong,
.settings-privacy-summary strong,
.settings-credit-row strong,
.settings-action-row strong {
  color: #edf2f9;
  font-size: 13px;
  font-weight: 630;
}

.settings-security-overview span,
.settings-privacy-summary span,
.settings-credit-row span,
.settings-action-row span {
  color: #8f99a9;
  font-size: 11.5px;
  line-height: 1.4;
}

.settings-security-group {
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
}

.settings-security-group > summary {
  min-height: 62px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  list-style: none;
}

.settings-security-group > summary::-webkit-details-marker {
  display: none;
}

.settings-security-group > summary > span:first-child {
  display: grid;
  gap: 3px;
}

.settings-security-group > summary strong {
  color: #e4eaf3;
  font-size: 13px;
  font-weight: 640;
}

.settings-security-group > summary em {
  color: #858f9f;
  font-size: 11px;
  font-style: normal;
}

.settings-security-chevron {
  color: #7eb5ff;
  font-size: 0;
  text-align: center;
}

.settings-security-chevron::before {
  content: "+";
  font-size: 17px;
}

.settings-security-group[open] .settings-security-chevron::before {
  content: "−";
}

.settings-security-group > .settings-row-list {
  margin-bottom: 16px;
}

.settings-section-block {
  display: grid;
  gap: 10px;
  padding: 20px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
}

.settings-section-block h3 {
  font-size: 13px;
}

.settings-plan-current {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  padding: 18px 0;
}

.settings-current-plan-copy {
  display: grid;
  gap: 4px;
}

.settings-current-plan-copy > strong {
  font-size: 20px;
}

.settings-eyebrow {
  color: #7eb5ff;
  font-size: 9px;
  font-weight: 760;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.settings-current-plan-actions,
.settings-plan-row-action {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.settings-plan-list {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.settings-plan-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.3fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  min-height: 88px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 14px 0;
}

.settings-plan-row.current {
  border-left: 2px solid rgba(72, 151, 255, 0.8);
  padding-left: 14px;
}

.settings-plan-row-heading {
  display: grid;
  gap: 4px;
}

.settings-plan-row-heading strong {
  color: #edf3fb;
  font-size: 14px;
}

.settings-plan-row-heading span,
.settings-plan-row p {
  margin: 0;
  color: #929cab;
  font-size: 11.5px;
  line-height: 1.45;
}

.settings-billing-footer {
  display: grid;
  gap: 10px;
  padding: 16px 0;
}

.settings-billing-footer p {
  margin: 0;
  color: #7e8999;
  font-size: 11px;
  line-height: 1.45;
}

.settings-capacity-overview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  padding: 18px 0;
}

.settings-capacity-metric {
  display: grid;
  gap: 6px;
}

.settings-capacity-metric > span,
.settings-capacity-metric > em {
  color: #828d9d;
  font-size: 10.5px;
  font-style: normal;
}

.settings-capacity-metric > strong {
  color: #edf3fb;
  font-size: 15px;
  font-weight: 650;
}

.settings-fact-list {
  display: grid;
  border-top: 1px solid rgba(255, 255, 255, 0.065);
}

.settings-fact-list > div {
  display: grid;
  grid-template-columns: minmax(150px, 0.36fr) minmax(0, 1fr);
  gap: 20px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.settings-fact-list strong {
  color: #dce3ed;
  font-size: 12px;
  font-weight: 590;
}

.settings-fact-list span {
  color: #8d97a7;
  font-size: 11.5px;
  line-height: 1.4;
}

.settings-action-row + .settings-action-row {
  border-top: 0;
}

@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  .settings-nav-account {
    display: block;
  }

  .settings-profile-hero,
  .settings-security-overview,
  .settings-privacy-summary,
  .settings-credit-row,
  .settings-action-row,
  .settings-plan-current,
  .settings-plan-row,
  .settings-fact-list > div {
    grid-template-columns: 1fr;
  }

  .settings-form-grid,
  .settings-capacity-overview {
    grid-template-columns: 1fr;
  }

  .settings-form-grid .settings-field:last-child {
    grid-column: auto;
  }

  .settings-profile-hero .avatar-upload-row,
  .settings-current-plan-actions,
  .settings-plan-row-action,
  .settings-row-actions {
    justify-content: flex-start;
  }

  .settings-plan-row {
    gap: 8px;
  }

  .composer-actions {
    grid-template-columns: 44px 44px minmax(0, 1fr) 44px 44px;
    gap: 4px;
  }

  .context-summary-popover {
    position: fixed;
    inset: auto 12px calc(116px + env(safe-area-inset-bottom)) 12px;
    width: auto;
    transform: none;
  }

  /* Missing evidence must not restore desktop columns on a narrow record. */
  .word-diff-panes,
  .response-record-comparison.original-unavailable .word-diff-panes {
    grid-template-columns: 1fr;
  }

  .response-record-comparison .word-diff-panes section,
  .response-record-comparison .word-diff-panes section + section {
    padding: 14px 0;
    border-left: 0;
  }

  .response-record-comparison .word-diff-panes section + section {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .settings-disclosure > summary {
    min-height: 54px;
    gap: 10px;
  }
}
