:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #6366f1;
  --accent-soft: #eef2ff;
  --accent-strong: #4f46e5;
  --rail: #1f2937;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
}

html {
  scroll-behavior: smooth;
  height: 100%;
}

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

.app-shell {
  height: 100vh;
  display: flex;
  background: var(--bg);
}

.rail {
  width: 80px;
  background: var(--rail);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04);
}

.rail-body {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.rail-brand {
  width: 100%;
  aspect-ratio: 1;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.rail-logo {
  width: 44px;
  height: auto;
  color: #f8fafc;
}

.workspace-header p,
.document-head p,
.panel p,
.field span,
.filter-group span,
.toolbar-label,
.results-title {
  color: var(--muted);
}

.rail-nav {
  display: grid;
  gap: 0;
  width: 100%;
  padding: 8px 0;
}

.rail-footer {
  margin-top: auto;
  width: 100%;
  padding: 10px 0 14px;
}

.nav-item,
.decision-card,
.primary-button,
.link-button {
  border: 0;
  cursor: pointer;
}

.nav-item {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 12px;
  border-radius: 0;
  background: transparent;
  color: #cbd5e1;
}

.nav-item span {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  transition: background-color 140ms ease, color 140ms ease;
}

.nav-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}

.nav-label {
  display: none;
}

.nav-item.is-active {
  color: #f8fafc;
}

.nav-item.is-active span {
  background: rgba(255, 255, 255, 0.12);
  color: var(--accent);
}

.nav-item:hover span {
  background: rgba(255, 255, 255, 0.1);
}

.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: none;
}

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

.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.field,
.filter-group {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  color: #334155;
}

.checkbox {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.workspace {
  flex: 1;
  min-width: 0;
  height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.workspace-header h1,
.panel h2,
.panel h3,
.panel h4 {
  margin: 0;
}

.workspace-header {
  background: white;
  border-bottom: 1px solid var(--line);
  padding: 12px 20px;
  flex: 0 0 auto;
}

.workspace-heading h1 {
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
}

.workspace-heading p {
  margin-top: 2px;
  font-size: 0.9rem;
}

.toolbar {
  margin: 0;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  padding: 12px 20px;
  display: grid;
  grid-template-columns: minmax(220px, 24%) 1fr auto;
  gap: 24px;
  align-items: center;
  flex: 0 0 auto;
  background: white;
}

.toolbar-notice {
  grid-column: 1 / -1;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.92rem;
}

.toolbar-notice.is-success {
  background: #ecfdf5;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.toolbar-notice.is-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.toolbar-search input {
  width: 100%;
  border: 0;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 11px 12px 11px 38px;
  color: #0f172a;
}

.toolbar-search {
  position: relative;
}

.toolbar-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  color: #64748b;
  transform: translateY(-50%);
}

.toolbar-search-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

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

.toolbar-reset {
  justify-self: start;
  padding-top: 0;
  white-space: nowrap;
}

.filter-dropdown {
  position: relative;
}

.filter-dropdown summary {
  list-style: none;
  cursor: pointer;
  color: #374151;
  font-size: 0.92rem;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.filter-dropdown summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 1.5px solid #94a3b8;
  border-bottom: 1.5px solid #94a3b8;
  transform: rotate(45deg) translateY(-1px);
}

.filter-dropdown[open] summary::after {
  transform: rotate(225deg) translateY(-1px);
}

.filter-dropdown summary::-webkit-details-marker {
  display: none;
}

.filter-dropdown-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 20;
  width: max-content;
  min-width: 320px;
  max-width: 460px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
}

.dropdown-section + .dropdown-section {
  margin-top: 14px;
}

.dropdown-title {
  display: block;
  margin-bottom: 8px;
  font-size: 0.84rem;
  font-weight: 700;
  color: #64748b;
}

.dropdown-option {
  display: block;
  margin-bottom: 6px;
  font-size: 0.92rem;
  color: #334155;
}

.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 700;
}

.toolbar-side-controls {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.toolbar-side-controls .field {
  margin-top: 0;
  min-width: 150px;
}

.case-info-dropdown {
  position: relative;
}

.case-info-button {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  white-space: nowrap;
}

.case-info-button::-webkit-details-marker {
  display: none;
}

.case-info-icon {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
}

.case-info-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 25;
  width: min(360px, 80vw);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
}

.case-info-panel h3 {
  margin: 0 0 12px;
}

.import-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #334155;
  background: #f8fafc;
  border: 1px solid var(--line);
  white-space: nowrap;
}

.import-control input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.remove-control {
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #b91c1c;
  background: #fef2f2;
  white-space: nowrap;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.42);
  padding: 24px;
}

.modal-card {
  width: min(560px, 100%);
  padding: 24px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.22);
}

.settings-backdrop {
  align-items: stretch;
  justify-content: flex-start;
  padding: 24px 24px 24px 120px;
}

.settings-card {
  width: min(780px, calc(100vw - 160px));
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.modal-body {
  display: grid;
  gap: 8px;
}

.settings-body {
  gap: 18px;
}

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

.settings-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.32fr) minmax(0, 0.68fr);
  gap: 18px;
  min-height: 0;
}

.settings-sidebar {
  display: grid;
  gap: 10px;
  align-content: start;
}

.settings-main {
  display: grid;
  gap: 16px;
  align-content: start;
}

.settings-nav {
  display: grid;
  gap: 8px;
}

.settings-section-button {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  text-align: left;
  color: #334155;
}

.settings-section-button.is-active {
  border-color: #818cf8;
  background: #eef2ff;
  color: #4338ca;
}

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

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

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

.settings-connections-head h4 {
  margin: 0;
  color: #334155;
}

.settings-connection-list-horizontal {
  grid-template-columns: repeat(auto-fit, minmax(170px, 220px));
}

.settings-connection-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
  text-align: left;
  display: block;
  color: #334155;
}

.settings-connection-item strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
}

.settings-connection-item.is-active {
  border-color: #818cf8;
  background: #eef2ff;
}

.settings-pane-section,
.settings-connection-editor {
  display: grid;
  gap: 12px;
}

.settings-pane-section h4 {
  margin: 0;
  color: #334155;
}

.settings-mode-note {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #dbeafe;
  background: #eff6ff;
}

.settings-mode-note p {
  margin: 0;
  color: #1e3a8a;
  line-height: 1.5;
}

.settings-inline-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.settings-inline-actions-start {
  justify-content: flex-start;
  align-items: center;
}

.settings-model-catalog {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #dbeafe;
  background: #f8fbff;
}

.settings-model-status {
  color: #1d4ed8;
  font-size: 0.92rem;
}

.settings-model-help,
.settings-model-error {
  margin: 0;
  line-height: 1.5;
}

.settings-model-help {
  color: #475569;
}

.settings-model-error {
  color: #b91c1c;
}

.link-button.settings-add-button {
  padding: 8px 10px;
  font-size: 0.92rem;
  line-height: 1.2;
  border-radius: 10px;
  border: 1px solid #c7d2fe;
  background: linear-gradient(180deg, #ffffff 0%, #eef2ff 100%);
  color: #4338ca;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 6px 14px rgba(99, 102, 241, 0.08);
}

.link-button.settings-add-button:hover {
  border-color: #a5b4fc;
  background: linear-gradient(180deg, #ffffff 0%, #e0e7ff 100%);
  color: #3730a3;
}

.link-button.settings-delete-button {
  padding: 8px 10px;
  font-size: 0.92rem;
  line-height: 1.2;
  border-radius: 10px;
  border: 1px solid #fecaca;
  background: linear-gradient(180deg, #ffffff 0%, #fef2f2 100%);
  color: #b91c1c;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 6px 14px rgba(239, 68, 68, 0.08);
}

.link-button.settings-delete-button:hover {
  border-color: #fca5a5;
  background: linear-gradient(180deg, #ffffff 0%, #fee2e2 100%);
  color: #991b1b;
}

.settings-textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  color: #1e293b;
  background: #fff;
  line-height: 1.55;
}

.analysis-prompt-preview {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  background: #f8fafc;
  color: #334155;
  font: inherit;
}

.settings-section {
  display: grid;
  gap: 10px;
  align-content: start;
}

.settings-section h4 {
  margin: 0;
  color: #334155;
}

.settings-note {
  padding: 14px 16px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.settings-note p {
  margin: 0;
}

.link-button.modal-close {
  padding: 8px 10px;
  font-size: 0.92rem;
  line-height: 1.2;
  border-radius: 10px;
  border: 1px solid #dbe4f0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  color: #475569;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 6px 14px rgba(148, 163, 184, 0.08);
}

.link-button.modal-close:hover {
  border-color: #cbd5e1;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  color: #334155;
}

.danger-button {
  background: #b91c1c;
}

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

.import-case-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  background: #f8fafc;
}

.import-doc-preview {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
}

.import-doc-preview p {
  margin: 0 0 6px;
  color: #475569;
  font-size: 0.92rem;
}

.match-card.is-saved {
  border-color: #93c5fd;
  background: #eff6ff;
}

.match-card.is-selected {
  border-color: #94a3b8;
  background: #f8fafc;
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.14);
}

.match-card.is-saved.is-selected {
  border-color: #60a5fa;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.18);
}

.link-button.mark-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  margin-top: 10px;
  border-radius: 10px;
  border: 1px solid #86efac;
  background: linear-gradient(180deg, #f7fef9 0%, #dcfce7 100%);
  color: #166534;
  font-size: 0.85rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), 0 4px 10px rgba(34, 197, 94, 0.08);
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.link-button.mark-button:hover {
  border-color: #4ade80;
  background: linear-gradient(180deg, #f0fdf4 0%, #bbf7d0 100%);
  color: #14532d;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86), 0 6px 14px rgba(34, 197, 94, 0.12);
}

.link-button.mark-button.is-active {
  border-color: #fca5a5;
  background: linear-gradient(180deg, #fff7f7 0%, #fee2e2 100%);
  color: #991b1b;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68), 0 6px 14px rgba(239, 68, 68, 0.12);
}

.workspace-stage {
  display: grid;
  grid-template-columns: minmax(300px, 30%) 1fr;
  flex: 1;
  min-height: 0;
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.workspace-stage-single {
  grid-template-columns: 1fr;
}

.results-panel {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: 0;
  overflow: hidden;
  height: 100%;
  background: white;
}

.results-panel-inner {
  padding: 18px;
  height: 100%;
  overflow: auto;
}

.results-group {
  margin-top: 18px;
}

.results-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.analysis-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.analysis-item,
.match-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.match-card {
  display: block;
  color: inherit;
  text-decoration: none;
}

.match-card > a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.match-card > a:hover,
.match-card > a:visited,
.match-card > a:active {
  color: inherit;
  text-decoration: none;
}

.match-card:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.match-rule-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.match-debug-list {
  display: grid;
  gap: 4px;
  margin: 0 0 10px;
}

.match-debug-list code {
  display: block;
  padding: 6px 8px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.analysis-item p,
.match-card p,
.analysis-sublist p,
.analysis-list p {
  margin: 0;
}

.analysis-sublist {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
}

.stage-main {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  min-width: 0;
  height: 100%;
  overflow: auto;
  background: white;
}

.stage-main-full {
  border-radius: 12px;
  margin: 20px;
}

.content-panel,
.summary-panel {
  padding: 20px;
}

.document-stack {
  display: grid;
  gap: 16px;
}

.document-card,
.matrix-card,
.hint-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.document-card {
  padding: 18px;
  margin-bottom: 16px;
}

.document-card.has-match {
  border-color: #c7d2fe;
}

.document-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.document-card p {
  line-height: 1.55;
}

.document-line {
  scroll-margin-top: 110px;
  padding: 4px 6px;
  margin: 0 -6px;
  border-radius: 6px;
}

.document-line.is-match {
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  padding-left: 10px;
}

.document-line.is-match:target {
  background: #fde68a;
  outline: 2px solid #f59e0b;
}

.matrix {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.signals-legacy-overview {
  position: relative;
  min-height: 72vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.signals-overview-core {
  position: relative;
  z-index: 2;
  font-size: 1.85rem;
  font-weight: 500;
  color: #94a3b8;
}

.signals-overview-connectors {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  width: 100%;
  height: 100%;
}

.signals-overview-connectors path {
  fill: none;
  stroke: #cbd5e1;
  stroke-width: 2.5;
  stroke-linecap: round;
}

.signals-overview-cards {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.signals-overview-card {
  position: absolute;
  width: min(31%, 340px);
  padding: 16px;
  border: 0;
  border-radius: 8px;
  background: white;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.signals-overview-card-1 {
  right: 65%;
  bottom: 70%;
}

.signals-overview-card-2 {
  right: 65%;
  top: 70%;
}

.signals-overview-card-3 {
  left: 65%;
  top: 70%;
}

.signals-overview-card-4 {
  left: 65%;
  bottom: 70%;
}

.signals-overview-title {
  font-size: 1.125rem;
  font-weight: 500;
  color: #475569;
}

.signals-overview-count {
  color: #334155;
}

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

.signals-status {
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  padding: 4px 8px;
  color: white;
  font-size: 0.92rem;
}

.signals-status-risk {
  background: #f43f5e;
}

.signals-status-resource {
  background: #10b981;
}

.signals-status-unclear {
  background: #64748b;
}

.signals-legacy-detail {
  --assignment-peek: 48px;
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 16px;
  min-height: 0;
  overflow: hidden;
  flex: 1 1 auto;
  padding-bottom: calc(var(--assignment-peek) + 12px);
}

.signals-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.signals-detail-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 500;
  color: #475569;
}

.signals-detail-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.signals-reset-button {
  white-space: nowrap;
}

.signals-back-button {
  border: 0;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.16);
  color: #6366f1;
  padding: 10px 12px;
  cursor: pointer;
}

.signals-matrix-shell {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.signals-subcategory-tabs {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.signals-subcategory-tab {
  flex: 0 0 auto;
  min-width: 0;
  max-width: 360px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
}

.signals-subcategory-tab.is-active {
  border-color: #818cf8;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.18);
}

.signals-subcategory-label {
  color: #334155;
  font-size: 0.94rem;
  line-height: 1.35;
  white-space: normal;
  text-wrap: balance;
}

.signals-subcategory-count {
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4f46e5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.72rem;
  padding: 0 5px;
  flex: 0 0 auto;
}

.signals-workspace {
  display: grid;
  grid-template-columns: minmax(300px, 0.42fr) minmax(0, 0.58fr);
  gap: 18px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.signals-source-column {
  min-height: 0;
  padding: 16px;
  overflow: auto;
}

.is-dragging-signal[data-active-drop-rating="open"] .signals-source-column {
  outline: 2px dashed #93c5fd;
  outline-offset: -2px;
  background: #f8fbff;
}

.signals-analysis-column {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 16px;
  overflow: hidden;
}

.signals-analysis-column > .llm-card {
  min-height: 0;
  height: 100%;
}

.signals-analysis-column h4 {
  margin: 0;
  color: #334155;
}

.signals-available-card.is-selected {
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.22);
}

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

.signals-available-card {
  padding: 10px 11px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.llm-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.llm-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex: 0 0 auto;
}

.analysis-pending {
  display: grid;
  gap: 10px;
  flex: 1 1 auto;
  overflow: auto;
  min-height: 0;
}

.analysis-pending p {
  margin: 0;
  color: #475569;
  line-height: 1.5;
}

.analysis-pending.is-error p {
  color: #991b1b;
}

.assignment-dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  margin-top: 0;
  padding-top: 6px;
  background: transparent;
  overflow: hidden;
  pointer-events: none;
}

.assignment-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 0;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
  box-shadow: none;
  align-items: end;
  background: transparent;
  pointer-events: none;
}

.signals-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.signals-panel > .panel-header {
  flex: 0 0 auto;
}

.assignment-zone {
  min-height: 240px;
  position: relative;
  background: transparent;
  overflow: hidden;
  pointer-events: none;
}

.assignment-zone-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  transform: translateY(calc(100% - var(--assignment-peek)));
  transition: transform 180ms ease;
  background: transparent;
  pointer-events: none;
}

.assignment-zone-head {
  min-height: 36px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  pointer-events: auto;
}

.assignment-zone-head h4 {
  margin: 0;
  font-size: 0.9rem;
}

.assignment-zone-risk .assignment-zone-head {
  background: #f43f5e;
  color: white;
}

.assignment-zone-resource .assignment-zone-head {
  background: #10b981;
  color: white;
}

.assignment-zone-unclear .assignment-zone-head {
  background: #cbd5e1;
  color: #334155;
}

.assignment-zone-irrelevant .assignment-zone-head {
  background: #e2e8f0;
  color: #334155;
}

.assignment-zone-body {
  flex: 1;
  border: 0;
  background: rgba(255, 255, 255, 0.96);
  pointer-events: auto;
}

.assignment-zone-list {
  display: grid;
  gap: 8px;
  min-height: 188px;
  max-height: 290px;
  overflow: auto;
  padding: 10px;
}

.assignment-zone:has(.assignment-zone-head:hover) .assignment-zone-inner,
.assignment-zone:has(.assignment-zone-body:hover) .assignment-zone-inner,
.assignment-zone:focus-within .assignment-zone-inner {
  transform: translateY(0);
}

.is-dragging-signal[data-active-drop-rating="risk"] .assignment-zone-risk .assignment-zone-inner,
.is-dragging-signal[data-active-drop-rating="resource"] .assignment-zone-resource .assignment-zone-inner,
.is-dragging-signal[data-active-drop-rating="unclear"] .assignment-zone-unclear .assignment-zone-inner,
.is-dragging-signal[data-active-drop-rating="irrelevant"] .assignment-zone-irrelevant .assignment-zone-inner {
  transform: translateY(0);
}

.matrix-group {
  display: grid;
  gap: 12px;
}

.matrix-group > h3 {
  margin: 0;
  font-size: 1.15rem;
  color: #334155;
}

.matrix-card {
  padding: 16px;
  display: grid;
  gap: 10px;
}

.matrix-card h4 {
  margin: 0;
  color: #334155;
}

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

.hint-card {
  padding: 12px;
}

.hint-meta,
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4f46e5;
  font-size: 0.8rem;
  font-weight: 600;
}

.evaluation-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.evaluation-toolbar {
  margin: 0;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  background: white;
}

.evaluation-toolbar-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.evaluation-toolbar h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: #334155;
}

.evaluation-folder-button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.16);
  color: #6366f1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.evaluation-folder-button svg {
  width: 20px;
  height: 20px;
}

.evaluation-folder-button.is-active {
  background: rgba(99, 102, 241, 0.24);
}

.evaluation-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 0 minmax(0, 1fr);
  overflow: hidden;
  transition: grid-template-columns 220ms ease;
}

.evaluation-body.has-overview {
  grid-template-columns: minmax(420px, 48vw) minmax(320px, 1fr);
}

.evaluation-overview {
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid transparent;
  background: rgba(255, 255, 255, 0.96);
  opacity: 0;
  transition: opacity 180ms ease, border-color 180ms ease;
}

.evaluation-overview.is-open {
  opacity: 1;
  border-right-color: var(--line);
}

.evaluation-overview-panel {
  height: 100%;
  background: transparent;
  overflow: auto;
}

.evaluation-overview-table {
  min-width: 0;
  min-height: 100%;
}

.evaluation-overview-grid {
  display: grid;
  grid-template-columns: minmax(190px, 0.95fr) repeat(3, minmax(0, 1fr));
}

.evaluation-overview-grid-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(255, 255, 255, 0.98);
}

.evaluation-overview-corner {
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}

.evaluation-overview-head {
  padding: 12px 14px;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}

.evaluation-overview-head h3 {
  margin: 0;
  font-size: 0.96rem;
}

.evaluation-overview-head-unclear {
  border-right: 0;
}

.evaluation-overview-head-risk {
  background: #f43f5e;
  color: white;
}

.evaluation-overview-head-resource {
  background: #10b981;
  color: white;
}

.evaluation-overview-head-unclear {
  background: #cbd5e1;
  color: #334155;
}

.evaluation-overview-section {
  display: grid;
}

.evaluation-overview-group-title {
  grid-column: 1 / -1;
  padding: 11px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #64748b;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}

.evaluation-overview-grid-row {
  min-height: 100px;
}

.evaluation-overview-subcategory-label {
  padding: 12px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  background: rgba(248, 250, 252, 0.7);
}

.evaluation-overview-cell {
  padding: 12px;
  display: grid;
  gap: 10px;
  align-content: start;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}

.evaluation-overview-grid-row .evaluation-overview-cell:last-child {
  border-right: 0;
}

.evaluation-overview-card {
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.evaluation-content {
  min-height: 0;
  overflow: auto;
}

.evaluation-shell {
  padding: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100%;
}

.decision-panel {
  width: min(560px, 100%);
  padding: 30px 32px;
  border-radius: 14px;
}

.summary-panel {
  width: min(680px, 100%);
}

.summary-panel-indeterminate {
  display: grid;
  gap: 22px;
  padding: 30px 32px;
  border-radius: 14px;
}

.evaluation-result-head {
  display: grid;
  gap: 6px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e2e8f0;
}

.evaluation-result-head span {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

.evaluation-result-head h3 {
  margin: 0;
  font-size: 1.28rem;
  line-height: 1.3;
  font-weight: 600;
  color: #0f172a;
}

.evaluation-edit-block {
  display: grid;
  gap: 10px;
}

.evaluation-edit-block h4 {
  margin: 0;
  font-size: 0.83rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #475569;
}

.evaluation-textarea {
  width: 100%;
  min-height: 144px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  color: #1e293b;
  background: #f8fafc;
  line-height: 1.55;
  font-size: 0.96rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.evaluation-textarea:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
  background: #fff;
}

.evaluation-actions {
  justify-content: space-between;
  align-items: center;
  padding-top: 6px;
}

.evaluation-actions .link-button {
  padding: 10px 14px;
  border-radius: 10px;
  color: #475569;
  background: #f8fafc;
}

.evaluation-actions .link-button:hover {
  background: #f1f5f9;
}

.evaluation-actions .primary-button {
  padding: 11px 16px;
  border-radius: 10px;
}

.decision-intro {
  margin: 0 0 18px;
  font-size: 0.96rem;
  line-height: 1.55;
}

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

.decision-card {
  padding: 14px 16px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #d1d5db;
  text-align: left;
  font-size: 0.92rem;
  line-height: 1.45;
}

.decision-card strong {
  font-weight: 600;
}

.decision-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.primary-button {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
}

.reset-danger-button,
.reset-danger-soft-button {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(190, 24, 93, 0.14);
  color: #8a1c3a;
  backdrop-filter: blur(4px);
  white-space: nowrap;
}

.reset-danger-button {
  background:
    linear-gradient(180deg, rgba(255, 250, 251, 0.96) 0%, rgba(254, 226, 226, 0.92) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 8px 18px rgba(244, 63, 94, 0.08);
}

.reset-danger-button:hover {
  background:
    linear-gradient(180deg, rgba(255, 247, 248, 0.98) 0%, rgba(254, 205, 211, 0.94) 100%);
  color: #7f1d1d;
}

.reset-danger-soft-button {
  background:
    linear-gradient(180deg, rgba(255, 252, 252, 0.95) 0%, rgba(255, 241, 242, 0.92) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 6px 14px rgba(244, 63, 94, 0.06);
}

.reset-danger-soft-button:hover {
  background:
    linear-gradient(180deg, rgba(255, 248, 249, 0.98) 0%, rgba(255, 228, 230, 0.94) 100%);
  color: #7f1d1d;
}

.toolbar-reset-case {
  white-space: nowrap;
}

.link-button {
  padding: 10px 0;
  background: transparent;
  color: #4b5563;
}

.empty-state,
.empty-mini {
  padding: 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  color: var(--muted);
  background: #f8fafc;
}

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

  .rail {
    width: auto;
    flex-direction: row;
    justify-content: space-between;
  }

  .rail-body {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .rail-brand {
    width: 72px;
  }

  .rail-nav {
    display: flex;
    width: auto;
    padding: 8px;
  }

  .nav-item {
    padding: 8px;
  }

  .rail-footer {
    width: auto;
    padding: 8px;
  }

  .settings-backdrop {
    padding: 16px;
  }

  .settings-card {
    width: 100%;
    max-height: none;
  }

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

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

  .settings-connections-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .settings-connection-list-horizontal {
    grid-template-columns: 1fr;
  }

  .toolbar {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .toolbar-side-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .workspace-stage {
    grid-template-columns: 1fr;
    gap: 12px;
    overflow: auto;
    padding: 12px;
  }

  .results-panel,
  .stage-main {
    border-radius: 12px;
    border-right: 1px solid var(--line);
  }

  .stage-main-full {
    margin: 0;
  }

  body {
    overflow: auto;
  }

  .matrix-card {
    grid-template-columns: 1fr;
  }

  .signals-legacy-overview {
    min-height: auto;
    display: grid;
    gap: 16px;
    justify-items: stretch;
  }

  .signals-overview-cards {
    position: static;
    display: grid;
    gap: 12px;
  }

  .signals-overview-connectors {
    display: none;
  }

  .signals-overview-card {
    position: static;
    width: auto;
  }

  .signals-workspace,
  .assignment-bar {
    grid-template-columns: 1fr;
  }

  .evaluation-body,
  .evaluation-body.has-overview {
    grid-template-columns: 1fr;
  }

  .evaluation-overview {
    display: none;
  }

  .evaluation-overview-grid {
    grid-template-columns: 1fr;
  }

  .document-head {
    flex-direction: column;
  }
}
