@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500&display=swap');

/* Minimal cream-and-brown J.Ai palette. */
:root {
  --gray-20: #faf8f5;
  --gray-50: #faf8f5;
  --gray-100: #f5f1eb;
  --gray-200: #e8e2d9;
  --gray-300: #d5cbbe;
  --gray-400: #a69582;
  --gray-500: #8b7355;
  --gray-600: #5c4a3a;
  --gray-700: #4a3f36;
  --gray-800: #3d3632;
  --gray-850: #2a2523;
  --gray-900: #231f1d;
  --brand-purple: #8b7355;
  --surface-submit: #8b7355;
  --surface-submit-hover: #5c4a3a;
}

html.light,
html.light body,
html.light #root {
  background-color: #faf8f5;
  color: #3d3632;
}

/* Condensed Playfair welcome with enough room for the J flourish. */
main .transform-gpu [class~="text-2xl"][class*="text-text-primary"] {
  width: min(90vw, 44rem);
  overflow: visible;
  padding: 0.14em clamp(1.5rem, 5vw, 4rem) 0.24em;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1.45rem, 2.4vw, 2rem) !important;
  font-weight: 400 !important;
  line-height: 1.22;
  letter-spacing: 0.012em;
  transform: scaleX(0.84);
  transform-origin: center;
}

/* Replace repeated personal identity with a restrained Admin marker. */
main .message-render:has(> .user-turn) > .relative.flex.flex-shrink-0 {
  display: flex;
}
main .message-render:has(> .user-turn) > .relative.flex.flex-shrink-0 > div {
  border: 1px solid rgba(139, 115, 85, 0.35);
  background: #8b7355;
}
main .message-render:has(> .user-turn) > .relative.flex.flex-shrink-0 > div > * {
  display: none;
}
main .message-render:has(> .user-turn) > .relative.flex.flex-shrink-0 > div::before {
  content: "";
  width: 0.875rem;
  height: 0.875rem;
  background: #faf8f5;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8Zm0 2c-4.42 0-8 2.24-8 5v1h16v-1c0-2.76-3.58-5-8-5Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8Zm0 2c-4.42 0-8 2.24-8 5v1h16v-1c0-2.76-3.58-5-8-5Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
main .message-render > .user-turn > h2 {
  font-size: 0 !important;
  font-weight: 400 !important;
  line-height: 1.25;
  color: #8b7355;
}
main .message-render > .user-turn > h2 > * {
  display: none;
}
main .message-render > .user-turn > h2::before {
  content: "Admin";
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.025em;
}

/* Softer, more legible chat rendering without slowing the stream. */
.message-content {
  font-weight: 400;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.message-content.submitting {
  animation: none !important;
}
@keyframes jai-stream-settle {
  from { opacity: 0.45; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  main .transform-gpu [class~="text-2xl"][class*="text-text-primary"] {
    width: 94vw;
    padding-inline: 1.25rem;
    transform: scaleX(0.9);
  }
}

@media (prefers-reduced-motion: reduce) {
  .message-content.submitting { animation: none; }
}
/* Keep Admin and J.Ai headers visually equal and understated. */
main .message-render > .agent-turn > h2 {
  font-size: 0 !important;
  font-weight: 400 !important;
  line-height: 1.25;
  color: #8b7355;
}
main .message-render > .agent-turn > h2 > * {
  display: none;
}
main .message-render > .agent-turn > h2::before {
  content: "J.Ai";
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.025em;
}
/* Quiet sidebar selection states: soft brown instead of a black outline. */
[aria-label="Control Panel"] button,
[aria-label="Control Panel"] a {
  outline-color: transparent !important;
}
[aria-label="Control Panel"] button:focus,
[aria-label="Control Panel"] button:focus-visible,
[aria-label="Control Panel"] a:focus,
[aria-label="Control Panel"] a:focus-visible {
  outline: 1px solid rgba(139, 115, 85, 0.38) !important;
  outline-offset: 1px !important;
  box-shadow: none !important;
}
[aria-label="Control Panel"] button[aria-pressed="true"],
[aria-label="Control Panel"] button[aria-expanded="true"] {
  border-color: rgba(139, 115, 85, 0.2) !important;
  box-shadow: none !important;
}
/* Remove LibreChat's black active-conversation rail and black keyboard ring. */
[data-testid="convo-item"]::before {
  content: none !important;
  display: none !important;
}
[data-testid="convo-item"]:focus-visible {
  outline: none !important;
  --tw-ring-color: transparent !important;
  box-shadow: none !important;
}
/* Admin avatar: lightweight outline to match the bot icon language. */
main .message-render:has(> .user-turn) > .relative.flex.flex-shrink-0 > div {
  border: 1px solid #8b7355;
  background: transparent;
}
main .message-render:has(> .user-turn) > .relative.flex.flex-shrink-0 > div::before {
  width: 1rem;
  height: 1rem;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b7355' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='3.25'/%3E%3Cpath d='M5.5 20c.45-3.9 2.8-6 6.5-6s6.05 2.1 6.5 6'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  -webkit-mask: none;
  mask: none;
}
/* Welcome typography: natural Playfair Display Regular 400. */
main .transform-gpu [class~="text-2xl"][class*="text-text-primary"] {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 400 !important;
  font-stretch: normal;
  letter-spacing: 0;
  transform: none;
}
@media (max-width: 640px) {
  main .transform-gpu [class~="text-2xl"][class*="text-text-primary"] {
    transform: none;
  }
}
/* Admin avatar: glyph only, no surrounding circle or background. */
main .message-render:has(> .user-turn) > .relative.flex.flex-shrink-0 > div {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
main .message-render:has(> .user-turn) > .relative.flex.flex-shrink-0 > div::before {
  width: 1.125rem;
  height: 1.125rem;
}

/* Give the outline bot the same visual weight as the Admin glyph. */
main .message-render:has(> .agent-turn) > .relative.flex.flex-shrink-0 > div {
  overflow: visible !important;
}
main .message-render:has(> .agent-turn) > .relative.flex.flex-shrink-0 > div > img,
main .message-render:has(> .agent-turn) > .relative.flex.flex-shrink-0 > div > svg {
  width: 1.25rem !important;
  height: 1.25rem !important;
  max-width: none !important;
  max-height: none !important;
}

/* Quiet assistant status: a small brown label instead of the large bouncing dot. */
@keyframes jai-thinking-breathe {
  0%, 100% { opacity: 0.72; }
  50% { opacity: 1; }
}
.submitting .result-thinking:empty:last-child::after {
  content: "Thinking";
  display: inline-block;
  position: static;
  width: auto;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: #8b7355;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.045em;
  line-height: 1.35;
  transform: none;
  animation: jai-thinking-breathe 2.8s ease-in-out infinite;
  will-change: opacity;
}
@media (prefers-reduced-motion: reduce) {
  .submitting .result-thinking:empty:last-child::after {
    animation: none;
    opacity: 0.86;
  }
}

/* Generated images: quiet editorial corners, never the default sharp rectangle. */
.message-content .markdown img,
.message-content .prose img {
  border-radius: 0.9rem !important;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(139, 115, 85, 0.12);
}
