.refresh-state {
  margin-left: auto;
  color: #4e5969;
  font-size: 12px;
  white-space: nowrap;
}

.manual-entry-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.manual-entry-actions button {
  height: 30px;
  padding: 0 10px;
  border: 1px solid #d8dee9;
  border-radius: 6px;
  background: #fff;
  color: #165dff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.manual-entry-actions button:hover {
  border-color: #94bfff;
  background: #f2f7ff;
}

.dashboard-page .cdemo.manual-cdemo {
  grid-template-columns: minmax(420px, 560px) minmax(520px, 1fr);
}

.manual-modal-mask {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(29, 33, 41, .42);
}

.manual-modal-panel {
  width: min(680px, 100%);
  max-height: calc(100vh - 72px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(29, 33, 41, .22);
}

.manual-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.manual-modal-head h2 {
  margin: 0 0 6px;
  color: #1d2129;
  font-size: 18px;
  line-height: 1.25;
}

.manual-modal-head p {
  margin: 0;
  color: #86909c;
  font-size: 13px;
  line-height: 1.55;
}

.manual-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: #f2f3f5;
  color: #4e5969;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.manual-textarea {
  min-height: 180px;
  padding: 12px;
  resize: vertical;
  border: 1px solid #d8dee9;
  border-radius: 6px;
  color: #1d2129;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.manual-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  border: 1px dashed #94bfff;
  border-radius: 8px;
  background: #f7fbff;
  color: #165dff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.manual-upload input {
  display: none;
}

.manual-json-example {
  border: 1px solid #e5e6eb;
  border-radius: 6px;
  background: #f7f8fa;
  overflow: hidden;
}

.manual-json-example-title {
  padding: 8px 10px;
  border-bottom: 1px solid #e5e6eb;
  color: #4e5969;
  font-size: 12px;
  font-weight: 700;
}

.manual-json-example pre {
  max-height: 240px;
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  color: #1d2129;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: pre-wrap;
}

.manual-preview {
  padding: 10px 12px;
  border: 1px solid #e5e6eb;
  border-radius: 6px;
  background: #f7f8fa;
  color: #4e5969;
  font-size: 12px;
}

.manual-preview strong {
  display: block;
  margin-bottom: 6px;
  color: #1d2129;
}

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

.manual-preview li {
  margin: 3px 0;
}

.manual-error {
  padding: 8px 10px;
  border-radius: 6px;
  background: #fff1f0;
  color: #f53f3f;
  font-size: 13px;
}

.manual-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.manual-actions button {
  height: 32px;
  padding: 0 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.manual-secondary {
  border: 1px solid #d8dee9;
  background: #fff;
  color: #4e5969;
}

.manual-primary {
  border: 1px solid #165dff;
  background: #165dff;
  color: #fff;
}

.manual-primary:disabled {
  border-color: #c9cdd4;
  background: #c9cdd4;
  cursor: default;
}

.virtual-query-list {
  padding: 0;
}

.virtual-query-list .qrow {
  min-height: 32px;
  padding-top: 0;
  padding-bottom: 0;
  flex-wrap: nowrap;
  gap: 6px;
  overflow: hidden;
}

.dashboard-page .query-select-row {
  height: 100%;
}

.virtual-query-list .qtext {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.query-column-empty {
  padding: 18px 16px;
  color: #86909c;
  font-size: 13px;
  line-height: 1.6;
}

/* Topic-table search-word preview: each input stays aligned with its judgment and output. */
.topic-table-panel {
  min-height: calc(100vh - 78px);
  padding: 18px;
  border: 1px solid #d9d3f3;
  border-radius: 10px;
  background: #f8f7fc;
  color: #1d2129;
}

.topic-table-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 2px 2px 16px;
}

.topic-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: #6e56cf;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.topic-table-intro h2 {
  margin: 0 0 7px;
  color: #202039;
  font-size: 22px;
  line-height: 1.25;
}

.topic-table-intro p {
  margin: 0;
  color: #646477;
  font-size: 13px;
}

.topic-preview-only {
  flex: none;
  padding: 7px 10px;
  border: 1px solid #b9ead6;
  border-radius: 999px;
  background: #edfff7;
  color: #16885e;
  font-size: 12px;
  font-weight: 700;
}

.topic-table-form {
  display: grid;
  grid-template-columns: 150px 150px minmax(190px, auto) minmax(180px, auto) minmax(190px, auto);
  align-items: end;
  gap: 10px;
  padding: 14px;
  border: 1px solid #e4e0f2;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(61, 49, 112, .05);
}

.topic-table-form label {
  display: grid;
  gap: 6px;
  color: #5d5d70;
  font-size: 11px;
  font-weight: 700;
}

.topic-table-form input {
  width: 100%;
  height: 34px;
  box-sizing: border-box;
  padding: 0 10px;
  border: 1px solid #d8d4e8;
  border-radius: 6px;
  background: #fff;
  color: #202039;
  font-size: 13px;
  outline: none;
}

.topic-table-form input:focus {
  border-color: #7c66d8;
  box-shadow: 0 0 0 3px rgba(110, 86, 207, .12);
}

.topic-table-form button {
  height: 34px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
}

.topic-example-button,
.topic-prompt-button {
  border: 1px solid #d8d4e8;
  background: #fff;
  color: #5d4e9d;
}

.topic-example-button:hover,
.topic-prompt-button:hover {
  border-color: #a99be0;
  background: #f5f2ff;
}

.topic-generate-button {
  border: 1px solid #6e56cf;
  background: #6e56cf;
  color: #fff;
  box-shadow: 0 5px 12px rgba(110, 86, 207, .18);
}

.topic-generate-button:hover:not(:disabled) {
  background: #5c45be;
}

.topic-generate-button:disabled {
  border-color: #bab1df;
  background: #bab1df;
  cursor: wait;
  box-shadow: none;
}

.topic-example-card {
  display: grid;
  grid-template-columns: minmax(360px, 1.3fr) minmax(320px, 1fr);
  gap: 28px;
  margin-top: 16px;
  padding: 20px 22px;
  border: 1px dashed #bbb1df;
  border-radius: 9px;
  background: linear-gradient(120deg, #fff 0%, #f5f2ff 100%);
}

.topic-example-card span {
  display: block;
  margin-bottom: 6px;
  color: #6e56cf;
  font-size: 11px;
  font-weight: 800;
}

.topic-example-card strong {
  color: #292444;
  font-size: 15px;
}

.topic-example-card p,
.topic-example-card li {
  color: #68657a;
  font-size: 12px;
  line-height: 1.6;
}

.topic-example-card ul {
  margin: 0;
  padding: 3px 0 0 20px;
}

.topic-loading-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 180px;
  margin-top: 16px;
  border: 1px solid #e4e0f2;
  border-radius: 8px;
  background: #fff;
  color: #625a82;
  font-size: 13px;
}

.topic-loading-card span {
  width: 14px;
  height: 14px;
  border: 2px solid #d9d2f2;
  border-top-color: #6e56cf;
  border-radius: 50%;
  animation: topic-spin .8s linear infinite;
}

@keyframes topic-spin {
  to { transform: rotate(360deg); }
}

.topic-generation-error {
  margin-top: 12px;
}

.topic-flow-grid {
  display: grid;
  grid-template-columns: minmax(280px, .9fr) minmax(340px, 1.05fr) minmax(360px, 1.15fr);
  gap: 12px;
  margin-top: 16px;
}

.topic-flow-column {
  position: relative;
  min-width: 0;
  max-height: calc(100vh - 250px);
  padding: 14px;
  overflow: auto;
  border: 1px solid #e1ddeb;
  border-radius: 8px;
  background: #fff;
}

.topic-flow-column:not(:last-child)::after {
  position: fixed;
  content: '';
}

.topic-flow-head {
  position: sticky;
  top: -14px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: -14px -14px 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #ece9f3;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(8px);
}

.topic-step {
  display: grid;
  width: 29px;
  height: 29px;
  flex: none;
  place-items: center;
  border-radius: 7px;
  background: #eeeaff;
  color: #6048be;
  font: 800 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.topic-flow-head strong {
  display: block;
  color: #292444;
  font-size: 13px;
}

.topic-flow-head small {
  color: #9690a8;
  font-size: 10px;
}

.topic-source-card {
  padding: 12px;
  border: 1px solid #e4e0f2;
  border-radius: 7px;
  background: #faf9ff;
}

.topic-source-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.topic-source-meta span {
  padding: 2px 6px;
  border-radius: 4px;
  background: #ece8fb;
  color: #62529d;
  font-size: 9px;
  font-weight: 700;
}

.topic-source-card h3 {
  margin: 10px 0 7px;
  color: #292444;
  font-size: 14px;
}

.topic-source-card p {
  margin: 0;
  color: #5f5c6d;
  font-size: 11px;
  line-height: 1.65;
}

.topic-dimension-group {
  margin-top: 12px;
}

.topic-dimension-group > strong,
.topic-point-list > strong {
  color: #514c63;
  font-size: 11px;
}

.topic-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.topic-chip-list span {
  padding: 3px 7px;
  border: 1px solid #e4e0ef;
  border-radius: 999px;
  background: #fff;
  color: #666174;
  font-size: 10px;
}

.topic-point-list {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #eeeaf3;
}

.topic-point-list > div {
  margin-top: 8px;
  padding-left: 9px;
  border-left: 2px solid #c7bbea;
}

.topic-point-list span {
  color: #765fc4;
  font-size: 9px;
  font-weight: 800;
}

.topic-point-list p {
  margin: 2px 0 0;
  color: #595569;
  font-size: 10px;
  line-height: 1.5;
}

.topic-needs-list,
.topic-query-list {
  display: grid;
  gap: 8px;
}

.topic-need-card {
  padding: 10px 11px;
  border: 1px solid #e3dfeb;
  border-left-width: 3px;
  border-radius: 6px;
  background: #fff;
}

.topic-need-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.topic-need-title span {
  color: #514b62;
  font-size: 10px;
  font-weight: 800;
}

.topic-need-title b {
  color: #9a94a7;
  font: 700 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.topic-need-card p {
  margin: 4px 0;
  color: #696575;
  font-size: 10px;
  line-height: 1.5;
}

.topic-need-card p strong {
  color: #3f3a4e;
}

.route-unique_hook { border-left-color: #7c5ce5; }
.route-goal_execution { border-left-color: #2c9d73; }
.route-key_execution { border-left-color: #3185d6; }
.route-cross_dimension { border-left-color: #df8b2e; }
.route-account_fit { border-left-color: #cc5a8b; }
.route-evidence_gap { border-left-color: #df5d55; }

.topic-query-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 8px 9px;
  border-radius: 6px;
  background: #f7f5fc;
  color: #777184;
  font-size: 10px;
}

.topic-query-summary b {
  color: #5e47b8;
  font-size: 15px;
}

.topic-query-summary em {
  margin-left: auto;
  color: #a36b17;
  font-style: normal;
  font-weight: 800;
}

.topic-query-list article {
  padding: 9px 10px;
  border: 1px solid #e4e1eb;
  border-radius: 6px;
  background: #fff;
}

.topic-query-route {
  display: inline-block;
  padding-left: 7px;
  border-left: 3px solid #7c5ce5;
  color: #777184;
  font-size: 9px;
  font-weight: 800;
}

.topic-query-list p {
  margin: 5px 0 3px;
  color: #292534;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}

.topic-query-list small {
  display: block;
  color: #9993a3;
  font-size: 9px;
  line-height: 1.4;
}

.topic-prompt-modal {
  width: min(920px, 100%);
}

.topic-route-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.topic-route-strip span {
  padding: 4px 8px;
  border: 1px solid #ded8f1;
  border-radius: 999px;
  background: #f6f3ff;
  color: #6654aa;
  font-size: 10px;
  font-weight: 750;
}

.topic-prompt-code {
  max-height: calc(100vh - 250px);
  margin: 0;
  padding: 14px 16px;
  overflow: auto;
  border: 1px solid #e3dfeb;
  border-radius: 7px;
  background: #252334;
  color: #ebe8f7;
  font: 11px/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: pre-wrap;
}

.topic-inline-state {
  color: #777184;
  font-size: 12px;
}

.topic-example-map,
.topic-route-map-head,
.topic-route-row {
  display: grid;
  grid-template-columns: minmax(280px, .95fr) minmax(320px, 1fr) minmax(360px, 1.15fr);
}

.topic-example-map {
  margin-top: 16px;
  overflow: hidden;
  border: 1px dashed #bdb3df;
  border-radius: 9px;
  background: #fff;
}

.topic-example-cell {
  min-width: 0;
  padding: 18px 20px;
}

.topic-example-cell + .topic-example-cell {
  border-left: 1px solid #e7e3f1;
}

.topic-example-cell span {
  color: #6a55bc;
  font-size: 11px;
  font-weight: 800;
}

.topic-example-cell p,
.topic-example-cell li {
  color: #403b4c;
  font-size: 12px;
  line-height: 1.6;
}

.topic-example-cell p {
  margin: 8px 0 0;
}

.topic-example-cell code,
.topic-route-input code {
  display: block;
  margin-top: 8px;
  color: #7a718a;
  font: 10px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  overflow-wrap: anywhere;
}

.topic-example-cell ul {
  margin: 7px 0 0;
  padding-left: 18px;
}

.topic-route-map {
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid #ddd8e9;
  border-radius: 9px;
  background: #fff;
}

.topic-route-map-head {
  border-bottom: 1px solid #ddd8e9;
  background: #f0edf8;
}

.topic-route-map-head strong {
  padding: 12px 18px;
  color: #403a50;
  font-size: 12px;
}

.topic-route-map-head strong + strong {
  border-left: 1px solid #ddd8e9;
}

.topic-route-map-body {
  display: grid;
}

.topic-source-group + .topic-source-group {
  border-top: 2px solid #d8d1eb;
}

.topic-source-group-toggle {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 18px;
  border: 0;
  color: inherit;
  text-align: left;
  background: #f7f4ff;
  cursor: pointer;
}

.topic-source-group-toggle:hover {
  background: #f1edfc;
}

.topic-source-group-toggle:focus-visible {
  position: relative;
  z-index: 2;
  outline: 2px solid #7256ce;
  outline-offset: -2px;
}

.topic-source-index {
  padding: 3px 7px;
  border-radius: 5px;
  color: #7159c7;
  background: #eae4fb;
  font-size: 10px;
  font-weight: 850;
}

.topic-source-title {
  display: grid;
  gap: 2px;
}

.topic-source-title strong {
  color: #312a45;
  font-size: 12px;
}

.topic-source-title small {
  color: #847d91;
  font-size: 10px;
}

.topic-source-counts {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.topic-source-counts b,
.topic-source-counts em,
.topic-source-counts i {
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-style: normal;
  font-weight: 750;
  white-space: nowrap;
}

.topic-source-counts b {
  color: #544c64;
  background: #e9e5ef;
}

.topic-source-counts em {
  color: #197152;
  background: #dff5e9;
}

.topic-source-counts i {
  color: #986417;
  background: #fff0cf;
}

.topic-source-chevron {
  color: #625b70;
  font-size: 10px;
  font-weight: 750;
}

.topic-source-chevron b {
  display: inline-block;
  font-size: 13px;
  transition: transform 160ms ease;
}

.topic-source-group.is-open .topic-source-chevron b {
  transform: rotate(180deg);
}

.topic-source-group-fields {
  max-height: 620px;
  overflow: auto;
  border-top: 1px solid #e5e1ed;
}

.topic-route-row {
  position: relative;
  border-left: 4px solid #d7d2e2;
}

.topic-route-row.is-selected {
  border-left-color: #7c5ce5;
}

.topic-route-row + .topic-route-row {
  border-top: 1px solid #e5e1ed;
}

.topic-route-row > div {
  min-width: 0;
  padding: 16px 18px;
}

.topic-route-row > div + div {
  border-left: 1px solid #e5e1ed;
}

.topic-route-input {
  background: #fcfbff;
}

.topic-route-input > span {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 5px;
  background: #ece7fb;
  color: #684fc1;
  font-size: 10px;
  font-weight: 850;
}

.topic-route-input > .topic-history-tag {
  margin-left: 5px;
  color: #986417;
  background: #fff0cf;
}

.topic-route-input > p {
  margin: 9px 0 0;
  color: #332e3f;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.55;
}

.topic-route-input h3 {
  margin: 8px 0 9px;
  color: #29243a;
  font-size: 13px;
}

.topic-route-input ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 17px;
}

.topic-route-input li {
  color: #686272;
  font-size: 10px;
  line-height: 1.5;
}

.topic-route-judgement p {
  margin: 0;
  color: #302b3b;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.6;
}

.topic-route-judgement small {
  display: block;
  margin-top: 8px;
  color: #777181;
  font-size: 10px;
  line-height: 1.55;
}

.topic-route-queries {
  display: grid;
  align-content: start;
  gap: 7px;
}

.topic-route-queries > div {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: start;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #e3dfeb;
  border-radius: 6px;
  background: #fff;
}

.topic-route-queries b {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: #eeeafb;
  color: #6751ba;
  font-size: 9px;
}

.topic-route-queries p {
  margin: 0;
  color: #292534;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.5;
}

.topic-route-judgement .topic-unused-copy,
.topic-route-queries > .topic-unused-copy {
  color: #96909f;
  font-weight: 500;
}

@media (max-width: 1180px) {
  .topic-table-form {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

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

  .topic-route-map-head {
    display: none;
  }

  .topic-source-group-toggle {
    grid-template-columns: auto 1fr auto;
  }

  .topic-source-counts {
    grid-column: 2 / -1;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .topic-example-map,
  .topic-route-row {
    grid-template-columns: 1fr;
  }

  .topic-example-cell + .topic-example-cell,
  .topic-route-row > div + div {
    border-top: 1px solid #e7e3f1;
    border-left: 0;
  }

  .topic-flow-column {
    max-height: none;
  }
}

@media (max-width: 720px) {
  .topic-table-panel { padding: 12px; }
  .topic-table-intro { flex-direction: column; }
  .topic-table-form { grid-template-columns: 1fr; }
  .topic-example-card { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .topic-loading-card span { animation: none; }
}
