#document-brain {
  position: fixed;
  right: 18px;
  bottom: 92px;
  z-index: 80;
  width: min(460px, calc(100vw - 36px));
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #122033;
  pointer-events: none;
}

#document-brain * {
  box-sizing: border-box;
}

.docbrain-launcher,
.docbrain-shell {
  pointer-events: auto;
}

.docbrain-launcher {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-left: auto;
  width: min(260px, calc(100vw - 36px));
  min-height: 46px;
  border: 1px solid rgba(113, 137, 174, 0.42);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 34px rgba(20, 32, 50, 0.15);
  color: #13243a;
  cursor: pointer;
  padding: 9px 12px;
  text-align: left;
}

.docbrain-launcher:hover {
  background: #f8fbff;
  border-color: #9fb9e4;
}

.docbrain-launcher span {
  color: #2358d8;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.docbrain-launcher strong {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #e6f8ef;
  color: #087347;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  padding: 7px 9px;
}

.docbrain-shell {
  border: 1px solid rgba(118, 141, 173, 0.34);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 50px rgba(20, 32, 50, 0.18);
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.docbrain-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid #e1e8f2;
  background: linear-gradient(90deg, #f8fbff, #ffffff);
}

.docbrain-top p {
  margin: 3px 0 0;
  color: #63748b;
  font-size: 12px;
  line-height: 1.3;
}

.docbrain-top span {
  display: block;
  color: #2358d8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.docbrain-top h2 {
  margin: 3px 0 0;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
}

.docbrain-refresh {
  flex: 0 0 auto;
  border: 1px solid #bdd0ee;
  border-radius: 7px;
  background: #fff;
  color: #173a74;
  font-size: 13px;
  font-weight: 750;
  height: 34px;
  padding: 0 12px;
  cursor: pointer;
}

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

.docbrain-close {
  flex: 0 0 auto;
  border: 1px solid #d3deee;
  border-radius: 7px;
  background: #f8fbff;
  color: #43556f;
  font-size: 13px;
  font-weight: 750;
  height: 34px;
  padding: 0 12px;
  cursor: pointer;
}

.docbrain-refresh:hover,
.docbrain-close:hover {
  background: #f0f6ff;
}

.docbrain-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid #e1e8f2;
}

.docbrain-stat {
  padding: 12px 16px;
  border-right: 1px solid #e1e8f2;
}

.docbrain-stat:last-child {
  border-right: 0;
}

.docbrain-stat strong,
.docbrain-stat span {
  display: block;
}

.docbrain-stat strong {
  font-size: 20px;
  line-height: 1;
}

.docbrain-stat span {
  margin-top: 4px;
  color: #5f6f85;
  font-size: 12px;
  font-weight: 650;
}

.docbrain-body {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 0;
  max-height: 560px;
}

.docbrain-list {
  overflow: auto;
  max-height: 178px;
  border-bottom: 1px solid #e1e8f2;
  background: #f7faff;
  padding: 8px;
}

.docbrain-file {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
}

.docbrain-file:hover,
.docbrain-file.active {
  border-color: #bfd2ef;
  background: #fff;
}

.docbrain-file strong,
.docbrain-file small {
  display: block;
}

.docbrain-file strong {
  color: #1b2b42;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 780;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.docbrain-file small {
  margin-top: 4px;
  color: #68778a;
  font-size: 11px;
}

.docbrain-status,
.docbrain-chip {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
}

.docbrain-status.indexed,
.docbrain-chip.quiet {
  background: #e6f8ef;
  color: #087347;
}

.docbrain-status.needs_ocr,
.docbrain-chip.risk {
  background: #fff1df;
  color: #9a4b00;
}

.docbrain-status.unsupported,
.docbrain-status.empty {
  background: #edf2f8;
  color: #516176;
}

.docbrain-detail {
  overflow: auto;
  max-height: 340px;
  padding: 16px;
  background: #fff;
}

.docbrain-dochead {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: start;
}

.docbrain-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #173a74;
  color: #fff;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.docbrain-dochead h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
}

.docbrain-dochead p {
  margin: 7px 0 0;
  color: #40516a;
  font-size: 13px;
  line-height: 1.5;
}

.docbrain-riskbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 4px;
}

.docbrain-section {
  margin-top: 16px;
}

.docbrain-section h4 {
  margin: 0 0 8px;
  color: #56677f;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.docbrain-section ul {
  margin: 0;
  padding-left: 18px;
}

.docbrain-section li {
  margin: 0 0 7px;
  color: #1e3048;
  font-size: 13px;
  line-height: 1.45;
}

.docbrain-questions {
  display: grid;
  gap: 8px;
}

.docbrain-question {
  border: 1px solid #c7d7ef;
  border-radius: 7px;
  background: #f8fbff;
  color: #173a74;
  font-size: 13px;
  font-weight: 720;
  line-height: 1.35;
  padding: 9px 10px;
  text-align: left;
}

.docbrain-empty {
  color: #66768a;
  font-size: 13px;
  line-height: 1.45;
  padding: 12px;
}

.docbrain-empty.compact {
  padding: 0;
}

@media (max-width: 760px) {
  #document-brain {
    right: 8px;
    bottom: 88px;
    width: calc(100vw - 16px);
  }

  .docbrain-body {
    grid-template-columns: 1fr;
    max-height: 70vh;
  }

  .docbrain-list {
    max-height: 210px;
    border-right: 0;
    border-bottom: 1px solid #e1e8f2;
  }
}
