:root {
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-muted: #f6f8fb;
  --ink: #172033;
  --muted: #667085;
  --line: #d8dee8;
  --accent: #256f5b;
  --accent-strong: #195243;
  --blue: #315fbd;
  --danger: #b42318;
  --success: #23714f;
  --violet: #7367f0;
  --violet-soft: #f1efff;
  --shadow: 0 16px 40px rgba(31, 42, 68, 0.08);
  --shadow-menu: 0 14px 36px rgba(47, 43, 61, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(238, 242, 246, 0.96)),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 24px 44px;
}

body.is-authenticated .container {
  width: 90vw;
  max-width: none;
  padding-inline: 0;
}

.card,
.panel,
.metric-card {
  background: var(--surface);
  border: 1px solid rgba(216, 222, 232, 0.86);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.card {
  padding: 24px;
  margin-bottom: 20px;
}

.container > .card:first-child {
  padding: 26px 28px;
  background: linear-gradient(135deg, #ffffff 0%, #f6faf9 100%);
}

.container > .card:first-child h1 {
  font-size: 30px;
  line-height: 1.15;
}

.container > .card:first-child p {
  margin-bottom: 0;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.hidden-control {
  display: none !important;
}

body.modal-open {
  overflow: hidden;
}

.login-shell {
  display: flex;
  justify-content: center;
  padding-top: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
}

h1,
h2,
p {
  margin-top: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: 20px;
}

label {
  display: block;
  margin-top: 12px;
}

label span,
legend {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

input,
textarea,
select,
button {
  width: 100%;
  border-radius: 8px;
  font: inherit;
}

input,
textarea,
select {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: var(--ink);
}

textarea {
  min-height: 92px;
  resize: vertical;
}

textarea.compact-textarea {
  min-height: 42px;
  overflow-y: hidden;
  resize: none;
  white-space: pre-wrap;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(37, 111, 91, 0.14);
}

button {
  position: relative;
  min-height: 42px;
  padding: 10px 14px;
  border: 0;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  transition:
    background 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

button:hover {
  background: var(--accent-strong);
  box-shadow: 0 8px 18px rgba(37, 111, 91, 0.18);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
  transform: none;
}

.is-loading::after {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 8px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #ffffff;
  border-radius: 999px;
  content: "";
  animation: spin 0.72s linear infinite;
}

.secondary-action {
  width: auto;
  background: #e8eef8;
  color: #244272;
}

.secondary-action:hover {
  background: #dbe6f7;
}

.ghost-action {
  width: auto;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.ghost-action:hover {
  background: var(--surface-muted);
}

.icon-action {
  display: inline-grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  background: #f3f5f9;
  color: #344054;
}

.icon-action:hover {
  background: var(--violet-soft);
  color: var(--violet);
  box-shadow: none;
}

.status-line {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.workspace-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 18px;
  width: 100%;
  margin-top: 0;
  align-items: start;
  transition: grid-template-columns 0.18s ease;
}

.workspace-shell.menu-collapsed {
  grid-template-columns: 86px minmax(0, 1fr);
}

.workspace-shell.menu-collapsed .side-menu {
  padding-inline: 12px;
}

.workspace-shell.menu-collapsed .brand-block {
  justify-content: center;
}

.workspace-shell.menu-collapsed .brand-block > div:last-child,
.workspace-shell.menu-collapsed .menu-heading {
  font-size: 0;
}

.workspace-shell.menu-collapsed .menu-item {
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 0;
  font-size: 0;
}

.workspace-shell.menu-collapsed .menu-item::before {
  content: attr(data-short);
  font-size: 14px;
  font-weight: 800;
}

.side-menu {
  position: sticky;
  top: 24px;
  min-height: calc(100vh - 48px);
  padding: 18px 14px;
  background: #ffffff;
  border: 1px solid rgba(216, 222, 232, 0.86);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 18px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #172033;
  color: #ffffff;
  font-weight: 800;
}

.brand-block strong,
.brand-block span {
  display: block;
}

.brand-block span {
  color: var(--muted);
  font-size: 12px;
}

.menu-list {
  display: grid;
  gap: 6px;
  margin-top: 16px;
}

.menu-heading {
  padding: 4px 12px;
  color: #98a2b3;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.menu-item {
  display: block;
  padding: 11px 12px;
  border-radius: 8px;
  color: #344054;
  font-weight: 700;
  text-decoration: none;
  transition:
    background 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}

.menu-item:hover {
  background: var(--violet-soft);
  color: var(--violet);
  transform: translateX(3px);
}

.menu-item.active {
  background: linear-gradient(90deg, rgba(115, 103, 240, 0.16), rgba(115, 103, 240, 0.08));
  color: var(--violet);
  box-shadow: inset 3px 0 0 var(--violet);
}

.menu-item.search-hidden {
  display: none;
}

.workspace-content {
  min-width: 0;
  width: 100%;
}

.workspace-page.hidden-page {
  display: none !important;
}

.workspace-topbar {
  position: sticky;
  top: 18px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(216, 222, 232, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.workspace-search {
  position: relative;
  flex: 1;
  margin-top: 0;
}

.workspace-search span {
  position: absolute;
  left: 13px;
  top: 50%;
  margin: 0;
  transform: translateY(-50%);
  color: #98a2b3;
  font-size: 12px;
}

.workspace-search input {
  padding-left: 66px;
  border-color: transparent;
  background: #f6f7fb;
}

.topbar-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  background: var(--violet);
  color: #ffffff;
  border-radius: 999px;
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  background: #172033;
  color: #ffffff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  scroll-margin-top: 96px;
}

.workspace-header h1 {
  margin-bottom: 0;
  font-size: 26px;
}

.workspace-header .eyebrow,
.workspace-header .user-chip strong {
  color: #b7c6d8;
}

.user-cluster {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-chip {
  display: grid;
  gap: 3px;
  min-width: 220px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
}

.user-chip span,
.user-chip strong {
  overflow-wrap: anywhere;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0;
}

.metric-card {
  position: relative;
  padding: 16px;
  overflow: hidden;
  transition:
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.metric-card:hover {
  box-shadow: 0 18px 38px rgba(47, 43, 61, 0.12);
  transform: translateY(-2px);
}

.metric-card::after {
  position: absolute;
  right: -18px;
  bottom: -22px;
  width: 82px;
  height: 82px;
  background: rgba(115, 103, 240, 0.08);
  border-radius: 999px;
  content: "";
}

.metric-icon {
  display: inline-grid !important;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-bottom: 10px;
  background: var(--violet-soft);
  color: var(--violet) !important;
  border-radius: 8px;
  font-size: 11px !important;
  font-weight: 800 !important;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin-top: 6px;
}

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

.panel {
  position: relative;
  padding: 20px;
  scroll-margin-top: 96px;
  overflow: visible;
}

.panel:hover {
  box-shadow: 0 18px 42px rgba(47, 43, 61, 0.1);
}

.span-2 {
  grid-column: span 2;
}

.panel-header {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.panel-header h2 {
  margin-bottom: 0;
}

.inline-actions {
  position: relative;
  display: flex;
  gap: 10px;
}

.panel-tools {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-actions button {
  width: auto;
}

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

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

.panel-actions {
  margin-top: 14px;
  max-width: 260px;
}

.service-fieldset {
  margin: 12px 0 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.checkbox-line input {
  width: auto;
}

.checkbox-line span {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-transform: none;
}

.result-surface {
  margin-top: 14px;
  min-height: 56px;
  padding: 12px;
  overflow: auto;
  background: var(--surface-muted);
  border: 1px solid #e1e7ef;
  border-radius: 8px;
  color: var(--muted);
}

.conversation-list-surface,
.conversation-detail-surface {
  min-height: 220px;
}

.embed-snippet-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  margin-top: 14px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.embed-snippet-box h3 {
  margin: 2px 0 0;
}

.code-snippet {
  grid-column: 1 / -1;
  margin: 0;
  padding: 12px;
  overflow: auto;
  background: #111827;
  color: #e5e7eb;
  border-radius: 8px;
  white-space: pre-wrap;
}

.session-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 24px;
}

.session-detail-modal.hidden {
  display: none !important;
}

.session-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
}

.session-detail-dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(980px, calc(100vw - 32px));
  max-height: min(86vh, 920px);
  overflow: hidden;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.28);
}

.session-detail-dialog .conversation-detail-surface {
  flex: 1;
  min-height: 360px;
  overflow: auto;
}

.image-crop-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
  padding: 24px;
}

.image-crop-modal.hidden {
  display: none !important;
}

.image-crop-dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(560px, calc(100vw - 32px));
  max-height: min(90vh, 760px);
  overflow: hidden;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.28);
}

.image-crop-body {
  display: grid;
  gap: 16px;
  padding: 18px;
  overflow: auto;
}

.image-crop-stage {
  display: grid;
  place-items: center;
  background:
    linear-gradient(45deg, #eef2f7 25%, transparent 25%),
    linear-gradient(-45deg, #eef2f7 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef2f7 75%),
    linear-gradient(-45deg, transparent 75%, #eef2f7 75%);
  background-color: #ffffff;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.image-crop-stage:active {
  cursor: grabbing;
}

.image-crop-stage canvas {
  display: block;
  width: min(100%, 320px);
  height: auto;
  aspect-ratio: 1;
}

.image-crop-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, 0.55fr) 88px;
  gap: 16px;
  align-items: end;
}

.image-crop-controls label[hidden] {
  display: none;
}

.image-crop-preview {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.image-crop-preview canvas {
  display: block;
  width: 72px;
  height: 72px;
  border-radius: 8px;
}

.image-crop-actions {
  justify-content: flex-end;
  padding: 0 18px 18px;
}

@media (max-width: 640px) {
  .image-crop-controls {
    grid-template-columns: 1fr;
  }

  .image-crop-preview {
    width: 72px;
    height: 72px;
  }
}

.conversation-list {
  display: grid;
  gap: 10px;
}

.conversation-item {
  display: grid;
  grid-template-columns: 44px minmax(280px, 1.6fr) 88px 140px 140px 72px;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: auto;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  box-shadow: none;
  transform: none;
}

.conversation-item-head-row {
  padding-block: 10px;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.conversation-item:hover {
  background: var(--violet-soft);
  color: var(--ink);
  box-shadow: none;
  transform: none;
}

.conversation-item.selected-row {
  background: #f8fbff;
  border-color: rgba(105, 108, 255, 0.45);
}

.conversation-item.internal-test-session {
  background: #fff8e8;
  border-color: #f3c96b;
  box-shadow: inset 3px 0 0 #d99718;
}

.conversation-item.internal-test-session:hover {
  background: #fff3d4;
}

.conversation-item.active {
  border-color: rgba(115, 103, 240, 0.38);
  background: linear-gradient(90deg, rgba(115, 103, 240, 0.12), rgba(255, 255, 255, 0.96));
  box-shadow: inset 3px 0 0 var(--violet);
}

.conversation-item.internal-test-session.active {
  border-color: #d99718;
  background: linear-gradient(90deg, rgba(217, 151, 24, 0.18), rgba(255, 248, 232, 0.96));
  box-shadow: inset 3px 0 0 #d99718;
}

.conversation-select-btn {
  display: grid;
  gap: 6px;
  min-height: auto;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  box-shadow: none;
  transform: none;
  min-width: 0;
}

.conversation-select-btn:hover {
  background: transparent;
  box-shadow: none;
  transform: none;
}

.conversation-row-actions {
  position: relative;
  justify-self: end;
}

.conversation-action-menu {
  min-width: 120px;
}

.conversation-action-menu button[data-conversation-action="delete"] {
  color: var(--danger);
}

.conversation-action-menu button[data-conversation-action="delete"]:hover {
  background: #fff0ee;
  color: var(--danger);
}

.conversation-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.conversation-item-head strong {
  color: var(--ink);
}

.conversation-item-head span,
.conversation-preview {
  color: var(--muted);
  font-size: 12px;
}

.session-source-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #7a4d00;
  color: #fff7df !important;
  font-size: 11px !important;
  font-weight: 800;
  line-height: 1;
}

.conversation-preview {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.pagination-bar button {
  min-width: 76px;
}

.conversation-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.conversation-detail-head h3 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 18px;
}

.chat-test-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr);
  gap: 14px;
}

.chat-test-controls {
  display: grid;
  align-content: start;
  gap: 12px;
}

.chat-test-actions {
  display: flex;
  gap: 10px;
}

.chat-test-actions button {
  width: auto;
}

.chat-test-surface {
  min-height: 420px;
}

.chat-test-session-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.empty-state {
  display: grid;
  min-height: 96px;
  place-items: center;
  color: var(--muted);
  background: #ffffff;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.skeleton-block {
  min-height: 72px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0)),
    #e9eef5;
  background-size: 220% 100%;
  animation: skeleton 1.1s linear infinite;
}

.compact-result {
  min-height: 80px;
}

.notice {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--ink);
  background: #edf1f5;
}

.notice.success {
  color: var(--success);
  background: #e8f5ee;
}

.notice.danger {
  color: var(--danger);
  background: #fff0ee;
}

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

.compact-summary {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.summary-item {
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.summary-item strong {
  display: block;
  margin-top: 5px;
}

.table-wrap {
  overflow-x: auto;
}

.large-textarea {
  min-height: 150px;
}

.knowledge-config-strip {
  margin-bottom: 14px;
}

.knowledge-create-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.knowledge-create-card {
  display: grid;
  align-content: flex-start;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.knowledge-create-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.knowledge-create-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.knowledge-create-head strong {
  color: var(--ink);
  font-size: 16px;
}

.knowledge-workbench {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
}

.knowledge-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.knowledge-list-toolbar span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.knowledge-list-toolbar strong {
  color: var(--ink);
  font-size: 16px;
}

.knowledge-list-controls {
  display: flex;
  gap: 8px;
}

.knowledge-list-controls select {
  min-width: 112px;
}

.knowledge-assets-surface,
.knowledge-search-surface {
  min-height: 260px;
}

.knowledge-asset-table,
.knowledge-match-list {
  display: grid;
  gap: 10px;
}

.knowledge-asset-row,
.knowledge-match {
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.knowledge-asset-row {
  display: grid;
  grid-template-columns: 44px 96px minmax(260px, 1.6fr) 92px 92px 88px 128px 132px 64px;
  gap: 12px;
  align-items: start;
}

.knowledge-asset-row.selected-row {
  background: #f8fbff;
  border-color: rgba(105, 108, 255, 0.45);
}

.knowledge-asset-head {
  padding-block: 10px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.knowledge-asset-title-cell {
  min-width: 0;
}

.knowledge-asset-title-cell strong,
.knowledge-match h3 {
  display: block;
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 16px;
}

.knowledge-asset-title-cell p,
.knowledge-match p {
  display: -webkit-box;
  margin-bottom: 0;
  overflow: hidden;
  color: var(--muted);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.knowledge-asset-row > div:not(.knowledge-asset-title-cell):not(.knowledge-row-actions) {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.knowledge-row-actions {
  position: relative;
  display: flex;
  justify-content: flex-end;
}

.knowledge-action-menu {
  min-width: 148px;
}

.knowledge-action-menu button[data-asset-action="delete"] {
  color: var(--danger);
}

.knowledge-action-menu button[data-asset-action="delete"]:hover {
  background: #fff0ee;
  color: var(--danger);
}

.user-table {
  display: grid;
  gap: 10px;
}

.user-list-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(5, minmax(120px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin: 14px 0;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.user-list-toolbar button {
  min-height: 42px;
}

.bulk-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.bulk-action-bar > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.danger-action {
  color: var(--danger);
}

.danger-action:hover {
  background: #fff0ee;
  color: var(--danger);
}

.user-row {
  display: grid;
  grid-template-columns: 44px minmax(260px, 1.5fr) minmax(140px, 0.9fr) 96px minmax(140px, 0.9fr) 138px 72px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.user-row.selected-row {
  background: #f8fbff;
  border-color: rgba(105, 108, 255, 0.45);
}

.user-row-head {
  padding-block: 10px;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.row-select-checkbox {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  accent-color: var(--violet);
}

.user-row > div {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.user-row strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.user-row span:not(.pill) {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.user-row-actions {
  position: relative;
  display: flex;
  justify-content: flex-end;
}

.user-action-menu {
  min-width: 140px;
}

.user-action-menu button[data-user-action="delete"] {
  color: var(--danger);
}

.user-action-menu button[data-user-action="delete"]:hover {
  background: #fff0ee;
  color: var(--danger);
}

.knowledge-search-box {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.knowledge-match-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.knowledge-match-head span {
  color: var(--violet);
  font-weight: 800;
}

.status-ready,
.status-completed {
  background: #e8f5ee;
  color: var(--success);
}

.status-failed {
  background: #fff0ee;
  color: var(--danger);
}

.status-processing,
.status-running,
.status-queued,
.status-uploaded {
  background: var(--violet-soft);
  color: var(--violet);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  color: var(--muted);
  background: #f9fbfd;
  font-size: 12px;
  text-transform: uppercase;
}

code {
  overflow-wrap: anywhere;
  color: #244272;
}

.pill {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e8f5ee;
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
}

.message-stack {
  display: grid;
  gap: 10px;
}

.message-row {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.message-row.outbound {
  justify-self: start;
  background: #e8f5ee;
  border-color: rgba(35, 113, 79, 0.18);
}

.message-row.inbound {
  justify-self: end;
  background: #ffffff;
  border-color: rgba(118, 95, 239, 0.22);
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.message-meta span {
  color: var(--muted);
  font-size: 12px;
}

.message-content a {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.message-copy-btn {
  display: inline-grid;
  place-items: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.message-copy-btn:hover {
  background: rgba(105, 108, 255, 0.1);
  color: var(--violet);
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 44px;
  min-height: 20px;
}

.typing-indicator span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #70809c;
  animation: typingPulse 1s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.16s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.32s;
}

.markdown-body p,
.markdown-body ul,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5 {
  margin-bottom: 0;
}

.markdown-body p + p,
.markdown-body p + ul,
.markdown-body ul + p,
.markdown-body h3 + p,
.markdown-body h4 + p,
.markdown-body h5 + p {
  margin-top: 8px;
}

.markdown-body ul {
  padding-left: 18px;
}

.markdown-body li + li {
  margin-top: 4px;
}

.markdown-body code {
  padding: 2px 5px;
  background: rgba(15, 23, 42, 0.06);
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 0.92em;
}

.raw-details {
  margin-top: 10px;
}

.raw-details summary {
  cursor: pointer;
  color: var(--blue);
  font-weight: 700;
}

.raw-details[open] summary {
  margin-bottom: 8px;
}

.raw-details pre {
  max-height: 260px;
  overflow: auto;
  padding: 12px;
  background: #111827;
  color: #e5e7eb;
  border-radius: 8px;
  white-space: pre-wrap;
}

.chat-log {
  min-height: 56px;
  display: grid;
  gap: 10px;
  align-content: start;
  max-height: 360px;
  overflow: auto;
  background: var(--surface-muted);
  border-radius: 8px;
  padding: 12px;
}

.floating-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 60;
  display: none;
  min-width: 184px;
  padding: 8px;
  background: #ffffff;
  border: 1px solid rgba(216, 222, 232, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow-menu);
}

.panel-header > .panel-menu-btn + .floating-menu {
  right: 0;
  top: 44px;
}

.floating-menu.open {
  display: grid;
  gap: 4px;
  animation: menuIn 0.14s ease-out;
}

.floating-menu button {
  width: 100%;
  min-height: 34px;
  padding: 8px 10px;
  background: transparent;
  color: #344054;
  text-align: left;
  box-shadow: none;
  transform: none;
}

.floating-menu button:hover {
  background: var(--violet-soft);
  color: var(--violet);
}

.menu-user {
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--line);
}

.menu-user strong,
.menu-user span {
  display: block;
  overflow-wrap: anywhere;
}

.menu-user span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.toast-region {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 100;
  display: grid;
  gap: 10px;
  width: min(320px, calc(100vw - 32px));
}

.toast {
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid rgba(216, 222, 232, 0.9);
  border-left: 4px solid var(--violet);
  border-radius: 8px;
  box-shadow: var(--shadow-menu);
  animation: toastIn 0.18s ease-out;
}

.toast.success {
  border-left-color: var(--success);
}

.toast.danger {
  border-left-color: var(--danger);
}

.toast.leaving {
  animation: toastOut 0.2s ease-in forwards;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes typingPulse {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@keyframes skeleton {
  to {
    background-position: -220% 0;
  }
}

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

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

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

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

  .workspace-shell.menu-collapsed {
    grid-template-columns: 1fr;
  }

  .workspace-shell.menu-collapsed .brand-block > div:last-child,
  .workspace-shell.menu-collapsed .menu-heading {
    font-size: inherit;
  }

  .workspace-shell.menu-collapsed .menu-item {
    font-size: 14px;
  }

  .workspace-shell.menu-collapsed .menu-item::before {
    content: none;
  }

  .side-menu {
    position: static;
    min-height: auto;
  }

  .menu-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-header,
  .panel-header,
  .user-cluster,
  .workspace-topbar {
    align-items: stretch;
    flex-direction: column;
  }

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

  .metric-strip,
  .workspace-grid,
  .form-grid,
  .summary-grid,
  .compact-summary,
  .knowledge-create-grid,
  .knowledge-workbench,
  .chat-test-layout {
    grid-template-columns: 1fr;
  }

	  .knowledge-list-toolbar,
	  .knowledge-list-controls {
	    align-items: stretch;
	    flex-direction: column;
	  }

	  .user-list-toolbar,
	  .user-row,
	  .conversation-list-toolbar,
	  .conversation-item {
	    grid-template-columns: 1fr;
	  }

	  .bulk-action-bar,
	  .bulk-action-bar .inline-actions {
	    align-items: stretch;
	    flex-direction: column;
	  }

	  .user-row-head,
	  .conversation-item-head-row {
	    display: none;
	  }

	  .user-row > div::before,
	  .conversation-item > div::before {
	    display: block;
	    margin-bottom: 3px;
	    color: var(--muted);
	    font-size: 11px;
	    font-weight: 800;
	    text-transform: uppercase;
	    content: attr(data-label);
	  }

	  .user-row-actions,
	  .conversation-row-actions {
	    justify-content: flex-start;
	    justify-self: start;
	  }

	  .knowledge-asset-head {
	    display: none;
	  }

  .knowledge-asset-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .knowledge-asset-row > div::before {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    content: attr(data-label);
  }

  .knowledge-row-actions {
    justify-content: flex-start;
  }

  .conversation-detail-head {
    flex-direction: column;
  }

  .span-2 {
    grid-column: span 1;
  }

  .inline-actions {
    flex-direction: column;
  }

  .chat-test-actions {
    flex-direction: column;
  }

  .inline-actions button,
  .chat-test-actions button,
  .secondary-action,
  .ghost-action {
    width: 100%;
  }
}
