#local-knowledge {
  display: block;
  width: 100%;
  max-width: 920px;
  min-width: 0;
  min-height: 0;
  margin: 18px auto 0;
  box-sizing: border-box;
  padding: 24px;
}
@media (max-width: 880px) {
  #local-knowledge { max-width: 560px; padding: 18px; }
}
.kb h2 {
  font-size: 18px;
  margin: 0 0 7px;
}
.kb-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}
.kb-heading p {
  color: var(--text-muted, #888c97);
  margin: 0;
  font-size: 13px;
}
.kb-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: center;
}
.kb .kb-toolbar {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 10px;
  margin: 20px 0 10px;
}
.kb-list {
  display: grid;
  gap: 10px;
  max-height: 560px;
  overflow: auto;
  scrollbar-width: thin;
  padding: 2px;
}
.kb-row {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
  padding: 15px;
  background: #0c0f14;
  border: 1px solid #252830;
  border-radius: 14px;
}
.kb-row > div:first-child {
  min-width: 0;
  flex: 1;
}
.kb-row .kb-actions {
  max-width: 250px;
  justify-content: flex-end;
}
.kb-row strong {
  font-size: 14px;
  overflow-wrap: anywhere;
}
.kb-muted {
  font-size: 12px;
  line-height: 1.55;
  color: #999da7;
  margin: 6px 0 10px;
}
.kb-excerpt {
  font-size: 13px;
  line-height: 1.55;
  color: #c5c8cf;
  margin: 8px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.kb-status {
  font-size: 13px;
  line-height: 1.5;
  color: #abd9eb;
  min-height: 20px;
  margin-top: 12px;
}
.kb-details {
  border-top: 1px solid #272a32;
  padding: 17px 0 4px;
  margin-top: 14px;
}
.kb summary {
  cursor: pointer;
  list-style-position: inside;
  font-size: 14px;
  font-weight: 600;
  padding: 5px 0;
}
.kb details[open] > summary {
  margin-bottom: 14px;
}
.kb label {
  display: block;
  color: #a6aab5;
  font-size: 12px;
  line-height: 1.5;
  margin: 15px 0;
}
.kb .form-input {
  display: block;
  margin-top: 7px;
  width: 100%;
  box-sizing: border-box;
}
.kb textarea {
  resize: vertical;
  min-height: 74px;
}
.kb .btn {
  font-size: 12px;
}
.kb-dialog {
  color: #e9ecf3;
  background: #101319;
  border: 1px solid #303541;
  border-radius: 20px;
  padding: 24px;
  width: min(600px, calc(100vw - 32px));
  max-height: calc(100dvh - 40px);
  overflow: auto;
  margin: auto;
  box-shadow: 0 24px 100px #0009;
}
.kb-dialog::backdrop {
  background: #000a;
  backdrop-filter: blur(4px);
}
.kb-close {
  border: 0;
  background: #222731;
  color: #adb2bd;
  border-radius: 9px;
  min-width: 32px;
  height: 32px;
  font-size: 24px;
  cursor: pointer;
}
.kb-dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 22px;
  position: sticky;
  bottom: -24px;
  background: #101319;
  padding: 16px 0;
}
.kb-page {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font:
    12px/1.65 ui-monospace,
    monospace;
  color: #c7cdd7;
  background: #090c11;
  padding: 14px;
  border: 1px solid #252b35;
  border-radius: 12px;
  max-height: 400px;
  overflow: auto;
}
.kb [data-documents] {
  margin: 15px 0;
}
.kb [data-reader] {
  width: min(850px, calc(100vw - 32px));
}
.kb[aria-busy="true"] button:not([hidden]) {
  opacity: 0.7;
}
.kb .btn:focus-visible,
.kb summary:focus-visible {
  outline: 2px solid #22a8e8;
  outline-offset: 3px;
}
@media (max-width: 650px) {
  .kb-heading,
  .kb-row {
    flex-direction: column;
  }
  .kb-row .kb-actions {
    max-width: none;
    justify-content: flex-start;
  }
  .kb .kb-toolbar {
    grid-template-columns: 1fr;
  }
  .kb-dialog {
    padding: 18px;
  }
  .kb-dialog-actions {
    bottom: -18px;
    flex-wrap: wrap;
  }
  .kb-list {
    max-height: 460px;
  }
}
.kb.set-card {
  display: block;
  grid-column: 1/-1;
  min-width: 0;
  padding: 24px;
  box-sizing: border-box;
}
.kb [hidden] {
  display: none !important;
}
.kb .kb-heading > div:first-child {
  min-width: 0;
  flex: 1;
}
.kb .kb-toolbar > * {
  min-width: 0;
}
.kb .kb-status {
  overflow-wrap: anywhere;
}
@media (max-width: 650px) {
  .kb.set-card {
    padding: 18px;
  }
}
.kb .kb-select {
  width: 17px;
  height: 17px;
  flex: none;
  margin-top: 3px;
  accent-color: #24a8e8;
}
.kb .kb-selection {
  margin: 12px 0;
}
.kb .kb-selection .btn {
  font-size: 11px;
}
.kb .kb-prompt {
  font:
    12px/1.6 ui-monospace,
    monospace;
  white-space: pre;
  overflow: auto;
  min-height: 240px;
}
.kb .kb-actions + .kb-muted {
  margin-top: 12px;
}
.kb .kb-row > div:not(.kb-actions) {
  min-width: 0;
  flex: 1;
}
.kb button:disabled {
  cursor: wait;
  opacity: 0.5;
}
.kb-manual h3 {
  margin: 7px 0;
  font-size: 14px;
}
.kb-manual-form {
  background: #0b0e13;
  border: 1px solid #252b35;
  border-radius: 16px;
  padding: 18px;
  margin: 18px 0;
}
.kb-manual-form > label:first-child {
  margin-top: 0;
}
.kb .kb-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin: 0 auto 0 0;
}
.kb .kb-check input {
  width: 16px;
  height: 16px;
  accent-color: #24a8e8;
}
.kb-optional {
  margin-top: 15px;
}
.kb-manual .kb-excerpt {
  white-space: pre-wrap;
  max-height: 160px;
  overflow: auto;
}
.kb-manual [data-trash] .kb-row > p {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
}
.kb-manual .kb-toolbar {
  margin-top: 20px;
}
.kb .kb-ai-reply {
  background: #0b1520;
  border: 1px solid #23475c;
  border-radius: 14px;
  padding: 16px;
  white-space: pre-wrap;
  line-height: 1.6;
}
.kb [data-rule-count] {
  text-align: right;
  margin-top: -8px;
}
.kb-manual-form [data-examples] details {
  margin: 12px 0;
}
.kb-manual-form > label:first-child {
  margin-top: 0;
}
