:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --line: #d8e0e8;
  --line-strong: #c1c7cd;
  --field: #eef2f6;
  --text: #18212f;
  --muted: #667085;
  --blue: #1f6feb;
  --green: #16835a;
  --amber: #b76e00;
  --red: #c43c35;
  --purple: #7254c7;
  --shadow: 0 16px 40px rgba(20, 31, 45, 0.08);
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --shadow-soft: 0 18px 44px rgba(18, 22, 25, 0.1);
  --shadow-card: 0 10px 26px rgba(18, 22, 25, 0.055);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.test-environment-banner {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 7px 16px;
  background: #fff3cd;
  border-bottom: 1px solid #e2b24b;
  color: #6a4700;
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
}

body.test-runtime .app-shell {
  height: calc(100dvh - 38px);
  min-height: calc(100dvh - 38px);
}

.admin-page {
  background: #eef2f6;
}

button,
textarea,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

.mobile-case-bar,
.mobile-shell-backdrop,
.dossier-backdrop,
.case-manager-backdrop,
.archive-mobile-summary,
.mobile-archive-actions,
.archive-form-backdrop,
.archive-form-mobile-head {
  display: none;
}

body.archive-view .app-shell {
  grid-template-columns: 228px minmax(0, 1fr);
}

body.archive-view .dossier-rail {
  display: none;
}

.admin-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 36px;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 62px;
}

.admin-hero {
  padding: 22px 0 16px;
  border-top: 1px solid var(--line);
}

.admin-hero h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 0;
}

.admin-hero p {
  margin: 8px 0 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.55;
}

.admin-console-map {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.admin-console-map[hidden] {
  display: none;
}

.admin-console-card {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  padding: 12px;
  text-align: left;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.06);
}

.admin-console-card span {
  width: fit-content;
  border-radius: 999px;
  background: #eef4ff;
  color: #1f5bbf;
  font-size: 11px;
  font-weight: 900;
  padding: 2px 7px;
}

.admin-console-card strong {
  font-size: 15px;
  line-height: 1.2;
}

.admin-console-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}

.admin-console-card.active,
.admin-console-card:hover,
.admin-console-card:focus-visible {
  border-color: rgba(37, 99, 235, 0.35);
  background: #f8fbff;
  box-shadow: 0 16px 36px rgba(37, 99, 235, 0.13);
  outline: 0;
}

.admin-console-card.danger {
  border-color: #f3c4c4;
  background: #fff8f8;
}

.admin-console-card.danger span {
  background: #fff1f1;
  color: #b42323;
}

.sidebar,
.review-pane {
  background: #fbfcfd;
  border-color: var(--line);
  border-style: solid;
}

.sidebar {
  border-width: 0 1px 0 0;
  height: 100dvh;
  overflow: auto;
  padding: 20px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 20px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #18212f;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-title {
  font-weight: 800;
}

.client-access {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.client-access-current {
  display: grid;
  gap: 2px;
}

.client-access-current span,
.client-access small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.client-access-current strong {
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.client-login-controls {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.client-login-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2f7;
  padding: 3px;
}

.client-login-tabs button {
  min-width: 0;
  min-height: 26px;
  border: 0;
  background: transparent;
  color: #506174;
  padding: 0 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-login-tabs button.active {
  background: var(--surface);
  color: #1558c7;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.client-access form.client-auth-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.client-access form.client-password-login-form {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
}

.client-access input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px;
  font-size: 12px;
}

.client-access button {
  min-height: 30px;
  border: 1px solid #bdd1e7;
  border-radius: 8px;
  background: #eef5ff;
  color: #1558c7;
  font-size: 12px;
  font-weight: 800;
  padding: 0 8px;
}

.client-access .client-login-tabs button {
  min-height: 26px;
  border: 0;
  background: transparent;
  color: #506174;
  padding: 0 6px;
}

.client-access .client-login-tabs button.active {
  background: var(--surface);
  color: #1558c7;
}

.client-access-logout {
  justify-self: start;
}

.brand-subtitle,
.case-item small,
.chat-header p,
.tool-header p,
.panel-title span,
.empty,
.message-meta,
.agent-card p,
.finding-card p,
.admin-note {
  color: var(--muted);
}

.case-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.new-case {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.case-rail-current {
  display: grid;
  gap: 7px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.case-rail-current span,
.case-rail-current small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.case-rail-current span {
  font-weight: 850;
}

.case-rail-current strong {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-manager-open-button {
  width: 100%;
  min-height: 30px;
}

.workspace-nav {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.matter-switcher {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.matter-switcher.case-manager-panel {
  align-content: start;
  grid-template-rows: auto minmax(0, auto);
  min-height: 0;
  max-height: calc(100dvh - 100px);
  margin-top: 0;
  overflow: hidden;
}

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

.case-manager-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.matter-switcher-head strong {
  font-size: 13px;
}

.matter-switcher-head button {
  min-height: 26px;
  border: 1px solid #bdd1e7;
  border-radius: 8px;
  background: #eef5ff;
  color: #1558c7;
  font-size: 11px;
  font-weight: 800;
  padding: 0 7px;
}

.matter-switcher-head button.danger {
  border-color: #fecaca;
  background: #fff1f2;
  color: #be123c;
}

.matter-delete-feedback {
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  padding: 8px 9px;
  overflow-wrap: anywhere;
}

.matter-delete-feedback[data-tone="success"] {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.matter-delete-feedback[data-tone="error"] {
  border-color: #fecaca;
  background: #fff7f7;
  color: #9f1239;
}

.matter-delete-feedback[data-tone="info"] {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.matter-delete-feedback[hidden] {
  display: none;
}

.matter-list {
  display: grid;
  gap: 6px;
  max-height: 170px;
  overflow: auto;
}

.case-manager-panel .matter-list {
  align-content: start;
  max-height: min(560px, calc(100dvh - 174px));
  min-height: 0;
  padding-right: 2px;
  overscroll-behavior: contain;
}

.matter-list-empty {
  border: 1px dashed #cbd6e2;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  padding: 9px;
}

.matter-switch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: stretch;
}

.matter-switch-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px;
  align-items: center;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  padding: 7px;
}

.matter-switch-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.matter-switch-copy strong,
.matter-switch-copy > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matter-switch-copy strong {
  font-size: 13px;
}

.matter-switch-copy > span {
  color: var(--muted);
  font-size: 12px;
}

.matter-state-pill {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  min-height: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  font-size: 11px;
  font-weight: 850;
  padding: 0 7px;
  white-space: nowrap;
}

.matter-switch-button.active .matter-state-pill {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1558c7;
}

.matter-switch-button.active,
.matter-switch-button:hover {
  border-color: #8bb8f7;
  background: #f0f6ff;
}

.matter-switch-row.local .matter-switch-button {
  border-style: dashed;
  background: #f8fbff;
}

.matter-switch-row.local .matter-switch-button.active {
  border-style: solid;
  background: #eef5ff;
}

.matter-rename-button {
  min-width: 40px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: #1558c7;
  font-size: 11px;
  font-weight: 850;
  padding: 0 7px;
  white-space: nowrap;
}

.matter-rename-button:hover {
  border-color: #8bb8f7;
  background: #eef5ff;
}

.matter-rename-form {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
  border: 1px solid #cfe0f3;
  border-radius: 8px;
  background: #f8fbff;
  padding: 7px;
}

.matter-rename-form[hidden] {
  display: none;
}

.matter-rename-form input {
  grid-column: 1 / -1;
  min-width: 0;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  padding: 0 9px;
}

.matter-rename-form button {
  min-height: 28px;
  border: 1px solid #bdd1e7;
  border-radius: 8px;
  background: #eef5ff;
  color: #1558c7;
  font-size: 11px;
  font-weight: 850;
  padding: 0 7px;
}

.matter-rename-form button[data-matter-name-cancel] {
  background: var(--surface);
  color: var(--muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  padding: 0 9px;
}

.nav-item span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: #4b5563;
  font-size: 11px;
}

.nav-item.active,
.nav-item:hover {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.case-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.case-item {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 54px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  text-align: left;
}

.case-item span {
  font-weight: 700;
}

.case-item.active,
.case-item:hover {
  border-color: var(--line);
  background: var(--surface);
}

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

.workspace-view {
  display: none;
  height: 100%;
  min-height: 0;
}

.workspace-view.active {
  display: grid;
}

#chatView.workspace-view.active {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.workspace-view.active > * {
  min-width: 0;
}

#chatView {
  position: relative;
  height: 100dvh;
  overflow: hidden;
}

.chat-drop-overlay {
  position: absolute;
  inset: clamp(92px, 10vh, 122px) 18px 18px;
  z-index: 30;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.985);
  border: 2px dashed rgba(31, 111, 235, 0.42);
  border-radius: 12px;
  background: rgba(248, 251, 255, 0.88);
  box-shadow: inset 0 0 0 1px rgba(31, 111, 235, 0.08), 0 24px 80px rgba(31, 111, 235, 0.12);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.chat-drop-overlay div {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-width: min(360px, calc(100% - 32px));
  border: 1px solid rgba(31, 111, 235, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  padding: 16px 20px;
}

.chat-drop-overlay strong {
  color: #1558c7;
  font-size: 17px;
  letter-spacing: 0;
}

.chat-drop-overlay span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

#chatView.chat-drop-active .chat-drop-overlay {
  opacity: 1;
  transform: scale(1);
}

.chat-header,
.tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px);
}

.chat-title-block {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.chat-title-block span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.chat-header h1,
.tool-header h1 {
  margin: 0;
  font-size: 21px;
  letter-spacing: 0;
}

.chat-header p,
.tool-header p {
  margin: 6px 0 0;
  max-width: 680px;
  line-height: 1.5;
}

.chat-header-actions,
.tool-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.tool-header-actions {
  flex-wrap: wrap;
}

.desktop-dossier-button {
  min-width: 68px;
}

.chat-case-strip {
  display: grid;
  grid-template-columns: minmax(180px, 0.58fr) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 46px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 252, 253, 0.86);
  padding: 8px 20px;
}

.chat-case-current {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chat-case-current span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.chat-case-current strong {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-view {
  grid-template-rows: auto 1fr;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(520px, 1fr);
  gap: 18px;
  min-height: 0;
  padding: 20px 24px;
  overflow: auto;
}

body.archive-view .tool-grid {
  grid-template-areas: "board";
  grid-template-columns: minmax(0, 1fr);
  height: 100%;
  overflow: auto;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(360px, 1fr);
  gap: 18px;
  padding: 24px 32px;
  overflow: auto;
}

.owner-admin-grid {
  padding: 0;
  overflow: visible;
}

.admin-grid.admin-authenticated {
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 0;
}

.admin-grid.admin-authenticated .admin-dashboard-placeholder,
.admin-grid.admin-authenticated .admin-dashboard:empty {
  display: none;
}

.ops-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 14px;
}

.ops-tab {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  padding: 0 14px;
}

.ops-tab.active,
.ops-tab:hover {
  background: #18212f;
  color: #fff;
  border-color: #18212f;
}

.ops-tab.danger {
  border-color: #f3c4c4;
  color: #a92323;
}

.ops-tab.danger.active,
.ops-tab.danger:hover {
  border-color: #a92323;
  background: #a92323;
  color: #fff;
}

.ops-tab[hidden] {
  display: none;
}

.ops-panels {
  display: grid;
}

.ops-panel {
  display: none;
}

.ops-panel.active {
  display: block;
}

.ops-grid {
  display: grid;
  gap: 14px;
}

.ops-grid.two-col {
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
}

.ops-card,
.run-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 14px;
  box-shadow: var(--shadow);
}

.ops-card h2 {
  margin: 0 0 12px;
  font-size: 16px;
  letter-spacing: 0;
}

.ops-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ops-card-header h2 {
  margin: 0;
}

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

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

.feed-layer-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.lawyer-collection-panel {
  gap: 16px;
}

.lawyer-collection-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.knowledge-layer-card.lawyer {
  background: #fff;
}

.knowledge-layer-card.lawyer .control-list {
  gap: 8px;
}

.knowledge-system-map {
  display: grid;
  gap: 16px;
}

.knowledge-system-section {
  display: grid;
  gap: 10px;
}

.knowledge-system-section h3,
.knowledge-system-subpanel h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0;
}

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

.knowledge-route-card,
.knowledge-system-subpanel {
  display: grid;
  gap: 10px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
}

.knowledge-route-card.can-reference {
  border-left: 4px solid var(--green);
}

.knowledge-route-card.hold-only {
  border-left: 4px solid #d98c00;
}

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

.knowledge-route-head h3 {
  margin: 0 0 4px;
  font-size: 14px;
  letter-spacing: 0;
}

.knowledge-route-head span,
.knowledge-route-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.knowledge-route-head strong {
  font-size: 22px;
  letter-spacing: 0;
}

.advanced-tools-details {
  display: block;
}

.advanced-tools-details > summary {
  cursor: pointer;
  font-weight: 850;
  letter-spacing: 0;
}

.advanced-tools-details[open] > summary {
  margin-bottom: 12px;
}

.tool-form,
.archive-form-drawer,
.admin-login,
.admin-inline-form {
  display: grid;
  gap: 10px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 14px;
  box-shadow: var(--shadow);
}

.admin-password-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 10px;
  margin-top: 12px;
}

.tool-form label,
.archive-form-drawer label,
.admin-login label,
.admin-password-form label,
.admin-inline-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.tool-form input,
.tool-form select,
.tool-form textarea,
.archive-form-drawer input,
.archive-form-drawer select,
.archive-form-drawer textarea,
.admin-login input,
.admin-password-form input,
.admin-inline-form input,
.admin-inline-form select,
.filter-row input,
.filter-row select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 10px;
}

.tool-form textarea,
.archive-form-drawer textarea {
  max-height: none;
  resize: vertical;
}

.archive-form-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 86;
  grid-area: form;
  width: min(440px, calc(100vw - 32px));
  height: 100dvh;
  max-height: none;
  overflow: auto;
  border-width: 0 0 0 1px;
  border-radius: 0;
  box-shadow: -18px 0 48px rgba(20, 31, 45, 0.18);
  transform: translateX(104%);
  transition: transform 0.2s ease;
}

.archive-form-drawer[aria-hidden="true"] {
  pointer-events: none;
}

.archive-form-mobile-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding-bottom: 10px;
}

.archive-form-mobile-head div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.archive-form-mobile-head strong {
  font-size: 15px;
}

.archive-form-mobile-head span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.archive-form-backdrop {
  position: fixed;
  inset: 0;
  z-index: 84;
  display: block;
  background: rgba(15, 23, 42, 0.24);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

body.archive-form-open .archive-form-backdrop {
  opacity: 1;
  pointer-events: auto;
}

body.archive-form-open .archive-form-drawer {
  transform: translateX(0);
}

.archive-upload-box {
  border: 1px dashed #b8c7d8;
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.archive-upload-box input {
  background: var(--surface);
}

.archive-upload-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}

.archive-draft-status {
  display: grid;
  gap: 3px;
  border: 1px solid #dbe7f5;
  border-radius: 12px;
  background: #fbfdff;
  padding: 9px 10px;
}

.archive-draft-status span {
  width: fit-content;
  border-radius: 999px;
  background: #eef5ff;
  color: #1558c7;
  font-size: 11px;
  font-weight: 900;
  padding: 2px 7px;
}

.archive-draft-status strong {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-draft-status small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.archive-draft-status[data-archive-draft-state="recognizing"] span,
.archive-draft-status[data-archive-draft-state="saving"] span {
  background: #fff7e8;
  color: #a35e00;
}

.archive-draft-status[data-archive-draft-state="ready"] span {
  background: #eaf7f1;
  color: #16835a;
}

.archive-draft-status[data-archive-draft-state="error"] span,
.archive-draft-status[data-archive-draft-state="locked"] span {
  background: #fff1f1;
  color: #b42323;
}

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

.archive-primary-fields label:first-child {
  grid-column: 1 / -1;
}

.archive-advanced-fields {
  display: block;
  border: 1px solid #dbe7f5;
  border-radius: 8px;
  background: #fbfdff;
  padding: 8px;
}

.archive-advanced-fields > summary {
  cursor: pointer;
  color: #1558c7;
  font-size: 12px;
  font-weight: 850;
  list-style: none;
}

.archive-advanced-fields > summary::-webkit-details-marker {
  display: none;
}

.archive-advanced-fields[open] > summary {
  margin-bottom: 8px;
}

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

.archive-advanced-grid .wide {
  grid-column: 1 / -1;
}

.archive-submit-row {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: grid;
  border-top: 1px solid rgba(211, 218, 227, 0.72);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), var(--surface) 34%);
  padding-top: 10px;
}

.archive-submit-row .send-button {
  width: 100%;
  min-height: 36px;
}

.wide {
  grid-column: 1 / -1;
}

.archive-board,
.knowledge-dashboard,
.admin-dashboard {
  display: grid;
  align-content: start;
  gap: 12px;
}

.archive-board {
  grid-area: board;
  min-width: 0;
}

.admin-dashboard {
  min-width: 0;
}

.archive-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.archive-summary-note {
  flex: 1 1 260px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: right;
}

.archive-scope-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(76px, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
  background: var(--surface-2);
}

.archive-scope-switch button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 0 9px;
  white-space: nowrap;
}

.archive-scope-switch button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 6px rgba(20, 31, 45, 0.12);
}

.archive-filter-shell {
  display: grid;
  grid-template-columns: 150px 150px minmax(220px, 1fr);
  align-items: start;
  gap: 10px;
}

.archive-filter-shell #archiveSearch {
  grid-column: 3;
}

.archive-filter-details {
  display: contents;
}

.archive-filter-details summary {
  display: none;
}

.archive-filter-details .filter-row {
  display: contents;
}

.archive-filter-details #archiveFilterCategory {
  grid-column: 1;
  grid-row: 1;
}

.archive-filter-details #archiveFilterStatus {
  grid-column: 2;
  grid-row: 1;
}

.filter-row {
  display: grid;
  grid-template-columns: 150px 150px minmax(220px, 1fr);
  gap: 10px;
}

.knowledge-toolbar {
  display: grid;
  grid-template-columns: 150px 150px 1fr;
  gap: 10px;
}

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

.knowledge-metric {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.knowledge-metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.knowledge-metric strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  letter-spacing: 0;
}

.knowledge-metric p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.knowledge-layer-bars {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.knowledge-layer-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 0 8px;
}

.knowledge-layer-bar span,
.knowledge-layer-bar strong {
  margin: 0;
  font-size: 12px;
}

.knowledge-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 12px;
  align-items: start;
}

.knowledge-section {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title-row h2 {
  margin: 0;
  font-size: 16px;
}

.section-title-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.archive-list,
.knowledge-list,
.metric-grid,
.recent-list {
  display: grid;
  gap: 10px;
}

.archive-card,
.knowledge-card,
.metric-card,
.recent-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.archive-state-card {
  display: grid;
  gap: 8px;
  border: 1px dashed #cbd6e2;
  border-radius: 8px;
  background: #f8fafc;
  padding: 18px;
}

.archive-state-card span {
  width: fit-content;
  border-radius: 999px;
  background: #e9f1fb;
  color: #255d9c;
  font-size: 11px;
  font-weight: 850;
  padding: 4px 8px;
}

.archive-state-card h3 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.35;
}

.archive-state-card p,
.archive-state-card small {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.archive-state-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.archive-state-button {
  min-height: 28px;
  border: 1px solid #bdd1e7;
  border-radius: 8px;
  background: #eef5ff;
  color: #1558c7;
  cursor: pointer;
  font-size: 11px;
  font-weight: 850;
  padding: 0 9px;
}

.archive-state-button:hover,
.archive-state-button:focus-visible {
  border-color: #8bb8f7;
  background: #e3efff;
  outline: none;
}

.archive-state-card.error {
  border-color: #f1b1b1;
  background: #fff7f7;
}

.archive-state-card.error span {
  background: #ffe7e7;
  color: #b42318;
}

.archive-state-card.loading {
  border-style: solid;
}

.archive-state-card.locked {
  border-color: #d4c6f4;
  background: #fbf8ff;
}

.metric-card-action {
  appearance: none;
  display: block;
  width: 100%;
  color: inherit;
  font: inherit;
  margin: 0;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.metric-card-action:hover,
.metric-card-action:focus-visible {
  border-color: #8fb4e7;
  box-shadow: 0 12px 30px rgba(31, 111, 235, 0.12);
  outline: none;
  transform: translateY(-1px);
}

.metric-card-action:active {
  transform: translateY(0);
}

.admin-jump-highlight {
  animation: adminJumpPulse 1.9s ease;
}

@keyframes adminJumpPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(31, 111, 235, 0.28);
    border-color: #1f6feb;
  }
  70% {
    box-shadow: 0 0 0 10px rgba(31, 111, 235, 0);
    border-color: #8fb4e7;
  }
  100% {
    box-shadow: none;
  }
}

.archive-card {
  display: grid;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.archive-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.archive-card-title {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.archive-card.deleted {
  background: #f8fafc;
  border-style: dashed;
  opacity: 0.92;
}

.archive-card:hover,
.archive-card:focus {
  border-color: #a8bfd8;
  box-shadow: 0 10px 28px rgba(20, 31, 45, 0.08);
  outline: none;
  transform: translateY(-1px);
}

.archive-card.evidence {
  border-left: 4px solid var(--amber);
}

.archive-card.case_file {
  border-left: 4px solid var(--blue);
}

.archive-card.document {
  border-left: 4px solid var(--green);
}

.archive-card.note {
  border-left: 4px solid var(--purple);
}

.archive-card.citation {
  border-left: 4px solid var(--red);
}

.knowledge-card {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.knowledge-card.candidate {
  border-left: 4px solid var(--amber);
}

.knowledge-card.needs_supplement {
  border-left: 4px solid var(--red);
}

.knowledge-card.distilled,
.knowledge-card.approved {
  border-left: 4px solid var(--green);
}

.knowledge-card.rejected {
  border-left: 4px solid #94a3b8;
  background: #f8fafc;
}

.archive-meta,
.recent-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.archive-extra-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.archive-extra-grid span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 7px;
}

.archive-card-file-name {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-card-copy {
  display: grid;
  gap: 5px;
}

.archive-card-copy p {
  margin: 0;
}

.archive-card-actions,
.detail-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.archive-action-button,
.detail-action-button {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  padding: 0 9px;
}

.archive-action-button.danger,
.detail-action-button.danger {
  border-color: #f1b1b1;
  background: #fff5f5;
  color: #a42323;
}

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

.metric-card {
  min-height: 92px;
}

.metric-value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 850;
  letter-spacing: 0;
}

.usage-section {
  display: grid;
  gap: 10px;
}

.usage-section h2 {
  margin: 8px 0 0;
  font-size: 15px;
}

.type-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.type-pill {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: #344054;
  padding: 7px 9px;
  font-size: 12px;
}

.type-pill.warn {
  border-color: #f1c36d;
  background: #fff8e8;
  color: #8a5200;
}

.type-pill.ok {
  border-color: #9fd8bd;
  background: #ecfdf5;
  color: #087044;
}

.type-pill.danger {
  border-color: #f2a8a3;
  background: #fff1f1;
  color: #a2302a;
}

.account-user-card {
  display: grid;
  gap: 10px;
  border-left: 4px solid #9bb6d8;
}

.account-user-card.deleted {
  border-left-color: #d0a3a3;
  background: #fffafa;
}

.account-user-summary-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.account-user-summary-row > div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.account-user-detail-toggle,
.account-user-operation-toggle {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.account-user-detail-toggle > summary,
.account-user-operation-toggle > summary {
  min-height: 34px;
  cursor: pointer;
  color: #344054;
  font-size: 13px;
  font-weight: 850;
  padding: 8px 10px;
}

.account-user-detail-body,
.account-user-operation-body {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 10px;
}

.account-user-detail-body p,
.account-user-operation-body p {
  margin: 0;
}

.account-danger-zone {
  display: grid;
  gap: 8px;
  border: 1px dashed #e6b1a8;
  border-radius: 8px;
  background: #fff8f6;
  padding: 10px;
}

.account-soft-delete-note {
  margin: 0;
  color: #7a3b31;
  font-size: 12px;
  line-height: 1.45;
}

.account-status-pill {
  display: inline-grid;
  align-items: center;
  min-height: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: #344054;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.2;
  white-space: nowrap;
}

.account-status-pill.ok {
  border-color: #9fd8bd;
  background: #ecfdf5;
  color: #087044;
}

.account-status-pill.warn {
  border-color: #f1c36d;
  background: #fff8e8;
  color: #8a5200;
}

.account-status-pill.danger {
  border-color: #f2a8a3;
  background: #fff1f1;
  color: #a2302a;
}

.account-status-pill.neutral {
  border-color: #d8e0e8;
  background: #f8fafc;
  color: #667085;
}

.account-risk-note {
  margin: 0;
  color: #5d6b7a;
  font-size: 12px;
  line-height: 1.45;
}

.account-action-zone {
  display: grid;
  gap: 8px;
  border: 1px dashed #c9d6e5;
  border-radius: 8px;
  background: #fbfdff;
  padding: 10px;
}

.account-action-zone > strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.account-action-zone .admin-inline-form {
  margin-top: 0;
  box-shadow: none;
}

.account-user-tools {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.account-user-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.account-user-filter-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: #425166;
  font-size: 12px;
  font-weight: 850;
  padding: 0 10px;
  white-space: nowrap;
}

.account-user-filter-button span {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  min-height: 20px;
  border-radius: 999px;
  background: #e9eef5;
  color: #475569;
  font-size: 11px;
  line-height: 1;
  padding: 0 6px;
}

.account-user-filter-button.active {
  border-color: #9bbff3;
  background: #eef5ff;
  color: #1558c7;
}

.account-user-filter-button.active span {
  background: #dbeafe;
  color: #1d4ed8;
}

.account-user-result-summary {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.account-user-results {
  min-width: 0;
}

.account-user-empty-state {
  border: 1px dashed #cbd6e2;
  border-radius: 8px;
  background: #fbfcfd;
  padding: 14px;
}

.control-list,
.agent-table {
  display: grid;
  gap: 10px;
}

.control-row,
.agent-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 10px;
}

.control-row {
  display: grid;
  gap: 5px;
}

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

.control-row p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.agent-row {
  display: grid;
  grid-template-columns: 1fr 72px;
  gap: 12px;
  align-items: start;
}

.agent-row.active {
  border-left: 4px solid var(--green);
}

.agent-row.standby {
  border-left: 4px solid var(--line);
}

.agent-row p {
  margin: 5px 0 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.agent-row-metrics {
  display: grid;
  justify-items: end;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
}

.agent-row-metrics strong {
  color: var(--text);
  font-size: 24px;
}

.flow-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.flow-node {
  position: relative;
  display: grid;
  gap: 3px;
  min-width: 118px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px;
}

.flow-node::after {
  content: ">";
  position: absolute;
  right: -9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 12px;
}

.flow-node:last-child::after {
  content: "";
}

.flow-node strong {
  font-size: 12px;
}

.flow-node small {
  color: var(--muted);
  font-size: 11px;
}

.knowledge-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.knowledge-layer-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
}

.knowledge-layer-card.practice {
  border-left: 4px solid var(--blue);
}

.knowledge-layer-card.statute {
  border-left: 4px solid var(--green);
}

.knowledge-layer-card.case {
  border-left: 4px solid var(--purple);
}

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

.knowledge-layer-head h3 {
  margin: 0 0 4px;
  font-size: 15px;
  letter-spacing: 0;
}

.knowledge-layer-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.knowledge-layer-head strong {
  font-size: 24px;
  letter-spacing: 0;
}

.knowledge-layer-card p,
.knowledge-flow-step p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.coverage-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f7;
}

.coverage-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #1f6feb;
}

.knowledge-layer-card.statute .coverage-track span {
  background: #16835a;
}

.knowledge-layer-card.case .coverage-track span {
  background: #7254c7;
}

.feed-workbench {
  display: grid;
  gap: 14px;
}

.steward-workbench-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(360px, 1.05fr) minmax(360px, 1fr);
  gap: 14px;
  align-items: start;
}

.steward-column {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.admin-dashboard-placeholder {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  padding: 12px 14px;
}

.feed-upload-form {
  display: grid;
  gap: 12px;
}

.feed-upload-drop {
  display: grid;
  place-items: center;
  min-height: 128px;
  border: 1px dashed #b7cae0;
  border-radius: 8px;
  background: #f8fbff;
  color: var(--text);
  cursor: pointer;
  padding: 18px;
  text-align: center;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.feed-upload-drop.dragging {
  border-color: var(--blue);
  background: #eef5ff;
}

.feed-upload-drop input {
  width: 100%;
  max-width: 420px;
  margin-bottom: 10px;
}

.feed-upload-drop span {
  font-weight: 850;
}

.feed-upload-drop small {
  color: var(--muted);
  font-size: 12px;
}

.feed-upload-form.compact {
  gap: 10px;
}

.feed-upload-drop.compact {
  min-height: 106px;
  padding: 14px;
}

.feed-upload-row.compact {
  grid-template-columns: minmax(0, 1fr) auto;
}

.feed-upload-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.feed-field-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.feed-main-grid {
  align-items: start;
}

.steward-list-card,
.steward-suggestion-card,
.steward-review-panel {
  min-height: 620px;
}

.steward-source-list,
.steward-node-list {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
  padding-right: 2px;
}

.steward-source-row,
.steward-node-choice {
  display: grid;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--text);
  padding: 10px;
  text-align: left;
}

.steward-source-row.active,
.steward-node-choice.active {
  border-color: #8fb7f5;
  background: #f2f7ff;
  box-shadow: inset 3px 0 0 var(--blue);
}

.source-row-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.source-row-main strong,
.steward-node-choice strong {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.source-row-main small,
.steward-node-choice span {
  color: var(--muted);
  font-size: 12px;
}

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

.steward-selected-file {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.steward-selected-file strong {
  overflow-wrap: anywhere;
}

.steward-selected-file span {
  color: var(--muted);
  font-size: 12px;
}

.steward-decision-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.steward-decision-grid .metric-card {
  min-height: 92px;
}

.steward-decision-grid .metric-value {
  font-size: 18px;
  overflow-wrap: anywhere;
}

.steward-verdict-card {
  display: grid;
  gap: 7px;
  border: 1px solid #cfe0f5;
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: #f7fbff;
  padding: 12px;
}

.steward-verdict-card.ok {
  border-color: #bbebd7;
  border-left-color: #15966a;
  background: #f4fff9;
}

.steward-verdict-card.warn {
  border-color: #f8d99b;
  border-left-color: #d98500;
  background: #fffaf0;
}

.steward-verdict-card.danger {
  border-color: #ffc4c4;
  border-left-color: #d83939;
  background: #fff7f7;
}

.steward-verdict-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.steward-verdict-card strong {
  color: var(--text);
  font-size: 20px;
  line-height: 1.2;
}

.steward-verdict-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.steward-block {
  display: grid;
  gap: 8px;
  border: 1px solid #dbe5ee;
  border-radius: 8px;
  background: #fbfcfd;
  padding: 10px;
}

.steward-block h3 {
  margin: 0;
  font-size: 13px;
}

.steward-block p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.steward-warning-summary {
  background: #fffaf0;
  border-color: #f8d99b;
}

.steward-evidence-details {
  border: 1px solid #dbe5ee;
  border-radius: 8px;
  background: #ffffff;
}

.steward-evidence-details > summary {
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
  padding: 10px 12px;
}

.steward-evidence-details[open] > summary {
  border-bottom: 1px solid #e5edf5;
}

.steward-evidence-body {
  display: grid;
  gap: 10px;
  padding: 10px;
}

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

.steward-linked-list {
  display: grid;
  gap: 8px;
}

.steward-linked-node {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 9px 10px;
  text-align: left;
}

.steward-linked-node.active {
  border-color: #8fb7f5;
  background: #f2f7ff;
  box-shadow: inset 3px 0 0 var(--blue);
}

.steward-linked-node span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.steward-linked-node strong {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.steward-linked-node small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.steward-linked-node em {
  color: var(--blue);
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
  white-space: nowrap;
}

.steward-source-context {
  display: grid;
  gap: 10px;
  border: 1px solid #dbe5ee;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.steward-source-context h3 {
  margin: 0;
  font-size: 13px;
}

.steward-context-grid {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 6px 10px;
  align-items: start;
  font-size: 12px;
}

.steward-context-grid span {
  color: var(--muted);
  font-weight: 750;
}

.steward-context-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.steward-source-context p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.steward-review-panel > .knowledge-review-card {
  box-shadow: none;
}

.steward-review-empty-state {
  display: grid;
  gap: 10px;
  border: 1px solid #dbe5ee;
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
}

.steward-review-empty-state h3 {
  margin: 0;
  font-size: 14px;
}

.steward-review-empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.knowledge-mini-flow.compact {
  gap: 8px;
}

.knowledge-mini-flow.compact .knowledge-flow-step {
  min-height: 0;
  padding: 9px 10px;
}

.knowledge-mini-flow.compact .knowledge-flow-step p {
  font-size: 12px;
}

.knowledge-review-retrieval-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px 10px;
}

.knowledge-review-retrieval-row input {
  width: 16px;
  min-height: 16px;
}

.knowledge-review-retrieval-row span {
  color: var(--text);
  font-weight: 850;
}

.knowledge-review-retrieval-row small {
  grid-column: 2;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.45;
}

.steward-layer-overview .feed-layer-board {
  margin-top: 12px;
}

.feed-source-list {
  display: grid;
  gap: 10px;
  max-height: 620px;
  overflow: auto;
  padding-right: 4px;
}

.feed-source-card,
.feed-knowledge-card,
.feed-layer-section {
  display: grid;
  gap: 10px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
}

.feed-source-card {
  border-left: 4px solid #d97706;
}

.feed-source-card h3,
.feed-knowledge-card h3 {
  margin: 0;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.feed-source-card p,
.feed-knowledge-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.feed-intelligence-box {
  display: grid;
  gap: 6px;
  border: 1px solid #d8e4f0;
  border-radius: 8px;
  background: #f8fbff;
  padding: 10px;
}

details.feed-intelligence-box {
  display: block;
  padding: 0;
  overflow: hidden;
}

details.feed-intelligence-box > summary {
  cursor: pointer;
  color: #305071;
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0;
  list-style-position: inside;
  padding: 10px 12px;
}

.feed-intelligence-detail {
  display: grid;
  gap: 6px;
  border-top: 1px solid #d8e4f0;
  padding: 10px;
}

.feed-intelligence-box.compact {
  background: #fbfcfd;
}

.feed-intelligence-box strong {
  color: var(--text);
  font-size: 13px;
}

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

.feed-value-summary > div {
  border: 1px solid #dbe5ee;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.feed-value-summary p {
  margin-top: 4px;
}

.feed-warning-box {
  display: grid;
  gap: 6px;
  border: 1px solid #f1c27a;
  border-radius: 8px;
  background: #fff8eb;
  padding: 8px;
}

.feed-warning-box p {
  color: #7a4a10;
}

.feed-checklist {
  display: grid;
  gap: 6px;
}

.feed-checklist span {
  border: 1px solid #dbe5ee;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  padding: 6px 8px;
}

.feed-checklist.action span {
  border-color: #c5d7ff;
  background: #f7faff;
  color: #214b92;
}

.feed-checklist.compact {
  margin-top: 4px;
}

.feed-excerpts {
  display: grid;
  gap: 6px;
}

.feed-excerpts span {
  border-left: 3px solid #bdd1e7;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  padding: 6px 8px;
}

.feed-layer-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.feed-layer-section.practice {
  border-left: 4px solid var(--blue);
}

.feed-layer-section.statute {
  border-left: 4px solid var(--green);
}

.feed-layer-section.case {
  border-left: 4px solid var(--purple);
}

.feed-layer-section .knowledge-layer-head strong {
  font-size: 22px;
}

.feed-layer-results {
  display: grid;
  gap: 10px;
  align-content: start;
  max-height: 540px;
  overflow: auto;
  padding-right: 2px;
}

.feed-knowledge-card.practice {
  border-left: 3px solid var(--blue);
}

.feed-knowledge-card.statute {
  border-left: 3px solid var(--green);
}

.feed-knowledge-card.case {
  border-left: 3px solid var(--purple);
}

.advanced-governance-panel {
  display: grid;
  gap: 12px;
}

.advanced-governance-intro {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  padding: 14px;
}

.advanced-governance-intro h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.advanced-governance-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.advanced-governance-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.advanced-governance-panel > details {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 12px;
  box-shadow: var(--shadow);
}

.advanced-governance-panel > details.admin-risk-zone {
  border-color: #f3c4c4;
  background: #fff8f8;
}

.admin-risk-zone > summary span {
  color: #9f1d1d;
}

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

.advanced-governance-panel > details > summary {
  align-items: start;
  cursor: pointer;
  display: grid;
  gap: 3px;
  font-weight: 850;
  letter-spacing: 0;
}

.advanced-governance-panel > details > summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

.advanced-governance-panel > details > div {
  margin-top: 12px;
}

.advanced-section-layout {
  display: grid;
  gap: 12px;
}

.advanced-summary-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.knowledge-priority-summary,
.access-summary-strip {
  border-left: 4px solid var(--blue);
}

.knowledge-priority-list {
  border-left: 4px solid var(--amber);
}

.knowledge-layer-quick-board {
  align-items: stretch;
}

.knowledge-governance-entry {
  border-left: 4px solid var(--green);
}

.knowledge-governance-entry .ops-inline-actions {
  justify-content: flex-start;
}

.knowledge-long-details {
  display: block;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: #fbfcfd;
  padding: 14px;
  box-shadow: var(--shadow);
}

.knowledge-long-details > summary {
  display: grid;
  gap: 3px;
  cursor: pointer;
  font-weight: 850;
  letter-spacing: 0;
}

.knowledge-long-details > summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

.knowledge-long-details[open] > summary {
  margin-bottom: 12px;
}

.knowledge-mobile-collapsed {
  scroll-margin-top: 14px;
}

.material-admin-workbench,
.access-admin-workbench {
  min-width: 0;
}

.test-ledger-workbench {
  min-width: 0;
}

.test-ledger-import-card {
  border-left: 4px solid var(--blue);
}

.test-ledger-import-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.test-ledger-import-form label {
  min-width: 0;
}

.test-ledger-dashboard {
  border-left: 4px solid var(--green);
}

.test-ledger-dashboard .metric-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.test-ledger-sample-list {
  border-left: 4px solid var(--purple);
}

.test-ledger-sample-list .knowledge-governance-list {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.test-ledger-empty-state {
  background: #fbfcfd;
}

.material-admin-workbench .advanced-summary-card {
  border-left: 4px solid var(--purple);
}

.material-risk-note {
  display: grid;
  gap: 4px;
  border: 1px solid #f1cf96;
  border-radius: 8px;
  background: #fffaf0;
  color: #7a4a00;
  padding: 10px 12px;
}

.material-risk-note strong {
  font-size: 13px;
}

.material-risk-note p {
  margin: 0;
  color: #7a4a00;
  font-size: 12px;
  line-height: 1.55;
}

.trial-access-form {
  grid-template-columns: minmax(160px, 1.1fr) minmax(120px, 0.75fr) minmax(160px, 1fr);
  align-items: end;
}

.trial-access-form label,
.trial-access-form button {
  min-width: 0;
}

.trial-access-form .send-button {
  grid-column: 1 / -1;
  width: 100%;
}

.access-priority-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.92fr);
  gap: 12px;
  align-items: start;
}

.access-create-card {
  grid-column: 2;
  grid-row: 1 / span 2;
  border-left: 4px solid var(--green);
}

.access-create-card .ops-card-header > div {
  min-width: 0;
}

.access-create-card .type-pill {
  flex: 0 0 auto;
  white-space: nowrap;
}

.access-security-summary {
  border-left: 4px solid var(--amber);
}

.access-security-summary .control-list {
  max-height: 220px;
  overflow: auto;
  padding-right: 2px;
}

.access-action-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.access-action-strip h2 {
  margin: 0 0 4px;
  font-size: 16px;
  letter-spacing: 0;
}

.access-long-sections {
  display: grid;
  gap: 10px;
}

.access-collapsed-section > summary {
  display: grid;
  gap: 3px;
}

.access-collapsed-section > summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}

.access-detail-section {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.trial-access-status {
  grid-column: 1 / -1;
}

.trial-issue-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

.trial-issue-form .wide-field {
  grid-column: 1 / -1;
}

.trial-issue-form #trialIssueStatus {
  align-self: center;
}

.material-admin-actions {
  align-items: center;
}

.material-admin-card .type-list {
  min-width: 0;
  max-width: 100%;
}

.material-admin-card .type-pill {
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.high-risk-governance-panel {
  max-width: 860px;
}

.high-risk-routing-panel {
  max-width: 760px;
}

.high-risk-governance-panel .admin-risk-zone {
  display: grid;
  gap: 12px;
  border: 1px solid #f3c4c4;
  border-radius: 14px;
  background: linear-gradient(180deg, #fff 0%, #fff8f8 100%);
  padding: 14px;
  box-shadow: var(--shadow);
}

.high-risk-not-execution h2 {
  margin: 0 0 6px;
  color: #9f1d1d;
  font-size: 18px;
  letter-spacing: 0;
}

.high-risk-not-execution p {
  margin: 0;
  color: #7f1d1d;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.5;
}

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

.advanced-history-details {
  border-style: dashed;
}

.advanced-history-details > summary {
  cursor: pointer;
  font-weight: 850;
  letter-spacing: 0;
}

.advanced-history-body {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.advanced-history-search {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(220px, 1fr) auto;
}

.advanced-history-search label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
}

.advanced-history-search input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  min-height: 38px;
  padding: 0 11px;
  width: 100%;
}

.advanced-history-filter-row {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.advanced-history-filter-row label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
}

.advanced-history-filter-row select {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  min-height: 38px;
  padding: 0 10px;
  width: 100%;
}

.history-limit-note {
  background: #f8fafc;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  padding: 9px 11px;
}

.recent-list.compact {
  gap: 8px;
}

.recent-list.compact .recent-card {
  padding: 10px;
}

.admin-confirm-overlay {
  align-items: center;
  background: rgba(15, 23, 42, 0.32);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: fixed;
  z-index: 1000;
}

.admin-confirm-dialog {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  display: grid;
  gap: 12px;
  max-width: 560px;
  padding: 18px;
  width: min(560px, 100%);
}

.admin-confirm-dialog.danger {
  border-color: #fecaca;
}

.admin-confirm-dialog h2 {
  font-size: 18px;
  margin: 0;
}

.admin-confirm-message {
  color: var(--text);
  line-height: 1.65;
  margin: 0;
}

.admin-confirm-details {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  gap: 6px;
  line-height: 1.5;
  margin: 0;
  padding: 10px 12px 10px 28px;
}

.admin-confirm-field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
}

.admin-confirm-field textarea,
.admin-confirm-field input {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  padding: 10px;
}

.admin-confirm-error {
  color: #b91c1c;
  font-size: 13px;
  min-height: 18px;
}

.admin-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.knowledge-mini-flow {
  display: grid;
  gap: 8px;
}

.knowledge-flow-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 4px 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.knowledge-flow-step span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 28px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.knowledge-flow-step strong {
  font-size: 13px;
}

.knowledge-review-list {
  display: grid;
  gap: 12px;
}

.knowledge-review-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
}

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

.knowledge-review-head h3 {
  margin: 5px 0 0;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.knowledge-review-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.knowledge-review-card input,
.knowledge-review-card select,
.knowledge-review-card textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
}

.knowledge-review-card textarea {
  resize: vertical;
  line-height: 1.5;
}

.knowledge-review-layer {
  max-width: 140px;
}

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

.knowledge-review-checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.knowledge-review-checks label.checked {
  border-color: #8fc7a5;
  background: #f1fbf5;
  color: #116333;
}

.knowledge-review-checks input {
  width: 16px;
  min-height: 16px;
  cursor: pointer;
}

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

.knowledge-governance-list {
  display: grid;
  gap: 12px;
}

.knowledge-bulk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.knowledge-bulk-bar input {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  padding: 7px 9px;
}

.knowledge-bulk-bar > input {
  flex: 1 1 220px;
}

.knowledge-select-all,
.knowledge-row-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.knowledge-row-select {
  padding-top: 4px;
}

.knowledge-governance-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
}

.knowledge-governance-card.disabled {
  border-left-color: var(--amber);
}

.knowledge-governance-card.deleted {
  border-left-color: #b8c2d1;
  background: #f7f9fc;
}

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

.knowledge-governance-head > div:nth-child(2) {
  flex: 1;
  min-width: 0;
}

.knowledge-governance-head h3 {
  margin: 5px 0 0;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.knowledge-retrieval-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 6px 10px;
  white-space: nowrap;
}

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

.knowledge-governance-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.knowledge-governance-grid .wide {
  grid-column: 1 / -1;
}

.knowledge-governance-grid input,
.knowledge-governance-grid select,
.knowledge-governance-grid textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
}

.knowledge-governance-grid textarea {
  line-height: 1.5;
  resize: vertical;
}

.admin-feedback,
.knowledge-review-message {
  min-height: 20px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.5;
}

.admin-state {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.admin-state.compact {
  display: grid;
  gap: 3px;
  min-height: 0;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  padding: 9px 10px;
  font-size: 12px;
  line-height: 1.45;
}

.admin-state.compact strong {
  color: var(--text);
  font-size: 13px;
}

.admin-state.compact span {
  color: var(--muted);
  font-weight: 700;
}

.admin-feedback {
  display: grid;
  gap: 2px;
}

.admin-feedback strong {
  color: inherit;
  font-size: 12px;
}

.admin-feedback span {
  color: inherit;
  font-weight: 700;
}

.admin-feedback-details {
  display: grid;
  gap: 2px;
  margin: 4px 0 0;
  padding-left: 16px;
  color: inherit;
  font-weight: 700;
}

.admin-feedback-details li {
  margin: 0;
}

.admin-feedback.inline {
  display: inline-grid;
  min-height: 0;
}

.admin-feedback.inline strong {
  display: none;
}

.admin-feedback.inline span {
  white-space: normal;
}

.admin-feedback.inline .admin-feedback-details {
  margin-top: 3px;
}

.knowledge-review-message.pending,
.knowledge-review-message.warn,
.knowledge-review-message.error,
.knowledge-review-message.ok {
  border: 1px solid var(--line);
  padding: 8px 10px;
}

.admin-state.pending {
  border-color: #d8e0e8;
}

.admin-state.warn {
  border-color: #f3d9a4;
}

.admin-state.error {
  border-color: #f1b1b1;
}

.admin-state.ok {
  border-color: #a8d8bc;
}

.knowledge-review-message.pending {
  background: #f6f8fb;
  color: var(--muted);
}

.knowledge-review-message.warn {
  border-color: #f3d9a4;
  background: #fff9ec;
  color: #8a5a00;
}

.knowledge-review-message.error {
  border-color: #f1b1b1;
  background: #fff5f5;
  color: #a42323;
}

.knowledge-review-message.ok {
  border-color: #8fc7a5;
  background: #f1fbf5;
  color: #116333;
}

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

.knowledge-settings-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.knowledge-settings-grid input[type="number"] {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
}

.knowledge-setting-check {
  display: flex !important;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.knowledge-setting-check input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.knowledge-setting-check span {
  display: grid;
  gap: 2px;
}

.knowledge-setting-check small {
  color: var(--muted);
  font-weight: 600;
  line-height: 1.35;
}

#knowledgeTestQuery {
  width: 100%;
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  padding: 10px;
  resize: vertical;
}

.knowledge-test-results,
.knowledge-impact-result {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.knowledge-maintenance-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 12px;
  margin-top: 12px;
}

.knowledge-maintenance-grid h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

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

.knowledge-duplicate-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--purple);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 10px;
}

.knowledge-duplicate-card h3 {
  margin: 0;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.knowledge-duplicate-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.knowledge-version-result {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.knowledge-version-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.knowledge-version-row p,
.knowledge-version-row small {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.knowledge-test-hit,
.knowledge-impact-result {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 10px;
}

.knowledge-test-hit.usable {
  border-left: 4px solid var(--green);
}

.knowledge-test-hit.blocked {
  border-left: 4px solid var(--amber);
}

.knowledge-test-hit h3 {
  margin: 5px 0 6px;
  font-size: 14px;
}

.knowledge-test-hit p,
.knowledge-impact-result p,
.knowledge-impact-result li {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.knowledge-impact-result ul {
  margin: 0;
  padding-left: 18px;
}

.secondary-button.danger {
  border-color: #f1b1b1;
  background: #fff5f5;
  color: #a42323;
}

.admin-note {
  font-size: 12px;
  line-height: 1.45;
}

.access-code-banner {
  display: grid;
  gap: 4px;
  border: 1px solid #acd5bf;
  border-radius: 8px;
  background: #f0fff6;
  padding: 12px;
}

.access-code-banner span {
  color: #26724a;
  font-size: 12px;
  font-weight: 800;
}

.access-code-banner strong {
  color: #0f5132;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 20px;
  letter-spacing: 0;
}

.access-code-banner p {
  margin: 0;
  color: #3f6b54;
  font-size: 12px;
}

.archive-card h3,
.metric-card h3,
.recent-card h3 {
  margin: 0 0 6px;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.archive-card p,
.metric-card p,
.recent-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.material-admin-section {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  padding: 12px;
}

.material-admin-section + .material-admin-section {
  margin-top: 12px;
}

.material-trash-section {
  border-color: #f2c08a;
  background: #fffbf5;
}

.material-admin-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.material-admin-section-header h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.material-admin-section-header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.material-admin-list {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.material-trash-list {
  max-height: 360px;
}

.material-admin-card {
  display: grid;
  gap: 10px;
  align-content: start;
}

.material-admin-card.deleted {
  border-style: dashed;
  background: #f8fafc;
  opacity: 0.92;
}

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

.material-admin-details summary {
  cursor: pointer;
  color: var(--blue);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0;
}

.material-admin-details .detail-grid {
  margin-top: 10px;
}

.archive-open-button {
  justify-self: start;
  min-height: 28px;
  border: 1px solid #bdd1e7;
  border-radius: 8px;
  background: #eef5ff;
  color: #1558c7;
  font-size: 12px;
  font-weight: 800;
  padding: 0 10px;
}

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

.detail-modal[hidden] {
  display: none;
}

.detail-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
}

.detail-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(920px, calc(100vw - 32px));
  max-height: min(820px, calc(100vh - 40px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 22px 70px rgba(20, 31, 45, 0.22);
}

.attachment-preview-dialog {
  width: min(1100px, calc(100vw - 32px));
}

.attachment-preview-body {
  display: grid;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.attachment-preview-frame {
  width: 100%;
  height: min(72vh, 760px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.attachment-preview-media {
  width: 100%;
  max-height: min(72vh, 760px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  object-fit: contain;
}

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

.detail-header h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.detail-header p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.detail-body {
  display: grid;
  gap: 14px;
  overflow: auto;
  padding: 18px 20px 22px;
}

.archive-detail-summary {
  gap: 6px;
}

.archive-detail-summary span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--muted);
  padding: 4px 8px;
}

.detail-section {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

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

.detail-section h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0;
}

.detail-section p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.detail-section .detail-note {
  color: #5f6b7a;
  font-size: 12px;
}

.detail-section pre {
  max-height: 260px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: #344054;
  font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  padding: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(86px, 132px) minmax(0, 1fr);
  gap: 8px 14px;
  align-items: start;
}

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

.detail-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.detail-open-link {
  display: inline-grid;
  place-items: center;
  justify-self: start;
  text-decoration: none;
}

.attachment-preview-image {
  width: min(100%, 760px);
  max-height: 460px;
  object-fit: contain;
  justify-self: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.attachment-preview-media {
  width: min(100%, 760px);
  max-height: 460px;
  justify-self: start;
  border-radius: 8px;
  background: #111827;
}

.attachment-preview-frame {
  width: 100%;
  min-height: 460px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
}

.secondary-button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  padding: 0 10px;
  white-space: nowrap;
}

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

.detail-section.archive-detail-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px 12px;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
  background: var(--surface-2);
}

.mode-control {
  display: grid;
  gap: 6px;
  justify-items: end;
  min-width: min(330px, 100%);
}

.mode-hint {
  max-width: 330px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: right;
}

.mode-switch button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 0 8px;
  white-space: nowrap;
}

.mode-switch button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 6px rgba(20, 31, 45, 0.12);
}

.prompt-launcher {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.prompt-launcher.composer-prompt-launcher {
  width: min(900px, 100%);
  justify-content: flex-start;
  margin: 0 auto 6px;
}

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

.prompt-panel-head div {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.prompt-panel-head strong {
  font-size: 14px;
  letter-spacing: 0;
}

.prompt-panel-head span,
.prompt-group-hint {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 3px 8px;
}

.prompt-library-open {
  min-height: 28px;
  white-space: nowrap;
}

.composer-prompt-button {
  flex: 0 0 auto;
  min-height: 28px;
}

.prompt-quick-list {
  display: flex;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  overflow-x: auto;
  padding: 1px 0 3px;
}

.prompt-quick-card {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  max-width: 204px;
  padding: 4px 8px;
  white-space: nowrap;
}

.prompt-quick-card span {
  flex: 0 0 auto;
  font-size: 12px;
}

.prompt-quick-card small {
  min-width: 0;
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.prompt-tabs button {
  display: grid;
  gap: 2px;
  min-width: 110px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  text-align: left;
  padding: 6px 8px;
}

.prompt-tabs button span {
  color: inherit;
  font-size: 13px;
  font-weight: 850;
}

.prompt-tabs button small {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.prompt-tabs button.active,
.prompt-tabs button:hover {
  border-color: #a8bfd8;
  background: #eef5ff;
  color: #1558c7;
}

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

.prompt-card {
  display: grid;
  align-content: start;
  gap: 5px;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  padding: 8px 10px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.prompt-card span {
  font-size: 13px;
  font-weight: 850;
}

.prompt-card small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.prompt-card.prompt-quick-card {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  max-width: 204px;
  padding: 4px 8px;
  white-space: nowrap;
}

.prompt-card.prompt-quick-card span {
  flex: 0 0 auto;
  font-size: 12px;
}

.prompt-card.prompt-quick-card small {
  min-width: 0;
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-card:hover,
.prompt-card:focus {
  border-color: #a8bfd8;
  box-shadow: 0 10px 24px rgba(20, 31, 45, 0.08);
  outline: none;
  transform: translateY(-1px);
}

.prompt-card.active {
  border-color: #8bb8f7;
  background: #eef5ff;
  color: #1558c7;
}

.selected-prompt-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  width: min(900px, 100%);
  margin: 0 auto 8px;
  border: 1px solid #bdd1e7;
  border-radius: 12px;
  background: #f8fbff;
  padding: 8px 10px;
}

.selected-prompt-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.selected-prompt-edge-summary {
  min-width: 0;
}

.selected-prompt-copy span {
  color: #1558c7;
  font-size: 11px;
  font-weight: 900;
}

.selected-prompt-copy strong,
.selected-prompt-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-prompt-copy strong {
  font-size: 13px;
}

.selected-prompt-copy small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.selected-prompt-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  min-width: 0;
}

.selected-prompt-actions button {
  flex: 0 1 auto;
  min-height: 28px;
  border: 1px solid #bdd1e7;
  border-radius: 8px;
  background: #ffffff;
  color: #1558c7;
  font-size: 12px;
  font-weight: 850;
  padding: 0 8px;
  white-space: nowrap;
}

.case-manager-backdrop {
  position: fixed;
  inset: 0;
  z-index: 66;
  background: rgba(15, 23, 42, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.case-manager-drawer {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 76;
  display: grid;
  align-content: start;
  grid-template-rows: auto auto;
  gap: 12px;
  width: min(400px, calc(100vw - 260px));
  height: 100dvh;
  min-width: 320px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 18px 0 48px rgba(20, 31, 45, 0.16);
  padding: 14px;
  transform: translateX(-110%);
  transition: transform 0.2s ease;
}

.case-manager-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.case-manager-head div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.case-manager-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.case-manager-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

body.case-manager-open .case-manager-backdrop {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

body.case-manager-open .case-manager-drawer {
  transform: translateX(0);
}

.prompt-library-drawer {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
}

.prompt-library-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.prompt-library-panel {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
  width: min(560px, calc(100vw - 32px));
  height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: -18px 0 48px rgba(20, 31, 45, 0.18);
  padding: 18px;
  transform: translateX(102%);
  transition: transform 0.2s ease;
}

.prompt-library-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.prompt-library-header h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.prompt-library-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.prompt-library-panel .prompt-grid {
  align-content: start;
  grid-auto-rows: minmax(74px, auto);
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 2px;
}

body.prompt-library-open .prompt-library-drawer {
  pointer-events: auto;
}

body.prompt-library-open .prompt-library-backdrop {
  opacity: 1;
}

body.prompt-library-open .prompt-library-panel {
  transform: translateX(0);
}

.matter-workbench {
  display: grid;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  padding: 5px 24px;
}

body.chat-view .matter-workbench {
  display: none;
}

.matter-workbench-card {
  display: grid;
  min-width: 0;
  max-width: 1180px;
}

.matter-workbench-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.matter-workbench-details[open] {
  max-height: min(240px, 32dvh);
  overflow: auto;
  overscroll-behavior: contain;
}

.matter-workbench-summary {
  display: grid;
  grid-template-columns: minmax(190px, 0.9fr) minmax(0, 1.6fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 5px 10px;
  cursor: pointer;
  list-style: none;
}

.matter-workbench-summary::-webkit-details-marker {
  display: none;
}

.matter-workbench-summary-metrics {
  display: flex;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
}

.matter-workbench-summary-chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  border: 1px solid #d8e3f4;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 0 9px;
}

.matter-workbench-summary-chip strong {
  color: var(--text);
  font-size: 14px;
}

.matter-workbench-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border: 1px solid #bdd1e7;
  border-radius: 8px;
  background: #eef5ff;
  color: #1558c7;
  font-size: 12px;
  font-weight: 850;
  padding: 0 10px;
  white-space: nowrap;
}

.matter-workbench-details .summary-open,
.matter-workbench-details[open] .summary-closed {
  display: none;
}

.matter-workbench-details[open] .summary-open {
  display: inline;
}

.matter-workbench-expanded {
  display: grid;
  gap: 12px;
  padding: 0 12px 12px;
}

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

.matter-workbench-title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.matter-workbench-title span,
.matter-workbench-next span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.matter-workbench-title strong {
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matter-workbench-updated {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

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

.matter-workbench-metric {
  display: grid;
  gap: 4px;
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 10px;
}

.matter-workbench-metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.matter-workbench-metric strong {
  color: var(--text);
  font-size: 20px;
  line-height: 1.1;
}

.matter-workbench-metric small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matter-workbench-conflict {
  display: grid;
  gap: 4px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
  padding: 10px 12px;
}

.matter-workbench-conflict strong {
  color: #9a3412;
  font-size: 13px;
}

.matter-workbench-conflict span {
  color: #7c2d12;
  font-size: 12px;
  line-height: 1.45;
}

.matter-workbench-evidence {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 10px 12px;
}

.matter-workbench-evidence-head {
  display: grid;
  gap: 3px;
}

.matter-workbench-evidence-head strong {
  color: var(--text);
  font-size: 13px;
}

.matter-workbench-evidence-head span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

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

.matter-workbench-evidence-grid div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid #d8e3f4;
  border-radius: 8px;
  background: #f8fbff;
  padding: 8px 10px;
}

.matter-workbench-evidence-grid span,
.matter-workbench-evidence li {
  color: var(--muted);
  font-size: 12px;
}

.matter-workbench-evidence-grid strong {
  color: var(--text);
  font-size: 18px;
}

.matter-workbench-evidence ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.matter-workbench-evidence li {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matter-workbench-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 10px;
}

.matter-workbench-next,
.matter-workbench-recent {
  display: grid;
  gap: 7px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 10px;
}

.matter-workbench-next ul,
.matter-workbench-recent ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.matter-workbench-next li,
.matter-workbench-recent li {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matter-workbench-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.matter-workbench-actions button {
  min-height: 28px;
  font-size: 12px;
  white-space: nowrap;
}

.matter-workbench-empty {
  max-width: 1180px;
  border: 1px dashed #cbd8ea;
  border-radius: 8px;
  background: #f8fbff;
  color: var(--muted);
  font-size: 13px;
  padding: 12px;
}

.conversation-status {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  border: 0;
  background: transparent;
  padding: 0;
}

body.chat-view .conversation-status {
  align-self: center;
}

.conversation-status div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.conversation-status strong {
  font-size: 13px;
  letter-spacing: 0;
}

.conversation-status span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-status-count {
  min-width: 54px;
  border: 1px solid #dbe7f5;
  border-radius: 999px;
  background: #f8fbff;
  color: #1558c7;
  font-size: 12px;
  text-align: center;
  padding: 4px 9px;
  white-space: nowrap;
}

.conversation-refresh {
  min-height: 26px;
  padding: 0 8px;
  white-space: nowrap;
}

.messages {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 20px 24px;
}

.message {
  width: min(920px, 100%);
  max-width: 920px;
  margin: 0 auto 18px;
  display: grid;
  gap: 8px;
}

.message.user {
  justify-items: end;
}

.message-meta {
  font-size: 12px;
  padding: 0 4px;
}

.bubble {
  max-width: 100%;
  border-radius: 8px;
  padding: 14px 16px;
  line-height: 1.68;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-shadow: var(--shadow);
}

.user .bubble {
  max-width: min(760px, 88%);
  background: #1f6feb;
  color: white;
}

.message.user .bubble {
  max-width: min(760px, 88%);
}

.assistant .bubble {
  width: min(900px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
}

.followup-choice-card {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 0 2px;
}

.followup-choice-card ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style-position: inside;
}

.followup-choice-card li {
  min-width: 0;
}

.followup-choice-button {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 4px;
  border: 1px solid #b9cce2;
  border-radius: 8px;
  background: #f7fbff;
  color: var(--text);
  padding: 11px 12px;
  text-align: left;
}

.followup-choice-button:hover,
.followup-choice-button:focus-visible {
  border-color: var(--blue);
  background: #edf6ff;
}

.followup-choice-button strong,
.followup-choice-button span {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.followup-choice-button span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.message.assistant.document-message {
  width: min(980px, 100%);
  max-width: 980px;
  justify-items: stretch;
}

.message.assistant.document-message .bubble {
  width: 100%;
  padding: 0;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #dbe3ed;
  box-shadow: 0 12px 28px rgba(17, 24, 39, 0.07);
}

.material-coverage-summary {
  display: grid;
  gap: 8px;
  margin: 18px 28px 0;
  padding: 11px 13px;
  border: 1px solid #cfe0d5;
  border-radius: 8px;
  background: #f5fbf7;
  color: #174b2d;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.material-coverage-summary.is-partial {
  border-color: #efd3a0;
  background: #fff9ed;
  color: #70420c;
}

.material-coverage-summary > strong {
  font-size: 13px;
  line-height: 1.55;
}

.material-analysis-basis {
  min-width: 0;
  font-size: 12px;
  color: #4b5563;
}

.material-analysis-basis > summary {
  width: fit-content;
  cursor: pointer;
  color: #34566f;
  font-weight: 650;
}

.material-analysis-basis ul {
  display: grid;
  gap: 7px;
  margin: 9px 0 0;
  padding: 0;
  list-style: none;
}

.material-analysis-basis li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 10px;
  padding-top: 7px;
  border-top: 1px solid currentColor;
  border-top-color: rgba(75, 85, 99, 0.16);
}

.material-analysis-basis li strong,
.material-analysis-basis li span,
.material-analysis-basis li small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.material-analysis-basis li small {
  grid-column: 1 / -1;
  color: #8a4e09;
}

.legal-answer-document {
  display: grid;
  gap: 18px;
  padding: 24px 28px;
  color: #111827;
  font-size: 15px;
  line-height: 1.78;
}

.answer-full-body {
  display: grid;
  gap: 13px;
}

.answer-guide {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid #cbd7e4;
  border-left: 4px solid #2f6f9f;
  background: #f7fbff;
  border-radius: 8px;
}

.answer-guide-title {
  font-size: 13px;
  font-weight: 700;
  color: #1f4e79;
}

.answer-guide ul {
  margin: 0;
  padding-left: 20px;
}

.answer-guide li {
  margin: 4px 0;
}

.answer-guide-note {
  margin: 0;
  font-size: 12px;
  color: #5f6b7a;
}

.lawyer-task-status {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
  padding: 10px 0 10px 14px;
  border-left: 3px solid #2563eb;
  border-bottom: 1px solid #e5eaf0;
}

.lawyer-task-status-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 12px;
  font-size: 13px;
}

.lawyer-task-status-line strong {
  color: #172033;
}

.lawyer-task-status-line span {
  color: #667085;
}

.lawyer-task-guidance {
  display: grid;
  gap: 6px;
  padding: 9px 10px;
  border: 1px solid #d9e1ea;
  border-radius: 6px;
  background: #fff;
  color: #475467;
  font-size: 12px;
}

.lawyer-task-guidance p,
.lawyer-task-guidance div {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 8px;
  margin: 0;
}

.lawyer-task-guidance strong {
  color: #253247;
}

.lawyer-task-guidance ul {
  margin: 0;
  padding-left: 18px;
}

.lawyer-task-guidance li {
  margin: 0 0 3px;
}

.lawyer-task-processes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lawyer-task-processes li {
  display: grid;
  align-content: start;
  gap: 3px;
  min-height: 62px;
  padding: 8px 10px;
  border: 1px solid #d9e1ea;
  border-radius: 6px;
  background: #f8fafc;
}

.lawyer-task-processes li > span {
  color: #667085;
  font-size: 11px;
}

.lawyer-task-processes li > strong {
  color: #1f2937;
  font-size: 13px;
}

.lawyer-task-processes li > p {
  margin: 0;
  color: #526071;
  font-size: 12px;
  line-height: 1.5;
}

.lawyer-task-processes li[data-process-status="正在办理"],
.lawyer-task-processes li[data-process-status="正在继续办理"] {
  border-color: #93b4d3;
  background: #f5f9fd;
}

.lawyer-task-processes li[data-process-status="已完成"] {
  border-color: #b8d2c2;
  background: #f6faf7;
}

.lawyer-task-progress {
  color: #475467;
  font-size: 12px;
}

.lawyer-task-progress summary {
  width: fit-content;
  cursor: pointer;
  color: #344054;
  font-weight: 650;
}

.lawyer-task-scope {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 6px 10px;
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px solid #e1e7ef;
  border-radius: 6px;
  background: #fafbfc;
}

.lawyer-task-scope span {
  color: #667085;
}

.lawyer-task-scope strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #344054;
}

@media (max-width: 780px) {
  .lawyer-task-processes {
    grid-template-columns: 1fr;
  }

  .lawyer-task-processes li {
    min-height: 0;
  }

  .lawyer-task-scope {
    grid-template-columns: 1fr;
  }

  .lawyer-task-guidance p,
  .lawyer-task-guidance div {
    grid-template-columns: 1fr;
  }
}

.answer-collapse-shell {
  display: grid;
  gap: 14px;
  padding: 18px 20px;
}

.answer-collapse-summary {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid #d9e1ea;
  border-radius: 8px;
  background: #f8fafc;
}

.answer-collapse-title {
  color: #172033;
  font-size: 16px;
  font-weight: 740;
  line-height: 1.45;
}

.answer-collapse-preview {
  color: #4b5563;
  font-size: 13px;
  line-height: 1.68;
}

.answer-collapse-meta {
  color: #6b7280;
  font-size: 12px;
}

.answer-collapse-full[hidden] {
  display: none;
}

.answer-collapse-shell .answer-collapse-full .legal-answer-document {
  padding: 0;
}

.answer-collapse-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.answer-collapse-toggle {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #ffffff;
  color: #1f2937;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.answer-collapse-toggle:hover {
  border-color: #9fb1c5;
  background: #f3f6f9;
}

.answer-collapse-shell.is-expanded .answer-collapse-summary {
  border-bottom-color: #cbd5e1;
  background: #ffffff;
}

.legal-answer-document h1,
.legal-answer-document h2,
.legal-answer-document h3,
.legal-answer-document p {
  margin: 0;
}

.legal-answer-document h1 {
  padding-bottom: 10px;
  border-bottom: 1px solid #e5eaf0;
  font-size: 22px;
  line-height: 1.42;
  font-weight: 750;
}

.legal-answer-document h2 {
  margin-top: 4px;
  font-size: 18px;
  line-height: 1.5;
  font-weight: 720;
  color: #172033;
}

.legal-answer-document h3 {
  font-size: 16px;
  line-height: 1.52;
  font-weight: 700;
  color: #243044;
}

.legal-answer-document strong {
  color: #111827;
  font-weight: 750;
}

.legal-answer-document ul,
.legal-answer-document ol {
  margin: 0;
  padding-left: 24px;
}

.legal-answer-document li {
  margin: 5px 0;
}

.legal-answer-document blockquote {
  margin: 0;
  padding: 12px 14px;
  border-left: 4px solid #9aa8b8;
  background: #f5f7fa;
  color: #374151;
  border-radius: 6px;
}

.legal-answer-document hr {
  width: 100%;
  height: 1px;
  border: 0;
  background: #e5eaf0;
}

.markdown-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #d9e1ea;
  border-radius: 8px;
}

.legal-answer-document table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  background: #ffffff;
}

.legal-answer-document th,
.legal-answer-document td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5eaf0;
  border-right: 1px solid #e5eaf0;
  text-align: left;
  vertical-align: top;
}

.legal-answer-document th {
  background: #f3f6f9;
  font-weight: 700;
  color: #1f2937;
}

.legal-answer-document th:last-child,
.legal-answer-document td:last-child {
  border-right: 0;
}

.legal-answer-document tr:last-child td {
  border-bottom: 0;
}

.assistant .bubble.streaming-plain {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.assistant .bubble strong {
  color: #111827;
}

.progress-bubble {
  display: grid;
  gap: 10px;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef5;
  border: 1px solid #d7e1ec;
}

.progress-track span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #14b8a6);
  animation: progressSweep 1.4s ease-in-out infinite;
}

.progress-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.progress-steps span {
  min-width: 0;
  padding-left: 10px;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-steps span::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.68em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #14b8a6;
}

@keyframes progressSweep {
  0% {
    transform: translateX(-105%);
  }
  100% {
    transform: translateX(245%);
  }
}

.composer {
  overflow-x: hidden;
  padding: 12px 24px 16px;
  border-top: 1px solid var(--line);
  background: rgba(245, 247, 250, 0.86);
}

.composer-attachment-context {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  width: min(900px, 100%);
  margin: 0 auto 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.composer-attachment-context strong {
  color: var(--text);
  font-weight: 850;
}

.file-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: min(900px, 100%);
  margin: 0 auto 8px;
}

.media-readiness-note {
  width: min(900px, 100%);
  margin: 0 auto 8px;
  padding: 8px 10px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 12px;
  line-height: 1.45;
}

.file-chip {
  display: inline-flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  max-width: 100%;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.file-chip-copy {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.file-chip strong {
  max-width: 220px;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-chip small {
  color: var(--muted);
  font-size: 11px;
}

.file-chip-diagnosis {
  max-width: min(520px, 72vw);
  line-height: 1.45;
  white-space: normal;
}

.file-chip-remove {
  flex: 0 0 auto;
  min-height: 24px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

.file-chip-remove:hover,
.file-chip-remove:focus-visible {
  border-color: var(--blue);
  color: var(--blue);
}

.file-chip.extracted {
  border-left: 4px solid var(--green);
}

.file-chip.pending_ocr,
.file-chip.pending_transcription,
.file-chip.manual_transcription_required,
.file-chip.needs_review,
.file-chip.metadata_only,
.file-chip.ready_to_upload,
.file-chip.uploading {
  border-left: 4px solid var(--amber);
}

.file-chip.rejected_size_limit,
.file-chip.rejected_count_limit,
.file-chip.rejected_total_sync_limit,
.file-chip.unsupported_type,
.file-chip.failed,
.file-chip.waiting_provider {
  border-left: 4px solid var(--red);
}

#chatForm {
  display: grid;
  grid-template-columns: 40px 1fr 72px;
  align-items: end;
  gap: 10px;
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.file-button,
.send-button {
  display: grid;
  place-items: center;
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.file-button {
  background: var(--surface-2);
  color: var(--text);
  font-size: 21px;
  line-height: 1;
}

.file-button input {
  display: none;
}

textarea {
  width: 100%;
  max-height: min(180px, 16dvh);
  min-height: 36px;
  border: 0;
  resize: none;
  outline: none;
  overflow-y: auto;
  line-height: 1.5;
  padding: 7px 2px;
  color: var(--text);
}

.fact-confirm {
  display: none;
  gap: 8px;
  margin-top: 10px;
}

.fact-confirm select,
.fact-confirm textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.fact-confirm select {
  min-height: 36px;
  padding: 0 9px;
}

.fact-confirm textarea {
  min-height: 64px;
  padding: 8px 9px;
  resize: vertical;
}

.fact-confirm button {
  min-height: 32px;
  border: 1px solid var(--blue);
  border-radius: 8px;
  background: #eef5ff;
  color: #1558c7;
  font-size: 13px;
  font-weight: 800;
}

.diff-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.diff-chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.send-button {
  border-color: #1558c7;
  background: var(--blue);
  color: white;
  font-size: 13px;
  font-weight: 800;
}

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

.dossier-rail {
  display: none;
}

.dossier-rail-button {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-height: 58px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 4px;
}

.dossier-rail-button span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.dossier-rail-button strong {
  font-size: 18px;
  letter-spacing: 0;
}

.dossier-rail-button:hover,
.dossier-rail-button:focus {
  border-color: #a8bfd8;
  background: #eef5ff;
  outline: none;
}

.review-pane {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 70;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(430px, calc(100vw - 32px));
  height: 100dvh;
  border-width: 0 0 0 1px;
  box-shadow: -16px 0 42px rgba(20, 31, 45, 0.16);
  overflow: hidden;
  padding: 0;
  transform: translateX(102%);
  transition: transform 0.2s ease;
}

.history-pane {
  display: grid;
}

.history-panel {
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 0;
  overflow: auto;
  padding: 14px 12px 18px;
}

.dossier-drawer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
  padding: 14px 12px;
}

.dossier-drawer-top div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.dossier-drawer-top span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.dossier-drawer-top strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.dossier-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 23, 42, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

body.dossier-open .review-pane {
  transform: translateX(0);
}

body.dossier-open .dossier-backdrop {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

body:not(.admin-page).dossier-open .sidebar {
  position: relative;
  z-index: 65;
}

body:not(.admin-page).dossier-open.matter-rail-open .sidebar {
  z-index: 95;
}

body:not(.admin-page).dossier-open.matter-rail-open .mobile-shell-backdrop {
  z-index: 84;
}

body:not(.admin-page).dossier-open.matter-rail-open .dossier-backdrop {
  pointer-events: none;
}

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

.history-header h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0;
}

.history-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.history-search-row input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 11px;
}

.history-case-summary {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  padding: 11px 12px;
}

.history-dossier-summary {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.history-dossier-summary > * {
  min-width: 0;
}

.history-case-title {
  display: grid;
  gap: 4px;
}

.history-case-name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.history-case-name-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
  align-items: center;
}

.history-case-name-form[hidden] {
  display: none;
}

.history-case-name-form input {
  min-width: 0;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  padding: 0 9px;
}

.history-case-title span,
.history-next span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.history-case-title strong {
  overflow-wrap: anywhere;
  font-size: 14px;
  letter-spacing: 0;
}

.history-case-title small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.history-case-compact-summary {
  display: grid;
  gap: 4px;
  border: 1px solid #d9e6f6;
  border-radius: 8px;
  background: #fafdff;
  padding: 8px 9px;
}

.history-case-compact-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.history-case-compact-summary p {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
}

.history-link-button {
  justify-self: start;
  min-height: 24px;
  border: 0;
  background: transparent;
  color: #1558c7;
  font-size: 12px;
  font-weight: 850;
  padding: 0;
}

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

.history-case-metrics div {
  min-height: 54px;
  border: 1px solid #d9e6f6;
  border-radius: 8px;
  background: var(--surface);
  padding: 8px;
}

.history-case-metrics span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.history-case-metrics strong {
  display: block;
  margin-top: 5px;
  font-size: 18px;
}

.history-case-section-nav {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.history-case-section-nav button {
  min-width: 0;
  min-height: 30px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: #1558c7;
  font-size: 12px;
  font-weight: 850;
  padding: 0 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-case-section-nav button:hover,
.history-case-section-nav button:focus {
  border-color: #bfdbfe;
  background: #eff6ff;
  outline: none;
}

.history-case-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.history-case-record {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
  border-left: 4px solid var(--blue);
}

.history-case-record-head {
  display: grid;
  gap: 8px;
}

.history-case-record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.history-case-record-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  padding: 2px 7px;
}

.history-case-record h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 15px;
}

.history-case-record > p,
.history-case-brief {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.history-case-record-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.history-case-record-grid div {
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafcff;
  padding: 9px;
}

.history-case-record-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.history-case-record-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.history-case-section {
  display: grid;
  gap: 8px;
}

.history-case-section h4 {
  margin: 0;
  font-size: 13px;
}

.history-case-details {
  display: grid;
  gap: 10px;
}

.history-case-details summary {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1558c7;
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
  list-style: none;
}

.history-case-details summary::-webkit-details-marker {
  display: none;
}

.history-case-details[open] {
  gap: 12px;
}

.history-case-details[open] summary {
  background: #dbeafe;
}

.history-case-details .summary-open,
.history-case-details[open] .summary-closed {
  display: none;
}

.history-case-details[open] .summary-open {
  display: inline;
}

.history-progress-list {
  display: grid;
  gap: 8px;
}

.history-progress-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 9px 10px;
}

.history-progress-time {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.history-progress-item p {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.55;
}

.history-progress-item strong {
  font-size: 12px;
  font-weight: 850;
}

.history-inline-empty {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.history-key-material-list {
  display: grid;
  gap: 7px;
}

.history-key-material-item {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.history-key-material-item strong,
.history-key-material-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.history-key-material-item strong {
  color: var(--text);
  font-size: 12px;
}

.history-key-material-item span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.matter-party-form {
  display: grid;
  grid-template-columns: minmax(120px, 1.2fr) minmax(92px, 0.8fr) minmax(92px, 0.8fr);
  gap: 8px;
  align-items: center;
}

.matter-party-form input,
.matter-party-form select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 10px;
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
}

.matter-party-form [data-party-note] {
  grid-column: 1 / span 2;
}

.history-case-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}

.history-action-button.compact {
  min-height: 26px;
  padding: 0 7px;
  font-size: 11px;
}

.word-export-actions {
  align-items: center;
}

.word-export-status {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.word-export-status a {
  color: var(--blue);
  font-weight: 850;
}

.word-export-status.error {
  color: var(--red);
  font-weight: 750;
}

.word-export-status.success {
  color: var(--green);
}

.history-card {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 11px 12px;
}

.history-card.chat {
  border-left: 4px solid var(--blue);
}

.history-card.material {
  border-left: 4px solid var(--amber);
}

.history-card.document {
  border-left: 4px solid var(--green);
}

.history-card.knowledge {
  border-left: 4px solid var(--purple);
}

.history-card.todo {
  border-left: 4px solid #f97316;
}

.history-card.system {
  border-left: 4px solid #94a3b8;
}

.history-card-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.history-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.history-card-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  padding: 2px 7px;
}

.history-delete-button {
  min-height: 24px;
  border: 1px solid #f1b1b1;
  border-radius: 8px;
  background: #fff5f5;
  color: #a42323;
  font-size: 12px;
  font-weight: 850;
  padding: 0 7px;
  white-space: nowrap;
}

.history-delete-button:hover {
  background: #ffe8e8;
}

.history-card h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.history-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.history-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}

.history-action-button {
  min-height: 28px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1558c7;
  font-size: 12px;
  font-weight: 850;
  padding: 0 9px;
}

.history-action-button:hover {
  background: #dbeafe;
}

.history-action-button.danger {
  border-color: #f1b1b1;
  background: #fff5f5;
  color: #a42323;
}

.history-action-button.danger:hover {
  background: #ffe3e3;
}

.hidden-work-state {
  display: none;
}

.panel {
  padding: 14px 0 16px;
  border-bottom: 1px solid var(--line);
}

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

.panel-title h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0;
}

.fact-grid,
.agent-stack,
.finding-list {
  display: grid;
  gap: 8px;
}

.fact-row,
.agent-card,
.finding-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.fact-row {
  display: grid;
  gap: 4px;
  font-size: 13px;
}

.fact-row span:first-child {
  color: var(--muted);
}

.agent-card h3,
.finding-card h3 {
  margin: 0 0 5px;
  font-size: 13px;
}

.agent-card p,
.finding-card p,
.citation-card p {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
}

.agent-card {
  border-left: 4px solid var(--blue);
}

.finding-card.block {
  border-left: 4px solid var(--red);
}

.finding-card.high {
  border-left: 4px solid var(--amber);
}

.finding-card.medium {
  border-left: 4px solid var(--purple);
}

.finding-card.low,
.finding-card.info {
  border-left: 4px solid var(--green);
}

.citation-list {
  display: grid;
  gap: 8px;
}

.citation-card,
.calculation-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.citation-card h3,
.calculation-card h3 {
  margin: 0 0 5px;
  font-size: 13px;
}

.calculation-list {
  display: grid;
  gap: 8px;
}

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

.quick-action-list button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  padding: 0 9px;
}

.quick-action-list button:hover {
  border-color: #b8c7d8;
  background: #f8fafc;
}

.calculation-card {
  border-left: 4px solid var(--green);
}

.calculation-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.calculation-lines {
  margin-top: 8px;
  display: grid;
  gap: 4px;
}

.calculation-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.citation-card.verified {
  border-left: 4px solid var(--green);
}

.citation-card.not_found,
.citation-card.text_mismatch,
.citation-card.not_current {
  border-left: 4px solid var(--red);
}

.citation-card.unverified {
  border-left: 4px solid var(--amber);
}

.empty {
  min-height: 40px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  font-size: 13px;
}

/* Rounded full-module lawyer workspace skin. Keeps the existing DOM and behavior intact. */
body:not(.admin-page) {
  background: #e5ebf2;
}

body:not(.admin-page) .app-shell {
  grid-template-columns: 228px minmax(0, 1fr) 56px;
  background: #e5ebf2;
}

body.archive-view .app-shell {
  grid-template-columns: 228px minmax(0, 1fr);
}

body:not(.admin-page) .sidebar {
  background: rgba(255, 255, 255, 0.86);
  border-right: 1px solid #c7d2df;
  padding: 18px 12px;
}

body:not(.admin-page) .brand {
  padding: 4px 8px 18px;
}

body:not(.admin-page) .brand-mark {
  width: 30px;
  height: 30px;
  border: 2px solid #697077;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #697077;
  font-size: 12px;
}

body:not(.admin-page) .client-access,
body:not(.admin-page) .case-rail-current,
body:not(.admin-page) .matter-switcher,
body:not(.admin-page) .matter-rename-form,
body:not(.admin-page) .case-item,
body:not(.admin-page) .matter-switch-button,
body:not(.admin-page) .matter-list-empty,
body:not(.admin-page) .matter-workbench-details,
body:not(.admin-page) .matter-workbench-empty,
body:not(.admin-page) .matter-workbench-metric,
body:not(.admin-page) .matter-workbench-evidence,
body:not(.admin-page) .matter-workbench-next,
body:not(.admin-page) .matter-workbench-recent,
body:not(.admin-page) .archive-card,
body:not(.admin-page) .archive-state-card,
body:not(.admin-page) .detail-section.archive-detail-state,
body:not(.admin-page) .history-case-summary,
body:not(.admin-page) .history-case-compact-summary,
body:not(.admin-page) .history-case-record,
body:not(.admin-page) .history-case-section,
body:not(.admin-page) .history-case-details,
body:not(.admin-page) .history-case-section-nav button,
body:not(.admin-page) .prompt-card,
body:not(.admin-page) .selected-prompt-card,
body:not(.admin-page) .prompt-tabs button {
  border-radius: var(--radius-lg);
}

body:not(.admin-page) .client-access,
body:not(.admin-page) .case-rail-current,
body:not(.admin-page) .case-item.active,
body:not(.admin-page) .case-item:hover,
body:not(.admin-page) .matter-switcher,
body:not(.admin-page) .matter-workbench-details,
body:not(.admin-page) .archive-card,
body:not(.admin-page) .history-case-summary,
body:not(.admin-page) .history-case-record,
body:not(.admin-page) .prompt-card,
body:not(.admin-page) .selected-prompt-card,
body:not(.admin-page) .detail-dialog {
  box-shadow: var(--shadow-card);
}

body:not(.admin-page) .client-access,
body:not(.admin-page) .case-rail-current,
body:not(.admin-page) .matter-switcher,
body:not(.admin-page) .case-item.active,
body:not(.admin-page) .case-item:hover,
body:not(.admin-page) .matter-switch-button,
body:not(.admin-page) .archive-card,
body:not(.admin-page) .history-case-summary,
body:not(.admin-page) .history-case-record,
body:not(.admin-page) .prompt-card,
body:not(.admin-page) .selected-prompt-card {
  background: rgba(255, 255, 255, 0.9);
}

body:not(.admin-page) .nav-item {
  min-height: 42px;
  border-radius: var(--radius-lg);
  padding: 0 10px;
}

body:not(.admin-page) .nav-item.active,
body:not(.admin-page) .nav-item:hover {
  border-color: #cfe0ff;
  background: #eef5ff;
  color: #001d6c;
  box-shadow: inset 3px 0 0 #001d6c;
}

body:not(.admin-page) .nav-item span {
  border-radius: var(--radius-sm);
}

body:not(.admin-page) .new-case,
body:not(.admin-page) .secondary-button,
body:not(.admin-page) .send-button,
body:not(.admin-page) .archive-action-button,
body:not(.admin-page) .detail-action-button,
body:not(.admin-page) .matter-rename-button,
body:not(.admin-page) .matter-switcher-head button,
body:not(.admin-page) .matter-rename-form button,
body:not(.admin-page) .archive-state-button,
body:not(.admin-page) .prompt-library-open,
body:not(.admin-page) .composer-prompt-button {
  min-height: 34px;
  border-radius: var(--radius-md);
  font-size: 12px;
}

body:not(.admin-page) .send-button {
  border-color: var(--blue);
  background: var(--blue);
}

body:not(.admin-page) .chat-header,
body:not(.admin-page) .tool-header {
  background: rgba(255, 255, 255, 0.86);
  padding: 16px 24px;
}

body:not(.admin-page) .chat-case-strip {
  background: rgba(255, 255, 255, 0.72);
  padding: 10px 24px;
}

body:not(.admin-page) .mode-switch,
body:not(.admin-page) .archive-scope-switch {
  border-radius: 999px;
  background: #e9eef4;
  padding: 4px;
}

body:not(.admin-page) .mode-switch button,
body:not(.admin-page) .archive-scope-switch button {
  min-height: 30px;
  border-radius: 999px;
}

body:not(.admin-page) .mode-switch button.active,
body:not(.admin-page) .archive-scope-switch button.active {
  background: #ffffff;
  color: #001d6c;
  box-shadow: 0 2px 10px rgba(18, 22, 25, 0.08);
}

body:not(.admin-page) .matter-workbench {
  background: rgba(255, 255, 255, 0.72);
  padding: 8px 24px;
}

body:not(.admin-page) .matter-workbench-details {
  background: rgba(255, 255, 255, 0.92);
}

body:not(.admin-page) .matter-workbench-summary-chip,
body:not(.admin-page) .conversation-status-count,
body:not(.admin-page) .tag,
body:not(.admin-page) .archive-extra-grid span,
body:not(.admin-page) .file-chip,
body:not(.admin-page) .prompt-group-hint {
  border-radius: 999px;
}

body:not(.admin-page) .archive-card-title h3,
body:not(.admin-page) .archive-card-file-name,
body:not(.admin-page) .case-rail-current strong,
body:not(.admin-page) .chat-case-strip strong,
body:not(.admin-page) .mobile-case-current strong,
body:not(.admin-page) .case-manager-panel .matter-switch-copy strong,
body:not(.admin-page) .selected-prompt-copy strong,
body:not(.admin-page) .selected-prompt-copy small {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

body:not(.admin-page) .archive-card-title h3,
body:not(.admin-page) .case-manager-panel .matter-switch-copy strong {
  overflow-wrap: anywhere;
}

body:not(.admin-page) .archive-card-file-name {
  display: block;
}

body:not(.admin-page) .messages {
  background: #f8fafc;
  padding-inline: 28px;
}

body:not(.admin-page) .message {
  width: min(780px, 100%);
  max-width: 780px;
  margin-bottom: 16px;
}

body:not(.admin-page) .bubble {
  border-radius: 16px 16px 16px 6px;
  box-shadow: 0 8px 22px rgba(18, 22, 25, 0.055);
}

body:not(.admin-page) .user .bubble {
  max-width: min(640px, 88%);
  border-radius: 16px 16px 6px 16px;
}

body:not(.admin-page) .composer {
  background: rgba(229, 235, 242, 0.9);
}

body:not(.admin-page) #chatForm {
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
}

body:not(.admin-page) .file-button {
  border-radius: var(--radius-lg);
}

body:not(.admin-page) textarea,
body:not(.admin-page) input,
body:not(.admin-page) select {
  border-radius: var(--radius-md);
}

body:not(.admin-page) .tool-grid {
  background: #e5ebf2;
}

body:not(.admin-page) .archive-filter-shell #archiveSearch,
body:not(.admin-page) .archive-filter-details #archiveFilterCategory,
body:not(.admin-page) .archive-filter-details #archiveFilterStatus,
body:not(.admin-page) .filter-row input,
body:not(.admin-page) .filter-row select,
body:not(.admin-page) .archive-form-drawer input,
body:not(.admin-page) .archive-form-drawer select,
body:not(.admin-page) .archive-form-drawer textarea,
body:not(.admin-page) .client-access input,
body:not(.admin-page) .matter-rename-form input {
  border-color: #d3dae3;
  background: var(--field);
}

body:not(.admin-page) .archive-form-drawer,
body:not(.admin-page) .prompt-library-panel,
body:not(.admin-page) .review-pane {
  border-radius: var(--radius-xl) 0 0 var(--radius-xl);
  box-shadow: -18px 0 44px rgba(18, 22, 25, 0.13);
}

body:not(.admin-page) .archive-form-drawer[aria-hidden="true"],
body:not(.admin-page) .prompt-library-panel[aria-hidden="true"],
body:not(.admin-page) .review-pane[aria-hidden="true"] {
  box-shadow: none;
}

body:not(.admin-page).archive-form-open .archive-form-drawer,
body:not(.admin-page).prompt-library-open .prompt-library-panel,
body:not(.admin-page).dossier-open .review-pane {
  box-shadow: -18px 0 44px rgba(18, 22, 25, 0.13);
}

body:not(.admin-page) .case-manager-drawer {
  border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
  box-shadow: 18px 0 44px rgba(18, 22, 25, 0.13);
}

body:not(.admin-page) .case-manager-drawer[aria-hidden="true"] {
  box-shadow: none;
}

body:not(.admin-page).case-manager-open .case-manager-drawer {
  box-shadow: 18px 0 44px rgba(18, 22, 25, 0.13);
}

body:not(.admin-page) .detail-dialog {
  border-radius: var(--radius-xl);
}

body:not(.admin-page) .archive-upload-box,
body:not(.admin-page) .archive-advanced-fields,
body:not(.admin-page) .detail-section pre,
body:not(.admin-page) .attachment-preview-image,
body:not(.admin-page) .attachment-preview-media,
body:not(.admin-page) .attachment-preview-frame,
body:not(.admin-page) .matter-workbench-conflict,
body:not(.admin-page) .matter-workbench-evidence-grid div,
body:not(.admin-page) .media-readiness-note,
body:not(.admin-page) .diff-chip {
  border-radius: var(--radius-lg);
}

body:not(.admin-page) .dossier-rail {
  display: grid;
  align-content: start;
  gap: 6px;
  border-left: 1px solid rgba(199, 210, 223, 0.72);
  background: rgba(255, 255, 255, 0.48);
  padding: 10px 6px;
}

body:not(.admin-page) .dossier-rail-button {
  border-radius: var(--radius-lg);
  min-height: 50px;
  border-color: rgba(199, 210, 223, 0.86);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
  padding: 6px 3px;
}

body:not(.admin-page) .dossier-rail-button strong {
  font-size: 16px;
}

body:not(.admin-page) .dossier-rail-button span {
  font-size: 10px;
}

body.archive-view .dossier-rail {
  display: none;
}

body:not(.admin-page) .archive-list {
  align-content: start;
}

body:not(.admin-page) .archive-state-card {
  width: min(760px, 100%);
  gap: 6px;
  border-style: solid;
  background: rgba(255, 255, 255, 0.76);
  padding: 14px 16px;
  box-shadow: none;
}

body:not(.admin-page) .archive-state-card h3 {
  font-size: 15px;
}

body:not(.admin-page) .archive-state-card p,
body:not(.admin-page) .archive-state-card small {
  font-size: 12px;
  line-height: 1.45;
}

body:not(.admin-page) .archive-state-card.error {
  border-color: #efc8c8;
  background: rgba(255, 248, 248, 0.82);
}

body:not(.admin-page) .prompt-tabs button.active,
body:not(.admin-page) .prompt-tabs button:hover,
body:not(.admin-page) .prompt-card:hover,
body:not(.admin-page) .prompt-card:focus,
body:not(.admin-page) .archive-card:hover,
body:not(.admin-page) .archive-card:focus,
body:not(.admin-page) .dossier-rail-button:hover,
body:not(.admin-page) .dossier-rail-button:focus {
  border-color: #b8ccff;
  background: #eef5ff;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 212px minmax(0, 1fr) 52px;
  }

  body.archive-view .app-shell {
    grid-template-columns: 212px minmax(0, 1fr);
  }

  .case-manager-drawer {
    width: min(392px, calc(100vw - 244px));
  }

  body.case-manager-open .case-manager-drawer {
    transform: translateX(0);
  }

  .dossier-rail {
    padding: 8px 5px;
  }

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

  body.archive-view .tool-grid {
    grid-template-areas:
      "form"
      "board";
  }

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

  .admin-console-map {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ops-grid.two-col,
  .owner-metric-grid,
  .lawyer-collection-cards,
  .knowledge-route-grid,
  .admin-password-form,
  .knowledge-map,
  .steward-workbench-grid,
  .steward-decision-grid,
  .feed-layer-board,
  .knowledge-summary-grid,
  .knowledge-content-grid,
  .knowledge-review-checks {
    grid-template-columns: 1fr;
  }

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

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

  .matter-workbench-bottom {
    grid-template-columns: 1fr;
  }

  .panel {
    border-bottom: 0;
  }
}

@media (max-width: 780px) {
  .admin-shell {
    width: min(100% - 24px, 560px);
    padding: 12px 0 28px;
  }

  .admin-hero {
    padding: 16px 0 12px;
  }

  .admin-grid.admin-authenticated {
    margin-bottom: 4px;
  }

  .admin-grid.admin-authenticated .admin-dashboard {
    gap: 6px;
  }

  .admin-grid.admin-authenticated .admin-dashboard-placeholder,
  .admin-grid.admin-authenticated .admin-dashboard:empty {
    display: none;
  }

  .admin-page .admin-hero {
    display: none;
  }

  .admin-hero h1 {
    font-size: 24px;
  }

  .admin-page .admin-console-map {
    display: flex;
    grid-template-columns: none;
    gap: 6px;
    margin: 4px 0 8px;
    overflow-x: visible;
    padding-bottom: 2px;
    scroll-snap-type: none;
    scrollbar-width: none;
  }

  .admin-page .admin-console-map::-webkit-scrollbar {
    display: none;
  }

  .admin-page .admin-console-card {
    flex: 1 1 0;
    min-width: 0;
    min-height: 46px;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    justify-items: center;
    row-gap: 3px;
    padding: 6px 4px;
    scroll-snap-align: none;
    text-align: center;
  }

  .admin-page .admin-console-card span {
    display: none;
  }

  .admin-page .admin-console-card strong {
    overflow: hidden;
    font-size: 11px;
    line-height: 1.15;
    text-align: center;
    text-overflow: ellipsis;
    white-space: normal;
  }

  .admin-page .admin-console-card small {
    display: none;
  }

  .admin-page .ops-tabs {
    display: grid;
    grid-auto-columns: initial;
    grid-auto-flow: row;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    margin: 6px 0 8px;
    overflow-x: visible;
    padding-bottom: 2px;
    scroll-snap-type: none;
    scrollbar-width: none;
  }

  .admin-page .ops-tabs::-webkit-scrollbar {
    display: none;
  }

  .admin-page .ops-tab {
    min-height: 30px;
    min-width: 0;
    padding: 0 2px;
    scroll-snap-align: none;
    font-size: 11px;
    line-height: 1.15;
    white-space: normal;
  }

  .admin-page .ops-card,
  .admin-page .knowledge-long-details,
  .admin-page .advanced-governance-panel > details,
  .admin-page .advanced-governance-intro {
    border-radius: 10px;
    padding: 10px;
  }

  .admin-page .ops-card-header,
  .admin-page .material-admin-section-header,
  .admin-page .knowledge-governance-head,
  .admin-page .knowledge-review-head {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .admin-page .ops-inline-actions,
  .admin-page .advanced-governance-shortcuts,
  .admin-page .admin-risk-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    justify-content: stretch;
  }

  .admin-page .ops-inline-actions .secondary-button,
  .admin-page .advanced-governance-shortcuts .secondary-button,
  .admin-page .admin-risk-actions .secondary-button {
    width: 100%;
    min-width: 0;
    min-height: 30px;
    padding: 4px 8px;
    white-space: normal;
  }

  .admin-page .knowledge-priority-summary .metric-grid,
  .admin-page .material-admin-workbench .metric-grid,
  .admin-page .access-summary-strip .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .admin-page .metric-card {
    min-height: 72px;
    padding: 8px;
  }

  .admin-page .metric-card h3,
  .admin-page .metric-card p {
    display: -webkit-box;
    overflow: hidden;
    line-height: 1.25;
    -webkit-box-orient: vertical;
  }

  .admin-page .metric-card h3 {
    font-size: 12px;
    -webkit-line-clamp: 1;
  }

  .admin-page .metric-card p {
    font-size: 11px;
    -webkit-line-clamp: 2;
  }

  .admin-page .metric-value {
    margin-top: 4px;
    font-size: 22px;
  }

  .admin-page .knowledge-layer-quick-board {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    max-width: 100%;
    overflow-x: visible;
    padding-bottom: 2px;
    scroll-snap-type: none;
    scrollbar-width: thin;
  }

  .admin-page .knowledge-layer-quick-board .knowledge-layer-card {
    flex: initial;
    min-width: 0;
    scroll-snap-align: none;
  }

  .admin-page .knowledge-priority-list .recent-list.compact {
    gap: 7px;
  }

  .admin-page .knowledge-long-details {
    box-shadow: none;
  }

  .admin-page .knowledge-long-details > summary,
  .admin-page .advanced-history-details > summary,
  .admin-page .advanced-tools-details > summary {
    line-height: 1.35;
  }

  .admin-page .knowledge-governance-entry .control-row p,
  .admin-page .material-admin-section-header p,
  .admin-page .advanced-governance-intro p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .admin-page .knowledge-bulk-bar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .admin-page .knowledge-bulk-bar > input,
  .admin-page .knowledge-bulk-bar .secondary-button {
    width: 100%;
    min-width: 0;
  }

  .admin-page .material-risk-note {
    padding: 9px 10px;
  }

  .admin-page .test-ledger-import-form {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .admin-page .test-ledger-import-form .send-button {
    width: 100%;
    min-height: 34px;
  }

  .admin-page .test-ledger-dashboard .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .admin-page .test-ledger-sample-list .knowledge-governance-list {
    grid-template-columns: 1fr;
  }

  .admin-page .test-ledger-empty-state,
  .admin-page .admin-state {
    max-width: 100%;
  }

  .admin-page .trial-access-form {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .admin-page .access-priority-stack {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .admin-page .access-create-card {
    grid-column: auto;
    grid-row: auto;
  }

  .admin-page .access-security-summary .control-list {
    max-height: 168px;
  }

  .admin-page .access-action-strip {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .admin-page .access-action-strip h2 {
    font-size: 14px;
  }

  .admin-page .access-long-sections {
    gap: 8px;
  }

  .admin-page .access-collapsed-section > summary {
    min-width: 0;
  }

  .admin-page .access-collapsed-section > summary small {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
  }

  .admin-page .trial-access-form label:nth-of-type(1) {
    order: 1;
  }

  .admin-page .trial-access-form label:nth-of-type(2) {
    order: 2;
  }

  .admin-page .trial-access-form label:nth-of-type(3) {
    order: 3;
  }

  .admin-page .trial-access-form .send-button {
    order: 4;
    width: 100%;
    min-height: 34px;
  }

  .admin-page .trial-access-status {
    order: 5;
  }

  .admin-page .trial-issue-form {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .admin-page .trial-issue-form .wide-field,
  .admin-page .trial-issue-form #trialIssueStatus {
    grid-column: auto;
  }

  .admin-page .trial-issue-form .send-button {
    width: 100%;
    min-height: 34px;
  }

  .admin-page .material-admin-actions {
    grid-template-columns: 1fr;
  }

  .admin-page .material-admin-actions > * {
    width: 100%;
    min-width: 0;
  }

  .admin-page .recent-card,
  .admin-page .control-row,
  .admin-page .material-admin-card,
  .admin-page .knowledge-governance-card {
    min-width: 0;
  }

  .admin-page .recent-card h3,
  .admin-page .material-admin-card h3,
  .admin-page .knowledge-governance-head h3,
  .admin-page .control-row strong {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .admin-page .material-admin-card .type-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .admin-page .material-admin-card .type-pill {
    width: 100%;
    white-space: normal;
  }

  .admin-page .high-risk-route-grid {
    grid-template-columns: 1fr;
  }

  body:not(.admin-page) .app-shell,
  body.archive-view .app-shell {
    grid-template-columns: 1fr;
  }

  body:not(.admin-page) .dossier-rail {
    display: none;
  }

  body:not(.admin-page) .archive-form-drawer,
  body:not(.admin-page) .prompt-library-panel,
  body:not(.admin-page) .review-pane,
  body:not(.admin-page) .case-manager-drawer {
    border-radius: 8px 8px 0 0;
  }

  .mobile-case-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 90;
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) 128px;
    align-items: center;
    gap: 7px;
    height: 58px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
    padding: 8px 9px;
  }

  .mobile-menu-button {
    min-height: 32px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text);
    font-size: 12px;
    font-weight: 850;
    padding: 0 7px;
  }

  .mobile-workspace-switch {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
    width: 128px;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #eef2f6;
    padding: 3px;
  }

  .mobile-workspace-button {
    min-width: 0;
    min-height: 28px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
    padding: 0 3px;
    white-space: nowrap;
  }

  .mobile-workspace-button.active {
    background: #ffffff;
    color: var(--text);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.1);
  }

  .mobile-case-current {
    display: grid;
    gap: 1px;
    min-width: 0;
    text-align: center;
  }

  .mobile-case-current span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
  }

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

  .secondary-button {
    min-height: 28px;
    font-size: 12px;
    padding: 0 8px;
  }

  .archive-state-button,
  .archive-action-button,
  .detail-action-button,
  .history-action-button,
  .quick-action-list button {
    min-height: 26px;
    font-size: 11px;
    padding: 0 7px;
  }

  .app-shell,
  body.archive-view .app-shell {
    display: block;
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
    padding-top: 58px;
  }

  .matter-workbench {
    padding: 8px 14px;
  }

  .matter-workbench-head {
    display: grid;
  }

  .matter-workbench-updated {
    white-space: normal;
  }

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

  .sidebar {
    position: fixed;
    top: 58px;
    bottom: 0;
    left: 0;
    z-index: 85;
    display: grid;
    align-content: start;
    gap: 10px;
    width: min(320px, 86vw);
    height: calc(100dvh - 58px);
    border-width: 0 1px 0 0;
    background: #fbfcfd;
    box-shadow: 16px 0 42px rgba(20, 31, 45, 0.14);
    padding: 12px;
    transform: translateX(-104%);
    transition: transform 0.2s ease;
  }

  body:not(.admin-page) .sidebar {
    gap: 7px;
    width: min(380px, calc(100vw - 8px));
    max-width: calc(100vw - 8px);
    background: #fbfcfd;
    padding: 10px;
  }

  body:not(.admin-page).dossier-open .sidebar,
  body:not(.admin-page).dossier-open.matter-rail-open .sidebar {
    position: fixed;
    top: 58px;
    bottom: 0;
  }

  body.matter-rail-open .sidebar {
    transform: translateX(0);
  }

  .mobile-shell-backdrop {
    position: fixed;
    inset: 58px 0 0;
    z-index: 80;
    display: block;
    background: rgba(15, 23, 42, 0.32);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
  }

  body.matter-rail-open .mobile-shell-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar .brand {
    padding: 0;
  }

  body:not(.admin-page) .sidebar .brand {
    gap: 8px;
    padding: 0 2px 2px;
  }

  body:not(.admin-page) .sidebar .brand-mark {
    width: 26px;
    height: 26px;
    font-size: 10px;
  }

  body:not(.admin-page) .sidebar .brand-title {
    font-size: 14px;
    line-height: 1.1;
  }

  body:not(.admin-page) .sidebar .brand-subtitle {
    display: none;
  }

  .client-access {
    margin-bottom: 0;
  }

  body:not(.admin-page) .client-access {
    gap: 5px;
    padding: 8px;
  }

  body:not(.admin-page) .client-access-current span,
  body:not(.admin-page) .client-access small {
    font-size: 11px;
  }

  body:not(.admin-page) .client-access #clientAccessHint {
    display: block;
    font-size: 10.5px;
  }

  body:not(.admin-page) .client-login-controls {
    gap: 5px;
  }

  body:not(.admin-page) .client-login-tabs {
    gap: 3px;
    padding: 2px;
  }

  body:not(.admin-page) .client-login-tabs button {
    min-height: 26px;
    padding: 0 4px;
    font-size: 11px;
  }

  body:not(.admin-page) .client-access form.client-auth-form {
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 5px;
  }

  body:not(.admin-page) .client-access form.client-password-login-form {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px;
  }

  body:not(.admin-page) .client-access input {
    min-height: 28px;
    padding: 5px 7px;
  }

  body:not(.admin-page) .client-access button {
    min-height: 28px;
    padding: 0 6px;
  }

  .case-rail-current {
    margin-bottom: 0;
  }

  body:not(.admin-page) .case-rail-current {
    gap: 5px;
    padding: 8px;
  }

  body:not(.admin-page) .case-rail-current span,
  body:not(.admin-page) .case-rail-current small {
    font-size: 11px;
  }

  body:not(.admin-page) .case-rail-current small {
    display: none;
  }

  body:not(.admin-page) .case-rail-current strong {
    font-size: 13px;
  }

  body:not(.admin-page) .case-manager-open-button {
    min-height: 28px;
  }

  body:not(.admin-page) .new-case {
    height: 30px;
    min-height: 30px;
    font-size: 12px;
  }

  .matter-switcher,
  .workspace-nav,
  .case-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  body:not(.admin-page) .workspace-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-top: 4px;
  }

  body:not(.admin-page) .nav-item {
    min-height: 32px;
    gap: 5px;
    border-radius: 9px;
    font-size: 12px;
    padding: 0 7px;
  }

  body:not(.admin-page) .nav-item span {
    width: 22px;
    height: 20px;
    font-size: 10px;
  }

  body:not(.admin-page) .case-list {
    gap: 6px;
    margin-top: 4px;
  }

  body:not(.admin-page) .case-item {
    min-height: 42px;
    gap: 2px;
    padding: 7px;
  }

  body:not(.admin-page) .case-item span {
    font-size: 12px;
  }

  body:not(.admin-page) .case-item small {
    font-size: 11px;
  }

  .case-manager-backdrop {
    inset: 58px 0 0;
    z-index: 82;
  }

  .case-manager-drawer {
    top: 58px;
    left: 0;
    z-index: 86;
    gap: 8px;
    width: 100vw;
    min-width: 0;
    height: calc(100dvh - 58px);
    border-right: 0;
    box-shadow: 0 -16px 42px rgba(20, 31, 45, 0.14);
    padding: 10px;
  }

  body:not(.admin-page) .case-manager-drawer {
    gap: 6px;
    padding: 8px;
  }

  .matter-switcher.case-manager-panel {
    gap: 7px;
    max-height: calc(100dvh - 132px);
    padding: 8px;
  }

  body:not(.admin-page) .matter-switcher.case-manager-panel {
    gap: 6px;
    padding: 7px;
  }

  .case-manager-panel .matter-list {
    gap: 5px;
    max-height: calc(100dvh - 184px);
  }

  body:not(.admin-page) .case-manager-panel .matter-list {
    max-height: calc(100dvh - 160px);
  }

  body.case-manager-open .case-manager-drawer {
    transform: translateX(0);
  }

  .case-manager-head {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    padding-bottom: 8px;
  }

  body:not(.admin-page) .case-manager-head {
    gap: 6px;
    padding-bottom: 6px;
  }

  .case-manager-head div {
    gap: 1px;
  }

  .case-manager-head span {
    font-size: 11px;
  }

  body:not(.admin-page) .case-manager-head span {
    display: none;
  }

  .case-manager-head h2 {
    font-size: 17px;
  }

  body:not(.admin-page) .case-manager-head h2 {
    font-size: 16px;
  }

  .case-manager-head .secondary-button {
    min-height: 26px;
    height: 26px;
    font-size: 11px;
    padding: 0 8px;
  }

  .case-manager-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
  }

  body:not(.admin-page) .case-manager-actions {
    gap: 4px;
  }

  .case-manager-panel .matter-switcher-head button {
    min-height: 24px;
    font-size: 11px;
    padding: 0 6px;
  }

  .matter-delete-feedback {
    font-size: 11px;
    padding: 7px 8px;
  }

  .case-manager-panel .matter-switch-row {
    grid-template-columns: minmax(0, 1fr) 38px;
    gap: 5px;
  }

  body:not(.admin-page) .case-manager-panel .matter-switch-row {
    align-items: stretch;
    grid-template-columns: minmax(0, 1fr) 38px;
  }

  .case-manager-panel .matter-switch-button {
    min-height: 38px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px;
    border-radius: 7px;
    padding: 6px 7px;
  }

  body:not(.admin-page) .case-manager-panel .matter-switch-copy {
    gap: 2px;
    min-width: 0;
  }

  .case-manager-panel .matter-switch-button strong {
    font-size: 12px;
  }

  body:not(.admin-page) .case-manager-panel .matter-switch-button strong {
    display: -webkit-box;
    overflow: hidden;
    line-height: 1.25;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .case-manager-panel .matter-switch-button span {
    font-size: 11px;
    line-height: 1.25;
  }

  body:not(.admin-page) .case-manager-panel .matter-switch-copy > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body:not(.admin-page) .case-manager-panel .matter-state-pill {
    min-width: 30px;
    min-height: 20px;
    align-self: center;
    font-size: 10px;
    padding: 0 5px;
  }

  .case-manager-panel .matter-rename-button {
    min-width: 34px;
    min-height: 38px;
    border-radius: 7px;
    font-size: 10px;
    padding: 0 6px;
  }

  .case-manager-panel .matter-rename-form {
    gap: 5px;
    border-radius: 7px;
    padding: 6px;
  }

  body:not(.admin-page) .case-manager-panel .matter-rename-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .case-manager-panel .matter-rename-form input {
    min-height: 29px;
    border-radius: 7px;
    font-size: 12px;
    padding: 0 8px;
  }

  body:not(.admin-page) .case-manager-panel .matter-rename-form input {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .case-manager-panel .matter-rename-form button {
    min-height: 26px;
    border-radius: 7px;
    font-size: 10px;
    padding: 0 6px;
  }

  body:not(.admin-page) .matter-list-empty {
    padding: 8px;
    font-size: 11px;
    line-height: 1.4;
  }

  .dossier-rail {
    display: none;
  }

  .main-pane {
    height: calc(100dvh - 58px);
  }

  .workspace-view.active {
    height: 100%;
  }

  #chatView {
    height: calc(100dvh - 58px);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
  }

  body:not(.admin-page) #chatView {
    grid-template-rows: 34px 30px minmax(0, 1fr) auto;
  }

  #archiveView {
    grid-template-rows: auto auto auto minmax(0, 1fr);
  }

  .chat-header,
  .tool-header {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    padding: 7px 10px;
  }

  .chat-header {
    min-height: 38px;
    padding: 5px 10px;
  }

  body:not(.admin-page) .chat-header {
    min-height: 34px;
    padding: 4px 8px;
  }

  .chat-header h1,
  .tool-header h1 {
    font-size: 16px;
  }

  .chat-header p,
  .tool-header p {
    display: none;
  }

  .chat-title-block {
    display: none;
  }

  .chat-header-actions {
    flex: 1 1 100%;
    justify-content: stretch;
  }

  .desktop-dossier-button {
    display: none;
  }

  .mode-control {
    justify-items: stretch;
    min-width: 0;
    width: 100%;
  }

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

  body:not(.admin-page) .mode-switch {
    padding: 1px;
  }

  .mode-switch button {
    min-height: 26px;
    font-size: 11px;
    padding: 0 4px;
  }

  body:not(.admin-page) .mode-switch button {
    min-height: 24px;
    height: 24px;
  }

  .mode-hint {
    display: none;
  }

  .chat-case-strip {
    min-height: 34px;
    grid-template-columns: minmax(0, 1fr);
    padding: 4px 10px;
  }

  body:not(.admin-page) .chat-case-strip {
    min-height: 30px;
    padding: 3px 8px;
  }

  .chat-case-current {
    display: none;
  }

  .prompt-launcher {
    align-items: center;
    min-height: 0;
    padding: 0;
  }

  body:not(.admin-page) .composer-prompt-launcher {
    width: min(900px, 100%);
    margin: 0 auto 5px;
    gap: 6px;
    min-height: 30px;
  }

  .prompt-panel-head {
    align-items: center;
  }

  .prompt-panel-head div {
    align-items: center;
    flex-direction: row;
    gap: 6px;
  }

  .prompt-library-open {
    min-height: 28px;
    padding: 0 8px;
  }

  body:not(.admin-page) .composer-prompt-button,
  body:not(.admin-page) .prompt-library-open {
    min-height: 30px;
    height: 30px;
    border-radius: 999px;
    padding: 0 10px;
  }

  .prompt-quick-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  body:not(.admin-page) .prompt-quick-list {
    gap: 6px;
    padding: 0 0 2px;
    scrollbar-width: none;
  }

  body:not(.admin-page) .prompt-quick-list::-webkit-scrollbar {
    display: none;
  }

  body:not(.admin-page) .selected-prompt-card {
    align-items: stretch;
    gap: 6px;
    margin: 0 auto 5px;
    border-radius: 14px;
    padding: 6px;
  }

  body:not(.admin-page) .selected-prompt-copy {
    gap: 0;
  }

  body:not(.admin-page) .selected-prompt-copy span {
    display: none;
  }

  body:not(.admin-page) .selected-prompt-copy strong {
    font-size: 12px;
  }

  body:not(.admin-page) .selected-prompt-copy small {
    font-size: 10px;
  }

  body:not(.admin-page) .selected-prompt-actions {
    gap: 4px;
  }

  body:not(.admin-page) .selected-prompt-actions button {
    min-height: 26px;
    border-radius: 10px;
    font-size: 11px;
    padding: 0 6px;
  }

  .prompt-group-hint {
    display: none;
  }

  .prompt-quick-card {
    flex: 0 0 auto;
    min-height: 28px;
    max-width: 146px;
    padding: 4px 7px;
  }

  .prompt-card.prompt-quick-card {
    min-height: 28px;
    max-width: 146px;
    padding: 4px 7px;
  }

  .matter-workbench-details[open] {
    max-height: min(220px, 34dvh);
  }

  .matter-workbench-summary {
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 8px 10px;
  }

  .matter-workbench-summary .matter-workbench-title span {
    display: none;
  }

  .matter-workbench-summary-metrics {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .matter-workbench-toggle {
    grid-column: 2;
    grid-row: 1;
  }

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

  .prompt-card {
    min-height: 50px;
  }

  .conversation-status {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 6px;
    min-height: 28px;
    padding: 0;
  }

  body:not(.admin-page) .conversation-status {
    grid-template-columns: minmax(0, 1fr) auto 34px;
    gap: 4px;
    min-height: 26px;
  }

  .conversation-status div {
    display: block;
  }

  .conversation-status strong:first-child {
    display: none;
  }

  .conversation-status span {
    overflow: visible;
    overflow-wrap: anywhere;
    font-size: 11px;
    line-height: 1.2;
    text-overflow: clip;
    white-space: normal;
  }

  .conversation-status-count {
    min-width: 42px;
    font-size: 11px;
    padding: 3px 6px;
  }

  body:not(.admin-page) .conversation-status-count {
    min-width: 38px;
    padding: 2px 5px;
  }

  .conversation-refresh {
    grid-column: auto;
    grid-row: auto;
    min-height: 26px;
    font-size: 11px;
    padding: 0 7px;
  }

  body:not(.admin-page) .conversation-refresh {
    min-width: 34px;
    min-height: 26px;
    height: 26px;
    padding: 0 4px;
  }

  .messages,
  body:not(.admin-page) .messages {
    padding: 12px 14px;
  }

  body:not(.admin-page) .messages {
    padding: 10px 12px;
  }

  .message {
    margin-bottom: 12px;
  }

  .bubble {
    padding: 12px 13px;
    line-height: 1.62;
  }

  .composer {
    padding: 10px 10px 12px;
  }

  body:not(.admin-page) .composer {
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    border-top-color: rgba(193, 199, 205, 0.82);
    background: rgba(235, 240, 246, 0.94);
    box-shadow: 0 -10px 24px rgba(18, 22, 25, 0.055);
  }

  body:not(.admin-page) .composer {
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  }

  .file-strip {
    max-height: 74px;
    overflow: auto;
  }

  body:not(.admin-page) .file-strip {
    gap: 5px;
    max-height: 58px;
    margin-bottom: 5px;
  }

  body:not(.admin-page) .media-readiness-note {
    margin-bottom: 5px;
    padding: 6px 8px;
    border-radius: 10px;
    font-size: 11px;
  }

  .file-chip strong {
    max-width: 150px;
  }

  body:not(.admin-page) .file-chip {
    min-height: 28px;
    padding: 4px 7px;
  }

  #chatForm {
    grid-template-columns: 36px minmax(0, 1fr) 56px;
    gap: 7px;
    padding: 7px;
  }

  body:not(.admin-page) #chatForm {
    grid-template-columns: 32px minmax(0, 1fr) 50px;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border-radius: 18px;
    box-shadow: 0 8px 20px rgba(18, 22, 25, 0.08);
  }

  .file-button,
  .send-button {
    min-height: 34px;
  }

  body:not(.admin-page) .file-button,
  body:not(.admin-page) .send-button {
    min-height: 32px;
    height: 32px;
    border-radius: 12px;
  }

  body:not(.admin-page) .file-button {
    font-size: 18px;
  }

  #chatForm textarea {
    max-height: min(164px, 12dvh);
    min-height: 34px;
    font-size: 13px;
    padding: 6px 1px;
  }

  body:not(.admin-page) #chatForm textarea {
    min-height: 32px;
    max-height: min(132px, 12dvh);
    line-height: 1.44;
    padding: 6px 2px 5px;
  }

  .send-button {
    grid-column: auto;
    min-width: 0;
  }

  body:not(.admin-page) .send-button {
    font-size: 12px;
    padding: 0 8px;
  }

  .tool-view {
    height: calc(100dvh - 58px);
    overflow: hidden;
  }

  .tool-grid,
  .admin-grid {
    grid-template-columns: 1fr;
    padding: 10px 14px 14px;
  }

  body:not(.admin-page) .archive-mobile-summary {
    display: grid;
    min-width: 0;
    gap: 3px;
    border: 1px solid rgba(207, 224, 255, 0.92);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.86);
    margin: 0 14px;
    padding: 7px 10px;
  }

  body:not(.admin-page) .archive-mobile-summary span {
    color: #1558c7;
    font-size: 10px;
    font-weight: 900;
  }

  body:not(.admin-page) .archive-mobile-summary strong {
    overflow: hidden;
    font-size: 13px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body:not(.admin-page) .archive-mobile-summary small {
    display: -webkit-box;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.28;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
  }

  body:not(.admin-page) .archive-mobile-summary[data-archive-mobile-state="error"] {
    border-color: #f0caca;
    background: rgba(255, 248, 248, 0.9);
  }

  .mobile-archive-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
    align-self: start;
    gap: 5px;
    border-bottom: 0;
    background: rgba(251, 252, 253, 0.82);
    padding: 4px 14px;
  }

  body:not(.admin-page) .archive-core-actions {
    background: transparent;
    padding-top: 2px;
  }

  .mobile-archive-actions .secondary-button {
    align-self: center;
    min-height: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 11px;
    padding: 0 10px;
  }

  body:not(.admin-page) .mobile-archive-actions .secondary-button {
    min-height: 28px;
    height: 28px;
    border-radius: 999px;
  }

  .mobile-archive-actions .secondary-button:first-child {
    border-color: #1f6feb;
    background: #eef5ff;
    color: #1558c7;
  }

  #archiveUploadBtn {
    display: none;
  }

  body.archive-view .tool-grid {
    grid-template-areas: "board";
    grid-template-columns: 1fr;
    align-content: start;
    height: 100%;
    overflow: auto;
  }

  .archive-board {
    gap: 8px;
    min-height: 0;
  }

  .archive-toolbar {
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .archive-scope-switch {
    flex: 0 0 auto;
    grid-template-columns: repeat(2, minmax(50px, 1fr));
    padding: 2px;
  }

  .archive-scope-switch button {
    min-height: 26px;
    font-size: 11px;
    padding: 0 6px;
  }

  .archive-summary-note {
    display: none;
  }

  .archive-filter-shell {
    position: relative;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
  }

  .archive-filter-shell #archiveSearch {
    grid-column: 1;
    grid-row: 1;
    min-height: 30px;
    font-size: 12px;
    padding: 5px 9px;
  }

  .archive-filter-details {
    display: block;
    grid-column: 2;
    grid-row: 1;
  }

  body:not(.admin-page) .archive-filter-entry {
    min-width: 54px;
  }

  body:not(.admin-page) .archive-filter-entry[open] {
    z-index: 6;
  }

  .archive-filter-details summary {
    display: grid;
    place-items: center;
    min-height: 30px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text);
    cursor: pointer;
    font-size: 11px;
    font-weight: 850;
    list-style: none;
    padding: 0 8px;
    white-space: nowrap;
  }

  .archive-filter-details summary::-webkit-details-marker {
    display: none;
  }

  .archive-filter-details .filter-row {
    display: none;
  }

  .archive-filter-details[open] .filter-row {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 12px 28px rgba(20, 31, 45, 0.16);
    padding: 8px;
  }

  .archive-filter-details #archiveFilterCategory,
  .archive-filter-details #archiveFilterStatus {
    grid-column: auto;
    grid-row: auto;
    min-height: 32px;
    font-size: 12px;
    padding: 6px 9px;
  }

  .archive-state-card {
    gap: 6px;
    padding: 12px;
  }

  body:not(.admin-page) .archive-state-card {
    gap: 5px;
    padding: 10px 12px;
  }

  .archive-state-card span,
  body:not(.admin-page) .archive-state-card span {
    padding: 2px 6px;
    font-size: 10px;
  }

  .archive-state-card h3,
  body:not(.admin-page) .archive-state-card h3 {
    font-size: 13px;
  }

  .archive-state-card p,
  .archive-state-card small,
  body:not(.admin-page) .archive-state-card p,
  body:not(.admin-page) .archive-state-card small {
    display: -webkit-box;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.38;
    -webkit-box-orient: vertical;
  }

  .archive-state-card p,
  body:not(.admin-page) .archive-state-card p {
    -webkit-line-clamp: 2;
  }

  .archive-state-card small,
  body:not(.admin-page) .archive-state-card small {
    -webkit-line-clamp: 1;
  }

  .archive-state-actions {
    gap: 5px;
    margin-top: 0;
  }

  .archive-state-button,
  body:not(.admin-page) .archive-state-button {
    min-height: 26px;
    font-size: 11px;
    padding: 0 8px;
  }

  body:not(.admin-page) .archive-list {
    gap: 7px;
  }

  body:not(.admin-page) .archive-card {
    gap: 6px;
    border-left-width: 3px;
    padding: 9px 10px;
  }

  body:not(.admin-page) .archive-card-head {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  body:not(.admin-page) .archive-card-title {
    gap: 4px;
  }

  body:not(.admin-page) .archive-card h3 {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 13px;
    line-height: 1.28;
  }

  body:not(.admin-page) .archive-card p {
    display: -webkit-box;
    overflow: hidden;
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.42;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  body:not(.admin-page) .archive-meta {
    gap: 5px;
    max-height: 34px;
    overflow: hidden;
    font-size: 10px;
    line-height: 1.35;
  }

  body:not(.admin-page) .archive-card-copy {
    gap: 3px;
  }

  body:not(.admin-page) .archive-extra-grid {
    max-height: 48px;
    overflow: hidden;
    gap: 5px;
  }

  body:not(.admin-page) .archive-extra-grid span {
    max-width: 100%;
    overflow: hidden;
    padding: 2px 6px;
    font-size: 10px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body:not(.admin-page) .archive-card .tag-row {
    max-height: 25px;
    overflow: hidden;
  }

  body:not(.admin-page) .archive-card-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  body:not(.admin-page) .archive-action-button {
    width: 100%;
    min-height: 28px;
    border-radius: 999px;
    font-size: 11px;
    padding: 0 8px;
  }

  .archive-form-mobile-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    padding-bottom: 10px;
  }

  .archive-form-mobile-head div {
    display: grid;
    gap: 3px;
    min-width: 0;
  }

  .archive-form-mobile-head strong {
    font-size: 15px;
  }

  .archive-form-mobile-head span {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
  }

  .archive-form-backdrop {
    position: fixed;
    inset: 58px 0 0;
    z-index: 84;
    display: block;
    background: rgba(15, 23, 42, 0.24);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
  }

  body.archive-form-open .archive-form-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .archive-form-drawer {
    position: fixed;
    inset: auto 0 0;
    z-index: 86;
    display: grid;
    width: 100vw;
    height: auto;
    max-height: min(76dvh, 660px);
    overflow: auto;
    border-width: 1px 0 0;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -16px 42px rgba(20, 31, 45, 0.16);
    gap: 7px;
    padding: 10px 10px 0;
    transform: translateY(104%);
    transition: transform 0.2s ease;
  }

  body:not(.admin-page) .archive-form-drawer {
    border-radius: 18px 18px 0 0;
  }

  body:not(.admin-page).archive-form-open .archive-form-drawer {
    box-shadow: 0 -16px 42px rgba(20, 31, 45, 0.16);
  }

  body.archive-form-open .archive-form-drawer {
    transform: translateY(0);
  }

  .archive-upload-box {
    gap: 5px;
    padding: 8px;
  }

  .archive-upload-box span {
    display: -webkit-box;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  body:not(.admin-page) .archive-draft-status {
    gap: 2px;
    border-radius: 12px;
    padding: 7px 8px;
  }

  body:not(.admin-page) .archive-draft-status span {
    font-size: 10px;
    padding: 1px 6px;
  }

  body:not(.admin-page) .archive-draft-status strong {
    font-size: 12px;
    line-height: 1.25;
  }

  body:not(.admin-page) .archive-draft-status small {
    display: -webkit-box;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.32;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
  }

  .archive-primary-fields {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .archive-primary-fields label:first-child {
    grid-column: auto;
  }

  body:not(.admin-page) .archive-primary-fields label:nth-child(2) {
    order: 1;
  }

  body:not(.admin-page) .archive-primary-fields label:nth-child(3) {
    order: 2;
  }

  body:not(.admin-page) .archive-primary-fields label:nth-child(1) {
    order: 3;
  }

  .archive-form-drawer label {
    gap: 4px;
    font-size: 12px;
  }

  .archive-form-drawer input,
  .archive-form-drawer select,
  .archive-form-drawer textarea {
    min-height: 31px;
    font-size: 12px;
    padding: 6px 9px;
  }

  .archive-advanced-fields {
    padding: 7px;
  }

  body:not(.admin-page) .archive-more-fields {
    max-height: 40px;
    overflow: hidden;
  }

  body:not(.admin-page) .archive-more-fields[open] {
    max-height: none;
    overflow: visible;
  }

  .archive-advanced-fields > summary {
    min-height: 28px;
    display: grid;
    align-items: center;
  }

  .archive-advanced-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .archive-submit-row {
    display: grid;
    margin-inline: -10px;
    padding: 8px 10px 10px;
  }

  body:not(.admin-page) .archive-submit-row {
    display: grid;
    gap: 6px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), var(--surface) 42%);
  }

  body:not(.admin-page) .archive-primary-action-row {
    position: sticky;
    bottom: 0;
    z-index: 3;
  }

  .archive-submit-row .send-button {
    min-height: 34px;
    border-radius: 999px;
  }

  body:not(.admin-page) .archive-submit-row .send-button {
    min-height: 34px;
    height: 34px;
    font-size: 12px;
  }

  .filter-row,
  .feed-upload-row,
  .feed-upload-row.compact,
  .knowledge-toolbar,
  .advanced-history-search,
  .advanced-history-filter-row {
    grid-template-columns: 1fr;
  }

  .feed-upload-row .send-button,
  .feed-upload-row.compact .send-button {
    width: 100%;
  }

  .admin-page .history-card-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .admin-page .account-user-summary-row {
    display: grid;
    gap: 8px;
  }

  .admin-page .history-action-button {
    width: 100%;
    min-width: 0;
    min-height: 30px;
    padding: 3px 7px;
    line-height: 1.25;
    white-space: normal;
  }

  .admin-page .material-admin-list {
    grid-template-columns: 1fr;
    padding-right: 0;
  }

  .owner-admin-grid {
    padding: 0;
  }

  .admin-topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .admin-topbar .secondary-button {
    align-self: flex-start;
    width: auto;
    min-width: 72px;
  }

  .review-pane {
    top: 58px;
    width: 100vw;
    height: calc(100dvh - 58px);
  }

  .dossier-backdrop {
    inset: 58px 0 0;
  }

  .dossier-drawer-top {
    position: sticky;
    top: 0;
    z-index: 2;
    min-height: 48px;
    padding: 8px 10px;
  }

  .dossier-drawer-top span {
    font-size: 11px;
  }

  .dossier-drawer-top strong {
    font-size: 14px;
    line-height: 1.25;
  }

  body:not(.admin-page) .dossier-drawer-top strong {
    display: none;
  }

  .dossier-drawer-top .secondary-button {
    min-height: 28px;
    height: 28px;
    font-size: 11px;
    padding: 0 8px;
  }

  .history-panel {
    gap: 8px;
    padding: 10px 10px 14px;
  }

  .history-header {
    align-items: stretch;
    flex-direction: row;
    gap: 8px;
    padding-bottom: 0;
    border-bottom: 0;
  }

  .history-header h2 {
    font-size: 14px;
  }

  .history-header p {
    display: none;
  }

  .history-header .secondary-button {
    align-self: start;
    min-height: 26px;
    height: 26px;
    font-size: 11px;
    padding: 0 8px;
  }

  .history-case-summary {
    gap: 8px;
    padding: 9px;
  }

  body:not(.admin-page) .history-dossier-summary {
    gap: 7px;
  }

  body:not(.admin-page) .history-dossier-empty {
    min-height: 0;
    padding: 9px;
    font-size: 11px;
    line-height: 1.4;
  }

  .history-case-title {
    gap: 3px;
  }

  .history-case-title > span {
    display: none;
  }

  .history-case-name-row {
    gap: 6px;
  }

  .history-case-title strong {
    display: -webkit-box;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.28;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .history-case-title small,
  .history-link-button {
    font-size: 10px;
  }

  body:not(.admin-page) .history-case-compact-summary {
    gap: 2px;
    padding: 6px 7px;
  }

  body:not(.admin-page) .history-case-compact-summary span {
    font-size: 10px;
  }

  body:not(.admin-page) .history-case-compact-summary p {
    display: -webkit-box;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .history-case-name-form {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .history-case-name-form input {
    grid-column: 1 / -1;
    min-height: 28px;
    font-size: 12px;
  }

  .history-case-metrics,
  .history-case-record-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-case-metrics {
    gap: 6px;
  }

  body:not(.admin-page) .history-case-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .history-case-metrics div {
    min-height: 44px;
    padding: 6px 7px;
  }

  body:not(.admin-page) .history-case-metrics div {
    min-height: 38px;
    padding: 5px 3px;
    text-align: center;
  }

  body:not(.admin-page) .history-case-quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  body:not(.admin-page) .history-case-quick-actions .history-action-button {
    width: 100%;
  }

  .history-case-metrics span,
  .history-case-record-grid span,
  .history-case-record-meta,
  .history-progress-time {
    font-size: 10px;
  }

  .history-case-metrics strong {
    margin-top: 3px;
    font-size: 16px;
  }

  body:not(.admin-page) .history-case-section-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  body:not(.admin-page) .history-case-section-nav button {
    min-height: 28px;
    font-size: 11px;
    padding: 0 6px;
  }

  .history-list {
    gap: 8px;
  }

  .history-case-record {
    gap: 9px;
    padding: 10px;
    border-left-width: 3px;
  }

  .history-case-record-head {
    gap: 6px;
  }

  body:not(.admin-page) .history-case-record-head {
    display: none;
  }

  .history-case-record h3 {
    font-size: 14px;
  }

  .history-case-brief {
    display: -webkit-box;
    overflow: hidden;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .history-case-record-grid {
    gap: 6px;
  }

  .history-case-record-grid {
    display: none;
  }

  .history-case-record-grid div {
    min-height: 48px;
    padding: 7px;
  }

  .history-case-record-grid strong {
    margin-top: 3px;
    font-size: 17px;
  }

  .history-case-details {
    gap: 8px;
  }

  body:not(.admin-page) .history-dossier-sections {
    border-style: solid;
    background: rgba(255, 255, 255, 0.8);
    padding: 7px;
  }

  .history-case-details summary {
    min-height: 26px;
    font-size: 11px;
  }

  .history-case-section {
    gap: 6px;
  }

  .history-case-section h4 {
    font-size: 12px;
  }

  .history-progress-list {
    gap: 6px;
  }

  .history-progress-item {
    gap: 6px;
    padding: 7px 8px;
  }

  body:not(.admin-page) .history-progress-item {
    grid-template-columns: 1fr;
  }

  body:not(.admin-page) .history-progress-time {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .history-progress-item p,
  .history-inline-empty {
    font-size: 11px;
    line-height: 1.45;
  }

  body:not(.admin-page) .matter-party-form {
    grid-template-columns: 1fr;
  }

  body:not(.admin-page) .matter-party-form [data-party-note] {
    grid-column: auto;
  }

  .history-case-actions {
    gap: 6px;
  }

  body:not(.admin-page) .history-case-record .history-case-actions {
    display: none;
  }

  .history-action-button {
    min-height: 28px;
    font-size: 11px;
    padding: 0 8px;
  }

  .prompt-library-drawer {
    inset: 58px 0 0;
  }

  .prompt-library-panel {
    width: 100vw;
    height: calc(100dvh - 58px);
    padding: 10px;
  }

  .prompt-library-header {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    padding-bottom: 8px;
  }

  body:not(.admin-page) .prompt-library-header {
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
  }

  body:not(.admin-page) .prompt-library-header h2 {
    font-size: 16px;
  }

  body:not(.admin-page) .prompt-library-header p {
    display: none;
  }

  body:not(.admin-page) .prompt-library-header .secondary-button {
    min-height: 28px;
    height: 28px;
    font-size: 11px;
    padding: 0 8px;
  }

  body:not(.admin-page) .prompt-tabs {
    gap: 6px;
    padding-bottom: 0;
    scrollbar-width: none;
  }

  body:not(.admin-page) .prompt-tabs::-webkit-scrollbar {
    display: none;
  }

  body:not(.admin-page) .prompt-tabs button {
    min-width: 78px;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0 10px;
    text-align: center;
  }

  body:not(.admin-page) .prompt-tabs button span {
    font-size: 12px;
  }

  body:not(.admin-page) .prompt-tabs button small {
    display: none;
  }

  body:not(.admin-page) .prompt-library-panel .prompt-grid {
    grid-auto-rows: auto;
    gap: 7px;
    overflow-y: auto;
    padding-right: 0;
  }

  body:not(.admin-page) .prompt-library-panel .prompt-card {
    min-height: 46px;
    gap: 3px;
    border-radius: 12px;
    box-shadow: none;
    padding: 7px 9px;
  }

  body:not(.admin-page) .prompt-library-panel .prompt-card span {
    font-size: 12px;
  }

  body:not(.admin-page) .prompt-library-panel .prompt-card small {
    display: -webkit-box;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
  }

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

  .agent-row {
    grid-template-columns: 1fr;
  }

  .agent-row-metrics {
    justify-items: start;
  }

  .detail-modal {
    place-items: stretch;
    padding: 0;
  }

  body:not(.admin-page) .detail-modal {
    z-index: 120;
  }

  body:not(.admin-page) .detail-dialog {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border-width: 0;
    border-radius: 0;
  }

  .detail-dialog {
    width: 100%;
    max-height: 100vh;
  }

  .detail-header {
    align-items: stretch;
    flex-direction: column;
    padding: 16px;
  }

  body:not(.admin-page) .detail-header {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    padding: 10px;
  }

  body:not(.admin-page) .detail-header h2 {
    display: -webkit-box;
    overflow: hidden;
    font-size: 15px;
    line-height: 1.3;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  body:not(.admin-page) .detail-header p {
    display: -webkit-box;
    overflow: hidden;
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
  }

  body:not(.admin-page) .detail-header .secondary-button {
    min-height: 28px;
    height: 28px;
    font-size: 11px;
    padding: 0 8px;
  }

  body:not(.admin-page) .detail-body {
    gap: 8px;
    padding: 10px 10px 14px;
  }

  body:not(.admin-page) .archive-detail-summary {
    max-height: 52px;
    overflow: hidden;
    font-size: 10px;
  }

  body:not(.admin-page) .archive-detail-summary span {
    max-width: 100%;
    overflow: hidden;
    padding: 3px 7px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body:not(.admin-page) .detail-section {
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    padding: 9px;
  }

  body:not(.admin-page) .detail-section h3 {
    font-size: 13px;
  }

  body:not(.admin-page) .detail-section p,
  body:not(.admin-page) .detail-section pre {
    font-size: 11px;
    line-height: 1.45;
  }

  body:not(.admin-page) .detail-section pre {
    max-height: 150px;
    padding: 9px;
  }

  body:not(.admin-page) .detail-action-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  body:not(.admin-page) .detail-action-button,
  body:not(.admin-page) .detail-open-link {
    width: 100%;
    min-height: 30px;
    border-radius: 999px;
    font-size: 11px;
  }

  .detail-body {
    padding: 16px;
  }

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

  .attachment-preview-frame {
    min-height: 360px;
  }
}

@media (max-width: 420px) {
  body:not(.admin-page) .selected-prompt-edge-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  body:not(.admin-page) .selected-prompt-copy strong,
  body:not(.admin-page) .selected-prompt-copy small {
    white-space: nowrap;
  }

  body:not(.admin-page) .selected-prompt-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  body:not(.admin-page) .selected-prompt-actions button {
    width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body:not(.admin-page) #chatForm textarea {
    min-width: 0;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 780px) {
  .material-coverage-summary {
    margin: 12px 14px 0;
    padding: 10px 11px;
  }

  .material-analysis-basis li {
    grid-template-columns: minmax(0, 1fr);
  }

  .answer-collapse-shell {
    padding: 14px 15px;
    gap: 12px;
  }

  .answer-collapse-summary {
    padding: 12px 13px;
  }

  .answer-collapse-actions {
    align-items: stretch;
  }

  .answer-collapse-toggle {
    width: 100%;
  }
}

body:not(.admin-page).case-manager-open .case-manager-drawer {
  transform: translateX(0);
}
