:root {
  --bg: #f4efe6;
  --bg-panel: rgba(255, 255, 255, 0.9);
  --bg-soft: rgba(255, 255, 255, 0.68);
  --line: rgba(25, 33, 41, 0.12);
  --line-strong: rgba(25, 33, 41, 0.2);
  --text: #1b232c;
  --muted: #687380;
  --accent: #c66c2a;
  --accent-soft: rgba(198, 108, 42, 0.12);
  --success: #267654;
  --danger: #a64430;
  --shadow: 0 22px 60px rgba(29, 37, 45, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  color: var(--text);
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(198, 108, 42, 0.16), transparent 35%),
    radial-gradient(circle at top right, rgba(27, 54, 74, 0.08), transparent 24%),
    linear-gradient(180deg, #f8f5ef 0%, #efe8dc 100%);
}

body::-webkit-scrollbar,
.messages::-webkit-scrollbar,
.dashboard::-webkit-scrollbar,
.activity-feed-scroll::-webkit-scrollbar {
  width: 10px;
}

body::-webkit-scrollbar-thumb,
.messages::-webkit-scrollbar-thumb,
.dashboard::-webkit-scrollbar-thumb,
.activity-feed-scroll::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(27, 35, 44, 0.18);
  background-clip: padding-box;
}

body::-webkit-scrollbar-track,
.messages::-webkit-scrollbar-track,
.dashboard::-webkit-scrollbar-track,
.activity-feed-scroll::-webkit-scrollbar-track {
  background: transparent;
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

.shell {
  height: 100vh;
  padding: 18px;
  overflow: hidden;
}

.shell--centered {
  display: grid;
  place-items: center;
}

.frame {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr) 392px;
  gap: 18px;
  height: calc(100vh - 36px);
  align-items: stretch;
}

.frame.frame--left-collapsed {
  grid-template-columns: 52px minmax(0, 1fr) 392px;
}

.frame.frame--right-collapsed {
  grid-template-columns: 286px minmax(0, 1fr) 52px;
}

.frame.frame--left-collapsed.frame--right-collapsed {
  grid-template-columns: 52px minmax(0, 1fr) 52px;
}

.frame--no-rail {
  grid-template-columns: 286px minmax(0, 1fr);
}

.panel-restore {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 12px 0;
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.panel-restore:hover,
.panel-toggle-button:hover {
  border-color: rgba(198, 108, 42, 0.32);
  background: rgba(255, 255, 255, 0.92);
}

.panel-toggle-button {
  display: inline-flex;
  align-items: center;
  min-width: 42px;
  min-height: 42px;
  justify-content: center;
}

.panel-toggle-button--close {
  width: 42px;
  padding: 0;
  border-radius: 50%;
}

.panel-toggle-x {
  font-size: 24px;
  line-height: 1;
  font-weight: 700;
}

.panel-toggle-label {
  white-space: nowrap;
}

.panel-restore span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.panel-toggle-button {
  padding-inline: 12px;
  white-space: nowrap;
}

.panel-toggle-button--close {
  padding-inline: 0;
}

.card {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.panel-title,
.auth-title,
.sidebar-title {
  margin: 12px 0;
  font-family: "Sora", sans-serif;
  letter-spacing: -0.045em;
}

h1,
.panel-title,
.auth-title {
  line-height: 0.96;
}

h1 {
  max-width: 9ch;
  font-size: clamp(38px, 4vw, 60px);
}

.hint,
.auth-copy,
.trace-row p,
.activity-card p,
.feedback-item p,
.dashboard-metric span,
.subtle,
.chat-row p,
.account-chip span,
.summary-item span,
.metric-pair-label,
.field label {
  color: var(--muted);
}

.auth-copy,
.hint,
.trace-row p,
.activity-card p,
.feedback-item p,
.chat-row p {
  line-height: 1.6;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--accent);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-metric,
.trace-row,
.activity-card,
.feedback-item,
.cost-row,
.chat-row,
.queue-card,
.trace-summary-card,
.trace-timeline-card,
.explanation-card,
.drilldown-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.dashboard-metric {
  min-height: 108px;
  padding: 16px;
  display: grid;
  align-content: space-between;
  gap: 8px;
}

.dashboard-metric strong {
  display: block;
  font-size: clamp(17px, 2vw, 24px);
  font-weight: 800;
  line-height: 1.1;
  word-break: normal;
  overflow-wrap: anywhere;
  hyphens: none;
}

.dashboard-metric span {
  display: block;
  font-size: 13px;
}

.segmented,
.feedback-row,
.inline-actions,
.topbar-actions,
.auth-actions,
.composer-footer {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.segmented button,
.ghost-button,
.primary-button,
.vote-button,
.trace-row {
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.segmented button,
.ghost-button,
.primary-button,
.vote-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 16px;
  cursor: pointer;
}

.segmented button,
.ghost-button,
.vote-button {
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
}

.primary-button,
.segmented .is-active {
  border-color: #24313d;
  color: #fff;
  background: linear-gradient(135deg, #1e2831 0%, #334354 100%);
}

.primary-button:disabled,
.ghost-button:disabled,
.chat-row:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.ghost-button:hover,
.primary-button:hover,
.segmented button:hover,
.vote-button:hover,
.trace-row:hover {
  transform: translateY(-1px);
}

.record-button.is-recording {
  border-color: rgba(190, 18, 60, 0.35);
  color: #be123c;
  background: rgba(190, 18, 60, 0.08);
}

.status-pill,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 12px;
}

.status-pill.subtle-pill {
  background: rgba(255, 255, 255, 0.68);
}

.signal-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.signal-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

.tone-success.signal-badge,
.dashboard-metric.tone-success {
  color: var(--success);
  border-color: rgba(38, 118, 84, 0.26);
  background: rgba(38, 118, 84, 0.08);
}

.tone-warning.signal-badge,
.dashboard-metric.tone-warning,
.queue-card.tone-warning,
.activity-card.tone-warning,
.timeline-step.tone-warning,
.explanation-card.tone-warning {
  color: #8a5a1f;
  border-color: rgba(198, 108, 42, 0.22);
  background: rgba(198, 108, 42, 0.08);
}

.tone-accent.signal-badge,
.dashboard-metric.tone-accent,
.queue-card.tone-accent,
.timeline-step.tone-accent,
.explanation-card.tone-accent {
  color: #204f72;
  border-color: rgba(32, 79, 114, 0.22);
  background: rgba(32, 79, 114, 0.08);
}

.tone-blocked.signal-badge,
.activity-card.tone-blocked,
.timeline-step.tone-blocked,
.explanation-card.tone-blocked {
  color: var(--danger);
  border-color: rgba(166, 68, 48, 0.24);
  background: rgba(166, 68, 48, 0.08);
}

.tone-critical.signal-badge,
.activity-card.tone-critical,
.timeline-step.tone-critical,
.explanation-card.tone-critical {
  color: #7d2d20;
  border-color: rgba(125, 45, 32, 0.26);
  background: rgba(166, 68, 48, 0.1);
}

.tone-fallback.signal-badge,
.timeline-step.tone-fallback {
  color: #745320;
  border-color: rgba(116, 83, 32, 0.25);
  background: rgba(198, 174, 110, 0.14);
}

.status-pill::before,
.stage-chip::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.stage-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border-radius: 999px;
  border: 1px solid rgba(198, 108, 42, 0.22);
  background: rgba(198, 108, 42, 0.1);
  color: var(--text);
  font-size: 12px;
}

.sidebar {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 16px;
  padding: 20px;
  min-height: 0;
  overflow: hidden;
}

.sidebar-head,
.sidebar-footer,
.sidebar-status {
  display: grid;
  gap: 10px;
}

.sidebar-title {
  margin: 0;
  font-size: 28px;
}

.sidebar-tools {
  display: grid;
  gap: 10px;
}

.chat-history {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.chat-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.chat-row-shell {
  position: relative;
}

.chat-row {
  width: 100%;
  min-height: 120px;
  padding: 14px 52px 14px 14px;
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.chat-row-delete {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(166, 68, 48, 0.16);
  border-radius: 999px;
  background: rgba(166, 68, 48, 0.06);
  color: var(--danger);
  padding: 0;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
  z-index: 1;
}

.chat-row-delete:hover {
  transform: translateY(-1px);
  border-color: rgba(166, 68, 48, 0.28);
  background: rgba(166, 68, 48, 0.1);
}

.chat-row-shell.is-active .chat-row-delete {
  background: rgba(166, 68, 48, 0.08);
}

.chat-row.is-active,
.chat-row-shell.is-active .chat-row {
  border-color: rgba(198, 108, 42, 0.28);
  background: rgba(198, 108, 42, 0.1);
}

.chat-row-shell.is-working .chat-row {
  border-color: rgba(62, 122, 255, 0.28);
  background: linear-gradient(135deg, rgba(62, 122, 255, 0.12), rgba(255, 255, 255, 0.9));
  box-shadow: 0 18px 38px rgba(62, 122, 255, 0.12);
}

.chat-row-status.is-working {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(62, 122, 255, 0.12);
  color: #275bd6;
  font-weight: 700;
}

.chat-row-status.is-working::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #3e7aff;
  box-shadow: 0 0 0 4px rgba(62, 122, 255, 0.14);
}

.chat-row strong,
.trace-row strong,
.activity-title,
.account-chip strong {
  display: block;
  font-size: 16px;
  line-height: 1.35;
}

.chat-row strong,
.chat-row p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
}

.chat-row strong {
  -webkit-line-clamp: 2;
}

.chat-row p {
  margin: 8px 0 10px;
  -webkit-line-clamp: 3;
}

.chat-row-head {
  display: grid;
  gap: 6px;
}

.account-chip {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.76);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.account-copy {
  display: grid;
  gap: 4px;
}

.loading-card {
  width: min(560px, calc(100vw - 36px));
  padding: 28px;
}

.main-panel,
.side-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.workspace-topbar-copy {
  display: grid;
  gap: 6px;
}

.workspace-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel-title {
  margin: 0 0 4px;
  font-size: 22px;
}

.chat-layout {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  flex: 1;
}

.messages {
  padding: 26px 28px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24) 0%, rgba(255, 255, 255, 0) 100%),
    linear-gradient(90deg, rgba(198, 108, 42, 0.035), transparent 28%);
}

.message {
  max-width: 82%;
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  line-height: 1.7;
  box-shadow: 0 10px 28px rgba(29, 37, 45, 0.06);
}

.message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(198, 108, 42, 0.16), rgba(198, 108, 42, 0.05));
  border-color: rgba(198, 108, 42, 0.22);
}

.message.assistant {
  align-self: flex-start;
}

.message-pending {
  width: min(560px, 82%);
  max-width: min(560px, 82%);
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.message.is-notice {
  max-width: 72%;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(36, 96, 82, 0.08);
  border-color: rgba(36, 96, 82, 0.16);
  color: var(--muted);
  line-height: 1.55;
}

.message-partial_answer {
  max-width: 82%;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(198, 108, 42, 0.08);
  border-color: rgba(198, 108, 42, 0.18);
  color: var(--ink);
}

.message-body {
  word-break: break-word;
}
.message.is-error {
  border-color: rgba(166, 68, 48, 0.24);
  background: rgba(166, 68, 48, 0.06);
}

.handoff-card {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(36, 96, 82, 0.18);
  border-radius: 10px;
  background: rgba(36, 96, 82, 0.06);
}

.handoff-card-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.handoff-card p {
  margin: 6px 0;
}

.handoff-card ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

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

.markdown-body {
  display: grid;
  gap: 12px;
}

.answer-asset-figures {
  display: grid;
  gap: 12px;
}

.markdown-paragraph {
  margin: 0;
}

.markdown-heading {
  margin: 0;
  line-height: 1.3;
  font-weight: 700;
}

.markdown-heading-1 {
  font-size: 1.25rem;
}

.markdown-heading-2 {
  font-size: 1.15rem;
}

.markdown-heading-3 {
  font-size: 1.05rem;
}

.markdown-heading-4 {
  font-size: 1rem;
}

.markdown-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
}

.markdown-list.ordered {
  padding-left: 22px;
}

.markdown-table-wrap {
  overflow-x: auto;
}

.markdown-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.88);
}

.markdown-table th,
.markdown-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.markdown-table th:last-child,
.markdown-table td:last-child {
  border-right: 0;
}

.markdown-table tbody tr:last-child td {
  border-bottom: 0;
}

.markdown-table th {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(25, 33, 41, 0.04);
}

.markdown-pre {
  margin: 0;
  padding: 14px 16px;
  overflow: auto;
  border-radius: 16px;
  background: #18202a;
  color: #f3f6f8;
}

.markdown-body code {
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(25, 33, 41, 0.08);
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 0.92em;
}

.markdown-pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.markdown-body a {
  color: #1f5674;
  text-decoration: none;
  border-bottom: 1px solid rgba(31, 86, 116, 0.24);
}

.markdown-body a:hover {
  border-bottom-color: rgba(31, 86, 116, 0.55);
}

.message-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.live-inline-card {
  display: grid;
  gap: 10px;
}

.progress-card {
  min-height: 0;
  padding: 16px 18px;
  border: 1px solid rgba(198, 108, 42, 0.18);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 250, 245, 0.92), rgba(255, 255, 255, 0.78));
}

.progress-card--compact {
  gap: 14px;
}

.progress-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.pending-kicker {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.progress-title {
  display: block;
  margin: 2px 0 0;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.progress-summary {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.progress-status-line {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
}

.progress-line {
  height: 8px;
  border-radius: 999px;
  background: rgba(198, 108, 42, 0.12);
  overflow: hidden;
}

.progress-reasoning-chain {
  display: grid;
  gap: 8px;
}

.progress-reasoning-step {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid rgba(25, 33, 41, 0.08);
  background: rgba(255, 255, 255, 0.74);
}

.progress-reasoning-step.is-latest {
  border-color: rgba(198, 108, 42, 0.24);
  background: rgba(198, 108, 42, 0.08);
}

.progress-reasoning-kicker {
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.progress-reasoning-text {
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.progress-line-fill {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(198, 108, 42, 0.3), rgba(198, 108, 42, 0.8), rgba(198, 108, 42, 0.3));
  animation: loadingBar 1.5s linear infinite;
}

.progress-card-actions {
  display: flex;
  justify-content: flex-start;
}

.feedback-block {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(27, 35, 44, 0.08);
  display: grid;
  gap: 10px;
}

.vote-button[data-kind="up"].is-selected {
  color: var(--success);
  border-color: rgba(38, 118, 84, 0.28);
  background: rgba(38, 118, 84, 0.1);
}

.vote-button[data-kind="down"].is-selected {
  color: var(--danger);
  border-color: rgba(166, 68, 48, 0.28);
  background: rgba(166, 68, 48, 0.1);
}

.feedback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.feedback-copy {
  margin: 0;
}

.feedback-status {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(38, 118, 84, 0.18);
  background: rgba(38, 118, 84, 0.08);
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
}

.feedback-comment {
  width: 100%;
  min-height: 88px;
  margin-top: 0;
}

.feedback-hint {
  margin-top: 0;
}

.feedback-hint-error {
  color: var(--danger);
}

.feedback-toggle {
  margin-left: auto;
}

.composer {
  padding: 18px 22px 22px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.56);
}

.composer textarea,
.field input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  padding: 14px 16px;
}

.composer textarea {
  min-height: 74px;
  resize: vertical;
}

.attachment-strip {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.attachment-pill {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.84);
}

.attachment-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.attachment-gallery.compact {
  grid-template-columns: 1fr;
  margin-top: 0;
}

.attachment-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
}

.attachment-card.compact {
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
}

.attachment-card-preview {
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: zoom-in;
}

.attachment-card-media,
.attachment-thumb {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(25, 33, 41, 0.08);
}

.attachment-gallery .attachment-card:not(.compact) .attachment-card-media {
  width: 100%;
  height: 148px;
}

.attachment-gallery .attachment-card:not(.compact) .attachment-card-preview {
  display: block;
}

.attachment-card-audio {
  width: 100%;
}

.attachment-pill-copy {
  min-width: 0;
}

.attachment-pill-copy span,
.attachment-card-copy strong {
  display: block;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-card-copy {
  min-width: 0;
}

.attachment-remove {
  border: 0;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
}

.attachment-file-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: rgba(25, 33, 41, 0.06);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.helper-text {
  align-self: center;
}

.trace-list,
.cost-list,
.feedback-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.trace-list,
.feedback-list {
  max-height: 100%;
  overflow: auto;
  padding-right: 4px;
}

.trace-row {
  width: 100%;
  padding: 14px 16px;
  cursor: pointer;
  text-align: left;
}

.trace-row.is-active {
  border-color: rgba(198, 108, 42, 0.28);
  background: var(--accent-soft);
}

.cost-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.dashboard {
  padding: 22px;
  overflow: auto;
}

.dashboard-stack {
  display: grid;
  gap: 22px;
}

.dashboard-section {
  display: grid;
  gap: 14px;
}

.dashboard-toolbar {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.dashboard-context {
  display: grid;
  gap: 4px;
  justify-items: end;
  text-align: right;
  max-width: 360px;
}

.section-label {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.dashboard-grid--summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 18px;
}

.dashboard-columns--overview {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-columns--traces {
  grid-template-columns: minmax(320px, 0.92fr) minmax(0, 1.08fr);
}

.dashboard-columns--feedback {
  grid-template-columns: minmax(280px, 0.86fr) minmax(0, 1.14fr);
}

.queue-card,
.trace-summary-card,
.trace-timeline-card {
  padding: 18px;
}

.queue-card {
  display: grid;
  align-content: start;
  gap: 14px;
}

.queue-list,
.operator-stack,
.drilldown-list {
  display: grid;
  gap: 12px;
}

.trace-workspace {
  align-content: start;
}

.trace-workspace-head {
  display: grid;
  gap: 14px;
}

.trace-detail-tabs {
  margin-top: 4px;
}

.trace-detail-panel {
  padding: 18px;
}

.queue-item {
  padding: 12px 0;
  border-top: 1px solid rgba(25, 33, 41, 0.08);
}

.queue-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.trace-detail-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.66));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.trace-detail-title {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.trace-question {
  margin: 0;
}

.trace-answer-preview {
  margin: 8px 0 0;
}

.metric-pair-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.metric-pair {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.metric-pair-value {
  display: block;
  font-size: 17px;
  line-height: 1.25;
}

.trace-row-meta,
.signal-row,
.timeline-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.signal-row.wrap {
  margin-top: 14px;
}

.trace-timeline {
  display: grid;
  gap: 12px;
}

.timeline-step {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
}

.timeline-marker {
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

.timeline-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.timeline-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: baseline;
}

.timeline-stage,
.explanation-kicker {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.timeline-title,
.explanation-headline {
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.timeline-summary,
.explanation-body {
  margin: 0;
  color: var(--muted);
}

.explanation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.explanation-card {
  padding: 16px;
  display: grid;
  gap: 10px;
}

.detail-rows {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 120px) minmax(0, 1fr);
  gap: 6px 12px;
}

.detail-rows dt {
  color: var(--muted);
  font-size: 12px;
}

.detail-rows dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.drilldown-stack {
  display: grid;
  gap: 12px;
}

.drilldown-card {
  overflow: hidden;
}

.drilldown-card summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 16px;
  font-weight: 700;
}

.drilldown-card summary::-webkit-details-marker {
  display: none;
}

.drilldown-body,
.drilldown-list {
  padding: 0 16px 16px;
}

.drilldown-list-item {
  display: grid;
  gap: 6px;
  padding: 12px 0;
  border-top: 1px solid rgba(25, 33, 41, 0.08);
}

.drilldown-list-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.summary-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  padding: 12px 14px;
}

.summary-item span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.summary-item strong {
  display: block;
  font-size: 18px;
  line-height: 1.2;
}

.feedback-item {
  padding: 16px;
  display: grid;
  gap: 8px;
}

.feedback-item strong,
.queue-item strong,
.trace-detail-title {
  overflow-wrap: anywhere;
}

.side-panel {
  padding: 20px;
  gap: 14px;
}

.side-panel .detail-rows {
  grid-template-columns: minmax(0, 96px) minmax(0, 1fr);
}

.side-panel-head {
  flex: 0 0 auto;
}

.activity-feed-scroll {
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  padding-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-padding-block-end: 16px;
}

.activity-card {
  padding: 14px 16px;
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78) 0%, rgba(255, 255, 255, 0.66) 100%);
}

.activity-card--compact {
  display: grid;
  gap: 6px;
}

.activity-compact-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.activity-compact-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.side-panel-stack {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
}

.side-panel-stack--compact {
  grid-template-rows: minmax(0, 1fr);
}

.side-panel-feed-card {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.side-panel-feed-card--single {
  min-height: 0;
}

.side-panel-feed-card .activity-card {
  padding: 12px 14px;
}

.side-panel-feed-card .activity-tags,
.side-panel-feed-card .detail-rows {
  display: none;
}

.side-panel-feed-card .activity-summary {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.side-panel-feed-card--single .activity-card--compact {
  gap: 8px;
}

.side-panel-feed-card--single .activity-summary {
  -webkit-line-clamp: 5;
}

.live-event-stack {
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  gap: 10px;
}

.inspector-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.inspector-stat-grid--compact {
  grid-template-columns: minmax(0, 1fr);
}

.inspector-stat-card {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
}

.inspector-stat-value {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.activity-card-header {
  display: grid;
  gap: 10px;
  margin-bottom: 8px;
}

.activity-stage-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: baseline;
}

.activity-stage {
  display: inline-flex;
  width: fit-content;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.activity-title {
  letter-spacing: -0.02em;
}

.activity-summary {
  margin: 0;
}

.activity-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.activity-card.is-latest {
  border-color: rgba(198, 108, 42, 0.28);
  background: rgba(198, 108, 42, 0.08);
}

.activity-card.is-latest::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(198, 108, 42, 0.9), rgba(198, 108, 42, 0.3));
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.48);
  color: var(--muted);
}

.empty-state.compact {
  padding: 14px;
}

.welcome-state {
  min-height: 160px;
  display: grid;
  align-content: center;
  gap: 10px;
}

.main-empty-state {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 28px;
}

.main-empty-state .empty-state {
  width: min(640px, 100%);
}

.empty-state-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
  min-height: 100vh;
}

.auth-hero,
.auth-panel {
  padding: min(6vw, 64px);
}

.auth-hero {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: min(100%, 520px);
  padding: 34px;
}

.auth-summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.auth-hero-copy {
  display: grid;
  gap: 16px;
  max-width: 680px;
}

.auth-card .empty-state {
  margin-bottom: 12px;
}

.loading-card,
.auth-card,
.trace-summary-card,
.trace-detail-card,
.queue-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.76));
}

.auth-card form {
  display: grid;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 0;
}

.auth-actions {
  align-items: center;
  flex-wrap: nowrap;
  margin-top: 4px;
}

.auth-actions .primary-button,
.auth-actions .ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  line-height: 1;
  white-space: nowrap;
  flex: 0 0 auto;
}

.admin-link {
  text-decoration: none;
}

.error-state {
  margin-top: 16px;
  color: var(--danger);
}

.feedback-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.media-preview-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 24, 32, 0.58);
  backdrop-filter: blur(10px);
}

.media-preview-modal {
  width: min(1100px, 100%);
  max-height: min(92vh, 960px);
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 80px rgba(18, 24, 32, 0.22);
}

.media-preview-stage {
  display: grid;
  place-items: center;
  overflow: auto;
  max-height: calc(92vh - 120px);
  padding: 8px;
  border-radius: 22px;
  background: rgba(25, 33, 41, 0.04);
}

.media-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.media-preview-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.media-preview-image {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(92vh - 136px);
  object-fit: contain;
  border-radius: 22px;
}

@keyframes loadingBar {
  0% {
    transform: translateX(-130%);
  }
  100% {
    transform: translateX(260%);
  }
}

@media (max-width: 1320px) {
  .frame {
    grid-template-columns: 272px minmax(0, 1fr) 344px;
  }
}

@media (max-width: 1040px) {
  html,
  body,
  #app,
  .shell {
    overflow: auto;
    height: auto;
  }

  .frame {
    height: auto;
    grid-template-columns: 1fr;
  }

  .sidebar,
  .main-panel,
  .side-panel {
    min-height: 320px;
  }

  .dashboard-columns {
    grid-template-columns: 1fr;
  }

  .dashboard-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .dashboard-context {
    justify-items: start;
    text-align: left;
  }
}

@media (max-width: 900px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-summary-grid,
  .metric-grid,
  .dashboard-grid,
  .summary-grid,
  .metric-pair-grid,
  .explanation-grid {
    grid-template-columns: 1fr;
  }

  .auth-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 12px;
  }

  .topbar,
  .messages,
  .composer,
  .dashboard,
  .side-panel,
  .sidebar {
    padding: 18px;
  }

  .inspector-stat-grid {
    grid-template-columns: 1fr;
  }

  .message {
    max-width: 100%;
  }
}

/* Admin trace inspector embedded into normal chat. */
.message-admin-panel {
  margin-top: 0.75rem;
}

.message-admin-toggle {
  font-size: 0.82rem;
  padding: 0.45rem 0.7rem;
}

.message-admin-card {
  margin-top: 0.6rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  padding: 0.85rem;
  background: rgba(15, 23, 42, 0.38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.message-admin-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.message-admin-head p {
  margin: 0.2rem 0 0;
}

.message-admin-tabs {
  margin: 0.55rem 0 0.75rem;
  flex-wrap: wrap;
}

.message-admin-section {
  display: grid;
  gap: 0.65rem;
}

.detail-mini-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.trace-raw-pre {
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
}

.attachment-card-copy strong,
.attachment-card-copy small {
  display: block;
  overflow-wrap: anywhere;
}

/* Round 5: live progress is a service line, not a fake assistant message. */
.service-progress-message {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(31, 86, 116, 0.14);
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.82);
  color: var(--text);
}

.service-progress-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
}

.service-progress-dot {
  width: 9px;
  height: 9px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(198, 108, 42, 0.12);
  animation: softPulse 1.4s ease-in-out infinite;
}

.service-progress-step {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.service-progress-reason {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.service-stop-button {
  flex: 0 0 auto;
  padding: 7px 10px;
  font-size: 12px;
}

@keyframes softPulse {
  0%, 100% { opacity: 0.55; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1.05); }
}

/* Agent images: captions are content, not footnote lint. */
.attachment-gallery .attachment-card:not(.compact) .agent-media-copy {
  gap: 6px;
}

.media-figure-label {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(31, 86, 116, 0.08);
  color: #1f5674;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.attachment-card-copy .media-caption {
  display: block;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  color: var(--text);
  font-size: 13px;
  line-height: 1.42;
}

.media-source {
  display: block;
  line-height: 1.35;
}

/* Round 6: transparency beats mystical agent smoke. */
.side-panel-stack--rich {
  grid-template-rows: auto;
  overflow: auto;
  padding-right: 4px;
}

.live-decision-card,
.live-source-card,
.live-memory-card {
  display: grid;
  gap: 10px;
}

.live-source-card .source-diagnostics-list {
  padding: 0;
  gap: 10px;
}

.live-source-card .source-diagnostics-card {
  padding: 10px 0 0;
}

.live-source-card .source-diagnostics-card p {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.decision-stack,
.memory-panel,
.trace-overview-panel {
  display: grid;
  gap: 12px;
}

.decision-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.20);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.56);
}

.decision-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.decision-card-list {
  display: grid;
  gap: 10px;
}

.decision-card {
  display: grid;
  gap: 7px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.72);
}

.decision-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.42;
}

.compact-bullet-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.compact-bullet-list li {
  overflow-wrap: anywhere;
}

.source-diagnostics-list {
  display: grid;
  gap: 12px;
}

.source-diagnostics-card {
  padding: 12px 0;
}

.source-diagnostics-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.source-diagnostics-head strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.source-diagnostics-card .detail-rows {
  margin-top: 6px;
  grid-template-columns: minmax(0, 88px) minmax(0, 1fr);
}

.source-diagnostics-card p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.mini-drilldown {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.62);
}

.mini-drilldown summary {
  padding: 10px 12px;
}

.message-admin-card {
  max-width: min(980px, 100%);
}

.message-admin-tabs button {
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .decision-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Round 8: figures are evidence, not decorative confetti. */
.attachment-gallery:not(.compact) {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: stretch;
}

.attachment-gallery:not(.compact) .attachment-card {
  overflow: hidden;
  background: rgba(255, 255, 255, 0.92);
}

.attachment-gallery:not(.compact) .attachment-card-media {
  height: 170px;
  background: rgba(25, 33, 41, 0.035);
  object-fit: contain;
}

.attachment-gallery:not(.compact) .agent-media-copy {
  padding-top: 2px;
}

.attachment-gallery:not(.compact) .attachment-card-copy .media-caption {
  font-size: 14px;
  font-weight: 750;
  line-height: 1.45;
}

.attachment-gallery:not(.compact) .media-source {
  max-height: 2.8em;
  overflow: hidden;
}

/* Round 9: cleaned workspace. One chat, visible work route, fewer museum-grade UI fossils. */
:root {
  --bg: #edf1f5;
  --bg-panel: rgba(255, 255, 255, 0.88);
  --bg-soft: rgba(248, 250, 252, 0.84);
  --line: rgba(15, 23, 42, 0.11);
  --line-strong: rgba(15, 23, 42, 0.18);
  --text: #111827;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.11);
  --success: #047857;
  --danger: #b42318;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.10);
  --shadow-soft: 0 14px 34px rgba(15, 23, 42, 0.07);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

body {
  background:
    radial-gradient(circle at 12% -8%, rgba(37, 99, 235, 0.18), transparent 34%),
    radial-gradient(circle at 88% 0%, rgba(14, 165, 233, 0.13), transparent 30%),
    linear-gradient(180deg, #f8fafc 0%, #e9eef5 100%);
}

.shell {
  padding: 14px;
}

.frame {
  height: calc(100vh - 28px);
  grid-template-columns: 312px minmax(0, 1fr) minmax(330px, 420px);
  gap: 14px;
}

.frame.frame--left-collapsed {
  grid-template-columns: 52px minmax(0, 1fr) minmax(330px, 420px);
}

.frame.frame--right-collapsed {
  grid-template-columns: 312px minmax(0, 1fr) 52px;
}

.frame.frame--left-collapsed.frame--right-collapsed {
  grid-template-columns: 52px minmax(0, 1fr) 52px;
}

.card {
  border-color: rgba(148, 163, 184, 0.24);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(22px) saturate(1.12);
  box-shadow: var(--shadow);
}

.sidebar,
.main-panel,
.side-panel {
  box-shadow: var(--shadow);
}

.sidebar {
  padding: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(248,250,252,.84));
}

.sidebar-title,
.panel-title,
.auth-title {
  letter-spacing: -0.035em;
}

.sidebar-title {
  font-size: 24px;
}

.eyebrow::before {
  background: var(--accent);
}

.primary-button,
.segmented .is-active {
  border-color: rgba(37, 99, 235, 0.78);
  background: linear-gradient(135deg, #2563eb, #1d4ed8 52%, #0f172a);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.20);
}

.ghost-button,
.segmented button,
.vote-button {
  background: rgba(255,255,255,.76);
}

.ghost-button:hover,
.segmented button:hover,
.vote-button:hover,
.primary-button:hover,
.chat-row:hover,
.trace-row:hover {
  transform: translateY(-1px);
}

.status-pill {
  border-color: rgba(37, 99, 235, 0.16);
  background: rgba(37, 99, 235, 0.08);
}

.status-pill::before,
.stage-chip::before {
  background: var(--accent);
}

.chat-row {
  min-height: 98px;
  padding: 13px 48px 13px 14px;
  background: rgba(255,255,255,.62);
}

.chat-row.is-active,
.chat-row-shell.is-active .chat-row {
  border-color: rgba(37, 99, 235, 0.26);
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.105), rgba(37, 99, 235, 0.055));
}

.chat-row p {
  -webkit-line-clamp: 2;
}

.account-chip {
  background: rgba(248,250,252,.84);
}

.topbar {
  min-height: 86px;
  padding: 18px 22px;
  background: rgba(255,255,255,.48);
}

.chat-layout {
  background: rgba(255,255,255,.24);
}

.messages {
  gap: 18px;
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.28) 0%, rgba(255,255,255,0) 45%),
    radial-gradient(circle at 5% 4%, rgba(37,99,235,.055), transparent 24%);
}

.message {
  max-width: min(840px, 84%);
  padding: 16px 18px;
  border-radius: 24px;
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(255,255,255,.94);
  box-shadow: var(--shadow-soft);
}

.message.user {
  color: #0f172a;
  background: linear-gradient(135deg, rgba(37,99,235,.16), rgba(14,165,233,.08));
  border-color: rgba(37, 99, 235, 0.22);
}

.message.assistant {
  background: rgba(255,255,255,.96);
}

.message.is-error {
  border-color: rgba(180, 35, 24, 0.24);
  background: rgba(254, 242, 242, 0.82);
}

.message-meta {
  opacity: 0.82;
}

.markdown-body {
  gap: 10px;
}

.markdown-table-wrap {
  max-width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255,255,255,.82);
}

.markdown-table {
  border: 0;
  border-radius: 0;
}

.markdown-table th {
  background: rgba(15,23,42,.045);
}

.service-progress-message {
  border-color: rgba(37,99,235,.20);
  background: linear-gradient(180deg, rgba(239,246,255,.92), rgba(255,255,255,.82));
}

.service-progress-dot {
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.13);
}

.composer {
  padding: 16px 18px 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(12px);
}

.composer textarea {
  min-height: 86px;
  max-height: 210px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 22px;
  background: rgba(248,250,252,.88);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}

.composer textarea:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.42);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.09), inset 0 1px 0 rgba(255,255,255,.85);
}

.composer-footer {
  align-items: center;
  justify-content: space-between;
}

.attachment-strip {
  padding-bottom: 4px;
}

.attachment-pill {
  border-color: rgba(37, 99, 235, 0.14);
  background: rgba(239, 246, 255, 0.64);
}

.attachment-card {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(255,255,255,.88);
}

.attachment-card-preview {
  background: rgba(15, 23, 42, 0.035);
}

.side-panel {
  background: linear-gradient(180deg, rgba(255,255,255,.86), rgba(248,250,252,.78));
}

.side-panel-head {
  padding: 18px 18px 14px;
}

.side-panel-stack--rich,
.activity-feed-scroll {
  padding: 0 18px 18px;
}

.trace-detail-card,
.dashboard-metric,
.trace-row,
.activity-card,
.feedback-item,
.cost-row,
.chat-row,
.queue-card,
.trace-summary-card,
.trace-timeline-card,
.explanation-card,
.drilldown-card {
  background: rgba(255,255,255,.72);
  border-color: rgba(148, 163, 184, 0.22);
}

.activity-card.is-latest {
  border-color: rgba(37, 99, 235, 0.24);
  background: rgba(239,246,255,.74);
}

.tone-accent.signal-badge,
.activity-card.tone-accent,
.timeline-step.tone-accent,
.explanation-card.tone-accent {
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.26);
  background: rgba(37, 99, 235, 0.09);
}

.welcome-conversation {
  min-height: 100%;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 18px;
}

.welcome-message {
  max-width: min(760px, 100%);
}

.welcome-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 860px;
}

.welcome-quick-actions .ghost-button {
  border-color: rgba(37, 99, 235, 0.16);
  background: rgba(255,255,255,.84);
}

.message-admin-card {
  background: rgba(248,250,252,.88);
  color: var(--text);
}

.trace-raw-pre {
  background: #111827;
}

.media-preview-backdrop {
  background: rgba(15, 23, 42, 0.64);
}

.media-preview-modal {
  background: rgba(255,255,255,.96);
}

@media (max-width: 1440px) {
  .frame {
    grid-template-columns: 292px minmax(0, 1fr) 360px;
  }
}

@media (max-width: 1160px) {
  .frame {
    grid-template-columns: 280px minmax(0, 1fr);
  }
  .side-panel {
    display: none;
  }
}

@media (max-width: 820px) {
  .shell {
    padding: 0;
  }
  .frame {
    height: auto;
    min-height: 100vh;
    gap: 0;
  }
  .card,
  .sidebar,
  .main-panel {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
  .message {
    max-width: 100%;
  }
  .composer-footer,
  .topbar {
    align-items: stretch;
  }
}

/* Inline evidence figures inside assistant Markdown answers. Because throwing all schemes at the bottom is not UX, it's a filing cabinet accident. */
.markdown-figure {
  margin: 12px 0 14px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(248, 250, 252, 0.86);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.markdown-figure-preview {
  display: block;
  width: 100%;
  padding: 10px;
  border: 0;
  background: rgba(255, 255, 255, 0.72);
  cursor: zoom-in;
}

.markdown-figure-media {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.035);
}

.markdown-figure-caption {
  padding: 10px 12px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.74);
}
