/* Pactum Workspace — тема портала в стиле pactum.kz (v0.5.4).
 * Подключается Caddy (replace-response: <link> перед </head> в HTML портала); бандлы LibreChat не меняются.
 * Опора — CSS-переменные дизайн-системы LibreChat (--surface-*, --text-*, --border-*) и устойчивые атрибуты
 * (id, aria-label, data-testid, role). Хеш-классы не используются. Что может «съехать» при обновлении LibreChat —
 * docs/BRANDING.md. Откат: убрать блок replace в Caddyfile (или вернуть образ caddy:2) — тема пропадёт целиком.
 * Палитра pactum.kz: dark #0b0e13, ink #1c2028, navy #122447, teal #068a99 / #035e5e, gold #f5b70a / #c8960a,
 * фон #faf9f6 / #f8f9fb, линии #e6e8ec. Шрифты: Inter (текст), Cormorant Garamond (заголовки). */
@import url("fonts.css");

/* ───────── палитра: светлая тема ───────── */
html:root {
  --pt-dark: #0b0e13; --pt-ink: #1c2028; --pt-navy: #122447; --pt-navy-d: #0c1a35;
  --pt-teal: #068a99; --pt-teal-d: #035e5e; --pt-gold: #f5b70a; --pt-gold-d: #c8960a;
  --pt-bg-w: #faf9f6; --pt-bg-s: #f8f9fb; --pt-line: #e6e8ec; --pt-text: #1a1c20; --pt-text-2: #6b7080;
  --pt-serif: "Cormorant Garamond", Georgia, serif;
  --pt-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --presentation: var(--pt-bg-w);
  --surface-primary: #ffffff;
  --surface-primary-alt: var(--pt-bg-s);
  --surface-primary-contrast: #f1f2f5;
  --surface-secondary: var(--pt-bg-s);
  --surface-secondary-alt: #eceef2;
  --surface-tertiary: #eef0f3;
  --surface-tertiary-alt: #ffffff;
  --surface-chat: #ffffff;
  --surface-dialog: #ffffff;
  --surface-hover: #eceef2;
  --surface-hover-alt: #e2e5ea;
  --surface-active: #e9ebef;
  --surface-active-alt: #dfe2e8;
  --surface-submit: var(--pt-navy);
  --surface-submit-hover: var(--pt-navy-d);
  --header-primary: #ffffff;
  --header-hover: var(--pt-bg-s);
  --header-button-hover: var(--pt-bg-s);
  --text-primary: var(--pt-text);
  --text-secondary: #3c414c;
  --text-secondary-alt: var(--pt-text-2);
  --text-tertiary: var(--pt-text-2);
  --border-light: var(--pt-line);
  --border-medium: #d9dce2;
  --border-medium-alt: #d9dce2;
  --border-heavy: #b9bec8;
  --border-xheavy: #9ba0ab;
  --ring-primary: var(--pt-teal);
  --brand-purple: var(--pt-teal);
  --radius: .25rem;
}

/* ───────── палитра: тёмная тема (как тёмные секции сайта) ───────── */
html.dark {
  --presentation: #0f1319;
  --surface-primary: var(--pt-dark);
  --surface-primary-alt: #10141b;
  --surface-primary-contrast: #141922;
  --surface-secondary: #12161e;
  --surface-secondary-alt: #171c25;
  --surface-tertiary: var(--pt-ink);
  --surface-tertiary-alt: var(--pt-ink);
  --surface-chat: var(--pt-ink);
  --surface-dialog: #141922;
  --surface-hover: #222833;
  --surface-hover-alt: #2a313d;
  --surface-active: #2a313d;
  --surface-active-alt: #222833;
  --surface-submit: var(--pt-teal);
  --surface-submit-hover: var(--pt-teal-d);
  --header-primary: #12161e;
  --header-hover: #1c2028;
  --header-button-hover: #1c2028;
  --text-primary: #ece9e1;
  --text-secondary: #c9ccd3;
  --text-secondary-alt: #9ba0ab;
  --text-tertiary: #9ba0ab;
  --border-light: rgba(255, 255, 255, .08);
  --border-medium: rgba(255, 255, 255, .12);
  --border-medium-alt: rgba(255, 255, 255, .12);
  --border-heavy: rgba(255, 255, 255, .18);
  --border-xheavy: rgba(255, 255, 255, .25);
  --ring-primary: var(--pt-gold);
  --brand-purple: var(--pt-gold);
}
html.dark { background-color: var(--pt-dark); }

/* ───────── шрифты ───────── */
body, button, input, textarea, select { font-family: var(--pt-sans); }
.markdown, .prose { font-family: var(--pt-sans); }
.markdown h1, .markdown h2, .prose h1, .prose h2 { font-family: var(--pt-serif); font-weight: 600; letter-spacing: .005em; }
.markdown a, .prose a { color: var(--pt-teal); text-decoration-color: rgba(6, 138, 153, .35); text-underline-offset: 2px; }
html.dark .markdown a, html.dark .prose a { color: var(--pt-gold); text-decoration-color: rgba(245, 183, 10, .35); }
::selection { background: rgba(245, 183, 10, .28); }

/* ───────── страница входа и регистрации ───────── */
#root > div.min-h-screen:has(form[aria-label="Login form"]),
#root > div.min-h-screen:has(form[method="POST"] input#email) {
  background:
    linear-gradient(90deg, transparent calc(50% - .5px), rgba(200, 168, 78, .10) 50%, transparent calc(50% + .5px)),
    radial-gradient(1200px 600px at 85% -10%, rgba(18, 36, 71, .9), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(6, 138, 153, .18), transparent 60%),
    var(--pt-dark) !important;
  color: #fff;
}
/* карточка формы */
#root div:has(> form[aria-label="Login form"]) {
  background: var(--pt-bg-w) !important;
  border-top: 3px solid var(--pt-gold);
  border-radius: 3px !important;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
  padding: 40px 36px 32px !important;
  position: relative;
}
#root div:has(> form[aria-label="Login form"])::before {
  content: "PACTUM WORKSPACE";
  display: block;
  font: 600 11px/1 var(--pt-sans);
  letter-spacing: .22em;
  color: var(--pt-gold-d);
  padding-left: 40px;
  margin-bottom: 18px;
  background: linear-gradient(var(--pt-gold), var(--pt-gold)) left center / 28px 1px no-repeat;
}
#root div:has(> form[aria-label="Login form"]) > h1 {
  font-family: var(--pt-serif) !important;
  font-weight: 500 !important;
  font-size: 2.4rem !important;
  line-height: 1.1;
  color: var(--pt-dark) !important;
  text-align: left !important;
}
#root div:has(> form[aria-label="Login form"]) > h1::after {
  content: "Юридический ассистент Pactum Group";
  display: block;
  margin-top: 10px;
  font: italic 400 1.15rem/1.3 var(--pt-serif);
  color: var(--pt-teal-d);
}
form[aria-label="Login form"] input {
  border-radius: 3px !important;
  background: #fff !important;
  color: var(--pt-text) !important;
  border-color: #d9dce2 !important;
}
form[aria-label="Login form"] input:focus { border-color: var(--pt-teal) !important; box-shadow: 0 0 0 3px rgba(6, 138, 153, .15) !important; }
form[aria-label="Login form"] label { background: #fff !important; color: var(--pt-text-2) !important; }
[data-testid="login-button"] {
  background: var(--pt-gold) !important;
  color: var(--pt-dark) !important;
  border-radius: 2px !important;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 600 !important;
  font-size: 12px !important;
  height: 50px !important;
  transition: background .2s;
}
[data-testid="login-button"]:hover { background: var(--pt-gold-d) !important; }
/* «Or» и кнопка Google — контурная, как вторичная кнопка сайта */
#root div:has(> form[aria-label="Login form"]) a[data-testid="google"] {
  border-radius: 2px !important;
  background: transparent !important;
  border-color: #c9ccd3 !important;
  color: var(--pt-text) !important;
}
#root div:has(> form[aria-label="Login form"]) a[href*="forgot-password"],
#root div:has(> form[aria-label="Login form"]) a[href*="register"] { color: var(--pt-teal) !important; }
/* логотип над формой — светлый текст на тёмном фоне */
#root > div.min-h-screen:has(form[aria-label="Login form"]) > div:first-child img { filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .4)); }
/* служебные надписи внизу (тема, ссылки) — читаемы на тёмном фоне */
#root > div.min-h-screen:has(form[aria-label="Login form"]) [role="contentinfo"],
#root > div.min-h-screen:has(form[aria-label="Login form"]) [role="contentinfo"] a { color: rgba(255, 255, 255, .6) !important; }
#root > div.min-h-screen:has(form[aria-label="Login form"]) button[aria-label*="theme"] { color: rgba(255, 255, 255, .7); }
#root > div.min-h-screen:has(form[aria-label="Login form"]) div.absolute.bottom-0 div { background: transparent !important; }
@media (max-width: 640px) {
  #root div:has(> form[aria-label="Login form"]) { margin: 0 12px; padding: 28px 20px 24px !important; }
  #root div:has(> form[aria-label="Login form"]) > h1 { font-size: 2rem !important; }
}
/* разделитель «Or» → «или», фон в тон карточке (Tailwind-утилиты relative/absolute — не хеш-классы) */
#root div:has(> form[aria-label="Login form"]) > div.relative > div.absolute {
  background: var(--pt-bg-w) !important; color: transparent !important; font-size: 0 !important; padding: 0 10px !important;
}
#root div:has(> form[aria-label="Login form"]) > div.relative > div.absolute::after {
  content: "или"; font: 500 11px/1 var(--pt-sans); letter-spacing: .14em; text-transform: uppercase; color: var(--pt-text-2);
}
#root div:has(> form[aria-label="Login form"]) > div.relative { border-color: var(--pt-line) !important; }

/* ───────── боковая панель: navy (светлая тема) / почти чёрная (тёмная) — переменные LibreChat в её области ───────── */
html:not(.dark) [data-testid="nav"] {
  --surface-primary-alt: var(--pt-navy);
  --surface-primary: var(--pt-navy);
  --surface-secondary: #1a2f58;
  --surface-hover: rgba(255, 255, 255, .08);
  --surface-hover-alt: rgba(255, 255, 255, .12);
  --surface-active: rgba(255, 255, 255, .12);
  --surface-active-alt: rgba(255, 255, 255, .12);
  --surface-tertiary: rgba(255, 255, 255, .08);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, .72);
  --text-secondary-alt: rgba(255, 255, 255, .6);
  --text-tertiary: rgba(255, 255, 255, .55);
  --border-light: rgba(255, 255, 255, .12);
  --border-medium: rgba(255, 255, 255, .18);
  --ring-primary: var(--pt-gold);
  color: #fff;
}
html.dark [data-testid="nav"] { --surface-primary-alt: #080a0e; --surface-primary: #080a0e; }
[data-testid="nav"] { border-right: 1px solid var(--border-light); }
/* золотая черта сверху панели — как линии на pactum.kz */
[data-testid="nav"] > * { position: relative; }
[data-testid="nav"]::before {
  content: ""; display: block; height: 3px;
  background: linear-gradient(90deg, var(--pt-gold) 0 48px, transparent 48px);
}
/* выбранная беседа — золотая метка слева */
[data-testid="nav"] [data-testid="convo-item"][aria-current="page"],
[data-testid="nav"] [data-testid="convo-item"].bg-surface-active-alt { box-shadow: inset 2px 0 0 var(--pt-gold); }
/* всплывающие меню внутри панели (аккаунт) — обычные цвета, не navy */
html:not(.dark) [data-testid="nav"] .popover-ui,
html:not(.dark) [data-testid="nav"] [role="listbox"],
html:not(.dark) [data-testid="nav"] [role="menu"] {
  --surface-primary: #ffffff; --surface-secondary: var(--pt-bg-s); --surface-hover: #eceef2; --surface-active: #e9ebef;
  --text-primary: var(--pt-text); --text-secondary: #3c414c; --border-light: var(--pt-line);
  color: var(--pt-text);
}

/* ───────── стартовый экран ───────── */
/* приветствие — Cormorant Garamond, как заголовки сайта; над ним — золотая подпись */
main :has(> span.will-change-transform) {
  font-family: var(--pt-serif) !important;
  font-weight: 500 !important;
  font-size: 2.7rem !important;
  letter-spacing: .005em;
  color: var(--pt-navy);
}
html.dark main :has(> span.will-change-transform) { color: #f3efe4; }

/* ───────── шапка, кнопка выбора модели ───────── */
button[aria-label="Выберите модель"] {
  border-radius: 3px !important;
  border-color: var(--border-medium) !important;
  font-weight: 600;
}
button[aria-label="Выберите модель"]:hover { border-color: var(--pt-gold) !important; }

/* ───────── поле ввода и отправка ───────── */
#root form:has(textarea) [class*="rounded-3xl"] {
  border-radius: 6px !important;
  border-color: var(--border-medium) !important;
  box-shadow: 0 1px 0 rgba(11, 14, 19, .04), 0 8px 24px rgba(18, 36, 71, .06) !important;
}
#root form:has(textarea) [class*="rounded-3xl"]:focus-within {
  border-color: var(--pt-gold) !important;
  box-shadow: 0 0 0 3px rgba(245, 183, 10, .15) !important;
}
button[data-testid="send-button"]:not(:disabled) {
  background: var(--pt-gold) !important;
  color: var(--pt-dark) !important;
}
button[data-testid="send-button"]:not(:disabled):hover { background: var(--pt-gold-d) !important; }
button[data-testid="send-button"] { border-radius: 4px !important; }

/* ───────── сообщения ───────── */
.markdown table th, .prose table th { background: var(--pt-bg-s); }
html.dark .markdown table th, html.dark .prose table th { background: #141922; }
.markdown blockquote, .prose blockquote { border-left-color: var(--pt-gold) !important; }

/* ───────── подвал ───────── */
[role="contentinfo"] a { color: var(--pt-teal) !important; }
html.dark [role="contentinfo"] a { color: var(--pt-gold) !important; }

/* ───────── меню моделей ───────── */
[role="menu"], [role="listbox"], .popover-ui { border-radius: 4px !important; }
[role="menuitem"][aria-checked="true"], [role="option"][aria-selected="true"] { box-shadow: inset 2px 0 0 var(--pt-gold); }

/* ───────── телефон: шапка navy с подписью вместо английского «New Chat» ───────── */
div:has(> button[data-testid="mobile-header-new-chat-button"]) {
  background: var(--pt-navy) !important;
  color: #fff !important;
  border-bottom: 2px solid var(--pt-gold);
}
html.dark div:has(> button[data-testid="mobile-header-new-chat-button"]) { background: #080a0e !important; }
div:has(> button[data-testid="mobile-header-new-chat-button"]) button { color: #fff !important; }
div:has(> button[data-testid="mobile-header-new-chat-button"]) > h1 { font-size: 0 !important; }
div:has(> button[data-testid="mobile-header-new-chat-button"]) > h1::after {
  content: "PACTUM WORKSPACE"; font: 600 11px/1 var(--pt-sans); letter-spacing: .22em; color: var(--pt-gold);
}
@media (max-width: 767px) {
  main :has(> span.will-change-transform) { font-size: 2.1rem !important; }
}
/* поля входа в тёмной теме: LibreChat заливает их через inset box-shadow (.webkit-dark-styles) */
html form[aria-label="Login form"] input,
html form[aria-label="Login form"] input:-webkit-autofill {
  -webkit-box-shadow: inset 0 0 0 1000px #fff !important;
  box-shadow: inset 0 0 0 1000px #fff !important;
  -webkit-text-fill-color: var(--pt-text) !important;
  caret-color: var(--pt-text);
}
html form[aria-label="Login form"] input:focus {
  -webkit-box-shadow: inset 0 0 0 1000px #fff, 0 0 0 3px rgba(6, 138, 153, .15) !important;
  box-shadow: inset 0 0 0 1000px #fff, 0 0 0 3px rgba(6, 138, 153, .15) !important;
}

/* ═════════════════════════ v0.6.0 (03.10.2026): внутренние экраны до уровня страницы входа ═════════════════════════
 * Фон — как герой pactum.kz (.hero__bg: linear-gradient 160° #080a0f → #111520 → #171d2a → #0d1018 + блики
 * rgba(200,168,78,.07) и rgba(100,120,180,.06)), закреплён к окну (шапка и область сообщений — бесшовно), виньетка;
 * на входе и стартовом экране — приглушённая абстрактная текстура texture.svg (линии и дуги, без фото).
 * Тёмная тема — по умолчанию (pactum-ui.js), светлая — тёплый фон #faf9f6, акценты золото + navy.
 * Контраст (WCAG AA): текст #ece9e1 / #c9ccd3 на #111520–#171d2a ≥ 10:1; золото #f5b70a на тёмном ≥ 9:1; в светлой
 * теме золото только декоративное (линии, кнопки с тёмным текстом), ссылки — #035e5e (7,4:1), акцент — #876100 (5,0:1). */
html:root {
  --pt-hero: radial-gradient(80% 60% at 20% 80%, rgba(200, 168, 78, .07) 0%, transparent 50%),
             radial-gradient(60% 80% at 80% 20%, rgba(100, 120, 180, .06) 0%, transparent 50%),
             linear-gradient(160deg, #080a0f 0%, #111520 40%, #171d2a 70%, #0d1018 100%);
  --pt-vignette: radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(0, 0, 0, .35) 100%);
  --pt-warm: radial-gradient(70% 60% at 85% 0%, rgba(245, 183, 10, .06), transparent 60%),
             radial-gradient(60% 60% at 0% 100%, rgba(18, 36, 71, .05), transparent 60%),
             linear-gradient(180deg, #faf9f6 0%, #f6f3ec 100%);
  --pt-texture: url("texture.svg");
  --pt-accent-light: #876100;
}
html.dark {
  --presentation: #121722;
  --surface-primary: #10141d;
  --surface-primary-alt: #0d121b;
  --surface-primary-contrast: #161c28;
  --surface-secondary: #151b27;
  --surface-secondary-alt: #1a2130;
  --surface-tertiary: #1b2232;
  --surface-tertiary-alt: #1b2232;
  --surface-chat: #171d2a;
  --surface-dialog: #141a26;
  --surface-hover: #222a3a;
  --surface-hover-alt: #293245;
  --surface-active: #263047;
  --surface-active-alt: #222a3a;
  --header-primary: #121722;
  --header-hover: #1b2232;
  --header-button-hover: #1b2232;
  --text-primary: #ece9e1;
  --text-secondary: #c9ccd3;
  --text-secondary-alt: #a3a8b4;
  --text-tertiary: #a3a8b4;
  --border-light: rgba(255, 255, 255, .08);
  --border-medium: rgba(255, 255, 255, .14);
}
html.dark, html.dark body { background: #0d1018; }
html.dark #loading-container { background: #0d1018 !important; }

/* ───── фон основной области: герой сайта, закреплён к окну ───── */
html.dark .bg-presentation,
html.dark #root div:has(> div > #messages-view) {
  background: var(--pt-vignette), var(--pt-hero) !important;
  background-attachment: fixed !important;
}
html:not(.dark) .bg-presentation,
html:not(.dark) #root div:has(> div > #messages-view) {
  background: var(--pt-warm) !important;
  background-attachment: fixed !important;
}
/* стартовый экран — плюс текстура */
html.dark .bg-presentation:has(p.split-parent),
html.dark #root div:has(> div > #messages-view):has(p.split-parent) {
  background: var(--pt-texture) center / cover no-repeat, var(--pt-vignette), var(--pt-hero) !important;
  background-attachment: fixed !important;
}
html:not(.dark) .bg-presentation:has(p.split-parent),
html:not(.dark) #root div:has(> div > #messages-view):has(p.split-parent) {
  background: var(--pt-texture) center / cover no-repeat, var(--pt-warm) !important;
  background-attachment: fixed !important;
}
#messages-view, #messages-view main { background: transparent !important; }

/* ───── вход: тот же герой + текстура (карточка и прочее — как в v0.5.4) ───── */
#root > div.min-h-screen:has(form[aria-label="Login form"]),
#root > div.min-h-screen:has(form[method="POST"] input#email) {
  background:
    linear-gradient(90deg, transparent calc(50% - .5px), rgba(200, 168, 78, .10) 50%, transparent calc(50% + .5px)),
    var(--pt-texture) center / cover no-repeat,
    var(--pt-vignette), var(--pt-hero) !important;
  background-attachment: fixed !important;
}

/* ───── боковая панель: navy темнее основной области, белый логотип pactum ───── */
html.dark [data-testid="nav"] {
  --surface-primary-alt: #0a1022; --surface-primary: #0a1022;
  --surface-hover: rgba(255, 255, 255, .06); --surface-active-alt: rgba(255, 255, 255, .08);
  background: linear-gradient(180deg, #0c1530 0%, #0a1022 45%, #080d1b 100%) !important;
}
html:not(.dark) [data-testid="nav"] {
  background: linear-gradient(180deg, #16295a 0%, #122447 45%, #0e1d3a 100%) !important;
}
[data-testid="nav"] > div, [data-testid="nav"] nav { background: transparent !important; }
#chat-history-nav div:has(> button[data-testid="close-sidebar-button"]) { position: relative; }
#chat-history-nav div:has(> button[data-testid="close-sidebar-button"])::after {
  content: ""; position: absolute; left: 48px; top: 50%; transform: translateY(-50%);
  width: 92px; height: 27px; pointer-events: none;
  background: url("logo-white.svg") left center / contain no-repeat;
}
/* активная беседа — золотой маркер (LibreChat помечает её классом bg-surface-active-alt) */
[data-testid="nav"] [data-testid="convo-item"].bg-surface-active-alt,
[data-testid="nav"] [data-testid="convo-item"][aria-current="page"] {
  box-shadow: inset 3px 0 0 var(--pt-gold) !important;
  background: rgba(245, 183, 10, .08) !important;
}
[data-testid="nav"] [data-testid="convo-item"] { border-radius: 2px !important; }
/* «Сегодня», «Вчера» — мелкие заглавные с разрядкой, как подписи сайта */
[data-testid="nav"] div.text-text-secondary.pl-2 {
  font: 600 10.5px/1 var(--pt-sans); letter-spacing: .18em; text-transform: uppercase; color: rgba(245, 183, 10, .8) !important;
}

/* ───── стартовый экран: золотая линия + «PACTUM WORKSPACE», приветствие Cormorant, имя — курсивом золотом ───── */
div:has(> div > p.split-parent) { position: relative; }
div:has(> div > p.split-parent)::before {
  content: "PACTUM WORKSPACE";
  display: block; margin: 0 auto 22px; padding-left: 46px;
  font: 600 11px/1 var(--pt-sans); letter-spacing: .22em; color: var(--pt-gold);
  background: linear-gradient(var(--pt-gold), var(--pt-gold)) left center / 32px 1px no-repeat;
}
html:not(.dark) div:has(> div > p.split-parent)::before {
  color: var(--pt-accent-light);
  background-image: linear-gradient(var(--pt-gold-d), var(--pt-gold-d));
}
div:has(> p.split-parent) > :not(p) { display: none !important; }      /* иконка модели у приветствия — как на сайте, без неё */
p.split-parent {
  font-family: var(--pt-serif) !important; font-weight: 300 !important;
  font-size: clamp(2.2rem, 4.2vw, 3.6rem) !important; line-height: 1.1 !important; letter-spacing: .005em;
  color: #ffffff !important;
}
html:not(.dark) p.split-parent { color: var(--pt-navy) !important; }
p.split-parent span { font-family: inherit !important; font-weight: inherit !important; }
p.split-parent span[data-pt-accent] { font-style: italic; color: var(--pt-gold) !important; }
html:not(.dark) p.split-parent span[data-pt-accent] { color: var(--pt-accent-light) !important; }
main :has(> span.will-change-transform) { font-size: inherit !important; font-weight: inherit !important; color: inherit !important; }
/* подсказка под приветствием */
div.animate-fadeIn.max-w-md { color: var(--text-secondary) !important; font-size: 14px !important; line-height: 1.6 !important; max-width: 34rem !important; }

/* ───── кнопка модели и вторичные — контурные, как «Изучить практики» ───── */
button[aria-label="Выберите модель"],
button[aria-label="Временный чат"] {
  background: transparent !important;
  border: 1px solid rgba(255, 255, 255, .22) !important;
  border-radius: 3px !important;
  color: rgba(255, 255, 255, .85) !important;
  text-transform: uppercase; letter-spacing: .1em; font-size: 11.5px !important; font-weight: 600 !important;
}
html:not(.dark) button[aria-label="Выберите модель"],
html:not(.dark) button[aria-label="Временный чат"] { border-color: rgba(18, 36, 71, .3) !important; color: var(--pt-navy) !important; }
button[aria-label="Выберите модель"]:hover, button[aria-label="Временный чат"]:hover { border-color: var(--pt-gold) !important; color: var(--pt-gold) !important; }
html:not(.dark) button[aria-label="Выберите модель"]:hover { color: var(--pt-navy) !important; }

/* ───── поле ввода: стекло на фоне героя; отправка — золотая ───── */
html.dark #root form:has(textarea) [class*="rounded-3xl"] {
  background: rgba(16, 20, 29, .72) !important; backdrop-filter: blur(6px);
  border-color: rgba(255, 255, 255, .14) !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .35) !important;
}
html:not(.dark) #root form:has(textarea) [class*="rounded-3xl"] { background: #ffffff !important; }
button[data-testid="send-button"] { background: rgba(245, 183, 10, .35) !important; color: #0b0e13 !important; border-radius: 3px !important; }
button[data-testid="send-button"]:not(:disabled) { background: var(--pt-gold) !important; color: #0b0e13 !important; }
button[data-testid="send-button"] svg { color: #0b0e13 !important; }

/* ───── ссылки и акценты — золото (в светлой теме — teal-d, золото декоративно) ───── */
html.dark a:not([data-testid]):not([role]) { text-decoration-color: rgba(245, 183, 10, .4); }
html.dark .markdown a, html.dark .prose a, html.dark [role="contentinfo"] a { color: var(--pt-gold) !important; }
html:not(.dark) .markdown a, html:not(.dark) .prose a { color: var(--pt-teal-d) !important; }

/* ───── сообщения: пузырь пользователя, код, таблицы — в тон фону ───── */
html.dark .markdown pre, html.dark .prose pre {
  background: #0b0e13 !important; border: 1px solid rgba(200, 168, 78, .16); border-radius: 3px;
}
html.dark .markdown :not(pre) > code, html.dark .prose :not(pre) > code {
  background: rgba(255, 255, 255, .07); color: #f3d27a; border-radius: 2px; padding: .1em .35em;
}
html:not(.dark) .markdown pre, html:not(.dark) .prose pre { border: 1px solid var(--pt-line); border-radius: 3px; }
.markdown table, .prose table { border-collapse: collapse; }
.markdown table th, .markdown table td, .prose table th, .prose table td { border: 1px solid var(--border-medium) !important; }
html.dark .markdown table th, html.dark .prose table th { background: rgba(18, 36, 71, .75) !important; color: #fff; }
html.dark .markdown table tr:nth-child(even) td, html.dark .prose table tr:nth-child(even) td { background: rgba(255, 255, 255, .025); }
html:not(.dark) .markdown table th, html:not(.dark) .prose table th { background: #eef1f6 !important; color: var(--pt-navy); }
.markdown h1, .markdown h2, .markdown h3, .prose h1, .prose h2, .prose h3 { font-family: var(--pt-serif); font-weight: 600; }
html.dark .markdown h1, html.dark .markdown h2, html.dark .prose h1, html.dark .prose h2 { color: #fff; }
html:not(.dark) .markdown h1, html:not(.dark) .markdown h2, html:not(.dark) .prose h1, html:not(.dark) .prose h2 { color: var(--pt-navy); }

/* ───── меню и диалоги — на тёмном navy-графите ───── */
html.dark [role="menu"], html.dark [role="listbox"], html.dark .popover-ui, html.dark [role="dialog"] {
  background: #141a26 !important; border: 1px solid rgba(255, 255, 255, .1) !important;
}

/* ───── телефон ───── */
html.dark div:has(> button[data-testid="mobile-header-new-chat-button"]) { background: #0a1022 !important; }
@media (max-width: 767px) {
  p.split-parent { font-size: 2.3rem !important; }
  div:has(> div > p.split-parent)::before { margin-bottom: 16px; }
  html.dark .bg-presentation, html.dark #root div:has(> div > #messages-view) { background-attachment: scroll !important; }
}

/* ───── шапка беседы (sticky, у LibreChat — bg-white / dark:bg-gray-800) — тот же закреплённый фон, бесшовно ───── */
html.dark div.sticky.top-0:has(button[aria-label="Выберите модель"]) {
  background: var(--pt-vignette), var(--pt-hero) !important; background-attachment: fixed !important;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
}
html:not(.dark) div.sticky.top-0:has(button[aria-label="Выберите модель"]) {
  background: var(--pt-warm) !important; background-attachment: fixed !important;
  border-bottom: 1px solid rgba(18, 36, 71, .06);
}
/* название беседы: затухание сплошным цветом не совпадает с градиентом панели → многоточие */
[data-testid="nav"] [data-testid="convo-item"] div.absolute.bg-gradient-to-l { display: none !important; }
[data-testid="nav"] [data-testid="convo-item"] div.relative.flex-1.overflow-hidden { text-overflow: ellipsis; }
/* логотип на входе — белый вордмарк, как в шапке pactum.kz */
#root > div.min-h-screen:has(form[aria-label="Login form"]) > div:first-child img { content: url("logo-white.svg"); display: block; height: 44px !important; width: 152px !important; max-width: 60vw; object-fit: contain; margin: 0 auto; }
