.oroculos-root {
  position: fixed;
  right: 22px;
  bottom: calc(22px + var(--oroculos-bottom-offset, 0px));
  z-index: 90;
  font-family: "Archivo", ui-sans-serif, system-ui, sans-serif;
  --oroculos-human: "Lora", Georgia, serif;
  color: #171814;
  --oroculos-line: #d8cdbb;
  --oroculos-panel: #fffaf1;
  --oroculos-muted: #746d61;
}

.oroculos-toggle {
  position: relative;
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: #171814;
  filter: drop-shadow(0 10px 18px rgba(31, 25, 17, .22));
  transition: transform .18s ease, filter .18s ease;
}

.oroculos-toggle:hover,
.oroculos-toggle:focus-visible {
  transform: translateY(-1px) scale(1.04) rotate(-2deg);
  filter: drop-shadow(0 14px 22px rgba(31, 25, 17, .24));
}

.oroculos-toggle:focus-visible {
  outline: 3px solid rgba(212, 155, 22, .5);
  outline-offset: 4px;
}

.oroculos-mascot-img {
  width: 100%;
  height: 100%;
  display: block;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  pointer-events: none;
  animation: oroculosMascotFloat 4.8s ease-in-out infinite;
  transition: opacity .18s ease, transform .18s ease;
}

.oroculos-mascot-badge {
  position: absolute;
  top: 4px;
  right: 3px;
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 2px solid #fffaf1;
  border-radius: 999px;
  background: #b64c36;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.oroculos-mascot-orbit {
  position: absolute;
  inset: -5px;
  border-radius: 22px;
  pointer-events: none;
  opacity: 0;
}

.oroculos-mascot-orbit i {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #d49b16;
}

.oroculos-mascot-orbit i:nth-child(1) { top: 8px; left: 15px; }
.oroculos-mascot-orbit i:nth-child(2) { right: 8px; top: 30px; }
.oroculos-mascot-orbit i:nth-child(3) { bottom: 8px; left: 29px; }

.oroculos-mascot--thinking {
  animation: oroculosMascotPulse 1.6s ease-in-out infinite;
}

.oroculos-mascot--expression .oroculos-mascot-img {
  animation: oroculosMascotFloat 4.8s ease-in-out infinite, oroculosExpressionPop .42s ease-out;
}

.oroculos-mascot--thinking .oroculos-mascot-orbit {
  opacity: 1;
  animation: oroculosOrbit 2.8s linear infinite;
}

.oroculos-mascot--success {
  transform: scale(1.05);
}

.oroculos-mascot--warning,
.oroculos-mascot--error {
  filter: drop-shadow(0 10px 18px rgba(182, 76, 54, .28));
}

.oroculos-panel {
  position: absolute;
  right: 0;
  bottom: 68px;
  width: min(480px, calc(100vw - 28px));
  max-height: min(720px, calc(100vh - 110px));
  display: none;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid #d8cdbb;
  border-radius: 10px;
  background: #fffaf1;
  box-shadow: 0 24px 70px rgba(31, 25, 17, .26);
}

.oroculos-root.open .oroculos-panel {
  display: grid;
  animation: oroculosPanelIn .16s ease-out;
}

.oroculos-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid #e5dac9;
  background: #171814;
  color: #fff;
}

.oroculos-avatar {
  width: 42px;
  height: 42px;
  display: block;
  color: transparent;
  font-size: 0;
  line-height: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .24));
}

.oroculos-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.oroculos-title strong {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.oroculos-title span,
.oroculos-note,
.oroculos-meta {
  font-size: 11px;
  color: #746d61;
}

.oroculos-head .oroculos-title span,
.oroculos-head .oroculos-meta {
  color: #d8cdbb;
}

.oroculos-head-controls {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.oroculos-head-actions {
  display: flex;
  gap: 6px;
}

.oroculos-specialist {
  width: 148px;
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
  background: #24251f;
  color: #fff;
  padding: 5px 8px;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
}

.oroculos-dna-state {
  max-width: 148px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 4px 7px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 6px;
  color: #fff;
  background: rgba(255,255,255,.08);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.oroculos-dna-state[data-state="conversation_stale"],
.oroculos-dna-state[data-state="stale"] {
  color: #fff3cf;
  border-color: rgba(240, 178, 30, .45);
}

.oroculos-dna-state[data-state="absent"] {
  color: #ffd6d0;
  border-color: rgba(182, 76, 54, .5);
}

.oroculos-icon-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font-weight: 900;
}

.oroculos-icon-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.oroculos-body {
  display: grid;
  align-content: start;
  gap: 12px;
  overflow: auto;
  overflow-x: hidden;
  padding: 14px;
}

.oroculos-greeting {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #e5dac9;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  line-height: 1.45;
}

.oroculos-status {
  padding: 10px 12px;
  border: 1px solid #e5dac9;
  border-radius: 8px;
  background: #f8f0df;
  font-size: 12px;
  line-height: 1.4;
}

.oroculos-toast {
  padding: 10px 12px;
  border: 1px solid rgba(108, 141, 39, .35);
  border-radius: 8px;
  background: #f1f8e8;
  color: #31420f;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.oroculos-toast.error {
  border-color: rgba(167, 55, 45, .35);
  background: #fff0ed;
  color: #8a2e25;
}

.oroculos-status.error {
  border-color: rgba(167, 55, 45, .35);
  background: #fff0ed;
  color: #8a2e25;
}

.oroculos-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.oroculos-insights {
  display: grid;
  gap: 8px;
}

.oroculos-insight-intro {
  margin: 0;
  color: #4a443a;
  font-size: 12px;
  font-weight: 800;
}

.oroculos-insight {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid #e2d7c5;
  border-left: 4px solid #d49b16;
  border-radius: 8px;
  background: #fff;
}

.oroculos-insight.severity-high {
  border-left-color: #b64c36;
}

.oroculos-insight.severity-low {
  border-left-color: #6c8d27;
}

.oroculos-insight strong {
  font-size: 12px;
}

.oroculos-insight p,
.oroculos-insight small {
  margin: 0;
  color: #5c554b;
  font-size: 12px;
  line-height: 1.4;
}

.oroculos-insight-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.oroculos-chip {
  min-height: 30px;
  padding: 7px 9px;
  border: 1px solid #ded2bf;
  border-radius: 999px;
  background: #fff;
  color: #171814;
  font-size: 12px;
  font-weight: 700;
}

.oroculos-messages {
  display: grid;
  gap: 10px;
}

.oroculos-message {
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid #e2d7c5;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.oroculos-message.user {
  margin-left: 28px;
  background: #171814;
  color: #fff;
}

.oroculos-message.assistant {
  margin-right: 18px;
}

.oroculos-section {
  display: grid;
  gap: 5px;
  padding-top: 7px;
  border-top: 1px solid #eee5d8;
}

.oroculos-section p,
.oroculos-opening {
  margin: 0;
}

.oroculos-section strong {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.oroculos-section ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 16px;
}

.oroculos-next-action {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(212, 155, 22, .32);
  border-radius: 8px;
  background: #fff8e8;
}

.oroculos-next-action strong,
.oroculos-details summary {
  font-size: 12px;
  font-weight: 900;
}

.oroculos-next-action p {
  margin: 0;
}

.oroculos-details {
  border-top: 1px solid #eee5d8;
  padding-top: 7px;
}

.oroculos-details summary {
  cursor: pointer;
  color: #3d382f;
}

.oroculos-details ul {
  display: grid;
  gap: 4px;
  margin: 7px 0 0;
  padding-left: 16px;
}

.oroculos-source {
  display: grid;
  gap: 2px;
  padding: 6px 0;
}

.oroculos-source code {
  color: #8a6b18;
  font-size: 11px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.oroculos-message.assistant,
.oroculos-greeting,
.oroculos-opening,
.oroculos-section p,
.oroculos-section li,
.oroculos-next-action p,
.oroculos-details,
.oroculos-note {
  font-family: var(--oroculos-human);
}

.oroculos-message.assistant {
  font-size: 13.5px;
}

.oroculos-advisor-context {
  display: grid;
  gap: 7px;
  margin-top: 7px;
}

.oroculos-advisor-context p {
  margin: 0;
}

.oroculos-compose {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e5dac9;
  background: #fbf8f1;
}

.oroculos-compose textarea,
.oroculos-access input,
.oroculos-settings input,
.oroculos-settings textarea {
  width: 100%;
  border: 1px solid #d8cdbb;
  border-radius: 8px;
  background: #fff;
  color: #171814;
  padding: 9px 10px;
  font: inherit;
  font-size: 13px;
}

.oroculos-compose textarea {
  min-height: 70px;
  resize: vertical;
  max-height: 170px;
}

.oroculos-actions {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
}

.oroculos-primary,
.oroculos-secondary,
.oroculos-link-btn {
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
}

.oroculos-primary {
  background: #171814;
  color: #fff;
}

.oroculos-secondary {
  border: 1px solid #d8cdbb;
  background: #fff;
  color: #171814;
}

.oroculos-link-btn {
  border: 0;
  background: transparent;
  color: #5d4612;
  padding-inline: 4px;
}

.oroculos-primary:disabled,
.oroculos-secondary:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.oroculos-settings {
  display: none;
  gap: 8px;
  padding: 12px;
  border: 1px solid #e5dac9;
  border-radius: 8px;
  background: #fff;
}

.oroculos-root.settings .oroculos-settings {
  display: grid;
}

.oroculos-access {
  display: grid;
  gap: 8px;
}

.oroculos-access.activated {
  display: none;
}

.oroculos-message.loading {
  color: #4f493f;
  background: #f8f0df;
}

.oroculos-message.error {
  border-color: rgba(182, 76, 54, .35);
  background: #fff0ed;
  color: #8a2e25;
}

.oroculos-processing-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
}

.oroculos-processing-avatar {
  width: 34px;
  height: 34px;
  display: block;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  animation: oroculosMascotPulse 1.8s ease-in-out infinite;
}

.oroculos-processing-content {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.oroculos-processing-phrase,
.oroculos-processing-time {
  margin: 0;
}

.oroculos-processing-phrase {
  font-weight: 800;
}

.oroculos-processing-time {
  color: #746d61;
  font-size: 11px;
}

.oroculos-thinking-dots {
  display: inline-flex;
  gap: 4px;
  height: 8px;
  align-items: center;
}

.oroculos-thinking-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #d49b16;
  animation: oroculosDot 1.15s ease-in-out infinite;
}

.oroculos-thinking-dots i:nth-child(2) {
  animation-delay: .14s;
}

.oroculos-thinking-dots i:nth-child(3) {
  animation-delay: .28s;
}

.oroculos-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes oroculosPanelIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes oroculosMascotPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.045); }
}

@keyframes oroculosMascotFloat {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -4px; }
}

@keyframes oroculosExpressionPop {
  0% { opacity: .72; transform: translateY(-2px) scale(.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes oroculosOrbit {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes oroculosDot {
  0%, 80%, 100% { transform: translateY(0); opacity: .45; }
  40% { transform: translateY(-3px); opacity: 1; }
}

@media (max-width: 620px) {
  .oroculos-root {
    right: 14px;
    bottom: calc(14px + var(--oroculos-bottom-offset, 0px));
  }

  .oroculos-toggle {
    width: 60px;
    height: 60px;
    border-radius: 16px;
  }

  .oroculos-panel {
    position: fixed;
    right: 8px;
    left: 8px;
    bottom: 64px;
    width: auto;
    max-height: calc(100vh - 92px);
  }

  .oroculos-head {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .oroculos-head-controls {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: minmax(0, 1fr) auto;
    justify-items: stretch;
  }

  .oroculos-specialist,
  .oroculos-dna-state {
    width: 100%;
    max-width: none;
  }

  .oroculos-message.user,
  .oroculos-message.assistant {
    margin-left: 0;
    margin-right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .oroculos-root *,
  .oroculos-root *::before,
  .oroculos-root *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }

  .oroculos-toggle:hover,
  .oroculos-toggle:focus-visible {
    transform: none;
  }

  .oroculos-mascot--thinking .oroculos-mascot-orbit {
    opacity: .6;
  }
}
