:root {
  color-scheme: light;
  --bg: #f3f4fb;
  --panel: #ffffff;
  --panel-soft: #f8f6ff;
  --text: #132033;
  --muted: #66788d;
  --line: #dbe5f1;
  --accent: #2f6df6;
  --accent-strong: #1f54c9;
  --accent-soft: #edf4ff;
  --blue: #0b3f87;
  --edge-accent: #6d5bd0;
  --violet: #7c67d8;
  --gold: #b87514;
  --amber: #f2b84b;
  --coral: #f26d6d;
  --rose: #ef6b86;
  --steel: #8aa0b8;
  --lavender: #c9b8ff;
  --red: #bd3a47;
  --status-blue: #174bbd;
  --brand-gradient: linear-gradient(135deg, #2f6df6 0%, #7c67d8 38%, #f2b84b 72%, #f26d6d 100%);
  --brand-soft-gradient: linear-gradient(135deg, #edf4ff 0%, #f4f1ff 42%, #fff7ea 100%);
  --shadow: 0 18px 44px rgba(65, 72, 124, 0.1);
  --shadow-soft: 0 8px 24px rgba(65, 72, 124, 0.07);
}

.user-badge {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  border: 1px solid rgba(216, 228, 239, 0.9);
  border-radius: 999px;
  color: #718096;
  background: rgba(248, 251, 255, 0.86);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.auth-blocked {
  min-height: 70vh;
  display: grid;
  place-content: center;
  gap: 12px;
  text-align: center;
}

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

* {
  box-sizing: border-box;
}

html,
body,
.shell,
.main,
.assistant-home,
.assistant-home-main,
.assistant-chat,
.chat-thread,
.chat-message,
.message-content,
.agent-task-card,
details {
  min-width: 0;
  max-width: 100%;
}

img,
svg,
canvas,
video,
table,
pre,
code {
  max-width: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  min-height: 36px;
  padding: 0 12px;
}

button:hover {
  border-color: #a8bac5;
}

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

button.primary:hover {
  background: var(--accent-strong);
}

button.full {
  width: 100%;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  min-height: 36px;
  padding: 7px 10px;
}

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

textarea.auto-resize-field {
  min-height: 36px;
  overflow: hidden;
  resize: none;
  white-space: pre-wrap;
}

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

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  transition: grid-template-columns 0.18s ease;
}

.sidebar {
  background: #f7f9fc;
  color: var(--text);
  border-right: 1px solid var(--line);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow: hidden;
}

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

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: #f5f1ff;
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(95, 76, 180, 0.12);
  flex: 0 0 auto;
}

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

.sidebar-toggle {
  margin-left: auto;
  width: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 8px;
  color: var(--muted);
}

.brand h1,
.brand p,
.topbar h2,
.topbar p {
  margin: 0;
}

.brand h1 {
  font-size: 17px;
}

.brand p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  color: #334155;
  background: transparent;
  border-color: transparent;
  text-align: left;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav button.active,
.nav button:hover {
  background: #edf3ff;
  border-color: #d8e4ff;
  color: var(--accent);
}

.nav-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: inherit;
  background: rgba(51, 112, 255, 0.08);
  flex: 0 0 auto;
}

.nav-icon svg {
  width: 15px;
  height: 15px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.main {
  min-width: 0;
  padding: 22px 24px 132px;
}

.shell.sidebar-collapsed {
  grid-template-columns: 72px minmax(0, 1fr);
}

.shell.sidebar-collapsed .sidebar {
  width: 72px;
  padding: 16px 10px;
  gap: 14px;
  overflow: hidden;
}

.shell.sidebar-collapsed .brand-mark,
.shell.sidebar-collapsed .brand > div:not(.brand-mark) {
  display: none;
}

.shell.sidebar-collapsed .nav {
  display: grid;
  gap: 8px;
}

.shell.sidebar-collapsed .nav button {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 0;
}

.shell.sidebar-collapsed .nav button > span:not(.nav-icon) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.shell.sidebar-collapsed .sidebar-toggle {
  position: static;
  align-self: center;
  margin: 0;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  border-color: #cbd7ee;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.topbar h2 {
  font-size: 28px;
  margin-top: 2px;
}

.top-actions {
  min-width: min(100%, 560px);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.top-search {
  width: min(430px, 44vw);
  min-width: 280px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  align-items: center;
  gap: 4px;
  padding: 4px 5px 4px 14px;
  border: 1px solid #d9e6f2;
  border-radius: 999px;
  background: rgba(248, 251, 255, 0.92);
}

.search-scope-label,
.floating-search-label {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  background: #eaf2ff;
  color: #2454a6;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.top-search input {
  min-width: 0;
  min-height: 34px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.top-search input:focus {
  outline: none;
}

.top-search:focus-within {
  border-color: #b8cff8;
  box-shadow: 0 0 0 3px rgba(47, 109, 246, 0.1);
}

.top-search button {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

.top-search button:hover,
.top-search button:focus-visible {
  background: var(--control-hover);
  color: var(--text);
  box-shadow: none;
}

.top-search button svg,
.floating-search-panel button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
  text-align: left;
}

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

.metric strong {
  display: block;
  font-size: 28px;
  margin-top: 5px;
}

.metric-link {
  display: block;
  width: 100%;
  min-height: 0;
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.metric-link:hover {
  border-color: var(--accent);
  box-shadow: 0 12px 34px rgba(51, 112, 255, 0.16);
  transform: translateY(-1px);
}

.metric-link:focus-visible {
  border-color: var(--accent);
  outline: 3px solid rgba(51, 112, 255, 0.18);
  outline-offset: 2px;
}

.layout-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
}

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

.settings-page {
  display: grid;
  gap: 16px;
}

.settings-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.settings-card {
  min-height: 188px;
}

.settings-card-body {
  min-height: 126px;
  display: grid;
  align-content: space-between;
  gap: 12px;
}

.settings-kv {
  display: grid;
  gap: 10px;
}

.settings-kv div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.settings-kv span,
.settings-account-card span {
  color: var(--muted);
  font-size: 12px;
}

.settings-kv strong {
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.compact-kv {
  grid-template-columns: repeat(6, minmax(96px, 1fr));
  margin: 12px 0;
}

.roadmap-checklist {
  display: grid;
  gap: 10px;
}

.roadmap-checklist article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.roadmap-checklist article.active {
  border-color: #b8dcc4;
  background: #f1fbf4;
}

.roadmap-checklist article.paused {
  background: #f6f7f9;
}

.roadmap-checklist strong,
.roadmap-checklist span {
  display: block;
}

.roadmap-checklist span {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.5;
}

.roadmap-checklist em {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  white-space: nowrap;
}

.inline-control {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.inline-control input {
  width: 84px;
}

.error-text {
  margin: 8px 0;
  color: #b42318;
  font-size: 13px;
}

.dev-note {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #f1d29a;
  border-radius: 8px;
  background: #fffaf0;
  color: #7a4b00;
}

.dev-note strong {
  color: #5f3900;
}

.dev-note p {
  margin: 0;
  color: #7a4b00;
}

.dev-note code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(122, 75, 0, 0.08);
}

.settings-account-card {
  display: grid;
  gap: 6px;
}

.settings-account-card strong {
  font-size: 18px;
}

.settings-account-card p {
  margin: 4px 0 0;
  color: var(--muted);
}

.settings-workflow-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.42fr) minmax(0, 0.58fr);
  gap: 16px;
  align-items: start;
}

.settings-action-row {
  margin-top: 12px;
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

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

.panel-head h3 {
  margin: 0;
  font-size: 16px;
}

.panel-body {
  padding: 16px;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar input,
.toolbar select {
  width: 180px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

.queue-table table {
  min-width: 980px;
}

.deleted-seller-table table {
  min-width: 880px;
}

.project-table table {
  min-width: 1180px;
}

.project-cockpit {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  gap: 14px;
  margin-bottom: 16px;
}

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

.project-kpi,
.project-focus-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(20, 37, 51, 0.04);
}

.project-kpi {
  display: grid;
  gap: 5px;
  padding: 14px 15px;
}

.project-kpi span,
.project-kpi em,
.project-focus-head p,
.project-focus-item span,
.project-focus-item em {
  color: var(--muted);
  font-style: normal;
}

.project-kpi strong {
  font-size: 28px;
  line-height: 1.1;
}

.project-kpi em,
.project-focus-head p,
.project-focus-item span,
.project-focus-item em {
  font-size: 12px;
}

.project-focus-panel {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.project-focus-head h3,
.project-focus-head p,
.project-focus-item p {
  margin: 0;
}

.project-focus-head h3 {
  font-size: 16px;
}

.project-focus-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.project-focus-item:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.project-focus-item strong,
.project-focus-item span,
.project-focus-item em {
  display: block;
}

.project-focus-item p {
  color: #263642;
  margin-top: 4px;
}

.project-focus-item button {
  min-height: 30px;
  white-space: nowrap;
}

.project-create-form {
  display: grid;
  gap: 14px;
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

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

.project-create-head strong,
.project-create-empty strong {
  display: block;
  color: #172033;
}

.project-create-head p,
.project-create-empty p {
  margin: 4px 0 0;
}

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

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f5f8fa;
  color: #4b5b66;
  font-size: 12px;
  position: sticky;
  top: 0;
  z-index: 1;
}

tr:hover td {
  background: #fbfcfd;
}

.project-context-cell {
  display: grid;
  gap: 8px;
  min-width: 220px;
}

.project-context-cell > span {
  color: #344552;
  line-height: 1.45;
}

.project-reference-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.project-reference-tags em {
  max-width: 180px;
  padding: 3px 7px;
  border: 1px solid #d9e4ff;
  border-radius: 6px;
  background: #f6f9ff;
  color: #2454a6;
  font-size: 12px;
  font-style: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-todos {
  display: grid;
  gap: 7px;
  min-width: 340px;
}

.project-todo-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  color: #17212b;
}

.project-todo-head strong {
  font-size: 13px;
  line-height: 1.45;
  font-weight: 800;
}

.project-todo-head span,
.project-progress,
.project-more {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.project-todo {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
  margin: 0;
  color: #344552;
  font-size: 13px;
  line-height: 1.45;
}

.project-todo input {
  width: 15px;
  height: 15px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.project-todo.done span {
  color: var(--muted);
  text-decoration: line-through;
}

.project-todo em {
  display: block;
  margin-top: 2px;
  color: var(--accent);
  font-size: 12px;
  font-style: normal;
  text-decoration: none;
}

.project-todo-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.project-todo-actions button {
  min-height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  background: #f8fbff;
  border-color: #d9e4ff;
  color: var(--accent);
  font-size: 12px;
}

.queue-note {
  white-space: pre-wrap;
  color: #344552;
  max-width: 520px;
}

.queue-result {
  margin-top: 6px;
  border-left: 3px solid var(--accent);
  padding-left: 8px;
  color: #344552;
  white-space: pre-wrap;
}

.queue-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.queue-actions button {
  min-height: 28px;
  padding: 0 9px;
}

.auth-permission-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.auth-user-form {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.auth-user-form textarea {
  min-height: 72px;
}

.checkbox-line {
  display: flex !important;
  grid-template-columns: auto 1fr;
  grid-column: 1 / -1;
  align-items: center !important;
  gap: 8px !important;
  color: var(--text) !important;
  font-size: 13px !important;
}

.checkbox-line input {
  width: 16px;
  min-height: 16px;
  padding: 0;
}

.auth-user-toolbar {
  margin: 12px 0 16px;
}

.auth-users-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 16px;
}

.auth-users-layout h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.auth-user-table table {
  min-width: 980px;
}

.auth-recent-table table {
  min-width: 720px;
}

.id-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 360px;
}

.id-list code {
  border: 1px solid #d8e4ef;
  border-radius: 6px;
  background: #f7fafc;
  padding: 2px 6px;
  color: #31465a;
  font-size: 12px;
}

@media (max-width: 1080px) {
  .project-cockpit {
    grid-template-columns: 1fr;
  }

  .auth-users-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .project-kpis {
    grid-template-columns: 1fr;
  }

  .project-focus-item {
    grid-template-columns: 1fr;
  }
}

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

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

.tag.hot {
  color: var(--red);
  border-color: #f1c3c3;
  background: #fff6f6;
}

.tag.warm {
  color: var(--gold);
  border-color: #ead4af;
  background: #fff9ed;
}

.tag.cold {
  color: var(--blue);
  border-color: #bdd4ef;
  background: #f4f8ff;
}

.score {
  display: inline-grid;
  place-items: center;
  min-width: 48px;
  height: 34px;
  padding: 0 12px;
  border-radius: 6px;
  font-weight: 900;
  color: #fff;
  background: #174bbd;
  letter-spacing: 0;
}

.score.mid {
  color: #172033;
  background: #f4c047;
}

.score.low {
  color: #fff;
  background: #b3343c;
}

.empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--muted);
}

.empty-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.case-search-status {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafc;
  color: var(--muted);
  font-size: 13px;
}

.case-search-status button {
  white-space: nowrap;
}

.match-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.5fr) minmax(0, 1fr);
  gap: 16px;
}

.case-library {
  display: grid;
  grid-template-columns: minmax(280px, 0.38fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.case-library-list-only {
  grid-template-columns: 1fr;
}

.case-index,
.case-detail {
  min-height: calc(100vh - 178px);
}

.case-library-list-only .case-index {
  position: static;
}

.case-index {
  position: sticky;
  top: 22px;
}

.case-list {
  max-height: calc(100vh - 284px);
  overflow: auto;
  padding: 10px;
  display: grid;
  gap: 12px;
}

.case-library-list-only .case-list {
  max-height: none;
  overflow: visible;
}

.case-library-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  padding: 10px 12px 0;
}

.case-library-tabs button {
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.case-library-tabs button.active {
  border-color: var(--accent);
  background: #eef4ff;
  box-shadow: 0 8px 24px rgba(51, 112, 255, 0.1);
}

.case-library-tabs strong,
.case-library-tabs span {
  display: block;
}

.case-library-tabs strong {
  color: var(--text);
  font-size: 13px;
}

.case-library-tabs span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.case-library-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--line);
}

.case-import-status {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  display: grid;
  gap: 8px;
  background: #f9fbfb;
}

.case-import-status.success {
  background: #f4f8ff;
}

.case-import-status.warning {
  background: #fff9ed;
}

.case-import-status.error {
  background: #fff6f6;
}

.case-import-status-head {
  display: grid;
  gap: 2px;
}

.case-import-status-head strong {
  font-size: 13px;
}

.case-import-status-head span,
.case-import-warnings p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.case-import-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.case-import-files span {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 7px;
  background: #fff;
  color: #3d515d;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-import-warnings {
  display: grid;
  gap: 4px;
}

.case-group {
  display: grid;
  gap: 6px;
}

.rule-library-entry {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 10px;
  border: 1px solid #d9e4ff;
  border-radius: 8px;
  background: #f8fbff;
  text-align: left;
}

.rule-library-entry:hover {
  border-color: #b8c9ff;
}

.rule-library-entry.active {
  border-color: var(--accent);
  background: #eef4ff;
  box-shadow: 0 8px 24px rgba(51, 112, 255, 0.1);
}

.rule-library-entry-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e4edff;
  color: var(--accent);
  font-weight: 800;
}

.rule-library-entry strong,
.rule-library-entry em {
  display: block;
}

.rule-library-entry strong {
  font-size: 14px;
  color: var(--text);
}

.rule-library-entry em {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.case-group-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 4px 2px;
}

.case-group-title span {
  color: #334155;
}

.case-list-item {
  display: grid;
  gap: 8px;
  width: 100%;
  min-height: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.material-index-item .case-list-actions {
  justify-content: flex-start;
  color: var(--muted);
  font-size: 12px;
}

.case-list-main {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.case-list-main:hover {
  border: 0;
}

.case-list-main strong {
  font-size: 13px;
  line-height: 1.35;
}

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

.case-list-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.case-list-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.case-list-tags .buyer {
  background: #eef6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.case-list-tags .structure {
  background: #f4f1ff;
  border-color: #ddd6fe;
  color: #5b21b6;
}

.case-list-tags .status,
.case-list-tags .value {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #047857;
}

.case-list-tags .risk {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #b45309;
}

.case-list-tags .source,
.case-list-tags .rule {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #334155;
}

.case-list-item.active {
  border-color: var(--accent);
  background: #f8fbff;
  box-shadow: 0 8px 24px rgba(51, 112, 255, 0.1);
}

.case-list-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.case-list-actions button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
  background: #f9fbfb;
}

.case-detail-body {
  display: grid;
  gap: 14px;
}

.case-compare-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.case-compare-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.case-compare-head strong,
.case-compare-head span {
  display: block;
}

.case-compare-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.case-compare-table-wrap {
  overflow: auto;
}

.case-compare-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 12px;
}

.case-compare-table th,
.case-compare-table td {
  padding: 9px 10px;
  border: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
  line-height: 1.5;
}

.case-compare-table th {
  width: 130px;
  background: var(--panel);
  color: var(--text);
}

.case-compare-table thead th {
  min-width: 180px;
}

.case-compare-table th button {
  display: block;
  margin-top: 6px;
  min-height: 24px;
  padding: 0 7px;
  font-size: 11px;
}

.case-detail-tabs {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  gap: 6px;
  padding: 8px 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.case-detail-tabs button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.case-detail-tabs button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.case-detail-tabs strong,
.case-detail-tabs span {
  display: inline;
}

.case-detail-tabs strong {
  color: var(--text);
  font-size: 12px;
}

.case-detail-tabs span {
  margin-top: 0;
  color: var(--muted);
  font-size: 11px;
}

.case-detail-scroll-sections {
  display: grid;
  gap: 18px;
}

.case-detail-scroll-section {
  display: grid;
  gap: 12px;
  scroll-margin-top: 68px;
}

.case-detail-section-head {
  display: flex;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 2px;
  border-top: 1px solid var(--line);
}

.case-detail-scroll-section:first-child .case-detail-section-head {
  border-top: 0;
}

.case-detail-section-head h4 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.35;
}

.case-detail-section-head span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: right;
}

.rule-library-detail {
  display: grid;
  gap: 14px;
}

.rule-calibration-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.rule-calibration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.rule-calibration-grid article {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.rule-calibration-grid article.ok {
  border-color: #b8dcc4;
  background: #f1fbf4;
}

.rule-calibration-grid article.warn {
  border-color: #efd08b;
  background: #fff9e9;
}

.rule-calibration-grid span {
  color: var(--muted);
  font-size: 12px;
}

.rule-calibration-grid strong {
  color: var(--text);
  font-size: 15px;
}

.rule-calibration-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.rule-scenario {
  display: grid;
  gap: 8px;
}

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

.rule-scenario-head h4 {
  margin: 0;
  font-size: 15px;
}

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

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

.rule-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

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

.rule-card-head strong,
.rule-card-head span {
  display: block;
}

.rule-card-head strong {
  font-size: 14px;
}

.rule-card-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.rule-card p {
  margin: 0;
  color: #2b3a45;
  line-height: 1.55;
}

.rule-card b {
  margin-right: 8px;
  color: var(--text);
}

.material-library-detail {
  display: grid;
  gap: 12px;
}

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

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

.material-card-head strong,
.material-card-head span {
  display: block;
}

.material-card-head strong {
  font-size: 15px;
}

.material-card-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.material-count {
  flex: 0 0 auto;
  border: 1px solid #d9e4ff;
  border-radius: 999px;
  padding: 4px 8px;
  background: #f8fbff;
  color: var(--accent) !important;
  font-weight: 700;
}

.material-summary {
  margin: 0;
  color: #263642;
  line-height: 1.55;
}

.material-card pre {
  max-height: 260px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfb;
  padding: 10px 12px;
  color: #2b3a45;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  font-size: 13px;
  line-height: 1.55;
}

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

.case-highlight-grid div,
.case-field-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfb;
  padding: 11px 12px;
}

.case-highlight-grid span,
.case-field-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.case-highlight-grid strong {
  display: block;
  color: var(--text);
}

.case-field-grid p {
  margin: 0;
  color: #2b3a45;
  word-break: break-word;
}

.case-narrative {
  display: grid;
  gap: 10px;
}

.case-narrative section {
  border: 1px solid #d9e4ff;
  border-radius: 8px;
  background: #f8fbff;
  padding: 12px;
}

.case-narrative h4,
.case-narrative p {
  margin: 0;
}

.case-narrative h4 {
  font-size: 13px;
  margin-bottom: 6px;
}

.case-overview-brief {
  display: grid;
  gap: 12px;
}

.case-overview-summary,
.case-overview-notes article {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.case-overview-summary span,
.case-overview-notes span,
.case-overview-highlights span,
.case-overview-facts dt {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.case-overview-summary p,
.case-overview-notes p {
  margin: 6px 0 0;
  color: var(--text);
  line-height: 1.65;
}

.case-overview-highlights {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.case-overview-highlights div {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfb;
}

.case-overview-highlights strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}

.case-overview-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}

.case-overview-facts div {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.case-overview-facts div:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.case-overview-facts div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.case-overview-facts dd {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
}

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

.file-button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.file-button:hover {
  border-color: #a8bac5;
}

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

.file-button.primary-like:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.18);
}

.file-button input {
  display: none;
}

.assistant-home {
  display: grid;
  gap: 18px;
}

.assistant-home .assistant-chat {
  width: min(960px, 100%);
  justify-self: center;
  box-shadow: 0 18px 60px rgba(51, 112, 255, 0.11);
  border-color: #d9e4ff;
}

.assistant-chat {
  display: grid;
  grid-template-rows: auto auto auto;
}

.panel-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.chat-thread {
  padding: 16px 18px;
  display: grid;
  gap: 14px;
  align-content: start;
  overflow: auto;
  max-height: 340px;
  background: linear-gradient(180deg, #fbfcfd 0%, #ffffff 40%);
}

.chat-thread:empty {
  display: none;
}

.chat-message {
  display: grid;
  gap: 6px;
  min-width: 0;
  max-width: 92%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chat-message.user {
  justify-self: end;
}

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

.chat-message.user .message-role {
  text-align: right;
}

.message-content {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chat-thread,
.ai-home-thread,
.ai-session,
.ai-session-card,
.chat-message,
.message-content,
.assistant-message,
.assistant-message *,
.message-content *,
.agent-task-card,
.agent-task-card * {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.chat-message.user .message-content {
  background: #eef4ff;
  border-color: #d8e4ff;
}

.message-content p {
  margin: 0 0 10px;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.chat-message.assistant .message-content {
  line-height: 1.68;
}

.chat-message.assistant .message-content h3,
.chat-message.assistant .message-content h4 {
  margin: 14px 0 7px;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: 0;
}

.chat-message.assistant .message-content h3 {
  font-size: 15px;
}

.chat-message.assistant .message-content h4 {
  font-size: 14px;
}

.chat-message.assistant .message-content p {
  margin: 0 0 10px;
}

.chat-message.assistant .message-content ul,
.chat-message.assistant .message-content ol {
  margin: 6px 0 12px;
  padding-left: 1.2rem;
}

.chat-message.assistant .message-content li {
  margin: 4px 0;
  line-height: 1.62;
}

.chat-message.assistant .message-content blockquote {
  margin: 10px 0;
  padding: 8px 10px;
  border-left: 3px solid #dbeafe;
  color: #475569;
  background: #f8fafc;
  border-radius: 6px;
}

.chat-message.assistant .message-content .source-citation {
  margin-left: 4px;
  transform: translateY(-1px);
}

.chat-message.assistant .message-content .source-citation-list {
  margin-top: 14px;
}

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

.chat-composer textarea {
  min-height: 92px;
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.ai-action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-action-row button {
  min-height: 32px;
  background: #f4f7ff;
  border-color: #dbe5ff;
  color: var(--accent);
}

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

.composer-hint {
  color: var(--muted);
  font-size: 12px;
}

.mini-report {
  white-space: pre-wrap;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: #243241;
}

.ai-status-strip {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid #f3c46b;
  border-radius: 8px;
  background: #fffaf0;
  color: #6f4700;
}

.ai-status-strip strong {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #f4c047;
  color: #172033;
  font-size: 12px;
}

.ai-status-strip span {
  font-size: 13px;
}

.assistant-results {
  display: grid;
  gap: 16px;
}

.assistant-combo-preview {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.assistant-combo-head,
.assistant-combo-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.assistant-combo-head strong {
  color: #12253a;
}

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

.assistant-combo-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #dbe7f2;
  border-radius: 8px;
  background: #fff;
}

.assistant-combo-title strong,
.assistant-combo-title span {
  display: block;
}

.assistant-combo-title em {
  min-width: 54px;
  min-height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #edf4ff;
  color: var(--accent);
  font-style: normal;
  font-weight: 900;
}

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

.assistant-combo-grid span {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: #405261;
  font-size: 12px;
  line-height: 1.45;
}

.assistant-combo-grid b {
  color: #16324f;
}

.seller-page {
  display: grid;
  gap: 16px;
}

.seller-inventory-list {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.seller-inventory-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 188px;
  gap: 10px;
  align-items: center;
  min-height: 104px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.seller-inventory-card:hover {
  border-color: #cfdcec;
  background: #fbfdff;
}

.seller-inventory-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.seller-inventory-title-row,
.seller-inventory-meta,
.seller-inventory-tags {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.seller-inventory-title-row {
  justify-content: space-between;
}

.seller-inventory-title {
  display: flex;
  gap: 8px;
  align-items: baseline;
  min-width: 170px;
}

.seller-inventory-title strong {
  min-width: 0;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  font-size: 15px;
  white-space: nowrap;
}

.seller-inventory-title span,
.seller-inventory-detail span {
  color: var(--muted);
  font-size: 12px;
}

.seller-inventory-tags {
  justify-content: flex-end;
  overflow: hidden;
}

.seller-inventory-tags > span,
.seller-inventory-meta span {
  min-width: 0;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seller-inventory-tags > span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #f4f7fb;
  color: #405261;
  font-size: 12px;
  font-weight: 700;
}

.seller-inventory-tags .tag-row {
  flex: 0 0 auto;
  gap: 4px;
  flex-wrap: nowrap;
}

.seller-inventory-tags .tag {
  white-space: nowrap;
}

.seller-inventory-summary {
  display: -webkit-box;
  min-height: 36px;
  margin: 0;
  overflow: hidden;
  color: #243241;
  font-size: 13px;
  line-height: 1.38;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.seller-inventory-meta {
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--muted);
  font-size: 12px;
}

.seller-inventory-meta span {
  display: inline-flex;
  gap: 4px;
}

.seller-inventory-meta b {
  color: #566475;
}

.seller-inventory-actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 5px;
  align-items: center;
}

.seller-inventory-actions > button,
.seller-action-more > summary {
  min-height: 28px;
  padding: 0 8px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.seller-inventory-actions > button:first-child {
  background: #edf4ff;
  border-color: #cddfff;
  color: var(--accent);
  font-weight: 800;
}

.seller-action-more {
  position: relative;
}

.seller-action-more > summary {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  list-style: none;
}

.seller-action-more > summary::-webkit-details-marker {
  display: none;
}

.seller-action-more > div {
  position: absolute;
  right: 0;
  z-index: 20;
  display: grid;
  gap: 6px;
  min-width: 112px;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.seller-action-more button {
  width: 100%;
}

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

.metric-grid.compact .metric {
  box-shadow: none;
}

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

.brief-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  display: grid;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.brief-card:hover {
  border-color: #b8c9ff;
  box-shadow: 0 10px 30px rgba(51, 112, 255, 0.08);
}

.brief-card.selected {
  border-color: var(--accent);
  background: #f8fbff;
  box-shadow: 0 12px 34px rgba(51, 112, 255, 0.12);
}

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

.brief-head strong {
  font-size: 15px;
}

.card-seller-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 900;
  padding: 0;
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid transparent;
}

.card-seller-link:hover,
.card-seller-link:focus-visible {
  color: var(--accent-strong);
  border-bottom-color: currentColor;
}

.demo-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: #fff6e6;
  color: #9b5c00;
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle;
  white-space: nowrap;
}

.brief-head span {
  color: var(--muted);
  margin-left: 6px;
}

.brief-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brief-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  color: #3d515d;
  font-size: 12px;
}

.brief-card p {
  margin: 0;
}

.rejected-candidates {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.rejected-candidates h4 {
  margin: 0;
  font-size: 13px;
  color: #344552;
}

.rejected-candidate {
  border: 1px solid #efd8d8;
  border-radius: 8px;
  background: #fffafa;
  padding: 11px 12px;
  display: grid;
  gap: 9px;
  cursor: pointer;
}

.candidate-summary {
  display: grid;
  gap: 6px;
  border: 1px solid #dce8f2;
  border-radius: 8px;
  background: #f8fbff;
  padding: 10px 12px;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.candidate-summary.subdued {
  background: #fbfdff;
}

.candidate-judgment-card {
  display: grid;
  gap: 7px;
  border: 1px solid #d4e3ec;
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  background: #fbfdff;
  padding: 10px 12px;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.candidate-judgment-card.weak-only {
  border-left-color: var(--gold);
  background: #fffaf0;
}

.candidate-judgment-card strong {
  color: #132033;
  font-size: 14px;
}

.candidate-judgment-card p {
  margin: 0;
  color: #273845;
  font-size: 13px;
  line-height: 1.55;
}

.candidate-summary strong {
  color: #132033;
  font-size: 14px;
}

.candidate-summary p,
.candidate-summary span {
  margin: 0;
  color: #3d515d;
  font-size: 13px;
  line-height: 1.5;
}

.candidate-result-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(138px, 100%), 1fr));
  gap: 7px;
  border: 1px solid #e3edf5;
  border-radius: 8px;
  background: #fbfdff;
  padding: 8px;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.candidate-result-summary span {
  display: grid;
  gap: 2px;
  border: 1px solid #e8f0f6;
  border-radius: 7px;
  background: #ffffff;
  padding: 7px 8px;
  color: #273845;
  font-size: 12px;
  line-height: 1.35;
  min-width: 0;
}

.candidate-result-summary b {
  color: #708092;
  font-size: 11px;
}

.candidate-compact-section {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.candidate-priority-section {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.candidate-priority-section h4,
.candidate-compact-section h4 {
  margin: 0;
  color: #344552;
  font-size: 13px;
}

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

.candidate-priority-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  cursor: pointer;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.candidate-priority-card:hover,
.candidate-compact-row:hover {
  border-color: var(--line-strong);
  background: var(--panel-hover);
}

.external-candidate-card,
.external-candidate-row {
  cursor: default;
}

.external-candidate-card:hover,
.external-candidate-row:hover {
  transform: none;
}

.external-candidate-summary {
  border-left: 3px solid var(--primary);
}

.candidate-priority-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

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

.candidate-priority-head strong {
  color: #132033;
  font-size: 15px;
}

.candidate-priority-head span:not(.score) {
  color: #66788d;
  font-size: 12px;
}

.candidate-priority-gridline,
.candidate-priority-notes {
  display: grid;
  gap: 6px;
}

.candidate-priority-gridline {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.candidate-priority-gridline span,
.candidate-priority-notes span {
  display: grid;
  gap: 2px;
  color: #3d515d;
  font-size: 12px;
  line-height: 1.45;
}

.candidate-priority-gridline b,
.candidate-priority-notes b {
  color: #66788d;
  font-size: 11px;
}

.candidate-compact-list {
  display: grid;
  gap: 8px;
}

.candidate-compact-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.candidate-compact-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.candidate-compact-main strong {
  color: #132033;
  font-size: 14px;
}

.candidate-compact-main span {
  color: #66788d;
  font-size: 12px;
}

.candidate-compact-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.candidate-compact-grid span {
  display: grid;
  gap: 2px;
  color: #3d515d;
  font-size: 12px;
  line-height: 1.45;
}

.candidate-compact-grid b {
  color: #66788d;
  font-size: 11px;
}

.candidate-tier-details {
  border: 1px solid #e4edf3;
  border-radius: 8px;
  background: #fbfdff;
  padding: 8px 10px;
  margin-top: 10px;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.candidate-judgment-card.weak-only + .candidate-summary,
.candidate-tier-details {
  border-color: #ead4af;
}

.candidate-tier-details > summary {
  cursor: pointer;
  color: #607286;
  font-size: 12px;
  font-weight: 750;
}

.candidate-card-details {
  grid-column: 1 / -1;
  margin-top: 0;
  padding: 6px 8px;
  background: #fcfdff;
}

.candidate-tier-details .candidate-compact-section {
  margin-top: 10px;
}

.candidate-weak-section {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.candidate-weak-list {
  display: grid;
  gap: 7px;
}

.candidate-weak-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  gap: 7px 10px;
  border: 1px solid #ead4af;
  border-radius: 8px;
  background: #fffaf0;
  padding: 9px 10px;
}

.candidate-weak-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.candidate-weak-title strong {
  color: #273845;
  font-size: 13px;
}

.candidate-weak-title span {
  color: #66788d;
  font-size: 12px;
}

.candidate-weak-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.candidate-weak-grid span {
  display: grid;
  gap: 2px;
  color: #3d515d;
  font-size: 12px;
  line-height: 1.45;
}

.candidate-weak-grid b {
  color: #8a6d2f;
  font-size: 11px;
}

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

.rejected-head strong,
.rejected-head span {
  display: block;
}

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

.reject-reasons,
.pass-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 12px;
}

.reject-reasons strong,
.pass-reasons strong {
  color: #344552;
}

.reject-reasons span,
.pass-reasons span {
  border-radius: 999px;
  padding: 3px 8px;
}

.reject-reasons span {
  background: #fff1f1;
  border: 1px solid #f0c7c7;
  color: var(--red);
}

.pass-reasons span {
  background: #f4f8ff;
  border: 1px solid #bdd4ef;
  color: var(--accent-strong);
}

.risk-line {
  color: var(--gold);
}

.hint-line {
  color: var(--accent);
  font-weight: 600;
}

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

.seller-inline-detail {
  display: grid;
  gap: 8px;
  border: 1px solid #d9e6f2;
  border-radius: 8px;
  background: #f8fbff;
  padding: 10px 12px;
}

.seller-inline-detail section {
  display: grid;
  gap: 3px;
}

.seller-inline-detail section span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.seller-inline-detail section p {
  color: var(--text);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.report-preview {
  max-height: calc(100vh - 310px);
  overflow: auto;
}

.selector-grid {
  display: grid;
  gap: 12px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f9fb;
}

.segmented-control button {
  border-color: transparent;
  background: transparent;
  min-height: 34px;
}

.segmented-control button.active {
  border-color: #cbd9f6;
  background: #fff;
  color: var(--accent);
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.match-summary {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfb;
  color: #4e5f69;
  font-size: 13px;
}

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

.match-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.match-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.reason-list {
  margin: 0;
  padding-left: 18px;
  color: #4e5f69;
}

.plan-output {
  background: #f9fbfb;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-height: 360px;
}

.plan-summary {
  display: grid;
  gap: 12px;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid #dbe7f2;
  border-radius: 8px;
  background: #fff;
}

.plan-summary-head,
.plan-summary-next {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.plan-summary-head strong {
  color: #12253a;
  font-size: 16px;
}

.plan-summary-head span,
.plan-summary-next span,
.plan-summary-grid span {
  color: var(--muted);
  font-size: 12px;
}

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

.plan-summary-grid section {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.plan-summary-grid strong {
  color: #16324f;
  font-size: 14px;
}

.plan-summary-grid p,
.plan-summary-next p {
  margin: 0;
  color: #405261;
  font-size: 13px;
  line-height: 1.5;
}

.plan-summary-next {
  padding-top: 2px;
}

.readable-report {
  display: grid;
  gap: 14px;
  color: #24384a;
  line-height: 1.72;
  white-space: normal;
}

.readable-report.report-preview {
  margin-top: 12px;
}

.report-title h3 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.report-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.report-meta span {
  border: 1px solid #d9e7f7;
  border-radius: 999px;
  background: #fff;
  color: #4c647c;
  padding: 4px 9px;
  font-size: 12px;
}

.report-section {
  display: grid;
  gap: 10px;
  padding: 14px 0 2px;
  border-top: 1px solid #dbe7f2;
}

.report-section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.report-section h3 {
  margin: 0;
  color: #12253a;
  font-size: 16px;
}

.report-section p {
  margin: 0;
}

.report-item {
  border: 1px solid #dbe7f2;
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
  display: grid;
  gap: 8px;
}

.report-item.compact-report-group {
  padding: 12px 14px 10px;
  gap: 6px;
}

.report-item.compact-report-group ul {
  margin-top: 0;
  display: grid;
  gap: 4px;
}

.report-item.compact-report-group li {
  margin: 0;
}

.report-item.has-report-gaps {
  border-color: #f3c46b;
  background: #fffaf0;
  padding: 10px 12px;
  gap: 6px;
}

.report-item.has-report-gaps ul {
  gap: 4px;
}

.report-item h4 {
  margin: 0;
  font-size: 14px;
  color: #16324f;
}

.report-seller-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: #16324f;
  font: inherit;
  font-weight: 900;
  padding: 0;
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid transparent;
}

.report-seller-link:hover,
.report-seller-link:focus-visible {
  color: var(--accent-strong);
  border-bottom-color: currentColor;
}

.report-item ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.report-item li {
  padding-left: 2px;
}

.report-line-label {
  font-weight: 700;
  color: #183c68;
}

.report-gap-highlight {
  border: 1px solid #f3c46b;
  border-radius: 5px;
  background: #fff1c7;
  color: #8a5400;
  padding: 0 4px;
}

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

.form-grid label {
  display: grid;
  gap: 5px;
  align-content: start;
  color: var(--muted);
  font-size: 12px;
}

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

dialog {
  border: 0;
  padding: 0;
  border-radius: 8px;
  width: min(1080px, calc(100vw - 24px));
  box-shadow: 0 26px 80px rgba(10, 22, 31, 0.22);
}

dialog::backdrop {
  background: rgba(12, 23, 31, 0.48);
}

.dialog-panel {
  padding: 0;
}

.dialog-head,
.dialog-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.dialog-actions {
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.dialog-head h3 {
  margin: 0;
}

.dialog-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.compact-dialog {
  max-width: 620px;
}

.case-detail-dialog-panel {
  width: min(1080px, calc(100vw - 32px));
  max-height: calc(100vh - 44px);
  overflow: hidden;
}

.material-source-dialog-panel,
.source-dialog-panel {
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100vh - 44px);
  overflow: hidden;
}

.material-source-dialog-body,
.source-dialog-body {
  max-height: calc(100vh - 154px);
  overflow: auto;
}

.source-dialog-body {
  padding: 16px;
}

.case-detail-dialog-body {
  max-height: calc(100vh - 44px);
  overflow: auto;
}

.case-detail-dialog-body .panel-head {
  position: relative;
  top: auto;
  z-index: 1;
  align-items: flex-start;
  min-height: auto;
  padding: 18px 20px;
  background: var(--panel);
}

.case-detail-dialog-body .panel-head > div:first-child {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.case-detail-dialog-body .panel-head h3 {
  font-size: 22px;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
}

.case-detail-dialog-body .panel-head p {
  margin: 0;
  line-height: 1.5;
  white-space: normal;
  word-break: break-word;
}

.case-detail-dialog-body .panel-body {
  padding: 20px;
}

.case-detail-dialog-body .case-detail-body {
  gap: 18px;
}

.case-detail-dialog-body .case-highlight-grid,
.case-detail-dialog-body .case-field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.case-detail-dialog-body .case-highlight-grid div,
.case-detail-dialog-body .case-field-grid div {
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 0;
  padding: 16px;
}

.case-detail-dialog-body .case-highlight-grid span,
.case-detail-dialog-body .case-field-grid span {
  margin: 0;
  line-height: 1.45;
}

.case-detail-dialog-body .case-highlight-grid strong,
.case-detail-dialog-body .case-field-grid p {
  line-height: 1.55;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.case-structure-section {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.case-evidence-section {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.case-evidence-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.case-evidence-row-list {
  grid-template-columns: 1fr;
}

.case-evidence-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.case-evidence-row-list .case-evidence-card {
  grid-template-columns: minmax(120px, 0.22fr) minmax(0, 1fr);
  align-items: start;
}

.case-evidence-card span {
  color: var(--muted);
  font-size: 12px;
}

.case-evidence-card p,
.case-evidence-card a {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.draft-readiness-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.draft-readiness-list article {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.draft-readiness-list article.ok {
  border-color: #b8dcc4;
  background: #f1fbf4;
}

.draft-readiness-list article.warn {
  border-color: #efd08b;
  background: #fff9e9;
}

.draft-readiness-list article.danger {
  border-color: #efb5b5;
  background: #fff1f1;
}

.draft-readiness-list strong {
  color: var(--text);
}

.draft-readiness-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.case-rule-map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.case-rule-map-row-list {
  grid-template-columns: 1fr;
}

.case-rule-map-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.case-rule-map-row-list .case-rule-map-card {
  grid-template-columns: minmax(130px, 0.22fr) minmax(0, 1fr);
  align-items: start;
}

.case-rule-map-card span {
  color: var(--muted);
  font-size: 12px;
}

.case-rule-map-card p {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.case-structure-head,
.case-structure-group-head {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.case-structure-head h4,
.case-structure-group-head strong {
  margin: 0;
  color: var(--text);
}

.case-structure-head span,
.case-structure-group-head span {
  color: var(--muted);
  font-size: 12px;
}

.case-structure-group {
  display: grid;
  gap: 10px;
}

.case-structure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.case-structure-row-list {
  display: grid;
  gap: 10px;
}

.case-structure-row {
  display: grid;
  grid-template-columns: minmax(190px, 0.28fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.case-structure-row-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

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

.case-structure-row-main strong {
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.case-structure-row-main p,
.case-structure-row-fields p {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.case-structure-row-main p {
  color: var(--muted);
}

.case-structure-row-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 14px;
  min-width: 0;
}

.case-structure-row-fields div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.case-structure-row-fields .wide {
  grid-column: 1 / -1;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.case-structure-timeline-group {
  gap: 12px;
}

.case-structure-timeline {
  display: grid;
  gap: 12px;
}

.case-structure-step {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.case-structure-step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 38px;
  bottom: -12px;
  width: 2px;
  background: var(--line);
}

.case-structure-step-index {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid #9bb8ff;
  border-radius: 50%;
  background: #eef4ff;
  color: #1250c4;
  font-size: 13px;
  font-weight: 700;
}

.case-structure-step-body {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.case-structure-step-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
  min-width: 0;
}

.case-structure-step-head div {
  min-width: 0;
}

.case-structure-step-head strong {
  display: block;
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.case-structure-step-head p,
.case-structure-step-target p,
.case-structure-step-details p,
.case-structure-step-source p {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.case-structure-step-head p {
  margin-top: 4px;
  color: var(--muted);
}

.case-structure-step-head > span {
  flex: 0 0 auto;
  max-width: 42%;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
  text-align: right;
}

.case-structure-step-target,
.case-structure-step-source {
  display: grid;
  gap: 4px;
}

.case-structure-step-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.case-structure-step-details div {
  display: grid;
  gap: 4px;
}

.case-structure-step-target span,
.case-structure-step-details span,
.case-structure-step-source span {
  color: var(--muted);
  font-size: 12px;
}

.case-structure-step-source {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.case-structure-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.case-structure-card div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.case-structure-card .wide {
  grid-column: 1 / -1;
}

.case-structure-card span {
  color: var(--muted);
  font-size: 12px;
}

.case-structure-card p {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.case-detail-close {
  flex: 0 0 auto;
}

.source-file-button {
  display: inline;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  text-align: left;
  line-height: 1.55;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  box-shadow: none;
}

.source-file-button:hover {
  background: transparent;
  color: var(--accent-strong);
  text-decoration: underline;
  transform: none;
}

.source-section,
.material-source-body {
  display: grid;
  gap: 12px;
}

.source-section {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.source-section-head,
.material-source-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.source-section-head strong {
  display: block;
  color: var(--text);
}

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

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

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

.source-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.draft-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #c7d8ff;
  border-radius: 8px;
  background: #f6f9ff;
}

.draft-card.rule-draft {
  border-color: #d8d2ff;
  background: #faf8ff;
}

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

.draft-card-head strong,
.draft-card-head span {
  display: block;
}

.draft-card-head span,
.draft-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.draft-status {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e8f0ff;
  color: #2454a6;
  font-size: 12px;
  font-weight: 700;
}

.source-card-actions,
.draft-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.source-card-actions span {
  color: var(--muted);
  font-size: 12px;
}

.source-card-actions .source-action-hint {
  flex-basis: 100%;
  line-height: 1.5;
}

.draft-structure-review {
  display: grid;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.draft-structure-head,
.draft-structure-group-head {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.draft-structure-head strong,
.draft-structure-group-head strong {
  display: block;
  color: var(--text);
}

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

.draft-structure-group-head div {
  display: grid;
  gap: 3px;
}

.draft-structure-group-head span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.draft-structure-group {
  display: grid;
  gap: 10px;
}

.draft-structure-group.is-empty .draft-structure-row {
  border-style: dashed;
  background: #fffdf8;
}

.draft-structure-rows {
  display: grid;
  gap: 10px;
}

.draft-structure-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.draft-structure-row label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.draft-structure-row label.wide {
  grid-column: 1 / -1;
}

.draft-structure-row button {
  justify-self: start;
}

.source-card strong,
.source-card span {
  display: block;
}

.source-card span,
.source-card p,
.source-card a {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
}

.material-source-body {
  padding: 16px;
}

.material-source-summary,
.material-source-text {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.material-source-summary p {
  margin: 0;
  color: var(--muted);
}

.material-source-text pre {
  max-height: 52vh;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  font-size: 13px;
  line-height: 1.6;
}

.knowledge-dialog {
  max-width: 720px;
}

.export-dialog {
  max-width: 680px;
}

.export-dialog-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.export-file-line,
.export-path-line {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid #dde8f5;
  border-radius: 8px;
  background: #f8fbff;
}

.export-file-line strong,
.export-path-line strong {
  color: #66788d;
  font-size: 12px;
}

.export-file-line span,
.export-path-line span {
  color: #132033;
  font-weight: 750;
  word-break: break-all;
}

.export-dialog-actions {
  flex-wrap: wrap;
}

.knowledge-maintenance-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

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

.knowledge-action strong {
  display: block;
  font-size: 15px;
}

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

.dialog-source-options {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 4px;
}

.source-option {
  position: relative;
  display: grid;
  gap: 5px;
  min-height: 82px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.source-option.active {
  border-color: var(--accent);
  background: #eef4ff;
}

.source-option:hover {
  border-color: #8fb0ff;
  background: #f4f7ff;
  box-shadow: 0 10px 24px rgba(51, 112, 255, 0.11);
  transform: translateY(-1px);
}

.source-option.disabled:hover {
  border-color: var(--line);
  background: #fbfcfd;
  box-shadow: none;
  transform: none;
}

.source-option strong {
  color: var(--text);
  font-size: 14px;
}

.source-option span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.upload-option {
  cursor: pointer;
}

.upload-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-option.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.dialog-import-status {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.dialog-import-status.working {
  border-color: #c7d8ff;
  background: #f4f8ff;
  color: #335ba6;
}

.dialog-import-message {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.dialog-import-progress {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.dialog-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(51, 91, 166, 0.22);
  border-top-color: #335ba6;
  border-radius: 50%;
  animation: assistant-spin 0.9s linear infinite;
}

.progress-dots {
  display: inline-flex;
  gap: 3px;
}

.progress-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
  animation: dialog-dot-pulse 1.1s ease-in-out infinite;
}

.progress-dots i:nth-child(2) {
  animation-delay: 0.16s;
}

.progress-dots i:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes dialog-dot-pulse {
  0%,
  80%,
  100% {
    opacity: 0.28;
    transform: translateY(0);
  }

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

@media (prefers-reduced-motion: reduce) {
  .dialog-spinner,
  .progress-dots i,
  .assistant-spinner {
    animation: none;
  }
}

.dialog-import-status.success {
  border-color: #cce3d4;
  background: #f2fbf5;
  color: #27633c;
}

.dialog-import-status.warning {
  border-color: #f1d597;
  background: #fff9ed;
  color: #7b5516;
}

.dialog-import-status.error {
  border-color: #f0c5c5;
  background: #fff6f6;
  color: #9a2f2f;
}

.dialog-import-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dialog-import-detail span {
  max-width: 100%;
  padding: 3px 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-recovery-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.import-recovery-body p {
  margin: 0;
  color: #263642;
  line-height: 1.55;
}

.import-recovery-issues {
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
}

.import-recovery-issues p {
  border: 1px solid #f4d3d3;
  border-radius: 8px;
  background: #fff7f7;
  color: #6f2d2d;
  padding: 8px 10px;
  font-size: 13px;
}

.import-recovery-note {
  border: 1px solid #d9e4ff;
  border-radius: 8px;
  background: #f8fbff;
  padding: 10px 12px;
  font-size: 13px;
}

.import-recovery-actions {
  flex-wrap: wrap;
}

.icon-btn {
  width: 36px;
  padding: 0;
  font-size: 20px;
}

#dialogFields {
  padding: 16px;
  max-height: calc(100vh - 178px);
  overflow: auto;
}

.smart-fill {
  border: 1px solid #d9e4ff;
  border-radius: 8px;
  background: #f8fbff;
  padding: 14px;
  display: grid;
  gap: 10px;
}

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

.smart-fill-head strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

.smart-fill-head span,
.smart-fill-status {
  color: var(--muted);
  font-size: 12px;
}

.smart-fill textarea {
  min-height: 70px;
  background: #fff;
}

.smart-fill button {
  flex: 0 0 auto;
}

.smart-attachment {
  border-top: 1px solid #d9e4ff;
  padding-top: 10px;
  display: grid;
  gap: 8px;
}

.smart-attachment-row {
  display: grid;
  gap: 6px;
}

.smart-attachment-row label {
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
}

.attachment-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.attachment-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.attachment-head strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

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

.attachment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

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

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

.attachment-list.compact {
  gap: 6px;
}

.attachment-list a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #f9fbfb;
}

.attachment-list a span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.attachment-pill {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  border: 1px solid #d9e4ff;
  border-radius: 6px;
  padding: 7px 9px;
  background: #fff;
  color: var(--text);
}

.attachment-pill span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 420px;
  background: #102027;
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Visual polish layer: quiet, high-density financial workspace. */
body {
  background:
    linear-gradient(180deg, #eef3fa 0%, #f7f9fc 260px, #eef3f8 100%);
}

button,
input,
select,
textarea {
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background-color 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}

button {
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.75) inset;
}

button:hover {
  border-color: #b9cfff;
  background: linear-gradient(180deg, #ffffff, #f6f9ff);
  box-shadow: 0 8px 18px rgba(65, 72, 124, 0.08);
}

button:focus-visible,
.nav button:focus-visible {
  border-color: #8db4ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  outline: 0;
}

button:active {
  transform: translateY(1px);
}

button.primary {
  border-color: var(--accent);
  background: linear-gradient(180deg, #3978ff, var(--accent));
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.22);
}

button.primary:hover {
  border-color: var(--accent-strong);
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.28);
}

input,
select,
textarea {
  background: #fbfdff;
  border-color: #d8e4ef;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #8db4ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.11);
  outline: 0;
}

.shell {
  grid-template-columns: 284px minmax(0, 1fr);
}

.sidebar {
  margin: 14px 0 14px 14px;
  border: 1px solid rgba(216, 228, 239, 0.92);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 250, 253, 0.98)),
    #f8fbff;
  box-shadow: 0 20px 50px rgba(28, 51, 84, 0.08);
}

.brand {
  padding: 4px 2px 8px;
}

.brand-mark {
  border-radius: 16px;
  background: #f5f1ff;
  box-shadow: 0 14px 32px rgba(124, 103, 216, 0.16);
}

.brand h1 {
  color: #101b2d;
  font-size: 18px;
  font-weight: 850;
}

.brand p {
  color: #66788d;
}

.sidebar-toggle {
  border-color: #d7e4f0;
  background: #fff;
}

.nav {
  gap: 8px;
}

.nav button {
  border-radius: 8px;
  min-height: 42px;
  padding: 0 11px;
  font-weight: 700;
}

.nav button.active {
  background: linear-gradient(90deg, #eaf2ff, #f6f9ff);
  border-color: #c9dcff;
  color: #174bbd;
  box-shadow: inset 3px 0 0 var(--edge-accent), 0 10px 24px rgba(37, 99, 235, 0.1);
}

.nav button:hover {
  background: #f3f7ff;
  border-color: #d8e6ff;
  box-shadow: none;
}

.nav-icon {
  background: #edf4ff;
  color: var(--accent);
}

.nav button.active .nav-icon {
  background: #ffffff;
  color: #174bbd;
  box-shadow: 0 8px 18px rgba(47, 109, 246, 0.12);
}

.nav button:nth-child(2) .nav-icon {
  background: #fff6e6;
  color: var(--gold);
}

.nav button:nth-child(3) .nav-icon {
  background: #f4f1ff;
  color: var(--violet);
}

.nav button:nth-child(4) .nav-icon {
  background: #f4f8ff;
  color: var(--accent-strong);
}

.nav button:nth-child(5) .nav-icon {
  background: #fff0f0;
  color: var(--coral);
}

.nav button:nth-child(6) .nav-icon {
  background: #f4f1ff;
  color: var(--violet);
}

.nav button:nth-child(7) .nav-icon {
  background: #fff7ea;
  color: #a46716;
}

.nav button:nth-child(8) .nav-icon {
  background: #fff7ea;
  color: #a46716;
}

.shell.sidebar-collapsed .sidebar {
  margin: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.main {
  padding: 24px 28px 132px;
}

.topbar {
  margin-bottom: 18px;
  border: 1px solid rgba(216, 228, 239, 0.9);
  border-radius: 8px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
}

.eyebrow {
  color: #6f8198;
  font-weight: 800;
  letter-spacing: 0;
}

.topbar h2 {
  color: #101b2d;
  font-size: 30px;
  font-weight: 900;
}

.top-actions > input {
  min-height: 40px;
}

.floating-search {
  position: fixed;
  right: 24px;
  top: 24px;
  z-index: 40;
  width: 48px;
  height: 48px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.floating-search.is-visible {
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0);
}

.floating-search-toggle {
  position: relative;
  z-index: 2;
  width: 48px;
  height: 48px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid #cfe0f4;
  background: #ffffff;
  color: #29435f;
  box-shadow: 0 14px 34px rgba(28, 51, 84, 0.18);
}

.floating-search-toggle svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}

.floating-search-toggle:hover {
  border-color: #9fbdf4;
  color: #1f54c9;
  transform: translateY(-1px);
}

.floating-search-panel {
  position: absolute;
  right: 58px;
  top: 0;
  width: min(520px, calc(100vw - 104px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px 36px;
  gap: 4px;
  align-items: center;
  padding: 5px;
  border: 1px solid #cfe0f4;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 42px rgba(28, 51, 84, 0.16);
  opacity: 0;
  transform: translateX(8px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.floating-search.is-open .floating-search-panel {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
}

.floating-search-panel input {
  min-width: 0;
  min-height: 38px;
  border: 0;
  background: #f7faff;
}

#floatingSearchSubmit {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

#floatingSearchSubmit:hover,
#floatingSearchSubmit:focus-visible {
  background: var(--control-hover);
  color: var(--text);
  box-shadow: none;
}

.floating-search-close {
  width: 38px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.metric-grid {
  gap: 14px;
}

.metric {
  position: relative;
  overflow: hidden;
  border-color: #d9e6f2;
  background:
    linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: var(--shadow-soft);
}

.metric::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--coral);
}

.metric:nth-child(2)::before {
  background: var(--gold);
}

.metric:nth-child(3)::before {
  background: var(--violet);
}

.metric:nth-child(4)::before {
  background: var(--blue);
}

.metric:nth-child(2) {
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.metric:nth-child(3) {
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.metric:nth-child(4) {
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.metric span {
  color: #66788d;
  font-weight: 700;
}

.metric strong {
  color: #101b2d;
  font-weight: 900;
  letter-spacing: 0;
}

.panel,
.project-kpi,
.project-focus-panel,
.brief-card,
.rule-card,
.material-card,
.case-list-item,
.rejected-candidate {
  border-color: #d9e6f2;
  box-shadow: var(--shadow-soft);
}

.panel {
  background: rgba(255, 255, 255, 0.96);
}

.panel-head {
  min-height: 64px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.panel-head h3 {
  color: #101b2d;
  font-size: 17px;
  font-weight: 850;
}

.panel-body {
  background: #fff;
}

.assistant-home {
  grid-template-columns: minmax(440px, 1.04fr) minmax(360px, 0.96fr);
  align-items: start;
}

.assistant-home .assistant-chat {
  width: 100%;
  justify-self: stretch;
}

.assistant-chat {
  overflow: hidden;
}

.assistant-chat .panel-head {
  border-bottom-color: #cfe0ff;
  background:
    linear-gradient(90deg, #eaf2ff 0%, #f7fbff 58%, #fffaf2 100%);
  box-shadow: inset 3px 0 0 var(--edge-accent);
}

.assistant-chat .panel-head h3 {
  font-size: 20px;
}

.chat-thread {
  max-height: 420px;
  background:
    linear-gradient(180deg, #f8fbff 0%, #ffffff 42%);
}

.message-content {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
  border-color: #d9e6f2;
  box-shadow: 0 8px 18px rgba(28, 51, 84, 0.04);
}

.chat-message.user .message-content {
  background: #edf4ff;
  border-color: #cfe0ff;
}

.chat-message.assistant.pending .message-content {
  border-color: #bfd3ff;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

.assistant-progress {
  display: grid;
  min-width: 0;
  max-width: 100%;
  gap: 6px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.assistant-progress-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.assistant-progress-row strong {
  font-size: 0.96rem;
}

.assistant-progress p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.55;
}

.chat-composer {
  background: #fbfdff;
}

.chat-composer textarea {
  min-height: 112px;
  border-color: #cfe0ff;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(16, 27, 45, 0.02);
}

.ai-action-row button {
  background: #f6f9ff;
  border-color: #d6e6ff;
  color: #174bbd;
  font-weight: 800;
}

.composer-actions button {
  font-weight: 800;
}

.assistant-results {
  gap: 14px;
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th {
  background: #f3f7fb;
  color: #5a6d82;
  font-weight: 850;
}

td {
  background: #fff;
}

tr:hover td {
  background: #f8fbff;
}

.tag {
  background: #f8f6ff;
  border-color: #ded6ff;
  font-weight: 700;
}

.score {
  border-radius: 8px;
  background: #174bbd;
  box-shadow: 0 10px 20px rgba(23, 75, 189, 0.2);
}

.score.mid {
  color: #172033;
  background: #f4c047;
  box-shadow: 0 10px 20px rgba(164, 103, 22, 0.18);
}

.score.low {
  background: #b3343c;
  box-shadow: 0 10px 20px rgba(179, 52, 60, 0.18);
}

.brief-card:hover,
.case-list-item:hover,
.rule-card:hover,
.material-card:hover {
  border-color: #b9d0f5;
  box-shadow: 0 14px 34px rgba(28, 51, 84, 0.1);
}

.brief-grid {
  border: 1px solid #e2ecf5;
  border-radius: 8px;
  padding: 8px 10px;
  background: #f8fbff;
}

.project-cockpit {
  gap: 16px;
}

.project-kpi {
  background:
    linear-gradient(180deg, #ffffff, #f8fbff);
}

.project-kpi strong {
  font-weight: 900;
}

.project-focus-panel {
  background: #fff;
}

.project-focus-item {
  border-top-color: #e5eef7;
}

.case-index,
.case-detail {
  min-height: calc(100vh - 196px);
}

.case-index {
  top: 110px;
}

.case-list {
  background: #fbfdff;
}

.rule-library-entry,
.case-narrative section {
  background: #f8fbff;
  border-color: #d9e8ff;
}

.rule-library-entry-icon {
  background: #dfeaff;
}

.mini-report,
.plan-output {
  border-color: #dbe7f2;
  background: #f8fbff;
}

.toast {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #101b2d;
  box-shadow: 0 18px 42px rgba(16, 27, 45, 0.24);
}

.shell.ai-home-mode {
  display: block;
  min-height: 100vh;
}

.shell.ai-home-mode .topbar {
  display: none;
}

.shell.ai-home-mode::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(15, 23, 42, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.shell.ai-home-mode.home-sidebar-open::before {
  opacity: 1;
  pointer-events: auto;
}

.shell.ai-home-mode .sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  width: min(320px, calc(100vw - 34px));
  margin: 0;
  border: 0;
  border-right: 1px solid rgba(216, 228, 239, 0.92);
  border-radius: 0;
  padding: 22px 18px;
  background: rgba(239, 244, 250, 0.98);
  box-shadow: 26px 0 54px rgba(28, 51, 84, 0.16);
  transform: translateX(-104%);
  transition: transform 0.2s ease;
}

.shell.ai-home-mode.home-sidebar-open .sidebar {
  transform: translateX(0);
}

.shell.ai-home-mode.sidebar-collapsed .brand-mark {
  display: grid;
}

.shell.ai-home-mode.sidebar-collapsed .brand > div:not(.brand-mark) {
  display: block;
}

.shell.ai-home-mode.sidebar-collapsed .nav {
  display: grid;
}

.shell.ai-home-mode.sidebar-collapsed .nav button {
  display: flex;
}

.shell.ai-home-mode.sidebar-collapsed .sidebar-toggle {
  position: static;
  width: 34px;
  min-height: 34px;
  margin-left: auto;
  background: #fff;
  border-color: #d7e4f0;
  box-shadow: none;
}

.shell.ai-home-mode .main {
  min-height: 100vh;
  padding: 0;
  background:
    linear-gradient(180deg, #eef3fa 0%, #f8fafc 280px, #eef3f8 100%);
}

.ai-home {
  min-height: 100vh;
  max-width: 1220px;
  margin: 0 auto;
  padding: 24px clamp(20px, 4vw, 48px) 72px;
}

.ai-home.has-chat {
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  overflow: hidden;
  padding-bottom: 20px;
}

.ai-home-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 58px;
}

.ai-home-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-menu-button {
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: transparent;
  color: #34465c;
  box-shadow: none;
}

.ai-menu-button:hover,
.ai-menu-button:focus-visible {
  background: rgba(255, 255, 255, 0.78);
  color: #174bbd;
}

.ai-menu-button svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  fill: none;
}

.ai-home-brand .brand-mark {
  width: 48px;
  height: 48px;
}

.ai-home-brand h1,
.ai-home-brand p,
.ai-hero h2,
.ai-hero p {
  margin: 0;
}

.ai-home-brand h1 {
  color: #101b2d;
  font-size: 18px;
  font-weight: 900;
}

.ai-home-brand p {
  color: #66788d;
  font-size: 12px;
}

.ai-home-top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.ai-new-chat-button {
  min-height: 38px;
  border: 1px solid #d8e3ef;
  border-radius: 999px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.86);
  color: #34465c;
  font-size: 14px;
  font-weight: 750;
  box-shadow: 0 8px 22px rgba(28, 51, 84, 0.08);
}

.ai-new-chat-button:hover,
.ai-new-chat-button:focus-visible {
  border-color: #b9cae0;
  background: #fff;
  color: #101b2d;
  transform: translateY(-1px);
}

.assistant-home-main {
  min-height: 0;
  display: grid;
  justify-items: center;
  align-items: start;
}

.ai-home.has-chat .assistant-home-main {
  align-items: stretch;
  height: 100%;
}

.ai-sync-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #d9e6f2;
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.76);
  color: #66788d;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(65, 72, 124, 0.06);
}

.ai-sync-pill.is-syncing {
  color: #1d4ed8;
  border-color: #bcd5ff;
  background: rgba(239, 246, 255, 0.92);
}

.ai-sync-pill.is-failed {
  max-width: min(760px, 100%);
  color: #b42318;
  border-color: #ffd0c8;
  background: rgba(255, 245, 242, 0.96);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-hero {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: clamp(44px, 8vh, 88px) 0 30px;
  text-align: center;
}

.ai-home-eyebrow {
  color: #174bbd;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.ai-hero h2 {
  color: #101b2d;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.08;
  font-weight: 950;
}

.ai-hero-copy {
  max-width: 720px;
  color: #66788d;
  font-size: 15px;
}

.ai-session {
  display: grid;
  justify-items: center;
  gap: 18px;
  min-height: 0;
  width: min(1120px, 100%);
}

.ai-session.is-idle {
  padding: clamp(88px, 16vh, 180px) 0 30px;
  text-align: center;
}

.ai-session.is-active {
  align-self: stretch;
  height: 100%;
  padding: 0;
}

.ai-session-intro {
  display: grid;
  justify-items: center;
  gap: 10px;
  max-width: 820px;
  text-align: center;
}

.ai-session-intro h2,
.ai-session-intro p {
  margin: 0;
}

.ai-session-intro h2 {
  color: #101b2d;
  font-size: clamp(36px, 5vw, 58px);
  line-height: 1.16;
  font-weight: 780;
}

.ai-session-card {
  width: min(980px, 100%);
  position: relative;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.ai-session.is-active .ai-session-card {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ai-session-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid #eef3f8;
  padding: 14px 18px;
  background: linear-gradient(90deg, #f8fbff 0%, #ffffff 58%, #f7fbff 100%);
  box-shadow: inset 3px 0 0 var(--edge-accent);
}

.ai-session-toolbar > div:first-child {
  display: grid;
  gap: 2px;
}

.ai-session-toolbar strong {
  color: #101b2d;
  font-size: 15px;
  font-weight: 900;
}

.ai-session-toolbar span {
  color: #66788d;
  font-size: 12px;
  font-weight: 700;
}

.ai-command-card {
  width: min(980px, 100%);
  margin-top: 12px;
  border: 1px solid #d8e3ef;
  border-radius: 28px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 22px 56px rgba(28, 51, 84, 0.12);
}

.ai-command-card textarea {
  min-height: 126px;
  border: 0;
  padding: 12px 12px 8px;
  background: transparent;
  color: #101b2d;
  font-size: 16px;
  line-height: 1.65;
  resize: vertical;
}

.ai-session-card .ai-command-card {
  width: 100%;
  margin: 0;
  border: 1px solid #d8e3ef;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 36px rgba(28, 51, 84, 0.1);
}

.ai-session.is-active .ai-session-composer {
  flex: 0 0 auto;
}

.ai-session.is-active .ai-command-card textarea {
  min-height: 88px;
  max-height: 190px;
}

.ai-session.is-idle .ai-command-card textarea {
  min-height: 160px;
}

.ai-command-card textarea:focus {
  box-shadow: none;
}

.ai-command-footer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid #eef3f8;
}

.ai-add-button {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  border-radius: 50%;
  padding: 0;
  display: inline-grid;
  place-items: center;
  color: #4f6478;
  background: #fff;
}

.ai-add-button svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2.8;
  stroke-linecap: round;
  fill: none;
}

.ai-upload-control {
  position: relative;
  display: inline-grid;
  place-items: center;
}

.ai-upload-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 20;
  min-width: 128px;
  padding: 6px;
  border: 1px solid rgba(203, 214, 228, 0.92);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 42px rgba(15, 31, 51, 0.18);
  display: none;
}

.ai-upload-control.is-open .ai-upload-menu {
  display: grid;
}

.ai-upload-menu button {
  min-height: 34px;
  justify-content: flex-start;
  border: 0;
  background: transparent;
  color: #132033;
  font-size: 14px;
  font-weight: 750;
  box-shadow: none;
}

.ai-upload-menu button:hover {
  background: #f2f6fb;
}

.ai-send-button {
  grid-column: 3;
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  border-radius: 50%;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 0;
  background: #d9dee6;
  color: #ffffff;
  box-shadow: none;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.ai-prompt-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.ai-prompt-row button {
  min-height: 32px;
  border-color: #dce8f6;
  border-radius: 999px;
  background: #f8fbff;
  color: #34465c;
  font-size: 13px;
  font-weight: 750;
}

.ai-prompt-row button:hover,
.ai-prompt-row button:focus-visible {
  border-color: #9fbcff;
  background: #edf4ff;
  color: #174bbd;
}

.ai-trust-line {
  margin: 10px 4px 0;
  color: #7a8797;
  font-size: 12px;
  text-align: center;
}

.ai-send-button svg {
  width: 21px;
  height: 21px;
  stroke: currentColor;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.ai-send-button svg rect {
  fill: currentColor;
  stroke: none;
}

.ai-send-button.is-ready {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.24);
}

.ai-send-button.is-ready:hover {
  background: #174bbd;
  transform: translateY(-1px);
}

.ai-send-button.is-empty,
.ai-send-button:disabled {
  cursor: default;
  opacity: 1;
}

.ai-send-button.is-empty:hover,
.ai-send-button.is-empty:disabled:hover {
  background: #c7ced8;
  color: #ffffff;
  border-color: rgba(102, 120, 141, 0.18);
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 8px 18px rgba(31, 45, 61, 0.12);
}

.ai-send-button.is-busy {
  background: #111827;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.08);
}

.chat-scroll-latest {
  position: absolute;
  right: 18px;
  bottom: 104px;
  z-index: 4;
  min-height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border-color: rgba(203, 213, 225, 0.88);
  background: rgba(255, 255, 255, 0.94);
  color: #475569;
  font-size: 12px;
  font-weight: 750;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.chat-scroll-latest:hover,
.chat-scroll-latest:focus-visible {
  border-color: #94a3b8;
  background: #f8fafc;
  color: #0f172a;
}

.chat-scroll-latest.is-hidden {
  display: none;
}

.ai-send-button.is-busy:hover,
.ai-send-button.is-busy:disabled:hover {
  background: #111827;
  color: #fff;
  border-color: transparent;
  transform: none;
}

.ai-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  width: min(920px, 100%);
  margin: 4px auto 22px;
}

.ai-session.is-active + .ai-status-grid {
  display: none;
}

.ai-status-card .metric {
  height: 100%;
  margin: 0;
  box-shadow: 0 10px 24px rgba(65, 72, 124, 0.07);
}

.ai-status-card:nth-child(1) .metric::before {
  background: var(--coral);
}

.ai-status-card:nth-child(2) .metric::before {
  background: var(--gold);
}

.ai-status-card:nth-child(3) .metric::before {
  background: var(--violet);
}

.ai-status-card:nth-child(4) .metric::before {
  background: var(--blue);
}

.ai-conversation {
  width: min(920px, 100%);
  margin: 0 auto;
}

.ai-conversation:not(.has-activity) {
  display: none;
}

.ai-dialog-panel .toolbar {
  justify-content: flex-end;
}

.ai-home-thread {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 22px;
  scroll-behavior: auto;
}

.ai-empty-dialog {
  display: grid;
  min-height: 196px;
  place-items: center;
  border: 1px dashed #c9dcff;
  border-radius: 8px;
  background: #f8fbff;
  color: #66788d;
  font-weight: 700;
  text-align: center;
}

.ai-home-thread .chat-message {
  min-width: 0;
  max-width: 100%;
  scroll-margin-top: 18px;
}

.chat-history-gate {
  justify-self: center;
  border: 1px solid #d6e3f2;
  border-radius: 999px;
  background: #f8fbff;
  color: #435a73;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 14px;
}

.chat-history-gate:hover {
  border-color: #9fb9d8;
  background: #eef6ff;
}

.ai-home-thread .chat-message.user {
  max-width: min(760px, 88%);
  justify-self: end;
}

.ai-home-thread .message-content {
  padding: 16px 18px;
}

.ai-home-thread .report-preview {
  max-height: none;
  overflow: visible;
}

.agent-task-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.agent-task-card p {
  margin: 0;
}

.message-content > .agent-task-card {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

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

.agent-field-grid span {
  display: grid;
  gap: 4px;
  border: 1px solid #dce8f2;
  border-radius: 8px;
  padding: 9px 10px;
  background: #f8fbff;
}

.agent-field-grid strong {
  color: #66788d;
  font-size: 12px;
}

.agent-field-grid em {
  color: #132033;
  font-style: normal;
  font-weight: 750;
}

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

.evidence-answer {
  gap: 14px;
}

.enhanced-analysis-card {
  gap: 10px;
}

.answer-composer-card {
  gap: 12px;
}

.advisor-answer-card {
  border-color: #cfe0ee;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(41, 64, 92, 0.08);
  overflow: hidden;
}

.advisor-answer-head {
  display: grid;
  gap: 7px;
}

.advisor-answer-head span {
  width: max-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid #d8e6f1;
  border-radius: 999px;
  padding: 0 9px;
  background: #f7fbff;
  color: #3f5f79;
  font-size: 12px;
  font-weight: 800;
}

.advisor-answer-head strong {
  color: #132033;
  font-size: 16px;
  line-height: 1.45;
}

.advisor-reason-list {
  display: grid;
  gap: 7px;
}

.advisor-reason-list span {
  position: relative;
  color: #273845;
  font-size: 13px;
  line-height: 1.55;
  padding-left: 15px;
}

.advisor-reason-list span::before {
  content: "";
  position: absolute;
  top: 0.72em;
  left: 2px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #2f6df6;
}

.advisor-next-action {
  display: grid;
  gap: 4px;
  border-left: 3px solid #2f6df6;
  padding: 8px 0 8px 11px;
  background: linear-gradient(90deg, rgba(237, 244, 255, 0.82), rgba(255, 255, 255, 0));
}

.advisor-next-action strong {
  color: #35566f;
  font-size: 12px;
}

.advisor-next-action p {
  margin: 0;
  color: #1d3042;
  font-size: 13px;
  line-height: 1.55;
}

.dense-answer-card {
  gap: 12px;
  color: #1d3042;
}

.dense-answer-head {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.dense-answer-eyebrow {
  width: max-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid #d8e6f1;
  border-radius: 999px;
  padding: 0 9px;
  background: #f7fbff;
  color: #3f5f79;
  font-size: 12px;
  font-weight: 800;
}

.dense-answer-title {
  color: #132033;
  font-size: 16px;
  line-height: 1.45;
}

.dense-answer-conclusion {
  display: grid;
  gap: 4px;
  border-left: 3px solid #2f6df6;
  padding: 8px 0 8px 11px;
  background: linear-gradient(90deg, rgba(237, 244, 255, 0.78), rgba(255, 255, 255, 0));
}

.dense-answer-conclusion b,
.dense-answer-boundary h4,
.dense-answer-section-title {
  margin: 0;
  color: #35566f;
  font-size: 12px;
  font-weight: 800;
}

.dense-answer-conclusion span {
  color: #1d3042;
  font-size: 13px;
  line-height: 1.6;
}

.dense-answer-summary,
.dense-answer-list,
.dense-answer-source-paths,
.dense-answer-notes {
  display: grid;
  gap: 6px;
}

.dense-answer-summary span,
.dense-answer-list span,
.dense-answer-source-paths span,
.dense-answer-notes span,
.dense-answer-section-summary {
  color: #2b3e50;
  font-size: 13px;
  line-height: 1.55;
}

.dense-answer-summary span,
.dense-answer-list span {
  position: relative;
  padding-left: 14px;
}

.dense-answer-summary span::before,
.dense-answer-list span::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.72em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #6d8aa3;
}

.dense-answer-section {
  display: grid;
  gap: 8px;
  min-width: 0;
  border-top: 1px solid #e1ebf4;
  padding-top: 11px;
}

.dense-answer-table {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.dense-answer-row {
  min-width: 0;
  display: grid;
  gap: 4px;
  border: 1px solid #dce8f2;
  border-radius: 8px;
  padding: 8px 9px;
  background: #f8fbff;
}

.dense-answer-label {
  color: #66788d;
  font-size: 12px;
  font-weight: 800;
}

.dense-answer-value {
  color: #132033;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.dense-answer-status {
  width: max-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border-radius: 999px;
  padding: 0 7px;
  background: #eef6ff;
  color: #3f5f79;
  font-size: 11px;
  font-weight: 800;
}

.dense-answer-row small {
  color: #6a7c8f;
  font-size: 12px;
  line-height: 1.45;
}

.dense-answer-source-paths,
.dense-answer-notes {
  border-left: 3px solid #d4e3ec;
  padding-left: 10px;
}

.dense-answer-source-paths strong {
  color: #4e6478;
  font-size: 12px;
}

.dense-answer-boundary {
  display: grid;
  gap: 7px;
  border-top: 1px solid #e7e7e7;
  padding-top: 11px;
  background: transparent;
}

.dense-answer-next-actions {
  padding-top: 2px;
}

.dense-answer-card.seller-public-info-check {
  gap: 10px;
}

.dense-answer-card.seller-public-info-check .dense-answer-section {
  gap: 7px;
  padding-top: 9px;
}

.dense-answer-card.seller-public-info-check .dense-answer-summary,
.dense-answer-card.seller-public-info-check .dense-answer-list {
  gap: 5px;
}

.dense-answer-card.seller-public-info-check .seller-public-info-key-judgments {
  border-top-color: #d5e5f1;
}

.dense-answer-card.seller-public-info-check .seller-public-info-key-judgments .dense-answer-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.seller-public-info-compact-table {
  min-width: 0;
  display: grid;
  overflow: hidden;
  border: 1px solid #dce8f2;
  border-radius: 8px;
  background: #ffffff;
}

.seller-public-info-compact-row {
  display: grid;
  grid-template-columns: minmax(104px, 0.85fr) minmax(0, 1.2fr) minmax(0, 1fr);
  min-width: 0;
  border-top: 1px solid #e7eef5;
}

.seller-public-info-compact-row:first-child {
  border-top: 0;
}

.seller-public-info-compact-row.header {
  background: #f3f8fc;
}

.seller-public-info-compact-row span {
  min-width: 0;
  padding: 7px 8px;
  border-left: 1px solid #e7eef5;
  color: #21364a;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.seller-public-info-compact-row span:first-child {
  border-left: 0;
  color: #50677d;
  font-weight: 800;
}

.seller-public-info-compact-row.header span {
  color: #3f5f79;
  font-size: 11px;
  font-weight: 850;
}

.dense-answer-card.seller-public-info-check .dense-answer-boundary {
  border-top-color: #d5e5f1;
}

.seller-lead-card {
  gap: 12px;
}

.seller-lead-head {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.seller-lead-head span {
  width: max-content;
  max-width: 100%;
  border: 1px solid #d8e6f1;
  border-radius: 999px;
  padding: 3px 9px;
  background: #f7fbff;
  color: #3f5f79;
  font-size: 12px;
  font-weight: 800;
}

.seller-lead-head strong {
  color: #132033;
  font-size: 16px;
  line-height: 1.45;
}

.seller-lead-head p {
  color: #314557;
  font-size: 13px;
  line-height: 1.55;
}

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

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

.seller-lead-grid span {
  min-width: 0;
  display: grid;
  gap: 4px;
  border: 1px solid #dce8f2;
  border-radius: 8px;
  padding: 8px 9px;
  background: #f8fbff;
}

.seller-lead-grid b,
.seller-lead-section strong {
  color: #66788d;
  font-size: 12px;
}

.seller-lead-grid em {
  min-width: 0;
  color: #132033;
  font-style: normal;
  font-size: 13px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.seller-lead-section {
  display: grid;
  gap: 6px;
  border: 1px solid #e1ebf4;
  border-radius: 8px;
  padding: 10px;
  background: #fbfdff;
}

.seller-lead-section span,
.seller-lead-section p {
  color: #2b3e50;
  font-size: 13px;
  line-height: 1.55;
}

.seller-lead-checklist {
  display: grid;
  gap: 8px;
}

.seller-lead-checklist section {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid #e1ebf4;
  border-radius: 8px;
  padding: 9px;
  background: #fff;
}

.seller-lead-checklist b {
  color: #1d3042;
  font-size: 13px;
}

.seller-lead-section.subdued {
  background: #fafafa;
  border-color: #e7e7e7;
}

.seller-lead-enrichment-card .seller-lead-head span {
  background: #f6fbf8;
  border-color: #d7eadf;
  color: #2e6b4c;
}

.answer-composer-head {
  display: grid;
  gap: 5px;
}

.answer-composer-head strong {
  color: #132033;
  font-size: 15px;
  line-height: 1.45;
}

.answer-composer-head span {
  color: #66788d;
  font-size: 12px;
  font-weight: 750;
}

.answer-composer-body {
  display: grid;
  gap: 8px;
}

.answer-composer-section {
  display: grid;
  gap: 3px;
  border-left: 3px solid #d4e3ec;
  padding-left: 10px;
}

.answer-composer-section strong {
  color: #4e6478;
  font-size: 12px;
}

.answer-composer-section p {
  color: #273845;
  font-size: 13px;
  line-height: 1.55;
}

.transaction-options-card {
  gap: 12px;
}

.transaction-options-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.transaction-options-head strong,
.transaction-option-head strong {
  color: #132033;
  font-size: 14px;
}

.transaction-options-head span {
  color: #66788d;
  font-size: 12px;
  font-weight: 750;
}

.transaction-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 10px;
  min-width: 0;
}

.transaction-comparison {
  border: 1px solid #dce8f2;
  border-radius: 8px;
  background: #fbfdff;
  padding: 11px;
}

.transaction-comparison {
  display: grid;
  gap: 9px;
}

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

.transaction-comparison-title strong {
  color: #132033;
  font-size: 14px;
}

.transaction-comparison-title span {
  color: #66788d;
  font-size: 12px;
  font-weight: 750;
}

.transaction-comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 8px;
  min-width: 0;
}

.transaction-comparison-grid article {
  display: grid;
  gap: 6px;
  border: 1px solid #e2edf5;
  border-radius: 8px;
  background: #ffffff;
  padding: 9px;
  min-width: 0;
}

.transaction-comparison-grid article > strong {
  color: #273845;
  font-size: 13px;
}

.transaction-comparison-grid article > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.transaction-comparison-grid span {
  display: grid;
  gap: 2px;
  color: #273845;
  font-size: 12px;
  line-height: 1.35;
}

.transaction-comparison-grid b {
  color: #66788d;
  font-size: 11px;
}

.transaction-comparison-grid p {
  color: #66788d;
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
}

.transaction-brief-grid {
  display: grid;
  gap: 9px;
}

.transaction-brief-section {
  display: grid;
  gap: 4px;
  border-left: 3px solid #d4e3ec;
  padding-left: 10px;
}

.transaction-brief-section strong {
  color: #4e6478;
  font-size: 12px;
}

.transaction-brief-section p {
  color: #273845;
  font-size: 13px;
  line-height: 1.55;
}

.transaction-option-card {
  display: grid;
  gap: 7px;
  border: 1px solid #dce8f2;
  border-radius: 8px;
  padding: 10px;
  background: #fbfdff;
  min-width: 0;
  max-width: 100%;
}

.transaction-option-card p {
  color: #273845;
  font-size: 13px;
  line-height: 1.55;
}

.transaction-option-section {
  display: grid;
  gap: 5px;
  border-left: 3px solid #d4e3ec;
  padding-left: 9px;
}

.transaction-option-section strong,
.transaction-option-detail-body section > strong {
  color: #66788d;
  font-size: 12px;
}

.transaction-option-section span {
  color: #273845;
  font-size: 13px;
  line-height: 1.45;
}

.transaction-basis-details {
  border: 1px solid #e4edf3;
  border-radius: 8px;
  background: #fbfdff;
  padding: 7px 10px;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.transaction-options-fold[open] {
  overflow-x: auto;
}

.transaction-options-detail-card {
  min-width: 0;
}

.transaction-basis-details > summary {
  cursor: pointer;
  color: #607286;
  font-size: 12px;
  font-weight: 750;
}

.transaction-option-detail-body {
  display: grid;
  gap: 8px;
  padding-top: 9px;
}

.transaction-option-detail-body section {
  display: grid;
  gap: 6px;
}

.transaction-risk-list {
  display: grid;
  gap: 8px;
}

.transaction-risk-list section {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.transaction-risk-list strong {
  color: #273845;
  font-size: 13px;
}

.transaction-risk-list p {
  color: #66788d;
  font-size: 12px;
  line-height: 1.45;
  margin: 4px 0 0;
}

.transaction-risk-level {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 22px;
  border-radius: 6px;
  background: #edf4ff;
  color: #174bbd;
  font-size: 12px;
  font-weight: 800;
}

.transaction-risk-level.p0 {
  background: #fff1f2;
  color: #bd3a47;
}

.transaction-risk-level.p1 {
  background: #fff7ea;
  color: #9a5b0e;
}

.transaction-risk-level.p2 {
  background: #edf7f3;
  color: #24735a;
}

.enhanced-analysis-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.answer-mode-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid #d4e3ec;
  border-radius: 999px;
  padding: 0 8px;
  background: #f7fafb;
  color: #3d515d;
  font-size: 12px;
  font-weight: 750;
}

.enhanced-analysis-answer {
  display: grid;
  gap: 5px;
  border-left: 3px solid var(--primary);
  padding: 7px 0 7px 12px;
  color: var(--text);
  line-height: 1.55;
  max-height: 10.5em;
  overflow: hidden;
}

.enhanced-analysis-answer p {
  margin: 0;
}

.enhanced-action-list {
  margin-top: 2px;
}

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

.enhanced-signal-list {
  display: grid;
  gap: 6px;
  border: 1px solid #dce8f2;
  border-radius: 8px;
  padding: 9px 10px;
  background: #f8fbff;
}

.enhanced-signal-list strong {
  color: #66788d;
  font-size: 12px;
}

.enhanced-signal-list span {
  color: #273845;
  font-size: 13px;
  line-height: 1.45;
}

.enhanced-analysis-details {
  border: 1px solid #e4edf3;
  border-radius: 8px;
  background: #fbfdff;
  padding: 7px 10px;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.lazy-details-placeholder {
  color: #71829a;
  font-size: 13px;
  padding-top: 9px;
}

.enhanced-analysis-details > summary {
  cursor: pointer;
  color: #607286;
  font-size: 12px;
  font-weight: 750;
}

.enhanced-analysis-detail-body {
  display: grid;
  gap: 8px;
  padding-top: 9px;
}

.enhanced-analysis-detail-body section {
  display: grid;
  gap: 6px;
}

.enhanced-analysis-detail-body section > strong {
  color: #66788d;
  font-size: 12px;
}

.enhanced-detail-list {
  display: grid;
  gap: 6px;
}

.enhanced-detail-list span {
  border: 1px solid #e4edf3;
  border-radius: 6px;
  background: #fff;
  padding: 6px 8px;
  color: #273845;
  font-size: 13px;
  line-height: 1.5;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.project-understanding-collapsed {
  border: 1px solid #dce8f2;
  border-radius: 8px;
  background: #fbfdff;
  padding: 8px 10px;
}

.project-understanding-collapsed > summary {
  cursor: pointer;
  color: #3d515d;
  font-size: 13px;
  font-weight: 750;
}

.project-understanding-collapsed .project-understanding-card {
  padding-top: 10px;
}

@media (max-width: 720px) {
  .enhanced-signal-grid,
  .transaction-comparison-grid,
  .transaction-option-grid {
    grid-template-columns: 1fr;
  }

  .transaction-comparison-grid article > div {
    grid-template-columns: 1fr;
  }

  .candidate-compact-row,
  .candidate-priority-grid,
  .candidate-priority-gridline,
  .candidate-compact-grid,
  .candidate-weak-row,
  .candidate-weak-grid,
  .dense-answer-table,
  .seller-lead-grid {
    grid-template-columns: 1fr;
  }

  .dense-answer-card.seller-public-info-check .seller-public-info-key-judgments .dense-answer-list,
  .seller-public-info-compact-row {
    grid-template-columns: 1fr;
  }

  .seller-public-info-compact-row span {
    border-left: 0;
    border-top: 1px solid #e7eef5;
  }

  .seller-public-info-compact-row span:first-child {
    border-top: 0;
  }
}

.evidence-linked-cards {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.evidence-linked-cards > .muted-text {
  font-size: 12px;
}

.button-like {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.button-like:hover {
  border-color: #a8bac5;
}

.download-fallback {
  margin-left: 4px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 750;
}

.download-local-path {
  grid-column: 1 / -1;
  width: 100%;
  color: #66788d;
  font-size: 12px;
  line-height: 1.6;
  word-break: break-all;
}

.assistant-progress {
  display: grid;
  gap: 10px;
}

.assistant-upload-card {
  gap: 14px;
}

.assistant-upload-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.assistant-upload-files span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  border: 1px solid #dbe7ff;
  border-radius: 999px;
  padding: 6px 10px;
  background: #f6f9ff;
}

.assistant-upload-files strong {
  color: #132033;
  font-size: 13px;
}

.assistant-upload-files em {
  color: #66788d;
  font-size: 12px;
  font-style: normal;
}

.assistant-upload-decision {
  display: grid;
  gap: 6px;
  border: 1px solid #dde8f5;
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

.assistant-progress p {
  color: var(--muted);
}

.assistant-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.assistant-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #d7e5ff;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: assistant-spin 0.9s linear infinite;
}

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

.agent-match-block {
  display: grid;
  gap: 8px;
  border-top: 1px solid #e5eef7;
  padding-top: 12px;
}

.agent-match-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #66788d;
}

.agent-match-title strong {
  color: #132033;
}

.agent-match-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #dce8f2;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.agent-match-row p {
  margin-top: 3px;
  color: #66788d;
  font-size: 12px;
}

.agent-list {
  display: grid;
  gap: 6px;
  border: 1px solid #dce8f2;
  border-radius: 8px;
  padding: 10px;
  background: #f8fbff;
}

.agent-list span {
  color: #4a5d73;
}

.case-lookup-answer {
  gap: 14px;
}

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

.case-lookup-facts span {
  display: grid;
  gap: 4px;
  border: 1px solid #dce8f2;
  border-radius: 8px;
  padding: 9px 10px;
  background: #f8fbff;
}

.case-lookup-facts em {
  color: #66788d;
  font-style: normal;
  font-size: 12px;
  font-weight: 750;
}

.case-lookup-facts strong {
  color: #132033;
  font-size: 13px;
}

.case-lookup-narrative {
  display: grid;
  gap: 8px;
}

.case-lookup-narrative section {
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}

.case-lookup-narrative h4,
.case-lookup-narrative p {
  margin: 0;
}

.case-lookup-narrative h4 {
  font-size: 13px;
}

.case-lookup-narrative p {
  color: #4a5d73;
}

@media (max-width: 1180px) {
  .assistant-home {
    grid-template-columns: 1fr;
  }

  .assistant-home-main {
    grid-template-columns: 1fr;
  }
}

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

  .compact-kv {
    grid-template-columns: repeat(3, minmax(96px, 1fr));
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: minmax(220px, 0.36fr) minmax(0, 1fr);
    align-items: start;
    gap: 16px 22px;
    margin: 0;
    border-right: 0;
    border-radius: 0;
    border-bottom: 1px solid var(--line);
    padding: 18px 22px;
    box-shadow: none;
  }

  .brand {
    min-width: 0;
  }

  .sidebar-toggle {
    justify-self: end;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
    align-self: center;
    gap: 8px 10px;
  }

  .nav button {
    min-height: 38px;
  }

  .metric-grid,
  .layout-2,
  .settings-grid,
  .settings-summary-grid,
  .settings-workflow-grid,
  .match-grid,
  .case-library {
    grid-template-columns: 1fr;
  }

  .assistant-home {
    grid-template-columns: 1fr;
  }

  .ai-home {
    padding: 18px 18px 56px;
  }

  .ai-home.has-chat {
    height: auto;
    overflow: visible;
    padding: 12px;
    gap: 10px;
  }

  .ai-home-top {
    align-items: flex-start;
  }

  .ai-home.has-chat .ai-home-top {
    min-height: 0;
  }

  .ai-session.is-active .ai-session-card {
    width: 100%;
  }

  .ai-home-thread {
    padding: 14px;
  }

  .ai-command-footer {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

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

  .case-index {
    position: static;
    min-height: 0;
  }

  .case-list {
    max-height: 420px;
  }

  .case-highlight-grid,
  .case-field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .case-overview-highlights,
  .case-overview-facts,
  .case-overview-notes {
    grid-template-columns: 1fr;
  }

  .case-overview-facts div,
  .case-overview-facts div:nth-child(odd) {
    border-right: 0;
  }

  .case-overview-facts div:nth-last-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .case-overview-facts div:last-child {
    border-bottom: 0;
  }

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

  .topbar {
    align-items: start;
  }

  .top-actions {
    min-width: 0;
    flex: 0 1 520px;
  }

  .top-search {
    width: 100%;
    min-width: 260px;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 16px;
  }

  .sidebar {
    grid-template-columns: 1fr;
    padding: 16px;
  }

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

  .topbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .top-actions {
    width: 100%;
    justify-content: stretch;
  }

  .top-search {
    width: 100%;
    min-width: 0;
  }

  .user-badge {
    justify-self: start;
  }

  .floating-search {
    right: 14px;
    top: 14px;
  }

  .floating-search-panel {
    right: 58px;
    width: min(520px, calc(100vw - 86px));
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .floating-search-close {
    grid-column: 2;
  }

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

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

  .case-highlight-grid,
  .case-field-grid {
    grid-template-columns: 1fr;
  }

  .case-detail-dialog-body .case-highlight-grid,
  .case-detail-dialog-body .case-field-grid {
    grid-template-columns: 1fr;
  }

  .knowledge-action {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .knowledge-action button,
  .knowledge-action .file-button {
    justify-content: center;
  }

  .dialog-source-options {
    grid-template-columns: 1fr;
  }

  .toolbar input,
  .toolbar select {
    width: 100%;
  }

  .ai-home-top,
  .ai-home-top {
    display: grid;
    grid-template-columns: 1fr;
  }

  .ai-command-footer {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .ai-session-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .ai-home-top-actions {
    justify-content: flex-start;
  }

  .ai-status-grid {
    grid-template-columns: 1fr;
  }

  .agent-field-grid,
  .agent-match-row {
    grid-template-columns: 1fr;
  }
}

/* Gemini aesthetic refactor: visual layer only, no state or behavior changes. */
:root {
  color-scheme: light dark;
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", sans-serif;
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #1f1f1f;
  --muted: #5f6368;
  --line: rgba(60, 64, 67, 0.12);
  --line-strong: rgba(60, 64, 67, 0.2);
  --accent: #4285f4;
  --accent-strong: #1a73e8;
  --accent-soft: rgba(66, 133, 244, 0.12);
  --blue: #4285f4;
  --edge-accent: #9b72cb;
  --violet: #9b72cb;
  --gold: #f2b84b;
  --coral: #d96570;
  --red: #d93025;
  --status-blue: #1a73e8;
  --brand-gradient: linear-gradient(74deg, #4285f4 0%, #9b72cb 9%, #d96570 20%);
  --brand-soft-gradient: linear-gradient(74deg, rgba(66, 133, 244, 0.18), rgba(155, 114, 203, 0.16), rgba(217, 101, 112, 0.14));
  --primary-button-bg: #0b57d0;
  --primary-button-hover: #0842a0;
  --primary-button-text: #ffffff;
  --primary-button-shadow: 0 1px 2px rgba(60, 64, 67, 0.18);
  --score-high-bg: #d3e3fd;
  --score-high-text: #0842a0;
  --score-high-border: rgba(66, 133, 244, 0.26);
  --score-mid-bg: #fff3d6;
  --score-mid-text: #815900;
  --score-mid-border: rgba(242, 184, 75, 0.36);
  --score-low-bg: #fce8e6;
  --score-low-text: #b3261e;
  --score-low-border: rgba(217, 48, 37, 0.24);
  --shadow: 0 8px 32px rgba(60, 64, 67, 0.12);
  --shadow-soft: 0 8px 32px rgba(60, 64, 67, 0.08);
  --control-bg: rgba(255, 255, 255, 0.72);
  --control-hover: rgba(60, 64, 67, 0.06);
  --control-active: rgba(60, 64, 67, 0.1);
  --control-text: #202124;
  --field-bg: rgba(255, 255, 255, 0.86);
  --field-focus: #ffffff;
  --placeholder: rgba(60, 64, 67, 0.58);
  --glass-bg: rgba(255, 255, 255, 0.74);
  --glass-strong: rgba(255, 255, 255, 0.88);
  --overlay-bg: rgba(232, 238, 247, 0.58);
  --panel-hover: #f8fbff;
  --chip-bg: rgba(255, 255, 255, 0.74);
  --toast-bg: rgba(255, 255, 255, 0.92);
  --home-bg:
    radial-gradient(circle at 46% 18%, rgba(66, 133, 244, 0.11), transparent 28%),
    radial-gradient(circle at 58% 26%, rgba(155, 114, 203, 0.08), transparent 26%),
    #ffffff;
  --gemini-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131314;
    --panel: #1e1f20;
    --panel-soft: #242528;
    --text: #e3e3e3;
    --muted: #b4b4b4;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.14);
    --accent: #8ab4f8;
    --accent-strong: #aecbfa;
    --accent-soft: rgba(138, 180, 248, 0.14);
    --red: #f28b82;
    --status-blue: #8ab4f8;
    --primary-button-bg: #a8c7fa;
    --primary-button-hover: #c2d7fb;
    --primary-button-text: #062e6f;
    --primary-button-shadow: none;
    --score-high-bg: rgba(168, 199, 250, 0.16);
    --score-high-text: #d3e3fd;
    --score-high-border: rgba(168, 199, 250, 0.28);
    --score-mid-bg: rgba(253, 214, 99, 0.15);
    --score-mid-text: #ffe08a;
    --score-mid-border: rgba(253, 214, 99, 0.26);
    --score-low-bg: rgba(242, 139, 130, 0.14);
    --score-low-text: #f6aea9;
    --score-low-border: rgba(242, 139, 130, 0.24);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.24);
    --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.18);
    --control-bg: rgba(255, 255, 255, 0.06);
    --control-hover: rgba(255, 255, 255, 0.1);
    --control-active: rgba(255, 255, 255, 0.1);
    --control-text: #e3e3e3;
    --field-bg: rgba(255, 255, 255, 0.06);
    --field-focus: rgba(255, 255, 255, 0.09);
    --placeholder: rgba(227, 227, 227, 0.52);
    --glass-bg: rgba(30, 31, 32, 0.8);
    --glass-strong: rgba(30, 31, 32, 0.92);
    --overlay-bg: rgba(19, 19, 20, 0.52);
    --panel-hover: #242528;
    --chip-bg: rgba(255, 255, 255, 0.07);
    --toast-bg: rgba(30, 31, 32, 0.92);
    --home-bg:
      radial-gradient(circle at 46% 18%, rgba(66, 133, 244, 0.11), transparent 28%),
      radial-gradient(circle at 58% 26%, rgba(155, 114, 203, 0.08), transparent 26%),
      #131314;
  }
}

html,
body {
  background: var(--bg);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  color: var(--text);
  font-family: var(--font-main);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

p {
  margin-top: 0;
  margin-bottom: 1.25rem;
}

button,
input,
select,
textarea,
.file-button,
.button-like,
.nav button,
.metric-link,
.brief-card,
.case-list-item,
.rule-card,
.material-card,
.project-kpi,
.project-focus-panel,
.panel,
.ai-command-card {
  transition:
    background 300ms var(--gemini-ease),
    border-color 300ms var(--gemini-ease),
    box-shadow 300ms var(--gemini-ease),
    color 300ms var(--gemini-ease),
    opacity 300ms var(--gemini-ease),
    transform 300ms var(--gemini-ease),
    filter 300ms var(--gemini-ease);
}

button,
.file-button,
.button-like {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--control-bg);
  color: var(--text);
  box-shadow: none;
}

button:hover:not(:disabled),
.file-button:hover,
.button-like:hover {
  border-color: var(--line-strong);
  background: var(--control-hover);
  color: var(--control-text);
  box-shadow: none;
  transform: translateY(-1px);
}

button:focus-visible,
.file-button:focus-visible,
.button-like:focus-visible,
.nav button:focus-visible {
  outline: 0;
  border-color: rgba(138, 180, 248, 0.34);
  box-shadow:
    inset 0 0 0 1px rgba(138, 180, 248, 0.18),
    0 0 0 4px rgba(138, 180, 248, 0.08);
}

button.primary,
.file-button.primary-like {
  border: 1px solid transparent;
  background: var(--primary-button-bg);
  color: var(--primary-button-text);
  box-shadow: var(--primary-button-shadow);
}

button.primary:hover,
.file-button.primary-like:hover {
  background: var(--primary-button-hover);
  color: var(--primary-button-text);
  filter: none;
  box-shadow: var(--primary-button-shadow);
  transform: translateY(-1px);
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--field-bg);
  color: var(--text);
  box-shadow: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--placeholder);
}

input:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: var(--line-strong);
  background: var(--field-focus);
  box-shadow:
    inset 0 0 0 1px rgba(138, 180, 248, 0.14),
    inset 0 0 28px rgba(138, 180, 248, 0.06);
}

.shell {
  background: var(--bg);
}

.main,
.shell.ai-home-mode .main {
  background: var(--bg);
}

.sidebar,
.topbar,
.floating-search-panel,
dialog,
.dialog-panel,
.shell.ai-home-mode .sidebar {
  border-color: var(--line);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: none;
}

.sidebar {
  margin: 0;
  border-radius: 0;
  border-right: 1px solid var(--line);
  padding: 22px 18px;
}

.shell.ai-home-mode .sidebar {
  box-shadow: var(--shadow);
}

.shell.ai-home-mode::before {
  background: var(--overlay-bg);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition: opacity 300ms var(--gemini-ease);
}

.shell.ai-home-mode .sidebar {
  transition: transform 300ms var(--gemini-ease);
}

.brand-mark {
  border-radius: 18px;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

.brand-mark img {
  border-radius: inherit;
  transform: scale(1.01);
  transform-origin: center;
}

.brand h1,
.topbar h2,
.ai-home-brand h1,
.ai-session-intro h2,
.panel-head h3,
.metric strong,
.project-kpi strong,
.chat-message .message-role,
.case-detail-title h3,
.card-seller-link,
.case-mention-link,
.report-seller-link,
.button-like,
.ai-session-toolbar strong,
.ai-upload-menu button,
.auth-blocked h2 {
  color: var(--text);
}

.brand p,
.eyebrow,
.topbar p,
.ai-home-brand p,
.ai-hero-copy,
.ai-session-intro p,
.panel-head p,
.metric span,
.muted,
.hint,
.project-focus-head p,
.project-focus-item span,
.project-focus-item em,
.ai-session-toolbar span,
.ai-trust-line,
.auth-blocked p {
  color: var(--muted);
}

.nav {
  gap: 8px;
}

.nav button {
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
}

.nav button:hover {
  background: var(--control-hover);
  color: var(--text);
  box-shadow: none;
  transform: none;
}

.nav button.active {
  border: 0;
  background: var(--control-active);
  color: var(--text);
  box-shadow: none;
}

.nav-icon,
.nav button:nth-child(n) .nav-icon,
.nav button.active .nav-icon {
  background: var(--control-bg);
  color: currentColor;
  box-shadow: none;
}

.topbar {
  border-radius: 28px;
  padding: 16px 18px;
}

.top-search,
.floating-search-toggle,
.floating-search-panel {
  border-color: var(--line);
  border-radius: 999px;
  background: var(--field-bg);
  box-shadow: none;
}

.top-search input,
.floating-search-panel input {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.top-search:focus-within,
.floating-search-panel:focus-within {
  border-color: var(--line-strong);
  background: var(--field-focus);
  box-shadow: inset 0 0 0 1px rgba(138, 180, 248, 0.1);
}

.panel,
.metric,
.project-kpi,
.project-focus-panel,
.brief-card,
.rule-card,
.material-card,
.case-list-item,
.rejected-candidate,
.case-detail,
.case-index,
.settings-summary-card,
.settings-workflow-card,
.knowledge-action,
.agent-task-card,
.match-card,
.compact-kv,
.mini-report,
.plan-output,
.report-preview,
.ai-empty-dialog {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  color: var(--text);
  box-shadow: none;
}

.panel-head,
.panel-body,
.project-kpi,
.project-focus-panel,
.project-focus-item,
.assistant-chat .panel-head,
.chat-composer,
.case-list,
.rule-library-entry,
.case-narrative section,
.brief-grid,
.settings-card,
.auth-users-panel,
.auth-user-form,
.auth-current-user-card,
.auth-user-row,
.finance-item,
.material-card,
.rule-card,
.case-list-item,
.case-detail,
.case-index,
.knowledge-action,
.mini-report,
.plan-output {
  border-color: var(--line);
  background: transparent;
  box-shadow: none;
}

.panel-head {
  border-bottom: 1px solid var(--line);
}

.brief-card:hover,
.case-list-item:hover,
.rule-card:hover,
.material-card:hover,
.project-kpi:hover,
.metric-link:hover {
  border-color: var(--line-strong);
  background: var(--panel-hover);
  box-shadow: var(--shadow);
  transform: translateY(-2px) scale(1.01);
}

.metric::before,
.assistant-chat .panel-head {
  box-shadow: none;
}

.metric::before {
  background: var(--brand-gradient);
  opacity: 0.86;
}

table {
  border-spacing: 0 6px;
}

th {
  border: 0;
  background: transparent;
  color: var(--muted);
}

td {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

tr:hover td {
  background: var(--panel-hover);
}

.tag,
.score,
.user-badge,
.ai-sync-pill,
.ai-prompt-row button,
.case-source-pill,
.knowledge-chip,
.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--text);
  box-shadow: none;
}

.score,
.score.mid,
.score.low {
  border-color: var(--score-high-border);
  background: var(--score-high-bg);
  color: var(--score-high-text);
  box-shadow: none;
}

.score.mid {
  border-color: var(--score-mid-border);
  background: var(--score-mid-bg);
  color: var(--score-mid-text);
}

.score.low {
  border-color: var(--score-low-border);
  background: var(--score-low-bg);
  color: var(--score-low-text);
}

.toast {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--toast-bg);
  color: var(--text);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.ai-home,
.shell.ai-home-mode .main {
  background: var(--home-bg);
}

.ai-home {
  max-width: 1280px;
}

.ai-menu-button,
.sidebar-toggle,
.floating-search-toggle,
.ai-add-button,
.ai-send-button {
  border-radius: 999px;
}

.ai-menu-button {
  color: var(--muted);
}

.ai-menu-button:hover,
.ai-menu-button:focus-visible {
  background: var(--control-hover);
  color: var(--text);
  transform: scale(1.02);
}

.ai-home-top-actions {
  opacity: 0.82;
}

.ai-new-chat-button {
  border-color: var(--line);
  background: var(--control-bg);
  color: var(--text);
  box-shadow: none;
}

.ai-new-chat-button:hover,
.ai-new-chat-button:focus-visible {
  border-color: var(--line-strong);
  background: var(--control-hover);
  color: var(--text);
}

.ai-session {
  gap: 26px;
}

.ai-session-intro {
  max-width: 880px;
}

.ai-home-eyebrow {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ai-session-card {
  overflow: visible;
}

.ai-session.is-idle .ai-session-card {
  display: grid;
  gap: clamp(22px, 3vh, 34px);
}

.ai-session-toolbar {
  border: 1px solid var(--line);
  border-radius: 24px;
  margin-bottom: 16px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: none;
}

.ai-command-card,
.ai-session-card .ai-command-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.ai-command-card:focus-within,
.ai-command-card:hover {
  border-color: var(--line-strong);
  background: var(--panel-hover);
  box-shadow:
    var(--shadow),
    inset 0 0 0 1px rgba(138, 180, 248, 0.06);
}

.ai-command-card textarea {
  color: var(--text);
  background: transparent;
}

.ai-command-footer {
  border-top: 1px solid var(--line);
}

.ai-add-button {
  background: var(--control-bg);
  color: var(--muted);
}

.ai-upload-menu {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.ai-upload-menu button:hover {
  background: var(--control-hover);
}

.ai-send-button {
  background: var(--control-active);
  color: #ffffff;
}

.ai-send-button.is-ready {
  background: var(--primary-button-bg);
  color: var(--primary-button-text);
}

.ai-send-button.is-ready:hover {
  background: var(--primary-button-hover);
  color: var(--primary-button-text);
  filter: none;
  transform: translateY(-1px) scale(1.04);
}

.ai-send-button.is-empty,
.ai-send-button.is-empty:hover,
.ai-send-button.is-empty:disabled:hover {
  background: var(--control-active);
  color: var(--muted);
}

.ai-prompt-row button:hover,
.ai-prompt-row button:focus-visible {
  border-color: var(--line-strong);
  background: var(--control-hover);
  color: var(--text);
  transform: translateY(-1px);
}

.ai-session.is-idle .ai-prompt-row {
  margin-top: 0;
  padding-top: 0;
}

.ai-session.is-active .ai-session-composer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: end;
  gap: 10px;
  max-width: min(960px, calc(100vw - 32px));
  min-height: 112px;
  padding: 16px 16px 14px;
  border-radius: 34px;
}

.ai-session.is-active .ai-session-composer textarea {
  grid-column: 2;
  grid-row: 1;
  min-height: 52px;
  max-height: 128px;
  padding: 4px 6px 8px;
  line-height: 1.5;
  resize: none;
}

.ai-session.is-active .ai-command-footer {
  display: contents;
  border-top: 0;
  padding-top: 0;
}

.ai-session.is-active .ai-upload-control {
  grid-column: 1;
  grid-row: 1;
  align-self: end;
}

.ai-session.is-active .ai-add-button {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  box-shadow: none;
}

.ai-session.is-active .ai-send-button {
  grid-column: 3;
  grid-row: 1;
  align-self: end;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
}

.chat-thread,
.ai-home-thread {
  background: transparent;
}

.message-content,
.chat-message.user .message-content,
.chat-message.assistant.pending .message-content {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  color: var(--text);
  box-shadow: none;
}

.chat-message.user .message-content {
  background: rgba(138, 180, 248, 0.14);
}

.dialog-panel {
  border-radius: 28px;
  color: var(--text);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: var(--overlay-bg);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.dialog-head {
  border-bottom-color: var(--line);
}

.report-gap {
  border-color: rgba(242, 184, 75, 0.3);
  background: rgba(242, 184, 75, 0.13);
  color: #fddc9b;
}

.danger-subtle {
  border-color: #f1c7c7;
  background: #fff7f7;
  color: #9f2f2f;
}

.danger-subtle:hover,
.danger-subtle:focus-visible {
  border-color: #df8a8a;
  background: #fff0f0;
  color: #842424;
}

/* Gemini-style home shell: persistent quiet sidebar + uncluttered chat canvas. */
.sidebar-account {
  margin-top: auto;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 6px;
  border-radius: 999px;
  color: var(--text);
}

.sidebar-account:hover {
  background: var(--control-hover);
}

.sidebar-account-avatar {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #009688;
  color: #fff;
  font-weight: 850;
}

.sidebar-account strong,
.sidebar-account p {
  display: block;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-account strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 760;
}

.sidebar-account p {
  color: var(--muted);
  font-size: 12px;
}

.shell.ai-home-mode {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: 100svh;
}

.shell.ai-home-mode::before {
  display: none;
}

.shell.ai-home-mode .sidebar {
  position: sticky;
  inset: auto;
  z-index: 1;
  width: auto;
  height: 100svh;
  transform: none;
  display: flex;
  padding: 24px 12px 18px;
  border-right: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.9);
  box-shadow: none;
  overflow-y: auto;
}

.shell.ai-home-mode .brand {
  padding: 0 8px 14px;
}

.shell.ai-home-mode .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.shell.ai-home-mode .brand h1 {
  font-size: 18px;
  font-weight: 760;
}

.shell.ai-home-mode .brand p {
  display: none;
}

.shell.ai-home-mode .sidebar-toggle {
  width: 34px;
  min-height: 34px;
  border-radius: 10px;
  background: transparent;
}

.shell.ai-home-mode .nav {
  gap: 4px;
}

.shell.ai-home-mode .nav button {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 0 12px;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 620;
}

.shell.ai-home-mode .nav button.active,
.shell.ai-home-mode .nav button:hover {
  background: rgba(60, 64, 67, 0.08);
  color: var(--text);
  transform: none;
}

.shell.ai-home-mode .nav-icon {
  background: transparent;
}

@media (min-width: 981px) {
  .shell.ai-home-mode:not(.sidebar-collapsed) .sidebar {
    gap: 14px;
    padding: 20px 12px 16px;
  }

  .shell.ai-home-mode:not(.sidebar-collapsed) .brand {
    padding: 0 8px 10px;
  }

  .shell.ai-home-mode:not(.sidebar-collapsed) .nav button {
    min-height: 38px;
    padding: 0 10px;
    border-radius: 20px;
    gap: 10px;
    line-height: 1.25;
  }

  .shell.ai-home-mode:not(.sidebar-collapsed) .nav-icon {
    width: 20px;
    height: 20px;
    border-radius: 6px;
  }
}

.shell.ai-home-mode:not(.sidebar-collapsed) .nav {
  width: min(198px, calc(100% - 56px));
  grid-template-columns: 1fr;
  align-self: center;
  align-content: start;
  gap: 4px;
  margin: 0 auto 18px;
}

.shell.ai-home-mode:not(.sidebar-collapsed) .nav button {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  margin: 0;
  padding: 0 10px;
  border-radius: 19px;
  justify-content: flex-start;
}

.shell.ai-home-mode .main {
  min-height: 100svh;
  padding: 0;
  background:
    radial-gradient(circle at 54% 50%, rgba(66, 133, 244, 0.18), transparent 31%),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 44%, #eaf5ff 100%);
}

.shell.ai-home-mode .ai-home {
  width: 100%;
  max-width: none;
  min-height: 100svh;
  padding: clamp(26px, 4vh, 46px) clamp(28px, 5vw, 72px) 64px;
}

.shell.ai-home-mode .ai-home-top {
  justify-content: flex-end;
  min-height: 40px;
}

.shell.ai-home-mode .ai-home-brand {
  display: none;
}

.shell.ai-home-mode .ai-home-top-actions {
  opacity: 1;
}

.shell.ai-home-mode .ai-new-chat-button {
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: #c2e7ff;
  color: #0842a0;
  font-size: 15px;
  font-weight: 700;
}

.shell.ai-home-mode .assistant-home-main {
  min-height: calc(100svh - 150px);
  align-items: center;
}

.shell.ai-home-mode .ai-session.is-idle {
  width: min(1200px, 100%);
  padding: 0 0 clamp(28px, 7vh, 86px);
}

.shell.ai-home-mode .ai-session-intro {
  max-width: 1040px;
  gap: 18px;
}

.shell.ai-home-mode .ai-session-intro h2 {
  color: #202124;
  font-size: clamp(2.75rem, 3.35vw, 4rem);
  line-height: 1.16;
  font-weight: 720;
  letter-spacing: 0;
}

.shell.ai-home-mode .ai-session-intro p {
  max-width: 54rem;
  color: #6f7378;
  font-size: 1.0625rem;
  line-height: 1.6;
}

.shell.ai-home-mode .ai-session-card {
  width: min(1180px, 100%);
}

.shell.ai-home-mode .ai-session.is-idle .ai-session-card {
  gap: 28px;
}

.shell.ai-home-mode .ai-session.is-idle .ai-command-card {
  display: grid;
  grid-template-rows: minmax(8.5rem, 1fr) auto;
  min-height: 14.75rem;
  padding: 1rem 1.125rem 0.875rem;
  border: 1px solid #dbe3ed;
  border-radius: 2rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 50px rgba(60, 64, 67, 0.12);
}

.shell.ai-home-mode .ai-session.is-idle .ai-command-card textarea {
  min-height: 8.5rem;
  padding: 0.5rem 0.375rem 0.25rem;
  color: #202124;
  font-size: 1.125rem;
  line-height: 1.6;
  resize: none;
}

.shell.ai-home-mode .ai-command-footer {
  border-top: 0;
  padding-top: 0.5rem;
}

.shell.ai-home-mode .ai-add-button,
.shell.ai-home-mode .ai-send-button {
  width: 2.625rem;
  min-width: 2.625rem;
  min-height: 2.625rem;
}

.shell.ai-home-mode .ai-prompt-row {
  justify-content: center;
  gap: 12px;
}

.shell.ai-home-mode .ai-prompt-row button {
  min-height: 2.25rem;
  padding: 0 1rem;
  border-color: rgba(60, 64, 67, 0.16);
  background: rgba(255, 255, 255, 0.82);
  color: #202124;
  font-size: 0.875rem;
  font-weight: 650;
}

.shell.ai-home-mode .ai-home.has-chat {
  padding-bottom: 24px;
}

.shell.ai-home-mode .ai-home.has-chat .assistant-home-main {
  align-items: stretch;
  min-height: 0;
}

.shell.ai-home-mode.sidebar-collapsed {
  grid-template-columns: 76px minmax(0, 1fr);
}

.shell.ai-home-mode.sidebar-collapsed .sidebar {
  width: 76px;
  padding: 18px 10px;
  align-items: center;
  overflow-x: hidden;
}

.shell.ai-home-mode.sidebar-collapsed .brand {
  justify-content: center;
  width: 100%;
  padding: 0 0 12px;
}

.shell.ai-home-mode.sidebar-collapsed .brand-mark,
.shell.ai-home-mode.sidebar-collapsed .brand > div:not(.brand-mark) {
  display: none;
}

.shell.ai-home-mode.sidebar-collapsed .sidebar-toggle {
  width: 42px;
  min-height: 42px;
  margin: 0;
  border-radius: 999px;
}

.shell.ai-home-mode.sidebar-collapsed .nav {
  width: 100%;
}

.shell.ai-home-mode.sidebar-collapsed .nav button {
  width: 100%;
  display: grid;
  place-items: center;
  padding: 0;
}

.shell.ai-home-mode.sidebar-collapsed .nav button > span:not(.nav-icon) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.shell.ai-home-mode.sidebar-collapsed .sidebar-account {
  grid-template-columns: 1fr;
  justify-items: center;
  width: 100%;
  padding: 6px 0;
}

.shell.ai-home-mode.sidebar-collapsed .sidebar-account > div {
  display: none;
}

.shell.ai-home-mode.sidebar-collapsed .sidebar-account-avatar {
  width: 42px;
  height: 42px;
}

@media (max-width: 980px) {
  .shell.ai-home-mode {
    display: block;
  }

  .shell.ai-home-mode::before {
    display: block;
  }

  .shell.ai-home-mode .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(360px, calc(100vw - 24px));
    transform: translateX(-104%);
    box-shadow: var(--shadow);
  }

  .shell.ai-home-mode.home-sidebar-open .sidebar {
    transform: translateX(0);
  }

  .shell.ai-home-mode.sidebar-collapsed {
    display: block;
  }

  .shell.ai-home-mode.sidebar-collapsed .sidebar {
    width: min(360px, calc(100vw - 24px));
    padding: 24px 12px 18px;
    align-items: stretch;
    overflow-x: visible;
  }

  .shell.ai-home-mode.sidebar-collapsed .brand {
    justify-content: flex-start;
    padding: 0 8px 14px;
  }

  .shell.ai-home-mode.sidebar-collapsed .brand-mark {
    display: grid;
  }

  .shell.ai-home-mode.sidebar-collapsed .brand > div:not(.brand-mark) {
    display: block;
  }

  .shell.ai-home-mode.sidebar-collapsed .nav button {
    display: flex;
    justify-content: flex-start;
    padding: 0 12px;
  }

  .shell.ai-home-mode.sidebar-collapsed .nav button > span:not(.nav-icon) {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }

  .shell.ai-home-mode.sidebar-collapsed .sidebar-account {
    grid-template-columns: 40px minmax(0, 1fr);
    justify-items: stretch;
    padding: 6px;
  }

  .shell.ai-home-mode.sidebar-collapsed .sidebar-account > div {
    display: block;
  }

  .shell.ai-home-mode.sidebar-collapsed .sidebar-account-avatar {
    width: 40px;
    height: 40px;
  }

  .shell.ai-home-mode .ai-home-brand {
    display: flex;
  }

  .shell.ai-home-mode .ai-home-top {
    justify-content: space-between;
  }

  .shell.ai-home-mode .ai-session-intro h2 {
    font-size: clamp(2.125rem, 9vw, 3rem);
  }

  .shell.ai-home-mode .ai-session.is-idle .ai-command-card {
    min-height: 13.5rem;
  }

  .shell.ai-home-mode .ai-session.is-idle .ai-command-card textarea {
    min-height: 8rem;
    font-size: 1rem;
  }
}

.card-seller-link,
.case-mention-link,
.report-seller-link {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
  padding: 0;
  font: inherit;
  font-weight: 700;
  line-height: inherit;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.card-seller-link:hover,
.card-seller-link:focus-visible,
.case-mention-link:hover,
.case-mention-link:focus-visible,
.report-seller-link:hover,
.report-seller-link:focus-visible {
  border-color: transparent;
  background: transparent;
  color: var(--accent-strong);
  box-shadow: none;
  filter: none;
  text-decoration-color: currentColor;
  transform: none;
}

@media (max-width: 768px) {
  body {
    line-height: 1.5;
  }

  .main,
  .ai-home,
  .ai-session,
  .ai-session-card,
  .chat-thread,
  .ai-home-thread,
  .dialog-panel {
    width: 100%;
    max-width: 100%;
  }

  .case-structure-step {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 10px;
  }

  .case-structure-step:not(:last-child)::before {
    left: 13px;
  }

  .case-structure-step-index {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .case-structure-step-head {
    display: grid;
  }

  .case-structure-step-head > span {
    max-width: 100%;
    justify-self: start;
    text-align: left;
  }

  .case-structure-row,
  .case-rule-map-row-list .case-rule-map-card,
  .case-evidence-row-list .case-evidence-card {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 980px) {
  html,
  body,
  .shell.ai-home-mode,
  .shell.ai-home-mode .main {
    min-height: 100%;
    overflow-y: auto;
  }

  .shell.ai-home-mode .sidebar {
    display: flex;
    flex-direction: column;
    gap: 22px;
    width: min(360px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 20px 16px max(20px, env(safe-area-inset-bottom));
  }

  .shell.ai-home-mode .nav {
    width: 100%;
    grid-template-columns: 1fr;
    align-self: stretch;
  }

  .shell.ai-home-mode .nav button {
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
    overflow: hidden;
    white-space: normal;
  }

  .shell.ai-home-mode .nav button > span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .shell.ai-home-mode:not(.sidebar-collapsed) .nav {
    width: min(198px, calc(100% - 56px));
    grid-template-columns: 1fr;
    align-self: center;
    gap: 4px;
    margin: 0 auto 18px;
  }

  .shell.ai-home-mode:not(.sidebar-collapsed) .nav button {
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
  }

  .ai-home.has-chat {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100svh;
    overflow: visible;
    padding: 14px clamp(10px, 3.5vw, 18px) calc(86px + env(safe-area-inset-bottom));
  }

  .ai-home.has-chat .assistant-home-main,
  .ai-session.is-active,
  .ai-session.is-active .ai-session-card {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .ai-session.is-active .ai-session-card {
    display: grid;
    gap: 12px;
  }

  .ai-home-thread {
    max-height: none;
    overflow: visible;
    padding: 12px 0 16px;
  }

  .ai-home-thread .chat-message.user {
    max-width: 100%;
  }

  .ai-home-thread .message-content {
    overflow-wrap: anywhere;
  }

  .ai-session.is-active .ai-session-composer {
    position: sticky;
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 12;
    margin-top: 4px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  button.primary,
  .ai-send-button.is-ready,
  .metric-link,
  .brief-card,
  .case-list-item,
  .rule-card,
  .material-card {
    will-change: transform, filter;
  }
}

.local-kb-chat-answer {
  display: grid;
  min-width: 0;
  max-width: 900px;
  gap: 12px;
  color: var(--text-main);
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.local-kb-chat-answer *,
.vertical-answer-body,
.vertical-answer-body *,
.vertical-answer-notes,
.vertical-answer-notes * {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.local-kb-prose {
  display: grid;
  min-width: 0;
  max-width: 900px;
  gap: 0;
  font-size: 15px;
  line-height: 1.78;
}

.local-kb-prose p {
  margin: 0 0 12px;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.local-kb-prose p:last-child {
  margin-bottom: 0;
}

.vertical-answer-body p,
.vertical-answer-body li,
.vertical-answer-notes p,
.vertical-answer-notes li {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.local-kb-prose pre,
.local-kb-prose code,
.vertical-answer-body pre,
.vertical-answer-body code,
.vertical-answer-notes pre,
.vertical-answer-notes code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.local-kb-prose h4,
.vertical-answer-heading {
  margin: 18px 0 8px;
  color: #111827;
  font-size: 0.98rem;
  letter-spacing: 0;
  font-weight: 700;
  line-height: 1.45;
}

.local-kb-prose h4:first-child,
.vertical-answer-heading:first-child {
  margin-top: 0;
}

.vertical-answer-lead {
  font-weight: 500;
  margin-bottom: 14px;
}

.local-kb-prose strong {
  font-weight: 820;
}

.local-kb-prose ul,
.local-kb-prose ol,
.vertical-answer-body ul,
.vertical-answer-body ol,
.vertical-answer-notes ul,
.vertical-answer-notes ol {
  max-width: 100%;
  margin: 8px 0 14px;
  padding-left: 1.3em;
  margin-right: 0;
  overflow-wrap: anywhere;
}

.local-kb-prose li,
.vertical-answer-body li {
  margin: 6px 0;
  line-height: 1.62;
}

.research-source-group-title {
  margin-top: 14px;
  margin-bottom: 6px;
}

.research-source-group-title + ul,
.research-source-group-title + ol {
  margin-top: 0;
  margin-bottom: 16px;
}

.research-source-group-title + ul li,
.research-source-group-title + ol li {
  margin: 7px 0;
}

.vertical-answer-notes {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.75);
  color: #6b7280;
  font-size: 13px;
  line-height: 1.6;
}

.vertical-answer-notes section {
  display: grid;
  gap: 5px;
}

.vertical-answer-notes strong {
  color: #4b5563;
  font-size: 13px;
  font-weight: 600;
}

.vertical-answer-notes ul {
  margin: 0;
  padding-left: 1.05rem;
}

.vertical-answer-notes li {
  margin: 4px 0;
  line-height: 1.6;
  font-size: 13px;
}

.kimi-research-source-layer {
  margin-top: 14px;
  border: 1px solid rgba(203, 213, 225, 0.75);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.82);
  color: #475569;
  font-size: 13px;
}

.kimi-research-source-layer > summary {
  padding: 10px 12px;
  color: #334155;
  font-weight: 750;
  cursor: pointer;
}

.kimi-research-source-layer__body {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.kimi-research-source-group {
  display: grid;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(226, 232, 240, 0.9);
}

.kimi-research-source-group h5 {
  margin: 0;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.kimi-research-source-group ul {
  margin: 0;
  padding-left: 1.1rem;
}

.kimi-research-source-group li {
  margin: 5px 0;
  line-height: 1.55;
}

.kimi-research-source-group p {
  margin: 3px 0 0;
  color: #64748b;
}

.kimi-research-source-group a {
  margin-left: 8px;
  color: #2563eb;
  font-weight: 700;
  text-decoration: none;
}

.kimi-research-source-group a:hover,
.kimi-research-source-group a:focus-visible {
  text-decoration: underline;
}

.kimi-research-source-type {
  margin-left: 6px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
}

.kimi-research-source-empty {
  color: #94a3b8;
}

.kimi-research-quality-flags {
  color: #64748b;
}

.source-citation {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  margin-left: 3px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  color: #64748b;
  background: #f1f5f9;
  text-decoration: none;
  vertical-align: super;
}

.source-citation:hover,
.source-citation:focus-visible {
  color: #0f172a;
  background: #e2e8f0;
  text-decoration: none;
}

.source-attribution {
  position: relative;
  display: inline-flex;
  max-width: 100%;
  margin-left: 3px;
  vertical-align: baseline;
}

.source-attribution__trigger {
  display: inline-flex;
  align-items: center;
  max-width: min(210px, calc(100vw - 48px));
  min-height: 18px;
  padding: 1px 5px;
  border: 1px solid #dbe4ef;
  border-radius: 999px;
  color: #526277;
  background: #f4f7fa;
  font: inherit;
  font-size: 10px;
  line-height: 1.25;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.source-attribution__trigger:hover,
.source-attribution__trigger:focus-visible,
.source-attribution__trigger[aria-expanded="true"] {
  color: #172033;
  border-color: #c4d1df;
  background: #eaf0f6;
  outline: none;
}

.source-attribution__popover {
  position: fixed;
  z-index: 40;
  display: grid;
  gap: 5px;
  width: max-content;
  max-width: min(320px, calc(100vw - 32px));
  padding: 10px 12px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  color: #4b5b70;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.source-attribution__popover[hidden] {
  display: none;
}

.source-attribution__popover strong {
  color: #172033;
  font-size: 12px;
}

.source-attribution__link {
  color: #2563a9;
  text-decoration: none;
}

.source-attribution__link:hover,
.source-attribution__link:focus-visible {
  text-decoration: underline;
}

.source-citation-list {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(226, 232, 240, 0.8);
  color: #64748b;
  font-size: 13px;
}

.source-citation-list strong {
  display: block;
  margin-bottom: 4px;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
}

.source-citation-list__group + .source-citation-list__group {
  margin-top: 8px;
}

.source-citation-list__group > strong {
  margin-bottom: 2px;
  color: #64748b;
  font-size: 12px;
}

.source-citation-list ol {
  margin: 0;
  padding-left: 1.15rem;
}

.source-citation-list ul {
  margin: 0;
  padding-left: 1.15rem;
}

.source-citation-list li {
  margin: 3px 0;
  line-height: 1.55;
}

.source-citation-list a {
  color: #475569;
  text-decoration: none;
}

.source-citation-list a:hover,
.source-citation-list a:focus-visible {
  color: #0f172a;
  text-decoration: underline;
}

.local-kb-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.vertical-answer-body table,
.vertical-answer-notes table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.local-kb-table {
  width: 100%;
  max-width: 100%;
  display: block;
  border-collapse: collapse;
  min-width: 620px;
  font-size: 0.92rem;
}

.local-kb-table th,
.local-kb-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  vertical-align: top;
}

.local-kb-table th {
  font-weight: 700;
  background: rgba(15, 23, 42, 0.04);
}

.local-kb-table tr:last-child td {
  border-bottom: 0;
}

@media (max-width: 768px) {
  .local-kb-chat-answer,
  .local-kb-prose,
  .vertical-answer-body {
    max-width: 100%;
    font-size: 14px;
  }

  .local-kb-prose {
    line-height: 1.76;
  }

  .local-kb-prose h4,
  .vertical-answer-heading {
    margin-top: 16px;
  }
}

/* Final home-sidebar spacing guard. Keep expanded menu rhythm independent from
   earlier theme and responsive sidebar rules. */
.shell.ai-home-mode:not(.sidebar-collapsed) .nav {
  width: min(176px, calc(100% - 72px)) !important;
  height: auto !important;
  max-height: none !important;
  flex: 0 0 auto !important;
  display: grid !important;
  grid-template-columns: 1fr !important;
  grid-auto-flow: row !important;
  grid-auto-rows: 44px !important;
  align-content: start !important;
  align-self: center !important;
  justify-content: center !important;
  gap: 4px !important;
  margin: 0 auto 18px !important;
}

.shell.ai-home-mode:not(.sidebar-collapsed) .nav button {
  width: 100% !important;
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  margin: 0 !important;
  padding: 0 10px !important;
  border-radius: 19px !important;
  justify-content: flex-start !important;
  align-items: center !important;
}
