:root {
  color-scheme: dark;
  --ink: #05070b;
  --graphite: #0b0f14;
  --graphite-2: #101720;
  --graphite-3: #151f2a;
  --panel: #0f151d;
  --panel-2: #121a24;
  --cyan: #2ee9ff;
  --cyan-soft: rgba(46, 233, 255, 0.18);
  --green: #61f2a7;
  --green-soft: rgba(97, 242, 167, 0.16);
  --amber: #ffd166;
  --amber-soft: rgba(255, 209, 102, 0.17);
  --magenta: #ff4fd8;
  --magenta-soft: rgba(255, 79, 216, 0.14);
  --blue-accent: #6aa9ff;
  --border: rgba(174, 198, 216, 0.18);
  --border-strong: rgba(46, 233, 255, 0.36);
  --text: #f2f7fb;
  --muted: #8fa1b2;
  --ok: var(--green);
  --danger: #ff5c7a;
  --black: var(--graphite);
  --black-2: var(--graphite-2);
  --red: #15131b;
  --red-accent: var(--magenta);
  --blue: var(--graphite);
  --blue-2: var(--graphite-2);
  --yellow: #151309;
  --yellow-accent: var(--amber);
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

.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;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 16%, rgba(46, 233, 255, 0.1), transparent 30%),
    radial-gradient(circle at 78% 74%, rgba(255, 79, 216, 0.09), transparent 32%),
    var(--ink);
}

.login-view[hidden],
.app-frame[hidden] {
  display: none;
}

.login-panel {
  width: min(460px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  background: rgba(11, 15, 20, 0.92);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.52), 0 0 40px rgba(46, 233, 255, 0.06);
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--cyan), var(--magenta) 58%, var(--amber));
  color: white;
  font-size: 24px;
  font-weight: 800;
  box-shadow: 0 0 24px rgba(46, 233, 255, 0.24);
}

.brand-mark.small {
  width: 28px;
  height: 28px;
  font-size: 16px;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 0;
  font-size: 16px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 6px;
  font-size: 16px;
  line-height: 1.2;
}

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

.primary-button,
.ghost-button,
.utility-button,
.global-tab,
.blue-tab,
.module,
.icon-button,
.yellow-button {
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  background: var(--panel-2);
  min-height: 32px;
  padding: 0 10px;
}

.primary-button {
  background: linear-gradient(180deg, rgba(46, 233, 255, 0.28), rgba(46, 233, 255, 0.13));
  border-color: rgba(46, 233, 255, 0.58);
  color: #ecfeff;
  box-shadow: 0 0 18px rgba(46, 233, 255, 0.1);
}

.ghost-button {
  background: transparent;
}

.ghost-button.danger {
  border-color: rgba(244, 63, 94, 0.55);
  color: #fecdd3;
  background: rgba(244, 63, 94, 0.08);
}

.utility-button {
  background: var(--panel-2);
  color: #d8e5ef;
}

.utility-button.danger {
  border-color: rgba(244, 63, 94, 0.55);
  color: #fecdd3;
}

.demo-role-row,
.ask-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.login-form {
  display: grid;
  gap: 8px;
}

.language-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  width: max-content;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(7, 16, 25, 0.78);
}

.language-switch.compact {
  align-self: center;
}

.language-switch button {
  min-width: 34px;
  min-height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.language-switch button.active {
  background: var(--cyan-soft);
  color: #ecfeff;
}

.login-form label,
.ask-box label {
  color: var(--muted);
  font-size: 12px;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--text);
  background: #091018;
}

.ghost-link {
  color: #bfdbfe;
  text-decoration: none;
}

.ghost-link:hover {
  text-decoration: underline;
}

.app-frame {
  min-height: 100vh;
  display: grid;
  position: relative;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 44px calc(108vh - 48px) auto;
  overflow: visible;
}

.black-layer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  background: rgba(5, 7, 11, 0.96);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
}

.icon-button {
  width: 32px;
  padding: 0;
}

.blue-tabs,
.black-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.global-tab.active,
.workbench-tab.active,
.blue-tab.active {
  background: var(--cyan-soft);
  border-color: rgba(46, 233, 255, 0.58);
}

.black-actions {
  margin-left: auto;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.status-pill,
.badge {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  color: #cfe4ef;
  background: rgba(10, 16, 23, 0.78);
  font-size: 12px;
  white-space: nowrap;
}

.badge.ok {
  border-color: rgba(97, 242, 167, 0.48);
  color: #c8ffe1;
}

.red-layer {
  position: absolute;
  z-index: 8;
  left: 12px;
  top: 132px;
  width: 520px;
  max-width: min(520px, calc(100% - 24px));
  height: calc(90vh - 136px);
  max-height: calc(90vh - 136px);
  grid-row: auto;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  background: rgba(9, 14, 20, 0.96);
  border: 1px solid rgba(46, 233, 255, 0.32);
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.58), 0 0 34px rgba(46, 233, 255, 0.08);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0;
}

.red-layer[hidden] {
  display: none;
}

.chat-anchor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  min-height: 38px;
  padding: 7px 9px 7px 11px;
  border-bottom: 1px solid rgba(46, 233, 255, 0.22);
  background: linear-gradient(90deg, rgba(46, 233, 255, 0.16), rgba(18, 26, 36, 0.92));
}

.chat-anchor-head strong {
  display: block;
  color: #dffbff;
  font-size: 13px;
  letter-spacing: 0;
}

.chat-anchor-head span {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}

.chat-anchor-head .icon-button {
  border-color: rgba(46, 233, 255, 0.36);
  background: rgba(15, 21, 33, 0.78);
}

.chat-anchor-head .icon-button:hover {
  border-color: rgba(254, 202, 202, 0.95);
  background: rgba(127, 29, 29, 0.45);
}

.chat-anchor-head .utility-button {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.red-layer.collapsed {
  width: 118px;
  min-height: 40px;
  max-height: none;
  grid-template-rows: auto;
}

.red-layer.collapsed .chat-stream,
.red-layer.collapsed .ask-box {
  display: none;
}

.chat-stream {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 10px 10px 8px;
  overscroll-behavior: contain;
}

.chat-message {
  border: 0;
  border-radius: 8px;
  padding: 9px 10px;
  background: rgba(18, 26, 36, 0.82);
}

.chat-message.user {
  border-color: rgba(46, 233, 255, 0.32);
  background: rgba(11, 28, 38, 0.86);
}

.chat-message strong {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  color: #dffbff;
}

.chat-message.user strong {
  color: #baf7ff;
}

.chat-message p {
  margin: 0;
  color: #e8edf5;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.chat-context-card {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid rgba(97, 242, 167, 0.22);
  border-radius: 8px;
  background: rgba(10, 22, 24, 0.82);
}

.chat-context-card strong {
  color: #eafff5;
  font-size: 13px;
  line-height: 1.35;
}

.chat-context-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.chat-context-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}

.chat-context-meta span {
  padding: 3px 6px;
  border: 1px solid rgba(46, 233, 255, 0.18);
  border-radius: 999px;
  background: rgba(7, 16, 25, 0.86);
  color: #cdeff4;
}

.node-chat-mode {
  display: inline-grid;
  grid-template-columns: auto auto;
  gap: 4px;
  margin-left: auto;
}

.node-chat-mode button {
  min-height: 26px;
  border: 1px solid rgba(46, 233, 255, 0.2);
  border-radius: 6px;
  background: rgba(7, 16, 25, 0.88);
  color: var(--muted);
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
}

.node-chat-mode button.active {
  border-color: rgba(46, 233, 255, 0.78);
  background: rgba(46, 233, 255, 0.16);
  color: #dffbff;
}

.node-chat-select {
  width: 100%;
  min-height: 32px;
  border: 1px solid rgba(46, 233, 255, 0.18);
  border-radius: 6px;
  background: #071019;
  color: var(--text);
  padding: 0 8px;
}

.node-chat-select:disabled {
  opacity: 0.48;
}

.ask-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ask-actions span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.module {
  width: 100%;
  min-height: 58px;
  display: grid;
  gap: 3px;
  margin-bottom: 8px;
  padding: 9px 10px;
  text-align: left;
  background: #211c25;
}

.module.active {
  border-color: rgba(229, 72, 77, 0.75);
  background: rgba(229, 72, 77, 0.14);
}

.module span {
  font-weight: 700;
}

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

.ask-box {
  margin-top: 0;
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 0;
  border-top: 1px solid rgba(46, 233, 255, 0.16);
  border-radius: 0;
  background: rgba(8, 13, 19, 0.96);
}

.ask-box label {
  color: var(--muted);
  font-size: 12px;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 64px;
  max-height: 112px;
  padding: 9px;
  border: 0;
  border-radius: 6px;
  background: #071019;
  color: var(--text);
  line-height: 1.45;
}

.blue-layer {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--graphite);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.blue-tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 10px 14px;
  background: rgba(17, 24, 39, 0.96);
  border-bottom: 1px solid var(--border);
}

.source-banner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin: 0;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(46, 233, 255, 0.16);
  background: #091018;
}

.source-banner span {
  color: var(--muted);
  margin-left: 8px;
}

.source-banner .blue-tabs {
  position: static;
  z-index: auto;
  padding: 0;
  margin-right: auto;
  background: transparent;
  border-bottom: 0;
}

.source-banner .blue-tab {
  min-height: 30px;
  white-space: nowrap;
}

.blue-view {
  display: none;
  padding: 0 14px 24px;
}

.blue-view.active {
  display: block;
}

.answer-panel,
.section-summary-panel,
.view-head,
.trace-output,
.table-wrap,
.object-card,
.audit-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
}

.answer-panel,
.section-summary-panel,
.view-head {
  padding: 16px;
  margin-bottom: 14px;
}

.answer-text {
  white-space: pre-wrap;
  line-height: 1.55;
}

.citation-grid,
.object-grid,
.audit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.audit-toolbar-card {
  grid-column: 1 / -1;
}

.audit-search-form {
  display: grid;
  grid-template-columns: minmax(110px, max-content) minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 10px;
}

.admin-search-form {
  margin: 2px 0 4px;
}

.audit-search-form label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.audit-log-row {
  display: grid;
  gap: 5px;
  padding: 10px 0;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.audit-log-row:first-of-type {
  border-top: 0;
}

.audit-log-row p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

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

.admin-output {
  display: grid;
  gap: 12px;
}

.topic-membership-strip {
  display: grid;
  grid-template-rows: auto auto;
  gap: 10px;
  min-width: 0;
  align-content: start;
  align-self: start;
  height: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(46, 233, 255, 0.14);
  border-radius: 8px;
  background: var(--panel);
}

.topic-membership-strip > h3 {
  margin: 0;
  font-size: 13px;
}

.topic-membership-groups {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-content: start;
  min-height: 0;
  overflow: visible;
}

.topic-membership-group {
  display: grid;
  gap: 7px;
  min-width: 0;
  min-height: 0;
}

.topic-membership-group h3 {
  margin: 0;
  color: #dbe4ef;
  font-size: 12px;
}

.topic-membership-list {
  display: grid;
  gap: 7px;
  overflow: auto;
  padding-right: 2px;
}

.topic-membership-pill {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 8px 9px;
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.topic-membership-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.topic-membership-top strong {
  color: #f8fafc;
}

.topic-membership-top span {
  color: #93c5fd;
  font-size: 11px;
  white-space: nowrap;
}

.topic-membership-pill p {
  margin: 0;
  color: #dbe4ef;
  font-size: 12px;
  line-height: 1.32;
}

.topic-membership-pill > span {
  color: var(--muted);
  font-size: 11px;
}

.topic-weight-bar {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(46, 233, 255, 0.9) var(--topic-share), rgba(51, 65, 85, 0.8) var(--topic-share));
}

.topic-membership-pill p,
.topic-membership-pill > span {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.admin-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.admin-metric {
  align-content: start;
  gap: 4px;
  min-height: 92px;
}

.admin-metric span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.admin-metric strong {
  font-size: 28px;
  line-height: 1;
}

.admin-metric small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 12px;
  align-items: start;
}

.admin-panel {
  display: grid;
  gap: 10px;
}

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

.admin-panel-head h2 {
  margin: 2px 0 0;
}

.admin-side-stack {
  display: grid;
  gap: 12px;
}

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

.admin-user-cell,
.admin-log-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.admin-user-cell strong,
.admin-log-row strong {
  display: block;
  color: #f2f7fb;
  font-size: 13px;
}

.admin-user-cell span,
.admin-log-row span,
.admin-log-row small,
.admin-subdate,
.admin-date {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.admin-date {
  color: #d8e5ef;
}

.admin-user-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(46, 233, 255, 0.28);
  border-radius: 6px;
  background: rgba(46, 233, 255, 0.12);
  color: #ecfeff;
  font-weight: 800;
  object-fit: cover;
}

.admin-log-row {
  align-items: start;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

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

.admin-event-list {
  display: grid;
  gap: 4px;
}

.admin-event-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.95fr) auto minmax(120px, 1.1fr) minmax(110px, auto);
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
}

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

.admin-event-row > * {
  min-width: 0;
}

.admin-event-user,
.admin-event-detail {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-event-user {
  color: #f2f7fb;
  font-weight: 700;
}

.admin-event-detail,
.admin-event-row time {
  color: var(--muted);
}

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

.admin-actions button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.admin-actions-compact {
  min-width: 220px;
}

.policy-row {
  display: grid;
  gap: 4px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.policy-row strong {
  color: #dffbff;
  font-size: 12px;
}

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

.citation-card,
.object-card,
.audit-card {
  padding: 12px;
}

.citation-card {
  border: 1px solid rgba(46, 233, 255, 0.22);
  border-radius: 8px;
  background: rgba(12, 21, 30, 0.96);
}

.citation-card button {
  margin-top: 8px;
}

.table-wrap {
  overflow: auto;
}

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

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

th {
  color: #dffbff;
  background: #101a24;
  font-size: 12px;
}

td {
  color: #dbe4ef;
  font-size: 13px;
}

.trace-output {
  min-height: 300px;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
  color: #d7e5ff;
}

.trace-output[hidden] {
  display: none;
}

.graph-stage {
  min-height: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  position: relative;
  height: 100%;
  background:
    linear-gradient(rgba(46, 233, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(46, 233, 255, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 66% 28%, rgba(46, 233, 255, 0.07), transparent 30%),
    #071019;
  background-size: 34px 34px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.graph-topline {
  position: relative;
  z-index: 3;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 7px 12px;
  border-bottom: 1px solid rgba(46, 233, 255, 0.16);
  background: rgba(7, 16, 25, 0.88);
}

.graph-scroll {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.graph-node-tooltip {
  position: absolute;
  z-index: 5;
  right: 14px;
  top: 64px;
  width: min(320px, calc(100% - 28px));
  max-height: min(360px, calc(100% - 78px));
  overflow: auto;
  padding: 0;
  border: 1px solid rgba(46, 233, 255, 0.28);
  border-radius: 8px;
  background: rgba(5, 10, 16, 0.92);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.36);
  transition: width 160ms ease, max-height 160ms ease;
}

.graph-node-tooltip[hidden] {
  display: none;
}

.graph-node-tooltip span,
.graph-node-tooltip strong {
  display: block;
}

.graph-node-tooltip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  padding: 5px 6px 5px 10px;
  border-bottom: 1px solid rgba(46, 233, 255, 0.18);
}

.graph-node-tooltip-head span {
  margin: 0;
}

.graph-node-tooltip-toggle {
  width: 26px;
  min-width: 26px;
  min-height: 24px;
  padding: 0;
  border: 1px solid rgba(46, 233, 255, 0.28);
  border-radius: 5px;
  background: rgba(15, 21, 33, 0.88);
  color: #eafcff;
  line-height: 1;
}

.graph-node-tooltip-body {
  padding: 8px 10px 10px;
}

.graph-node-tooltip.collapsed {
  width: 116px;
  max-height: 36px;
  overflow: hidden;
}

.graph-node-tooltip.collapsed .graph-node-tooltip-head {
  border-bottom: 0;
}

.graph-node-tooltip.collapsed .graph-node-tooltip-body {
  display: none;
}

.graph-node-tooltip span {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.graph-node-tooltip strong {
  color: #eafcff;
  font-size: 13px;
  line-height: 1.35;
}

.graph-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 5px 10px;
  min-width: 0;
}

.graph-summary span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
}

.node-search-form {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.node-search-input {
  min-height: 32px;
  width: min(320px, 42vw);
  min-width: 180px;
  padding: 0 10px;
  border-radius: 6px;
  background: #071019;
  border: 1px solid rgba(46, 233, 255, 0.22);
  color: var(--text);
  font-size: 13px;
}

.node-search-form .primary-button {
  min-height: 32px;
  padding: 0 11px;
  font-size: 12px;
}

.graph-legend {
  display: none;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.graph-tools {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
}

.graph-zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 2px;
  border: 1px solid rgba(46, 233, 255, 0.22);
  border-radius: 6px;
  background: rgba(11, 15, 24, 0.6);
}

.graph-zoom-controls .icon-button {
  width: 28px;
  min-height: 28px;
}

.graph-zoom-input {
  width: 48px;
  min-height: 28px;
  padding: 0 4px;
  border-radius: 4px;
  text-align: right;
  font-size: 12px;
}

.graph-zoom-unit {
  min-width: 10px;
  text-align: center;
  color: #dbe4ef;
  font-size: 11px;
}

.graph-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #dbe4ef;
  font-size: 12px;
}

.graph-legend i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.graph-legend.thesis-similarity-legend {
  display: flex;
}

.blue-layer:has(#graphStage[data-graph-view="thesis_similarity"]) {
  min-width: 0;
}

#graphStage[data-graph-view="thesis_similarity"] {
  grid-template-columns: minmax(0, 1fr);
}

.thesis-similarity-legend .search-hit-swatch {
  border: 2px solid #2ee9ff;
}

.thesis-similarity-legend .match-swatch {
  border: 2px solid #a78bfa;
}

.thesis-similarity-legend .candidate-swatch {
  border: 2px solid #ffd166;
}

.thesis-similarity-legend .similar-thesis-swatch {
  border: 2px dashed #ffd166;
}

.thesis-similarity-legend .reciprocal-swatch {
  width: 16px;
  height: 0;
  border-top: 3px solid #b4d4d8;
  border-radius: 0;
}

.similarity-warning {
  color: #ffd166;
  font-size: 12px;
}

.graph-canvas {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
}

.graph-backdrop {
  fill: transparent;
  pointer-events: all;
}

.graph-link.corpus-membership {
  stroke: rgba(255, 79, 216, 0.7);
}

.graph-link.document-macro-membership {
  stroke: rgba(46, 233, 255, 0.78);
}

.graph-link.document-fine-membership {
  stroke: rgba(255, 181, 71, 0.66);
}

.graph-link.people-membership {
  stroke: rgba(97, 242, 167, 0.58);
}

.graph-link.thesis-similarity-membership {
  stroke: rgba(46, 233, 255, 0.62);
}

.graph-link.supervisor-similarity-membership {
  stroke: rgba(255, 79, 216, 0.7);
  stroke-dasharray: 6 5;
}

.graph-link.selected {
  stroke: rgba(46, 233, 255, 0.95);
  opacity: 0.9 !important;
}

.graph-link.dimmed {
  opacity: 0.045 !important;
}

.corpus-graph-summary {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.corpus-view-tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  width: fit-content;
  padding: 2px;
  border: 1px solid rgba(46, 233, 255, 0.2);
  border-radius: 6px;
  background: rgba(5, 10, 16, 0.48);
}

.corpus-view-tab {
  min-height: 26px;
  padding: 0 9px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.corpus-view-tab.active {
  background: rgba(46, 233, 255, 0.16);
  color: #eafcff;
}

.corpus-summary-metrics {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  max-width: 100%;
}

.corpus-summary-metrics strong {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: #eafcff;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.corpus-graph-summary span {
  color: var(--muted);
  font-size: 11px;
}

.corpus-summary-line {
  display: block;
  max-width: 100%;
  overflow: hidden;
  line-height: 1.35;
}

.graph-node text,
.empty-graph text {
  fill: #eaf1fb;
  font-size: 14px;
  font-weight: 700;
}

.empty-graph text + text {
  fill: #b9c4d2;
  font-size: 12px;
  font-weight: 500;
}

.graph-node {
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.graph-node.dragging {
  cursor: grabbing;
}

.graph-link {
  stroke: rgba(148, 163, 184, 0.34);
  stroke-width: 1.1;
}

.graph-link.thesis_similarity {
  stroke: rgba(155, 193, 199, 0.6);
  stroke-width: 1.8;
  pointer-events: stroke;
}

.graph-link.thesis_similarity.reciprocal {
  stroke: #b4d4d8;
  stroke-width: 3;
}

.graph-node.similar_thesis .cell-core {
  stroke-dasharray: 5 3;
}

.graph-node.search_hit .cell-core {
  stroke-width: 2.5;
}

.graph-node:focus-visible .cell-core {
  stroke: #ffffff !important;
  stroke-width: 3;
}

.selection-detail-layout.thesis-similarity-details {
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
}

.thesis-similarity-details .node-chat-card {
  grid-column: 1 / -1;
}

.thesis-relationship-row {
  width: 100%;
  margin-top: 8px;
  overflow-wrap: anywhere;
}

.thesis-similarity-details .thesis-relationships {
  min-width: 0;
}

.selection-panel:has(.thesis-similarity-details) .selection-head {
  flex-wrap: wrap;
}

.selection-panel:has(.thesis-similarity-details) .selection-head > div {
  flex: 1 1 320px;
  min-width: 0;
}

.selection-panel:has(.thesis-similarity-details) .selection-head .utility-button {
  flex-shrink: 0;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .blue-layer:has(#graphStage[data-graph-view="thesis_similarity"]) .source-banner,
  .blue-layer:has(#graphStage[data-graph-view="thesis_similarity"]) .blue-tabs {
    flex-wrap: wrap;
  }
  .blue-layer:has(#graphStage[data-graph-view="thesis_similarity"]) #statusBadge {
    margin-left: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  #graphStage[data-graph-view="thesis_similarity"] .graph-topline {
    grid-template-columns: minmax(0, 1fr);
  }
  #graphStage[data-graph-view="thesis_similarity"] .graph-tools {
    flex-wrap: wrap;
    min-width: 0;
  }
  #graphStage[data-graph-view="thesis_similarity"] .node-search-input {
    flex: 1;
    width: 0;
    min-width: 0;
  }
  #graphStage[data-graph-view="thesis_similarity"] .node-search-form button {
    flex-shrink: 0;
  }
  .selection-detail-layout.thesis-similarity-details {
    grid-template-columns: minmax(0, 1fr);
  }
  .thesis-similarity-legend span {
    font-size: 10px;
  }
}

.graph-link.document_contains,
.graph-link.contains_section,
.graph-link.section_contains {
  stroke: rgba(94, 234, 212, 0.34);
}

.graph-link.section_contains {
  stroke-width: 1.4;
}

.graph-link.scoped_to_place {
  stroke: rgba(251, 146, 60, 0.5);
  stroke-dasharray: 5 5;
}

.graph-link.framework_guides_method {
  stroke: rgba(46, 233, 255, 0.58);
  stroke-width: 1.6;
}

.graph-node .cell-halo {
  opacity: 0.2;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 1;
  animation: cellHalo 5.5s ease-in-out infinite;
}

.graph-node .cell-core {
  opacity: 0.96;
  stroke-width: 2.2;
  filter: url(#nodeGlow);
}

.graph-node:hover .cell-halo {
  opacity: 0.28;
}

.graph-node.selected .cell-halo {
  opacity: 0.58;
  stroke: rgba(46, 233, 255, 0.86);
  stroke-width: 2;
}

.graph-node.selected .cell-core {
  stroke-width: 3.5;
  filter: url(#nodeGlow);
}

.graph-node.related .cell-halo {
  opacity: 0.36;
}

.graph-node.dimmed {
  opacity: 0.18;
}

.graph-node.dimmed text {
  opacity: 0.28;
}

.graph-node:hover .cell-core {
  opacity: 1;
  stroke: #ffffff;
  stroke-width: 2.4;
}

.graph-node.chat-focus .cell-halo {
  opacity: 0.64;
  stroke: rgba(97, 242, 167, 0.9);
  stroke-width: 2.5;
  animation: chatFocusPulse 1.8s ease-in-out infinite;
}

.graph-node.chat-focus .cell-core {
  opacity: 1;
  stroke: #61f2a7 !important;
  stroke-width: 4;
  filter: drop-shadow(0 0 10px rgba(97, 242, 167, 0.78));
}

.graph-node.chat-focus .node-label {
  fill: #f3fff9;
  stroke: #04130d;
  stroke-width: 3.6px;
}

.graph-node.dragging .cell-core {
  opacity: 1;
  stroke: #ffffff;
  stroke-width: 2.6;
}

.graph-node text {
  paint-order: stroke;
  stroke: #0f1724;
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
}

.graph-node .node-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  opacity: 1;
  fill: #f8fafc;
}

.graph-node.document-node .node-label {
  font-size: 12px;
  font-weight: 900;
  fill: #ffffff;
  stroke-width: 3.4px;
}

.graph-node.corpus-node[data-node-type="Document"] .node-label {
  opacity: 0;
}

.graph-node.corpus-node[data-node-type="Document"].selected .node-label,
.graph-node.corpus-node[data-node-type="Document"].related .node-label,
.graph-node.corpus-node[data-node-type="Document"].chat-focus .node-label {
  opacity: 1;
}

.empty-graph circle {
  fill: rgba(148, 163, 184, 0.08);
  stroke: rgba(148, 163, 184, 0.42);
  stroke-width: 2;
}

@keyframes cellHalo {
  0%, 100% { opacity: 0.1; }
  50% { opacity: 0.2; }
}

@keyframes chatFocusPulse {
  0%, 100% {
    opacity: 0.48;
    transform: scale(1);
  }
  50% {
    opacity: 0.78;
    transform: scale(1.08);
  }
}

.yellow-layer {
  grid-column: 1 / -1;
  grid-row: 3;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 0;
  background: #080d13;
  border-top: 1px solid rgba(46, 233, 255, 0.18);
  min-height: 420px;
  overflow: visible;
}

.workbench-head {
  display: block;
  padding: 10px 14px 0;
  background: #091018;
  border-bottom: 1px solid rgba(46, 233, 255, 0.14);
}

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

.workbench-tab {
  width: auto;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px 6px 0 0;
  color: var(--text);
  background: #0d151d;
  text-align: center;
  padding: 0 14px;
  border-bottom-color: transparent;
}

.workbench-tab.active {
  background: rgba(46, 233, 255, 0.13);
  border-color: rgba(46, 233, 255, 0.48);
  color: #dffbff;
}

.workbench-body {
  min-width: 0;
  min-height: 0;
  overflow: visible;
  padding: 14px;
  background: #080d13;
}

.workbench-panel {
  display: none;
}

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

#evidenceWorkbench.active {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 12px;
  align-items: start;
}

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

.selection-panel {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  background: var(--panel-2);
}

.research-overview-head,
.section-summary-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.research-overview-head h2 {
  margin: 2px 0 4px;
}

.thesis-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.thesis-overview-card,
.citation-guide-card,
.source-detail {
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  background: var(--panel);
}

.thesis-overview-card h3 {
  margin: 4px 0 6px;
  font-size: 15px;
  line-height: 1.3;
}

.thesis-overview-card p,
.citation-guide-card p {
  margin-bottom: 8px;
  color: #dbe4ef;
  line-height: 1.5;
}

.overview-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.overview-stats span {
  padding: 3px 7px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  color: #cbd5e1;
  font-size: 11px;
}

.section-mini-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #dbe4ef;
}

.section-mini-list li {
  margin: 4px 0;
}

.section-mini-list strong,
.section-mini-list span {
  display: inline;
  font-size: 12px;
}

.section-mini-list span {
  color: var(--muted);
}

.section-summary-panel {
  border-color: rgba(148, 163, 184, 0.2);
  background: var(--panel-2);
}

.evidence-card {
  min-height: 0;
}

.section-summary-card {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  background: var(--panel);
}

.section-summary-card.active {
  border-color: rgba(255, 209, 102, 0.58);
  background: rgba(255, 209, 102, 0.08);
}

.section-summary-card h3 {
  margin: 2px 0 6px;
  font-size: 14px;
}

.section-summary-card p {
  margin-bottom: 6px;
  color: #dbe4ef;
  line-height: 1.5;
}

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

.evidence-snippets {
  display: grid;
  gap: 6px;
}

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

.selection-head h2 {
  margin: 2px 0 4px;
  font-size: 18px;
}

.selection-head p {
  color: var(--muted);
  margin: 0;
}

.selection-grid {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(120px, 0.7fr) minmax(90px, 0.45fr) minmax(90px, 0.45fr) minmax(0, 1.8fr);
  gap: 8px;
  margin-bottom: 12px;
}

.selection-grid div {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 6px;
  background: var(--panel);
}

.selection-grid strong,
.selection-grid span {
  display: block;
}

.selection-grid strong {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.selection-grid span {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.selection-detail-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(440px, 1.45fr) minmax(240px, 0.7fr);
  align-items: start;
  gap: 12px;
}

.selection-detail-layout article,
.selection-detail-layout .topic-membership-strip {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  background: var(--panel);
}

.selection-detail-layout h3,
.topic-membership-group h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.node-chat-card {
  padding: 0;
  overflow: hidden;
}

.node-chat-card .red-layer {
  position: static;
  z-index: auto;
  left: auto;
  top: auto;
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 360px;
  max-height: 620px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: rgba(9, 14, 20, 0.82);
}

.node-chat-card .chat-stream {
  min-height: 96px;
}

.synopsis-card {
  min-height: 240px;
}

.evidence-support-card {
  grid-column: 1 / -1;
  overflow: visible;
}

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

.evidence-card-head h3 {
  margin: 0;
}

.evidence-card-head span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.evidence-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.selection-summary-text {
  margin: 0;
  color: #dbe4ef;
  line-height: 1.55;
  white-space: pre-wrap;
}

.synopsis-points {
  margin: 10px 0 0;
  padding-left: 18px;
  color: #cbd5e1;
  line-height: 1.45;
}

.synopsis-points li + li {
  margin-top: 6px;
}

.source-row {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 9px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
}

.source-row.evidence-card-row {
  display: grid;
  gap: 8px;
  margin-bottom: 0;
  padding: 11px;
  background: rgba(7, 16, 25, 0.72);
}

.source-row.compact {
  margin-bottom: 0;
  padding: 8px;
}

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

.source-row.evidence-card-row strong {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.source-row.evidence-card-row strong span {
  max-width: 100%;
  padding: 3px 7px;
  border-radius: 999px;
  color: #dbe4ef;
  background: rgba(30, 41, 59, 0.9);
  font-size: 11px;
  white-space: nowrap;
}

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

.source-row.evidence-card-row > span,
.section-summary-card > p,
.source-detail blockquote {
  white-space: pre-wrap;
}

.source-row.evidence-card-row > span {
  max-height: 420px;
  overflow: auto;
  color: #dbe4ef;
  font-size: 13px;
}

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

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

.metric {
  padding: 10px;
  border: 1px solid rgba(255, 209, 102, 0.24);
  border-radius: 8px;
  background: rgba(255, 209, 102, 0.07);
}

.metric strong {
  display: block;
  font-size: 18px;
  font-family: var(--mono);
}

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

.yellow-button {
  background: var(--amber-soft);
  border-color: rgba(255, 209, 102, 0.5);
  color: #ffe6a6;
}

.citation-guide-card {
  grid-column: 1 / -1;
}

.citation-card code {
  display: block;
  margin: 8px 0 10px;
  padding: 8px;
  border-radius: 6px;
  color: #ffe6a6;
  background: rgba(255, 209, 102, 0.08);
  white-space: normal;
  line-height: 1.45;
}

.trace-output {
  white-space: normal;
}

.source-detail blockquote {
  margin: 14px 0;
  padding: 12px 14px;
  border-left: 3px solid rgba(255, 209, 102, 0.7);
  color: #eef2f7;
  background: var(--panel-2);
  line-height: 1.6;
}

.source-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.source-meta-grid div {
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 6px;
  background: var(--panel);
}

.moodboard-head {
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid rgba(46, 233, 255, 0.18);
  border-radius: 8px;
  background:
    radial-gradient(circle at 88% 20%, rgba(46, 233, 255, 0.11), transparent 26%),
    var(--panel);
}

.moodboard-head h2 {
  margin: 3px 0 6px;
  font-size: 22px;
}

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

.moodboard-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(174, 198, 216, 0.18);
  border-radius: 8px;
  background: var(--panel-2);
}

.moodboard-card h3 {
  margin: 0 0 12px;
  font-size: 13px;
  text-transform: uppercase;
}

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

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

.swatch {
  min-height: 84px;
  display: grid;
  align-content: end;
  gap: 3px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: white;
}

.swatch span,
.swatch code,
.spec-cell span {
  font-family: var(--mono);
  font-size: 11px;
}

.swatch code {
  color: rgba(255, 255, 255, 0.74);
}

.swatch.ink { background: #05070b; }
.swatch.graphite { background: #0b0f14; }
.swatch.cyan {
  background: #09242c;
  box-shadow: inset 0 0 0 1px rgba(46, 233, 255, 0.45), 0 0 24px rgba(46, 233, 255, 0.08);
}
.swatch.green {
  background: #0d261a;
  box-shadow: inset 0 0 0 1px rgba(97, 242, 167, 0.42);
}
.swatch.amber {
  background: #2a220d;
  box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.42);
}
.swatch.magenta {
  background: #2a1027;
  box-shadow: inset 0 0 0 1px rgba(255, 79, 216, 0.42);
}

.spec-cell {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(46, 233, 255, 0.18);
  border-radius: 8px;
  background: #091018;
}

.spec-cell strong {
  font-family: var(--mono);
  font-size: 28px;
  line-height: 1;
  color: #dffbff;
}

.spec-cell span {
  color: var(--muted);
  text-transform: uppercase;
}

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

.signal-ok {
  border-color: rgba(97, 242, 167, 0.45);
  color: #c8ffe1;
  background: var(--green-soft);
}

.signal-warn {
  border-color: rgba(255, 209, 102, 0.45);
  color: #ffe6a6;
  background: var(--amber-soft);
}

.signal-danger {
  border-color: rgba(255, 92, 122, 0.48);
  color: #fecdd3;
  background: rgba(255, 92, 122, 0.12);
}

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

.direction-notes p {
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(174, 198, 216, 0.14);
  border-radius: 8px;
  background: var(--panel);
  color: #dbe7ef;
  line-height: 1.5;
}

.direction-notes strong {
  display: block;
  margin-bottom: 4px;
  color: #dffbff;
}

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

.source-meta-grid strong {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.source-meta-grid span {
  margin-top: 3px;
  color: #dbe4ef;
  font-size: 12px;
  line-height: 1.4;
}

.citation-patterns {
  display: grid;
  gap: 6px;
}

.citation-patterns h3,
.citation-patterns p {
  margin: 0;
}

.citation-patterns p {
  color: #dbe4ef;
  line-height: 1.5;
}

@media (max-width: 900px) {
  .app-frame {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(420px, 1fr) auto;
    overflow: auto;
    height: auto;
    min-height: 100vh;
  }

  .black-layer,
  .yellow-layer {
    grid-column: 1;
  }

  .black-layer {
    flex-wrap: wrap;
  }

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

  .red-layer,
  .blue-layer {
    grid-column: 1;
    grid-row: auto;
  }

  .red-layer {
    position: fixed;
    left: 12px;
    right: 12px;
    top: 112px;
    width: auto;
    max-width: none;
    height: min(560px, calc(100vh - 132px));
    max-height: calc(100vh - 132px);
  }

  .red-layer,
  .blue-layer,
  .yellow-layer {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .yellow-layer {
    grid-row: auto;
  }

  .workbench-head {
    border-right: 0;
    border-bottom: 1px solid rgba(234, 179, 8, 0.24);
    padding-right: 0;
    padding-bottom: 12px;
  }

  .workbench-tabs,
  .black-actions {
    display: flex;
    flex-wrap: wrap;
  }

  .workbench-tab {
    width: auto;
  }

  .selection-grid,
  .selection-detail-layout,
  .admin-layout,
  .moodboard-grid,
  .direction-notes {
    grid-template-columns: 1fr;
  }

  .swatch-grid,
  .spec-strip {
    grid-template-columns: 1fr;
  }

  #evidenceWorkbench.active {
    grid-template-columns: 1fr;
  }

  .graph-legend {
    max-width: none;
    justify-content: flex-start;
  }

  .graph-node-tooltip {
    right: 8px;
    top: auto;
    bottom: 8px;
    width: min(300px, calc(100% - 16px));
    max-height: min(44vh, 300px);
  }

  .graph-node-tooltip.collapsed {
    width: 116px;
    max-height: 36px;
  }

  .graph-topline,
  .compact-head {
    align-items: flex-start;
  }

  .graph-topline {
    grid-template-columns: 1fr;
  }

  .graph-summary {
    grid-template-columns: 1fr;
  }

  .node-search-form {
    width: 100%;
  }

  .node-search-input {
    width: 100%;
    min-width: 0;
  }

  .audit-search-form {
    grid-template-columns: 1fr;
  }

  .topic-membership-strip {
    grid-template-columns: 1fr;
  }
}
