:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --soft: #f8fafc;
  --line: #d8dee7;
  --line-soft: #e8edf3;
  --text: #17202c;
  --muted: #667085;
  --blue: #2463eb;
  --blue-2: #e9f0ff;
  --green: #15803d;
  --green-2: #eaf7ee;
  --amber: #b45309;
  --amber-2: #fff4df;
  --red: #b42318;
  --red-2: #ffebe9;
  --primary-sidebar-collapsed: 72px;
  --primary-sidebar-expanded: 188px;
  --context-sidebar: 320px;
  --agent: 420px;
  --radius: 8px;
  --shadow: 0 14px 36px rgba(23, 32, 44, .08);
  --fs-xxs: 10px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 18px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

* { box-sizing: border-box; }

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(102, 112, 133, .32) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(102, 112, 133, .26);
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(102, 112, 133, .46);
  background-clip: padding-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-sm);
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #132235;
  padding: 24px;
}

.login-screen[hidden] {
  display: none;
}

.login-card {
  width: min(360px, 100%);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.14);
  background: #fff;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .24);
  padding: 24px;
  display: grid;
  gap: 14px;
}

.login-card .brand-mark {
  width: 40px;
  height: 40px;
}

.login-card h1 {
  margin: 0;
  font-size: var(--fs-xl);
}

.login-card p,
.login-card small {
  margin: 0;
  color: var(--muted);
}

.login-card label {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

.login-card input {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  outline: 0;
}

.login-card input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(36, 99, 235, .14);
}

.login-card .primary-btn {
  height: 38px;
}

#loginError {
  min-height: 18px;
  color: var(--red);
}

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

button {
  border: 0;
  cursor: pointer;
}

.app {
  display: grid;
  grid-template-columns: var(--primary-sidebar-collapsed) var(--context-sidebar) minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.app.nav-expanded {
  grid-template-columns: var(--primary-sidebar-expanded) var(--context-sidebar) minmax(0, 1fr);
}

.primary-sidebar,
.context-sidebar {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  color: #f8fafc;
}

.primary-sidebar {
  background: #132235;
  border-right: 1px solid rgba(255,255,255,.08);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.context-sidebar {
  background: #17263a;
  border-right: 1px solid rgba(15, 23, 42, .18);
  padding: 16px 14px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 38px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #61dafb, #34d399);
  color: #0f172a;
  display: grid;
  place-items: center;
  font-size: var(--fs-xs);
  font-weight: 700;
}

.brand-text,
.nav-text {
  display: none;
}

.app.nav-expanded .brand {
  justify-content: flex-start;
}

.app.nav-expanded .brand-text,
.app.nav-expanded .nav-text {
  display: inline;
}

.nav-spacer {
  flex: 1;
}

.nav-btn,
.collapse-btn {
  height: 38px;
  border-radius: 8px;
  background: rgba(255,255,255,.06);
  color: #d7e2ef;
  border: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.nav-btn.active {
  background: #fff;
  color: #132235;
}

.app.nav-expanded .nav-btn {
  justify-content: flex-start;
  padding: 0 12px;
}

.folder-icon {
  position: relative;
  width: 22px;
  height: 22px;
  display: block;
}

.folder-icon::before {
  content: "";
  position: absolute;
  left: 2px;
  bottom: 3px;
  width: 17px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.folder-icon::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 8px;
  height: 4px;
  border-radius: 3px 3px 0 0;
  background: currentColor;
}

.gear-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
}

.context-panel {
  display: none;
  height: 100%;
  flex-direction: column;
  gap: 10px;
}

.context-panel.active {
  display: flex;
}

.context-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 30px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: var(--fs-xs);
  color: #475467;
  background: #eef2f6;
  border: 1px solid #dde3eb;
  white-space: nowrap;
}

.badge.success,
.tag-green {
  color: var(--green);
  background: var(--green-2);
  border-color: #bde6c8;
}

.tag-red {
  color: var(--red);
  background: var(--red-2);
  border-color: #ffc7c1;
}

.tag-amber {
  color: var(--amber);
  background: var(--amber-2);
  border-color: #fedca3;
}

.tag-blue {
  color: var(--blue);
  background: var(--blue-2);
  border-color: #c7d7ff;
}

.create-btn,
.primary-btn {
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 700;
  height: 34px;
  padding: 0 12px;
}

.secondary-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 700;
  height: 32px;
  padding: 0 10px;
}

.danger-btn {
  color: var(--red);
  border-color: #ffc7c1;
  background: #fff;
}

.settings-card .danger-btn {
  margin-top: 10px;
}

.danger-primary {
  background: var(--red);
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  padding: 7px 9px;
}

.search input {
  min-width: 0;
  width: 100%;
  color: #fff;
  background: transparent;
  border: 0;
  outline: 0;
}

.project-list {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
  scrollbar-color: rgba(215, 226, 239, .22) transparent;
}

.sidebar-empty {
  border: 1px dashed rgba(255,255,255,.16);
  border-radius: 8px;
  color: #b9c6d6;
  padding: 12px;
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.project-list::-webkit-scrollbar {
  width: 6px;
}

.project-list::-webkit-scrollbar-thumb {
  background: rgba(215, 226, 239, .18);
  background-clip: padding-box;
}

.project-list::-webkit-scrollbar-thumb:hover {
  background: rgba(215, 226, 239, .34);
  background-clip: padding-box;
}

.project-card,
.setting-item {
  text-align: left;
  border-radius: 8px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  color: #d7e2ef;
}

.project-card {
  padding: 10px 11px;
  min-height: 84px;
}

.project-card.active {
  background: #fff;
  color: #15202d;
}

.project-card h3 {
  margin: 0 0 7px;
  font-size: var(--fs-md);
  line-height: 1.38;
}

.project-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: var(--fs-xs);
  opacity: .72;
}

.progress {
  margin-top: 8px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.25);
  overflow: hidden;
}

.progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2463eb, #0f766e);
}

.setting-item {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.workspace {
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.title-block {
  min-width: 0;
}

.title-block small {
  color: var(--muted);
  font-size: var(--fs-xs);
}

.title-block h1 {
  margin: 3px 0 0;
  font-size: var(--fs-lg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-actions,
.inline-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.view,
.settings-view {
  display: none;
  flex: 1;
  min-height: 0;
}

.view.active {
  display: block;
}

.settings-view.active {
  display: block;
  overflow: auto;
  padding: 18px 22px;
}

#createProjectView.active {
  display: block;
  overflow: auto;
}

.project-layout {
  height: calc(100vh - 60px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--agent);
  min-height: 0;
  overflow: hidden;
}

.project-empty-state {
  height: calc(100vh - 60px);
  display: grid;
  place-items: center;
  padding: 24px;
}

.project-empty-card {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 24px;
  display: grid;
  gap: 12px;
  text-align: left;
}

.project-empty-card h2 {
  margin: 0;
  font-size: var(--fs-xl);
}

.project-empty-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.empty-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--blue-2);
  color: var(--blue);
  font-weight: 800;
}

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

.project-main {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: auto;
  padding: 0 22px var(--project-scroll-extra-bottom, 0px);
  scroll-padding-top: 0;
  overscroll-behavior: contain;
  --project-tabs-height: 41px;
  --project-tab-gap: 14px;
  --project-scroll-extra-bottom: 0px;
}

.agent-panel {
  position: relative;
  border-left: 1px solid var(--line);
  background: #fbfcfe;
  display: flex;
  height: 100%;
  overflow: hidden;
  min-width: 0;
  flex-direction: column;
}

.agent-panel.drag-over::after {
  content: "松开后自动上传资料，Agent 会整理入库";
  position: absolute;
  inset: 12px;
  z-index: 5;
  border: 2px dashed #8aa8ff;
  border-radius: 10px;
  background: rgba(246, 249, 255, .94);
  color: var(--blue);
  display: grid;
  place-items: center;
  font-size: var(--fs-md);
  font-weight: 800;
  pointer-events: none;
}

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

.compact-card {
  margin-top: 18px;
  margin-bottom: 12px;
}

.card-head {
  min-height: 40px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fbfcfe;
}

.card-head h2 {
  margin: 0;
  font-size: var(--fs-md);
}

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

.meta-grid {
  padding: 10px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.core-detail-list {
  display: grid;
  gap: 5px;
}

.core-detail-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 22px;
}

.core-detail-row span,
.core-status-item span {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
}

.core-detail-row strong,
.core-status-item strong {
  display: block;
  font-size: var(--fs-sm);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.core-detail-row.danger strong {
  color: var(--red);
}

.core-status-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  align-content: start;
  justify-items: end;
}

.core-status-item {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--soft);
  padding: 8px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.core-status-item.compact-status {
  width: 132px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 2px 0;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 7px;
}

.status-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  color: #fff !important;
  background: var(--blue);
  font-size: var(--fs-xs);
  font-weight: 800;
}

.compact-status .status-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--blue);
}

.compact-status div {
  min-width: 0;
}

.compact-status strong {
  white-space: nowrap;
}

.analysis-actions {
  margin: 0 10px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.analysis-actions strong {
  display: block;
  font-size: var(--fs-sm);
  margin-bottom: 3px;
}

.analysis-actions p {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.5;
}

.analysis-actions.info {
  background: #eef6ff;
  border-color: #bfdbfe;
}

.analysis-actions.success {
  background: #ecfdf3;
  border-color: #b7e4c7;
}

.analysis-actions.error {
  background: #fff1f0;
  border-color: #fecaca;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  overflow-x: auto;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
  padding-top: 4px;
  background: #f4f7fb;
}

.tab {
  height: 36px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  font-size: var(--fs-sm);
  font-weight: 700;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.tab-panel {
  display: none;
  min-height: 0;
}

.tab-panel.active {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--project-tabs-height);
  height: var(--project-active-panel-height, calc(100% - var(--project-tabs-height)));
  min-height: var(--project-active-panel-height, calc(100% - var(--project-tabs-height)));
  padding-top: var(--project-tab-gap);
  padding-bottom: var(--project-tab-gap);
  background: var(--bg);
  z-index: 10;
}

.tab-panel.active > .card {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.tab-panel.active > .card > .card-head {
  flex: 0 0 auto;
}

#todosPanel .todo-grid,
#subjectsPanel .subject-workspace,
#documentsPanel .document-layout,
#recordsPanel .record-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.todo-grid,
.record-grid,
.skill-grid {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.todo-grid {
  grid-template-columns: 1fr;
  gap: 8px;
}

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

.subject-workspace {
  padding: 10px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  background: #fff;
  overflow: hidden !important;
}

.subject-tabs {
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 2px;
}

.subject-tab {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #475467;
  text-align: center;
  position: relative;
}

.subject-tab.active {
  border-color: #9ab5ff;
  background: var(--blue-2);
  color: var(--blue);
  box-shadow: none;
}

.subject-tab span {
  font-size: var(--fs-xs);
  font-weight: 800;
}

.subject-tab small {
  min-width: 0;
  color: var(--muted);
  font-size: var(--fs-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subject-state-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #98a2b3;
  box-shadow: 0 0 0 2px #f2f4f7;
}

.subject-state-dot.normal {
  background: #16a34a;
  box-shadow: 0 0 0 2px #dcfce7;
}

.subject-state-dot.pending {
  background: #d97706;
  box-shadow: 0 0 0 2px #ffedd5;
}

.subject-state-dot.unknown {
  background: #98a2b3;
  box-shadow: 0 0 0 2px #eef2f6;
}

.subject-detail {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.todo-card,
.record-card,
.summary-card,
.skill-card,
.settings-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.todo-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 11px 12px;
}

.todo-level {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: var(--fs-xs);
  font-weight: 800;
  border: 1px solid currentColor;
}

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

.subject-detail-card {
  min-height: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
}

.subject-fact-card {
  gap: 14px;
}

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

.subject-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 800;
}

.subject-detail-head h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.subject-detail-section {
  display: grid;
  gap: 8px;
}

.subject-detail-section h4 {
  margin: 0;
  color: #475467;
  font-size: var(--fs-sm);
}

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

.subject-section-title span {
  color: var(--muted);
  font-size: var(--fs-xs);
  white-space: nowrap;
}

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

.subject-fact-summary div {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #f8fafc;
  padding: 9px 10px;
}

.subject-fact-summary strong {
  display: block;
  color: var(--ink);
  font-size: var(--fs-md);
  line-height: 1.2;
}

.subject-fact-summary span {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
}

.subject-detail-section ul {
  margin: 0;
  padding-left: 20px;
  color: #334155;
  font-size: var(--fs-sm);
  line-height: 1.65;
}

.subject-detail-section .muted-text {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-sm);
}

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

.subject-role {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
}

.subject-head h3 {
  margin: 0;
  font-size: var(--fs-md);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.subject-meta {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 4px 8px;
  padding: 8px;
  border-radius: 8px;
  background: var(--soft);
}

.subject-meta-wide {
  grid-template-columns: 72px minmax(0, 1fr);
  padding: 10px;
  gap: 8px 12px;
}

.subject-meta span {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
}

.subject-meta strong {
  min-width: 0;
  font-size: var(--fs-sm);
  overflow-wrap: anywhere;
}

.subject-block {
  display: grid;
  gap: 5px;
}

.subject-confirmed {
  padding: 8px;
  border-radius: 8px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

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

.fact-section {
  display: grid;
  gap: 7px;
}

.fact-section > strong {
  color: #334155;
  font-size: var(--fs-xs);
}

.fact-list {
  display: grid;
  gap: 6px;
}

.fact-row {
  display: block;
  padding: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
  user-select: text;
}

.fact-row summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 9px 10px;
}

.fact-row summary::-webkit-details-marker {
  display: none;
}

.fact-main {
  min-width: 0;
}

.fact-side {
  display: grid;
  justify-items: end;
  gap: 5px;
  min-width: 140px;
}

.fact-row.done {
  background: #f5fcf7;
  border-color: #c8ead5;
}

.fact-row.pending,
.fact-row.search {
  background: #fffaf0;
  border-color: #fde0a5;
}

.fact-row.missing {
  background: #fff6f6;
  border-color: #ffc9c9;
}

.fact-label {
  display: block;
  color: #1d2939;
  font-size: var(--fs-sm);
  font-weight: 800;
}

.fact-row p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fact-row[open] summary {
  align-items: flex-start;
}

.fact-row[open] p {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.fact-sources {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.source-badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  color: #667085;
  background: #fff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.source-badge.tag-blue {
  color: var(--blue);
  background: var(--blue-2);
  border-color: #c7d7ff;
}

.source-badge.tag-green {
  color: var(--green);
  background: var(--green-2);
  border-color: #bde6c8;
}

.source-badge.tag-amber {
  color: var(--amber);
  background: var(--amber-2);
  border-color: #fedca3;
}

.fact-detail-body {
  border-top: 1px solid var(--line-soft);
  padding: 8px 10px 10px;
  background: rgba(255, 255, 255, .72);
}

.fact-detail-body strong {
  display: block;
  margin-bottom: 5px;
  color: #475467;
  font-size: var(--fs-xs);
}

.fact-detail-value {
  margin: 0 0 8px;
  color: #1d2939;
  font-size: var(--fs-xs);
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.fact-detail-body ul {
  margin: 0;
  padding-left: 18px;
  color: #334155;
  font-size: var(--fs-xs);
  line-height: 1.55;
}

.subject-block > strong {
  font-size: var(--fs-xs);
  color: #475467;
}

.subject-block ul {
  margin: 0;
  padding-left: 18px;
  color: #334155;
  line-height: 1.55;
}

.subject-docs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.subject-docs span {
  max-width: 100%;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 3px 8px;
  color: #475467;
  background: #f8fafc;
  font-size: var(--fs-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subject-issues {
  border-top: 1px solid var(--line-soft);
  padding-top: 8px;
}

.record-card {
  width: 100%;
  color: inherit;
  text-align: left;
}

.record-card:hover,
.summary-card:hover,
.project-card:hover,
.setting-item:hover {
  filter: brightness(.985);
}

.todo-card h3,
.record-card h3,
.summary-card h3,
.skill-card h3 {
  margin: 0 0 6px;
  font-size: var(--fs-md);
}

.todo-card p,
.record-card p,
.summary-card p,
.skill-card p,
.settings-card p {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.55;
}

.document-layout,
.chat-layout,
.settings-layout {
  padding: 10px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
}

.document-layout {
  display: flex;
  flex-direction: column;
  overflow: hidden !important;
}

.inline-filters,
.document-head-filters {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.filter-pill {
  min-height: 26px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: #475467;
  padding: 0 10px;
  font-size: var(--fs-xs);
  font-weight: 700;
}

.filter-pill.active {
  color: var(--blue);
  background: var(--blue-2);
  border-color: #9ab5ff;
}

.compact-btn {
  min-height: 28px;
  padding: 0 10px;
  font-size: var(--fs-xs);
  border-radius: 7px;
  white-space: nowrap;
}

.document-head-filters label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  white-space: nowrap;
}

.document-head-filters select {
  height: 28px;
  width: 118px;
  max-width: 118px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 8px;
  font-size: var(--fs-xs);
}

.index-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 10px;
  display: grid;
  gap: 10px;
}

.filter-group h3 {
  margin: 0 0 7px;
  color: #475467;
  font-size: var(--fs-xs);
}

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

.chip {
  min-height: 26px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: #475467;
  background: #fff;
  padding: 4px 8px;
  font-size: var(--fs-xs);
  font-weight: 700;
}

.chip.active {
  color: var(--blue);
  background: var(--blue-2);
  border-color: #9ab5ff;
}

.table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: var(--fs-sm);
  background: #fff;
}

.doc-col-file {
  width: auto;
}

.doc-col-status {
  width: 150px;
}

#documentsPanel th:last-child,
#documentsPanel td:last-child {
  width: 150px;
  text-align: left;
}

.document-file-cell {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

th, td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f7f9fc;
  color: #475467;
  font-size: var(--fs-xs);
}

.file-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 24px;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  font-size: var(--fs-xxs);
  font-weight: 700;
  margin-right: 8px;
  flex: 0 0 auto;
}

.doc-name-wrap {
  min-width: 0;
  flex: 1 1 auto;
  display: block;
  overflow: hidden;
}

.doc-link {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  line-height: 1.35;
}

.doc-link.muted {
  cursor: default;
}

.doc-original-name {
  display: block;
  max-width: 100%;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.35;
}

.doc-original-name:hover {
  color: var(--ink);
}

.doc-link:hover {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.summary-card {
  text-align: left;
}

.summary-card.active {
  border-color: #9ab5ff;
  box-shadow: 0 0 0 3px rgba(36,99,235,.08);
}

.raw-chat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.raw-chat-head {
  min-height: 38px;
  border-bottom: 1px solid var(--line-soft);
  background: #f7f9fc;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.raw-message {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.raw-message time {
  color: var(--muted);
  font-size: var(--fs-xs);
}

.raw-message p {
  margin: 3px 0 0;
  color: #334155;
  font-size: var(--fs-sm);
  line-height: 1.55;
}

.agent-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 14px 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.agent-empty-chat {
  margin: auto 0;
  border: 1px dashed #c8d5ee;
  border-radius: 10px;
  background: #f8fbff;
  padding: 14px;
  color: #475467;
}

.agent-empty-chat strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: var(--fs-sm);
}

.agent-empty-chat p {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.55;
}

.agent-empty-chat small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.5;
}

.message {
  max-width: 92%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 9px 10px;
  box-sizing: border-box;
  overflow: visible;
}

.message.user {
  margin-left: auto;
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.message-thinking {
  max-width: 100%;
  background: #f3f6fb;
  color: var(--muted);
  border-style: dashed;
  padding: 7px 10px;
}

.message-thinking .message-title {
  color: var(--muted);
}

.message-action {
  max-width: 100%;
  border-left: 4px solid var(--green);
  background: #f3fbf6;
  border-color: #bfe8cf;
}

.message-error {
  max-width: 100%;
  border-left: 4px solid #e53935;
  background: #fff6f6;
  border-color: #ffc9c9;
}

.message-context {
  max-width: 100%;
  background: transparent;
  border-color: transparent;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 4px 0 10px;
  color: var(--muted);
}

.message-title {
  display: block;
  font-size: var(--fs-xs);
  margin-bottom: 6px;
}

.message-title span {
  float: right;
  color: inherit;
  opacity: .72;
  font-weight: 600;
}

.message-body {
  font-size: var(--fs-sm);
  line-height: 1.55;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message-body p {
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message-body p + p,
.message-body ul + p,
.message-body ol + p,
.message-body table + p,
.message-body blockquote + p {
  margin-top: 8px;
}

.message.user .message-body p {
  white-space: pre-wrap;
}

.agent-markdown h3,
.agent-markdown h4,
.agent-markdown h5,
.agent-markdown h6 {
  margin: 10px 0 6px;
  color: var(--text);
  font-size: var(--fs-sm);
  line-height: 1.35;
}

.agent-markdown h3:first-child,
.agent-markdown h4:first-child,
.agent-markdown h5:first-child,
.agent-markdown h6:first-child {
  margin-top: 0;
}

.agent-markdown ul,
.agent-markdown ol {
  margin: 6px 0 8px;
  padding-left: 1.3em;
}

.agent-markdown li {
  margin: 4px 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.agent-markdown blockquote {
  margin: 8px 0;
  padding: 6px 9px;
  border-left: 3px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
}

.agent-markdown code {
  border-radius: 5px;
  background: #eef2f7;
  padding: 1px 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92em;
}

.agent-markdown pre {
  margin: 8px 0;
  overflow: auto;
  border-radius: 8px;
  background: #101828;
  color: #f8fafc;
  padding: 10px;
}

.agent-markdown pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.agent-markdown a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.markdown-table-wrap {
  margin: 8px 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.agent-markdown table {
  width: 100%;
  min-width: 360px;
  border-collapse: collapse;
  font-size: var(--fs-xs);
}

.agent-markdown th,
.agent-markdown td {
  border-bottom: 1px solid var(--line-soft);
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.agent-markdown th {
  background: #f6f8fb;
  color: var(--text);
  font-weight: 700;
}

.agent-markdown tr:last-child td {
  border-bottom: 0;
}

.agent-compose {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 10px;
  display: grid;
  gap: 6px;
}

.agent-input-row {
  display: block;
}

.agent-input-row textarea {
  min-height: 96px;
  max-height: 180px;
  resize: none;
}

.agent-input-hint {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.45;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 9px;
  outline: 0;
  background: #fff;
}

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

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

.scope-grid label {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: var(--fs-sm);
}

.settings-layout {
  grid-template-columns: minmax(0, 1fr) 330px;
  align-items: start;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(320px, 38%) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.admin-list-card,
.admin-editor-card,
.placeholder-card {
  box-shadow: none;
}

.admin-list {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.admin-list-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}

.admin-list-item.active {
  border-color: #9ab5ff;
  box-shadow: 0 0 0 3px rgba(36,99,235,.08);
}

.admin-list-item h3 {
  margin: 0 0 5px;
  font-size: var(--fs-md);
}

.admin-list-item p {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.admin-form {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.admin-form label {
  display: grid;
  gap: 6px;
}

.admin-form label > span {
  color: #475467;
  font-size: var(--fs-xs);
  font-weight: 700;
}

.check-row {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 8px !important;
  color: #334155;
  font-size: var(--fs-sm);
}

.check-row input {
  width: auto;
}

.prompt-textarea {
  min-height: 170px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  line-height: 1.65;
}

.compact-textarea {
  min-height: 74px;
}

.code-textarea {
  min-height: 140px;
  white-space: pre;
}

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

.log-card {
  box-shadow: none;
}

.log-list {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.log-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 11px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 14px;
}

.log-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.log-title strong {
  font-size: var(--fs-md);
}

.log-main p {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.log-error {
  color: var(--red) !important;
}

.log-side {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  color: var(--muted);
  font-size: var(--fs-xs);
  white-space: nowrap;
}

.log-files {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line-soft);
  padding-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.log-files span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: #475467;
  padding: 4px 8px;
  font-size: var(--fs-xs);
}

.log-response {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line-soft);
  padding-top: 8px;
}

.log-response summary {
  cursor: pointer;
  color: #334155;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.log-response pre {
  max-height: 320px;
  overflow: auto;
  margin: 8px 0 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f172a;
  color: #e5edf7;
  padding: 10px;
  font-size: var(--fs-xs);
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.settings-cards {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.hidden {
  display: none !important;
}

.create-workspace {
  min-height: calc(100vh - 60px);
  padding: 22px;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 12px;
}

.create-card {
  width: min(820px, 100%);
}

.create-mode-tabs {
  width: min(820px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.mode-tab {
  height: 32px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.mode-tab.active {
  background: var(--blue);
  color: #fff;
}

.project-create-form,
.confirm-content {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.project-create-form label {
  display: grid;
  gap: 6px;
}

.project-create-form label > span {
  color: #475467;
  font-size: var(--fs-xs);
  font-weight: 700;
}

.project-create-form textarea {
  min-height: 110px;
}

.upload-intake {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.upload-zone {
  border: 1px dashed #9ab5ff;
  border-radius: 8px;
  background: #f7f9ff;
  color: #334155;
  min-height: 116px;
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 18px;
  text-align: center;
  cursor: pointer;
}

.upload-zone.drag-over {
  border-color: var(--blue);
  background: var(--blue-2);
  box-shadow: 0 0 0 3px rgba(36, 99, 235, .08);
}

.upload-zone strong {
  font-size: var(--fs-md);
}

.upload-zone span {
  max-width: 560px;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.55;
}

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

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

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

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

.file-row strong {
  display: block;
  font-size: var(--fs-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: var(--fs-xs);
}

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

.analysis-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 11px;
}

.analysis-state.success {
  border-color: #bde6c8;
  background: var(--green-2);
}

.analysis-state.error {
  border-color: #ffc7c1;
  background: var(--red-2);
}

.analysis-state.error strong {
  color: var(--red);
}

.analysis-state strong {
  display: block;
  margin-bottom: 4px;
  font-size: var(--fs-sm);
}

.analysis-state p {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.55;
}

.intake-review-grid {
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.intake-review-grid h3 {
  margin: 0 0 8px;
  font-size: var(--fs-sm);
}

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

.source-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: #fff;
}

.source-row span {
  display: block;
  color: var(--muted);
  font-size: var(--fs-xs);
  margin-bottom: 3px;
}

.source-row strong {
  display: block;
  font-size: var(--fs-sm);
}

.source-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.45;
}

.missing-list,
.risk-list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  list-style: none;
}

.missing-list li {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 9px;
  display: grid;
  gap: 4px;
}

.missing-list strong {
  font-size: var(--fs-sm);
}

.missing-list span,
.risk-list li {
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.5;
}

.missing-list em {
  justify-self: start;
  border-radius: 999px;
  background: var(--amber-2);
  color: var(--amber);
  padding: 2px 7px;
  font-size: var(--fs-xxs);
  font-style: normal;
  font-weight: 700;
}

.risk-list {
  margin-top: 10px;
}

.risk-list li {
  border-left: 3px solid var(--amber);
  background: var(--amber-2);
  border-radius: 6px;
  padding: 8px 9px;
}

.project-create-form label.has-error input,
.project-create-form label.has-error textarea,
.project-create-form label.has-error select {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, .08);
}

.empty-state {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--muted);
  padding: 12px;
  font-size: var(--fs-sm);
  line-height: 1.55;
}

.modal-layer {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
}

.modal-layer.active {
  display: block;
}

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

.modal {
  position: absolute;
  top: 10vh;
  left: 50%;
  width: min(640px, calc(100vw - 32px));
  max-height: 80vh;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .24);
  overflow: hidden;
}

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

.modal-head h2 {
  margin: 0;
  font-size: var(--fs-lg);
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #eef2f6;
  color: #475467;
  font-size: var(--fs-lg);
  line-height: 1;
}

.modal-body {
  max-height: calc(80vh - 48px);
  overflow: auto;
  padding: 13px;
}

.modal-form,
.detail-stack {
  display: grid;
  gap: 12px;
}

.modal-form label {
  display: grid;
  gap: 6px;
}

.modal-form label > span {
  color: #475467;
  font-size: var(--fs-xs);
  font-weight: 700;
}

.modal-form label.has-error input {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, .08);
}

.field-error {
  color: var(--red);
  font-size: var(--fs-xs);
}

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

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

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: var(--fs-xs);
}

.detail-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--soft);
}

.confirm-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.confirm-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: #fff;
}

.confirm-row:last-child {
  border-bottom: 0;
}

.confirm-row span {
  color: var(--muted);
  font-size: var(--fs-sm);
}

.confirm-row strong {
  color: var(--text);
  font-size: var(--fs-sm);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.output-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 12px;
}

.output-preview h3 {
  margin: 0 0 8px;
  font-size: var(--fs-md);
}

.output-preview p,
.output-preview li,
.detail-stack p {
  color: #334155;
  font-size: var(--fs-sm);
  line-height: 1.65;
}

.output-preview p,
.detail-stack p {
  margin: 0;
}

.output-preview ul {
  margin: 0;
  padding-left: 18px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  border: 1px solid #bde6c8;
  border-radius: 8px;
  background: var(--green-2);
  color: var(--green);
  padding: 10px 12px;
  box-shadow: var(--shadow);
  font-size: var(--fs-sm);
  font-weight: 700;
}

@media (max-width: 1240px) {
  .project-layout {
    grid-template-columns: 1fr;
  }
  .agent-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .document-layout,
  .chat-layout,
  .settings-layout,
  .admin-layout {
    grid-template-columns: 1fr;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .meta-grid {
    grid-template-columns: 1fr;
  }
  .core-status-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .card-head {
    align-items: flex-start;
  }
  .document-head-filters {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .core-status-list {
    grid-template-columns: 1fr;
  }
  .document-head-filters,
  .inline-filters {
    width: 100%;
    justify-content: flex-start;
  }
  .document-head-filters label {
    flex: 1 1 120px;
  }
  .document-head-filters select {
    width: 100%;
    max-width: none;
  }
}
