/* IA Corporativa — UVA e Unijorge — LibreChat v0.8.7.
   Complemento do tema de login v5. Nao altera os estilos da autenticacao.
   Cores derivadas da imagem fornecida; nao substituem o manual de marca.
   Seletores conferidos nos componentes da tag v0.8.7. */
body:not(:has(.w-authPageWidth)) {
  --ies-blue: #004b78;
  --ies-blue-hover: #003b60;
  --ies-yellow: #ffcf04;
  --ies-red: #df101c;
  --presentation: #ffffff;
  --header-primary: #ffffff;
  --header-hover: #edf3f8;
  --header-button-hover: #edf3f8;
  --surface-primary: #ffffff;
  --surface-primary-alt: #f4f7fb;
  --surface-primary-contrast: #edf3f8;
  --surface-secondary: #eef3f8;
  --surface-secondary-alt: #e4edf5;
  --surface-tertiary: #e6eef5;
  --surface-tertiary-alt: #ffffff;
  --surface-dialog: #ffffff;
  --surface-chat: #f2f6fa;
  --surface-active: #e4edf5;
  --surface-active-alt: #dce9f3;
  --surface-hover: #eaf1f7;
  --surface-hover-alt: #dce9f3;
  --surface-submit: var(--ies-blue);
  --surface-submit-hover: var(--ies-blue-hover);
  --text-primary: #1b334a;
  --text-secondary: #425d73;
  --text-secondary-alt: #526a7f;
  --text-tertiary: #587085;
  --border-light: #d9e4ed;
  --border-medium: #bdcfdc;
  --border-medium-alt: #bdcfdc;
  --border-heavy: #8aa6bb;
  --border-xheavy: #526f84;
  --ring-primary: #00649b;
}

html.dark body:not(:has(.w-authPageWidth)) {
  --presentation: #102134;
  --header-primary: #102134;
  --header-hover: #203b53;
  --header-button-hover: #203b53;
  --surface-primary: #102134;
  --surface-primary-alt: #132a40;
  --surface-primary-contrast: #1c374e;
  --surface-secondary: #193247;
  --surface-secondary-alt: #25445c;
  --surface-tertiary: #25445c;
  --surface-tertiary-alt: #193247;
  --surface-dialog: #162d43;
  --surface-chat: #193247;
  --surface-active: #25445c;
  --surface-active-alt: #2c4e67;
  --surface-hover: #25445c;
  --surface-hover-alt: #2c4e67;
  --surface-submit: #00649b;
  --surface-submit-hover: #0875ae;
  --text-primary: #edf5fc;
  --text-secondary: #c3d4e4;
  --text-secondary-alt: #afc6d9;
  --text-tertiary: #9bb7cd;
  --border-light: #2c485f;
  --border-medium: #43627a;
  --border-medium-alt: #43627a;
  --border-heavy: #6a8ba5;
  --border-xheavy: #9bb7cd;
  --ring-primary: #8ecfff;
}

/* UnifiedSidebar: aside no desktop; drawer fixo no celular.
   O requisito nav-panel evita atingir paineis de citacoes e ferramentas. */
body:not(:has(.w-authPageWidth)) :is(aside, div.fixed.left-0.top-0):has([data-testid^="nav-panel-"]) {
  --presentation: #004b78;
  --surface-primary: #004b78;
  --surface-primary-alt: #004b78;
  --surface-primary-contrast: #165d88;
  --surface-secondary: #00446e;
  --surface-secondary-alt: #165d88;
  --surface-tertiary: #165d88;
  --surface-tertiary-alt: #00446e;
  --surface-chat: #004b78;
  --surface-active: #165d88;
  --surface-active-alt: #1b638f;
  --surface-hover: #165d88;
  --surface-hover-alt: #1b638f;
  --text-primary: #ffffff;
  --text-secondary: #e0edf7;
  --text-secondary-alt: #d2e6f5;
  --text-tertiary: #c4ddf0;
  --text-destructive: #ffc1c7;
  --border-light: #37759c;
  --border-medium: #6090af;
  --border-medium-alt: #6090af;
  --border-heavy: #9bbdd4;
  --ring-primary: var(--ies-yellow);
  color: var(--text-primary);
  background-color: #004b78;
}

html.dark body:not(:has(.w-authPageWidth)) :is(aside, div.fixed.left-0.top-0):has([data-testid^="nav-panel-"]) {
  --presentation: #073654;
  --surface-primary: #073654;
  --surface-primary-alt: #073654;
  --surface-secondary: #082f49;
  --surface-secondary-alt: #174c6c;
  --surface-tertiary: #174c6c;
  --surface-tertiary-alt: #082f49;
  --surface-active: #174c6c;
  --surface-active-alt: #20597a;
  --surface-hover: #174c6c;
  --surface-hover-alt: #20597a;
  background-color: #073654;
}

/* Placa decorativa acima do conteudo nativo: o padding reserva espaco,
   sem inserir elementos no DOM gerenciado pelo React. */
body:not(:has(.w-authPageWidth)) :is(aside, div.fixed.left-0.top-0):has([data-testid^="nav-panel-"]) nav {
  position: relative;
  box-sizing: border-box;
  padding-top: 92px;
  border-right: 1px solid var(--border-light);
}
body:not(:has(.w-authPageWidth)) :is(aside, div.fixed.left-0.top-0):has([data-testid^="nav-panel-"]) nav::before {
  content: '';
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  height: 68px;
  box-sizing: border-box;
  border: 1px solid #dae5ee;
  border-top: 3px solid var(--ies-yellow);
  border-bottom: 3px solid var(--ies-red);
  border-radius: 12px;
  background: #ffffff url('./logo.svg') center 11px / min(200px, calc(100% - 24px)) auto no-repeat;
  pointer-events: none;
}
body:not(:has(.w-authPageWidth)) :is(aside, div.fixed.left-0.top-0):has([data-testid^="nav-panel-"]) nav::after {
  content: 'IA Corporativa';
  position: absolute;
  top: 58px;
  left: 12px;
  right: 12px;
  color: #004b78;
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  line-height: 14px;
  text-align: center;
  pointer-events: none;
}

body:not(:has(.w-authPageWidth)) :is(aside, div.fixed.left-0.top-0):has([data-testid^="nav-panel-"]) :is([aria-current="page"], [data-testid^="nav-panel-"][aria-pressed="true"]) {
  box-shadow: inset 3px 0 0 var(--ies-yellow);
}

/* Envio: mantem o estado desabilitado e o icone legivel nos dois temas. */
body:not(:has(.w-authPageWidth)) button[data-testid="send-button"] {
  background-color: var(--surface-submit);
  color: #ffffff;
  box-shadow: 0 3px 12px rgb(0 75 120 / 14%);
}
body:not(:has(.w-authPageWidth)) button[data-testid="send-button"] svg {
  color: #ffffff;
}
body:not(:has(.w-authPageWidth)) button[data-testid="send-button"]:hover:not(:disabled) {
  background-color: var(--surface-submit-hover);
}
body:not(:has(.w-authPageWidth)) button[data-testid="send-button"]:disabled {
  opacity: .4;
  box-shadow: none;
}

/* Nao sobrescreve o realce violeta usado em conversas temporarias. */
body:not(:has(.w-authPageWidth)) div.rounded-t-3xl:has(textarea[data-testid="text-input"]):not([class*="border-violet-"]) {
  border-color: var(--border-medium);
  box-shadow: 0 6px 24px rgb(0 75 120 / 7%);
}
body:not(:has(.w-authPageWidth)) div.rounded-t-3xl:has(textarea[data-testid="text-input"]):not([class*="border-violet-"]):focus-within {
  border-color: var(--ring-primary);
  box-shadow: 0 0 0 2px rgb(0 100 155 / 15%), 0 6px 24px rgb(0 75 120 / 7%);
}
body:not(:has(.w-authPageWidth)) :is(button, a, input, textarea):focus-visible {
  outline: 2px solid var(--ring-primary);
  outline-offset: 3px;
}
body:not(:has(.w-authPageWidth)) :is(aside, div.fixed.left-0.top-0):has([data-testid^="nav-panel-"]) :is(button, a, input):focus-visible {
  outline-color: var(--ies-yellow);
}

@media (max-width: 767px) {
  body:not(:has(.w-authPageWidth)) textarea[data-testid="text-input"] {
    font-size: max(16px, 1em);
  }
}

/* Preserva as cores do sistema em modo de alto contraste. */
@media (forced-colors: active) {
  body:not(:has(.w-authPageWidth)) :is(aside, div.fixed.left-0.top-0):has([data-testid^="nav-panel-"]) {
    background: Canvas;
    color: CanvasText;
  }
  body:not(:has(.w-authPageWidth)) button[data-testid="send-button"] {
    background: ButtonFace;
    color: ButtonText;
    border: 1px solid ButtonText;
    box-shadow: none;
  }
  body:not(:has(.w-authPageWidth)) button[data-testid="send-button"] svg {
    color: ButtonText;
  }
  body:not(:has(.w-authPageWidth)) :is(aside, div.fixed.left-0.top-0):has([data-testid^="nav-panel-"]) :is([aria-current="page"], [data-testid^="nav-panel-"][aria-pressed="true"]) {
    outline: 2px solid Highlight;
    outline-offset: -2px;
  }
}


/* Correcao v7: campos nos paineis azuis precisam definir fundo E texto.
   defaultTextProps do LibreChat usa focus:bg-gray-50; o texto herdado
   da navegacao era branco. Mantem labels claros fora dos campos. */
body:not(:has(.w-authPageWidth)) :is(aside, div.fixed.left-0.top-0):has([data-testid^="nav-panel-"]) {
  --ies-field-background: #ffffff;
  --ies-field-text: #1b334a;
  --ies-field-secondary: #425d73;
  --ies-field-placeholder: #526a7f;
  --ies-field-border: #bdcfdc;
  --ies-field-color-scheme: light;
}
html.dark body:not(:has(.w-authPageWidth)) :is(aside, div.fixed.left-0.top-0):has([data-testid^="nav-panel-"]) {
  --ies-field-background: #162d43;
  --ies-field-text: #edf5fc;
  --ies-field-secondary: #c3d4e4;
  --ies-field-placeholder: #afc6d9;
  --ies-field-border: #6a8ba5;
  --ies-field-color-scheme: dark;
}

/* Exclui os controles que nao sao caixas de entrada. */
body:not(:has(.w-authPageWidth)) :is(aside, div.fixed.left-0.top-0):has([data-testid^="nav-panel-"])
  :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="hidden"], [type="button"], [type="submit"], [type="reset"], [type="image"]), textarea, select, [contenteditable="true"], [role="combobox"]) {
  --text-primary: var(--ies-field-text);
  --text-secondary: var(--ies-field-secondary);
  --text-secondary-alt: var(--ies-field-placeholder);
  --text-tertiary: var(--ies-field-placeholder);
  --surface-primary: var(--ies-field-background);
  --surface-secondary: var(--ies-field-background);
  --surface-tertiary: var(--ies-field-background);
  background-color: var(--ies-field-background);
  color: var(--ies-field-text);
  caret-color: var(--ies-field-text);
  -webkit-text-fill-color: currentColor;
  color-scheme: var(--ies-field-color-scheme);
}
body:not(:has(.w-authPageWidth)) :is(aside, div.fixed.left-0.top-0):has([data-testid^="nav-panel-"])
  :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="hidden"], [type="button"], [type="submit"], [type="reset"], [type="image"]), textarea, select, [contenteditable="true"], [role="combobox"]):not([aria-invalid="true"]) {
  border-color: var(--ies-field-border);
}
body:not(:has(.w-authPageWidth)) :is(aside, div.fixed.left-0.top-0):has([data-testid^="nav-panel-"])
  :is(input, textarea)::placeholder {
  color: var(--ies-field-placeholder);
  -webkit-text-fill-color: currentColor;
  opacity: 1;
}
body:not(:has(.w-authPageWidth)) :is(aside, div.fixed.left-0.top-0):has([data-testid^="nav-panel-"]) select option {
  background-color: var(--ies-field-background);
  color: var(--ies-field-text);
}
body:not(:has(.w-authPageWidth)) :is(aside, div.fixed.left-0.top-0):has([data-testid^="nav-panel-"])
  :is(input, textarea, [contenteditable="true"])::selection {
  background-color: #004b78;
  color: #ffffff;
}

/* O preenchimento automatico do navegador pode aplicar suas proprias cores. */
body:not(:has(.w-authPageWidth)) :is(aside, div.fixed.left-0.top-0):has([data-testid^="nav-panel-"]) input:autofill {
  -webkit-text-fill-color: var(--ies-field-text);
  caret-color: var(--ies-field-text);
  box-shadow: 0 0 0 1000px var(--ies-field-background) inset;
}
@media (forced-colors: active) {
  body:not(:has(.w-authPageWidth)) :is(aside, div.fixed.left-0.top-0):has([data-testid^="nav-panel-"])
    :is(input, textarea, select, [contenteditable="true"], [role="combobox"]) {
    -webkit-text-fill-color: currentColor;
    box-shadow: none;
  }
}
