.scribe-chat-anchor {
  position: absolute;
  right: clamp(14px, 2vw, 24px);
  top: 14px;
  z-index: 6;
  border: 1px solid rgba(196, 139, 59, 0.42);
  border-radius: 999px;
  color: #8b5b1d;
  background: rgba(255, 250, 243, 0.88);
  box-shadow: 0 8px 20px rgba(42, 31, 20, 0.12);
  padding: 8px 12px;
  font: 800 11px/1 Inter, system-ui, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.scribe-chat-anchor:hover {
  border-color: rgba(196, 139, 59, 0.72);
  transform: translateY(-1px);
}

.scribe-chat-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1000;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.scribe-chat-toggle {
  min-width: 62px;
  height: 62px;
  padding: 0 16px;
  border: 1px solid rgba(241, 192, 109, 0.56);
  border-radius: 999px;
  color: #fffaf3;
  background:
    radial-gradient(circle at 30% 18%, rgba(241, 192, 109, 0.32), transparent 36%),
    #001d35;
  box-shadow: 0 18px 42px rgba(0, 28, 52, 0.26);
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 30px;
  gap: 10px;
  place-items: center;
  font: 800 12px/1 Inter, system-ui, sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.scribe-chat-toggle svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scribe-chat-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: min(470px, calc(100vw - 28px));
  height: min(720px, calc(100vh - 110px));
  display: none;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  color: #071226;
  background: rgba(255, 250, 243, 0.97);
  border: 1px solid rgba(91, 72, 51, 0.18);
  border-radius: 12px;
  box-shadow: 0 28px 70px rgba(42, 31, 20, 0.24);
}

.scribe-chat-root.open .scribe-chat-panel {
  display: grid;
}

.scribe-chat-head {
  padding: 15px 16px 13px;
  color: #fffaf3;
  background:
    radial-gradient(circle at 12% 0%, rgba(196, 139, 59, 0.24), transparent 42%),
    #001d35;
}

.scribe-chat-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.scribe-chat-title strong {
  font: 700 17px/1.1 Georgia, "Times New Roman", serif;
  letter-spacing: 0.02em;
}

.scribe-chat-close {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(241, 192, 109, 0.35);
  border-radius: 50%;
  color: #fffaf3;
  background: transparent;
  cursor: pointer;
}

.scribe-chat-context {
  color: #f1c06d;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.scribe-mode-select {
  width: 100%;
  min-height: 36px;
  margin-top: 10px;
  border: 1px solid rgba(241, 192, 109, 0.35);
  border-radius: 8px;
  color: #fffaf3;
  background: rgba(255, 250, 243, 0.09);
  padding: 7px 9px;
  text-transform: capitalize;
}

.scribe-new-investigation {
  margin-top: 9px;
  border: 1px solid rgba(241, 192, 109, 0.35);
  border-radius: 999px;
  color: #f1c06d;
  background: transparent;
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
}

.scribe-context-alert {
  padding: 9px 14px;
  color: #6c4719;
  background: #f7ead7;
  border-bottom: 1px solid rgba(91, 72, 51, 0.14);
  font-size: 12px;
}

.scribe-chat-log {
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scribe-chat-msg {
  max-width: 88%;
  border: 1px solid rgba(91, 72, 51, 0.14);
  border-radius: 10px;
  padding: 10px 11px;
  background: #fffdfa;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.scribe-chat-msg.structured {
  max-width: 96%;
}

.scribe-answer-section {
  margin-bottom: 12px;
}

.scribe-answer-section h4 {
  margin: 0 0 6px;
  color: #8b5b1d;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.scribe-answer-section p,
.scribe-answer-section ul {
  margin: 0;
}

.scribe-answer-section ul {
  padding-left: 18px;
}

.scribe-evidence-item {
  border: 1px solid rgba(91, 72, 51, 0.14);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 8px;
  background: #fffaf3;
}

.scribe-evidence-meta {
  color: #6c4719;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.scribe-evidence-item blockquote,
.scribe-receipt-panel blockquote {
  margin: 7px 0;
  padding-left: 10px;
  border-left: 3px solid rgba(196, 139, 59, 0.45);
  font-family: Georgia, "Times New Roman", serif;
}

.scribe-receipt-button {
  border: 1px solid rgba(196, 139, 59, 0.38);
  border-radius: 999px;
  color: #8b5b1d;
  background: #fffdfa;
  padding: 6px 9px;
  cursor: pointer;
  font-size: 12px;
}

.scribe-receipt-host {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(7, 18, 38, 0.38);
}

.scribe-receipt-host.open {
  display: block;
}

.scribe-receipt-panel {
  position: absolute;
  right: 24px;
  top: 24px;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 18px;
  color: #071226;
  background: #fffaf3;
  border: 1px solid rgba(91, 72, 51, 0.18);
  border-radius: 12px;
  box-shadow: 0 26px 70px rgba(42, 31, 20, 0.25);
}

.scribe-receipt-close {
  float: right;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(91, 72, 51, 0.18);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.scribe-receipt-row {
  margin: 7px 0;
  font-size: 13px;
}

.scribe-selection-popover {
  position: absolute;
  z-index: 1100;
  border: 1px solid rgba(241, 192, 109, 0.56);
  border-radius: 999px;
  color: #fffaf3;
  background: #001d35;
  box-shadow: 0 16px 34px rgba(0, 28, 52, 0.22);
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
}

.scribe-chat-msg.user {
  align-self: flex-end;
  color: #fffaf3;
  background: #001d35;
  border-color: rgba(241, 192, 109, 0.26);
}

.scribe-chat-msg.assistant {
  align-self: flex-start;
}

.scribe-chat-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 14px 10px;
}

.scribe-chat-chip {
  border: 1px solid rgba(196, 139, 59, 0.34);
  border-radius: 999px;
  color: #8b5b1d;
  background: #fffaf3;
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
}

.scribe-chat-form {
  border-top: 1px solid rgba(91, 72, 51, 0.14);
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 8px;
  background: rgba(245, 240, 232, 0.72);
}

.scribe-chat-input {
  min-width: 0;
  height: 42px;
  resize: none;
  border: 1px solid rgba(91, 72, 51, 0.2);
  border-radius: 8px;
  color: #071226;
  background: #fffdfa;
  padding: 10px 11px;
  outline: none;
  font: 14px/1.35 Inter, system-ui, sans-serif;
}

.scribe-chat-send {
  border: 0;
  border-radius: 8px;
  color: #fffaf3;
  background: #001d35;
  cursor: pointer;
}

.scribe-chat-send svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 620px) {
  .scribe-chat-root {
    right: 14px;
    bottom: 14px;
  }

  .scribe-chat-panel {
    bottom: 76px;
    height: min(590px, calc(100vh - 96px));
  }

  .scribe-chat-toggle span {
    display: none;
  }

  .scribe-chat-toggle {
    width: 62px;
    padding: 0;
    grid-template-columns: 30px;
  }

  body.scribe-ask-visible .scribe-chat-root:not(.open) {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
  }
}
