:root {
  color-scheme: light;
  --background: #f6f8fb;
  --surface: #ffffff;
  --text: #172033;
  --muted: #667085;
  --subtle: #98a2b3;
  --border: #e7eaf0;
  --primary: #2563eb;
  --primary-soft: #eff6ff;
  --green: #15803d;
  --green-soft: #ecfdf3;
  --orange: #b54708;
  --orange-soft: #fffaeb;
  --red: #b42318;
  --red-soft: #fef3f2;
  --gray: #475467;
  --gray-soft: #f2f4f7;
  --shadow: 0 1px 2px rgb(16 24 40 / 4%);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--background);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 15px;
  line-height: 1.65;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 40;
  top: 10px;
  left: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--text);
  color: #fff;
  text-decoration: none;
  transform: translateY(-160%);
}

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

.app-shell {
  min-height: 100vh;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.muted {
  color: var(--muted);
}

.button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.button:focus-visible,
.queue-item:focus-visible,
.reference-inline:focus-visible,
.evidence-button:focus-visible,
.image-attachment:focus-visible,
.search-field:focus-within,
.login-field input:focus-visible,
.store-switch-option:focus-visible {
  outline: 3px solid rgb(37 99 235 / 22%);
  outline-offset: 2px;
}

.button-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.button-primary:hover:not(:disabled) {
  border-color: #1d4ed8;
  background: #1d4ed8;
}

.button-quiet {
  border-color: var(--border);
  background: var(--surface);
}

.button-quiet:hover:not(:disabled) {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.button-outline {
  border-color: #b8c6dc;
  background: var(--surface);
  color: #344054;
}

.button-outline:hover:not(:disabled) {
  border-color: #7f9dcc;
  background: #f8fbff;
  color: #1d4ed8;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(680px, 100%);
  padding: clamp(24px, 5vw, 48px);
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 4px 0 12px;
  font-size: clamp(25px, 3vw, 30px);
  line-height: 1.25;
}

.intro,
.queue-boundary,
.login-boundary {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.inline-state,
.pane-state {
  margin: 14px 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
}

.pane-state[data-kind="warning"],
.inline-state[data-kind="warning"] {
  border-color: #fedf89;
  background: var(--orange-soft);
  color: #8a4b06;
}

.pane-state[data-kind="error"],
.inline-state[data-kind="error"] {
  border-color: #fecdca;
  background: var(--red-soft);
  color: var(--red);
}

.login-form {
  display: grid;
  gap: 14px;
  margin: 18px 0;
}

.login-field {
  display: grid;
  gap: 7px;
  color: var(--gray);
  font-size: 13px;
  font-weight: 600;
}

.login-field input {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  line-height: 1.4;
}

.login-field input:hover {
  border-color: #cbd5e1;
}

.login-field input:focus {
  border-color: var(--primary);
  outline: 0;
}

.login-submit {
  width: 100%;
  margin-top: 4px;
}

.login-boundary {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.workbench-screen {
  width: min(1600px, 100%);
  min-height: 100vh;
  margin: 0 auto;
}

.app-header {
  display: flex;
  min-height: 64px;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 9px 20px;
  border-bottom: 1px solid var(--border);
  background: rgb(255 255 255 / 94%);
}

.brand-lockup {
  display: flex;
  flex: 1 1 190px;
  align-items: baseline;
  gap: 8px;
}

.brand-lockup h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.brand-version {
  color: var(--subtle);
  font-size: 12px;
  font-weight: 600;
}

.session-summary {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  font-size: 12px;
}

.session-field {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
}

.session-label {
  color: var(--subtle);
  font-size: 12px;
}

.session-user {
  max-width: 120px;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-account {
  display: inline-block;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.store-chip,
.count-chip,
.status-tag,
.metric-chip,
.source-chip,
.confidence-chip,
.analysis-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--gray);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.store-switch {
  position: relative;
}

.store-switch-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  width: max-content;
  min-width: 184px;
  gap: 3px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 12px 28px rgb(16 24 40 / 12%);
}

.store-switch-option {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.store-switch-option:hover:not(:disabled),
.store-switch-option[aria-current="true"] {
  background: var(--primary-soft);
  color: #1d4ed8;
}

.store-switch-option small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.data-cutoff {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  max-width: 180px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
}

.data-cutoff-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #98a2b3;
}

.data-cutoff[data-freshness="normal"] .data-cutoff-dot {
  background: #22a06b;
}

.data-cutoff[data-freshness="stale"] .data-cutoff-dot,
.data-cutoff[data-freshness="very_stale"] .data-cutoff-dot {
  background: #d08b13;
}

.offline-demo-banner {
  margin: 12px 20px 0;
  padding: 9px 12px;
  border: 1px solid #b8d4ff;
  border-radius: 8px;
  background: var(--primary-soft);
  color: #1d4ed8;
  font-size: 13px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 312px minmax(0, 1fr);
  min-height: calc(100vh - 64px);
}

.panel {
  background: var(--surface);
}

.action-queue-pane {
  position: sticky;
  top: 0;
  display: flex;
  height: calc(100vh - 64px);
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  padding: 20px 16px;
  border-right: 1px solid var(--border);
}

.workspace-switcher {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--gray-soft);
}

.workspace-switcher button {
  min-height: 36px;
  padding: 6px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.workspace-switcher button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow);
}

.workspace-switcher button:focus-visible {
  outline: 3px solid var(--primary-soft);
  outline-offset: 2px;
}

.queue-content {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 14px;
}

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

.panel-heading h2 {
  margin: 2px 0 0;
  font-size: 20px;
  line-height: 1.25;
}

.count-chip {
  min-width: 26px;
  justify-content: center;
}

.queue-boundary {
  margin-top: -4px;
}

.search-field {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
}

.search-field svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-width: 1.8;
}

.search-field input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.search-field input::placeholder {
  color: var(--subtle);
}

.action-queue-pane .pane-state {
  flex: 0 0 auto;
  margin: 0;
}

.action-queue-list {
  display: grid;
  min-height: 0;
  flex: 1;
  align-content: start;
  gap: 16px;
  overflow: auto;
  padding: 2px 1px 10px;
}

.queue-section {
  display: grid;
  gap: 7px;
}

.queue-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.queue-section-heading span:last-child {
  color: var(--subtle);
}

.queue-empty {
  margin: 0;
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.all-customers-disclosure {
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.all-customers-disclosure > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.all-customers-disclosure[open] > summary {
  color: var(--text);
}

.all-customers-list {
  display: grid;
  gap: 5px;
  margin-top: 8px;
}

.queue-item {
  display: grid;
  width: 100%;
  gap: 6px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.queue-item:hover {
  background: #f8fafc;
}

.queue-item[aria-pressed="true"] {
  border-color: #93c5fd;
  background: var(--primary-soft);
}

.queue-item-header,
.queue-item-meta,
.message-header,
.message-tags,
.analysis-meta,
.timeline-metrics,
.customer-header-meta,
.action-card-meta,
.action-card-actions,
.communication-points-header {
  display: flex;
  align-items: center;
  gap: 7px;
}

.queue-item-header {
  justify-content: space-between;
}

.queue-item-name {
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-item-summary {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.queue-item-meta {
  color: var(--subtle);
  font-size: 12px;
}

.queue-item .status-tag.status-tag--manual-check {
  border-color: #f3d49d;
  background: #fffbeb;
  color: #8a5a00;
}

.status-tag[data-status="action_recommended"] {
  border-color: #bfdbfe;
  background: var(--primary-soft);
  color: #1d4ed8;
}

.status-tag[data-status="waiting"] {
  border-color: #abefc6;
  background: var(--green-soft);
  color: var(--green);
}

.status-tag[data-status="manual_check"] {
  border-color: #fedf89;
  background: var(--orange-soft);
  color: var(--orange);
}

.status-tag[data-status="blocked"] {
  border-color: #fecdca;
  background: var(--red-soft);
  color: var(--red);
}

.status-tag[data-status="unknown"] {
  background: var(--gray-soft);
  color: var(--gray);
}

.queue-show-all {
  width: 100%;
  flex: 0 0 auto;
}

.customer-action-pane {
  min-width: 0;
  padding: 26px;
}

.action-panel,
.action-panel-state {
  width: min(960px, 100%);
  margin: 0 auto;
}

.action-panel {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.action-panel > * {
  min-width: 0;
}

.action-panel-state {
  margin-top: 30px;
}

.customer-action-header {
  display: grid;
  gap: 8px;
  padding: 4px 0 8px;
}

.customer-heading-row {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.customer-action-header h2 {
  min-width: 0;
  flex: 1 1 auto;
  margin: 0;
  font-size: clamp(28px, 3vw, 32px);
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.customer-header-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.stage-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid #d0d5dd;
  border-radius: 999px;
  color: var(--gray);
  font-size: 12px;
  font-weight: 600;
}

.customer-header-meta {
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.customer-header-id {
  color: var(--subtle);
  font-size: 12px;
  white-space: nowrap;
}

.freshness-notice {
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid #f3d49d;
  border-radius: 12px;
  background: #fffbeb;
  color: #7a560b;
  font-size: 13px;
  line-height: 1.4;
}

.freshness-notice-row {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.freshness-notice-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: #b77916;
}

.freshness-notice-summary {
  min-width: 0;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.freshness-details {
  flex: 0 0 auto;
  margin-left: auto;
}

.freshness-details > summary,
.next-action-details > summary,
.future-communication > summary,
.evidence-disclosure > summary {
  cursor: pointer;
  color: inherit;
  font-size: 12px;
  font-weight: 600;
  list-style: none;
  white-space: nowrap;
}

.freshness-details > summary::-webkit-details-marker,
.next-action-details > summary::-webkit-details-marker,
.future-communication > summary::-webkit-details-marker,
.evidence-disclosure > summary::-webkit-details-marker {
  display: none;
}

.freshness-details > summary::after,
.next-action-details > summary::after,
.future-communication > summary::after,
.evidence-disclosure > summary::after {
  margin-left: 4px;
  content: "+";
}

.freshness-details[open] > summary::after,
.next-action-details[open] > summary::after,
.future-communication[open] > summary::after,
.evidence-disclosure[open] > summary::after {
  content: "−";
}

.freshness-details[open] {
  flex-basis: 100%;
  margin-left: 26px;
}

.freshness-details-copy {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  color: #7a560b;
  font-size: 12px;
}

.freshness-notice[data-freshness="normal"] {
  border-color: #e8dfc6;
  background: #fffdf7;
  color: var(--muted);
}

.freshness-notice[data-freshness="normal"] .freshness-notice-icon {
  color: #8a7b5a;
}

.freshness-notice[data-freshness="unknown"] {
  border-color: #e7eaf0;
  background: #fafbfc;
  color: var(--muted);
}

.freshness-notice[data-freshness="unknown"] .freshness-notice-icon {
  color: var(--subtle);
}

.action-card {
  padding: clamp(22px, 3vw, 26px);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: none;
  overflow-wrap: anywhere;
}

.rfq-scope-note,
.rfq-operation-note {
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.rfq-operation-note {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: #1d4ed8;
}

.rfq-card .detail-list {
  margin-top: 0;
}

.rfq-card .action-card-actions {
  flex-wrap: wrap;
  margin-top: 14px;
  margin-bottom: 14px;
}

.rfq-card .button {
  text-decoration: none;
}

.rfq-assignment-request,
.rfq-background-check {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.rfq-assignment-request h4,
.rfq-background-check h4 {
  margin: 0 0 12px;
  font-size: 16px;
}

.rfq-input-disclosure {
  margin: 14px 0;
}

.rfq-input-disclosure .detail-list {
  margin-top: 12px;
}

.rfq-assignee-field {
  display: grid;
  max-width: 440px;
  gap: 7px;
  margin: 16px 0 10px;
}

.rfq-assignee-field label {
  font-size: 13px;
  font-weight: 600;
}

.rfq-assignee-field select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.rfq-assignee-field select:focus-visible {
  outline: 3px solid var(--primary-soft);
  border-color: var(--primary);
}

.rfq-evidence-list p {
  margin: 4px 0;
}

.rfq-evidence-list code {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.action-card-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.action-card-icon {
  display: inline-flex;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #f2f4f7;
  color: #667085;
}

.ui-icon {
  width: 21px;
  height: 21px;
}

.action-card--situation {
  background: #fff;
}

.action-card--next {
  border-color: #bdd7ff;
  background: #f6faff;
  box-shadow: 0 12px 30px rgb(37 99 235 / 6%);
}

.action-card--next .action-card-icon {
  background: #e7f0ff;
  color: #2563eb;
}

.action-card--communication {
  border-color: #e9e4f3;
  background: #fcfbff;
}

.action-card--communication .action-card-icon {
  background: #f1edff;
  color: #6d5bc5;
}

.action-card--evidence {
  background: #fafbfc;
}

.action-card--evidence .action-card-icon {
  background: #eef1f5;
  color: #667085;
}

.action-card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}

.situation-headline,
.next-action-headline {
  margin: 0;
  max-width: 720px;
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.55;
}

.next-action-headline {
  font-size: clamp(24px, 2.5vw, 28px);
  font-weight: 600;
  line-height: 1.35;
}

.action-card p + p {
  margin-top: 9px;
}

.action-card-description {
  margin: 9px 0 0;
  max-width: 720px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.conditional-follow-up {
  margin: 14px 0 0;
  max-width: 720px;
  color: #344054;
  font-size: 16px;
  line-height: 1.6;
}

.conditional-follow-up strong {
  font-weight: 600;
}

.action-check-label {
  margin: 16px 0 0;
  color: #3b5f9b;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}

.action-card-hint,
.action-card-meta {
  margin: 9px 0 0;
  max-width: 720px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.action-card--situation .situation-headline,
.action-card--situation .action-card-description {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.action-card-meta {
  flex-wrap: wrap;
  font-size: 12px;
}

.next-action-details,
.future-communication,
.evidence-disclosure {
  margin-top: 16px;
}

.next-action-details > summary {
  color: #3b5f9b;
}

.next-action-details-copy {
  display: grid;
  gap: 2px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid #dce8fb;
}

.action-card-actions {
  flex-wrap: wrap;
  margin-top: 16px;
}

.communication-points-header {
  justify-content: space-between;
}

.communication-points-header h3 {
  margin-bottom: 0;
}

.communication-points {
  display: grid;
  gap: 9px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.communication-points li {
  position: relative;
  padding-left: 18px;
  color: var(--text);
  font-size: 14px;
}

.communication-points li::before {
  position: absolute;
  top: 0.67em;
  left: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  content: "";
}

.message-source-details > summary,
.diagnosis-card-header {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.message-source-details > summary:hover {
  color: var(--primary);
}

.next-action-details > summary:hover,
.future-communication > summary:hover,
.evidence-disclosure > summary:hover {
  color: var(--primary);
}

.evidence-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.evidence-button {
  display: grid;
  width: 100%;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.evidence-button:hover:not(:disabled) {
  border-color: #b7c8ef;
  background: var(--primary-soft);
}

.evidence-button span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.action-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 4px 2px;
}

.link-button {
  min-height: auto;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.link-button:hover {
  color: var(--primary);
  text-decoration: underline;
}

.drawer-backdrop {
  position: fixed;
  z-index: 60;
  inset: 0;
  background: rgb(15 23 42 / 30%);
}

.chat-drawer {
  position: fixed;
  z-index: 61;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  width: clamp(480px, 42vw, 560px);
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--surface);
  box-shadow: -12px 0 36px rgb(16 24 40 / 14%);
}

.chat-drawer.chat-drawer--embedded {
  position: static;
  z-index: auto;
  inset: auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  border-left: 0;
  box-shadow: none;
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.drawer-header h2,
.expert-mode-header h2 {
  margin: 2px 0 3px;
  font-size: 20px;
  line-height: 1.35;
}

.drawer-header .muted {
  margin: 0;
  font-size: 12px;
}

.drawer-cutoff {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.timeline-metrics {
  flex-wrap: wrap;
  padding: 12px 20px 0;
}

.timeline-metrics:empty {
  display: none;
}

.timeline-metrics + .pane-state {
  margin: 12px 20px;
}

.timeline-list {
  display: grid;
  min-height: 0;
  flex: 1;
  align-content: start;
  gap: 10px;
  overflow: auto;
  margin: 0;
  padding: 16px 20px;
  list-style: none;
}

.timeline-item {
  display: flex;
}

.timeline-item--buyer {
  justify-content: flex-start;
}

.timeline-item--seller {
  justify-content: flex-end;
}

.timeline-item--system {
  justify-content: center;
}

.timeline-message {
  width: min(100%, 445px);
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.timeline-item--buyer .timeline-message {
  background: #f8fafc;
}

.timeline-item--seller .timeline-message {
  border-color: #cfe0ff;
  background: var(--primary-soft);
}

.timeline-item--system .timeline-message {
  width: 100%;
  border-style: dashed;
  background: #fffbeb;
}

.timeline-message.is-evidence-target {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 18%);
}

.message-header {
  justify-content: space-between;
}

.message-role {
  color: var(--gray);
  font-size: 12px;
  font-weight: 600;
}

.message-time {
  flex: 0 0 auto;
  color: var(--subtle);
  font-size: 11px;
}

.message-text {
  margin: 7px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-text.is-collapsed {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.message-expand-button {
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}

.alibaba-card {
  --card-accent: var(--primary);
  min-width: 0;
  overflow: hidden;
  margin-top: 8px;
  border: 1px solid #dbe5f5;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 1px 2px rgb(16 24 40 / 4%);
}

.alibaba-card--commerce {
  --card-accent: #b54708;
}

.alibaba-card--document,
.alibaba-card--media {
  --card-accent: #475467;
}

.alibaba-card--image {
  --card-accent: #7c3aed;
}

.alibaba-card--order {
  --card-accent: #15803d;
}

.alibaba-card--generic {
  --card-accent: #667085;
}

.alibaba-card-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 9px;
  padding: 11px 11px 9px;
  border-bottom: 1px solid #eef1f6;
}

.alibaba-card-glyph {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--card-accent) 10%, white);
  color: var(--card-accent);
  font-size: 14px;
  font-weight: 700;
}

.alibaba-card-heading,
.alibaba-card-title,
.alibaba-card-summary,
.alibaba-card-field,
.alibaba-card-field dd,
.alibaba-card-note {
  min-width: 0;
  overflow-wrap: anywhere;
}

.alibaba-card-eyebrow {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.35;
}

.alibaba-card-type {
  color: var(--subtle);
  font-weight: 500;
}

.alibaba-card-title {
  margin: 2px 0 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
}

.alibaba-card-status {
  align-self: start;
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--card-accent) 22%, white);
  border-radius: 999px;
  background: color-mix(in srgb, var(--card-accent) 6%, white);
  color: var(--card-accent);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.alibaba-card-summary {
  margin: 0;
  padding: 9px 11px 0;
  color: var(--gray);
  font-size: 12px;
  line-height: 1.55;
}

.alibaba-card-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
  padding: 9px 11px 11px;
}

.alibaba-card-field {
  padding: 7px 8px;
  border-radius: 6px;
  background: #f8fafc;
}

.alibaba-card-field dt {
  color: var(--subtle);
  font-size: 10px;
  line-height: 1.35;
}

.alibaba-card-field dd {
  margin: 2px 0 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.alibaba-card-note {
  margin: 0;
  padding: 8px 11px;
  border-top: 1px solid #eef1f6;
  background: #fbfcfe;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.message-source-details {
  margin-top: 8px;
}

.message-tags {
  flex-wrap: wrap;
  margin-top: 7px;
}

.source-chip {
  min-height: 20px;
  font-size: 11px;
  font-weight: 500;
}

.source-chip--system {
  border-color: #fedf89;
  background: var(--orange-soft);
  color: var(--orange);
}

.source-chip--unknown {
  background: var(--gray-soft);
}

.attachment-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.image-attachment {
  width: 74px;
  height: 62px;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.image-attachment img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-attachment.is-unavailable {
  opacity: 0.45;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
}

.attachment-chip--missing {
  border-color: #fecdca;
  background: var(--red-soft);
  color: var(--red);
}

.timeline-footer {
  padding: 0 20px 20px;
}

.expert-mode-dialog,
.image-lightbox {
  width: min(1020px, calc(100vw - 32px));
  max-height: min(860px, calc(100vh - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--background);
  color: var(--text);
  box-shadow: 0 20px 60px rgb(15 23 42 / 24%);
}

.expert-mode-dialog[open] {
  display: flex;
  height: min(860px, calc(100vh - 32px));
  flex-direction: column;
  overflow: hidden;
}

.expert-mode-dialog.has-evidence {
  width: min(94vw, 1500px);
  height: min(900px, 90vh);
  max-height: 90vh;
}

.expert-mode-dialog::backdrop,
.image-lightbox::backdrop {
  background: rgb(15 23 42 / 36%);
}

.expert-mode-header,
.lightbox-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.expert-mode-header {
  flex: 0 0 auto;
}

.expert-mode-header .muted,
.lightbox-toolbar .muted {
  max-width: 720px;
  margin: 0;
  font-size: 13px;
}

.analysis-meta {
  flex-wrap: wrap;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  background: #fbfcfe;
  color: var(--muted);
  font-size: 12px;
}

.analysis-meta:empty {
  display: none;
}

.analysis-results {
  display: grid;
  max-height: calc(min(860px, 100vh - 32px) - 140px);
  align-content: start;
  grid-auto-rows: max-content;
  gap: 10px;
  overflow: auto;
  padding: 18px 22px 22px;
}

.expert-mode-container {
  container-name: expert-dialog;
  container-type: inline-size;
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.expert-mode-layout {
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
}

.expert-diagnosis-pane {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.expert-diagnosis-pane .analysis-meta {
  flex: 0 0 auto;
}

.expert-diagnosis-pane .analysis-results {
  min-height: 0;
  flex: 1 1 auto;
  max-height: none;
}

.expert-evidence-pane {
  display: flex;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
}

.expert-timeline-host {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
}

.expert-mode-layout.is-evidence-open .expert-diagnosis-pane {
  display: none;
}

.expert-mode-layout.is-evidence-open .expert-evidence-pane {
  display: flex;
}

@container expert-dialog (min-width: 1080px) {
  .expert-mode-layout.is-evidence-open {
    grid-template-columns: minmax(520px, 1.1fr) minmax(420px, 0.9fr);
  }

  .expert-mode-layout.is-evidence-open .expert-diagnosis-pane {
    display: flex;
  }

  .expert-mode-layout.is-evidence-open .expert-evidence-pane {
    border-left: 1px solid var(--border);
  }
}

.diagnosis-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.diagnosis-card--critical {
  border-color: #fecdca;
}

.diagnosis-card--action {
  border-color: #b7c8ef;
}

.diagnosis-card-header {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(0, 2fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  list-style: none;
}

.diagnosis-card-header::-webkit-details-marker {
  display: none;
}

.diagnosis-card-title {
  color: var(--text);
  font-size: 14px;
}

.diagnosis-card-summary {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.diagnosis-card-toggle::after {
  display: inline-block;
  margin-left: 4px;
  content: "⌄";
}

.diagnosis-card[open] .diagnosis-card-toggle::after {
  transform: rotate(180deg);
}

.diagnosis-card[open] .diagnosis-card-summary {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}

.diagnosis-card-body {
  display: grid;
  gap: 14px;
  padding: 0 14px 16px;
  border-top: 1px solid var(--border);
}

.detail-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.detail-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 12px;
}

.detail-row dt {
  color: var(--muted);
  font-size: 12px;
}

.detail-row dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.list-block,
.basis-item,
.hypothesis {
  display: grid;
  gap: 6px;
}

.plain-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
}

.basis-item {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfe;
}

.basis-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.basis-item p,
.hypothesis p,
.detail-empty {
  margin: 0;
  color: var(--muted);
}

.basis-kind {
  color: var(--gray);
  font-size: 12px;
  font-weight: 600;
}

.confidence-chip {
  min-height: 20px;
  font-size: 11px;
}

.evidence-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.reference-inline {
  padding: 4px 7px;
  border: 1px solid #cfe0ff;
  border-radius: 6px;
  background: var(--primary-soft);
  color: #1d4ed8;
  font-size: 11px;
}

.not-evaluated-value,
.unknown-value {
  color: var(--muted);
}

.lightbox-toolbar {
  position: sticky;
  top: 0;
}

.image-lightbox img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 170px);
  margin: 0 auto;
  object-fit: contain;
}

@media (max-width: 900px) {
  .session-summary {
    width: 100%;
    flex: 1 0 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 900px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .action-queue-pane {
    position: static;
    height: auto;
    max-height: 400px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .action-queue-list {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    overflow: auto;
  }

  .customer-action-pane {
    min-width: 0;
  }
}

@media (max-width: 720px) {
  .app-header {
    gap: 9px;
    padding: 14px 16px;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .data-cutoff {
    max-width: calc(100% - 120px);
  }

  .customer-heading-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .freshness-notice-row {
    flex-wrap: wrap;
  }

  .freshness-details {
    margin-left: 26px;
  }

  .freshness-details[open] {
    max-width: none;
  }

  .action-queue-pane,
  .customer-action-pane {
    padding: 16px;
  }

  .action-queue-pane {
    max-height: 48vh;
  }

  .action-queue-list {
    grid-template-columns: 1fr;
  }

  .chat-drawer {
    width: 100vw;
  }

  .drawer-header,
  .timeline-metrics,
  .timeline-list,
  .timeline-footer {
    padding-right: 16px;
    padding-left: 16px;
  }

  .expert-mode-dialog,
  .expert-mode-dialog.has-evidence,
  .image-lightbox {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .expert-mode-header,
  .lightbox-toolbar,
  .analysis-meta,
  .analysis-results {
    padding-right: 16px;
    padding-left: 16px;
  }

  .diagnosis-card-header {
    grid-template-columns: 1fr auto;
  }

  .diagnosis-card-summary {
    grid-column: 1 / -1;
  }

  .detail-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .alibaba-card-header {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .alibaba-card-status {
    grid-column: 2;
  }

  .alibaba-card-fields {
    grid-template-columns: 1fr;
  }
}
