:root {
  --bg: #f8fbff;
  --surface: #ffffff;
  --surface-soft: #f2f7ff;
  --surface-warm: #f7fbff;
  --sidebar: #f7faff;
  --gray-050: #f8fbff;
  --gray-100: #eef5ff;
  --gray-150: #dde9fb;
  --gray-200: #c8d9f5;
  --gray-500: #7180a3;
  --gray-600: #536381;
  --gray-700: #283653;
  --gray-950: #111936;
  --primary: #2f6ff4;
  --primary-hover: #245fe0;
  --primary-soft: #edf4ff;
  --primary-rgb: 47, 111, 244;
  --accent-warm: #ff5a2f;
  --accent-warm-soft: #fff0eb;
  --success: #40b66b;
  --danger: #e45b42;
  --clay: var(--primary);
  --clay-soft: var(--primary-soft);
  --olive: var(--success);
  --blue: var(--primary);
  --border: rgba(var(--primary-rgb), .20);
  --border-soft: rgba(var(--primary-rgb), .12);
  --text: var(--gray-950);
  --text-secondary: var(--gray-700);
  --text-muted: var(--gray-600);
  --shadow: 0 18px 48px rgba(29, 76, 160, .12);
  --motion-fast: 140ms;
  --motion-mid: 240ms;
  --motion-slow: 520ms;
  --ease-standard: cubic-bezier(.2, .8, .2, 1);
  --ease-emphasis: cubic-bezier(.16, 1, .3, 1);
  --sidebar-width: 288px;
  --font-sans: Inter, Arial, system-ui, sans-serif;
  --font-brand: "Aptos Display", "Segoe UI Variable Display", "Segoe UI", var(--font-sans);
  --font-serif: Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.38;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
}

.login-shell {
  width: min(100%, 460px);
  padding: 24px;
}

.login-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.login-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary-soft);
}

.login-mark img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.login-brand strong {
  display: block;
  font-size: 22px;
  line-height: 1.1;
}

.login-brand span {
  display: block;
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

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

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--text-muted);
  font-weight: 700;
}

.login-form input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 13px 14px;
  color: var(--text);
  font: inherit;
  outline: none;
}

.login-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .14);
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.login-note {
  margin: 18px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

button,
a,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: .68;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 0;
  padding: 18px 10px 14px;
  border-right: 1px solid var(--border-soft);
  background: var(--sidebar);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 0 8px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition:
    background var(--motion-fast) var(--ease-standard),
    color var(--motion-fast) var(--ease-standard),
    transform var(--motion-fast) var(--ease-standard);
}

.brand:hover {
  background: rgba(var(--primary-rgb), .07);
  color: var(--primary);
}

.brand:focus-visible {
  outline: 2px solid rgba(var(--primary-rgb), .42);
  outline-offset: 3px;
}

.brand:active {
  transform: translateY(1px);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.brand-mark img {
  display: block;
  width: 30px;
  height: 30px;
  object-fit: contain;
  transform: translateY(1px) scale(1.35);
  transform-origin: center;
}

.brand-copy {
  display: grid;
  gap: 1px;
  font-family: var(--font-brand);
  font-weight: 520;
}

.brand-copy strong {
  font-size: 15px;
  font-weight: 520;
  line-height: 1.1;
}

.role-switcher {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 14px;
  align-items: center;
  column-gap: 7px;
  width: calc(100% - 16px);
  min-height: 30px;
  margin: 16px 8px 14px;
  padding: 0 8px 0 9px;
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-secondary);
  text-align: left;
  box-shadow: 0 1px 0 rgba(29, 76, 160, .04);
}

.role-switcher span:nth-child(2) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-chevron {
  display: grid;
  place-items: center;
  width: 14px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1;
}

.sidebar-section {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.sidebar-section-title {
  padding: 0 9px;
  color: var(--text-muted);
  font-size: 12px;
}

.sidebar-nav {
  display: grid;
  gap: 1px;
}

.sidebar-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 5px;
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
  transition: background var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard);
}

.sidebar-item:hover {
  background: rgba(var(--primary-rgb), .07);
}

.sidebar-item.active {
  background: rgba(var(--primary-rgb), .10);
  color: var(--primary);
}

.sidebar-item span:nth-child(2) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  min-width: 18px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1;
}

.sidebar-count {
  color: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.sidebar-recent-section {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  margin-top: 26px;
  overflow: hidden;
}

.recent-list {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 1px;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 2px 8px 0;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--primary-rgb), .28) transparent;
}

.recent-list::-webkit-scrollbar {
  width: 8px;
}

.recent-list::-webkit-scrollbar-track {
  background: transparent;
}

.recent-list::-webkit-scrollbar-thumb {
  border: 2px solid var(--sidebar);
  border-radius: 999px;
  background: rgba(var(--primary-rgb), .24);
}

.recent-list::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--primary-rgb), .38);
}

.recent-case {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-height: 28px;
  padding: 3px 9px;
  border-radius: 5px;
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
}

.recent-case:hover,
.recent-case.active {
  background: rgba(var(--primary-rgb), .10);
}

.recent-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--olive);
}

.recent-dot.warning {
  background: var(--clay);
}

.recent-dot.danger {
  background: var(--danger);
}

.recent-copy {
  display: block;
  min-width: 0;
}

.recent-copy strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-copy strong {
  color: var(--text);
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.25;
}

.recent-empty {
  padding: 4px 9px;
  color: var(--text-muted);
  font-size: 12px;
}

.brand-copy span,
.muted,
.eyebrow {
  color: var(--text-muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 2px;
  margin-top: 18px;
}

.nav-item,
.nav-link {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 34px;
  padding: 0 8px;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
  text-decoration: none;
  transition: background var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard);
}

.nav-item:hover,
.nav-link:hover {
  background: rgba(var(--primary-rgb), .07);
}

.nav-item.active {
  background: rgba(var(--primary-rgb), .10);
  color: var(--primary);
}

.sidebar-card {
  display: grid;
  gap: 8px;
  margin: 24px 4px 0;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface);
}

.mini-meter {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--gray-150);
}

.mini-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--clay);
}

.sidebar-links {
  display: grid;
  gap: 2px;
  margin-top: auto;
}

.main {
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(248, 251, 255, .94);
  overflow-x: auto;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 650;
}

.topbar-spacer {
  flex: 1;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 260px;
  padding: 0 8px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard);
}

.chip.quiet {
  background: transparent;
}

.chip.warning {
  border-color: rgba(var(--primary-rgb), .28);
  background: var(--primary-soft);
  color: var(--primary);
}

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  transition: transform var(--motion-fast) var(--ease-standard), background var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard);
}

.button:hover {
  border-color: rgba(var(--primary-rgb), .32);
  background: var(--primary-soft);
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button.primary,
.flow-button.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 24px rgba(var(--primary-rgb), .22);
}

.button.primary:hover,
.flow-button.primary:hover,
.add-case-button:hover,
.chat-composer .composer-submit:hover {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
  color: #fff;
  box-shadow: 0 12px 28px rgba(var(--primary-rgb), .28);
}

.button.loading,
.flow-button.loading {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: rgba(var(--primary-rgb), .34);
}

.button.loading::after,
.flow-button.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(var(--primary-rgb), .18), transparent);
  transform: translateX(-120%);
  animation: actionSweep 1.1s var(--ease-standard) infinite;
}

.work-scroll {
  height: calc(100vh - 56px);
  overflow: auto;
  padding: 18px;
}

.inbox-panel {
  width: min(100%, 1280px);
  margin: 0 auto 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
  animation: surfaceIn var(--motion-slow) var(--ease-emphasis) both;
}

.inbox-panel:not([open]) {
  background: transparent;
}

.inbox-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 650;
  cursor: pointer;
}

.flow-strip {
  display: grid;
  grid-template-columns: 184px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  width: min(100%, 1280px);
  margin: 0 auto 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  animation: surfaceIn var(--motion-slow) var(--ease-emphasis) both;
}

.flow-strip-head {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.flow-strip-head strong {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.2;
}

.flow-steps {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.flow-step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 12px;
}

.flow-step span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-step-marker {
  display: inline-flex;
  flex: 0 0 23px;
  align-items: center;
  justify-content: center;
  min-height: 23px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.flow-step.done {
  border-color: transparent;
  background: var(--gray-100);
  color: var(--text-secondary);
}

.flow-step.done .flow-step-marker {
  border-color: transparent;
  background: var(--primary);
  color: #fff;
}

.flow-step.active {
  border-color: rgba(var(--primary-rgb), .34);
  background: var(--primary-soft);
  color: var(--text);
}

.flow-step.active .flow-step-marker {
  border-color: rgba(var(--primary-rgb), .34);
  background: var(--primary);
  color: #fff;
}

.inbox-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 150px;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
}

.inbox-toolbar input,
.inbox-toolbar select {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-secondary);
  font: inherit;
  outline: none;
}

.inbox-toolbar input:focus,
.inbox-toolbar select:focus {
  border-color: var(--text-muted);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .12);
}

.case-list {
  display: grid;
  max-height: 260px;
  overflow: auto;
}

.case-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, .72fr);
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 10px 14px;
  border: 0;
  border-top: 1px solid var(--border-soft);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  animation: rowIn var(--motion-mid) var(--ease-emphasis) both;
  transition: background var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard);
}

.case-row:first-child {
  border-top: 0;
}

.case-row:hover,
.case-row.active {
  background: var(--primary-soft);
}

.case-row.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: var(--clay);
}

.case-row-main,
.case-row-meta {
  min-width: 0;
}

.case-row-main {
  display: grid;
  gap: 3px;
}

.case-row-main strong,
.case-row-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-row-main span {
  color: var(--text-muted);
  font-size: 12px;
}

.case-row-meta {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.case-row-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.case-row-meta span.warning {
  border-color: rgba(255, 90, 47, .24);
  background: var(--accent-warm-soft);
  color: var(--accent-warm);
}

.case-row-meta span.danger {
  border-color: rgba(228, 91, 66, .28);
  background: rgba(228, 91, 66, .08);
  color: var(--danger);
}

.case-list-empty {
  padding: 14px;
  color: var(--text-muted);
}

.workspace,
.lower-grid {
  width: min(100%, 1280px);
  margin: 0 auto 16px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, .78fr) minmax(360px, 1.25fr) 292px;
  gap: 14px;
  align-items: start;
}

.case-panel,
.assistant-panel,
.action-panel,
.panel {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  transition: border-color var(--motion-mid) var(--ease-standard), box-shadow var(--motion-mid) var(--ease-standard), transform var(--motion-mid) var(--ease-standard);
}

.workspace.just-updated .case-panel,
.workspace.just-updated .assistant-panel,
.workspace.just-updated .action-panel {
  animation: workspaceUpdate 680ms var(--ease-emphasis) both;
}

.case-panel,
.assistant-panel,
.action-panel {
  min-height: 560px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-soft);
}

.panel-head.slim {
  min-height: 72px;
  align-items: flex-start;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  font-family: var(--font-serif);
  font-weight: 500;
}

h1 {
  margin-top: 3px;
  font-size: 25px;
  line-height: 1.12;
}

h2 {
  margin-top: 3px;
  font-size: 21px;
  line-height: 1.14;
}

.facts {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
  padding: 14px;
}

.facts.compact {
  padding: 12px 0 0;
}

.facts dt {
  color: var(--text-muted);
}

.facts dd {
  min-width: 0;
  margin: 0;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.summary-block {
  margin: 0 14px 14px;
  padding: 12px;
  border: 1px solid rgba(var(--primary-rgb), .18);
  border-radius: 8px;
  background: var(--surface-soft);
}

.summary-block p {
  margin: 6px 0 0;
  color: var(--text-secondary);
}

.risk-block {
  display: grid;
  gap: 8px;
  margin: 0 14px 14px;
  padding: 12px;
  border: 1px solid rgba(255, 90, 47, .28);
  border-radius: 8px;
  background: var(--accent-warm-soft);
}

.risk-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.risk-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--text-secondary);
}

.risk-list li {
  overflow-wrap: anywhere;
}

.hidden {
  display: none !important;
}

.artifact-list {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.artifact-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border-soft);
  transition: background var(--motion-fast) var(--ease-standard), padding var(--motion-fast) var(--ease-standard);
  animation: artifactIn var(--motion-slow) var(--ease-emphasis) both;
}

.artifact-row:first-child {
  border-top: 0;
}

.artifact-row.downloading {
  margin: 0 -8px;
  padding-right: 8px;
  padding-left: 8px;
  border-radius: 8px;
  background: var(--primary-soft);
}

.artifact-meta {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.artifact-meta strong,
.artifact-meta span,
.artifact-meta small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artifact-meta span,
.artifact-meta small,
.artifact-empty {
  color: var(--text-muted);
  font-size: 12px;
}

.artifact-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  transition: transform var(--motion-fast) var(--ease-standard), background var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard);
}

.artifact-link:hover {
  border-color: rgba(var(--primary-rgb), .30);
  background: var(--primary-soft);
  transform: translateY(-1px);
}

.artifact-link.disabled {
  border-color: var(--border-soft);
  background: transparent;
  color: var(--text-muted);
  cursor: default;
}

.artifact-link.disabled:hover {
  background: transparent;
  transform: none;
}

.artifact-row.downloading .artifact-link::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(var(--primary-rgb), .16), transparent);
  transform: translateX(-120%);
  animation: actionSweep 900ms var(--ease-standard) infinite;
}

.drawer,
.inspector {
  border-top: 1px solid var(--border-soft);
}

.drawer {
  margin-top: 4px;
  padding: 0 14px 14px;
}

summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  color: var(--text-secondary);
  cursor: pointer;
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  color: var(--text-muted);
}

details[open] > summary::after {
  content: "-";
}

.drawer[open] .facts,
.drawer[open] .artifact-list,
.debug-drawer[open] .flow-actions,
.inspector[open] pre {
  animation: drawerContentIn var(--motion-mid) var(--ease-emphasis) both;
}

.drawer.drawer-attention {
  border-color: rgba(var(--primary-rgb), .30);
  background: var(--primary-soft);
}

.assistant-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(320px, 1fr) auto;
}

.assistant-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface);
}

.assistant-head div:nth-child(2) {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.assistant-head span {
  color: var(--text-muted);
  font-size: 12px;
}

.assistant-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-serif);
  font-size: 20px;
}

.pulse {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.pulse span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--clay);
  opacity: .28;
}

.is-busy .pulse span {
  animation: pulse 1s ease-in-out infinite;
}

.is-busy .pulse span:nth-child(2) {
  animation-delay: .14s;
}

.is-busy .pulse span:nth-child(3) {
  animation-delay: .28s;
}

@keyframes pulse {
  0%,
  100% {
    opacity: .22;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.source-ribbon {
  display: flex;
  gap: 7px;
  min-width: 0;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-soft);
  overflow-x: auto;
}

.source-chip,
.suggestion-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-secondary);
  font: inherit;
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard), transform var(--motion-fast) var(--ease-standard);
}

.source-chip {
  flex: 0 0 auto;
  gap: 7px;
  min-height: 32px;
  max-width: 210px;
  padding: 0 9px;
  font-size: 12px;
}

.source-chip strong,
.source-chip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-chip span {
  color: var(--text-muted);
}

.source-chip.active {
  border-color: rgba(var(--primary-rgb), .28);
  background: var(--primary-soft);
}

.source-chip:disabled {
  cursor: default;
  opacity: .58;
}

.source-chip:not(:disabled):hover,
.suggestion-chip:hover {
  border-color: rgba(var(--primary-rgb), .30);
  background: var(--primary-soft);
  transform: translateY(-1px);
}

.operation-rail {
  display: none;
  gap: 9px;
  padding: 11px 14px 12px;
  border-bottom: 1px solid rgba(var(--primary-rgb), .18);
  background: var(--primary-soft);
  animation: railIn var(--motion-mid) var(--ease-emphasis) both;
}

.operation-rail.hidden {
  display: none;
}

.operation-rail.complete {
  animation: railOut 320ms var(--ease-exit) both;
}

.operation-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.operation-rail-head span {
  color: var(--text);
  font-weight: 650;
}

.operation-rail-head small {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.operation-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.operation-step {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid rgba(var(--primary-rgb), .22);
  border-radius: 8px;
  background: rgba(255, 255, 255, .58);
  color: var(--text-secondary);
  font-size: 12px;
  animation: operationStep 1.85s var(--ease-standard) infinite;
  animation-delay: calc(var(--step-index) * 240ms);
}

.operation-step span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operation-step-marker {
  display: inline-flex;
  flex: 0 0 20px;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
}

.chat-log {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  padding: 14px;
  overflow: auto;
  background: linear-gradient(180deg, #fff 0%, #f7fbff 100%);
}

.message {
  max-width: 86%;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(29, 76, 160, .05);
  animation: messageIn var(--motion-mid) var(--ease-emphasis) both;
}

.message.assistant {
  justify-self: start;
}

.message.user {
  justify-self: end;
  border-color: rgba(var(--primary-rgb), .22);
  background: var(--primary-soft);
}

.message.warning {
  border-color: rgba(255, 90, 47, .28);
  background: var(--accent-warm-soft);
}

.work-card {
  display: grid;
  gap: 11px;
  width: 100%;
  min-width: 0;
  max-width: 94%;
  padding: 12px;
  border: 1px solid rgba(var(--primary-rgb), .18);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(29, 76, 160, .06);
  animation: artifactIn var(--motion-slow) var(--ease-emphasis) both;
}

.work-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.work-card-head > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.work-card-head strong {
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 500;
  line-height: 1.14;
}

.work-card-reason {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

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

.work-card-row {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface-soft);
}

.work-card-row span {
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
}

.work-card-row strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.telegram-preview {
  margin: 0;
  padding: 10px 11px;
  border-left: 3px solid var(--clay);
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.thinking-message {
  position: relative;
  overflow: hidden;
  border-color: transparent;
  background: transparent;
}

.thinking-message::after {
  content: none;
}

.thinking-message > * {
  position: relative;
  z-index: 1;
}

.thinking-steps {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.thinking-step {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 12px;
  animation: stepFocus 1.7s var(--ease-standard) infinite;
  animation-delay: calc(var(--step-index) * 210ms);
}

.assistant-thinking-line {
  display: inline-grid;
  grid-template-columns: 8px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 13px;
}

.assistant-thinking-line.status-swap {
  animation: processingSwap 280ms var(--ease-emphasis) both;
}

.step-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--clay);
  box-shadow: 0 0 0 0 rgba(var(--primary-rgb), .24);
  animation: dotPulse 1.7s var(--ease-standard) infinite;
  animation-delay: calc(var(--step-index) * 210ms);
}

.message strong {
  display: block;
  margin-bottom: 4px;
}

.message p {
  margin: 0;
  color: var(--text-secondary);
}

.message span {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--border-soft);
  background: var(--surface-soft);
}

.suggestion-row {
  grid-column: 1 / -1;
  display: flex;
  gap: 7px;
  min-width: 0;
  overflow-x: auto;
}

.suggestion-chip {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 9px;
  color: var(--text-muted);
  font-size: 12px;
}

.composer textarea {
  min-width: 0;
  resize: vertical;
  max-height: 112px;
  padding: 10px 44px 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.composer textarea:focus {
  border-color: rgba(var(--primary-rgb), .48);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .12);
}

.composer-submit {
  min-width: 92px;
}

.voice-input-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(var(--primary-rgb), .18);
  border-radius: 50%;
  background: var(--surface);
  color: var(--primary);
  transition:
    border-color var(--motion-fast) var(--ease-standard),
    background var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-fast) var(--ease-standard),
    color var(--motion-fast) var(--ease-standard),
    transform var(--motion-fast) var(--ease-standard);
}

.voice-input-btn:hover {
  border-color: rgba(var(--primary-rgb), .34);
  background: var(--primary-soft);
  color: var(--primary);
  transform: translateY(-1px);
}

.voice-input-btn:focus-visible {
  outline: 2px solid rgba(var(--primary-rgb), .28);
  outline-offset: 2px;
}

.voice-input-btn.is-listening {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .14);
  transform: translateY(-1px);
}

.voice-input-btn.is-transcribing {
  border-color: rgba(var(--primary-rgb), .34);
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .10);
}

.voice-input-btn:disabled {
  cursor: default;
  opacity: .70;
  transform: none;
}

.voice-input-icon {
  display: block;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z'/%3E%3Cpath d='M19 10v2a7 7 0 0 1-14 0v-2'/%3E%3Cpath d='M12 19v3'/%3E%3Cpath d='M8 22h8'/%3E%3C/svg%3E") center / 18px 18px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z'/%3E%3Cpath d='M19 10v2a7 7 0 0 1-14 0v-2'/%3E%3Cpath d='M12 19v3'/%3E%3Cpath d='M8 22h8'/%3E%3C/svg%3E") center / 18px 18px no-repeat;
}

.voice-input-btn.is-transcribing .voice-input-icon {
  animation: micPulse 900ms var(--ease-standard) infinite;
}

.voice-field-shell {
  position: relative;
  display: grid;
  min-width: 0;
}

.voice-field-shell .voice-field-control {
  width: 100%;
  padding-right: 46px;
}

.voice-field-shell > .voice-input-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
}

.voice-field-shell.is-voice-capturing {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.voice-field-shell.is-voice-capturing .voice-field-control,
.voice-field-shell.is-voice-capturing > .voice-input-btn {
  display: none;
}

.voice-capture-bar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(160px, .9fr) auto auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 64px;
}

.voice-capture-bar[hidden] {
  display: none;
}

.voice-capture-text {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 18px;
  font-style: italic;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-capture-text.is-empty {
  color: var(--text-muted);
}

.voice-capture-wave {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  justify-self: stretch;
  height: 18px;
  min-width: 120px;
  overflow: hidden;
  border-radius: 999px;
  --voice-level: 0;
}

.voice-capture-wave span {
  flex: 0 0 auto;
  width: 2.5px;
  height: 2.5px;
  border-radius: 999px;
  background: rgba(var(--primary-rgb), .62);
  opacity: calc(.35 + (var(--bar-level, .05) * .55));
  transform: scaleY(calc(1 + (var(--bar-level, .05) * 12)));
  transform-origin: center;
  transition:
    opacity 70ms linear,
    transform 70ms linear,
    background var(--motion-fast) var(--ease-standard);
}

.voice-capture-wave.is-hearing span {
  background: rgba(var(--primary-rgb), .86);
}

.voice-capture-bar[data-voice-status="transcribing"] .voice-capture-wave span {
  animation: voiceTranscribingBars 840ms var(--ease-standard) infinite;
  animation-delay: calc(var(--bar-index, 0) * 18ms);
}

.voice-capture-action {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--gray-100);
  color: var(--primary);
  transition:
    border-color var(--motion-fast) var(--ease-standard),
    background var(--motion-fast) var(--ease-standard),
    transform var(--motion-fast) var(--ease-standard);
}

.voice-capture-action:hover {
  transform: translateY(-1px);
}

.voice-capture-action:focus-visible {
  outline: 2px solid rgba(var(--primary-rgb), .26);
  outline-offset: 2px;
}

.voice-capture-cancel::before,
.voice-capture-cancel::after {
  position: absolute;
  width: 13px;
  height: 1.5px;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.voice-capture-cancel::before {
  transform: rotate(45deg);
}

.voice-capture-cancel::after {
  transform: rotate(-45deg);
}

.voice-capture-confirm {
  border-color: rgba(var(--primary-rgb), .24);
  background: var(--primary);
  color: #fff;
}

.voice-capture-confirm::before {
  width: 11px;
  height: 6px;
  margin-top: -2px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(-45deg);
  content: "";
}

.voice-capture-action:disabled {
  cursor: wait;
  opacity: .72;
  transform: none;
}

.flow-actions {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.next-action-card {
  display: grid;
  gap: 8px;
  padding: 12px 10px 10px;
  border-bottom: 1px solid var(--border-soft);
}

.next-action-button {
  width: 100%;
  min-height: 40px;
}

.next-action-button.muted {
  border-color: var(--border);
  background: var(--gray-100);
  color: var(--text-muted);
}

.next-action-card span {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}

.debug-drawer {
  border-top: 1px solid var(--border-soft);
}

.debug-drawer > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 10px;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
}

.debug-drawer[open] > summary {
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-soft);
  color: var(--text-secondary);
}

.debug-drawer:not([open]) > .flow-actions {
  display: none;
}

.debug-drawer .flow-actions {
  max-height: 342px;
  overflow: auto;
}

.flow-button {
  position: relative;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
  overflow: hidden;
  transition: transform var(--motion-fast) var(--ease-standard), background var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard);
}

.flow-button:hover {
  background: var(--primary-soft);
  transform: translateX(2px);
}

.flow-button.recommended {
  border-color: rgba(var(--primary-rgb), .34);
  background: var(--primary-soft);
  color: var(--text);
}

.flow-button.recommended span {
  background: var(--primary);
  color: #fff;
}

.flow-button span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  border-radius: 6px;
  background: var(--gray-100);
  color: var(--text-muted);
  font-size: 11px;
}

.flow-button.primary span {
  background: rgba(255, 255, 255, .18);
  color: #fff;
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
  gap: 14px;
}

.timeline {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 8px 0;
  list-style: none;
}

.timeline li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 34px;
  padding: 7px 14px;
  color: var(--text-secondary);
  font-size: 13px;
  animation: rowIn var(--motion-mid) var(--ease-emphasis) both;
}

.timeline li:hover {
  background: var(--primary-soft);
}

.timeline time {
  color: var(--text-muted);
  white-space: nowrap;
}

.inspector {
  border-top: 0;
}

.inspector summary {
  min-height: 54px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-soft);
}

.inspector:not([open]) > pre {
  display: none;
}

pre {
  min-height: 280px;
  max-height: 420px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  background: #111936;
  color: #eef5ff;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 60;
  display: none;
  min-height: 40px;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text-secondary);
  transform: translateX(-50%);
}

.toast.visible {
  display: block;
  animation: toastIn var(--motion-mid) var(--ease-emphasis) both;
}

.chat-ui {
  font-size: 13px;
}

.add-case-button {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  width: calc(100% - 16px);
  min-height: 32px;
  margin: 0 8px 8px;
  padding: 0 9px;
  border: 1px solid var(--primary);
  border-radius: 5px;
  background: var(--primary);
  color: #fff;
  text-align: left;
  box-shadow: 0 10px 24px rgba(var(--primary-rgb), .22);
}

.add-case-button .nav-icon {
  color: #fff;
}

.chat-main {
  background: var(--bg);
}

.chat-topbar {
  position: relative;
  min-height: 44px;
  padding: 0 16px;
  border-bottom: 0;
  background: var(--bg);
}

.chat-topbar .chip {
  min-height: 22px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 11px;
}

.chat-topbar #nextAction,
.chat-topbar #caseStatus,
.chat-topbar #aiMode,
.chat-topbar #telegramMode,
.chat-topbar #systemMode,
.chat-topbar #runHappyPathBtn {
  display: none;
}

.chat-topbar .topbar-title {
  gap: 8px;
  font-size: 14px;
  font-weight: 650;
}

.chat-topbar #caseNumber::after {
  content: "⌄";
  margin-left: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 400;
}

.chat-main:has(.intake-panel:not(.hidden)) .chat-topbar #caseNumber,
.chat-main:has(.intake-panel:not(.hidden)) .chat-topbar #loadCaseBtn,
.chat-main:has(.processing-panel:not(.hidden)) .chat-topbar #caseNumber,
.chat-main:has(.processing-panel:not(.hidden)) .chat-topbar #loadCaseBtn {
  visibility: hidden;
}

.button.compact {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 4px;
  font-size: 12px;
}

.button.quiet-action {
  color: var(--text-muted);
}

.chat-work-scroll {
  height: calc(100vh - 44px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--primary-rgb), .24) transparent;
}

.chat-work-scroll::-webkit-scrollbar {
  width: 10px;
}

.chat-work-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.chat-work-scroll::-webkit-scrollbar-thumb {
  border: 3px solid var(--surface);
  border-radius: 999px;
  background: rgba(var(--primary-rgb), .22);
}

.chat-shell {
  display: grid;
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr);
  width: 100%;
  min-height: 100%;
  height: auto;
  margin: 0 auto;
  background: var(--bg);
  border: 0;
}

.chat-main:has(.processing-panel:not(.hidden)) .chat-work-scroll {
  overflow: hidden;
}

.chat-main:has(.processing-panel:not(.hidden)) .chat-shell {
  height: 100%;
}

.chat-shell-head {
  display: none;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(248, 251, 255, .88);
}

.chat-shell-head .assistant-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 17px;
}

.chat-shell-title {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.chat-shell-title strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.chat-shell-title span {
  overflow: hidden;
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.chat-shell .source-ribbon {
  display: none;
}

.intake-panel {
  display: grid;
  gap: 14px;
  width: min(100% - 48px, 1180px);
  margin: 46px auto 32px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.intake-hero {
  display: grid;
  justify-items: center;
  margin-bottom: 4px;
  color: var(--text);
  text-align: center;
}

.intake-heading {
  display: grid;
  justify-content: center;
  gap: 4px;
  max-width: 720px;
}

.intake-hero h1 {
  font-family: var(--font-sans);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.25;
  text-wrap: balance;
}

.intake-heading p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.intake-spark {
  color: var(--accent-warm);
  font-family: var(--font-serif);
  font-size: 34px;
  line-height: 1;
}

.intake-composer-card {
  position: relative;
  isolation: isolate;
  display: grid;
  justify-self: center;
  gap: 6px;
  width: min(100%, 720px);
  padding: 12px 18px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(20, 20, 19, .03);
  overflow: visible;
  transition:
    border-color var(--motion-fast) var(--ease-standard),
    background var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-fast) var(--ease-standard);
}

.intake-composer-card::after {
  position: absolute;
  inset: 10px;
  z-index: 1;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(var(--primary-rgb), .58);
  border-radius: 14px;
  background: rgba(237, 244, 255, .94);
  color: var(--text-secondary);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transform: scale(.99);
  transition:
    opacity var(--motion-fast) var(--ease-standard),
    transform var(--motion-fast) var(--ease-standard);
  content: "Отпустите файл здесь";
}

.intake-composer-card:hover,
.intake-composer-card:focus-within {
  border-color: var(--border);
  box-shadow: 0 2px 8px rgba(20, 20, 19, .04);
}

.intake-composer-card.is-file-dragging {
  border-color: rgba(var(--primary-rgb), .66);
  background: var(--primary-soft);
  box-shadow: 0 2px 8px rgba(20, 20, 19, .04);
}

.intake-composer-card.is-file-dragging::after {
  opacity: 1;
  transform: scale(1);
}

.upload-zone {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  min-width: 0;
  padding: 0 9px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-zone span:last-child {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}

.intake-panel textarea {
  height: 48px;
  min-height: 48px;
  margin: 0;
  resize: none;
  padding: 8px 2px 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  line-height: 1.35;
  outline: none;
}

.intake-panel textarea:focus {
  box-shadow: none;
}

.intake-composer-card > .voice-input-btn {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 1;
}

.intake-composer-foot .voice-input-btn[data-voice-target="appealTextInput"] {
  position: static;
  display: grid;
  visibility: visible;
  opacity: 1;
  justify-self: end;
}

.intake-composer-foot .voice-input-btn[data-voice-target="appealTextInput"]:disabled {
  opacity: 1;
}

.intake-composer-card.is-voice-capturing {
  padding: 12px 14px;
}

.intake-composer-card.is-voice-capturing textarea,
.intake-composer-card.is-voice-capturing .voice-input-btn,
.intake-composer-card.is-voice-capturing .intake-composer-foot {
  display: none;
}

.intake-composer-foot {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 9px;
}

.intake-file-types {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.dashboard-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(20, 20, 19, .03);
}

.dashboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.dashboard-head > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.dashboard-head strong {
  color: var(--text);
  font-size: 16px;
}

.dashboard-head span {
  color: var(--text-muted);
  font-size: 12px;
}

.dashboard-head select,
.dashboard-toolbar input,
.dashboard-toolbar select {
  min-height: 34px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-secondary);
  font: inherit;
  outline: none;
}

.dashboard-counters {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.dashboard-counter {
  display: grid;
  gap: 3px;
  min-width: 0;
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
}

.dashboard-counter:hover,
.dashboard-counter.active {
  border-color: rgba(var(--primary-rgb), .34);
  background: var(--primary-soft);
}

.dashboard-counter strong {
  color: var(--text);
  font-size: 20px;
  line-height: 1;
}

.dashboard-counter span {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.dashboard-counter.warning strong {
  color: var(--accent-warm);
}

.dashboard-counter.danger strong {
  color: var(--danger);
}

.dashboard-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr);
  gap: 8px;
  min-width: 0;
}

.dashboard-case-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.dashboard-case-row {
  grid-template-columns: minmax(220px, .58fr) minmax(0, 1fr);
  gap: 12px;
  min-height: 88px;
  padding: 11px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--surface);
}

.dashboard-case-row:first-child {
  border-top: 1px solid var(--border-soft);
}

.dashboard-case-row.is-overdue {
  border-color: rgba(228, 91, 66, .34);
  background: rgba(228, 91, 66, .06);
}

.dashboard-case-row.is-due-soon {
  border-color: rgba(255, 90, 47, .28);
  background: rgba(255, 90, 47, .06);
}

.dashboard-case-row.is-waiting-external:not(.is-overdue) {
  border-color: rgba(var(--primary-rgb), .24);
}

.dashboard-case-row .case-row-main small {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.dashboard-case-row .case-row-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 7px;
  justify-content: stretch;
}

.dashboard-case-field {
  display: grid;
  gap: 2px;
  min-width: 0;
  min-height: 38px;
  padding: 6px 7px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: rgba(255, 255, 255, .52);
}

.dashboard-case-field small,
.dashboard-case-field b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-case-field small {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
}

.dashboard-case-field b {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 650;
}

.dashboard-case-field.warning {
  border-color: rgba(255, 90, 47, .22);
  color: var(--accent-warm);
}

.dashboard-case-field.danger {
  border-color: rgba(228, 91, 66, .28);
  color: var(--danger);
}

.dashboard-case-field.unassigned b {
  color: var(--text-muted);
}

.dashboard-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.dashboard-group {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--surface-soft);
}

.dashboard-group > strong {
  color: var(--text);
  font-size: 12px;
}

.dashboard-group-table {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.dashboard-group-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  color: var(--text-muted);
  font-size: 11px;
}

.dashboard-group-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-group-row .primary {
  color: var(--text-secondary);
  font-weight: 650;
}

.dashboard-group-empty {
  color: var(--text-muted);
  font-size: 11px;
}

.intake-composer-foot #appealCharCount {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.intake-foot,
.intake-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.intake-foot {
  justify-content: center;
  padding: 0;
  color: var(--text-muted);
  font-size: 12px;
}

.intake-actions {
  justify-content: center;
  padding: 0;
}

.intake-actions .button {
  min-height: 30px;
  border-color: transparent;
  background: transparent;
}

.processing-intake-card {
  display: grid;
  gap: 7px;
  width: min(100% - 48px, 540px);
  margin: 64px auto 16px;
  padding: 15px 18px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(29, 76, 160, .04);
  animation: intakeCardIn 360ms var(--ease-emphasis) both;
}

.processing-intake-card span,
.processing-intake-card small {
  color: var(--text-muted);
  font-size: 12px;
}

.processing-intake-card strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.processing-panel {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  width: min(100% - 48px, 660px);
  margin: 0 auto 18px;
  padding: 18px 20px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 16px 42px rgba(29, 76, 160, .08);
  animation: processingCardIn 360ms var(--ease-emphasis) both;
}

.processing-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.processing-mark img {
  display: block;
  width: 30px;
  height: 30px;
  object-fit: contain;
  transform-origin: center;
  animation: processingLogoPulse 1.7s var(--ease-standard) infinite;
}

.processing-copy {
  display: grid;
  gap: 8px;
  align-content: start;
}

.processing-copy > strong {
  font-size: 17px;
  font-weight: 650;
  line-height: 1.25;
}

.processing-current {
  display: inline-grid;
  grid-template-columns: 10px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 22px;
  color: var(--text-secondary);
  font-size: 13px;
}

.processing-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--clay);
  box-shadow: 0 0 0 0 rgba(var(--primary-rgb), .20);
  animation: dotPulse 1.35s var(--ease-standard) infinite;
}

.processing-current.status-swap {
  animation: processingSwap 280ms var(--ease-emphasis) both;
}

.processing-thought {
  min-height: 18px;
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.processing-thought.status-swap {
  animation: processingSwap 280ms var(--ease-emphasis) both;
}

.processing-findings {
  display: grid;
  gap: 6px;
}

.processing-findings:empty {
  display: none;
}

.processing-finding {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.35;
  animation: processingSwap 280ms var(--ease-emphasis) both;
}

.processing-finding strong {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 520;
}

.processing-finding span {
  min-width: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.processing-progress {
  height: 3px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--gray-150);
}

.processing-progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 520ms var(--ease-emphasis);
}

.claude-chat {
  gap: 22px;
  min-height: 0;
  padding: 54px max(24px, calc((100% - 760px) / 2)) 182px;
  background: var(--bg);
  font-size: 15px;
  overflow: visible;
}

.chat-shell:has(.intake-panel:not(.hidden)) .claude-chat,
.chat-shell:has(.processing-panel:not(.hidden)) .claude-chat {
  overflow: hidden;
}

.claude-chat .message {
  width: min(100%, 760px);
  max-width: 760px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.claude-chat .message.user {
  justify-self: end;
  width: auto;
  max-width: min(620px, 78%);
  padding: 10px 14px;
  border: 0;
  border-radius: 13px;
  background: var(--primary-soft);
}

.claude-chat .message.user strong {
  display: none;
}

.claude-chat .message.user p {
  color: var(--text);
}

.claude-chat .message p {
  line-height: 1.48;
}

.claude-chat .message strong {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 500;
}

.route-artifact,
.response-artifact {
  display: grid;
  width: min(100%, 540px);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(29, 76, 160, .04);
  animation: artifactIn var(--motion-slow) var(--ease-emphasis) both;
}

.route-artifact {
  gap: 0;
  width: min(100%, 620px);
  overflow: visible;
  animation: routeCardIn 420ms var(--ease-emphasis) both;
}

.response-artifact {
  gap: 12px;
  width: min(100%, 720px);
  padding: 14px;
}

.rewrite-result-card {
  display: grid;
  gap: 14px;
  width: min(100%, 760px);
  padding: 18px 22px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(29, 76, 160, .04);
  animation: artifactIn var(--motion-slow) var(--ease-emphasis) both;
}

.rewrite-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.rewrite-result-head strong {
  display: block;
  color: var(--text);
  font-size: 16px;
  font-weight: 650;
  line-height: 1.18;
}

.rewrite-result-head span {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.rewrite-result-body {
  display: grid;
  gap: 10px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.62;
}

.rewrite-result-body p {
  margin: 0;
  white-space: pre-wrap;
}

.typewriter-line.is-typing::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 1.1em;
  margin-left: 2px;
  border-radius: 999px;
  background: currentColor;
  opacity: .42;
  vertical-align: -2px;
  animation: typeCursor 820ms steps(2, start) infinite;
}

.document-artifact {
  width: min(100%, 760px);
  padding: 20px 30px 22px;
}

.document-artifact .artifact-head {
  align-items: flex-start;
}

.document-preview {
  display: grid;
  gap: 10px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

.document-preview p {
  margin: 0;
  white-space: pre-wrap;
}

.document-preview [contenteditable="true"] {
  margin-left: -2px;
  padding: 1px 2px;
  border-radius: 4px;
  cursor: text;
  outline: none;
  transition: background var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard);
}

.document-preview [contenteditable="true"]:hover {
  background: rgba(var(--primary-rgb), .04);
}

.document-preview [contenteditable="true"]:focus {
  background: rgba(var(--primary-rgb), .06);
  box-shadow: 0 0 0 1px rgba(var(--primary-rgb), .22);
}

.document-artifact.is-document-dirty {
  border-color: rgba(var(--primary-rgb), .34);
}

.document-preview .document-addressee {
  font-weight: 600;
}

.document-preview .document-reference,
.document-preview .document-executor {
  color: var(--text-secondary);
  font-size: 13px;
}

.document-preview .document-signature {
  margin-top: 10px;
  font-weight: 600;
}

.document-telegram-preview {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.document-telegram-preview strong {
  font-size: 12px;
  font-weight: 650;
}

.document-telegram-preview p {
  margin: 0;
  white-space: pre-wrap;
}

.document-artifact .artifact-actions {
  justify-content: flex-end;
  padding-top: 4px;
}

.document-save-button {
  min-width: 92px;
}

.telegram-send-button .telegram-button-icon {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  margin: 0;
  color: inherit;
  font-size: 0;
  line-height: 1;
}

.telegram-send-button .telegram-button-icon::before {
  content: "✈";
  font-size: 13px;
}

.telegram-delivery-status {
  display: grid;
  gap: 2px;
  min-width: 190px;
  padding: 7px 10px;
  border: 1px solid rgba(var(--primary-rgb), .18);
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
}

.telegram-delivery-status strong {
  font-weight: 650;
}

.telegram-delivery-status span {
  color: var(--text-muted);
}

.artifact-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.route-artifact .artifact-head {
  min-height: 56px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border-soft);
  animation: routePartIn 300ms var(--ease-emphasis) 120ms both;
}

.artifact-head strong {
  display: block;
  color: var(--text);
  font-size: 16px;
  font-weight: 650;
  line-height: 1.18;
}

.artifact-head span {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.route-artifact .artifact-head > .chip {
  display: none;
}

.route-head-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.route-head-main > div {
  min-width: 0;
}

.route-card-icon,
.route-row-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  line-height: 1;
}

.route-card-icon {
  width: 20px;
  height: 20px;
  font-size: 15px;
}

.route-brief-body {
  display: grid;
  gap: 11px;
  padding: 15px 18px 16px;
}

.route-brief-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  animation: routeRowIn 360ms var(--ease-emphasis) both;
}

.route-brief-row:nth-child(1) {
  animation-delay: 250ms;
}

.route-brief-row:nth-child(2) {
  animation-delay: 410ms;
}

.route-brief-row:nth-child(3) {
  animation-delay: 570ms;
}

.route-row-icon {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  font-size: 13px;
}

.route-brief-row > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.route-brief-row span {
  color: var(--text-muted);
  font-size: 12px;
}

.route-brief-row strong,
.route-owner-select {
  color: var(--text);
  font-size: 13px;
}

.route-summary {
  display: block;
  max-height: 260px;
  margin: 0;
  padding-right: 6px;
  color: var(--text);
  line-height: 1.45;
  overflow: auto;
  overflow-wrap: anywhere;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--primary-rgb), .22) transparent;
}

.route-summary::-webkit-scrollbar {
  width: 6px;
}

.route-summary::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(var(--primary-rgb), .22);
}

.route-brief-row small {
  display: none;
  color: var(--text-muted);
  font-size: 12px;
}

.route-map {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface-soft);
}

.route-map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.route-map-head strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.route-map-status {
  flex: 0 0 auto;
  max-width: 48%;
  overflow: hidden;
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-secondary);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.route-map-status.danger {
  border-color: rgba(228, 91, 66, .30);
  background: rgba(228, 91, 66, .08);
  color: var(--danger);
}

.route-map-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.route-map-metric {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(var(--primary-rgb), .10);
  border-radius: 7px;
  background: var(--surface);
}

.route-map-metric span {
  overflow: hidden;
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.route-map-metric strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.route-map-metric.danger strong {
  color: var(--danger);
}

.scenario-map {
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(var(--primary-rgb), .14);
  border-radius: 8px;
  background: var(--surface);
}

.scenario-map.redirect {
  border-color: rgba(228, 91, 66, .26);
  background: rgba(228, 91, 66, .05);
}

.scenario-map.burdening {
  border-color: rgba(228, 91, 66, .26);
  background: rgba(228, 91, 66, .05);
}

.scenario-map.favorable {
  border-color: rgba(64, 182, 107, .28);
  background: rgba(64, 182, 107, .06);
}

.scenario-map.unknown {
  border-color: rgba(var(--primary-rgb), .14);
  background: var(--surface);
}

.external-request-map.sent,
.external-request-map.delivered,
.external-request-map.response_received {
  border-color: rgba(64, 182, 107, .24);
  background: rgba(64, 182, 107, .05);
}

.external-request-map.overdue,
.external-request-map.failed {
  border-color: rgba(228, 91, 66, .26);
  background: rgba(228, 91, 66, .05);
}

.overdue-map {
  border-color: rgba(228, 91, 66, .30);
  background: rgba(228, 91, 66, .055);
}

.scenario-map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.scenario-map-head strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.scenario-map-badge {
  flex: 0 0 auto;
  max-width: 52%;
  overflow: hidden;
  padding: 3px 7px;
  border: 1px solid rgba(var(--primary-rgb), .18);
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--text-secondary);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.scenario-map-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, .8fr));
  gap: 7px;
}

.deadline-control-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.overdue-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.scenario-map .route-map-metric:first-child strong {
  display: -webkit-box;
  white-space: normal;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.scenario-map-note,
.scenario-map-deadline {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.scenario-map-deadline {
  color: var(--danger);
  font-weight: 600;
}

.scenario-map-inline-label {
  color: var(--text-secondary);
  font-size: 12px;
}

.demo-wizard {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.demo-wizard-main,
.demo-wizard-sidebar {
  min-width: 0;
}

.demo-wizard-main {
  border-color: rgba(64, 182, 107, .22);
  background: rgba(64, 182, 107, .04);
}

.demo-wizard-head > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.demo-wizard-head span {
  color: var(--text-muted);
  font-size: 12px;
}

.demo-wizard-panel {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface);
}

.demo-wizard-eyebrow {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.demo-wizard-title {
  color: var(--text);
  font-size: 16px;
}

.demo-wizard-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.demo-wizard-metrics .route-map-metric {
  align-content: start;
}

.demo-wizard-metrics .route-map-metric span,
.demo-wizard-metrics .route-map-metric strong {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.3;
}

.demo-wizard-blocker-note {
  border-color: rgba(238, 87, 62, .22);
  background: rgba(238, 87, 62, .07);
  color: var(--danger);
  font-weight: 700;
}

.demo-wizard-preview,
.demo-wizard-response-input {
  max-height: 180px;
  overflow: auto;
  padding: 9px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--surface-soft);
}

.demo-wizard-details {
  min-width: 0;
}

.demo-wizard-details summary {
  cursor: pointer;
  color: var(--primary);
  font-size: 12px;
  font-weight: 650;
}

.demo-wizard-attachment-list {
  gap: 6px;
}

.demo-wizard-edit-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(var(--primary-rgb), .20);
  border-radius: 8px;
  background: rgba(var(--primary-rgb), .035);
}

.demo-wizard-edit-hint {
  grid-column: 1 / -1;
}

.demo-wizard-edit-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.demo-wizard-edit-field.wide {
  grid-column: 1 / -1;
}

.demo-wizard-edit-field span {
  color: var(--text-muted);
  font-size: 12px;
}

.demo-wizard-edit-field input,
.demo-wizard-edit-field select,
.demo-wizard-edit-field textarea {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  outline: none;
}

.demo-wizard-edit-field textarea {
  resize: vertical;
  line-height: 1.4;
}

.demo-wizard-edit-field input:focus,
.demo-wizard-edit-field select:focus,
.demo-wizard-edit-field textarea:focus {
  border-color: rgba(var(--primary-rgb), .42);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .10);
}

.demo-wizard-actions,
.demo-wizard-footer {
  justify-content: flex-start;
}

.demo-wizard-footer {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.demo-wizard-sidebar {
  display: grid;
  align-content: start;
  gap: 8px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface);
}

.demo-wizard-sidebar > strong {
  color: var(--text);
  font-size: 12px;
}

.demo-wizard-steps {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.demo-wizard-steps li {
  min-width: 0;
}

.demo-wizard-steps button {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 4px 8px;
  width: 100%;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--text-secondary);
  text-align: left;
}

.demo-wizard-steps button:disabled {
  cursor: default;
  opacity: .72;
}

.demo-wizard-step-marker {
  display: grid;
  grid-row: 1 / span 2;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
}

.demo-wizard-steps strong,
.demo-wizard-steps small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.demo-wizard-steps strong {
  font-size: 12px;
}

.demo-wizard-steps small {
  color: var(--text-muted);
  font-size: 10px;
}

.demo-wizard-steps li.completed button {
  border-color: rgba(64, 182, 107, .24);
  background: rgba(64, 182, 107, .08);
}

.demo-wizard-steps li.completed .demo-wizard-step-marker {
  background: rgba(64, 182, 107, .16);
  color: var(--success);
}

.demo-wizard-steps li.active button {
  border-color: rgba(var(--primary-rgb), .28);
  background: var(--primary-soft);
}

.demo-wizard-steps li.active .demo-wizard-step-marker {
  background: var(--primary);
  color: #fff;
}

.demo-wizard-steps li.pending button,
.demo-wizard-steps li.locked button {
  color: var(--text-muted);
}

@media (min-width: 1280px) {
  .route-artifact:has(.demo-wizard) {
    animation: none;
    transform: none;
  }
}

@media (min-width: 1280px) and (max-width: 1439px) {
  .route-artifact:has(.demo-wizard) {
    margin-right: 50px;
    margin-left: -50px;
  }
}

@media (min-width: 1280px) {
  .demo-wizard-sidebar {
    position: fixed;
    top: 68px;
    right: 12px;
    left: auto;
    z-index: 12;
    width: 292px;
    max-height: calc(100vh - 96px);
    overflow: auto;
    box-shadow: 0 18px 42px rgba(38, 72, 130, .10);
    transform: translateX(calc(100% - 58px));
    transition: transform .22s ease, box-shadow .22s ease, padding .22s ease;
    will-change: transform;
  }

  .demo-wizard-sidebar:hover,
  .demo-wizard-sidebar:focus-within {
    transform: translateX(0);
    box-shadow: 0 22px 52px rgba(38, 72, 130, .16);
  }

  .demo-wizard-sidebar > strong,
  .demo-wizard-steps strong,
  .demo-wizard-steps small {
    transition: opacity .16s ease;
  }

  .demo-wizard-sidebar:not(:hover):not(:focus-within) > strong,
  .demo-wizard-sidebar:not(:hover):not(:focus-within) .demo-wizard-steps strong,
  .demo-wizard-sidebar:not(:hover):not(:focus-within) .demo-wizard-steps small {
    opacity: 0;
    pointer-events: none;
  }

  .demo-wizard-sidebar:not(:hover):not(:focus-within) > strong {
    height: 0;
    overflow: hidden;
  }

  .demo-wizard-sidebar:not(:hover):not(:focus-within) .demo-wizard-steps button {
    border-color: transparent;
    background: transparent;
  }

  .demo-wizard-sidebar:not(:hover):not(:focus-within) .demo-wizard-steps li.active button {
    border-color: transparent;
    background: transparent;
  }
}

.workflow-branch-panel,
.workflow-timeline-panel,
.workflow-documents-panel {
  gap: 10px;
}

.workflow-branch-head > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

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

.workflow-branch-head span {
  color: var(--text-muted);
  font-size: 12px;
}

.button.small {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 12px;
}

.workflow-recommended {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface);
}

.workflow-status-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  color: var(--text-muted);
  font-size: 12px;
}

.workflow-reason {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.45;
  font-size: 13px;
}

.workflow-route-title {
  color: var(--text-secondary);
  font-size: 12px;
}

.workflow-route-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
}

.workflow-doc-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.workflow-doc-summary span {
  max-width: 100%;
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.2;
}

.workflow-current-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(var(--primary-rgb), .22);
  border-radius: 8px;
  background: var(--primary-soft);
}

.workflow-current-action > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.workflow-current-action strong {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.3;
}

.workflow-current-action span {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
}

.workflow-branch-list {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.workflow-branch-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface-soft);
}

.workflow-branch-option.selected {
  border-color: rgba(var(--primary-rgb), .22);
  background: var(--primary-soft);
}

.workflow-branch-option > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.workflow-branch-option strong {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.25;
}

.workflow-branch-option span,
.workflow-branch-option small {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
}

.workflow-branch-missing {
  margin: 0;
  color: var(--warning, #b46a00) !important;
  font-size: 12px;
  line-height: 1.35;
}

.scenario-map-badge.success {
  border-color: rgba(64, 182, 107, .24);
  background: rgba(64, 182, 107, .10);
  color: var(--success);
}

.scenario-map-badge.warning {
  border-color: rgba(223, 157, 54, .28);
  background: rgba(223, 157, 54, .09);
  color: #9a5a00;
}

.workflow-branch-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.workflow-timeline {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.workflow-timeline li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--surface-soft);
}

.workflow-timeline li.done {
  border-color: rgba(64, 182, 107, .22);
  background: rgba(64, 182, 107, .07);
}

.workflow-timeline li.current {
  border-color: rgba(var(--primary-rgb), .26);
  background: var(--primary-soft);
}

.workflow-timeline-marker {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
}

.workflow-timeline li.done .workflow-timeline-marker {
  background: rgba(64, 182, 107, .16);
  color: var(--success);
}

.workflow-timeline li.current .workflow-timeline-marker {
  background: var(--primary);
  color: #fff;
}

.workflow-timeline li > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.workflow-timeline strong,
.workflow-timeline span,
.workflow-timeline small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-timeline strong {
  color: var(--text-secondary);
  font-size: 12px;
}

.workflow-timeline span,
.workflow-timeline small {
  color: var(--text-muted);
  font-size: 10px;
}

.workflow-deadline.danger {
  color: var(--danger);
  font-weight: 700;
}

.workflow-deadline.warning {
  color: #9a5a00;
  font-weight: 700;
}

.workflow-document-list {
  display: grid;
  gap: 7px;
}

.workflow-document-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--surface-soft);
}

.external-request-text,
.external-response-text {
  max-height: 180px;
  overflow: auto;
  padding: 9px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--surface-soft);
  white-space: pre-line;
}

.external-response-text {
  border-color: rgba(var(--primary-rgb), .16);
}

.external-request-actions {
  justify-content: flex-start;
}

.document-map-actions,
.document-row-actions {
  justify-content: flex-start;
}

.document-map-list {
  display: grid;
  gap: 7px;
}

.document-map-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--surface-soft);
}

.document-map-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.document-map-meta strong,
.document-map-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-map-meta strong {
  color: var(--text);
  font-size: 12px;
}

.document-map-meta span {
  color: var(--text-muted);
  font-size: 11px;
}

.document-row-actions {
  flex-wrap: wrap;
  max-width: 100%;
}

.attachment-list {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.attachment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--surface-soft);
}

.attachment-row.needs-ocr {
  border-color: rgba(223, 157, 54, .32);
  background: rgba(223, 157, 54, .07);
}

.attachment-row.failed {
  border-color: rgba(228, 91, 66, .30);
  background: rgba(228, 91, 66, .06);
}

.attachment-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.attachment-meta strong,
.attachment-meta span,
.attachment-meta small,
.attachment-row p {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-meta strong,
.attachment-meta span,
.attachment-meta small {
  white-space: nowrap;
}

.attachment-meta strong {
  color: var(--text);
  font-size: 12px;
}

.attachment-meta span,
.attachment-meta small,
.attachment-row p {
  color: var(--text-muted);
  font-size: 11px;
}

.attachment-row p {
  display: -webkit-box;
  margin: 0;
  white-space: normal;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.attachment-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.extracted-fields-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.responsible-map.unassigned {
  border-color: rgba(223, 157, 54, .30);
  background: rgba(223, 157, 54, .06);
}

.responsible-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.assignment-suggestion {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(var(--primary-rgb), .16);
  border-radius: 7px;
  background: var(--primary-soft);
}

.assignment-suggestion strong,
.assignment-suggestion span,
.assignment-suggestion small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assignment-suggestion strong,
.assignment-suggestion span {
  white-space: nowrap;
}

.assignment-suggestion strong {
  color: var(--text-secondary);
  font-size: 12px;
}

.assignment-suggestion span,
.assignment-suggestion small {
  color: var(--text-muted);
  font-size: 11px;
}

.assignment-suggestion small {
  white-space: normal;
  overflow-wrap: anywhere;
}

.responsible-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.overdue-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.external-sla-row {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--surface-soft);
}

.external-sla-row strong,
.external-sla-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.external-sla-row strong {
  color: var(--text-secondary);
  font-size: 12px;
}

.external-sla-row span {
  color: var(--text-muted);
  font-size: 11px;
}

.scenario-target-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.scenario-target-list li {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--surface-soft);
}

.scenario-target-list strong,
.scenario-target-list span,
.scenario-target-list small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scenario-target-list strong {
  color: var(--text-secondary);
  font-size: 12px;
}

.scenario-target-list span,
.scenario-target-list small {
  color: var(--text-muted);
  font-size: 11px;
}

.route-map-timeline {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.route-map-history {
  margin-top: 12px;
}

.route-map-history > summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.route-map-history[open] .route-map-timeline {
  margin-top: 10px;
}

.route-map-timeline li {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-width: 0;
}

.route-map-dot {
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .10);
}

.route-map-timeline li > div {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.route-map-timeline strong,
.route-map-timeline span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-map-timeline strong {
  color: var(--text-secondary);
  font-size: 12px;
}

.route-map-timeline span {
  color: var(--text-muted);
  font-size: 11px;
}

.route-owner-select {
  width: fit-content;
  max-width: 100%;
  min-height: 24px;
  padding: 0 24px 0 0;
  border: 0;
  background: transparent;
  outline: none;
  cursor: pointer;
}

.route-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 10px 18px;
  border-top: 1px solid var(--border-soft);
  animation: routePartIn 300ms var(--ease-emphasis) 720ms both;
}

.route-ai-owner {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.route-ai-owner span:first-child {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 650;
}

.route-ai-owner span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.route-field {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface-soft);
}

.route-field span {
  color: var(--text-muted);
  font-size: 11px;
}

.route-field strong,
.route-field select {
  min-width: 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.route-field strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-field select {
  min-height: 28px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  outline: none;
}

.artifact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.route-card-footer .artifact-actions {
  flex: 0 1 auto;
  justify-content: flex-end;
}

.artifact-actions .button {
  min-height: 32px;
  border-radius: 5px;
  font-size: 12px;
}

.route-card-footer .artifact-actions .button {
  min-height: 32px;
  padding: 0 12px;
}

.chat-composer {
  position: fixed;
  left: calc(50% + (var(--sidebar-width) / 2));
  bottom: 24px;
  z-index: 20;
  width: min(720px, calc(100vw - var(--sidebar-width) - 48px));
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  padding: 10px 12px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 18px 54px rgba(29, 76, 160, .12);
  transform: translateX(-50%);
}

.chat-composer .suggestion-row {
  padding-bottom: 4px;
}

.chat-composer .suggestion-chip {
  min-height: 32px;
  padding: 0 11px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-secondary);
  font-weight: 500;
}

.chat-composer textarea {
  min-height: 42px;
  max-height: 132px;
  padding: 9px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  resize: none;
}

.chat-composer textarea:focus {
  box-shadow: none;
}

.chat-composer .composer-submit {
  align-self: end;
  min-width: 74px;
  min-height: 36px;
  border-radius: 5px;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 24px rgba(var(--primary-rgb), .22);
}

.chat-composer .voice-input-btn {
  align-self: end;
  margin-bottom: 2px;
}

.chat-composer.is-voice-capturing {
  grid-template-columns: minmax(0, 1fr);
  padding: 10px 12px;
}

.chat-composer.is-voice-capturing .suggestion-row,
.chat-composer.is-voice-capturing textarea,
.chat-composer.is-voice-capturing .voice-input-btn,
.chat-composer.is-voice-capturing .composer-submit {
  display: none;
}

.chat-shell:has(.intake-panel:not(.hidden)) .chat-composer,
.chat-shell:has(.processing-panel:not(.hidden)) .chat-composer {
  display: none;
}

.chat-shell:has(.intake-panel:not(.hidden)) .claude-chat,
.chat-shell:has(.processing-panel:not(.hidden)) .claude-chat {
  padding-bottom: 24px;
}

.legacy-state {
  display: none;
}

@keyframes actionSweep {
  to {
    transform: translateX(120%);
  }
}

@keyframes voiceWave {
  to {
    background-position: 18px 50%;
  }
}

@keyframes voiceTranscribingBars {
  0%,
  100% {
    transform: scaleY(1);
    opacity: .36;
  }

  50% {
    transform: scaleY(8);
    opacity: .82;
  }
}

@keyframes micPulse {
  0%,
  100% {
    opacity: .56;
    transform: scale(.94);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes surfaceIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rowIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes artifactIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes typeCursor {
  50% {
    opacity: 0;
  }
}

@keyframes processingSwap {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes intakeCardIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes processingCardIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes routeCardIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes routePartIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes routeRowIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes railIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes railOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-4px);
  }
}

@keyframes operationStep {
  0%,
  100% {
    border-color: rgba(var(--primary-rgb), .18);
    transform: translateY(0);
  }
  44% {
    border-color: rgba(var(--primary-rgb), .42);
    transform: translateY(-1px);
  }
}

@keyframes drawerContentIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes workspaceUpdate {
  0% {
    border-color: rgba(var(--primary-rgb), .34);
    box-shadow: 0 0 0 rgba(var(--primary-rgb), 0);
    transform: translateY(0);
  }
  35% {
    border-color: rgba(var(--primary-rgb), .42);
    box-shadow: 0 10px 28px rgba(var(--primary-rgb), .10);
    transform: translateY(-1px);
  }
  100% {
    border-color: var(--border);
    box-shadow: none;
    transform: translateY(0);
  }
}

@keyframes stepFocus {
  0%,
  100% {
    opacity: .58;
  }
  44% {
    opacity: 1;
  }
}

@keyframes dotPulse {
  0%,
  100% {
    opacity: .46;
    transform: scale(.86);
    box-shadow: 0 0 0 0 rgba(var(--primary-rgb), .18);
  }
  46% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 0 5px rgba(var(--primary-rgb), 0);
  }
}

@keyframes processingLogoPulse {
  0%,
  100% {
    opacity: .72;
    transform: translateY(1px) scale(1.16);
  }
  46% {
    opacity: 1;
    transform: translateY(1px) scale(1.35);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) 292px;
  }

  .case-panel {
    grid-column: 1 / -1;
    min-height: auto;
  }

  .operation-steps,
  .work-card-grid,
  .scenario-map-grid,
  .route-map-grid,
  .dashboard-counters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-case-row,
  .dashboard-groups {
    grid-template-columns: 1fr;
  }

  .dashboard-case-row .case-row-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app {
    display: block;
  }

  .sidebar {
    display: flex;
    height: auto;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border-soft);
  }

  .main {
    height: auto;
    min-height: 100vh;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 0 12px;
  }

  .work-scroll {
    height: auto;
    padding: 12px;
  }

  .inbox-toolbar,
  .case-row,
  .dashboard-toolbar {
    grid-template-columns: 1fr;
  }

  .case-row-meta {
    justify-content: flex-start;
  }

  .dashboard-counters,
  .dashboard-case-row .case-row-meta {
    grid-template-columns: 1fr;
  }

  .dashboard-head {
    align-items: stretch;
    flex-direction: column;
  }

  .flow-strip {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .flow-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .route-map-grid {
    grid-template-columns: 1fr;
  }

  .scenario-map-grid {
    grid-template-columns: 1fr;
  }

  .demo-wizard {
    grid-template-columns: 1fr;
  }

  .demo-wizard-sidebar {
    order: -1;
    overflow-x: auto;
  }

  .demo-wizard-steps {
    display: flex;
    gap: 6px;
    min-width: 0;
    padding-bottom: 2px;
  }

  .demo-wizard-steps li {
    flex: 0 0 min(210px, 78vw);
  }

  .demo-wizard-metrics {
    grid-template-columns: 1fr;
  }

  .demo-wizard-edit-form {
    grid-template-columns: 1fr;
  }

  .workflow-branch-option,
  .workflow-current-action,
  .workflow-document-row {
    grid-template-columns: 1fr;
  }

  .workflow-branch-head,
  .workflow-branch-head-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .workflow-timeline span,
  .workflow-timeline small {
    white-space: normal;
  }

  .workspace,
  .lower-grid {
    grid-template-columns: 1fr;
  }

  .case-panel,
  .assistant-panel,
  .action-panel {
    min-height: auto;
  }

  .assistant-panel {
    grid-template-rows: auto minmax(300px, 48vh) auto;
  }

  .chat-shell {
    width: 100%;
    min-height: calc(100vh - 44px);
    border-right: 0;
    border-left: 0;
  }

  .chat-work-scroll {
    height: auto;
    min-height: calc(100vh - 44px);
    overflow: visible;
    scrollbar-gutter: auto;
  }

  .claude-chat {
    padding-right: 16px;
    padding-left: 16px;
    padding-bottom: 180px;
  }

  .chat-composer {
    left: 50%;
    bottom: 14px;
    width: calc(100vw - 24px);
    grid-template-columns: 1fr auto auto;
    transform: translateX(-50%);
  }

  .chat-composer textarea {
    grid-column: 1 / -1;
  }

  .chat-composer .voice-input-btn {
    justify-self: end;
  }

  .chat-composer .composer-submit {
    justify-self: end;
  }

  .voice-capture-bar {
    grid-template-columns: minmax(0, 1fr) auto auto;
    min-height: 58px;
  }

  .voice-capture-wave {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
  }

  .intake-panel {
    width: calc(100% - 24px);
    margin-top: 24px;
    padding: 0;
  }

  .intake-hero h1 {
    font-size: 22px;
  }

  .intake-composer-foot {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .intake-file-types {
    display: none;
  }

  .intake-composer-foot #appealCharCount {
    justify-self: end;
  }

  .intake-composer-foot #submitAppealBtn {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .processing-intake-card,
  .processing-panel {
    width: calc(100% - 24px);
  }

  .processing-intake-card {
    margin-top: 16px;
    padding: 16px;
  }

  .processing-panel {
    margin-top: 0;
    padding: 16px;
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .processing-finding {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .route-artifact,
  .response-artifact {
    width: 100%;
  }

  .route-card-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .route-card-footer .artifact-actions {
    justify-content: flex-start;
  }

  .route-grid {
    grid-template-columns: 1fr;
  }

  .operation-steps,
  .work-card-grid {
    grid-template-columns: 1fr;
  }

  .work-card {
    max-width: 100%;
  }

  h1 {
    font-size: 23px;
  }
}
