:root { --otter-width: 430px; }
.otter-intelligence-panel {
  position: fixed;
  z-index: 80;
  inset: 0 0 0 auto;
  width: min(var(--otter-width), 48vw);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  grid-template-areas: "header" "history" "body" "question" "footer";
  background: #0d0d0c;
  border-left: 1px solid #4d4124;
  box-shadow: -20px 0 48px rgb(0 0 0 / 45%);
}
.otter-intelligence-panel.hidden { display: none; }
body.otter-docked .shell { margin-right: min(var(--otter-width), 48vw); }
.otter-resize-handle {
  position: absolute;
  inset: 0 auto 0 -5px;
  width: 10px;
  cursor: ew-resize;
  touch-action: none;
}
.otter-resize-handle:focus-visible { outline: 2px solid #e5ca78; outline-offset: -2px; }
.otter-intelligence-panel.collapsed {
  width: 76px;
  grid-template-rows: auto;
  grid-template-areas: "header";
}
body.otter-docked:has(.otter-intelligence-panel.collapsed) .shell { margin-right: 76px; }
.otter-intelligence-panel.collapsed .otter-resize-handle,
.otter-intelligence-panel.collapsed .otter-history,
.otter-intelligence-panel.collapsed .otter-intelligence-body,
.otter-intelligence-panel.collapsed .otter-question-form,
.otter-intelligence-panel.collapsed footer,
.otter-intelligence-panel.collapsed header > div:first-child { display: none; }
.otter-intelligence-panel.collapsed header { display: block; padding: 8px 16px; }
.otter-intelligence-panel.collapsed header > div:last-child { display: grid; gap: 4px; }
.otter-intelligence-panel header,
.otter-intelligence-panel footer {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #292820;
}
.otter-intelligence-panel > header { grid-area: header; }
.otter-intelligence-panel > .otter-history { grid-area: history; }
.otter-intelligence-panel > .otter-intelligence-body { grid-area: body; min-height: 0; }
.otter-intelligence-panel > .otter-question-form { grid-area: question; }
.otter-intelligence-panel > footer { grid-area: footer; min-width: 0; }
.otter-intelligence-panel header p { margin: 6px 0 0; color: #aaa89d; font-size: .78rem; }
.otter-intelligence-panel footer {
  border: 0;
  border-top: 1px solid #292820;
  flex-wrap: wrap;
  justify-content: flex-start;
  padding-block: 12px;
}
.otter-intelligence-body { padding: 20px 24px; overflow: auto; overscroll-behavior: contain; }
.otter-welcome { margin-bottom: 22px; }
.otter-welcome h4 { margin: 7px 0; font-size: 1.15rem; }
.otter-welcome p { margin: 0 0 14px; color: #aaa89d; }
.otter-suggestions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.otter-suggestions button { text-align: left; white-space: normal; min-height: 44px; }
.otter-stream-status {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-left: 2px solid #d8b75b;
  color: #e5ca78;
  background: #171610;
}
.otter-response:empty { display: none; }
.otter-intelligence-section { margin-block: 0 24px; }
.otter-intelligence-section > h4 {
  margin: 0 0 8px;
  color: #d8b75b;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .75rem;
}
.otter-intelligence-section p { margin: 0; line-height: 1.65; }
.otter-intelligence-evidence,
.otter-intelligence-recommendations,
.otter-intelligence-links { display: grid; gap: 10px; }
.otter-intelligence-evidence article,
.otter-intelligence-recommendations article,
.otter-transcript-item {
  padding: 14px;
  border: 1px solid #343227;
  background: #131311;
}
.otter-transcript-item { margin-bottom: 10px; }
.otter-transcript-item h4 { margin: 0 0 8px; }
.otter-transcript-item p { color: #c1bfb5; }
.otter-intelligence-panel a { overflow-wrap: anywhere; }
.otter-confidence {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid #64552e;
  color: #e5ca78;
}
.otter-mode-guidance { color: #c9b266; font-size: .82rem; }
.otter-question-form {
  padding: 12px 20px;
  border-top: 1px solid #292820;
  background: #10100e;
}
.otter-question-form textarea {
  width: 100%;
  min-height: 58px;
  resize: vertical;
  background: #171713;
  border: 1px solid #3a382d;
  color: #f2efe4;
  padding: 10px;
}
.otter-question-form > div { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }
.otter-history {
  border-bottom: 1px solid #292820;
  padding: 12px 20px;
  max-height: 34vh;
  overflow: auto;
}
.otter-history-toolbar { display: flex; gap: 8px; }
.otter-history-toolbar input { min-width: 0; flex: 1; }
#otter-conversation-list { display: grid; gap: 8px; margin-top: 10px; }
#otter-conversation-list > button {
  display: grid;
  text-align: left;
  padding: 10px;
  border: 1px solid #343227;
  background: #151511;
  color: #f2efe4;
}
#otter-conversation-list small { color: #aaa89d; margin-top: 4px; }
.otter-global-action { color: #e5ca78; border-color: #64552e; }
.otter-explain-action { white-space: nowrap; }
@media (max-width: 720px) {
  body.otter-docked .shell,
  body.otter-docked:has(.otter-intelligence-panel.collapsed) .shell { margin-right: 0; }
  .otter-intelligence-panel {
    inset: auto 0 0;
    width: 100%;
    height: min(88dvh, 780px);
    border-left: 0;
    border-top: 1px solid #4d4124;
    border-radius: 18px 18px 0 0;
  }
  .otter-intelligence-panel.collapsed { width: 100%; height: 76px; }
  .otter-resize-handle { display: none; }
  .otter-intelligence-body { padding: 16px; }
  .otter-suggestions { grid-template-columns: 1fr; }
  .otter-question-form { padding: 10px 16px; }
  .otter-question-form textarea { min-height: 44px; resize: none; }
  .otter-intelligence-panel footer {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 8px 16px;
    scrollbar-width: thin;
  }
  .otter-intelligence-panel footer button { flex: 0 0 auto; }
  body:has(.otter-intelligence-panel:not(.hidden):not(.collapsed)) { overflow: hidden; }
}
@media (prefers-reduced-motion: no-preference) {
  .otter-intelligence-panel,
  body.otter-docked .shell { transition: width 140ms ease, height 140ms ease, margin-right 140ms ease; }
}
