/* ============================================================================
 * 7bits Brand Theme Override for LibreChat (Design System v2)
 * ============================================================================ */

@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/install-assets/golos-text-cyrillic-ext.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/install-assets/golos-text-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/install-assets/golos-text-latin-ext.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/install-assets/golos-text-latin.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root,
html {
  --sb-ink: #191730;
  --sb-muted: #48425f;
  --sb-bg: #ffffff;
  --sb-card: #f0f2ff;
  --sb-pale: #f0f2ff;
  --sb-pale-strong: #e4e1fc;
  --sb-line: #e2dff5;
  --sb-line-strong: #ccc6ee;
  --sb-brand: #816fee;
  --sb-brand-hover: #634edf;
  --sb-brand-active: #4d28df;
  --sb-brand-ink: #5643cc;
  --sb-ok: #0e7a3e;
  --sb-ok-bg: #e9f7ef;
  --sb-err: #c42535;
  --sb-err-bg: #fdecee;
  --sb-font-sans: "Golos Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;

  --accent-primary: 86 67 204 !important;
  --accent-primary-hover: 129 111 238 !important;
  --surface-submit: 129 111 238 !important;
  --surface-submit-hover: 99 78 223 !important;
  --green-50: 240 242 255 !important;
  --green-100: 228 225 252 !important;
  --green-200: 226 223 245 !important;
  --green-300: 204 198 238 !important;
  --green-400: 158 144 242 !important;
  --green-500: 129 111 238 !important;
  --green-600: 99 78 223 !important;
  --green-700: 86 67 204 !important;
  --green-800: 77 40 223 !important;
  --green-900: 54 36 140 !important;
  --brand-purple: 129 111 238 !important;
}

.dark,
html.dark {
  --sb-ink: #f3f2ff;
  --sb-muted: #b6b1cc;
  --sb-bg: #1e1d2b;
  --sb-card: #252438;
  --sb-pale: #2d2b45;
  --sb-pale-strong: #383556;
  --sb-line: #3a3754;
  --sb-line-strong: #4d496e;
  --sb-brand: #816fee;
  --sb-brand-hover: #9484f4;
  --sb-brand-active: #634edf;
  --sb-brand-ink: #c4baff;
  --sb-ok: #4ade80;
  --sb-ok-bg: #143322;
  --sb-err: #f87171;
  --sb-err-bg: #3b1920;

  --accent-primary: 196 186 255 !important;
  --accent-primary-hover: 148 132 244 !important;
  --surface-submit: 129 111 238 !important;
  --surface-submit-hover: 148 132 244 !important;
  --green-500: 148 132 244 !important;
  --green-600: 129 111 238 !important;
  --green-700: 99 78 223 !important;
}

html,
body {
  font-family: var(--sb-font-sans) !important;
}

.bg-surface-submit,
button[type="submit"].bg-surface-submit,
button.bg-green-500,
button.bg-green-600 {
  background: var(--sb-brand) !important;
  border-color: transparent !important;
  color: #ffffff !important;
  box-shadow: none !important;
  transition: background-color 0.16s ease !important;
}

.bg-surface-submit:hover,
.hover\:bg-surface-submit-hover:hover,
button[type="submit"].bg-surface-submit:hover,
button.bg-green-500:hover,
button.bg-green-600:hover {
  background: var(--sb-brand-hover) !important;
  box-shadow: none !important;
}

.bg-surface-submit:active,
button[type="submit"].bg-surface-submit:active,
button.bg-green-500:active,
button.bg-green-600:active {
  background: var(--sb-brand-active) !important;
}

.text-green-600,
.text-green-500,
.text-surface-submit,
.peer:focus ~ .peer-focus\:text-green-600,
.peer:focus ~ .peer-focus\:text-green-500 {
  color: var(--sb-brand-ink) !important;
}

.bg-green-100,
.bg-green-50 {
  background-color: var(--sb-pale) !important;
}

.border-green-500,
.border-green-600,
.focus\:border-green-500:focus,
.focus\:border-green-600:focus {
  border-color: var(--sb-brand) !important;
}

.ring-green-500,
.focus\:ring-green-500:focus {
  --tw-ring-color: rgba(129, 111, 238, 0.35) !important;
}

footer a,
[data-librechat-configured-footer] a {
  color: var(--sb-brand-ink) !important;
  font-weight: 600 !important;
}

/* Auth pages (/login, /register) aligned with @7bits/ui Card, Input, Button */
.w-authPageWidth {
  background-color: var(--sb-card) !important;
  border-radius: 28px !important;
  padding: 32px 28px !important;
  width: min(440px, calc(100vw - 32px)) !important;
  max-width: 440px !important;
  margin: 24px auto;
}

.w-authPageWidth h1 {
  color: var(--sb-ink) !important;
  font-weight: 700 !important;
  letter-spacing: -0.03em !important;
}

.w-authPageWidth p {
  color: var(--sb-muted);
}

.w-authPageWidth input:not([type="checkbox"]) {
  background-color: var(--sb-bg) !important;
  border-color: var(--sb-line) !important;
  color: var(--sb-ink) !important;
  border-radius: 16px !important;
}

.w-authPageWidth input:not([type="checkbox"]):hover {
  border-color: var(--sb-line-strong) !important;
}

.w-authPageWidth input:not([type="checkbox"]):focus,
.w-authPageWidth input:not([type="checkbox"]):focus-visible,
html[data-input-modality="pointer"] .w-authPageWidth .lc-field:focus {
  border-color: var(--sb-brand) !important;
  box-shadow: 0 0 0 3px rgba(129, 111, 238, 0.16) !important;
  outline: none !important;
}

.w-authPageWidth label.bg-surface-primary {
  background: transparent !important;
  color: var(--sb-muted) !important;
}

.w-authPageWidth .peer:focus ~ label.bg-surface-primary,
.w-authPageWidth .peer:not(:placeholder-shown) ~ label.bg-surface-primary {
  background: linear-gradient(180deg, var(--sb-card) 50%, var(--sb-bg) 50%) !important;
  border-radius: 4px;
}

.w-authPageWidth .peer:focus ~ label.bg-surface-primary {
  color: var(--sb-brand-ink) !important;
}

.w-authPageWidth button[type="button"] {
  color: var(--sb-muted);
}

.w-authPageWidth button.bg-surface-submit,
.w-authPageWidth button[type="submit"] {
  border-radius: 9999px !important;
  font-weight: 600 !important;
}

/* Legal consents on auth pages */
.sb-legal-footer {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 8px;
  padding: 12px 16px 20px;
  text-align: center;
  font-family: var(--sb-font-sans);
  font-size: 12.5px;
  color: var(--sb-muted);
}

@media (max-width: 640px) {
  .sb-legal-footer {
    padding: 12px 16px 56px;
  }
}

.sb-legal-footer a {
  color: var(--sb-brand-ink) !important;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sb-legal-footer a:hover {
  color: var(--sb-brand) !important;
}

.sb-legal-footer a:focus-visible {
  outline: 2px solid var(--sb-brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.sb-legal-sep {
  opacity: 0.55;
}

.sb-legal-consents {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 4px;
  padding: 14px 16px;
  border: 1px solid var(--sb-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  font-family: var(--sb-font-sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--sb-ink);
}

.dark .sb-legal-consents {
  background: rgba(255, 255, 255, 0.04);
}

.sb-legal-consents.sb-legal-invalid {
  border-color: var(--sb-err);
}

.sb-legal-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.sb-legal-row input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  margin: 2px 0 0;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border-radius: 5px;
  border: 1.5px solid var(--sb-line-strong);
  background-color: var(--sb-bg);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 12px 12px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.sb-legal-row input[type="checkbox"]:checked {
  border-color: var(--sb-brand);
  background-color: var(--sb-brand);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 8.2 6.5 11.2 12.5 4.8' stroke='%23ffffff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.sb-legal-row input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--sb-brand);
  outline-offset: 2px;
}

.sb-legal-consents.sb-legal-invalid #sb-consent-offer:not(:checked) {
  border-color: var(--sb-err);
}

/* /register: только email + пароль; name/username LibreChat заполняем из email (#374 п.19) */
body.sb-register-page .sb-hide-register-identity {
  display: none !important;
}

.sb-legal-row a {
  color: var(--sb-brand-ink) !important;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sb-legal-row a:hover {
  color: var(--sb-brand) !important;
}

.sb-legal-row a:focus-visible {
  outline: 2px solid var(--sb-brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.sb-legal-optional {
  color: var(--sb-muted);
}

.sb-legal-optional em {
  font-style: normal;
  font-size: 12px;
}

.sb-req {
  color: var(--sb-err);
  margin-left: 2px;
}

.sb-legal-error {
  margin: 0 0 0 28px;
  font-size: 12px;
  font-weight: 600;
  color: var(--sb-err);
}

/* Account menu → Help (LibreChat keeps Help for keyboard shortcuts even when HELP_AND_FAQ_URL=/). */
[role="menuitem"].sb-hide-help,
.sb-hide-help {
  display: none !important;
}

/* Artifacts / Tools / badge-row leftovers (yaml: hideBadgeRow + artifacts:false; CSS for stale tenant yaml). */
button[aria-label*="artifact" i],
button[title*="artifact" i],
[data-testid*="artifact" i],
[aria-label*="artifact" i][role="button"],
button[aria-label*="tools" i],
button[aria-label*="tool" i],
button[aria-label*="инструмент" i],
button[title*="tools" i],
button[title*="инструмент" i],
[data-testid*="tools" i],
[data-testid="toolbar-tools"],
[data-testid="badge-row"],
div[class*="badge-row" i],
div[class*="BadgeRow" i] {
  display: none !important;
}

/* Messenger connect items — match LibreChat AccountSettings icon size (lucide h-4). */
[data-sb-msg-item] svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

/* Default LibreChat tagline under the chat composer */
.sb-hide-lc-tagline {
  display: none !important;
}
