:root {
  --bg: #f4f7fa;
  --surface: #ffffff;
  --surface-soft: #f8fbfc;
  --ink: #17202a;
  --muted: #647184;
  --line: #d7e0ea;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --blue: #2563eb;
  --amber: #b45309;
  --green-soft: #e5f7f3;
  --blue-soft: #eaf2ff;
  --amber-soft: #fff5df;
  --shadow: 0 10px 30px rgba(23, 32, 42, 0.08);
  --radius: 8px;
}

* {
  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;
}

html {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background: linear-gradient(180deg, #eef6f7 0, var(--bg) 280px);
  font-family: "Helvetica Neue", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

button,
input,
select,
textarea {
  max-width: 100%;
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.hero-panel,
.side-panel,
.result-card,
.ai-card,
.detail-panel,
.auth-panel,
.modal-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.hero-panel {
  padding: 22px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
  gap: 20px;
  align-items: stretch;
}

.hero-main,
.results-column,
.card-copy {
  min-width: 0;
}

.brand-row,
.result-head,
.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.brand-name {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.12;
}

.count-pill,
.badge,
.tag,
.local-source-label,
.fit-line {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border-radius: 999px;
  white-space: nowrap;
}

.count-pill {
  flex: 0 0 auto;
  padding: 8px 12px;
  color: var(--accent-strong);
  background: var(--green-soft);
  font-size: 13px;
  font-weight: 800;
}

.search-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 10px;
  margin-top: 22px;
}

.search-box input {
  width: 100%;
  min-width: 0;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  outline: none;
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.search-box input:disabled {
  color: var(--muted);
  background: #eef3f5;
  cursor: not-allowed;
}

.search-box button,
.primary-link,
.ghost-button,
.ghost-link,
.auth-form button,
.account-pill button {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 800;
}

.search-box button,
.primary-link,
.auth-form button[type="submit"] {
  color: #fff;
  background: var(--accent);
}

.search-box button:disabled {
  color: #718096;
  background: #dbe3ea;
  cursor: not-allowed;
}

.primary-link,
.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  text-decoration: none;
}

.ghost-button,
.ghost-link,
.account-pill button,
.auth-form .link-button {
  color: var(--accent);
  background: var(--green-soft);
}

.warn-action {
  color: #8a4b13;
  background: var(--amber-soft);
}

.quick-row,
.tag-row,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-row {
  margin-top: 14px;
}

.quick-row button,
.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-weight: 700;
}

.quick-row button {
  min-height: 38px;
  padding: 0 12px;
  cursor: pointer;
}

.quick-row button:disabled {
  background: #eef3f5;
  cursor: not-allowed;
}

.search-progress {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #b7eee6;
  border-radius: var(--radius);
  background: #edfdf8;
}

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

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #2fb77d);
  transition: width 0.35s ease;
}

.progress-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.progress-step {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid #d7e0ea;
  border-radius: 999px;
  color: #728096;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.progress-step b {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 999px;
  color: #789;
  background: #edf2f7;
  font-size: 11px;
}

.progress-step em {
  overflow: hidden;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-step.done,
.progress-step.active,
.progress-step.partial {
  color: #0f766e;
  border-color: #99f6e4;
  background: #f0fdfa;
}

.progress-step.done b {
  color: #fff;
  background: #0f766e;
}

.progress-step.active b {
  color: #fff;
  background: #2fb77d;
  box-shadow: 0 0 0 4px rgba(47, 183, 125, 0.14);
}

.progress-step.partial {
  color: #92400e;
  border-color: #fde68a;
  background: #fffbeb;
}

.progress-step.partial b {
  color: #fff;
  background: #d97706;
}

.progress-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 7px;
}

.search-progress small,
.status-detail {
  display: block;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

.progress-cancel {
  flex: 0 0 auto;
  border: 0;
  color: #346170;
  background: transparent;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.progress-cancel:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.status-detail {
  margin-top: 7px;
}

.auth-panel {
  padding: 16px;
  box-shadow: none;
  background: var(--surface-soft);
}

.auth-box {
  min-width: 0;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form strong,
.auth-heading {
  color: var(--accent);
  font-size: 15px;
  font-weight: 900;
}

.auth-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.auth-form input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.auth-form .link-button {
  min-width: 76px;
  padding: 0 12px;
}

.auth-form small {
  min-height: 18px;
  color: var(--amber);
  font-size: 12px;
  line-height: 1.4;
}

.account-pill {
  display: grid;
  gap: 12px;
}

.account-pill span {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--accent-strong);
  background: var(--green-soft);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.account-pill small {
  color: var(--muted);
  line-height: 1.5;
}

.account-admin-link {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: var(--radius);
  color: var(--accent);
  background: var(--green-soft);
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.side-panel {
  order: 3;
  grid-column: 1 / -1;
  padding: 0;
  overflow: hidden;
  box-shadow: none;
}

.results-column {
  order: 1;
}

.detail-panel {
  order: 2;
}

.filter-drawer > summary,
.more-panel > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.filter-drawer > summary::-webkit-details-marker,
.more-panel > summary::-webkit-details-marker {
  display: none;
}

.filter-drawer > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 0 16px;
  color: #0f172a;
  font-weight: 900;
}

.filter-drawer > summary small {
  color: var(--muted);
  font-weight: 700;
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.25fr) minmax(220px, 0.8fr);
  gap: 14px 22px;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
  background: #f7fafc;
}

.filter-grid > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.panel-title {
  width: 100%;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.side-panel label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 13px;
  cursor: pointer;
}

.select-label {
  min-width: min(100%, 260px);
}

.select-label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.select-label select {
  min-width: 128px;
  border: 0;
  color: var(--accent-strong);
  background: transparent;
  font-weight: 900;
  outline: none;
}

.status-line {
  margin: 2px 0 12px;
  color: var(--muted);
  line-height: 1.55;
}

.status-main {
  color: var(--muted);
  font-weight: 800;
}

.results {
  display: grid;
  gap: 12px;
}

.reading-path {
  display: grid;
  gap: 11px;
  padding: 12px 14px;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 8px 22px rgba(23, 32, 42, 0.04);
}

.reading-path > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.reading-path strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.reading-path small {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.reading-path ol {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.reading-path li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-width: 0;
  min-height: 46px;
  padding: 9px;
  border: 1px solid #d9f2ee;
  border-radius: var(--radius);
  background: #f8fcfb;
}

.reading-path b {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-size: 12px;
}

.reading-path span {
  color: #334155;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.auth-required-card,
.empty-state {
  padding: 18px;
  border: 1px dashed #b7c5d4;
  border-radius: var(--radius);
  color: var(--muted);
  background: #fff;
  line-height: 1.65;
}

.result-card,
.ai-card {
  padding: 14px;
}

.result-card {
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease;
}

.result-card:hover,
.result-card.active,
.result-card:focus-visible {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.result-card:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.22);
  outline-offset: 3px;
}

.result-main {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.card-thumb {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

.card-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.result-head {
  align-items: center;
  gap: 10px;
}

.result-head .tag-row,
.compact-tags {
  margin-top: 0;
}

.result-head strong {
  flex: 0 0 auto;
  color: var(--accent-strong);
  font-size: 14px;
}

.match-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid #c7d7e6;
  border-radius: 999px;
  color: #344054;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.result-card h2,
.detail-panel h2 {
  margin: 8px 0 6px;
  line-height: 1.3;
}

.result-card h2 {
  font-size: 19px;
}

.detail-panel h2 {
  font-size: 21px;
}

.summary,
.why,
.empty-detail,
.field {
  color: var(--muted);
  line-height: 1.65;
}

.summary,
.why {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
}

.result-card .summary {
  -webkit-line-clamp: 2;
}

.why {
  margin-top: 8px;
  color: #35515f;
  -webkit-line-clamp: 2;
  font-size: 13px;
}

.result-meta,
.plan-meta {
  display: block;
  margin-top: 7px;
  color: #667085;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.detail-community-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0;
  padding: 11px;
  border: 1px solid rgba(32, 55, 70, 0.12);
  border-radius: var(--radius);
  background: #f8fafc;
}

.detail-community-prompt strong,
.detail-community-prompt span {
  display: block;
}

.detail-community-prompt strong {
  color: var(--brand-ink);
  font-size: 14px;
}

.detail-community-prompt span {
  margin-top: 3px;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.detail-community-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.detail-community-actions button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #d7e7f5;
  border-radius: var(--radius);
  color: var(--accent-strong);
  background: #fff;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.detail-community-actions button:hover,
.detail-community-actions button:focus-visible {
  border-color: rgba(8, 143, 207, 0.35);
  background: var(--blue-soft);
  outline: none;
}

.detail-review-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 8px;
  margin: 10px 0 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

.detail-review-strip > div {
  min-width: 0;
}

.detail-review-strip span,
.detail-review-strip strong {
  display: block;
}

.detail-review-strip span {
  color: #647184;
  font-size: 11px;
  font-weight: 900;
}

.detail-review-strip strong {
  margin-top: 3px;
  color: #17202a;
  font-size: 13px;
  line-height: 1.25;
}

.detail-review-actions {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.detail-review-actions button {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #d7e0ea;
  border-radius: var(--radius);
  color: #155a91;
  background: #fff;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.detail-review-actions button:hover,
.detail-review-actions button:focus-visible {
  border-color: rgba(15, 118, 110, 0.36);
  color: #0f766e;
  outline: none;
}

.detail-top-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.detail-return-link {
  display: none;
}

.detail-top-actions > * {
  width: 100%;
  min-width: 0;
  min-height: 38px;
}

.detail-top-actions .ghost-button {
  border: 0;
}

.detail-facts {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin: 12px 0;
}

.detail-facts div {
  min-width: 0;
  padding: 9px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

.detail-facts strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-category-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.detail-category-panel div {
  min-width: 0;
}

.detail-category-panel span {
  display: block;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
}

.detail-category-panel strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.detail-category-panel .ghost-button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border-color: #d7e7f5;
  background: #f8fafc;
}

.detail-similar-panel,
.detail-plan-reference-panel {
  display: grid;
  gap: 10px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

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

.detail-similar-head strong,
.detail-plan-reference-head strong,
.detail-plan-reference-item strong,
.detail-similar-item strong {
  display: block;
  color: var(--ink);
  line-height: 1.35;
}

.detail-similar-head span,
.detail-similar-head small,
.detail-plan-reference-head span,
.detail-plan-reference-head small,
.detail-plan-reference-item span,
.detail-plan-reference-item small,
.detail-similar-item span,
.detail-similar-item small,
.detail-similar-empty {
  color: #667085;
  font-size: 12px;
  font-weight: 800;
}

.detail-similar-list,
.detail-plan-reference-list {
  display: grid;
  gap: 8px;
}

.detail-plan-reference-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid #dbe7f2;
  border-radius: var(--radius);
  background: #f8fafc;
}

.detail-plan-reference-item > div {
  min-width: 0;
}

.detail-plan-reference-item strong,
.detail-plan-reference-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-plan-reference-kicker,
.detail-plan-reference-sources {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.detail-plan-reference-kicker span,
.detail-plan-reference-kicker em,
.detail-plan-reference-sources span {
  display: inline-flex;
  max-width: 100%;
  min-height: 22px;
  align-items: center;
  padding: 0 7px;
  overflow: hidden;
  border: 1px solid #d8e1ea;
  border-radius: 5px;
  color: #475569;
  background: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-plan-reference-kicker span {
  color: #155a91;
  border-color: #c3d9ed;
  background: #f5faff;
}

.detail-plan-reference-item strong {
  margin-top: 6px;
}

.detail-plan-reference-item small {
  display: block;
  margin-top: 4px;
}

.detail-plan-reference-sources {
  margin-top: 6px;
}

.detail-plan-reference-sources span {
  max-width: 190px;
  color: #647184;
  background: #fff;
}

.detail-similar-item {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid #dbe7f2;
  border-radius: var(--radius);
  background: #f8fafc;
  text-align: left;
  cursor: pointer;
}

.detail-similar-item:hover,
.detail-similar-item:focus-visible {
  border-color: rgba(8, 143, 207, 0.4);
  background: #f0f9ff;
  outline: none;
}

.detail-similar-empty {
  padding: 10px 0;
}

.badge {
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.badge.main {
  color: #075985;
  background: #e0f2fe;
}

.badge.sub {
  color: #7c2d12;
  background: #ffedd5;
}

.badge.safe {
  color: #166534;
  background: #dcfce7;
}

.badge.warn {
  color: var(--amber);
  background: var(--amber-soft);
}

.badge.real {
  color: #0f766e;
  background: #ccfbf1;
}

.badge.source {
  color: #475569;
  background: #e2e8f0;
}

.tag-row {
  margin-top: 12px;
}

.tag {
  padding: 6px 9px;
  font-size: 12px;
  cursor: default;
}

.fit-line {
  margin-top: 9px;
  padding: 6px 9px;
  color: var(--accent-strong);
  background: #ccfbf1;
  font-size: 12px;
  font-weight: 900;
}

.fold-note {
  margin-top: 9px;
  padding: 8px 10px;
  border: 1px dashed #bfdbfe;
  border-radius: var(--radius);
  color: #1d4ed8;
  background: var(--blue-soft);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
}

.tap-hint {
  margin-top: 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.skeleton-card {
  cursor: wait;
}

.skeleton-line {
  height: 14px;
  margin: 11px 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #eef2f7, #dbeafe, #eef2f7);
  background-size: 180% 100%;
  animation: shimmer 1.2s linear infinite;
}

.skeleton-line.wide {
  width: 72%;
  height: 20px;
}

.skeleton-line.short {
  width: 42%;
}

@keyframes shimmer {
  from { background-position: 180% 0; }
  to { background-position: -180% 0; }
}

.ai-card {
  background: linear-gradient(135deg, #f0fdfa, #fff);
}

.ai-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ai-title strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.local-source-label {
  padding: 5px 10px;
  color: var(--accent-strong);
  background: #ccfbf1;
  font-size: 12px;
  font-weight: 800;
}

.mini-row,
.flow-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.mini-row span,
.flow-row span {
  display: inline-flex;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.mini-row span {
  border: 1px solid #99f6e4;
  color: var(--accent-strong);
  background: #ecfdf5;
}

.flow-row span {
  color: #1d4ed8;
  background: #dbeafe;
}

.assembly {
  margin-top: 12px;
  color: #35515f;
  line-height: 1.65;
}

.assembly ol {
  margin: 8px 0 0;
  padding-left: 20px;
}

.plan-modules {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.plan-module {
  display: grid;
  gap: 6px;
  min-width: 0;
  min-height: 100px;
  padding: 12px;
  text-align: left;
  border: 1px solid #99f6e4;
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.plan-module span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.plan-module strong,
.plan-module small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.plan-module small {
  color: var(--muted);
  line-height: 1.45;
}

.schematic-box {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  background: var(--blue-soft);
}

.connection-wrap {
  margin-top: 12px;
  overflow-x: auto;
}

.connection-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
}

.connection-table th,
.connection-table td {
  border: 1px solid #d9f2ee;
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
}

.connection-table th {
  color: var(--accent);
  background: #ecfdf5;
}

.plan-checks {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.method-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.method-list span {
  padding: 9px 10px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  color: #1d4ed8;
  background: #eff6ff;
  line-height: 1.55;
}

.plan-checks span,
.gap-note {
  padding: 9px 10px;
  border-radius: var(--radius);
  color: #8a4b13;
  background: var(--amber-soft);
  line-height: 1.55;
}

.plan-actions,
.action-row {
  margin-top: 14px;
}

.gap-note {
  margin-top: 12px;
}

.more-panel {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.more-panel > summary {
  padding: 11px 12px;
  color: var(--accent);
  font-weight: 900;
}

.more-panel > *:not(summary) {
  margin-left: 12px;
  margin-right: 12px;
}

.more-panel[open] {
  padding-bottom: 12px;
}

.detail-panel {
  position: sticky;
  top: 16px;
  min-width: 0;
  padding: 16px;
}

.compact-detail-head .tag-row {
  margin-top: 0;
}

.detail-record-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  margin-top: 10px;
  border: 1px solid #cfd8e3;
  border-radius: var(--radius);
  background: #cfd8e3;
}

.detail-record-nav a {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px 10px;
  color: #243241;
  background: #fff;
  text-decoration: none;
}

.detail-record-nav a:hover,
.detail-record-nav a:focus-visible {
  color: #0f6f9f;
  outline: none;
  background: #f8fcff;
}

.detail-record-nav span,
.detail-record-nav strong {
  min-width: 0;
  overflow: hidden;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-record-nav span {
  color: #647184;
  font-size: 11px;
  font-weight: 900;
}

.detail-record-nav strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 950;
}

.detail-preview-section,
#detailArchive,
#detailSource,
#detailCommunity {
  scroll-margin-top: 84px;
}

.preview-frame {
  width: 100%;
  margin: 12px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #111827;
}

.preview-frame img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  background: #f8fafc;
}

.preview-open,
.pdf-preview-frame a {
  position: relative;
  display: block;
  width: 100%;
  padding: 8px;
  border: 0;
  background: #111827;
  font: inherit;
  cursor: zoom-in;
}

.preview-open:hover img {
  filter: contrast(1.03) saturate(1.03);
}

.pdf-preview-frame img {
  border-radius: 6px;
}

.preview-caption {
  padding: 10px 12px;
  color: #d1fae5;
  background: #0f172a;
  font-size: 13px;
  font-weight: 700;
}

.markable-surface {
  position: relative;
}

.annotation-marker-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.annotation-marker {
  position: absolute;
  width: 16px;
  height: 16px;
  transform: translate(-50%, -50%);
  border: 3px solid #fff;
  border-radius: 999px;
  background: #0b8fd3;
  box-shadow: 0 0 0 3px rgba(11, 143, 211, 0.28);
}

.annotation-marker.draft {
  background: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.28);
}

.annotation-pick-hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 6px 9px;
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 999px;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.download-package-card {
  display: grid;
  gap: 10px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  color: #1e3a5f;
  background: linear-gradient(135deg, #eff6ff, #f8fafc);
}

.download-package-card strong {
  color: #075985;
  font-size: 14px;
}

.download-package-card p {
  margin: 6px 0 0;
  color: #35515f;
  line-height: 1.6;
}

.package-facts {
  display: grid;
  gap: 7px;
}

.package-facts span {
  padding: 8px 9px;
  border: 1px solid #dbeafe;
  border-radius: 7px;
  color: #334155;
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.disabled-link {
  opacity: 0.56;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.35);
}

.source-card-preview {
  padding: 16px;
  background: #f0fdfa;
}

.preview-modal {
  z-index: 60;
  padding: 18px;
}

.preview-modal-card {
  width: min(1180px, 100%);
  max-height: calc(100vh - 36px);
  padding: 14px;
  background: #f8fafc;
}

.preview-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 44px 12px 2px;
}

.preview-modal-head strong {
  min-width: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.35;
}

.preview-modal-head a {
  flex: 0 0 auto;
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.preview-large-frame {
  overflow: auto;
  max-height: calc(100vh - 130px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f172a;
}

.preview-large-frame img {
  display: block;
  width: 100%;
  min-height: 240px;
  object-fit: contain;
  background: #f8fafc;
}

.source-card-preview strong {
  display: block;
  margin: 8px 0;
  font-size: 17px;
}

.source-card-preview p {
  margin: 8px 0;
}

.source-card-preview a {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.source-record {
  color: var(--muted);
  font-size: 13px;
  word-break: break-word;
}

.source-local-note {
  color: var(--accent);
  font-weight: 800;
}

.field {
  margin: 8px 0;
}

.ai-detail {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid #b7eee6;
  border-radius: var(--radius);
  background: #f0fdfa;
}

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

.block-item {
  padding: 10px;
  border: 1px solid #ccfbf1;
  border-radius: var(--radius);
  background: #fff;
}

.block-item p {
  margin: 5px 0;
  color: var(--muted);
  line-height: 1.55;
}

.block-item small {
  color: var(--accent);
  line-height: 1.5;
}

.action-row > * {
  flex: 1;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
}

.modal-card {
  position: relative;
  width: min(760px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 22px;
  background: #fff;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  color: var(--accent);
  background: var(--green-soft);
  cursor: pointer;
}

.mark-area {
  position: relative;
  margin: 12px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

.mark-area img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  cursor: crosshair;
}

.mark-dot {
  position: absolute;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  border: 3px solid #fff;
  border-radius: 999px;
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.35);
  pointer-events: none;
}

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

.feedback-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.feedback-form input,
.feedback-form select,
.feedback-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--ink);
}

.feedback-form small {
  color: var(--accent);
  font-weight: 800;
}

.community-panel {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid rgba(20, 184, 166, 0.28);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(240, 253, 250, 0.92), rgba(255, 255, 255, 0.96));
}

.thread-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  cursor: pointer;
  list-style: none;
}

.thread-panel-head::-webkit-details-marker {
  display: none;
}

.thread-panel-head::after {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #647184;
  content: "+";
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 900;
}

.community-panel[open] .thread-panel-head::after {
  content: "-";
}

.thread-panel-body {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.thread-panel-head strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 16px;
}

.thread-panel-head small {
  flex: 0 0 auto;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
}

.thread-summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.thread-summary-strip div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

.thread-target-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #cbd5df;
  border-radius: var(--radius);
  background: #fff;
}

.thread-target-card div {
  min-width: 0;
}

.thread-target-card span,
.thread-target-card small {
  display: block;
  overflow: hidden;
  color: #647184;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-target-card span {
  color: #0f766e;
  font-weight: 950;
}

.thread-target-card strong {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 3px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 950;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

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

.thread-target-actions button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #cfe0e9;
  border-radius: var(--radius);
  color: #155a91;
  background: #eef5fb;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.thread-target-actions button:first-child {
  color: #0f766e;
  border-color: #b9d7d2;
  background: #f0fdfa;
}

.community-note {
  margin: 6px 0 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

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

.community-form {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.community-form strong {
  color: var(--ink);
  font-size: 15px;
}

.community-form input,
.community-form select,
.community-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.community-form textarea {
  resize: vertical;
}

.community-form small {
  min-height: 18px;
  color: var(--accent);
  font-weight: 800;
}

.community-form .community-form-note {
  min-height: 0;
  color: #647184;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.annotation-template-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.annotation-template-row button {
  min-width: 0;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid #d8e1ea;
  border-radius: 7px;
  color: #344256;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.annotation-template-row button:hover,
.annotation-template-row button:focus-visible {
  border-color: rgba(15, 118, 110, 0.45);
  color: #0f766e;
  background: #f0fdfa;
  outline: none;
}

.annotation-location-picker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 8px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
}

.annotation-location-picker button {
  flex: 0 0 auto;
  border: 1px solid #cfe7f3;
  border-radius: 999px;
  padding: 6px 9px;
  color: #075985;
  background: #fff;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.annotation-location-picker button.active {
  color: #fff;
  border-color: #0b8fd3;
  background: #0b8fd3;
}

.annotation-location-picker span {
  min-width: 0;
  color: #667085;
  font-size: 12px;
  font-weight: 900;
}

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

.community-hub {
  margin-top: 12px;
}

.community-quick-panel {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.community-quick-panel button {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) auto;
  grid-template-areas:
    "label value"
    "note value";
  gap: 2px 10px;
  min-width: 0;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  color: inherit;
  background: #f8fafc;
  text-align: left;
  cursor: pointer;
}

.community-quick-panel button:hover,
.community-quick-panel button:focus-visible {
  border-color: rgba(15, 118, 110, 0.34);
  background: #f4fbf9;
  outline: none;
}

.community-quick-panel span,
.community-quick-panel strong,
.community-quick-panel small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-quick-panel span {
  grid-area: label;
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
}

.community-quick-panel strong {
  grid-area: value;
  align-self: center;
  color: #0f766e;
  font-size: 17px;
  line-height: 1;
}

.community-quick-panel small {
  grid-area: note;
  color: #647184;
  font-size: 11px;
  font-weight: 780;
}

.community-drawer {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
}

.community-drawer > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 0 14px;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.community-drawer > summary::-webkit-details-marker {
  display: none;
}

.community-drawer > summary span {
  font-weight: 900;
}

.community-drawer > summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.community-drawer[open] {
  padding-bottom: 12px;
}

.community-drawer[open] > summary {
  border-bottom: 1px solid var(--line);
}

.community-drawer .community-hub-card {
  margin: 12px 12px 0;
  box-shadow: none;
}

.community-hub-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(23, 32, 42, 0.1);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 12px 28px rgba(20, 31, 41, 0.05);
}

.plan-library-card {
  border-color: rgba(166, 95, 0, 0.16);
  background: linear-gradient(180deg, #fffdf8, #fff);
}

.my-contrib-card {
  border-color: rgba(15, 139, 127, 0.18);
  background: #fbfffe;
}

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

.community-hub-head span {
  display: block;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.community-hub-head strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 16px;
}

.icon-refresh {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(11, 143, 211, 0.2);
  border-radius: 50%;
  color: var(--accent);
  background: #f8fbff;
  font-weight: 900;
  cursor: pointer;
}

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

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

.community-metrics div,
.contribution-metrics div {
  padding: 9px 8px;
  border: 1px solid rgba(23, 32, 42, 0.08);
  border-radius: var(--radius);
  background: #f7fbff;
}

.community-metrics strong,
.community-metrics span,
.contribution-metrics strong,
.contribution-metrics span {
  display: block;
}

.community-metrics strong,
.contribution-metrics strong {
  color: var(--ink);
  font-size: 18px;
}

.community-metrics span,
.contribution-metrics span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.community-filter-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 3px;
  border: 1px solid rgba(23, 32, 42, 0.08);
  border-radius: var(--radius);
  background: #f7f9fb;
}

.community-filter-row button {
  min-height: 30px;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.community-filter-row button:hover,
.community-filter-row button:focus-visible {
  color: var(--accent);
  background: #fff;
  outline: 1px solid rgba(11, 143, 211, 0.22);
}

.community-filter-row button.active,
.community-filter-row button[aria-selected="true"] {
  color: var(--accent);
  background: #fff;
  box-shadow: 0 1px 3px rgba(20, 31, 41, 0.08);
}

.thread-filter-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
  padding: 3px;
  border: 1px solid rgba(23, 32, 42, 0.08);
  border-radius: var(--radius);
  background: #f7f9fb;
}

.thread-filter-row button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.thread-filter-row button:hover,
.thread-filter-row button:focus-visible {
  color: var(--accent);
  background: #fff;
  outline: 1px solid rgba(11, 143, 211, 0.2);
}

.thread-filter-row button.active,
.thread-filter-row button[aria-selected="true"] {
  color: var(--accent);
  background: #fff;
  box-shadow: 0 1px 3px rgba(20, 31, 41, 0.08);
}

.thread-filter-row b {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  color: #4b6478;
  background: rgba(23, 32, 42, 0.07);
  font-size: 11px;
  line-height: 1;
}

.thread-filter-row button.active b,
.thread-filter-row button[aria-selected="true"] b {
  color: #fff;
  background: var(--accent);
}

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

.community-feed-empty,
.community-feed-item {
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(23, 32, 42, 0.08);
  border-radius: var(--radius);
  background: #fff;
}

.community-feed-empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.community-feed-item {
  display: grid;
  gap: 4px;
  text-align: left;
  cursor: pointer;
}

.community-feed-item:hover,
.community-feed-item:focus-visible {
  border-color: rgba(11, 143, 211, 0.28);
  background: #f8fcff;
  outline: none;
}

.community-feed-item span {
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
}

.community-feed-item strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.community-feed-item small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.plan-library-item span {
  color: #a65f00;
}

.my-contrib-card .community-feed-item span,
.my-contrib-card .community-hub-head span {
  color: #0f766e;
}

.community-empty,
.community-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  padding: 12px;
}

.community-empty {
  color: var(--muted);
  font-size: 14px;
}

.community-item div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.community-item strong {
  color: var(--ink);
}

.community-item span,
.community-item small {
  color: var(--muted);
  font-size: 12px;
}

.community-status {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  margin-top: 8px;
  padding: 3px 8px;
  border: 1px solid #c7d7e8;
  border-radius: 999px;
  color: #155a91;
  background: #eef5fb;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.community-item p {
  margin: 8px 0;
  color: var(--ink);
  line-height: 1.6;
}

.community-item small {
  display: block;
  margin-top: 4px;
}

.community-item .community-edited {
  color: #7b8794;
  font-size: 12px;
  font-weight: 800;
}

.source-annotation-ref {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid #d8e1ea;
  border-radius: 999px;
  color: #334155;
  background: #f8fafc;
  font-weight: 850;
}

.reply-context,
.reply-target {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  padding: 8px 10px;
  border-left: 3px solid #c7d7e8;
  background: #f8fafc;
  color: #475569;
}

.reply-context span,
.reply-target span {
  color: #155a91;
  font-size: 12px;
  font-weight: 900;
}

.reply-context p,
.reply-target p {
  margin: 0;
  color: #536579;
  font-size: 12px;
  line-height: 1.45;
}

.reply-target {
  border: 1px solid #c7d7e8;
  border-left: 3px solid #0f766e;
  border-radius: var(--radius);
  background: #f6fbfb;
}

.reply-target button,
.community-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #155a91;
  background: #fff;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

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

.reply-target button:hover,
.reply-target button:focus-visible,
.community-actions button:hover,
.community-actions button:focus-visible {
  border-color: #0f766e;
  color: #0f766e;
  outline: none;
}

.community-actions .danger-action {
  border-color: #f1c8c5;
  color: #a33b35;
  background: #fff7f6;
}

.community-actions .danger-action:hover,
.community-actions .danger-action:focus-visible {
  border-color: #b9433c;
  color: #8f302b;
}

.community-edit-form {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #c7d7e8;
  border-radius: var(--radius);
  background: #f8fbff;
}

.community-edit-form strong {
  color: #155a91;
  font-size: 13px;
  font-weight: 900;
}

.community-edit-form input,
.community-edit-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #cfd8e3;
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.community-edit-form textarea {
  resize: vertical;
}

.community-edit-form input:focus,
.community-edit-form textarea:focus {
  border-color: #0f766e;
  outline: 2px solid rgba(15, 118, 110, 0.12);
}

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

.community-edit-actions button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #c7d7e8;
  border-radius: var(--radius);
  color: #155a91;
  background: #fff;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.community-edit-actions button:first-child {
  border-color: #0f766e;
  color: #fff;
  background: #0f766e;
}

.community-edit-form small {
  color: #667085;
  font-size: 12px;
  font-weight: 800;
}

.hidden {
  display: none !important;
}

.login-body {
  background: #f4f7f9;
}

.login-shell {
  display: grid;
  width: min(1040px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0;
  place-items: center;
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 34px;
  align-items: center;
  width: 100%;
  padding: 0;
}

.login-brand {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
}

.login-logo-frame {
  width: min(300px, 76vw);
}

.login-logo {
  display: block;
  width: 100%;
  height: auto;
}

.login-heading {
  display: grid;
  gap: 6px;
}

.login-brand h1 {
  color: #2f2928;
  font-size: clamp(34px, 5vw, 54px);
}

.login-brand p {
  margin: 0;
  max-width: 520px;
  color: #4f5966;
  line-height: 1.7;
}

.login-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.login-meta-row span {
  padding: 8px 12px;
  border: 1px solid rgba(8, 143, 207, 0.28);
  border-radius: 999px;
  color: #087fc0;
  background: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 900;
}

.login-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 20px;
  border: 1px solid rgba(12, 68, 92, 0.12);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(20, 56, 72, 0.08);
}

.login-card strong {
  color: #087fc0;
  font-size: 18px;
  font-weight: 900;
}

.login-card input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid #dbe6ec;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  outline: none;
}

.login-card input:focus {
  border-color: #088fcf;
  box-shadow: 0 0 0 3px rgba(8, 143, 207, 0.14);
}

.login-card button {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: #087fc0;
  cursor: pointer;
  font-weight: 900;
  box-shadow: none;
}

.login-card .link-button {
  color: #087fc0;
  background: rgba(232, 246, 252, 0.9);
  box-shadow: none;
}

.login-card small {
  min-height: 18px;
  color: var(--amber);
  line-height: 1.4;
}

@media (max-width: 1040px) {
  .hero-grid,
  .workspace {
    grid-template-columns: 1fr;
  }

  .auth-panel,
  .detail-panel {
    position: static;
  }

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

@media (max-width: 720px) {
  html,
  body {
    overflow-x: hidden;
  }

  .shell {
    width: 100%;
    padding: 8px 8px 24px;
  }

  .hero-panel,
  .auth-panel,
  .result-card,
  .ai-card,
  .detail-panel {
    border-radius: var(--radius);
  }

  .hero-panel {
    width: 100%;
    max-width: 100%;
    padding: 16px;
    overflow: hidden;
  }

  .brand-row,
  .result-head,
  .detail-head {
    display: grid;
    gap: 10px;
  }

  h1 {
    font-size: 32px;
    line-height: 1.12;
  }

  .count-pill {
    width: fit-content;
    white-space: normal;
  }

  .search-box {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 18px;
  }

  .search-box input {
    min-height: 50px;
  }

  .search-box button {
    min-height: 50px;
  }

  .quick-row {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    gap: 6px;
    padding-bottom: 2px;
  }

  .quick-row button {
    flex: 0 0 auto;
    max-width: 260px;
    height: auto;
    min-height: 36px;
    padding: 7px 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
    text-align: left;
  }

  .auth-panel {
    padding: 12px;
  }

  .auth-form {
    gap: 8px;
  }

  .auth-note {
    display: none;
  }

  .auth-form input,
  .auth-form button,
  .account-pill button {
    min-height: 42px;
  }

  .auth-form small {
    min-height: 0;
  }

  .account-pill {
    gap: 8px;
  }

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

  .progress-steps {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    margin-top: 8px;
  }

  .progress-step {
    grid-template-columns: 1fr;
    justify-items: center;
    min-height: 34px;
    padding: 5px 2px;
    border-radius: 8px;
    font-size: 0;
  }

  .progress-step b {
    width: 22px;
    height: 22px;
    font-size: 12px;
  }

  .progress-step em {
    display: none;
  }

  .search-progress {
    padding: 10px;
  }

  .search-progress small,
  .status-detail {
    font-size: 12px;
    line-height: 1.45;
  }

  .filter-drawer > summary small {
    display: none;
  }

  .result-main {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
  }

  .result-card h2 {
    font-size: 16px;
  }

  .result-card .summary {
    -webkit-line-clamp: 1;
    margin-bottom: 4px;
  }

  .result-card .why {
    display: -webkit-box;
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.45;
    -webkit-line-clamp: 1;
  }

  .compact-tags {
    display: flex;
    gap: 5px;
    margin-top: 8px;
  }

  .compact-tags .tag {
    padding: 4px 7px;
    font-size: 11px;
    line-height: 1.1;
  }

  .plan-modules {
    grid-template-columns: 1fr;
  }

  .flow-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .flow-row span {
    flex: 0 0 auto;
  }

  .action-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .connection-table {
    min-width: 560px;
  }

  .login-shell {
    width: 100%;
    min-height: 100vh;
    padding: 22px 14px 18px;
    place-items: stretch;
  }

  .login-panel {
    grid-template-columns: 1fr;
    align-content: start;
    gap: 20px;
    padding: 0;
  }

  .login-brand {
    align-content: start;
    justify-items: center;
    gap: 12px;
    text-align: center;
  }

  .login-logo-frame {
    width: min(178px, 48vw);
    margin: 0 auto 2px;
  }

  .login-brand h1 {
    font-size: 34px;
    letter-spacing: 0;
  }

  .login-brand p {
    max-width: 280px;
    font-size: 14px;
    line-height: 1.65;
  }

  .login-card {
    gap: 12px;
    padding: 18px;
    border-radius: 18px;
  }

  .login-card strong {
    font-size: 17px;
  }

  .login-card input {
    min-height: 52px;
    padding: 0 14px;
    border-radius: 12px;
  }

  .login-card button {
    min-height: 52px;
    border-radius: 12px;
  }

  .login-meta-row {
    justify-content: center;
    gap: 8px;
  }

  .login-meta-row span,
  .login-meta-row .count-pill {
    padding: 7px 10px;
    font-size: 12px;
  }

  .search-panel,
  .search-panel *,
  .account-drawer,
  .account-drawer *,
  .account-drawer[open] .auth-box {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .search-panel {
    width: calc(100vw - 16px) !important;
    margin: 8px auto 0 !important;
    padding: 16px !important;
    overflow: hidden !important;
  }

  .account-drawer,
  .account-drawer[open],
  .account-drawer[open] .auth-box {
    position: static !important;
    inset: auto !important;
    right: auto !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 12px 0 0 !important;
  }

  .account-drawer[open] .auth-box {
    padding: 12px !important;
    box-shadow: none !important;
  }

  .account-drawer summary {
    width: 100% !important;
    justify-content: center !important;
  }
}

@media (max-width: 430px) {
  h1 {
    font-size: 30px;
  }

  .result-main {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .badge {
    padding: 4px 7px;
    font-size: 11px;
  }

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

/* Formal app shell */
:root {
  --bg: #f4f9fc;
  --surface: #ffffff;
  --surface-soft: #f7fbfe;
  --ink: #302827;
  --muted: #5f6978;
  --line: #d9e6ee;
  --accent: #088fcf;
  --accent-strong: #0477ad;
  --brand-blue: #088fcf;
  --brand-blue-deep: #056ea5;
  --brand-ink: #302827;
  --brand-wash: #eef8fd;
  --green-soft: #eaf8f4;
  --blue-soft: #edf7ff;
  --shadow: 0 18px 48px rgba(23, 43, 57, 0.08);
}

.app-body {
  color: var(--brand-ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0, rgba(243, 250, 253, 0.98) 42%, #eef7fb 100%);
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 74px;
  padding: 0 max(24px, calc((100vw - 1280px) / 2 + 24px));
  border-bottom: 1px solid rgba(32, 55, 70, 0.1);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--brand-ink);
  text-decoration: none;
}

.topbar-brand img {
  display: block;
  width: 42px;
  height: 42px;
  object-fit: contain;
  flex: 0 0 auto;
}

.topbar-title {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding-left: 14px;
  border-left: 1px solid rgba(48, 40, 39, 0.16);
}

.topbar-title strong,
.topbar-title small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-title strong {
  color: var(--brand-ink);
  font-size: 16px;
  font-weight: 900;
}

.topbar-title small {
  color: #6d7480;
  font-size: 12px;
  font-weight: 800;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.app-topbar .count-pill {
  height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(8, 143, 207, 0.18);
  color: var(--accent-strong);
  background: rgba(238, 248, 253, 0.88);
  font-size: 13px;
}

.app-topbar .auth-box {
  min-width: 0;
}

.app-topbar .account-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.app-topbar .account-pill .auth-heading,
.app-topbar .account-pill small {
  display: none;
}

.app-topbar .account-pill span {
  max-width: 150px;
  padding: 0;
  overflow: hidden;
  color: var(--brand-ink);
  background: transparent;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-topbar .account-pill button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(32, 55, 70, 0.14);
  color: var(--brand-ink);
  background: #fff;
  box-shadow: none;
}

.app-shell {
  width: min(1280px, calc(100vw - 48px));
  padding: 0 0 48px;
}

.app-command {
  position: relative;
  overflow: hidden;
  padding: 56px 0 30px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.app-command::before {
  position: absolute;
  top: 12px;
  right: -120px;
  width: 560px;
  height: 250px;
  content: "";
  opacity: 0.45;
  background: repeating-linear-gradient(
    135deg,
    rgba(8, 143, 207, 0.14) 0,
    rgba(8, 143, 207, 0.14) 1px,
    transparent 1px,
    transparent 22px
  );
  transform: skewX(-18deg);
  pointer-events: none;
}

.app-command .hero-main {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  min-width: 0;
  text-align: center;
}

.app-hero-title {
  width: 100%;
  justify-content: center;
}

.app-hero-title > div {
  max-width: 880px;
  min-width: 0;
}

.brand-kicker {
  margin-bottom: 10px;
  color: var(--accent-strong);
  font-size: 12px;
  letter-spacing: 0;
}

.app-command h1 {
  max-width: 920px;
  color: var(--brand-ink);
  font-size: clamp(40px, 5.2vw, 66px);
  line-height: 1.06;
}

.hero-copy {
  max-width: 720px;
  margin: 16px auto 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.app-command .search-box {
  width: min(880px, 100%);
  grid-template-columns: minmax(0, 1fr) 124px;
  gap: 8px;
  margin: 28px auto 0;
  padding: 8px;
  border: 1px solid rgba(32, 55, 70, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 44px rgba(21, 53, 73, 0.12);
}

.app-command .search-box input {
  min-height: 56px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  font-size: 16px;
}

.app-command .search-box input:focus {
  box-shadow: inset 0 0 0 2px rgba(8, 143, 207, 0.2);
}

.app-command .search-box button {
  min-height: 56px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #159bdb, var(--brand-blue-deep));
  box-shadow: 0 12px 26px rgba(8, 143, 207, 0.24);
}

.app-command .quick-row {
  justify-content: center;
  width: min(880px, 100%);
  margin: 18px auto 0;
}

.app-command .quick-row button,
.app-workspace .tag {
  border-color: rgba(8, 143, 207, 0.14);
  color: #346170;
  background: rgba(255, 255, 255, 0.82);
}

.app-command .quick-row button:hover {
  color: var(--accent-strong);
  background: var(--blue-soft);
}

.app-command .search-progress {
  width: min(880px, 100%);
  margin: 18px auto 0;
  border-color: rgba(8, 143, 207, 0.18);
  background: rgba(238, 248, 253, 0.86);
}

.app-command .progress-track span {
  background: linear-gradient(90deg, var(--brand-blue), #19b5a8);
}

.app-command .progress-step.done,
.app-command .progress-step.active {
  color: var(--accent-strong);
  border-color: rgba(8, 143, 207, 0.28);
  background: #f5fbff;
}

.app-command .progress-step.done b,
.app-command .progress-step.active b {
  background: var(--brand-blue);
}

.app-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 460px);
  gap: 20px;
  align-items: start;
  margin-top: 0;
}

.filter-panel {
  grid-column: 1 / -1;
  overflow: hidden;
  border: 1px solid rgba(32, 55, 70, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: none;
}

.filter-panel .filter-drawer > summary {
  min-height: 58px;
  padding: 0 20px;
}

.filter-panel .filter-drawer > summary span {
  color: var(--brand-ink);
  font-size: 18px;
}

.filter-panel .filter-drawer > summary small {
  color: #7c8592;
}

.filter-panel .filter-grid {
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr) minmax(220px, 0.8fr);
  padding: 16px 20px 18px;
  border-top-color: rgba(32, 55, 70, 0.1);
  background: rgba(247, 251, 254, 0.9);
}

.filter-panel .panel-title {
  color: var(--accent-strong);
}

.filter-panel label {
  min-height: 36px;
  border-radius: var(--radius);
  color: #596577;
  background: #fff;
}

.filter-panel label:has(input:checked) {
  border-color: rgba(8, 143, 207, 0.28);
  color: var(--accent-strong);
  background: var(--blue-soft);
}

.status-line {
  margin: 2px 0 14px;
}

.status-main {
  color: #657184;
}

.status-detail,
.search-progress small {
  color: var(--accent-strong);
}

.app-workspace .result-card,
.app-workspace .ai-card,
.app-workspace .detail-panel {
  border: 1px solid rgba(32, 55, 70, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 36px rgba(23, 43, 57, 0.07);
}

.app-workspace .result-card,
.app-workspace .ai-card {
  padding: 16px;
}

.app-workspace .result-card {
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.app-workspace .result-card:hover,
.app-workspace .result-card.active {
  border-color: rgba(8, 143, 207, 0.46);
  box-shadow: 0 18px 42px rgba(8, 143, 207, 0.12);
}

.app-workspace .result-main {
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 16px;
}

.app-workspace .result-main:not(:has(.card-thumb)) {
  grid-template-columns: 1fr;
}

.app-workspace .card-thumb {
  border-color: rgba(32, 55, 70, 0.1);
  background: #f6fafc;
}

.app-workspace .result-head strong {
  color: var(--accent-strong);
}

.app-workspace .match-badge {
  color: #155a91;
  border-color: #d7e7f5;
  background: #f3f8fd;
}

.app-workspace .result-card h2 {
  color: var(--brand-ink);
  font-size: 20px;
}

.app-workspace .detail-panel h2 {
  color: var(--brand-ink);
  font-size: 22px;
}

.badge.main,
.badge.safe {
  color: var(--accent-strong);
  background: var(--blue-soft);
}

.badge.sub {
  color: #5b433a;
  background: #f3eeeb;
}

.fit-line,
.local-source-label {
  color: var(--accent-strong);
  background: var(--blue-soft);
}

.ai-card {
  background: linear-gradient(135deg, #f6fbff, #fff);
}

.ai-title strong {
  color: var(--brand-ink);
}

.app-workspace .detail-panel {
  top: 92px;
  max-height: calc(100vh - 112px);
  overflow: auto;
  padding: 18px;
}

.preview-frame {
  border-color: rgba(32, 55, 70, 0.12);
  background: #f7fafc;
}

.preview-frame img {
  background: #f7fafc;
}

.source-card-preview,
.ai-detail {
  border-color: rgba(8, 143, 207, 0.18);
  background: var(--blue-soft);
}

.block-item {
  border-color: rgba(8, 143, 207, 0.14);
}

.primary-link,
.auth-form button[type="submit"] {
  background: linear-gradient(180deg, #159bdb, var(--brand-blue-deep));
}

.ghost-button,
.ghost-link,
.account-pill button,
.auth-form .link-button {
  color: var(--accent-strong);
  background: var(--blue-soft);
}

@media (max-width: 1040px) {
  .app-workspace {
    grid-template-columns: 1fr;
  }

  .app-workspace .detail-panel {
    position: static;
    max-height: none;
  }

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

  .detail-community-prompt {
    display: grid;
  }

  .detail-community-actions {
    width: 100%;
  }

  .detail-community-actions button {
    flex: 1 1 0;
  }
}

@media (max-width: 900px) {
  .app-topbar {
    flex-wrap: wrap;
    gap: 10px 16px;
    min-height: auto;
    padding: 10px 16px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .app-shell {
    width: calc(100vw - 28px);
  }

  .app-command h1 {
    font-size: clamp(36px, 8vw, 52px);
  }
}

@media (max-width: 720px) {
  .app-body {
    background: linear-gradient(180deg, #fff 0, #f5fbfe 45%, #edf7fb 100%);
  }

  .app-topbar {
    flex-wrap: nowrap;
    gap: 8px 12px;
    min-height: 58px;
    padding: 9px 12px;
  }

  .topbar-brand {
    gap: 10px;
  }

  .topbar-brand img {
    width: 36px;
    height: 36px;
  }

  .topbar-title {
    padding-left: 10px;
  }

  .topbar-title strong {
    font-size: 14px;
  }

  .topbar-title small {
    font-size: 11px;
  }

  .app-topbar .count-pill {
    display: none;
  }

  .topbar-actions {
    width: auto;
    margin-left: auto;
    justify-content: flex-end;
  }

  .app-topbar .account-pill span {
    max-width: 96px;
    font-size: 13px;
  }

  .app-topbar .account-pill button {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }

  .app-shell {
    width: 100%;
    padding: 0 12px 28px;
  }

  .app-command {
    padding: 32px 0 20px;
  }

  .app-command::before {
    display: none;
  }

  .app-command h1 {
    font-size: 34px;
    line-height: 1.12;
  }

  .brand-kicker {
    font-size: 11px;
  }

  .hero-copy {
    max-width: 330px;
    margin-top: 12px;
    font-size: 14px;
    line-height: 1.65;
  }

  .app-command .search-box {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 22px;
    padding: 8px;
  }

  .app-command .search-box input,
  .app-command .search-box button {
    min-height: 52px;
  }

  .app-command .quick-row {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    width: 100%;
    padding-bottom: 4px;
  }

  .app-command .quick-row button {
    flex: 0 0 auto;
  }

  .app-command .search-progress {
    width: 100%;
  }

  .app-workspace {
    gap: 12px;
  }

  .filter-panel .filter-drawer > summary {
    min-height: 50px;
    padding: 0 14px;
  }

  .filter-panel .filter-drawer > summary span {
    font-size: 17px;
  }

  .filter-panel .filter-grid {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .filter-panel label {
    min-height: 34px;
  }

  .app-workspace .result-card,
  .app-workspace .ai-card,
  .app-workspace .detail-panel {
    padding: 12px;
    box-shadow: 0 10px 26px rgba(23, 43, 57, 0.06);
  }

  .app-workspace .result-main {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
  }

  .app-workspace .result-card h2 {
    font-size: 17px;
  }

  .app-workspace .detail-panel h2 {
    font-size: 19px;
  }

  .status-line {
    margin: 0 2px 12px;
  }

  .preview-frame img {
    max-height: 360px;
  }

  .preview-modal {
    padding: 10px;
  }

  .preview-modal-card {
    max-height: calc(100vh - 20px);
    padding: 10px;
  }

  .preview-modal-head {
    align-items: flex-start;
    flex-direction: column;
    padding-right: 42px;
  }

  .preview-large-frame {
    max-height: calc(100vh - 150px);
  }
}

@media (max-width: 430px) {
  .app-topbar {
    padding-inline: 10px;
  }

  .topbar-brand img {
    width: 34px;
    height: 34px;
  }

  .topbar-title {
    padding-left: 8px;
  }

  .topbar-title strong {
    font-size: 13px;
  }

  .topbar-title small {
    font-size: 10px;
  }

  .app-topbar .count-pill {
    display: none;
  }

  .app-command h1 {
    font-size: 31px;
  }

  .hero-copy {
    max-width: 300px;
    font-size: 13px;
  }

  .app-shell {
    padding: 0 10px 24px;
  }

  .app-workspace .result-main {
    grid-template-columns: 86px minmax(0, 1fr);
  }
}

/* Workbench redesign 2026-06-02 */
:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #17202a;
  --muted: #5b6678;
  --line: #d9e3ee;
  --accent: #0b8fd3;
  --accent-strong: #08679b;
  --teal: #0f8b7f;
  --teal-soft: #e8f8f5;
  --amber: #a65f00;
  --amber-soft: #fff4dc;
  --blue-soft: #edf7ff;
  --shadow: 0 12px 34px rgba(17, 35, 51, 0.08);
  --radius: 8px;
}

body.app-body {
  background:
    linear-gradient(180deg, #ffffff 0, #f7fbfd 150px, var(--bg) 520px),
    var(--bg);
  color: var(--ink);
}

.app-topbar {
  min-height: 64px;
  padding: 0 max(16px, calc((100vw - 1320px) / 2 + 18px));
  border-bottom: 1px solid rgba(23, 32, 42, 0.1);
  background: rgba(255, 255, 255, 0.92);
}

.topbar-brand img {
  width: 38px;
  height: 38px;
}

.topbar-title {
  padding-left: 12px;
}

.app-shell {
  width: min(1320px, calc(100vw - 32px));
  padding-bottom: 44px;
}

.app-command {
  padding: 24px 0 18px;
}

.app-command::before {
  top: 0;
  right: 0;
  width: 420px;
  height: 170px;
  opacity: 0.22;
  background:
    linear-gradient(90deg, rgba(11, 143, 211, 0.1) 1px, transparent 1px),
    linear-gradient(180deg, rgba(15, 139, 127, 0.08) 1px, transparent 1px);
  background-size: 24px 24px;
  transform: none;
}

.app-command .hero-main {
  justify-items: start;
  text-align: left;
}

.app-hero-title {
  justify-content: flex-start;
}

.app-hero-title > div {
  max-width: 940px;
}

.brand-kicker {
  margin-bottom: 8px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.app-command h1 {
  max-width: 820px;
  color: var(--ink);
  font-size: 42px;
  line-height: 1.12;
}

.hero-copy {
  max-width: 780px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.app-command .search-box {
  width: min(920px, 100%);
  margin: 20px 0 0;
  border-color: rgba(23, 32, 42, 0.12);
  border-radius: var(--radius);
  box-shadow: 0 14px 34px rgba(11, 143, 211, 0.12);
}

.app-command .quick-row,
.app-command .search-progress {
  width: min(920px, 100%);
  margin-left: 0;
  margin-right: 0;
  justify-content: flex-start;
}

.app-command .search-box button,
.primary-link,
.auth-form button[type="submit"] {
  background: linear-gradient(180deg, #0f9add, #0876ad);
}

.app-workspace {
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, 0.82fr);
  gap: 18px;
}

.filter-panel {
  border-color: rgba(23, 32, 42, 0.1);
  background: rgba(255, 255, 255, 0.9);
}

.filter-panel .filter-drawer > summary {
  min-height: 50px;
}

.filter-panel .filter-drawer > summary span {
  font-size: 16px;
}

.results {
  gap: 14px;
}

.app-workspace .result-card,
.app-workspace .ai-card,
.app-workspace .detail-panel,
.community-panel,
.plan-community-panel,
.community-form,
.community-item,
.community-empty {
  border-radius: var(--radius);
}

.app-workspace .ai-card {
  border-color: rgba(11, 143, 211, 0.2);
  background: #fff;
}

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

.ai-card-head,
.subhead-row,
.plan-community-head,
.schematic-title-row,
.card-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ai-card-head {
  align-items: center;
}

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

.ai-title strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
  line-height: 1.35;
}

.ai-head-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.ai-head-actions .ghost-button,
.ai-head-actions .ghost-link,
.compact-action {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.ghost-button.saved-action {
  color: #0f766e;
  border-color: rgba(15, 118, 110, 0.22);
  background: #ecfdf5;
}

.ghost-button:disabled,
.ghost-button[disabled] {
  opacity: 0.65;
  cursor: wait;
}

.plan-save-scope {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  color: #334155;
}

.plan-save-scope span,
.plan-save-scope small {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.plan-save-scope small {
  color: #64748b;
}

.plan-save-options {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(86px, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.plan-save-options button {
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-left: 1px solid var(--line);
  color: #475569;
  background: transparent;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.plan-save-options button:first-child {
  border-left: 0;
}

.plan-save-options button.active {
  color: #0f766e;
  background: #ecfdf5;
}

.plan-saved-note {
  padding: 9px 11px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: var(--radius);
  color: #0f766e;
  background: #f0fdfa;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.plan-summary {
  margin: 0;
  color: #385160;
  line-height: 1.65;
}

.schematic-visual {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(11, 143, 211, 0.16);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(11, 143, 211, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(15, 139, 127, 0.05) 1px, transparent 1px),
    #fbfdff;
  background-size: 22px 22px;
}

.schematic-title-row span,
.plan-community-head span {
  display: block;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.schematic-title-row strong,
.plan-community-head strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  line-height: 1.35;
}

.schematic-title-row small,
.plan-community-head small,
.subhead-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.circuit-board {
  position: relative;
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 34px 12px 30px;
  overflow: hidden;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(15, 118, 110, 0.05) 1px, transparent 1px),
    #ffffff;
  background-size: 18px 18px;
}

.generated-schematic-file {
  display: grid;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #cbd5df;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 8px 18px rgba(23, 32, 42, 0.04);
}

.generated-schematic-file-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 11px 12px;
  border-bottom: 1px solid #d8e0e8;
  background: #f8fafc;
}

.generated-schematic-file-head span {
  display: block;
  color: #0f766e;
  font-size: 11px;
  font-weight: 950;
}

.generated-schematic-file-head strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generated-schematic-file-head small,
.generated-schematic-file-foot {
  display: block;
  margin-top: 4px;
  color: #647184;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.generated-schematic-file-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.generated-schematic-file-actions a,
.generated-schematic-file-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  color: #334155;
  background: #fff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.generated-schematic-file-actions a:hover,
.generated-schematic-file-actions a:focus-visible,
.generated-schematic-file-actions button:hover,
.generated-schematic-file-actions button:focus-visible {
  border-color: #8ecae6;
  color: #0f6f9f;
  outline: none;
}

.generated-schematic-file-preview {
  display: flex;
  min-height: 520px;
  max-height: min(76vh, 760px);
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  padding: 14px;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(11, 143, 211, 0.04) 1px, transparent 1px),
    #ffffff;
  background-size: 20px 20px;
  scrollbar-color: #b6c7d4 transparent;
}

.generated-schematic-file-preview img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 980px;
  border: 1px solid #d8e0e8;
  background: #fff;
  box-shadow: 0 8px 22px rgba(23, 32, 42, 0.08);
}

.generated-schematic-file-foot {
  margin-top: 0;
  padding: 9px 12px 11px;
  border-top: 1px solid #edf2f7;
  background: #fff;
}

.circuit-rail {
  position: absolute;
  right: 14px;
  left: 14px;
  height: 2px;
  background: #98a2b3;
}

.circuit-rail span {
  position: absolute;
  top: -11px;
  left: 0;
  padding: 0 7px;
  color: #475467;
  background: #fff;
  font-size: 11px;
  font-weight: 900;
}

.circuit-rail-vcc {
  top: 16px;
}

.circuit-rail-gnd {
  bottom: 16px;
}

.circuit-stage-track {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 18px;
  min-width: 0;
}

.circuit-stage {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 166px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(248, 250, 252, 0.95);
  text-align: left;
  box-shadow: 0 8px 18px rgba(23, 32, 42, 0.05);
}

button.circuit-stage {
  cursor: pointer;
}

button.circuit-stage:hover,
button.circuit-stage:focus-visible {
  border-color: var(--accent);
  outline: none;
  background: #f0fdfa;
}

.circuit-stage.active {
  border-color: rgba(15, 118, 110, 0.62);
  background: #f0fdfa;
  box-shadow: inset 0 0 0 2px rgba(15, 118, 110, 0.12), 0 8px 18px rgba(23, 32, 42, 0.05);
}

.circuit-stage::before {
  position: absolute;
  top: -18px;
  bottom: -18px;
  left: 20px;
  width: 1px;
  content: "";
  background: rgba(71, 84, 103, 0.35);
}

.circuit-stage:not(:last-child)::after {
  position: absolute;
  top: 50%;
  right: -19px;
  width: 18px;
  height: 2px;
  content: "";
  background: #475467;
}

.circuit-stage-index {
  position: relative;
  z-index: 1;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 4px;
  color: #fff;
  background: #475467;
  font-size: 12px;
  font-weight: 900;
}

.circuit-stage-current {
  position: absolute;
  top: 9px;
  right: 9px;
  padding: 3px 6px;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 4px;
  color: #0f766e;
  background: #fff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.1;
}

.circuit-stage-role {
  margin-top: 8px;
  color: #0f766e;
  font-size: 12px;
  font-weight: 900;
}

.circuit-symbol {
  display: grid;
  height: 54px;
  margin: 3px 0;
  place-items: center;
  color: #334155;
}

.circuit-symbol svg {
  width: min(92px, 100%);
  height: 54px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.circuit-symbol-preview {
  height: 76px;
  overflow: hidden;
  border: 1px solid #d8e1ea;
  border-radius: 6px;
  background: #fff;
}

.circuit-symbol-preview .preview-image-shell,
.circuit-symbol-preview .preview-image-shell > img {
  height: 100%;
}

.circuit-symbol-preview img {
  object-fit: contain;
}

.circuit-symbol-preview .preview-fallback {
  min-height: 100%;
  padding: 6px;
  text-align: center;
}

.circuit-symbol-preview .preview-fallback span,
.circuit-symbol-preview .preview-fallback-actions {
  display: none;
}

.circuit-stage strong {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.circuit-stage small {
  margin-top: 6px;
  color: #647184;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
}

.circuit-stage.virtual {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.9);
}

.schema-track {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.schema-node {
  position: relative;
  display: grid;
  gap: 6px;
  min-width: 120px;
  min-height: 116px;
  padding: 12px;
  border: 1px solid rgba(11, 143, 211, 0.2);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
}

.schema-node:not(:last-child)::after {
  position: absolute;
  top: 50%;
  right: -9px;
  width: 8px;
  height: 2px;
  content: "";
  background: var(--accent);
}

.schema-node b {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  font-size: 13px;
}

.schema-node span {
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.schema-node strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
}

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

.net-grid div {
  padding: 9px 10px;
  border: 1px solid rgba(15, 139, 127, 0.18);
  border-radius: var(--radius);
  background: rgba(232, 248, 245, 0.72);
}

.net-grid span {
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.net-grid p,
.schema-note {
  margin: 4px 0 0;
  color: #41515e;
  font-size: 13px;
  line-height: 1.5;
}

.plan-modules {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.plan-module {
  min-height: 116px;
  border-color: rgba(23, 32, 42, 0.1);
  background: #fff;
}

.plan-module:hover {
  border-color: rgba(11, 143, 211, 0.35);
  background: #f8fcff;
}

.plan-connection-wrap {
  margin-top: 0;
}

.subhead-row {
  align-items: center;
  margin-bottom: 8px;
}

.subhead-row strong {
  color: var(--ink);
  font-size: 15px;
}

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

.plan-steps {
  margin: 0;
  padding: 12px 12px 12px 30px;
  border: 1px solid rgba(23, 32, 42, 0.1);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: #41515e;
  line-height: 1.55;
}

.method-list {
  padding: 12px;
  border: 1px solid rgba(23, 32, 42, 0.1);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.method-list strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
}

.plan-checks {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.plan-checks span,
.gap-note {
  border: 1px solid rgba(166, 95, 0, 0.16);
}

.plan-community-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(15, 139, 127, 0.22);
  background: linear-gradient(180deg, #fbfffe, #f7fbff);
}

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

.plan-form {
  background: #fff;
}

.compact-community-list {
  max-height: 360px;
  overflow: auto;
}

.plan-item {
  background: #fff;
}

.card-actions {
  align-items: center;
  margin-top: 10px;
}

.card-actions .tap-hint {
  margin-top: 0;
}

.compact-action {
  flex: 0 0 auto;
}

.app-workspace .detail-panel {
  top: 80px;
  max-height: calc(100vh - 96px);
}

.community-panel {
  border-color: rgba(15, 139, 127, 0.22);
  background: linear-gradient(180deg, #fbfffe, #fff);
}

.community-grid {
  gap: 10px;
}

.community-form {
  border-color: rgba(23, 32, 42, 0.1);
}

.community-form input,
.community-form select,
.community-form textarea,
.feedback-form input,
.feedback-form select,
.feedback-form textarea {
  border-radius: var(--radius);
}

@media (max-width: 1120px) {
  .app-workspace {
    grid-template-columns: 1fr;
  }

  .app-workspace .detail-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 760px) {
  .app-topbar {
    min-height: 56px;
    padding: 8px 10px;
  }

  .app-shell {
    width: 100%;
    padding: 0 10px 28px;
  }

  .app-command {
    padding: 22px 0 14px;
  }

  .app-command::before {
    display: none;
  }

  .app-command h1 {
    font-size: 30px;
  }

  .hero-copy {
    max-width: 100%;
    font-size: 14px;
  }

  .app-command .search-box {
    grid-template-columns: 1fr;
    margin-top: 16px;
    box-shadow: 0 10px 24px rgba(11, 143, 211, 0.1);
  }

  .app-command .search-box input,
  .app-command .search-box button {
    min-height: 50px;
  }

  .ai-card-head,
  .plan-community-head,
  .schematic-title-row,
  .card-actions {
    display: grid;
    gap: 10px;
  }

  .ai-head-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .ai-head-actions .ghost-button,
  .ai-head-actions .ghost-link {
    width: 100%;
  }

  .generated-schematic-file-head {
    grid-template-columns: 1fr;
  }

  .generated-schematic-file-actions {
    justify-content: flex-start;
  }

  .generated-schematic-file-preview {
    min-height: 420px;
    max-height: 72vh;
  }

  .plan-save-scope {
    display: grid;
    gap: 8px;
  }

  .plan-save-options {
    width: 100%;
  }

  .ai-title strong {
    font-size: 18px;
  }

  .schema-track {
    grid-template-columns: repeat(5, minmax(136px, 1fr));
  }

  .net-grid,
  .plan-modules,
  .plan-checks,
  .plan-community-grid,
  .community-grid {
    grid-template-columns: 1fr;
  }

  .community-hub-card {
    padding: 12px;
  }

  .community-feed-list {
    max-height: 280px;
    overflow: auto;
  }

  .connection-table {
    min-width: 660px;
  }

  .app-workspace .result-main {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .compact-action {
    width: 100%;
  }

  .compact-community-list {
    max-height: none;
  }
}

@media (max-width: 430px) {
  .app-command h1 {
    font-size: 28px;
  }

  .topbar-title small {
    display: none;
  }

  .app-workspace .result-main {
    grid-template-columns: 72px minmax(0, 1fr);
  }
}

/* Focus pass: keep the search answer as the first thing users read. */
.app-workspace .results-column {
  order: 1;
}

.app-workspace .detail-panel {
  order: 2;
}

.app-workspace .filter-panel {
  order: 3;
  grid-column: 1 / -1;
}

.app-workspace .reading-path {
  border-color: rgba(15, 139, 127, 0.18);
  background: rgba(255, 255, 255, 0.96);
}

.community-drawer {
  overflow: hidden;
}

.community-drawer > summary {
  min-height: 46px;
}

.community-drawer .community-hub-card {
  background: rgba(255, 255, 255, 0.96);
}

@media (max-width: 1120px) {
  .app-workspace .filter-panel {
    order: 3;
  }
}

@media (max-width: 760px) {
  .app-workspace .reading-path {
    padding: 11px;
  }

  .reading-path > div {
    display: grid;
    gap: 4px;
  }

  .reading-path ol {
    grid-template-columns: 1fr;
  }

  .reading-path li {
    min-height: 0;
  }

  .community-drawer > summary {
    display: grid;
    gap: 2px;
    align-content: center;
    padding: 8px 12px;
  }

  .community-drawer > summary small {
    text-align: left;
  }

  .contribution-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Database/forum pass: compact, source-first, low decoration. */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #1f2933;
  --muted: #667085;
  --line: #d8dee6;
  --accent: #1f6fb2;
  --accent-strong: #155a91;
  --teal: #177e72;
  --teal-soft: #e9f5f3;
  --blue-soft: #edf4fb;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  --radius: 6px;
}

body.app-body {
  color: var(--ink);
  background: var(--bg);
}

.app-topbar {
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  backdrop-filter: none;
}

.app-topbar .count-pill,
.app-topbar .account-pill button {
  height: 32px;
  min-height: 32px;
  box-shadow: none;
}

.app-shell {
  width: min(1240px, calc(100vw - 32px));
  padding-bottom: 36px;
}

.app-command {
  padding: 18px 0 14px;
  border-bottom: 1px solid var(--line);
}

.app-command::before,
.brand-kicker {
  display: none;
}

.app-command .hero-main {
  text-align: left;
}

.app-command h1 {
  font-size: 30px;
  line-height: 1.2;
}

.hero-copy {
  max-width: 760px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.app-command .search-box {
  width: min(860px, 100%);
  grid-template-columns: minmax(0, 1fr) 108px;
  gap: 0;
  margin-top: 14px;
  padding: 0;
  border: 1px solid #cfd8e3;
  background: #fff;
  box-shadow: none;
}

.app-command .search-box input {
  min-height: 46px;
  padding: 0 14px;
  border-radius: var(--radius) 0 0 var(--radius);
  font-size: 15px;
}

.app-command .search-box input:focus {
  box-shadow: inset 0 0 0 2px rgba(31, 111, 178, 0.16);
}

.app-command .search-box button,
.primary-link,
.auth-form button[type="submit"] {
  min-height: 46px;
  border-left: 1px solid #cfd8e3;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: #1f6fb2;
  box-shadow: none;
}

.app-command .quick-row {
  gap: 6px;
  width: min(860px, 100%);
  margin-top: 10px;
}

.app-command .quick-row button,
.app-workspace .tag {
  min-height: 30px;
  padding: 0 9px;
  border-color: #d8dee6;
  color: #455468;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
}

.app-command .quick-row button:hover {
  color: var(--accent-strong);
  background: #f8fafc;
}

.app-command .search-progress {
  width: min(860px, 100%);
  margin-top: 10px;
  padding: 8px 10px;
  border-color: var(--line);
  background: #fff;
  box-shadow: none;
}

.progress-track {
  height: 3px;
}

.progress-steps {
  display: none;
}

.progress-foot {
  margin-top: 6px;
}

.search-progress small,
.status-detail {
  color: #536171;
  font-size: 12px;
  font-weight: 700;
}

.app-workspace {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  gap: 14px;
  margin-top: 14px;
}

.status-line {
  margin: 0 0 8px;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
}

.status-main {
  color: #475467;
  font-weight: 700;
}

.result-overview {
  display: grid;
  grid-template-columns: minmax(180px, 0.75fr) minmax(360px, 1.25fr) auto;
  align-items: start;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.result-overview-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.result-overview-main strong {
  color: var(--ink);
  font-size: 15px;
}

.result-overview-main span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.result-filter-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex-wrap: wrap;
}

.result-filter-shell {
  min-width: 0;
}

.result-filter-toggle-button {
  display: none;
}

.filter-chip-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex-wrap: wrap;
}

.filter-chip,
.filter-toggle,
.filter-select-inline {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  color: #344054;
  font-size: 12px;
  font-weight: 800;
}

.filter-chip {
  padding: 5px 9px;
  cursor: pointer;
}

.filter-chip:hover,
.filter-chip:focus-visible,
.filter-chip.active,
.filter-toggle.active {
  color: var(--accent-strong);
  border-color: #9fc9e7;
  background: #eef8ff;
  outline: none;
}

.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  cursor: pointer;
}

.filter-toggle input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

.filter-select-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
}

.filter-select-inline span {
  color: #667085;
}

.filter-select-inline select {
  min-height: 28px;
  border: 0;
  color: #344054;
  background: transparent;
  font: inherit;
  outline: none;
}

.result-view-toggle {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

.view-toggle-button {
  min-height: 26px;
  padding: 4px 9px;
  border: 0;
  border-radius: 5px;
  color: #536171;
  background: transparent;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.view-toggle-button:hover,
.view-toggle-button:focus-visible,
.view-toggle-button.active {
  color: var(--accent-strong);
  background: #fff;
  outline: none;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

.result-tabs {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 4px;
}

.result-tabs a,
.result-tabs button {
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #344054;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.result-tabs a:hover,
.result-tabs a:focus-visible,
.result-tabs button:hover,
.result-tabs button:focus-visible {
  color: var(--accent-strong);
  border-color: #b8cbe0;
  background: #fff;
  outline: none;
}

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

.result-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.result-table-summary {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.result-table-summary div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.result-table-summary span,
.result-table-summary small {
  min-width: 0;
  overflow: hidden;
  color: #64748b;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-table-summary strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 950;
  line-height: 1.25;
  white-space: nowrap;
}

.result-table-head,
.result-row {
  display: grid;
  grid-template-columns: minmax(250px, 1.75fr) minmax(118px, 0.62fr) 86px 104px 92px minmax(118px, 0.7fr);
  align-items: center;
  column-gap: 12px;
}

.result-table-head {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: #667085;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 900;
}

.result-table-body {
  display: grid;
}

.result-row {
  min-width: 0;
  padding: 11px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

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

.result-row:hover,
.result-row:focus-visible,
.result-row.active {
  background: #f8fbff;
  outline: none;
}

.result-row.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.result-row-title,
.result-row-category,
.result-row-format,
.result-row-status,
.result-row-community,
.result-row-actions {
  min-width: 0;
}

.result-row-title {
  display: grid;
  gap: 4px;
}

.result-row-title strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.32;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-row-title span,
.result-row-category small,
.result-row-format small {
  color: #667085;
  font-size: 12px;
  line-height: 1.35;
}

.result-row-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-row-code::after {
  content: " · ";
}

.result-row-category,
.result-row-format,
.result-row-status {
  display: grid;
  gap: 3px;
}

.result-row-category span,
.result-row-format b,
.result-row-status b {
  overflow: hidden;
  color: #344054;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-row-status small {
  overflow: hidden;
  color: #667085;
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-row-community {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 5px;
  align-items: baseline;
  color: #667085;
  font-size: 12px;
}

.result-row-community b {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.result-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.row-action {
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #344054;
  background: #fff;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.row-action:hover,
.row-action:focus-visible,
.row-action.saved-action {
  color: var(--accent-strong);
  border-color: #b8cbe0;
  background: #eef8ff;
  outline: none;
}

.result-empty-card {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px dashed #b8cbe0;
  border-radius: var(--radius);
  background: #f8fbff;
  color: #536171;
}

.result-empty-card strong {
  color: var(--ink);
  font-size: 15px;
}

.result-empty-card span {
  font-size: 13px;
  line-height: 1.6;
}

.result-empty-card .ghost-button {
  width: fit-content;
}

.app-workspace .result-card,
.app-workspace .ai-card,
.app-workspace .detail-panel,
.filter-panel,
.community-drawer,
.plan-community-panel,
.community-form,
.community-item,
.community-empty {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.app-workspace .result-card,
.app-workspace .ai-card {
  padding: 12px;
}

.app-workspace .result-card:hover,
.app-workspace .result-card.active {
  transform: none;
  border-color: #9bb8d5;
  box-shadow: 0 0 0 2px rgba(31, 111, 178, 0.08);
}

.app-workspace .result-card h2 {
  margin-top: 7px;
  font-size: 18px;
}

.result-meta,
.plan-meta {
  color: #667085;
}

.badge,
.tag,
.local-source-label,
.fit-line {
  border-radius: 4px;
}

.local-source-label,
.fit-line,
.badge.real {
  color: #146c5c;
  background: var(--teal-soft);
}

.badge.main {
  color: #155a91;
  background: var(--blue-soft);
}

.badge.source {
  color: #475467;
  background: #eef1f5;
}

.app-workspace .ai-card {
  border-color: #cfd8e3;
}

.ai-workbench-card {
  gap: 12px;
}

.ai-card-head {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.ai-title strong {
  margin-top: 4px;
  font-size: 18px;
}

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

.plan-coverage div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

.plan-coverage span,
.plan-coverage strong,
.plan-coverage small {
  display: block;
}

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

.plan-coverage strong {
  margin-top: 3px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
}

.plan-coverage small {
  margin-top: 3px;
  color: #536579;
  font-size: 11px;
  line-height: 1.35;
}

.plan-chain-map {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.plan-chain-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.plan-chain-head strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.plan-chain-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

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

.plan-chain-node {
  position: relative;
  display: grid;
  gap: 6px;
  min-width: 0;
  min-height: 92px;
  padding: 10px;
  text-align: left;
  border: 1px solid #d8e1ea;
  border-radius: var(--radius);
  color: var(--ink);
  background: #f8fafc;
  cursor: pointer;
}

.plan-chain-node:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -10px;
  width: 10px;
  border-top: 1px solid #98a2b3;
}

.plan-chain-node span,
.plan-chain-node small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.plan-chain-node strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.plan-chain-node:disabled {
  cursor: default;
}

.plan-chain-node:hover:not(:disabled),
.plan-chain-node:focus-visible:not(:disabled) {
  border-color: #0f766e;
  background: #fff;
  outline: none;
}

.plan-chain-signals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.plan-chain-signals div {
  min-width: 0;
  padding: 8px 10px;
  border: 1px dashed #cfd8e3;
  border-radius: var(--radius);
  background: #f8fafc;
}

.plan-chain-signals span {
  display: block;
  color: #0f766e;
  font-size: 12px;
  font-weight: 900;
}

.plan-chain-signals p {
  margin: 4px 0 0;
  color: #536579;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.ai-head-actions .ghost-button,
.compact-action {
  min-height: 32px;
  padding: 0 10px;
}

.ghost-button,
.ghost-link,
.account-pill button,
.auth-form .link-button {
  color: #155a91;
  background: #eef5fb;
  box-shadow: none;
}

.schematic-visual {
  padding: 12px;
  border-color: var(--line);
  background: #fff;
}

.schema-track {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 8px;
}

.schema-node {
  min-height: 82px;
  padding: 10px;
  border-color: var(--line);
  background: #f8fafc;
}

.schema-node b {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: #475467;
}

.schema-node:not(:last-child)::after {
  background: #98a2b3;
}

.net-grid div,
.method-list,
.plan-steps,
.plan-checks span,
.gap-note {
  border-color: var(--line);
  background: #f8fafc;
}

.ai-workbench-card .net-grid,
.ai-workbench-card .schema-note {
  display: none;
}

.ai-workbench-card .schematic-visual .net-grid {
  display: grid;
}

.ai-workbench-card .schematic-visual .schema-note {
  display: block;
}

.plan-detail-fold[open] .net-grid {
  display: grid;
}

.plan-detail-fold[open] .schema-note {
  display: block;
}

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

.plan-module {
  min-height: 58px;
  padding: 8px 10px;
  border-color: var(--line);
  background: #fff;
}

.plan-module small {
  display: none;
}

.plan-detail-fold {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.plan-detail-fold > summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.plan-detail-fold > summary::-webkit-details-marker {
  display: none;
}

.plan-detail-fold > summary span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.plan-detail-fold > summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.plan-detail-fold[open] > summary {
  border-bottom: 1px solid var(--line);
}

.plan-detail-fold .plan-connection-wrap,
.plan-detail-fold .plan-lower-grid,
.plan-detail-fold .gap-note {
  margin: 12px;
}

.plan-community-panel {
  padding: 0;
  overflow: hidden;
}

.plan-community-panel > summary {
  cursor: pointer;
  list-style: none;
  padding: 11px 12px;
}

.plan-community-panel > summary::-webkit-details-marker {
  display: none;
}

.plan-community-panel[open] {
  padding-bottom: 12px;
}

.plan-community-panel[open] > summary {
  border-bottom: 1px solid var(--line);
}

.plan-community-panel .plan-community-grid,
.plan-community-panel .thread-filter-row,
.plan-community-panel .community-list {
  margin: 12px 12px 0;
}

.filter-panel {
  background: #fff;
}

.filter-panel .filter-drawer > summary {
  min-height: 44px;
}

.filter-panel .filter-grid {
  background: #f8fafc;
}

.community-drawer {
  background: #fff;
}

@media (max-width: 1120px) {
  .app-workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: 100%;
    padding: 0 10px 24px;
  }

  .app-command {
    padding: 14px 0 12px;
  }

  .app-command h1 {
    font-size: 24px;
  }

  .hero-copy {
    font-size: 13px;
  }

  .app-command .search-box {
    grid-template-columns: 1fr;
  }

  .app-command .search-box input,
  .app-command .search-box button {
    border-radius: var(--radius);
  }

  .app-command .search-box button {
    border-left: 0;
    border-top: 1px solid #cfd8e3;
  }

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

  .result-filter-bar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .filter-chip-group {
    width: 100%;
  }

  .filter-chip {
    flex: 1 1 auto;
    text-align: center;
  }

  .filter-toggle,
  .filter-select-inline {
    width: 100%;
  }

  .filter-toggle {
    justify-content: flex-start;
  }

  .filter-select-inline {
    justify-content: space-between;
  }

  .result-view-toggle {
    width: 100%;
  }

  .view-toggle-button {
    flex: 1 1 0;
  }

  .result-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .result-table {
    border-radius: var(--radius);
  }

  .result-table-head {
    display: none;
  }

  .result-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    padding: 12px;
  }

  .result-row-title {
    grid-column: 1 / -1;
  }

  .result-row-title strong,
  .result-row-title span {
    white-space: normal;
  }

  .result-row-category,
  .result-row-format,
  .result-row-status,
  .result-row-community {
    align-self: start;
  }

  .result-row-community {
    grid-template-columns: auto auto auto auto;
    justify-self: start;
  }

  .result-row-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .row-action {
    min-height: 32px;
  }

  .plan-coverage {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .plan-chain-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .plan-chain-track,
  .plan-chain-signals {
    grid-template-columns: 1fr;
  }

  .plan-chain-node:not(:last-child)::after {
    top: auto;
    right: auto;
    bottom: -10px;
    left: 18px;
    width: 0;
    height: 10px;
    border-top: 0;
    border-left: 1px solid #98a2b3;
  }

  .app-workspace .result-main {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .schema-track {
    grid-template-columns: repeat(5, minmax(138px, 1fr));
  }

  .plan-community-panel .plan-community-grid,
  .plan-community-panel .thread-filter-row,
  .plan-community-panel .community-list {
    margin-inline: 10px;
  }

  .thread-filter-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .thread-filter-row button {
    justify-content: space-between;
    padding: 0 10px;
  }
}

/* Community hub pass: make exchange a first-class forum/database surface. */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-left: auto;
}

.topbar-nav a,
.topbar-nav button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: #344054;
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.topbar-nav a:hover,
.topbar-nav a:focus-visible,
.topbar-nav button:hover,
.topbar-nav button:focus-visible {
  color: var(--accent-strong);
  border-color: #c8d7e6;
  background: #f8fafc;
  outline: none;
}

.topbar-nav a.active,
.topbar-nav button.active,
.topbar-nav a[aria-current="page"],
.topbar-nav button[aria-current="page"] {
  color: var(--accent-strong);
  border-color: rgba(15, 118, 110, 0.24);
  background: var(--green-soft);
}

.community-secondary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 12px;
}

.community-secondary-grid .community-hub-card {
  margin: 0;
}

.community-board {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.community-board-head,
.community-board-row {
  display: grid;
  grid-template-columns: 96px minmax(180px, 1.15fr) minmax(150px, 0.95fr) 86px;
  gap: 10px;
  align-items: center;
}

.community-board-head {
  min-height: 34px;
  padding: 0 10px;
  color: #667085;
  background: #f4f6f8;
  font-size: 12px;
  font-weight: 900;
}

.community-board-row {
  width: 100%;
  min-height: 50px;
  padding: 9px 10px;
  border: 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.community-board-row:hover,
.community-board-row:focus-visible {
  background: #f8fbff;
  outline: none;
}

.community-board-row span,
.community-board-row small,
.community-board-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-board-row span {
  color: #155a91;
  font-size: 12px;
  font-weight: 900;
}

.community-board-row strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.community-board-row small {
  color: #667085;
  font-size: 12px;
}

.community-board-row b {
  display: inline-flex;
  justify-content: center;
  min-width: 0;
  padding: 4px 7px;
  border: 1px solid #d8dee6;
  border-radius: 999px;
  color: #455468;
  background: #f8fafc;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.community-feed-list .community-board-row {
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 5px 8px;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.community-feed-list .community-board-row small {
  grid-column: 2;
}

.community-feed-list .community-board-row b {
  grid-column: 1;
  grid-row: 2;
  justify-self: start;
}

.community-index-card .community-feed-empty {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}

@media (max-width: 900px) {
  .topbar-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .topbar-actions {
    margin-left: auto;
  }
}

@media (max-width: 760px) {
  .topbar-nav a,
  .topbar-nav button {
    min-height: 30px;
    padding: 0 8px;
    font-size: 12px;
  }

  .community-secondary-grid {
    grid-template-columns: 1fr;
    margin: 10px;
  }

  .community-board-head {
    display: none;
  }

  .community-board-row,
  .community-feed-list .community-board-row {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 5px 8px;
    border-top: 1px solid var(--line);
  }

  .community-board-row small {
    grid-column: 2;
  }

  .community-board-row b {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
  }

  .library-plan-grid {
    grid-template-columns: 1fr;
  }

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

  .library-plan-main strong {
    font-size: 15px;
  }
}

.quick-row {
  display: none !important;
}

.home-overview {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.home-loading,
.home-empty {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: #fff;
  font-size: 13px;
  font-weight: 700;
}

.home-metrics,
.home-community-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

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

.home-route-card {
  display: grid;
  min-width: 0;
  min-height: 132px;
  align-content: start;
  gap: 8px;
  padding: 16px;
  border: 1px solid #cfd8e3;
  border-radius: var(--radius);
  color: inherit;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.home-route-card:hover,
.home-route-card:focus-visible {
  border-color: rgba(15, 118, 110, 0.48);
  outline: none;
  box-shadow: 0 14px 34px rgba(23, 32, 42, 0.08);
}

.home-route-card span {
  color: #0f766e;
  font-size: 12px;
  font-weight: 950;
}

.home-route-card strong {
  color: var(--ink);
  font-size: 18px;
  font-weight: 950;
  line-height: 1.35;
}

.home-route-card small {
  color: #647184;
  font-size: 13px;
  font-weight: 760;
  line-height: 1.55;
}

.home-metrics > div,
.home-community-strip > div,
.home-metric-action {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.home-metric-action {
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.home-metric-action:hover,
.home-metric-action:focus-visible {
  border-color: rgba(15, 118, 110, 0.45);
  outline: none;
  box-shadow: 0 10px 24px rgba(23, 32, 42, 0.08);
}

.home-metrics span,
.home-community-strip span,
.home-section-head span,
.home-recent-item span,
.home-recent-item small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.home-metrics strong,
.home-community-strip strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.1;
}

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

.home-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.home-section-head strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 16px;
}

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

.home-category,
.home-recent-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.home-category {
  min-height: 74px;
  padding: 12px;
}

.home-category:hover,
.home-category:focus-visible,
.home-recent-item:hover,
.home-recent-item:focus-visible {
  border-color: rgba(15, 118, 110, 0.42);
  outline: none;
}

.home-category strong,
.home-recent-item strong {
  display: block;
  color: var(--ink);
  line-height: 1.35;
}

.home-category span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.home-recent-item {
  display: grid;
  gap: 6px;
  min-height: 104px;
  padding: 12px;
}

.home-recent-item strong,
.home-recent-item small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-recent-item strong {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.home-recent-item small {
  white-space: nowrap;
}

.home-community-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: stretch;
}

.home-community-strip .ghost-button {
  min-height: 100%;
  padding: 0 16px;
}

body.is-idle .app-workspace {
  display: block;
  max-width: 860px;
  margin-top: 10px;
}

body.is-idle .filter-panel,
body.is-idle .detail-panel,
body.is-idle .results {
  display: none;
}

body.is-idle .results-column {
  max-width: 860px;
}

body.is-idle .status-line {
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: #475467;
  font-size: 13px;
  font-weight: 800;
}

body.is-idle .status-detail {
  display: none;
}

body.has-query .app-workspace {
  display: grid;
}

body.has-query .home-overview,
body.is-idle.show-community .home-overview {
  display: none;
}

body.is-idle.show-community .app-workspace {
  display: block;
  max-width: 1100px;
  margin-top: 24px;
}

body.is-idle.show-community .app-command {
  display: none;
}

body.is-idle.show-community .filter-panel {
  display: none;
}

body.is-idle.show-community .filter-drawer,
body.is-idle.show-community .detail-panel {
  display: none;
}

body.is-idle.show-community .results-column,
body.is-idle.show-community .results {
  display: block;
}

body.is-idle.show-community .status-line {
  display: none;
}

.community-page {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 12px 26px rgba(20, 31, 41, 0.05);
}

.community-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.community-page-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.25;
}

.community-page-head p {
  max-width: 720px;
  margin: 7px 0 0;
  color: #667085;
  font-size: 14px;
  line-height: 1.65;
}

.community-page-path {
  margin-top: 6px;
  color: #667085;
  font-size: 13px;
  font-weight: 800;
}

.community-page-refresh {
  flex: 0 0 auto;
}

.community-page-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7f9fb;
  scrollbar-width: none;
}

.community-page-tabs::-webkit-scrollbar {
  display: none;
}

.community-page-tabs button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  color: #526071;
  background: transparent;
  text-align: center;
  cursor: pointer;
}

.community-page-tabs button.active,
.community-page-tabs button:hover,
.community-page-tabs button:focus-visible {
  color: var(--accent-strong);
  background: #fff;
  box-shadow: 0 1px 4px rgba(20, 31, 41, 0.08);
  outline: none;
}

.community-page-tabs span {
  font-size: 13px;
  font-weight: 900;
}

.community-page-tabs small {
  overflow: hidden;
  color: #667085;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-page-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.community-page-summary div {
  min-width: 0;
  padding: 12px 14px;
  border-right: 1px solid var(--line);
  background: #f8fafc;
}

.community-page-summary div:last-child {
  border-right: 0;
}

.community-page-summary span,
.community-page-summary strong,
.community-page-summary small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-page-summary span {
  color: #667085;
  font-size: 12px;
  font-weight: 850;
}

.community-page-summary strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.15;
}

.community-page-summary small {
  margin-top: 4px;
  color: #647184;
  font-size: 11px;
  font-weight: 780;
}

.community-workbench-strip {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid #cfd8e3;
  border-radius: var(--radius);
  background: #cfd8e3;
}

.community-workbench-strip > div,
.community-workbench-strip button {
  min-width: 0;
  padding: 11px 12px;
  border: 0;
  color: #243241;
  background: #fff;
  text-align: left;
}

.community-workbench-strip button {
  cursor: pointer;
}

.community-workbench-strip button:hover,
.community-workbench-strip button:focus-visible,
.community-workbench-strip button.active {
  color: #0f6f9f;
  outline: none;
  background: #f8fcff;
}

.community-workbench-strip span,
.community-workbench-strip strong,
.community-workbench-strip small {
  display: block;
  min-width: 0;
  overflow: hidden;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-workbench-strip span {
  color: #0f766e;
  font-size: 11px;
  font-weight: 950;
}

.community-workbench-strip strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 950;
}

.community-workbench-strip button strong {
  font-size: 18px;
}

.community-workbench-strip small {
  margin-top: 4px;
  color: #647184;
  font-size: 11px;
  font-weight: 800;
}

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

.community-page-metrics div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbff;
}

.community-page-metrics strong,
.community-page-metrics span {
  display: block;
}

.community-page-metrics strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.1;
}

.community-page-metrics span {
  margin-top: 4px;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
}

.community-index-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}

.community-index-strip div {
  min-width: 0;
  padding: 13px 14px;
  border-right: 1px solid var(--line);
  background: #f8fafc;
}

.community-index-strip div:last-child {
  border-right: 0;
}

.community-index-strip span,
.detail-facts span,
.thread-summary-strip span,
.thread-panel-head span {
  display: block;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
}

.community-index-strip strong,
.detail-facts strong,
.thread-summary-strip strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.2;
}

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

.community-route-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.community-route-head div {
  min-width: 0;
}

.community-route-head strong,
.community-route-head span {
  display: block;
  min-width: 0;
}

.community-route-head strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 950;
}

.community-route-head span {
  margin-top: 3px;
  color: #667085;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
}

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

.community-route-card {
  display: grid;
  gap: 5px;
  min-width: 0;
  min-height: 126px;
  padding: 12px;
  border: 1px solid #d8e0e8;
  border-radius: var(--radius);
  color: var(--ink);
  background: #f8fafc;
  text-align: left;
  cursor: pointer;
}

.community-route-card:hover,
.community-route-card:focus-visible,
.community-route-card.active {
  border-color: rgba(15, 118, 110, 0.45);
  background: #f0fdfa;
  outline: none;
}

.community-route-card span,
.community-route-card small,
.community-route-card b {
  display: block;
  min-width: 0;
  color: #667085;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
}

.community-route-card span {
  color: #0f766e;
  font-weight: 950;
}

.community-route-card strong {
  color: var(--ink);
  font-size: 24px;
  font-weight: 950;
  line-height: 1.1;
}

.community-route-card small {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.community-route-card b {
  align-self: end;
  color: #155a91;
}

.review-queue-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #c8d7e4;
  border-radius: var(--radius);
  background: #fff;
}

.review-queue-panel.empty {
  border-color: #d8e0e8;
  background: #f8fafc;
}

.review-queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.review-queue-head div {
  min-width: 0;
}

.review-queue-head span,
.review-queue-head strong {
  display: block;
  min-width: 0;
}

.review-queue-head span {
  color: #0f766e;
  font-size: 12px;
  font-weight: 950;
}

.review-queue-head strong {
  margin-top: 3px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 950;
}

.review-queue-panel > p {
  margin: 0;
  color: #647184;
  font-size: 13px;
  font-weight: 780;
  line-height: 1.5;
}

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

.review-queue-lanes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.review-queue-lane {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

.review-queue-lane.risk {
  border-color: #f0c57f;
  background: #fffaf0;
}

.review-queue-lane.schematic {
  border-color: #b9d8d4;
  background: #f3faf9;
}

.review-queue-lane.material {
  border-color: #c3d9ed;
  background: #f5faff;
}

.review-queue-lane.discussion {
  border-color: #d8e0e8;
  background: #fbfcfe;
}

.review-queue-lane-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 8px;
  align-items: start;
  min-width: 0;
}

.review-queue-lane-head span,
.review-queue-lane-head strong,
.review-queue-lane-head small {
  display: block;
  min-width: 0;
}

.review-queue-lane-head span {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-queue-lane-head strong {
  min-width: 24px;
  min-height: 24px;
  padding: 0 7px;
  border: 1px solid #c8d7e4;
  border-radius: 999px;
  color: #155a91;
  background: #fff;
  font-size: 12px;
  font-weight: 950;
  line-height: 22px;
  text-align: center;
}

.review-queue-lane-head small {
  grid-column: 1 / -1;
  color: #647184;
  font-size: 12px;
  font-weight: 780;
  line-height: 1.35;
}

.review-queue-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 11px;
  border: 1px solid #ead7b1;
  border-radius: 7px;
  background: #fff;
}

.review-queue-lane .review-queue-item {
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 10px;
}

.review-queue-item.priority {
  border-color: #f0b36a;
  box-shadow: inset 3px 0 0 #d97706;
}

.review-queue-item span,
.review-queue-item strong,
.review-queue-item p,
.review-queue-item small {
  display: block;
  min-width: 0;
}

.review-queue-item span {
  color: #8a4d00;
  font-size: 11px;
  font-weight: 950;
}

.review-queue-item strong {
  margin-top: 3px;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-queue-item p {
  margin: 5px 0 0;
  color: #455468;
  font-size: 13px;
  font-weight: 760;
  line-height: 1.45;
}

.review-queue-lane .review-queue-item p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.review-queue-item small {
  margin-top: 5px;
  color: #647184;
  font-size: 12px;
  font-weight: 780;
}

.review-queue-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.review-queue-lane .review-queue-actions {
  justify-content: flex-start;
}

.review-queue-actions .community-actions {
  display: contents;
}

@media (max-width: 1120px) {
  .review-queue-lanes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

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

.community-section-head strong {
  color: var(--ink);
  font-size: 16px;
}

.community-section-head > span {
  color: #667085;
  font-size: 13px;
  font-weight: 800;
}

.category-copy-link {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.compact-filter {
  width: min(420px, 100%);
}

.community-page-board {
  box-shadow: none;
}

.record-filter-panel {
  display: grid;
  grid-template-columns: minmax(160px, 0.34fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

.record-filter-panel > div:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.record-filter-panel strong,
.record-filter-panel span {
  min-width: 0;
}

.record-filter-panel strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.25;
}

.record-filter-panel span {
  color: #667085;
  font-size: 12px;
  font-weight: 800;
}

.record-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px auto;
  gap: 8px;
  min-width: 0;
}

.record-filter-row input,
.record-filter-row button {
  min-width: 0;
  min-height: 38px;
  border-radius: var(--radius);
  font: inherit;
}

.record-filter-row input {
  padding: 0 11px;
  border: 1px solid #cfd8e3;
  color: var(--ink);
  background: #fff;
}

.record-filter-row input:focus {
  border-color: #0f766e;
  outline: 2px solid rgba(15, 118, 110, 0.14);
}

.record-filter-row button[type="submit"] {
  border: 0;
  color: #fff;
  background: #0f766e;
  font-weight: 900;
  cursor: pointer;
}

.record-filter-row button[type="submit"]:hover,
.record-filter-row button[type="submit"]:focus-visible {
  background: #0b5f59;
}

.community-page-board .community-feed-empty {
  grid-column: 1 / -1;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}

.library-plan-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

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

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

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

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

.library-plan-grid .community-feed-empty,
.contributor-grid .community-feed-empty,
.category-index-grid .community-feed-empty,
.category-recent-grid .community-feed-empty {
  grid-column: 1 / -1;
}

.library-search-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.record-search-panel {
  grid-column: 1 / -1;
}

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

.library-stats-overview div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #d8e1ea;
  border-radius: var(--radius);
  background: #fff;
}

.library-stats-overview span,
.library-stats-overview strong,
.library-stats-overview small {
  display: block;
  min-width: 0;
}

.library-stats-overview span {
  color: #647184;
  font-size: 11px;
  font-weight: 900;
}

.library-stats-overview strong {
  margin-top: 3px;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.1;
}

.library-stats-overview small {
  margin-top: 4px;
  overflow: hidden;
  color: #667085;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-search-panel > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.library-search-panel strong,
.library-search-panel span {
  min-width: 0;
}

.library-search-panel strong {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.3;
}

.library-search-panel span {
  color: #667085;
  font-size: 13px;
  font-weight: 800;
}

.library-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 108px;
  gap: 8px;
}

.library-search-row-sort {
  grid-template-columns: minmax(0, 1fr) 132px 108px;
}

.library-search-row input,
.library-search-row select,
.library-search-row button {
  min-width: 0;
  min-height: 42px;
  border-radius: var(--radius);
  font: inherit;
}

.library-search-row input,
.library-search-row select {
  border: 1px solid #cfd8e3;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

.library-search-row select {
  font-weight: 900;
}

.library-search-row input:focus,
.library-search-row select:focus {
  border-color: #0f766e;
  outline: 2px solid rgba(15, 118, 110, 0.14);
}

.library-search-row button {
  border: 0;
  color: #fff;
  background: #0f766e;
  font-weight: 900;
  cursor: pointer;
}

.library-search-row button:hover,
.library-search-row button:focus-visible {
  background: #0b5f59;
  outline: none;
}

/* Detail archive facts should read like database metadata, not cramped tiles. */
.detail-facts {
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}

.detail-facts div {
  display: grid;
  gap: 3px;
  min-height: 58px;
  padding: 8px 10px;
}

.detail-facts span {
  font-size: 11px;
  line-height: 1.2;
}

.detail-facts strong {
  margin-top: 0;
  overflow: visible;
  color: #243044;
  font-size: 13px;
  line-height: 1.35;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.library-plan-card {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.7fr);
  align-items: start;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
}

.library-plan-main {
  min-width: 0;
}

.contributor-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
}

.category-index-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
}

.library-plan-card:hover,
.library-plan-card:focus-within,
.contributor-card:hover,
.contributor-card:focus-within,
.category-index-card:hover,
.category-index-card:focus-within {
  border-color: #0f766e;
  background: #f8fafc;
  outline: none;
}

.library-plan-main span,
.library-plan-foot span,
.contributor-main span,
.category-index-main span {
  display: inline-flex;
  width: fit-content;
  padding: 3px 8px;
  border-radius: var(--radius);
  color: #0f766e;
  background: #edf8f5;
  font-size: 12px;
  font-weight: 900;
}

.library-plan-main strong,
.contributor-main strong,
.category-index-main strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.library-plan-main p,
.contributor-main p,
.category-index-main p {
  display: -webkit-box;
  margin: 7px 0 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: #536579;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.55;
}

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

.category-child-list button,
.category-recent-card {
  min-width: 0;
  border: 1px solid #d8e1ea;
  border-radius: var(--radius);
  color: inherit;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.category-child-list button {
  padding: 9px;
}

.category-child-list button:hover,
.category-child-list button:focus-visible,
.category-recent-card:hover,
.category-recent-card:focus-visible {
  border-color: rgba(15, 118, 110, 0.42);
  background: #f8fafc;
  outline: none;
}

.category-child-list strong,
.category-child-list span,
.category-recent-card strong,
.category-recent-card span,
.category-recent-card small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-child-list strong,
.category-recent-card strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
}

.category-child-list span,
.category-recent-card span,
.category-recent-card small {
  margin-top: 4px;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  white-space: nowrap;
}

.category-index-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.category-index-foot span {
  min-width: 0;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.category-recent-card {
  display: grid;
  gap: 4px;
  min-height: 102px;
  padding: 12px;
}

.category-recent-card strong {
  display: -webkit-box;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.category-browser-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.category-browser-main,
.category-browser-meta {
  min-width: 0;
}

.category-browser-main span,
.category-browser-main p,
.category-browser-meta span {
  color: #667085;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.category-browser-main span,
.category-browser-main strong,
.category-browser-main p,
.category-browser-meta span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-browser-main strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
  white-space: nowrap;
}

.category-browser-main p {
  margin: 5px 0 0;
  white-space: nowrap;
}

.category-browser-meta {
  display: grid;
  gap: 4px;
}

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

.category-browser-filter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(130px, auto);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

.category-filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.category-filter-buttons button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #d7e7f5;
  border-radius: var(--radius);
  color: #33536b;
  background: #fff;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.category-filter-buttons button.active,
.category-filter-buttons button:hover,
.category-filter-buttons button:focus-visible {
  border-color: rgba(15, 118, 110, 0.42);
  color: #0f766e;
  background: #ecfdf5;
  outline: none;
}

.category-local-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #52657a;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.category-browser-filter select {
  min-height: 34px;
  border: 1px solid #d7e7f5;
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
}

.category-browser-more {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfd8e3;
  border-radius: var(--radius);
  color: #0f766e;
  background: #fff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.category-browser-more:hover,
.category-browser-more:focus-visible {
  border-color: rgba(15, 118, 110, 0.42);
  background: #f8fafc;
  outline: none;
}

.category-browser-more:disabled {
  color: #98a2b3;
  cursor: progress;
}

.record-more-button {
  width: 100%;
  min-height: 40px;
  border: 1px solid #cfd8e3;
  border-radius: var(--radius);
  color: #155a91;
  background: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.record-more-button:hover,
.record-more-button:focus-visible {
  border-color: rgba(15, 118, 110, 0.42);
  color: #0f766e;
  background: #f8fafc;
  outline: none;
}

.record-more-button:disabled {
  color: #98a2b3;
  cursor: progress;
}

.library-plan-meta,
.contributor-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.library-plan-meta {
  grid-column: 2;
  grid-row: 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.library-plan-meta div,
.contributor-meta div {
  min-width: 0;
  padding: 8px;
  border: 1px solid #d8e1ea;
  border-radius: var(--radius);
  background: #f8fafc;
}

.library-plan-meta div.reviewed {
  border-color: #b9d7d2;
  background: #f0fdfa;
}

.library-plan-meta div.reviewed b {
  color: #0f766e;
}

.library-plan-meta b,
.library-plan-meta small,
.contributor-meta b,
.contributor-meta small {
  display: block;
  min-width: 0;
}

.library-plan-meta b,
.contributor-meta b {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-plan-meta small,
.contributor-meta small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.library-review-strip {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 280px);
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #d8e1ea;
  border-radius: var(--radius);
  background: #f8fafc;
}

.library-review-copy {
  min-width: 0;
}

.library-review-copy strong,
.library-review-copy span {
  display: block;
  min-width: 0;
}

.library-review-copy strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
  line-height: 1.25;
}

.library-review-copy span {
  margin-top: 3px;
  overflow: hidden;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-review-bar {
  position: relative;
  overflow: hidden;
  height: 9px;
  border: 1px solid #c8d7e4;
  border-radius: 999px;
  background: #fff;
}

.library-review-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f766e, #1f6fb2);
}

.library-plan-foot,
.contributor-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.library-plan-foot {
  grid-column: 1 / -1;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.contributor-foot span,
.contributor-foot small {
  min-width: 0;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
}

.contributor-foot span {
  overflow-wrap: anywhere;
}

.contributor-foot small {
  flex: 0 0 auto;
}

.library-plan-foot em {
  color: #155a91;
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
}

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

.library-plan-actions .community-actions {
  margin-top: 0;
}

.record-card-list {
  display: grid;
  gap: 8px;
  overflow: visible;
  border: 0;
  background: transparent;
}

.record-card-list .community-feed-empty {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.community-record-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 6px 10px;
  width: 100%;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.community-record-card:hover,
.community-record-card:focus-within {
  border-color: #0f766e;
  background: #f8fafc;
  outline: none;
}

.record-kind,
.record-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  width: fit-content;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.record-kind {
  color: #0f766e;
  background: #edf8f5;
}

.record-status {
  grid-column: 3;
  justify-self: end;
  color: #455468;
  background: #f1f4f7;
}

.community-record-card strong {
  grid-column: 1 / -1;
  min-width: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.community-record-card p {
  grid-column: 1 / -1;
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: #536579;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.55;
}

.community-record-card small {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
}

.community-record-card small b,
.community-record-card small em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-record-card small b {
  color: #3d4a5c;
}

.community-record-card small em {
  color: #667085;
  font-style: normal;
}

.record-thread-meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.record-thread-meta span {
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid #d8e0e8;
  border-radius: var(--radius);
  color: #455468;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
}

.record-card-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.record-card-actions .community-actions {
  margin-top: 0;
}

.record-open-button,
.record-copy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #c7d7e8;
  border-radius: var(--radius);
  color: #155a91;
  background: #eef5fb;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  text-decoration: none;
}

.record-copy-button {
  color: #344054;
  background: #fff;
}

.record-open-button.secondary {
  border-color: #cbd5df;
  color: #0f766e;
  background: #fff;
}

.record-open-button:hover,
.record-open-button:focus-visible,
.record-copy-button:hover,
.record-copy-button:focus-visible {
  border-color: #0f766e;
  color: #0f766e;
  outline: none;
}

.compact-board .community-board-row {
  grid-template-columns: 96px minmax(180px, 1.15fr) minmax(150px, 0.95fr) 86px;
}

/* Database pass: keep the primary search practical, not campaign-like. */
.app-command {
  padding: 30px 0 20px;
}

.app-command::before {
  opacity: 0.2;
}

.app-command .hero-main {
  justify-items: start;
  text-align: left;
}

.app-hero-title {
  justify-content: flex-start;
}

.app-command h1 {
  max-width: none;
  font-size: clamp(30px, 3.2vw, 42px);
  line-height: 1.18;
}

.hero-copy {
  max-width: 760px;
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 1.65;
}

.app-command .search-box {
  width: min(780px, 100%);
  grid-template-columns: minmax(0, 1fr) 116px;
  margin: 18px 0 0;
  box-shadow: 0 10px 22px rgba(21, 53, 73, 0.08);
}

.app-command .search-box input,
.app-command .search-box button {
  min-height: 48px;
}

@media (max-width: 760px) {
  .community-page {
    padding: 12px;
  }

  .community-page-head {
    display: grid;
    gap: 10px;
  }

  .community-page-head h2 {
    font-size: 22px;
  }

  .community-page-refresh {
    width: 100%;
  }

  .community-page-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    overflow: visible;
  }

  .community-page-tabs button {
    min-width: 0;
    padding: 0 4px;
  }

  .community-page-tabs span {
    font-size: 12px;
    white-space: nowrap;
  }

  .community-page-tabs small {
    display: none;
  }

  .community-workbench-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .community-workbench-strip > div {
    grid-column: 1 / -1;
  }

  .community-page-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .community-index-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .community-index-strip div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .community-index-strip div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .community-section-head {
    display: grid;
  }

  .compact-filter {
    width: 100%;
  }

  .app-command {
    padding: 18px 0 14px;
  }

  .app-command .hero-main {
    text-align: left;
  }

  .app-command h1 {
    font-size: 30px;
  }

  .app-command .search-box {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 6px;
  }

  .detail-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-category-panel {
    display: grid;
  }

  .detail-category-panel .ghost-button {
    width: 100%;
  }

  .thread-panel-head {
    display: grid;
  }

  .thread-panel-head small {
    justify-self: start;
  }
}

@media (max-width: 760px) {
  .app-topbar {
    flex-wrap: wrap;
  }

  .topbar-actions {
    width: auto;
    flex: 1 1 auto;
  }

  .topbar-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .topbar-nav::-webkit-scrollbar {
    display: none;
  }

  .topbar-nav a,
  .topbar-nav button {
    flex: 0 0 auto;
  }
}

/* Professional reference-library pass: flatter chrome, clearer hierarchy. */
body {
  background: #f3f5f7;
}

.app-command::before {
  display: none;
}

.app-command {
  padding: 24px 0 18px;
}

.app-command h1 {
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 900;
}

.hero-copy {
  max-width: 820px;
  color: #586579;
}

.app-command .search-box {
  width: min(820px, 100%);
  border-color: #cfd8e3;
  background: #fff;
  box-shadow: none;
}

.app-command .search-box button,
.primary-link,
.auth-form button[type="submit"] {
  background: #0f766e;
  box-shadow: none;
}

.app-workspace .result-card,
.app-workspace .ai-card,
.app-workspace .detail-panel,
.result-overview,
.community-page,
.community-hub-card {
  box-shadow: none;
}

.app-workspace .result-card:hover,
.app-workspace .result-card.active {
  border-color: #0f766e;
  box-shadow: none;
}

.app-workspace .ai-card {
  border-color: #cfd8e3;
  background: #fff;
}

.local-source-label,
.fit-line,
.badge.main,
.badge.safe {
  color: #0f766e;
  background: #edf8f5;
}

.schematic-visual {
  border-color: #cfd8e3;
  background: #fff;
}

.schema-node,
.net-grid div {
  border-color: #d8e1ea;
  background: #f8fafc;
}

.plan-module {
  border-color: #d8e1ea;
  background: #fff;
}

.plan-module:hover,
.plan-module:focus-visible {
  border-color: #0f766e;
  outline: none;
}

.community-panel {
  border-color: #cfd8e3;
  background: #fff;
}

.community-form,
.community-item,
.community-empty {
  border-color: #d8e1ea;
}

body.is-idle .status-line {
  max-width: 820px;
}

html {
  scroll-padding-top: 78px;
}

#resultList,
#detailPanel,
#assemblyPlan,
#communityHub,
[data-community-panel],
[data-plan-community-panel] {
  scroll-margin-top: 78px;
}

@media (max-width: 760px) {
  html {
    scroll-padding-top: 16px;
  }

  #resultList,
  #detailPanel,
  #assemblyPlan,
  #communityHub,
  [data-community-panel],
  [data-plan-community-panel] {
    scroll-margin-top: 16px;
  }

  .home-metrics,
  .home-category-grid,
  .home-community-strip {
    grid-template-columns: 1fr 1fr;
  }

  .home-recent-grid {
    grid-template-columns: 1fr;
  }

  .home-section-head {
    align-items: flex-start;
  }

  .home-section-head .ghost-button {
    min-height: 38px;
  }

  .home-community-strip .ghost-button {
    grid-column: 1 / -1;
    min-height: 42px;
  }

  .library-plan-grid,
  .contributor-grid,
  .category-index-grid,
  .category-recent-grid {
    grid-template-columns: 1fr;
  }

  .category-child-list {
    grid-template-columns: 1fr;
  }

  .category-index-foot {
    display: grid;
  }

  .category-index-actions,
  .category-browser-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .category-browser-item {
    grid-template-columns: 1fr;
  }

  .category-browser-main strong,
  .category-browser-main p,
  .category-browser-meta span {
    white-space: normal;
  }

  .category-browser-filter {
    grid-template-columns: 1fr;
  }

  .category-browser-filter select {
    width: 100%;
  }

  .category-copy-link {
    width: 100%;
  }

  .community-route-head {
    display: grid;
  }

  .community-route-head .record-open-button {
    width: 100%;
    justify-content: center;
  }

  .community-route-grid {
    grid-template-columns: 1fr;
  }

  .community-route-card {
    min-height: 104px;
  }

  .annotation-template-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .review-queue-head,
  .review-queue-item {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .review-queue-lanes {
    grid-template-columns: 1fr;
  }

  .review-queue-head {
    display: grid;
  }

  .review-queue-head .record-open-button,
  .review-queue-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .library-plan-meta,
  .contributor-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .library-plan-card,
  .contributor-card {
    width: 100%;
  }

  .library-search-panel > div:first-child {
    display: grid;
    gap: 4px;
  }

  .library-search-row {
    grid-template-columns: 1fr;
  }

  .record-filter-panel {
    grid-template-columns: 1fr;
  }

  .record-filter-row {
    grid-template-columns: 1fr;
  }

  .community-record-card {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 11px;
  }

  .record-status {
    grid-column: 2;
  }

  .community-record-card small {
    display: grid;
    gap: 4px;
  }

  .community-record-card small b,
  .community-record-card small em {
    white-space: normal;
  }

  .record-card-actions {
    justify-content: stretch;
  }

  .library-plan-foot {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    justify-content: stretch;
    gap: 8px;
  }

  .library-plan-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    justify-content: stretch;
    gap: 8px;
    width: 100%;
  }

  .library-plan-foot > span {
    justify-self: start;
  }

  .library-plan-actions .community-actions {
    display: contents;
    width: auto;
  }

  .library-plan-actions .community-actions button,
  .library-plan-actions .record-open-button,
  .library-plan-actions .record-copy-button {
    width: 100%;
    justify-content: center;
  }

  .library-plan-actions .record-open-button {
    grid-column: 1 / -1;
    order: -1;
    min-height: 38px;
    border-color: var(--accent);
    color: #fff;
    background: var(--accent);
  }

  .library-plan-actions .record-open-button:hover,
  .library-plan-actions .record-open-button:focus-visible {
    border-color: var(--accent-strong);
    color: #fff;
    background: var(--accent-strong);
  }

  .library-plan-actions .record-open-button.secondary {
    grid-column: auto;
    order: 0;
    min-height: 34px;
    border-color: #cbd5df;
    color: #0f766e;
    background: #fff;
  }

  .record-card-actions .community-actions,
  .record-open-button,
  .record-copy-button {
    width: 100%;
  }

  .record-card-actions .community-actions button,
  .record-open-button,
  .record-copy-button {
    width: 100%;
    justify-content: center;
  }
}

/* Information architecture cleanup: database first, auxiliary records second. */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #17202a;
  --muted: #5f6b7a;
  --line: #d8e0e8;
  --accent: #0f766e;
  --accent-strong: #0b615b;
  --blue-soft: #eef6fb;
  --teal-soft: #eaf8f5;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  --radius: 8px;
}

body.app-body {
  color: var(--ink);
  background: var(--bg);
}

.app-topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  min-height: 58px;
  padding: 0 max(18px, calc((100vw - 1320px) / 2 + 20px));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: none;
}

.topbar-brand img {
  width: 34px;
  height: 34px;
}

.topbar-title {
  padding-left: 10px;
}

.topbar-title strong {
  font-size: 15px;
}

.topbar-title small {
  color: #687385;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.topbar-nav::-webkit-scrollbar {
  display: none;
}

.topbar-nav a,
.topbar-nav button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #465365;
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.topbar-nav a:hover,
.topbar-nav a:focus-visible,
.topbar-nav button:hover,
.topbar-nav button:focus-visible,
.topbar-nav a.active,
.topbar-nav button.active,
.topbar-nav a[aria-current="page"],
.topbar-nav button[aria-current="page"] {
  color: var(--accent-strong);
  border-color: #c8dedb;
  background: #f2faf8;
  outline: none;
}

.topbar-actions {
  gap: 10px;
}

.app-topbar .count-pill {
  height: 32px;
  border-color: #d8e0e8;
  color: #334155;
  background: #fff;
}

.app-topbar .account-pill button {
  min-height: 32px;
}

.app-shell {
  width: min(1320px, calc(100vw - 40px));
  padding: 0 0 40px;
}

.app-command {
  padding: 24px 0 14px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.app-command::before,
.brand-kicker,
.quick-row {
  display: none !important;
}

.app-command .hero-main,
.app-hero-title {
  justify-items: start;
  justify-content: flex-start;
  text-align: left;
}

.app-command h1 {
  max-width: none;
  color: var(--ink);
  font-size: clamp(28px, 2.6vw, 36px);
  line-height: 1.18;
}

.hero-copy {
  max-width: 720px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.app-command .search-box {
  width: min(760px, 100%);
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 0;
  margin: 16px 0 0;
  padding: 0;
  border: 1px solid #cbd5df;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: none;
}

.app-command .search-box input {
  min-height: 46px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius) 0 0 var(--radius);
  background: transparent;
  font-size: 15px;
}

.app-command .search-box input:focus {
  box-shadow: inset 0 0 0 2px rgba(15, 118, 110, 0.16);
}

.app-command .search-box button {
  min-height: 46px;
  border-left: 1px solid #cbd5df;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: #fff;
  background: var(--accent);
  box-shadow: none;
}

body.has-query .app-command {
  padding: 10px 0 8px;
}

body.has-query .app-hero-title {
  display: none;
}

body.has-query .app-command .search-box {
  margin-top: 0;
}

body.has-query .hero-copy {
  display: none;
}

body.has-query .status-line {
  display: none;
}

.app-command .search-progress {
  width: min(760px, 100%);
  margin: 10px 0 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: none;
}

.progress-track {
  height: 3px;
}

.progress-steps {
  display: none;
}

.app-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 410px);
  gap: 16px;
  align-items: start;
  margin-top: 8px;
}

.results-column,
.detail-panel,
.result-table,
.result-row-title,
.result-row-meta,
.result-row-community,
.result-row-actions {
  min-width: 0;
}

body.has-query .filter-panel,
body.has-query .community-hub {
  display: none;
}

.app-workspace .results-column {
  order: 1;
}

.app-workspace .detail-panel {
  position: static !important;
  order: 2;
  max-height: none !important;
  overflow: visible !important;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: none;
}

  .app-workspace .detail-panel h2 {
    margin-top: 8px;
    font-size: 19px;
    line-height: 1.35;
  }

  .detail-return-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    margin-top: 8px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: #344054;
    background: #f8fafc;
    font-size: 12px;
    font-weight: 900;
    text-decoration: none;
  }

  .detail-return-link:hover,
  .detail-return-link:focus-visible {
    color: var(--accent-strong);
    border-color: #b8cbe0;
    background: #eef8ff;
    outline: none;
  }

@media (min-width: 861px) {
  .detail-return-link {
    display: none;
  }
}

.empty-detail {
  min-height: 180px;
  align-content: center;
  border: 1px dashed #cbd5df;
  color: #64748b;
  background: #f8fafc;
}

.result-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: none;
}

.result-overview-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.result-overview-main strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.result-overview-main span {
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.result-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.filter-chip,
.filter-toggle,
.filter-select-inline,
.result-view-toggle,
.result-overview-actions a,
.result-overview-actions button {
  min-height: 30px;
  border: 1px solid #d8e0e8;
  border-radius: 6px;
  color: #465365;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 800;
}

.filter-chip,
.result-overview-actions button {
  padding: 0 9px;
  cursor: pointer;
}

.filter-toggle,
.filter-select-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
}

.filter-select-inline select {
  min-height: 28px;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  outline: none;
}

.filter-chip:hover,
.filter-chip:focus-visible,
.filter-chip.active,
.filter-toggle.active,
.result-overview-actions a:hover,
.result-overview-actions a:focus-visible,
.result-overview-actions button:hover,
.result-overview-actions button:focus-visible {
  color: var(--accent-strong);
  border-color: #b9d7d2;
  background: #f2faf8;
  outline: none;
}

.result-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
}

.view-toggle-button {
  min-height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 4px;
  color: #64748b;
  background: transparent;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.view-toggle-button.active,
.view-toggle-button:hover,
.view-toggle-button:focus-visible {
  color: var(--accent-strong);
  background: #fff;
  outline: none;
}

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

.result-overview-actions a,
.result-overview-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  text-decoration: none;
}

.result-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: none;
}

.result-table-head,
.result-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) minmax(170px, 0.72fr) minmax(140px, 0.58fr) minmax(170px, 0.62fr);
  align-items: center;
  column-gap: 12px;
}

.result-table-head {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  color: #64748b;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 900;
}

.result-row {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}

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

.result-row:hover,
.result-row:focus-visible,
.result-row.active {
  background: #f8fbff;
  outline: none;
}

.result-row.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.result-row-title,
.result-row-meta,
.result-row-community {
  display: grid;
  gap: 3px;
}

.result-row-title strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.32;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-row-title span,
.result-row-meta small,
.result-row-community span,
.result-row-community small {
  overflow: hidden;
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-row-meta span,
.result-row-community b {
  overflow: hidden;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.row-action {
  min-height: 27px;
  padding: 0 7px;
  border: 1px solid #d8e0e8;
  border-radius: 5px;
  color: #465365;
  background: #fff;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.row-action:hover,
.row-action:focus-visible,
.row-action.saved-action {
  color: var(--accent-strong);
  border-color: #b9d7d2;
  background: #f2faf8;
  outline: none;
}

.app-workspace .result-card,
.app-workspace .ai-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: none;
}

.app-workspace .result-card:hover,
.app-workspace .result-card.active {
  border-color: #9fc8c2;
  box-shadow: none;
}

.app-workspace .ai-card {
  margin-top: 12px;
}

.ai-workbench-card {
  gap: 12px;
}

.ai-card-head,
.card-actions {
  align-items: center;
}

.ai-head-actions {
  flex-wrap: wrap;
}

.plan-chain-track,
.plan-modules {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.detail-facts,
.thread-summary-strip {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-workspace .detail-panel [data-community-panel] .thread-summary-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.app-workspace .detail-panel [data-community-panel] .community-grid {
  grid-template-columns: minmax(0, 1fr);
}

.app-workspace .detail-panel [data-community-panel] .community-form {
  min-width: 0;
}

.preview-frame img {
  max-height: 420px;
}

body.is-idle .app-workspace {
  display: block;
  max-width: 760px;
  margin-top: 8px;
}

body.is-idle .filter-panel,
body.is-idle .detail-panel,
body.is-idle .results {
  display: none;
}

body.is-idle .results-column {
  max-width: 760px;
}

body.is-idle .status-line {
  margin: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: #64748b;
  font-size: 13px;
  font-weight: 800;
}

body.is-idle.show-community .app-workspace {
  display: block;
  max-width: 1120px;
  margin-top: 18px;
}

body.is-idle.show-community .app-command,
body.is-idle.show-community .filter-panel,
body.is-idle.show-community .detail-panel,
body.is-idle.show-community .status-line {
  display: none;
}

body.is-idle.show-community .results,
body.is-idle.show-community .results-column {
  display: block;
}

body.is-idle.show-community .results-column {
  width: 100%;
  max-width: none;
}

@media (max-width: 1180px) {
  .app-workspace {
    grid-template-columns: 1fr;
  }

  .app-workspace .detail-panel {
    order: 3;
  }

  .plan-chain-track,
  .plan-modules {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .app-topbar {
    position: static;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    padding: 8px 12px;
  }

  .topbar-nav {
    grid-column: 1 / -1;
    padding-top: 2px;
  }

  .app-shell {
    width: 100%;
    padding: 0 12px 28px;
  }

  .app-command {
    padding: 16px 0 12px;
  }

  .app-command h1,
  body.has-query .app-command h1 {
    font-size: 26px;
  }

  body.has-query .app-command {
    padding: 10px 0 8px;
  }

  .hero-copy {
    font-size: 13px;
  }

  .app-command .search-box {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 6px;
  }

  .app-command .search-box input,
  .app-command .search-box button {
    min-height: 44px;
    border: 0;
    border-radius: 6px;
  }

  .result-table {
    border: 0;
    background: transparent;
  }

  .result-table-head {
    display: none;
  }

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

  .result-row {
    grid-template-columns: 1fr;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }

  .result-row-title {
    gap: 3px;
  }

  .result-row-title strong {
    display: -webkit-box;
    overflow: hidden;
    line-height: 1.3;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .result-row-code {
    color: #667085;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
  }

  .result-row-code::after,
  .result-row-summary {
    display: none;
  }

  .result-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 3px 8px;
  }

  .result-row-meta span,
  .result-row-meta small {
    font-size: 11px;
    line-height: 1.25;
  }

  .result-row-community {
    grid-template-columns: auto auto;
    gap: 2px 6px;
  }

  .result-row-community small {
    display: none;
  }

  .result-row-title strong,
  .result-row-title span,
  .result-row-meta span,
  .result-row-meta small,
  .result-row-community b,
  .result-row-community span,
  .result-row-community small {
    white-space: normal;
  }

  .result-row-actions {
    justify-content: flex-start;
  }

  .row-action {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }

  .result-filter-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-chip-group,
  .result-overview-actions {
    grid-column: 1 / -1;
    width: 100%;
  }

  .result-filter-shell {
    grid-column: 1 / -1;
    width: 100%;
  }

  .result-filter-toggle-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 38px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: #344054;
    background: #f8fafc;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
  }

  .result-filter-toggle-button small {
    color: #667085;
    font-size: 11px;
    font-weight: 800;
  }

  .result-filter-bar {
    display: none;
    margin-top: 8px;
  }

  .result-overview.filters-open .result-filter-bar {
    display: flex;
  }

  .filter-chip,
  .filter-toggle,
  .filter-select-inline,
  .result-overview-actions a,
  .result-overview-actions button {
    flex: 1 1 auto;
    justify-content: center;
  }

  .thread-summary-strip,
  .plan-chain-track,
  .plan-modules,
  .plan-coverage,
  .plan-chain-signals,
  .plan-community-grid,
  .community-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .community-workbench-strip {
    grid-template-columns: 1fr;
  }

  .topbar-nav {
    gap: 2px;
  }

  .topbar-nav a,
  .topbar-nav button {
    min-height: 32px;
    padding: 0 7px;
    font-size: 12px;
  }

  .topbar-title small,
  .app-topbar .count-pill {
    display: none;
  }

  .topbar-brand img {
    width: 32px;
    height: 32px;
  }

  .app-topbar .account-pill span {
    max-width: 86px;
  }

  .result-overview {
    padding: 10px;
  }

  .app-workspace .detail-panel {
    padding: 12px;
  }
}

@media (max-width: 760px) {
  .detail-plan-reference-item {
    grid-template-columns: 1fr;
  }

  .detail-plan-reference-item strong,
  .detail-plan-reference-item small {
    white-space: normal;
  }

  .detail-plan-reference-item .record-open-button {
    justify-self: start;
  }

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

  .detail-review-actions {
    grid-column: 1 / -1;
  }

  .detail-review-actions button {
    flex: 1 1 0;
  }

  .ai-workbench-card .circuit-stage-track {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .ai-workbench-card .circuit-stage {
    min-height: 128px;
    padding: 10px;
  }

  .ai-workbench-card .circuit-symbol {
    height: 40px;
    margin: 0;
  }

  .ai-workbench-card .circuit-symbol svg {
    height: 40px;
    stroke-width: 4.5;
  }

  .ai-workbench-card .circuit-stage strong {
    font-size: 12px;
    -webkit-line-clamp: 2;
  }

  .ai-workbench-card .circuit-stage small {
    font-size: 10px;
  }

  .ai-workbench-card .circuit-stage:not(:last-child)::after {
    display: none;
  }

  .ai-workbench-card .circuit-stage::before {
    top: -16px;
    bottom: -16px;
  }

  .ai-workbench-card .schema-track {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
    padding-bottom: 0;
  }

  .ai-workbench-card .schema-node {
    min-width: 0;
  }

  .ai-workbench-card .schema-node:not(:last-child)::after {
    display: none;
  }
}

@media (max-width: 360px) {
  .ai-workbench-card .circuit-stage-track,
  .ai-workbench-card .schema-track {
    grid-template-columns: 1fr;
  }
}

.result-reading-map {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid #cfd8e3;
  border-radius: var(--radius);
  background: #fff;
}

.result-reading-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.32fr);
  gap: 14px;
  align-items: start;
}

.result-reading-head span,
.result-reading-status span {
  display: block;
  color: #0f766e;
  font-size: 12px;
  font-weight: 950;
}

.result-reading-head strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 950;
  line-height: 1.28;
}

.result-reading-head p {
  max-width: 760px;
  margin: 6px 0 0;
  color: #475569;
  font-size: 13px;
  font-weight: 760;
  line-height: 1.65;
}

.result-reading-status {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #d8e1ea;
  border-radius: 7px;
  background: #f8fafc;
}

.result-reading-status small {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.result-reading-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.result-reading-steps a {
  display: grid;
  min-width: 0;
  min-height: 112px;
  align-content: start;
  gap: 5px;
  padding: 11px;
  border: 1px solid #d8e1ea;
  border-radius: 7px;
  color: inherit;
  background: #fbfcfe;
  text-decoration: none;
}

.result-reading-steps a:hover,
.result-reading-steps a:focus-visible {
  border-color: #0f766e;
  background: #f6fbfa;
  outline: none;
}

.result-reading-steps a.primary {
  border-color: #9fd3ca;
  background: #f1fbf8;
}

.result-reading-steps span {
  color: #0f766e;
  font-size: 12px;
  font-weight: 950;
}

.result-reading-steps strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 950;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-reading-steps em {
  overflow: hidden;
  color: #334155;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-reading-steps small {
  color: #64748b;
  font-size: 12px;
  font-weight: 760;
  line-height: 1.45;
}

.result-db-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.result-db-strip > div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #d8e0e8;
  border-radius: var(--radius);
  background: #f8fafc;
}

.result-db-strip span,
.result-db-strip small {
  display: block;
  overflow: hidden;
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-db-strip strong {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: #17202a;
  font-size: 16px;
  font-weight: 950;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-db-strip small {
  margin-top: 3px;
  font-size: 10px;
}

.result-db-strip .selected-record {
  border-color: rgba(15, 118, 110, 0.22);
  background: #f0fdfa;
}

.result-availability-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.result-availability-pills span {
  min-width: 0;
  max-width: 100%;
  padding: 3px 6px;
  overflow: hidden;
  border: 1px solid #d8e0e8;
  border-radius: 5px;
  color: #475569;
  background: #f8fafc;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-availability-pills span.match,
.result-availability-pills span.thread {
  color: #155a91;
  border-color: #cfe4f4;
  background: #eef8ff;
}

.result-availability-pills span.local {
  color: #0f766e;
  border-color: #b9d7d2;
  background: #f0fdfa;
}

.result-availability-pills span.warn {
  color: #92400e;
  border-color: #f6d38b;
  background: #fff8e6;
}

.result-row-title .result-availability-pills {
  margin: 1px 0;
}

.result-card .result-availability-pills {
  margin: 6px 0 2px;
}

@media (max-width: 1180px) {
  .result-reading-head {
    grid-template-columns: minmax(0, 1fr);
  }

  .result-reading-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 760px) {
  .result-reading-map {
    padding: 12px;
  }

  .result-reading-head strong {
    font-size: 19px;
  }

  .result-reading-head p {
    font-size: 12px;
  }

  .result-reading-steps {
    grid-template-columns: 1fr;
  }

  .result-reading-steps a {
    min-height: 0;
  }

  .result-reading-steps strong,
  .result-reading-steps em {
    white-space: normal;
  }

  .result-db-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-db-strip .selected-record {
    grid-column: 1 / -1;
  }

  .result-availability-pills span {
    font-size: 10px;
  }
}

.reference-review-guide {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid #cfd8e3;
  border-radius: var(--radius);
  background: #cfd8e3;
}

.reference-review-guide a {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 8px;
  min-width: 0;
  padding: 10px 12px;
  color: #243241;
  background: #fff;
  text-decoration: none;
}

.reference-review-guide a:hover,
.reference-review-guide a:focus-visible {
  color: #0f6f9f;
  outline: none;
  background: #f8fcff;
}

.reference-review-guide span {
  grid-row: span 3;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  color: #0f766e;
  background: #f0fdfa;
  font-size: 12px;
  font-weight: 950;
}

.reference-review-guide strong,
.reference-review-guide em,
.reference-review-guide small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-review-guide strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
  line-height: 1.2;
}

.reference-review-guide em {
  color: #334155;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  line-height: 1.2;
}

.reference-review-guide small {
  color: #647184;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.reference-chain-table,
.reference-evidence-panel,
.reference-preview-rail,
.plan-community-panel {
  scroll-margin-top: 84px;
}

.reference-workbench {
  border-color: #bccddc;
  background: #fff;
}

.reference-workbench-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 14px;
  align-items: stretch;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

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

.reference-title strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.28;
}

.reference-title p {
  max-width: 780px;
  margin: 7px 0 0;
  color: #536171;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
}

.reference-title small {
  display: block;
  margin-top: 7px;
}

.reference-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-self: stretch;
}

.reference-facts div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

.reference-facts span {
  display: block;
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
}

.reference-facts strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 19px;
  line-height: 1;
}

.reference-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.reference-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.62fr);
  gap: 12px;
  align-items: stretch;
}

.reference-layout > .schematic-visual {
  min-width: 0;
}

.reference-evidence-panel {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #cbd5df;
  border-radius: var(--radius);
  background: #fff;
}

.reference-evidence-panel.empty {
  background: #f8fafc;
}

.reference-evidence-head {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.reference-evidence-head span,
.reference-evidence-head small {
  display: block;
  overflow: hidden;
  color: #647184;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-evidence-head span {
  color: #0f766e;
  font-weight: 950;
}

.reference-evidence-head strong {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  font-weight: 950;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.reference-preview-open {
  display: block;
  width: 100%;
  min-height: 230px;
  padding: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f172a;
  cursor: zoom-in;
}

.reference-preview-open .preview-image-shell {
  height: auto;
  min-height: 214px;
}

.reference-preview-open .preview-image-shell > img {
  width: 100%;
  height: auto;
  max-height: 360px;
  object-fit: contain;
  background: #f8fafc;
}

.reference-evidence-panel.has-preview {
  border-color: rgba(15, 118, 110, 0.34);
  background: #fbfefd;
}

.reference-evidence-panel.no-preview {
  background: #f8fafc;
}

.reference-preview-note {
  padding: 7px 9px;
  border: 1px solid #d8e4ea;
  border-radius: 6px;
  color: #526372;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.reference-source-summary {
  display: grid;
  gap: 8px;
  min-height: 210px;
  align-content: start;
  padding: 12px;
  border: 1px solid #d8e0e8;
  border-radius: var(--radius);
  background: #f8fafc;
}

.reference-source-summary span {
  color: #0f766e;
  font-size: 12px;
  font-weight: 950;
}

.reference-source-summary p {
  margin: 0;
  color: #475569;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.6;
}

.reference-related-preview {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.reference-related-preview > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.reference-related-preview span {
  color: #647184;
  font-size: 12px;
  font-weight: 900;
}

.reference-related-preview strong {
  display: -webkit-box;
  overflow: hidden;
  color: #1f2937;
  font-size: 13px;
  font-weight: 950;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.reference-preview-open.compact {
  min-height: 150px;
}

.reference-preview-open.compact .preview-image-shell {
  min-height: 134px;
}

.reference-preview-open.compact .preview-image-shell > img {
  max-height: 210px;
}

.reference-evidence-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.reference-evidence-actions .ghost-button,
.reference-evidence-actions .ghost-link,
.reference-evidence-actions .primary-link {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.reference-preview-rail {
  display: grid;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid #cfd8e3;
  border-radius: var(--radius);
  background: #fff;
}

.reference-preview-rail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.reference-preview-rail-head strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 950;
}

.reference-preview-rail-head span {
  min-width: 0;
  color: #647184;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.reference-preview-rail-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.reference-preview-thumb {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  border: 1px solid #d7e0ea;
  border-radius: var(--radius);
  color: var(--ink);
  background: #f8fafc;
  text-align: left;
  cursor: pointer;
}

.reference-preview-thumb:hover,
.reference-preview-thumb:focus-visible,
.reference-preview-thumb.active {
  border-color: rgba(15, 118, 110, 0.55);
  outline: none;
  background: #f0fdfa;
}

.reference-preview-thumb .preview-image-shell {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid #d8e1ea;
  border-radius: 6px;
  background: #fff;
}

.reference-preview-thumb img {
  object-fit: contain;
}

.reference-preview-thumb span,
.reference-preview-thumb strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reference-preview-thumb span {
  color: #0f766e;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.reference-preview-thumb strong {
  display: -webkit-box;
  color: #263443;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.reference-chain-table {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #cfd8e3;
  border-radius: var(--radius);
  background: #fff;
}

.reference-chain-table-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.reference-chain-table-head div {
  min-width: 0;
}

.reference-chain-table-head span,
.reference-chain-table-head small {
  display: block;
  color: #647184;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.4;
}

.reference-chain-table-head span {
  color: #0f766e;
  font-weight: 950;
}

.reference-chain-table-head strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 950;
  line-height: 1.3;
}

.reference-chain-rows {
  display: grid;
  overflow: hidden;
  border: 1px solid #d8e1ea;
  border-radius: 7px;
  background: #fff;
}

.reference-chain-row {
  display: grid;
  grid-template-columns: minmax(86px, 0.55fr) minmax(0, 1.5fr) minmax(0, 1.75fr) minmax(120px, 0.8fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
  min-height: 46px;
  padding: 9px 11px;
  border: 0;
  border-bottom: 1px solid #edf1f5;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

button.reference-chain-row {
  cursor: pointer;
}

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

.reference-chain-row.head {
  min-height: 34px;
  color: #647184;
  background: #f8fafc;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0;
}

.reference-chain-row span,
.reference-chain-row strong,
.reference-chain-row small,
.reference-chain-row em,
.reference-chain-evidence {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reference-chain-row span {
  color: #0f766e;
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}

.reference-chain-row strong {
  display: -webkit-box;
  color: #1f2937;
  font-size: 13px;
  font-weight: 950;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.reference-chain-row small,
.reference-chain-row em {
  color: #647184;
  font-size: 12px;
  font-style: normal;
  font-weight: 760;
  line-height: 1.4;
}

.reference-chain-evidence {
  display: grid;
  gap: 5px;
}

.reference-chain-evidence em {
  white-space: nowrap;
}

.reference-chain-review {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid #d8e1ea;
  border-radius: 6px;
  background: #f8fafc;
}

.reference-chain-review span,
.reference-chain-review small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-chain-review span {
  color: #344256;
  font-size: 11px;
  font-weight: 950;
}

.reference-chain-review small {
  color: #647184;
  font-size: 11px;
  font-weight: 780;
}

.reference-chain-review.pending {
  border-color: #f1d9a8;
  background: #fffaf0;
}

.reference-chain-review.pending span {
  color: #8a4d00;
}

.reference-chain-review.resolved {
  border-color: #b7e0cb;
  background: #f0fbf5;
}

.reference-chain-review.resolved span {
  color: #167344;
}

.reference-chain-review.active {
  border-color: #b9d9f5;
  background: #f2f8fd;
}

.reference-chain-review.active span {
  color: #0f6fa8;
}

button.reference-chain-row:hover,
button.reference-chain-row:focus-visible {
  outline: none;
  background: #f1f8f7;
}

button.reference-chain-row:disabled {
  cursor: default;
  opacity: 0.7;
}

.reference-chain-missing {
  padding: 9px 11px;
  border: 1px solid #f1d9a8;
  border-radius: 7px;
  color: #7c4a03;
  background: #fffaf0;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.45;
}

.reference-current-node {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: var(--radius);
  background: #f8fcfb;
}

.reference-current-node div {
  min-width: 0;
}

.reference-current-node span,
.reference-current-node small {
  display: block;
  color: #647184;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.reference-current-node strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.reference-node-actions .ghost-button,
.reference-node-actions .ghost-link {
  min-height: 34px;
  padding: 0 11px;
  font-size: 12px;
}

.preview-image-shell {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
}

.preview-image-shell > img {
  display: block;
  width: 100%;
  height: 100%;
}

.preview-image-shell .preview-fallback {
  display: none;
}

.preview-image-shell.preview-missing > img {
  display: none;
}

.preview-image-shell.preview-missing .preview-fallback {
  display: grid;
}

.preview-fallback-frame {
  background: #fff;
}

.preview-fallback {
  gap: 8px;
  min-height: 148px;
  padding: 18px;
  align-content: center;
  border: 1px dashed #c9d5df;
  border-radius: var(--radius);
  color: #536171;
  background: #f8fafc;
  text-align: left;
}

.preview-fallback strong {
  color: var(--ink);
  font-size: 15px;
}

.preview-fallback span {
  color: #647184;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.55;
}

.preview-fallback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.card-thumb .preview-fallback,
.row-thumb .preview-fallback {
  min-height: 100%;
  padding: 8px;
  place-content: center;
  text-align: center;
}

.card-thumb .preview-fallback span,
.row-thumb .preview-fallback span,
.card-thumb .preview-fallback-actions,
.row-thumb .preview-fallback-actions {
  display: none;
}

.result-table-head,
.result-row {
  grid-template-columns: minmax(260px, 1.7fr) minmax(160px, 0.85fr) minmax(132px, 0.75fr) minmax(168px, 0.8fr);
}

.result-row-title {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.result-row-title:not(:has(.row-thumb)) {
  grid-template-columns: minmax(0, 1fr);
}

.result-row-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.row-thumb {
  width: 58px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.row-thumb img {
  object-fit: contain;
}

.preview-open .preview-image-shell > img {
  height: auto;
  max-height: 520px;
  object-fit: contain;
  background: #f8fafc;
}

.preview-open .preview-image-shell {
  height: auto;
}

@media (max-width: 1120px) {
  .reference-workbench-head {
    grid-template-columns: 1fr;
  }

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

  .reference-facts {
    max-width: 420px;
  }

  .reference-preview-rail-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .reference-title strong {
    font-size: 19px;
  }

  .reference-title p {
    font-size: 12px;
  }

  .reference-facts {
    max-width: none;
  }

  .reference-evidence-panel {
    padding: 10px;
  }

  .reference-preview-open {
    min-height: 220px;
  }

  .reference-preview-open .preview-image-shell {
    min-height: 204px;
  }

  .reference-current-node {
    grid-template-columns: 1fr;
  }

  .reference-current-node strong {
    white-space: normal;
  }

  .reference-node-actions {
    justify-content: flex-start;
  }

  .reference-node-actions .ghost-button,
  .reference-node-actions .ghost-link {
    flex: 1 1 120px;
  }

  .reference-preview-rail-head {
    display: grid;
  }

  .reference-preview-rail-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.has-query .app-command {
    padding: 8px 0 6px;
  }

  body.has-query .app-command .search-box {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 86px;
    gap: 0;
    padding: 0;
    border-radius: var(--radius);
  }

  body.has-query .app-command .search-box input,
  body.has-query .app-command .search-box button {
    min-height: 42px;
    font-size: 14px;
  }

  body.has-query .app-command .search-box input {
    border-radius: var(--radius) 0 0 var(--radius);
  }

  body.has-query .app-command .search-box button {
    width: auto;
    border-left: 1px solid #cbd5df;
    border-radius: 0 var(--radius) var(--radius) 0;
  }

  .result-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .result-table-summary {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .result-table-summary small {
    white-space: normal;
  }

  .detail-record-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-row-title,
  .result-row-actions {
    grid-column: 1;
  }

  .result-row-meta,
  .result-row-community {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .result-row-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 420px) {
  .reference-preview-rail-list {
    grid-template-columns: 1fr;
  }

  .detail-record-nav {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .thread-target-card {
    grid-template-columns: 1fr;
  }

  .thread-target-actions {
    justify-content: flex-start;
  }

  .thread-target-actions button {
    flex: 1 1 140px;
  }

  .ai-workbench-card .circuit-symbol-preview {
    height: 62px;
  }

  .ai-workbench-card .circuit-symbol-preview .preview-image-shell {
    min-height: 0;
  }
}

/* clean35: recommendation quality and community signals */
.app-topbar {
  min-height: 64px;
  border-bottom-color: #d8e0e8;
  background: rgba(255, 255, 255, 0.94);
}

.topbar-nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  padding: 3px;
  border: 1px solid #dfe7ef;
  border-radius: var(--radius);
  background: #f8fafc;
}

.topbar-nav a,
.topbar-nav button {
  min-height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  color: #52606f;
  background: transparent;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.topbar-nav a:hover,
.topbar-nav button:hover,
.topbar-nav a.active,
.topbar-nav button.active {
  color: var(--brand-ink);
  background: #fff;
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.04);
}

.app-shell {
  width: min(1420px, calc(100vw - 48px));
}

.app-command {
  padding: 34px 0 18px;
}

.app-command::before {
  display: none;
}

.app-command .hero-main {
  justify-items: start;
  text-align: left;
}

.app-hero-title {
  justify-content: flex-start;
}

.app-command h1 {
  font-size: clamp(34px, 4.2vw, 54px);
}

.hero-copy {
  max-width: 760px;
  margin: 12px 0 0;
}

.app-command .search-box {
  width: min(1040px, 100%);
  margin: 22px 0 0;
  border-color: #cfd8e3;
  box-shadow: 0 14px 32px rgba(21, 53, 73, 0.08);
}

body.has-query .app-command {
  padding: 12px 0 8px;
}

body.has-query .app-hero-title,
body.has-query .hero-copy {
  display: none;
}

body.has-query .app-command .search-box {
  width: 100%;
  margin-top: 0;
  box-shadow: none;
}

.home-overview {
  gap: 14px;
  margin-top: 6px;
}

.home-primary-routes {
  gap: 0;
  overflow: hidden;
  border: 1px solid #cfd8e3;
  border-radius: var(--radius);
  background: #fff;
}

.home-route-card {
  min-height: 118px;
  padding: 18px 20px;
  border: 0;
  border-right: 1px solid #e2e8f0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

.home-route-card:last-child {
  border-right: 0;
}

.home-route-card:hover,
.home-route-card:focus-visible {
  border-color: #e2e8f0;
  background: #f8fcff;
  box-shadow: inset 0 3px 0 rgba(8, 143, 207, 0.48);
}

.home-route-card span {
  color: #0f766e;
  letter-spacing: 0;
}

.home-route-card.primary {
  background: #f4fbff;
  box-shadow: inset 0 3px 0 rgba(8, 143, 207, 0.58);
}

.home-route-card.primary strong {
  color: #1f3a4a;
}

.home-route-card strong {
  font-size: 17px;
}

.home-metrics,
.home-community-strip {
  gap: 8px;
}

body.has-query .filter-panel,
body.has-query .community-hub {
  display: none !important;
}

.app-workspace {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  gap: 16px;
  margin-top: 10px;
}

.result-overview {
  grid-template-columns: minmax(220px, 0.72fr) minmax(420px, 1.24fr) auto;
  gap: 10px;
  padding: 10px;
  box-shadow: none;
}

.result-overview-main strong {
  font-size: 14px;
}

.result-overview-main span {
  line-height: 1.45;
}

.result-overview-actions {
  align-self: stretch;
}

.result-overview-actions a,
.result-overview-actions button {
  min-height: 30px;
  border-radius: 6px;
}

.reference-workbench {
  border-color: #b9c9d6;
  background: #fff;
  box-shadow: 0 10px 24px rgba(23, 43, 57, 0.06);
}

.reference-workbench-head {
  margin: -16px -16px 14px;
  padding: 15px 16px;
  border-bottom-color: #d8e0e8;
  background: #f8fafc;
}

.reference-title strong {
  font-size: 23px;
}

.reference-title p {
  max-width: 840px;
}

.reference-facts div {
  background: #fff;
}

.reference-layout {
  grid-template-columns: minmax(0, 1.62fr) minmax(320px, 0.7fr);
  gap: 14px;
}

.reference-preview-open {
  min-height: 270px;
}

.reference-preview-open .preview-image-shell {
  min-height: 250px;
}

.reference-preview-open .preview-image-shell > img {
  max-height: 420px;
}

.reference-preview-rail {
  border-color: #d8e0e8;
  background: #f8fafc;
}

.result-db-strip {
  box-shadow: none;
}

.result-table {
  box-shadow: none;
}

@media (max-width: 1120px) {
  .result-overview {
    grid-template-columns: 1fr;
  }

  .result-overview-actions {
    justify-content: flex-start;
  }

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

@media (max-width: 760px) {
  .app-topbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 8px 12px;
  }

  .topbar-nav {
    width: 100%;
    overflow-x: auto;
  }

  .app-shell {
    width: 100%;
    padding: 0 12px 28px;
  }

  .app-command {
    padding: 18px 0 12px;
  }

  .app-command .search-box,
  body.has-query .app-command .search-box {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 6px;
  }

  .app-command .search-box input,
  .app-command .search-box button,
  body.has-query .app-command .search-box input,
  body.has-query .app-command .search-box button {
    border-radius: 6px;
  }

  .home-primary-routes {
    grid-template-columns: 1fr;
  }

  .home-route-card {
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid #e2e8f0;
  }

  .home-route-card:last-child {
    border-bottom: 0;
  }

  .app-workspace {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .reference-workbench-head {
    margin: -14px -14px 12px;
    padding: 12px 14px;
  }

  .reference-preview-open,
  .reference-preview-open .preview-image-shell {
    min-height: 180px;
  }

  .reference-chain-table-head {
    display: grid;
    align-items: start;
  }

  .reference-chain-row,
  .reference-chain-row.head {
    grid-template-columns: 1fr;
    gap: 4px;
    align-items: start;
  }

  .reference-chain-row.head {
    display: none;
  }

  .reference-chain-row span,
  .reference-chain-row strong,
  .reference-chain-row small,
  .reference-chain-row em,
  .reference-chain-review span,
  .reference-chain-review small {
    white-space: normal;
  }

  .reference-chain-review {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

.recommended-record-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: -4px;
}

.opened-plan-record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid #b9c8d6;
  border-radius: var(--radius);
  background: #f8fafc;
}

.opened-plan-record > div:first-child {
  min-width: 0;
}

.opened-plan-record span {
  display: block;
  color: #0f766e;
  font-size: 11px;
  font-weight: 950;
}

.opened-plan-record strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--ink);
  font-size: 17px;
  font-weight: 950;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.opened-plan-record small {
  display: block;
  margin-top: 3px;
  color: #647184;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.opened-plan-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.opened-plan-actions .ghost-button {
  min-height: 32px;
  padding: 0 10px;
  white-space: nowrap;
}

.recommended-record-strip > div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #d8e0e8;
  border-radius: var(--radius);
  background: #f8fafc;
}

.recommended-record-strip span,
.schematic-ai-annotations-head span,
.plan-rating-row > span {
  display: block;
  color: #0f766e;
  font-size: 11px;
  font-weight: 950;
}

.recommended-record-strip strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recommended-record-strip small,
.schematic-ai-annotations-head small,
.schematic-ai-annotation-list small,
.reference-empty-grid small {
  display: block;
  margin-top: 4px;
  color: #647184;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.4;
}

.schematic-ai-annotations {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #d8e0e8;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
}

.schematic-ai-annotations-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.schematic-ai-annotation-list,
.reference-empty-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.schematic-ai-annotation-list > div,
.reference-empty-grid > div {
  min-width: 0;
  padding: 9px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
}

.schematic-ai-annotation-item {
  display: grid;
  align-content: start;
  gap: 6px;
  box-shadow: inset 3px 0 0 transparent;
}

.schematic-ai-annotation-item.open {
  border-color: #f0c36c;
  background: #fffdf7;
  box-shadow: inset 3px 0 0 #d97706;
}

.schematic-ai-annotation-item.reviewed {
  border-color: #b9d7d2;
  background: #f7fffd;
  box-shadow: inset 3px 0 0 #0f766e;
}

.schematic-ai-annotation-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.schematic-ai-annotation-list span,
.reference-empty-grid span {
  display: block;
  color: #647184;
  font-size: 11px;
  font-weight: 900;
}

.schematic-ai-annotation-list em {
  flex: 0 0 auto;
  padding: 2px 6px;
  border: 1px solid #d8e0e8;
  border-radius: 999px;
  color: #647184;
  background: #f8fafc;
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
}

.schematic-ai-annotation-item.open em {
  color: #8a4d00;
  border-color: #f2d28d;
  background: #fff8e6;
}

.schematic-ai-annotation-item.reviewed em {
  color: #0f766e;
  border-color: #b9d7d2;
  background: #f0fdfa;
}

.schematic-ai-annotation-record {
  overflow: hidden;
  max-width: 100%;
  padding: 3px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  background: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schematic-ai-annotation-list strong,
.reference-empty-grid strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schematic-ai-annotation-list button {
  justify-self: start;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid #cfe7f3;
  border-radius: 6px;
  color: #0f6f9f;
  background: #f6fbff;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.schematic-ai-annotation-list button:hover,
.schematic-ai-annotation-list button:focus-visible {
  border-color: #8ecae6;
  background: #eef8ff;
  outline: none;
}

.schematic-ai-annotations-more {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.schematic-ai-annotations-more > summary {
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid #d8e0e8;
  border-radius: 6px;
  color: #0f6f9f;
  background: #f6fbff;
  font-size: 12px;
  font-weight: 950;
  cursor: pointer;
}

.schematic-ai-annotations-more[open] > summary {
  border-color: #8ecae6;
  background: #eef8ff;
}

.schematic-empty-state {
  min-height: 320px;
  align-content: start;
}

.reference-pending-body {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #d8e0e8;
  border-radius: var(--radius);
  background: #f8fafc;
}

.plan-thread-body .thread-summary-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.plan-rating-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 8px;
  border: 1px solid #d8e0e8;
  border-radius: var(--radius);
  background: #f8fafc;
}

.plan-rating-row label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  color: #334155;
  background: #fff;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.plan-rating-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.plan-rating-row label:has(input:checked) {
  color: #fff;
  border-color: #0f8bcf;
  background: #0f8bcf;
}

@media (max-width: 960px) {
  .recommended-record-strip,
  .reference-review-guide,
  .plan-thread-body .thread-summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .schematic-ai-annotation-list,
  .reference-empty-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .recommended-record-strip,
  .reference-review-guide,
  .plan-thread-body .thread-summary-strip {
    grid-template-columns: 1fr;
  }

  .schematic-ai-annotations-head {
    display: grid;
  }
}

/* clean55: final compact mobile pass for the database workflow. */
@media (max-width: 760px) {
  .app-topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 8px;
    min-height: 0;
    padding: 7px 10px;
  }

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

  .topbar-actions {
    justify-content: flex-end;
    min-width: 0;
  }

  .topbar-nav {
    grid-column: 1 / -1;
    width: 100%;
    padding: 2px;
    overflow-x: auto;
  }

  .topbar-nav a,
  .topbar-nav button {
    min-height: 30px;
    padding: 0 8px;
    font-size: 12px;
  }

  .app-shell {
    width: 100%;
    padding: 0 10px 24px;
  }

  .app-command,
  body.has-query .app-command {
    padding: 8px 0 6px;
  }

  .app-command h1 {
    font-size: 26px;
    line-height: 1.18;
  }

  .hero-copy {
    font-size: 13px;
  }

  .app-command .search-box,
  body.has-query .app-command .search-box {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 82px;
    gap: 0;
    padding: 0;
    border-radius: var(--radius);
  }

  .app-command .search-box input,
  body.has-query .app-command .search-box input {
    min-height: 42px;
    border-radius: var(--radius) 0 0 var(--radius);
    font-size: 14px;
  }

  .app-command .search-box button,
  body.has-query .app-command .search-box button {
    min-height: 42px;
    border-left: 1px solid #cbd5df;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 13px;
  }

  .result-overview,
  .reference-workbench,
  .community-page,
  .app-workspace .detail-panel {
    padding: 10px;
  }

  .result-overview-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .result-overview-actions::-webkit-scrollbar {
    display: none;
  }

  .result-overview-actions a,
  .result-overview-actions button {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 0 10px;
    white-space: nowrap;
  }

  .reference-workbench-head {
    margin: -10px -10px 10px;
    padding: 10px;
  }

  .reference-title strong {
    font-size: 18px;
  }

  .reference-facts,
  .detail-facts,
  .library-plan-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .library-stats-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .library-stats-overview small {
    white-space: normal;
  }

  .generated-schematic-file-preview {
    min-height: 360px;
    max-height: 68vh;
    padding: 8px;
  }

  .generated-schematic-file-preview img {
    max-width: 760px;
  }

  .reference-preview-open,
  .reference-preview-open .preview-image-shell {
    min-height: 180px;
  }

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

  .community-page-head {
    display: grid;
    gap: 8px;
  }

  .community-page-tabs {
    display: flex;
    overflow-x: auto;
    padding: 3px;
  }

  .community-page-tabs button {
    flex: 0 0 auto;
    min-width: 86px;
    padding: 0 8px;
  }

  .community-workbench-strip,
  .community-index-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .community-workbench-strip > div {
    grid-column: 1 / -1;
  }

  .library-plan-grid,
  .contributor-grid,
  .category-index-grid,
  .category-recent-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .reference-facts,
  .detail-facts,
  .library-plan-meta,
  .community-workbench-strip,
  .community-index-strip {
    grid-template-columns: 1fr;
  }

  .topbar-title small,
  .app-topbar .count-pill {
    display: none;
  }
}

/* Mainline product pass: make the site read like a database first. */
.home-mainline {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.home-mainline-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.home-mainline-head strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 950;
}

.home-mainline-head span {
  color: #5c6b7e;
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.home-mainline-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.home-mainline-steps button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "index title"
    "index note";
  column-gap: 10px;
  row-gap: 2px;
  min-width: 0;
  min-height: 86px;
  padding: 13px 14px;
  border: 0;
  border-right: 1px solid var(--line);
  color: inherit;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.home-mainline-steps button:last-child {
  border-right: 0;
}

.home-mainline-steps button:hover,
.home-mainline-steps button:focus-visible {
  background: #f7fbfb;
  outline: none;
}

.home-mainline-steps b {
  grid-area: index;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid #b9d8d4;
  border-radius: 999px;
  color: #0f766e;
  background: #edf8f6;
  font-size: 12px;
  font-weight: 950;
}

.home-mainline-steps span {
  grid-area: title;
  min-width: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 950;
}

.home-mainline-steps small {
  grid-area: note;
  min-width: 0;
  color: #647184;
  font-size: 12px;
  font-weight: 760;
  line-height: 1.45;
}

.result-overview {
  box-shadow: none;
}

.result-db-strip,
.result-reading-map {
  display: none;
}

.reference-workbench {
  border-color: #c8d8e8;
}

.reference-workbench-head {
  border-bottom-color: #d8e2eb;
}

/* launch-mainline: keep the primary search answer readable and schematic-first. */
body.has-query .app-workspace {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
  gap: 16px;
}

.reference-workbench {
  display: grid;
  gap: 14px;
  border-color: #bfcfe0;
}

.reference-workbench-head {
  grid-template-columns: minmax(0, 1fr) minmax(210px, 280px);
}

.generated-schematic-file-head strong {
  white-space: normal;
}

.generated-schematic-file-preview {
  min-height: 460px;
  max-height: min(72vh, 700px);
}

.reference-review-guide strong,
.reference-review-guide em,
.reference-review-guide small {
  white-space: normal;
}

.result-overview {
  margin-top: 2px;
}

@media (max-width: 1120px) {
  body.has-query .app-workspace {
    grid-template-columns: 1fr;
  }

  .reference-workbench-head {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .generated-schematic-file-preview {
    min-height: 320px;
    max-height: 68vh;
  }

  .reference-review-guide {
    grid-template-columns: 1fr;
  }

  .opened-plan-record {
    grid-template-columns: 1fr;
  }

  .opened-plan-record strong {
    white-space: normal;
  }

  .opened-plan-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 900px) {
  .home-mainline-head {
    display: grid;
    align-items: start;
  }

  .home-mainline-head span {
    text-align: left;
  }

  .home-mainline-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-mainline-steps button:nth-child(2) {
    border-right: 0;
  }

  .home-mainline-steps button:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .community-page-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .community-page-summary div:nth-child(2n) {
    border-right: 0;
  }

  .community-page-summary div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

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

  .library-plan-meta {
    grid-column: auto;
    grid-row: auto;
  }

  .library-review-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .home-mainline-steps {
    grid-template-columns: 1fr;
  }

  .home-mainline-steps button,
  .home-mainline-steps button:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .home-mainline-steps button:last-child {
    border-bottom: 0;
  }

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

  .community-page-summary div,
  .community-page-summary div:nth-child(2n) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .community-page-summary div:last-child {
    border-bottom: 0;
  }
}

/* Official launch footer and registration guard. */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  padding: 18px 14px 24px;
  color: #64748b;
  font-size: 12px;
  font-weight: 760;
  line-height: 1.45;
}

.site-footer a {
  color: #0f766e;
  font-weight: 900;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: #155a91;
  text-decoration: underline;
  outline: none;
}

.login-footer {
  padding-top: 0;
  color: rgba(100, 116, 139, 0.92);
}

.register-trap {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* clean82: keep the generated schematic as a dependable document preview. */
.generated-schematic-file-preview .generated-schematic-preview-shell {
  display: flex;
  width: 100%;
  min-height: inherit;
  align-items: flex-start;
  justify-content: center;
}

.generated-schematic-file-preview .generated-schematic-preview-shell > img {
  width: auto;
  max-width: 980px;
  height: auto;
  min-height: 0;
  object-fit: contain;
}

.generated-schematic-file-preview .generated-schematic-preview-shell.preview-missing {
  display: grid;
  min-height: 320px;
  place-items: center;
}

.generated-schematic-preview-fallback {
  width: min(100%, 560px);
  min-height: 190px;
  margin: 0 auto;
  background: #fff;
}

@media (max-width: 760px) {
  .generated-schematic-file-preview .generated-schematic-preview-shell.preview-missing {
    min-height: 240px;
  }

  .generated-schematic-preview-fallback {
    min-height: 170px;
  }
}

/* mainline94: formal database flow, compact command bar after search. */
body.has-query .app-command {
  position: sticky;
  top: 58px;
  z-index: 12;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 246, 248, 0.96);
}

body.has-query .app-command .hero-main {
  display: grid;
  grid-template-columns: minmax(180px, 0.36fr) minmax(360px, 0.64fr);
  gap: 14px;
  align-items: center;
}

body.has-query .app-command h1 {
  font-size: 20px;
  line-height: 1.25;
}

body.has-query .hero-copy {
  display: none;
}

body.has-query .app-command .search-box {
  width: 100%;
  margin: 0;
}

body.has-query .app-command .search-progress {
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 4px;
}

body.has-query .app-workspace {
  margin-top: 12px;
}

.result-reading-map {
  display: grid;
  border-color: #c8d7e4;
  box-shadow: none;
}

.result-reading-head strong {
  font-size: 19px;
}

.result-reading-steps a {
  min-height: 96px;
  background: #fff;
}

.result-reading-steps a.primary {
  border-color: #9fbfdc;
  background: #f5faff;
}

.reference-workbench {
  border-color: #b8c8d8;
}

.reference-workbench-head {
  margin: -12px -12px 12px;
  padding: 13px 14px;
}

.reference-title strong {
  font-size: 21px;
}

.reference-title p {
  color: #475569;
}

.generated-schematic-file {
  border-color: #b9c8d6;
}

.generated-schematic-file-head {
  background: #f5f7fa;
}

.generated-schematic-file-preview {
  min-height: 500px;
  background:
    linear-gradient(90deg, rgba(31, 111, 178, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(31, 111, 178, 0.03) 1px, transparent 1px),
    #ffffff;
  background-size: 20px 20px;
}

.schematic-ai-annotations {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.schematic-ai-annotations-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.schematic-ai-annotation-list {
  padding: 10px;
}

.plan-community-panel > summary {
  background: #f8fafc;
}

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

.result-overview-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.result-overview-actions a,
.result-overview-actions button {
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #344054;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}

.result-overview-actions a:hover,
.result-overview-actions a:focus-visible,
.result-overview-actions button:hover,
.result-overview-actions button:focus-visible {
  color: var(--accent-strong);
  border-color: #b8cbe0;
  background: #fff;
  outline: none;
}

@media (max-width: 1120px) {
  body.has-query .app-command {
    position: static;
  }

  body.has-query .app-command .hero-main {
    grid-template-columns: 1fr;
  }

  body.has-query .app-command .search-box {
    width: min(860px, 100%);
  }

  .result-reading-head,
  .result-reading-steps {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  body.has-query .app-command {
    padding: 10px 0 12px;
  }

  body.has-query .app-command h1 {
    font-size: 19px;
  }

  .result-reading-head,
  .result-reading-steps {
    grid-template-columns: 1fr;
  }

  .result-reading-map {
    padding: 11px;
  }

  .result-reading-steps a {
    min-height: 0;
  }

  .generated-schematic-file-preview {
    min-height: 340px;
  }

  .result-overview-actions {
    justify-content: flex-start;
  }
}

/* mainline96: make recommended schematics a first-class database ledger. */
.library-ledger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.84fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid #c8d7e4;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: none;
}

.library-ledger-main {
  min-width: 0;
}

.library-ledger-main span {
  display: block;
  color: #0f766e;
  font-size: 12px;
  font-weight: 950;
}

.library-ledger-main strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 950;
  line-height: 1.25;
}

.library-ledger-main p {
  max-width: 760px;
  margin: 6px 0 0;
  color: #475569;
  font-size: 13px;
  font-weight: 760;
  line-height: 1.6;
}

.library-ledger-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.library-ledger-metrics div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

.library-ledger-metrics span,
.library-ledger-metrics small {
  display: block;
  overflow: hidden;
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-ledger-metrics strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 950;
  line-height: 1.2;
}

.library-plan-card {
  border-color: #c8d7e4;
}

.library-plan-main {
  gap: 7px;
}

.library-plan-kicker {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 8px;
}

.library-plan-kicker span,
.library-plan-kicker em,
.library-plan-kicker small,
.library-plan-sources span,
.library-plan-sources em {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  min-height: 24px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #475569;
  background: #f8fafc;
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
  line-height: 1.25;
}

.library-plan-kicker span.needs-review {
  color: #a65f00;
  border-color: #f0d5a8;
  background: #fff7e8;
}

.library-plan-kicker span.reviewed {
  color: #0f766e;
  border-color: #b9d8d4;
  background: #edf8f6;
}

.library-plan-kicker span.new {
  color: #155a91;
  border-color: #c3d9ed;
  background: #edf5fc;
}

.library-plan-kicker span.quality {
  color: #344054;
  border-color: #d8e1ea;
  background: #fff;
}

.library-plan-kicker span.quality.attention,
.library-plan-kicker span.quality.needs_review {
  color: #9a4f00;
  border-color: #f0d5a8;
  background: #fff7e8;
}

.library-plan-kicker span.quality.in_review,
.library-plan-kicker span.quality.reference {
  color: #155a91;
  border-color: #c3d9ed;
  background: #edf5fc;
}

.library-plan-kicker span.quality.trusted {
  color: #0f766e;
  border-color: #b9d8d4;
  background: #edf8f6;
}

.library-plan-kicker span.quality.featured {
  color: #7c5a00;
  border-color: #ead084;
  background: #fff9db;
}

.library-plan-sources {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.library-plan-sources span:first-child {
  max-width: 100%;
  color: #155a91;
  border-color: #c3d9ed;
  background: #f5faff;
}

.library-plan-sources em {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-plan-meta div {
  background: #fff;
}

.library-plan-meta div:first-child {
  border-color: #c3d9ed;
  background: #f5faff;
}

.library-plan-actions .record-open-button {
  color: #fff;
  border-color: #1f6fb2;
  background: #1f6fb2;
}

.library-plan-actions .record-open-button.secondary {
  color: #155a91;
  border-color: #c3d9ed;
  background: #eef5fb;
}

@media (max-width: 980px) {
  .library-ledger {
    grid-template-columns: 1fr;
  }

  .library-ledger-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .library-ledger-metrics {
    grid-template-columns: 1fr;
  }

  .library-plan-sources em {
    max-width: 100%;
  }
}
