:root {
  --page: #f3f2f1;
  --surface: #ffffff;
  --ink: #0b0c0c;
  --muted: #505a5f;
  --line: #b1b4b6;
  --subtle: #d8dcde;
  --nav: #0b0c0c;
  --nav-ink: #ffffff;
  --blue: #1d70b8;
  --blue-dark: #003078;
  --green: #00703c;
  --amber: #ffdd00;
  --red: #b42318;
  --max: 1120px;
  --wide: 1480px;
  --header-h: 60px;
  --banner-h: 0px;
  --rail-w: 264px;
  --rail-compact-w: 65px;
  --artifact-handle-w: 64px;
  --artifact-drawer-w: 390px;
  --chat-min-protected: 720px;
  --font: "GDS Transport", Arial, Helvetica, sans-serif;
  --brand-font: "Sorts Mill Goudy", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  overflow-y: scroll;
  scrollbar-gutter: stable;
  background: var(--page);
  color: var(--ink);
}

body {
  min-height: 100%;
  margin: 0;
  font-family: var(--font);
  font-size: 19px;
  line-height: 1.3157894737;
  letter-spacing: 0;
  background: var(--page);
}

a {
  color: var(--blue);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--blue-dark);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 0;
  box-shadow: 0 0 0 5px var(--ink);
}

button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: 12px;
  z-index: 40;
  transform: translateY(-160%);
  padding: 8px 12px;
  color: var(--ink);
  background: var(--amber);
  font-weight: 700;
}

.skip-link:focus {
  transform: translateY(0);
}

.service-header {
  color: var(--nav-ink);
  background: var(--nav);
  border-bottom: 4px solid var(--amber);
}

.system-banner {
  display: none;
}

.system-banner:not([hidden]):not(:empty) {
  display: block;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  width: min(calc(100% - 32px), var(--wide));
  margin: 0 auto;
  padding: 8px 0;
  color: var(--muted);
  font-size: 16px;
}

.width-container {
  width: min(calc(100% - 32px), var(--max));
  margin: 0 auto;
}

.wide-container {
  width: min(calc(100% - 32px), var(--wide));
  margin: 0 auto;
}

.service-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 8px;
}

@media (min-width: 901px) {
  .service-header {
    height: 60px;
  }

  .service-header__inner {
    height: 56px;
    padding-top: 0;
    padding-bottom: 0;
  }
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand__text {
  display: grid;
}

.brand__name {
  font-family: var(--brand-font);
  font-size: 30px;
  font-weight: 400;
  line-height: 1;
}

.brand__strap {
  color: #d8dcde;
  font-size: 13px;
  font-weight: 700;
}

.workspace-mobile-controls {
  display: none;
}

.workspace-shell {
  position: relative;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(var(--chat-min-protected), 1fr);
  gap: 14px;
  align-items: stretch;
  height: clamp(560px, calc(100dvh - var(--header-h) - var(--banner-h)), 780px);
  overflow: visible;
  padding-bottom: 0;
}

.workspace-shell[data-rail-state="compact"] {
  --rail-w: var(--rail-compact-w);
}

.workspace-shell[data-artifact-state="empty"] .chat-pane,
.workspace-shell[data-artifact-panel="none"] .chat-pane {
  width: 100%;
  justify-self: stretch;
}

.workspace-shell[data-artifact-panel="none"] .artifact-handle,
.workspace-shell[data-artifact-panel="none"] .dossier-pane,
.workspace-shell[data-artifact-panel="collapsed"] .dossier-pane {
  display: none;
}

.workspace-shell[data-artifact-panel="collapsed"] .artifact-handle {
  display: grid;
}

.workspace-shell[data-artifact-panel="collapsed"] .chat-pane {
  padding-right: calc(var(--artifact-handle-w) + 8px);
}

.workspace-shell[data-artifact-panel="source-open"] .chat-pane,
.workspace-shell[data-artifact-panel="review-open"] .chat-pane,
.workspace-shell[data-artifact-panel="export-open"] .chat-pane {
  padding-right: calc(var(--artifact-drawer-w) + var(--artifact-handle-w) + 24px);
}

.workspace-shell[data-artifact-panel="source-open"] .dossier-pane,
.workspace-shell[data-artifact-panel="review-open"] .dossier-pane,
.workspace-shell[data-artifact-panel="export-open"] .dossier-pane {
  display: grid;
  position: absolute;
  z-index: 20;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(var(--artifact-drawer-w), calc(100% - var(--rail-w) - 24px));
  min-width: 340px;
  background: var(--surface);
  border-left: 2px solid var(--ink);
  box-shadow: -4px 0 12px rgba(11, 12, 12, 0.18);
}

.workspace-shell[data-artifact-panel="pinned"] .artifact-handle {
  display: none;
}

.workspace-shell[data-artifact-panel="source-open"] .artifact-handle,
.workspace-shell[data-artifact-panel="review-open"] .artifact-handle,
.workspace-shell[data-artifact-panel="export-open"] .artifact-handle {
  display: none;
}

@media (min-width: 1480px) {
  .workspace-shell[data-artifact-panel="pinned"] {
    grid-template-columns: var(--rail-w) minmax(700px, 1fr) minmax(360px, 420px);
  }

  .workspace-shell[data-artifact-panel="pinned"] .chat-pane {
    padding-right: 0;
  }

  .workspace-shell[data-artifact-panel="pinned"] .dossier-pane {
    display: grid;
    position: static;
    min-width: 0;
    box-shadow: 0 2px 0 #d8d8d8;
  }
}

.workspace-sidebar,
.chat-pane,
.dossier-pane {
  min-width: 0;
  height: 100%;
  background: var(--surface);
  border: 1px solid #d9d9d9;
  box-shadow: 0 1px 0 #e7e7e7;
}

.workspace-sidebar,
.dossier-pane {
  overflow: hidden;
}

.workspace-sidebar {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.rail-compact-nav {
  display: none;
  height: 100%;
  position: sticky;
  top: 12px;
  grid-template-rows: repeat(2, 50px) 1fr;
  gap: 6px;
  padding: 8px;
  border-top: 0;
  background: #ffffff;
}

.compact-nav-button {
  display: inline-flex;
  min-width: 0;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid #b1b4b6;
  border-radius: 0;
  font-size: 21px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.compact-nav-button svg {
  width: 20px;
  height: 20px;
}

.compact-nav-button:hover {
  background: #f3f2f1;
}

.workspace-shell[data-rail-state="compact"] .workspace-sidebar {
  overflow: visible;
}

.workspace-shell[data-rail-state="compact"] .rail-compact-nav {
  display: grid;
}

.workspace-shell[data-rail-state="compact"] .rail-workspace,
.workspace-shell[data-rail-state="compact"] .rail-nav,
.workspace-shell[data-rail-state="compact"] .rail-bottom {
  display: none;
}

.sidebar-section + .sidebar-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.sidebar-label,
.field label,
.field span {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.rail-workspace,
.rail-nav,
.rail-bottom {
  padding: 10px;
}

.rail-workspace {
  border-top: 4px solid #b1b4b6;
  border-bottom: 1px solid var(--line);
}

.rail-workspace__top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.rail-workspace h1 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.25;
}

.rail-workspace p {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 15px;
}

.rail-workspace select {
  width: 100%;
  min-height: 42px;
  padding: 7px;
  color: var(--ink);
  background: #ffffff;
  border: 2px solid var(--ink);
  border-radius: 0;
}

.sidebar-status {
  display: grid;
  gap: 5px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
}

.rail-collapse-button {
  min-width: 34px;
  min-height: 34px;
  padding: 4px 7px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid #b1b4b6;
  font-size: 18px;
  font-weight: 700;
}

.rail-collapse-button:hover {
  background: #f3f2f1;
}

.rail-nav {
  display: grid;
  flex: 1 1 auto;
  align-content: start;
  gap: 7px;
  min-height: 0;
  overflow: auto;
  border-top: 0;
}

.rail-section-heading {
  display: flex;
  min-height: 32px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 2px;
}

.rail-section-heading .sidebar-label {
  margin-bottom: 0;
}

.rail-section-heading-history {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.rail-section-add {
  display: inline-flex;
  min-width: 30px;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid #b1b4b6;
  font-size: 20px;
  font-weight: 700;
}

.rail-section-add:hover {
  background: #f3f2f1;
}

.rail-bottom {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border-top: 1px solid var(--line);
  background: #f8f8f8;
}

.rail-link {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  color: var(--ink);
  background: #ffffff;
  border: 2px solid var(--ink);
  border-radius: 0;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.rail-link:hover {
  background: #f3f2f1;
}

.button,
.link-button,
.icon-button,
.dossier-row,
.tab-button,
.view-switch button,
.rail-link,
.source-chip {
  border-radius: 0;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px 7px;
  color: #ffffff;
  background: var(--green);
  border: 2px solid transparent;
  box-shadow: 0 2px 0 #002d18;
  font-weight: 700;
  text-decoration: none;
}

.button:hover {
  background: #005a30;
}

.button-secondary {
  color: var(--ink);
  background: #f3f2f1;
  box-shadow: 0 2px 0 #929191;
}

.button-secondary:hover {
  background: #dbdad9;
}

.button-warning {
  color: #ffffff;
  background: var(--red);
  box-shadow: 0 2px 0 #55130d;
}

.button-small {
  min-height: 34px;
  padding: 6px 9px 5px;
  font-size: 16px;
}

.button-icon {
  position: relative;
  display: inline-block;
  width: 16px;
  height: 14px;
  flex: 0 0 auto;
}

.button-icon-folder::before,
.button-icon-folder::after {
  position: absolute;
  content: "";
  border: 2px solid currentColor;
}

.button-icon-folder::before {
  top: 0;
  left: 1px;
  width: 7px;
  height: 4px;
  border-bottom: 0;
}

.button-icon-folder::after {
  right: 0;
  bottom: 0;
  left: 0;
  height: 10px;
}

.button:disabled,
.button[aria-disabled="true"],
.button:disabled:hover,
.button[aria-disabled="true"]:hover {
  color: var(--muted);
  background: #f3f2f1;
  box-shadow: none;
  cursor: not-allowed;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.dossier-list {
  display: grid;
  gap: 4px;
}

.unfiled-list {
  margin-bottom: 4px;
}

.client-group {
  display: grid;
  gap: 3px;
}

.client-heading {
  display: grid;
  gap: 1px;
  padding: 6px 2px 2px;
  color: var(--ink);
  background: transparent;
  border-left: 0;
}

.client-heading strong {
  font-size: 15px;
  line-height: 1.2;
}

.client-heading span {
  color: var(--muted);
  font-size: 13px;
}

.dossier-tree-item {
  display: grid;
  gap: 3px;
}

.dossier-row {
  display: grid;
  width: 100%;
  gap: 2px;
  padding: 7px 8px;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  text-align: left;
}

.dossier-row:hover {
  background: #f3f2f1;
}

.dossier-row-case {
  padding-left: 11px;
  border-left: 2px solid #b1b4b6;
}

.conversation-row {
  margin-left: 0;
  width: 100%;
  padding-top: 6px;
  padding-bottom: 6px;
  border-left: 2px solid #d8d8d8;
  background: transparent;
}

.unfiled-row {
  border-left: 2px solid #b1b4b6;
  padding-left: 12px;
}

.dossier-row[aria-current="true"] {
  border-left: 4px solid var(--amber);
  padding-left: 10px;
  background: #fff7bf;
}

.dossier-row-pinned[aria-current="true"] {
  border-left-color: var(--green);
}

.dossier-row strong {
  font-size: 15px;
}

.conversation-row strong {
  font-size: 15px;
  font-weight: 700;
}

.dossier-row span {
  color: var(--muted);
  font-size: 13px;
}

.conversation-row span {
  font-size: 13px;
}

.rail-empty {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.template-list {
  display: grid;
  gap: 6px;
}

.chat-pane {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.pane-header {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.pane-header__top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.pane-header__title-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.rail-toggle-button {
  flex: 0 0 auto;
}

.pane-header h2 {
  font-size: 24px;
  line-height: 1.25;
}

.pane-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
}

.tag {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 2px 7px;
  color: var(--ink);
  background: #f3f2f1;
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 700;
}

.tag-yellow {
  background: #fff7bf;
  border-color: var(--amber);
}

.chat-thread {
  display: grid;
  flex: 1 1 auto;
  align-content: start;
  gap: 14px;
  min-height: 0;
  padding: 16px;
  overflow: auto;
}

.chat-thread:empty {
  min-height: 0;
}

.message {
  display: grid;
  gap: 6px;
  max-width: 94%;
  padding: 12px 14px;
  border-left: 3px solid var(--line);
  background: #f8f8f8;
}

.message-user {
  justify-self: end;
  border-left-color: var(--ink);
  background: #ffffff;
}

.message-assistant {
  justify-self: start;
  border-left-color: #b1b4b6;
  background: #fffdf7;
}

.message--linked {
  border-left-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(29, 112, 184, 0.16);
}

.message__meta {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.message__text {
  white-space: pre-wrap;
}

.message__text--interaction {
  font-size: 18px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.message__text--thinking {
  min-height: 28px;
  display: flex;
  align-items: center;
}

.typing-dots {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.35;
  animation: typing-dot 900ms ease-in-out infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 120ms;
}

.typing-dots span:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes typing-dot {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 0.9;
    transform: translateY(-2px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .typing-dots span {
    animation: none;
  }
}

.message__text--structured {
  display: grid;
  gap: 10px;
  white-space: normal;
}

.message__text--structured p {
  margin: 0;
}

.answer-ack {
  color: var(--muted);
  font-size: 16px;
}

.answer-section {
  display: grid;
  gap: 3px;
}

.answer-section h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
}

.answer-section-check {
  padding: 7px 0 0 10px;
  background: transparent;
  border-left: 3px solid #b58800;
}

.inline-citations {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-left: 5px;
  white-space: nowrap;
}

.citation-link {
  min-height: 0;
  padding: 0 2px;
  color: var(--blue);
  background: transparent;
  border: 0;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.citation-link:hover,
.citation-link.is-citation-highlighted {
  color: var(--blue-dark);
  background: #eef7ff;
}

.answer-disclosure,
.source-disclosure {
  color: var(--muted);
  font-size: 15px;
}

.answer-disclosure summary,
.source-disclosure summary {
  width: fit-content;
  color: var(--blue);
  cursor: pointer;
  font-weight: 700;
}

.answer-disclosure p,
.source-disclosure p {
  margin: 7px 0 0;
}

.source-disclosure ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.message__sources {
  display: grid;
  gap: 6px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 15px;
}

.message-evidence-disclosure {
  width: fit-content;
  max-width: 100%;
}

.message-evidence-disclosure[open] {
  width: 100%;
}

.evidence-section {
  display: grid;
  gap: 5px;
  margin-top: 10px;
}

.evidence-section h3 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.3;
}

.evidence-source-list {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.evidence-source-list .source-ref-button {
  width: 100%;
}

.message-evidence-actions {
  margin-top: 10px;
}

.source-summary {
  color: var(--muted);
  font-weight: 700;
}

.message-source-ref {
  display: inline;
}

.message__sources a,
.source-ref-button {
  font-weight: 700;
}

.source-ref-button {
  display: inline-flex;
  width: auto;
  min-height: 30px;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid #b1b4b6;
  text-align: left;
  text-decoration: none;
}

.source-ref-button small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.source-ref-button:hover,
.is-citation-highlighted .source-ref-button {
  background: #f3f2f1;
}

.source-citation-marker {
  color: var(--blue);
  font-weight: 700;
}

.source-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.message__tools {
  margin-top: 4px;
}

.message__tools .button {
  padding-right: 0;
  padding-left: 0;
  color: var(--blue);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.message__tools .button:hover {
  color: var(--blue-dark);
  background: transparent;
  text-decoration: underline;
}

.source-dot,
.status-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  background: var(--green);
  border-radius: 0;
}

.source-dot[data-source-state="warning"] {
  background: #b58800;
}

.coverage-warning {
  padding: 7px 8px;
  color: var(--ink);
  background: #fff7bf;
  border-left: 4px solid #b58800;
  font-size: 15px;
  font-weight: 700;
}

.typing-caret::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: -0.15em;
  background: var(--ink);
  animation: caret-pulse 850ms steps(1) infinite;
}

@keyframes caret-pulse {
  50% {
    opacity: 0;
  }
}

.composer {
  position: relative;
  z-index: 2;
  display: grid;
  flex: 0 0 auto;
  gap: 8px;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.composer-status {
  min-height: 32px;
  padding: 6px 8px;
  background: #f8f8f8;
  border-left: 3px solid #b1b4b6;
}

.artifact-handle {
  display: none;
  position: absolute;
  z-index: 18;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--artifact-handle-w);
  padding: 8px 6px;
  align-content: center;
  gap: 8px;
  background: #f3f2f1;
  border-left: 1px solid var(--line);
}

.artifact-handle button {
  display: grid;
  min-height: 46px;
  align-content: center;
  justify-items: center;
  gap: 2px;
  padding: 5px 3px;
  color: var(--ink);
  background: #ffffff;
  border: 2px solid var(--ink);
  border-radius: 0;
  font-size: 13px;
  font-weight: 700;
}

.artifact-handle [data-source-count] {
  min-width: 22px;
  padding: 1px 4px;
  color: var(--ink);
  background: var(--amber);
  font-size: 12px;
}

.artifact-window-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.composer-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.composer textarea,
.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 42px;
  padding: 8px;
  color: var(--ink);
  background: #ffffff;
  border: 2px solid var(--ink);
  border-radius: 0;
}

.composer textarea {
  min-height: 60px;
  max-height: 140px;
  overflow-y: hidden;
  resize: none;
}

.composer-actions {
  justify-content: flex-end;
}

.composer-actions [data-primary-action] {
  min-width: 112px;
}

.composer-actions [data-primary-action][data-action-mode="cancel"] {
  color: #2b1700;
  background: #ffdd00;
  box-shadow: 0 2px 0 #b58800;
}

.composer-classer {
  display: grid;
  gap: 0;
  margin-top: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.classer-toggle {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  color: var(--ink);
  background: #ffffff;
  border: 0;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  text-align: left;
}

.classer-toggle:not(:disabled) {
  cursor: pointer;
}

.classer-toggle:hover:not(:disabled) {
  background: #f3f2f1;
}

.classer-toggle:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

.classer-chevron {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  transform-origin: center;
  transition: transform 140ms ease-out;
}

.composer-classer[data-expanded="true"] .classer-chevron {
  transform: rotate(90deg);
}

.classer-toggle__label {
  white-space: nowrap;
}

.classer-toggle__hint {
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.classer-options {
  display: grid;
  gap: 12px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.classer-options[hidden] {
  display: none;
}

.classer-actions {
  justify-content: flex-end;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
  color: var(--muted);
  font-size: 15px;
}

.status-line[data-status-state="loading"] .status-dot {
  background: #b58800;
  animation: status-pulse 900ms ease-in-out infinite;
}

.status-line[data-status-state="error"] .status-dot {
  background: var(--red);
}

@keyframes status-pulse {
  50% {
    opacity: 0.35;
  }
}

.dossier-pane {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 0;
}

.dossier-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid #e6e6e6;
}

.tab-button {
  min-height: 48px;
  padding: 8px;
  color: var(--ink);
  background: #fafafa;
  border: 0;
  border-right: 1px solid #e6e6e6;
  font-size: 16px;
  font-weight: 700;
}

.tab-button[aria-selected="true"] {
  background: #ffffff;
  border-top: 4px solid var(--amber);
}

.dossier-view {
  display: none;
  padding: 14px;
}

.dossier-view[data-active="true"] {
  display: grid;
  gap: 12px;
  align-content: start;
  overflow: auto;
}

.work-section {
  display: grid;
  gap: 8px;
  padding: 10px 0 12px;
  border-top: 1px solid #e6e6e6;
  border-left: 0;
  background: #ffffff;
}

.work-section:first-child {
  border-top: 0;
  padding-top: 0;
}

.work-section h3 {
  font-size: 18px;
  line-height: 1.25;
}

.work-section details {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.work-section summary {
  font-weight: 700;
  cursor: pointer;
}

.facts-list,
.source-list,
.history-list,
.validation-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.facts-list li,
.source-list li,
.history-list li,
.validation-list li {
  padding: 8px 0;
  background: transparent;
  border-top: 1px solid #e6e6e6;
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
}

.source-list strong {
  display: block;
}

.source-list small,
.history-list small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.source-list li.is-highlighted {
  border-color: var(--ink);
  box-shadow: inset 6px 0 0 var(--amber);
  background: #fff7bf;
}

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

.field {
  display: grid;
  gap: 4px;
}

.field-full {
  grid-column: 1 / -1;
}

.lock-errors {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 20px;
  color: var(--red);
  font-size: 16px;
  font-weight: 700;
}

.modal {
  width: min(calc(100% - 32px), 720px);
  padding: 0;
  border: 3px solid var(--ink);
  border-radius: 0;
}

.modal::backdrop {
  background: rgba(11, 12, 12, 0.72);
}

.modal__header,
.modal__body {
  padding: 18px;
}

.modal__header {
  border-top: 7px solid var(--ink);
  border-bottom: 1px solid var(--line);
}

.hidden {
  display: none !important;
}

.view-switch[hidden],
.nav-drawer-backdrop[hidden] {
  display: none !important;
}

.nav-drawer-backdrop {
  display: none;
}

@media (max-width: 1180px) {
  .workspace-mobile-controls {
    display: grid;
    position: sticky;
    top: 8px;
    z-index: 65;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    min-height: 108px;
    padding-left: 0;
    padding-top: 24px;
    padding-bottom: 24px;
    pointer-events: none;
  }

  .mobile-nav-buttons {
    position: absolute;
    z-index: 2;
    top: 0;
    left: 0;
    display: block;
    width: 46px;
    pointer-events: auto;
  }

  .mobile-nav-buttons .compact-nav-button {
    position: absolute;
    left: 0;
    width: 46px;
  }

  .mobile-menu-button {
    top: -52px;
  }

  .mobile-new-question-button {
    top: 1px;
  }

  .mobile-current-question {
    min-height: 38px;
    color: var(--ink);
    background: #ffffff;
    border: 2px solid var(--ink);
    font-weight: 700;
  }

  .mobile-current-question {
    display: grid;
    min-width: 0;
    gap: 1px;
    margin-left: 22px;
    padding: 8px 10px 8px 64px;
    text-align: left;
    border-top: 7px solid var(--nav);
    box-shadow: var(--panel-shadow);
    pointer-events: auto;
  }

  .mobile-current-question[hidden] {
    display: none;
  }

  .mobile-current-question span {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.1;
    text-transform: uppercase;
  }

  .mobile-current-question strong {
    overflow: hidden;
    font-size: 14px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .workspace-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100svh - 220px);
    padding-bottom: 16px;
  }

  .workspace-shell[data-artifact-state="empty"] {
    grid-template-columns: 1fr;
  }

  .workspace-shell[data-rail-state="compact"],
  .workspace-shell[data-rail-state="expanded"] {
    --rail-w: 0px;
  }

  .dossier-pane {
    max-height: none;
  }

  .view-switch {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .view-switch button {
    min-height: 38px;
    color: var(--ink);
    background: #ffffff;
    border: 2px solid var(--ink);
    font-weight: 700;
  }

  .view-switch button[aria-pressed="true"] {
    background: var(--amber);
  }

  .view-switch button:disabled {
    color: var(--muted);
    background: #f3f2f1;
    border-color: var(--line);
    cursor: not-allowed;
  }

  .workspace-sidebar {
    position: fixed;
    z-index: 80;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(88vw, 340px);
    max-height: none;
    border-top: 6px solid var(--ink);
    transform: translateX(-105%);
    transition: transform 160ms ease-out;
  }

  .workspace-shell[data-rail-state="drawer-open"] .workspace-sidebar,
  .workspace-sidebar[data-open="true"] {
    transform: translateX(0);
  }

  .workspace-shell[data-rail-state="drawer-open"] .rail-compact-nav,
  .workspace-shell[data-rail-state="drawer-closed"] .rail-compact-nav,
  .workspace-shell[data-rail-state="compact"] .rail-compact-nav,
  .workspace-shell[data-rail-state="expanded"] .rail-compact-nav {
    display: none;
  }

  .workspace-shell[data-rail-state="drawer-open"] .rail-workspace,
  .workspace-shell[data-rail-state="drawer-open"] .rail-actions,
  .workspace-shell[data-rail-state="drawer-open"] .rail-nav,
  .workspace-shell[data-rail-state="drawer-open"] .rail-bottom,
  .workspace-shell[data-rail-state="drawer-closed"] .rail-workspace,
  .workspace-shell[data-rail-state="drawer-closed"] .rail-actions,
  .workspace-shell[data-rail-state="drawer-closed"] .rail-nav,
  .workspace-shell[data-rail-state="drawer-closed"] .rail-bottom {
    display: grid;
  }

  .nav-drawer-backdrop {
    position: fixed;
    z-index: 70;
    inset: 0;
    display: block;
    background: rgba(11, 12, 12, 0.62);
  }

  body.drawer-open {
    overflow: hidden;
  }

  .workspace-shell[data-artifact-panel="collapsed"] .chat-pane,
  .workspace-shell[data-artifact-panel="source-open"] .chat-pane,
  .workspace-shell[data-artifact-panel="review-open"] .chat-pane,
  .workspace-shell[data-artifact-panel="export-open"] .chat-pane {
    padding-right: 0;
  }

  .artifact-handle {
    position: fixed;
    top: auto;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 6px;
    border: 2px solid var(--ink);
    box-shadow: 0 2px 0 #929191;
  }

  .workspace-shell[data-artifact-panel="source-open"] .artifact-handle,
  .workspace-shell[data-artifact-panel="review-open"] .artifact-handle,
  .workspace-shell[data-artifact-panel="export-open"] .artifact-handle {
    display: none;
  }

  .workspace-shell[data-artifact-panel="source-open"] .dossier-pane,
  .workspace-shell[data-artifact-panel="review-open"] .dossier-pane,
  .workspace-shell[data-artifact-panel="export-open"] .dossier-pane {
    position: fixed;
    z-index: 80;
    top: 76px;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    min-width: 0;
  }
}

@media (max-width: 900px) {
  html,
  body {
    overflow-x: hidden;
  }

  .service-header__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: start;
  }

  .service-nav {
    grid-column: 1 / -1;
    flex-wrap: wrap;
  }

  .workspace-shell[data-mobile-view="chat"] .dossier-pane,
  .workspace-shell[data-mobile-view="dossier"] .chat-pane {
    display: none;
  }

  .chat-pane,
  .dossier-pane {
    min-height: auto;
    height: auto;
    max-height: none;
  }

  .workspace-shell[data-mobile-view="chat"] .chat-pane {
    min-height: calc(100svh - 360px);
  }

  .workspace-shell[data-artifact-state="empty"] .dossier-pane {
    display: none;
  }

  .chat-pane .pane-meta .tag {
    display: none;
  }

  .chat-pane .pane-header__top {
    display: none;
  }

  .chat-pane .pane-header {
    padding-top: 10px;
  }

  .chat-pane .pane-meta {
    margin-top: 0;
  }

  .chat-pane .chat-thread {
    padding-top: 34px;
  }
}

@media (max-width: 620px) {
  body {
    font-size: 17px;
  }

  main {
    padding-bottom: 12px;
  }

  .brand__name {
    font-size: 26px;
  }

  .field-grid,
  .dossier-tabs {
    grid-template-columns: 1fr;
  }

  .dossier-pane .pane-header__top {
    display: grid;
  }

  .dossier-pane .pane-header__top .button {
    width: 100%;
  }

  .composer {
    gap: 5px;
    padding: 8px 10px;
  }

  .composer textarea {
    min-height: 58px;
  }

  .composer .button-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .composer .button {
    min-height: 34px;
    padding: 7px 5px 6px;
    font-size: 15px;
  }

  .message {
    max-width: 100%;
  }
}

/* ---- Answer per-block cards ---- */
.answer-section {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  margin: 10px 0;
  border-left: 4px solid #d2d2d2;
  border-radius: 3px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.answer-section h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}

.answer-section h3::before {
  font-size: 17px;
}

.answer-section[data-section-type="answer"] {
  border-left-color: #1d70b8;
  background: #f8fbff;
}

.answer-section[data-section-type="answer"] h3::before {
  content: "▸";
  color: #1d70b8;
}

.answer-section[data-section-type="why"] {
  border-left-color: #5694ca;
  background: #f9fcfe;
}

.answer-section[data-section-type="why"] h3::before {
  content: "•";
  color: #5694ca;
  font-size: 22px;
}

.answer-section.answer-section-check {
  border-left-color: #d4351c;
  background: #fff8f6;
}

.answer-section.answer-section-check h3::before {
  content: "⚠";
  color: #d4351c;
}

.answer-ack {
  display: block;
  padding: 6px 14px;
  margin: 6px 0 4px;
  color: #505a5f;
  font-size: 15px;
  font-style: italic;
  border-left: 3px solid #b1b4b6;
  background: #fafafa;
  border-radius: 2px;
}

.message__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.message__text--structured p {
  margin: 0;
  line-height: 1.55;
}

.message__text--structured p + p {
  margin-top: 6px;
}

.answer-list {
  margin: 4px 0;
  padding-left: 22px;
  list-style: decimal;
}

.answer-list li {
  margin: 3px 0;
  line-height: 1.5;
  padding-left: 4px;
}

/* ---- Source ref card layout ---- */
[data-source-ref-row] {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  margin: 8px 0;
  border-left: 3px solid #b1b4b6;
  border-radius: 3px;
  background: #fafafa;
  list-style: none;
}

.source-ref-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.source-ref-corpus {
  font-size: 13px;
  color: var(--muted);
}

.source-ref-passage {
  margin: 4px 0;
  padding: 8px 10px;
  border-left: 2px solid #1d70b8;
  background: #f4f8fc;
  font-style: italic;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.source-ref-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.source-ref-route,
.source-ref-action {
  color: var(--muted);
  font-size: 13px;
}

.source-ref-link {
  font-size: 14px;
  font-weight: 600;
}
