/* Name-or-question search: one starting point, then optional related topics. */
.graph-query-form.knowledge-search {
  min-width:0;
  padding:16px 18px 12px;
  border:1px solid var(--line);
  border-radius:16px;
  background:#fffdfb;
  box-shadow:0 3px 16px #71534b04;
}

.knowledge-search .graph-search-heading {
  gap:8px 18px;
  margin-bottom:10px;
}

.knowledge-search .graph-search-heading h2 {
  color:#59463f;
  font-size:20px;
  line-height:1.4;
}

.knowledge-search .graph-search-heading p {
  margin-top:3px;
  color:var(--muted);
  font-size:14px;
  line-height:1.6;
}

.knowledge-search-row {
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
}

.knowledge-input-wrap {
  position:relative;
  flex:1 1 0;
  min-width:0;
}

.knowledge-search .graph-query-search {
  width:100%;
  min-width:0;
  max-width:none;
  height:48px;
  margin:0;
  border-color:#d8c4bd;
  background:#fff;
}

.knowledge-search .graph-query-search input {
  min-width:0;
  width:100%;
  height:46px;
  padding:9px 10px 9px 2px;
  font-size:16px;
}

.knowledge-search .graph-query-search input::placeholder {
  color:#8b7d75;
  opacity:1;
}

.knowledge-search-row>button {
  flex:0 0 auto;
  min-height:48px;
  padding:9px 16px;
  font-size:16px;
  white-space:nowrap;
}

.knowledge-search-row #reset-graph {
  color:#805b61;
  background:transparent;
}

.knowledge-suggestions {
  position:absolute;
  z-index:60;
  top:calc(100% + 6px);
  right:0;
  left:0;
  max-height:280px;
  margin:0;
  padding:5px;
  overflow:auto;
  overscroll-behavior:contain;
  border:1px solid #dbcac2;
  border-radius:12px;
  background:#fff;
  box-shadow:0 8px 24px #5f443d20;
  scrollbar-width:thin;
}

.knowledge-suggestions .suggestion-item {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px 16px;
  width:100%;
  min-width:0;
  min-height:44px;
  padding:8px 10px;
  border:0;
  border-radius:7px;
  background:transparent;
  text-align:left;
}

.knowledge-suggestions .suggestion-item>span {
  min-width:0;
  overflow-wrap:anywhere;
  font-size:16px;
  font-weight:550;
}

.knowledge-suggestions .suggestion-item small {
  color:var(--muted);
  font-size:13px;
  line-height:1.5;
  text-align:right;
}

.knowledge-suggestions .suggestion-item:hover,
.knowledge-suggestions .suggestion-item[aria-selected="true"] {
  background:var(--accent-soft);
}

.knowledge-examples {
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:5px 7px;
  min-width:0;
  margin-top:9px;
  color:var(--muted);
  font-size:14px;
}

.knowledge-examples>span {
  flex:0 0 auto;
}

.knowledge-examples button,
.knowledge-browse-items button {
  min-width:0;
  max-width:100%;
  min-height:36px;
  padding:5px 10px;
  border:1px solid #eee1d9;
  border-radius:8px;
  background:#fcf8f4;
  color:#72594f;
  font-size:14px;
  line-height:1.6;
  text-align:left;
  white-space:normal;
  overflow-wrap:anywhere;
}

.knowledge-examples button:hover,
.knowledge-browse-items button:hover {
  border-color:#c9a3ab;
  background:#f7eceb;
  color:#854652;
}

.knowledge-browse {
  min-width:0;
  margin-top:5px;
}

.knowledge-browse>summary {
  width:fit-content;
  max-width:100%;
  padding:6px 1px;
  border-radius:5px;
  color:#845c61;
  font-size:14px;
  line-height:1.6;
  cursor:pointer;
  overflow-wrap:anywhere;
}

.knowledge-browse[open]>summary {
  margin-bottom:5px;
}

.knowledge-browse-types {
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:5px;
  padding:8px;
  border:1px solid #ede2dc;
  border-bottom:0;
  border-radius:10px 10px 0 0;
  background:#f8f3ee;
}

.knowledge-browse-types button {
  min-height:36px;
  padding:5px 10px;
  border:1px solid transparent;
  border-radius:7px;
  background:transparent;
  font-size:14px;
  line-height:1.6;
}

.knowledge-browse-types button[aria-pressed="true"],
.knowledge-browse-types button.active {
  border-color:#e2cbd0;
  background:#fff;
  color:var(--accent);
  font-weight:600;
}

.knowledge-browse-items {
  display:flex;
  align-content:flex-start;
  flex-wrap:wrap;
  gap:7px;
  max-height:160px;
  padding:10px;
  overflow:auto;
  overscroll-behavior:contain;
  border:1px solid #ede2dc;
  border-radius:0 0 10px 10px;
  background:#fff;
  scrollbar-width:thin;
}

#graph-query-context.knowledge-search-status {
  min-width:0;
  margin-top:5px;
  padding:4px 1px 0;
  border:0;
  border-radius:0;
  background:transparent;
  color:#78665f;
  font-size:14px;
  line-height:1.6;
  overflow-wrap:anywhere;
}

.knowledge-topics {
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px 12px;
  min-width:0;
  padding:10px 2px;
}

.knowledge-topics>strong {
  flex:0 0 auto;
  color:#665149;
  font-size:15px;
  font-weight:600;
}

.knowledge-topic-buttons {
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  min-width:0;
}

.knowledge-topic-buttons button {
  min-height:40px;
  max-width:100%;
  padding:6px 12px;
  border-radius:999px;
  background:#fff;
  color:#765f57;
  font-size:14px;
  line-height:1.6;
  white-space:normal;
  overflow-wrap:anywhere;
}

.knowledge-topic-buttons button[aria-pressed="true"] {
  border-color:#be919a;
  background:var(--accent-soft);
  color:#834652;
  font-weight:600;
}

.knowledge-search button:focus-visible,
.knowledge-search summary:focus-visible,
.knowledge-topics button:focus-visible,
#graph-query-results button:focus-visible {
  outline:3px solid #b8828b;
  outline-offset:2px;
}

#graph-query-results {
  min-width:0;
}

#graph-query-results .graph-query-results-head {
  gap:5px 16px;
  padding:11px 15px;
}

#graph-query-results .graph-query-results-head h2 {
  font-size:18px;
}

#graph-query-results .graph-query-hits {
  max-height:200px;
  padding:9px;
  gap:8px;
}

#graph-query-results .query-hit {
  min-height:88px;
  padding:10px 12px;
}

.knowledge-result-actions {
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px;
  min-width:0;
  margin-top:10px;
}

.knowledge-result-actions button,.knowledge-result-actions a {
  display:inline-flex;
  align-items:center;
  min-height:44px;
  max-width:100%;
  padding:7px 11px;
  font-size:14px;
  white-space:normal;
  overflow-wrap:anywhere;
}

.knowledge-empty {
  grid-column:1/-1;
  min-width:0;
  padding:20px 18px;
  color:#75645d;
  font-size:15px;
  line-height:1.75;
  overflow-wrap:anywhere;
}

.knowledge-empty strong {
  color:#5f4942;
}

.knowledge-empty p+p {
  margin-top:5px;
}

.knowledge-empty button {
  max-width:100%;
  min-height:44px;
  margin:8px 6px 0 0;
  padding:7px 12px;
  color:var(--accent);
  font-size:15px;
  white-space:normal;
  overflow-wrap:anywhere;
}

@media(max-width:699px) {
  .graph-query-form.knowledge-search {
    padding:13px 12px 10px;
    border-radius:13px;
  }

  .knowledge-search .graph-search-heading {
    margin-bottom:9px;
  }

  .knowledge-search .graph-search-heading h2 {
    font-size:19px;
  }

  .knowledge-search-row {
    flex-wrap:wrap;
    gap:8px;
  }

  .knowledge-input-wrap {
    flex-basis:100%;
  }

  .knowledge-search-row>button {
    flex:1 1 0;
    min-width:0;
    min-height:44px;
    padding:8px 12px;
  }

  .knowledge-suggestions {
    max-height:240px;
  }

  .knowledge-examples {
    align-items:flex-start;
    gap:6px;
    margin-top:10px;
  }

  .knowledge-examples>span {
    width:100%;
  }

  .knowledge-examples button,
  .knowledge-browse-items button,
  .knowledge-browse-types button,
  .knowledge-topic-buttons button {
    min-height:44px;
  }

  .knowledge-browse>summary {
    display:list-item;
    min-height:44px;
    padding:9px 0;
  }

  .knowledge-browse-items {
    max-height:190px;
  }

  .knowledge-topics {
    align-items:flex-start;
    gap:6px;
    padding:10px 0;
  }

  .knowledge-topics>strong {
    width:100%;
  }

  #graph-query-results .graph-query-results-head {
    padding:10px 12px;
  }

  #graph-query-results .graph-query-hits {
    grid-template-columns:minmax(0,1fr);
    max-height:192px;
  }

  #graph-query-results .query-hit {
    min-height:86px;
  }

  .knowledge-empty {
    padding:15px 12px;
  }
}

.suggestion-heading { display:block; padding:5px 10px; color:var(--muted); font-size:13px; }
#graph-query-results .graph-query-hits { grid-template-columns:repeat(auto-fit,minmax(min(100%,260px),1fr)); }
@media(max-width:699px) { #graph-query-results .graph-query-hits { grid-template-columns:minmax(0,1fr); } }
