/* BLMPay shared light/dark theme and responsive layout */
:root {
  color-scheme: light;
  --blm-bg: #f9fafb;
  --blm-surface: #ffffff;
  --blm-surface-soft: #f3f4f6;
  --blm-surface-hover: #f9fafb;
  --blm-border: #e5e7eb;
  --blm-border-soft: #f3f4f6;
  --blm-text: #111827;
  --blm-text-muted: #6b7280;
  --blm-text-faint: #9ca3af;
  --blm-shadow: 0 1px 3px rgba(0,0,0,.06);
}

html.dark {
  color-scheme: dark;
  --blm-bg: #090f1b;
  --blm-surface: #111827;
  --blm-surface-soft: #172033;
  --blm-surface-hover: #1b2639;
  --blm-border: #263247;
  --blm-border-soft: #1e293b;
  --blm-text: #f3f4f6;
  --blm-text-muted: #c0cad8;
  --blm-text-faint: #94a3b8;
  --blm-shadow: 0 1px 3px rgba(0,0,0,.32);
}

html, body { background: var(--blm-bg); }
body { transition: background-color .18s ease, color .18s ease; }

.theme-toggle {
  width: 68px;
  height: 36px;
  padding: 4px;
  border: 1px solid var(--blm-border);
  border-radius: 9999px;
  background: var(--blm-surface-soft);
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  justify-items: center;
  position: relative;
  cursor: pointer;
  flex: 0 0 68px;
  overflow: hidden;
  isolation: isolate;
  transition: background-color .18s ease, border-color .18s ease;
}
.theme-toggle::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 4px;
  width: 26px;
  height: 26px;
  border-radius: 9999px;
  background: var(--blm-surface);
  box-shadow: 0 2px 7px rgba(15,23,42,.2);
  transform: translateX(0);
  transition: transform .22s ease, background-color .18s ease;
  z-index: 0;
}
html.dark .theme-toggle::before { transform: translateX(32px); }
.theme-toggle svg {
  width: 16px;
  height: 16px;
  position: relative;
  z-index: 1;
  flex: none;
  transition: opacity .18s ease, transform .18s ease, color .18s ease;
}
.theme-toggle .theme-sun { color: #f59e0b; opacity: 1; }
.theme-toggle .theme-moon { color: #64748b; opacity: .72; }
html.dark .theme-toggle .theme-sun { color: #94a3b8; opacity: .7; }
html.dark .theme-toggle .theme-moon { color: #93c5fd; opacity: 1; }
.theme-toggle:hover svg { transform: scale(1.06); }
.theme-toggle:focus-visible { outline: 3px solid rgba(22,163,74,.25); outline-offset: 2px; }

/* Dark mode overrides for existing Tailwind utility-heavy views. */
html.dark body,
html.dark .bg-gray-50,
html.dark .bg-gray-100 { background-color: var(--blm-bg) !important; }
html.dark .bg-white,
html.dark .card { background-color: var(--blm-surface) !important; }
html.dark .bg-gray-50\/50,
html.dark .bg-gray-100,
html.dark .bg-gray-200 { background-color: var(--blm-surface-soft) !important; }
html.dark .hover\:bg-gray-50:hover,
html.dark .hover\:bg-gray-100:hover,
html.dark .data-table tbody tr:hover { background-color: var(--blm-surface-hover) !important; }
html.dark .border-gray-100,
html.dark .border-gray-200,
html.dark .border-gray-300,
html.dark .border,
html.dark .border-b,
html.dark .border-t,
html.dark .border-r,
html.dark .card { border-color: var(--blm-border) !important; }
html.dark .divide-y > :not([hidden]) ~ :not([hidden]) { border-color: var(--blm-border-soft) !important; }
html.dark .text-gray-900,
html.dark .text-gray-800,
html.dark .text-gray-700,
html.dark h1,
html.dark h2,
html.dark h3,
html.dark h4,
html.dark h5,
html.dark strong { color: var(--blm-text) !important; }
html.dark .text-gray-600,
html.dark .text-gray-500,
html.dark .text-gray-400 { color: var(--blm-text-muted) !important; }
html.dark .text-gray-300 { color: var(--blm-text-faint) !important; }
html.dark .shadow-sm,
html.dark .shadow,
html.dark .shadow-lg,
html.dark .card { box-shadow: var(--blm-shadow) !important; }

html.dark .sidebar-link,
html.dark .menu-parent,
html.dark .submenu-link { color: var(--blm-text-muted); }
html.dark .sidebar-link:hover,
html.dark .menu-parent:hover,
html.dark .submenu-link:hover { background: var(--blm-surface-hover); color: var(--blm-text); }
html.dark .sidebar-link.active,
html.dark .menu-parent.open,
html.dark .menu-parent.has-active,
html.dark .submenu-link.active { background: rgba(22,163,74,.16); color: #4ade80; }
html.dark .sidebar-section { color: var(--blm-text-faint); }

html.dark .form-input,
html.dark .form-select,
html.dark textarea,
html.dark input:not([type='checkbox']):not([type='radio']):not([type='submit']):not([type='button']),
html.dark select {
  background-color: #0f172a !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}
html.dark .form-input::placeholder,
html.dark textarea::placeholder,
html.dark input::placeholder { color: #718096 !important; }
html.dark .form-input:disabled,
html.dark input:disabled,
html.dark select:disabled { background-color: #172033 !important; color: #94a3b8 !important; }
html.dark .form-label,
html.dark label { color: var(--blm-text-muted); }

html.dark .btn-secondary {
  background: var(--blm-surface);
  border-color: #334155;
  color: var(--blm-text);
}
html.dark .btn-secondary:hover { background: var(--blm-surface-hover); border-color: #475569; }

html.dark .data-table thead tr { background: #172033; border-color: var(--blm-border); }
html.dark .data-table th { color: #aebbd0; }
html.dark .data-table tbody tr { border-color: var(--blm-border-soft); }
html.dark .data-table td { color: #d9e1ec; }

html.dark pre,
html.dark code:not([class*='text-']) { background-color: #08101f !important; color: #d1fae5 !important; border-color: #25334a !important; }

/* Preserve readable status/info surfaces in dark mode. */
html.dark .bg-blue-50 { background-color: rgba(37,99,235,.16) !important; }
html.dark .bg-green-50 { background-color: rgba(22,163,74,.16) !important; }
html.dark .bg-red-50 { background-color: rgba(220,38,38,.16) !important; }
html.dark .bg-amber-50,
html.dark .bg-yellow-50 { background-color: rgba(217,119,6,.16) !important; }
html.dark .bg-purple-50 { background-color: rgba(147,51,234,.16) !important; }
html.dark .text-blue-800,
html.dark .text-blue-700,
html.dark .text-blue-600 { color: #93c5fd !important; }
html.dark .text-green-800,
html.dark .text-green-700,
html.dark .text-green-600 { color: #86efac !important; }
html.dark .text-red-800,
html.dark .text-red-700,
html.dark .text-red-600 { color: #fca5a5 !important; }
html.dark .text-amber-800,
html.dark .text-amber-700 { color: #fcd34d !important; }
html.dark .text-purple-700,
html.dark .text-purple-600 { color: #d8b4fe !important; }

/* Mobile/desktop resilience. */
img, svg, video, canvas { max-width: 100%; }
main { min-width: 0; }

.app-page-content > * { min-width: 0; }
.app-page-content .flex { min-width: 0; }
.app-page-content input, .app-page-content select, .app-page-content textarea { max-width: 100%; }

.overflow-x-auto { -webkit-overflow-scrolling: touch; }
.data-table { min-width: 680px; }
.card { max-width: 100%; }

.app-topbar { min-height:72px; }

@media (max-width: 1023px) {
  .app-topbar { padding-left: 1rem !important; padding-right: 1rem !important; }
  .app-page-content { padding: 1rem !important; }
  .app-title { max-width: min(48vw, 360px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .desktop-user-name { display: none !important; }
}

@media (max-width: 639px) {
  .app-topbar { height: 64px !important; min-height:64px !important; }
  .app-page-content > .flex.items-center.justify-between { flex-direction: column; align-items: stretch; gap: .75rem; }
  .app-page-content > .flex.items-center.justify-between > a,
  .app-page-content > .flex.items-center.justify-between > button { align-self: flex-start; }
  .app-page-content form.flex { flex-wrap: wrap; }
  .app-page-content .pagination, .app-page-content nav[aria-label='Pagination'] { overflow-x: auto; }
  .app-page-content .fixed.top-4.right-4 { left: .75rem !important; right: .75rem !important; max-width: none !important; }

  .app-page-content { padding: .875rem !important; }
  .app-title { max-width: 42vw; font-size: .925rem !important; }
  .header-actions { gap: .35rem !important; }
  .theme-toggle { width: 62px; height: 34px; flex-basis: 62px; }
  .theme-toggle::before { width: 24px; height: 24px; }
  html.dark .theme-toggle::before { transform: translateX(28px); }
  .data-table { min-width: 620px; }
  .btn-primary, .btn-secondary, .btn-danger { max-width: 100%; }
  .mobile-stack { flex-direction: column !important; align-items: stretch !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .fade-up, .reveal { opacity: 1 !important; transform: none !important; }
}


/* 2026-07-29 dark-mode visual corrections */
html.dark .bg-white\/90 { background-color: rgba(15,23,42,.94) !important; }
html.dark .bg-white\/80 { background-color: rgba(15,23,42,.86) !important; }
html.dark .from-gray-50, html.dark .to-gray-100 { --tw-gradient-from: #090f1b var(--tw-gradient-from-position) !important; --tw-gradient-to: #111827 var(--tw-gradient-to-position) !important; }
html.dark .gradient-hero { background: radial-gradient(circle at 18% 12%, rgba(22,163,74,.16), transparent 35%), linear-gradient(135deg,#07111d 0%,#0d1728 55%,#101827 100%) !important; }
html.dark .bg-gray-900 { background-color: #07101f !important; }
html.dark .text-white { color: #fff !important; }
html.dark .bg-black { background-color: #020617 !important; }
html.dark nav.sticky { border-color: #263247 !important; }
html.dark .user-menu { background:#111827 !important; border-color:#263247 !important; }
html.dark .fade-up, html.dark .reveal.in { opacity:1; }

/* Login only: preserve the green branding panel and make the form panel truly dark. */
html.dark body.auth-login { background:#090f1b !important; }
html.dark body.auth-login .auth-form-panel { background:linear-gradient(145deg,#090f1b 0%,#111827 100%) !important; }
html.dark body.auth-login .auth-form-card { background:#111827; border:1px solid #263247; border-radius:20px; padding:28px; box-shadow:0 24px 70px rgba(0,0,0,.3); }
html.dark body.auth-login input[type='email'],
html.dark body.auth-login input[type='password'] { background:#0b1322 !important; border-color:#3b4a61 !important; color:#f8fafc !important; }
html.dark body.auth-login input:-webkit-autofill,
html.dark body.auth-login input:-webkit-autofill:hover,
html.dark body.auth-login input:-webkit-autofill:focus { -webkit-text-fill-color:#f8fafc; -webkit-box-shadow:0 0 0 1000px #0b1322 inset; transition:background-color 9999s ease-out; }
html.dark body.auth-login input[type='checkbox'] { accent-color:#16a34a; }

/* API docs */
html.dark body.api-docs-page { background:#090f1b !important; color:#e5edf7; }
html.dark body.api-docs-page .toc-link { color:#94a3b8; }
html.dark body.api-docs-page .toc-link:hover { color:#f8fafc; }
html.dark body.api-docs-page .toc-link.active { color:#4ade80; }
html.dark body.api-docs-page table { border-color:#263247 !important; }
html.dark body.api-docs-page tbody tr { border-color:#1e293b !important; }
html.dark body.api-docs-page code.bg-gray-100 { background:#172033 !important; }

@media (max-width: 639px) {
  html.dark body.auth-login .auth-form-card { padding:20px; border-radius:16px; }
}


/* Public shop dark mode corrections 2026-08-03 */
html.dark body.public-shop-page {
  background: radial-gradient(circle at 8% 0%, rgba(22,163,74,.09), transparent 26%), #080f1b !important;
  color: #e5edf7 !important;
}
html.dark body.public-shop-page header,
html.dark body.public-shop-page footer,
html.dark body.public-shop-page main > section.bg-white,
html.dark body.public-shop-page section.bg-white {
  background-color: #0f172a !important;
  border-color: #263247 !important;
}
html.dark body.public-shop-page .bg-white,
html.dark body.public-shop-page .group.bg-white {
  background-color: #111b2d !important;
  border-color: #2b3950 !important;
}
html.dark body.public-shop-page .bg-gray-50,
html.dark body.public-shop-page .bg-gray-100 {
  background-color: #0b1322 !important;
}
html.dark body.public-shop-page .text-gray-900,
html.dark body.public-shop-page .text-gray-800,
html.dark body.public-shop-page h1,
html.dark body.public-shop-page h2,
html.dark body.public-shop-page h3 {
  color: #f8fafc !important;
}
html.dark body.public-shop-page .text-gray-700,
html.dark body.public-shop-page .text-gray-600,
html.dark body.public-shop-page .text-gray-500,
html.dark body.public-shop-page .text-gray-400 {
  color: #aebbd0 !important;
}
html.dark body.public-shop-page input,
html.dark body.public-shop-page textarea,
html.dark body.public-shop-page select {
  background-color: #0a1220 !important;
  color: #f8fafc !important;
  border-color: #3a4960 !important;
}
html.dark body.public-shop-page input::placeholder,
html.dark body.public-shop-page textarea::placeholder { color:#718096 !important; }
html.dark body.public-shop-page .chip-active { background:#16a34a !important; border-color:#22c55e !important; color:#fff !important; }
html.dark body.public-shop-page a.group:hover { border-color:#3f526e !important; box-shadow:0 18px 42px rgba(0,0,0,.28) !important; }
html.dark body.public-shop-page .border-gray-100,
html.dark body.public-shop-page .border-gray-200,
html.dark body.public-shop-page .border-b,
html.dark body.public-shop-page .border-t { border-color:#263247 !important; }
html.dark body.public-shop-page .bg-purple-50 { background:rgba(147,51,234,.14) !important; border-color:rgba(192,132,252,.28) !important; }
html.dark body.public-shop-page .bg-red-50 { background:rgba(220,38,38,.14) !important; border-color:rgba(248,113,113,.28) !important; }
html.dark body.public-shop-page img.bg-white,
html.dark body.public-shop-page img.bg-gray-50 { background:#fff !important; }


/* Public shop visual hotfix 2026-08-03 v2 */
html.dark body.public-shop-page .public-shop-header {
  background: rgba(9, 15, 27, .94) !important;
  border-color: #263247 !important;
  box-shadow: 0 1px 0 rgba(148,163,184,.08);
}
html.dark body.public-shop-page .shop-directory-hero {
  background-image:
    radial-gradient(circle at 18% 8%, rgba(34,197,94,.16), transparent 34%),
    radial-gradient(circle at 86% 22%, rgba(37,99,235,.14), transparent 34%),
    linear-gradient(145deg, #08111f 0%, #0d1728 52%, #101a2c 100%) !important;
  background-color: #0b1322 !important;
  border-color: #263247 !important;
}
html.dark body.public-shop-page .shop-directory-hero h1 {
  color: #f8fafc !important;
  text-shadow: 0 1px 0 rgba(0,0,0,.12);
}
html.dark body.public-shop-page .shop-directory-hero p {
  color: #b8c4d6 !important;
}
html.dark body.public-shop-page .shop-directory-hero form input {
  background: #111b2d !important;
  border-color: #34435b !important;
  color: #f8fafc !important;
  box-shadow: 0 12px 34px rgba(0,0,0,.18) !important;
}
html.dark body.public-shop-page .shop-directory-hero form input:focus {
  border-color: #22c55e !important;
  box-shadow: 0 0 0 4px rgba(34,197,94,.13) !important;
}
html.dark body.public-shop-page .shop-directory-hero .bg-green-100 {
  background: rgba(34,197,94,.14) !important;
  border: 1px solid rgba(74,222,128,.22);
}
html.dark body.public-shop-page .shop-directory-hero .text-green-700 {
  color: #86efac !important;
}
html.dark body.public-shop-page main > section:not(.shop-directory-hero) {
  color: #e5edf7;
}
html.dark body.public-shop-page footer {
  background: #070e1a !important;
  border-color: #263247 !important;
}
html.dark body.public-shop-page details nav {
  background: #111827 !important;
  border-color: #2b3950 !important;
  color: #dbe5f2 !important;
}
html.dark body.public-shop-page details summary {
  background: #111827 !important;
  border-color: #334155 !important;
  color: #e5edf7 !important;
}
@media (max-width: 639px) {
  body.public-shop-page .public-shop-header .theme-toggle {
    width: 58px;
    height: 32px;
    flex-basis: 58px;
  }
  body.public-shop-page .public-shop-header .theme-toggle::before {
    width: 22px;
    height: 22px;
  }
  html.dark body.public-shop-page .public-shop-header .theme-toggle::before {
    transform: translateX(26px);
  }
}

/* 2026-08-09 dashboard dark-mode coverage + feature badge polish */
.sidebar-link-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.feature-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  max-width: 64px;
  min-width: 0;
  padding: 1px 5px;
  border-radius: 9999px;
  font-size: 7.5px;
  line-height: 1.35;
  font-weight: 800;
  letter-spacing: .015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.feature-badge-new { background:#dcfce7; color:#15803d; }
.feature-badge-soon { background:#f3f4f6; color:#6b7280; }
html.dark .feature-badge-new { background:rgba(34,197,94,.17); color:#86efac; border:1px solid rgba(74,222,128,.18); }
html.dark .feature-badge-soon { background:#1e293b; color:#aebbd0; border:1px solid #334155; }

/* Tailwind colour surfaces which were previously left bright in dark mode. */
html.dark .bg-brand-50,
html.dark .bg-brand-100 { background-color:rgba(22,163,74,.15) !important; }
html.dark .bg-green-100,
html.dark .bg-emerald-100 { background-color:rgba(22,163,74,.16) !important; }
html.dark .bg-blue-100,
html.dark .bg-cyan-100,
html.dark .bg-indigo-100 { background-color:rgba(37,99,235,.16) !important; }
html.dark .bg-red-100 { background-color:rgba(220,38,38,.16) !important; }
html.dark .bg-amber-100,
html.dark .bg-orange-100 { background-color:rgba(217,119,6,.16) !important; }
html.dark .bg-purple-100,
html.dark .bg-pink-100 { background-color:rgba(147,51,234,.16) !important; }
html.dark .bg-teal-50,
html.dark .bg-teal-100,
html.dark .bg-cyan-50 { background-color:rgba(13,148,136,.15) !important; }
html.dark .bg-emerald-50 { background-color:rgba(5,150,105,.15) !important; }
html.dark .bg-orange-50 { background-color:rgba(234,88,12,.15) !important; }

/* Fix light gradient tokens such as WhatsApp Commerce's from-green-50 -> to-white. */
html.dark .from-green-50 {
  --tw-gradient-from: rgba(22,163,74,.14) var(--tw-gradient-from-position) !important;
  --tw-gradient-to: rgba(22,163,74,0) var(--tw-gradient-to-position) !important;
}
html.dark .from-white {
  --tw-gradient-from: #111827 var(--tw-gradient-from-position) !important;
  --tw-gradient-to: rgba(17,24,39,0) var(--tw-gradient-to-position) !important;
}
html.dark .to-white { --tw-gradient-to:#111827 var(--tw-gradient-to-position) !important; }
html.dark .to-blue-50 { --tw-gradient-to:rgba(37,99,235,.12) var(--tw-gradient-to-position) !important; }

/* Selection cards used by Payments and Payout Accounts. */
html.dark .type-option,
html.dark .atype-opt {
  background-color:#0f172a !important;
  border-color:#334155 !important;
  color:#e5edf7 !important;
}
html.dark .type-option.bg-brand-50,
html.dark .atype-opt.bg-brand-50 {
  background:rgba(22,163,74,.14) !important;
  border-color:#22c55e !important;
}
html.dark .type-option.bg-blue-50 {
  background:rgba(37,99,235,.14) !important;
  border-color:#60a5fa !important;
}
html.dark .type-option:hover,
html.dark .atype-opt:hover { background-color:#172033 !important; }
html.dark .type-option.bg-brand-50:hover,
html.dark .atype-opt.bg-brand-50:hover { background:rgba(22,163,74,.18) !important; }
html.dark .type-option.bg-blue-50:hover { background:rgba(37,99,235,.18) !important; }

/* Read-only verified payout name should remain clearly readable, not washed out. */
html.dark .verified-name-input[readonly] {
  background:#101a2c !important;
  border-color:#334155 !important;
  color:#f8fafc !important;
  opacity:1 !important;
  cursor:default !important;
}
html.dark .verified-name-input.is-verified[readonly] {
  border-color:rgba(34,197,94,.7) !important;
  box-shadow:0 0 0 3px rgba(34,197,94,.08) !important;
}

/* Modal and readonly support surfaces used throughout dashboard pages. */
html.dark .dashboard-modal-panel { background:#111827 !important; border:1px solid #263247; }
html.dark .dashboard-soft-surface { background:#0f172a !important; border-color:#334155 !important; }

/* Dark-mode semantic text + status contrast */
html.dark .text-brand-800,
html.dark .text-brand-700,
html.dark .text-brand-600 { color:#86efac !important; }
html.dark .text-emerald-800,
html.dark .text-emerald-700,
html.dark .text-teal-700,
html.dark .text-teal-600 { color:#6ee7b7 !important; }
html.dark .text-cyan-800,
html.dark .text-cyan-700,
html.dark .text-cyan-600 { color:#67e8f9 !important; }
html.dark .text-orange-700,
html.dark .text-orange-600,
html.dark .text-orange-500 { color:#fdba74 !important; }
html.dark .text-indigo-600 { color:#a5b4fc !important; }
html.dark .text-pink-700 { color:#f9a8d4 !important; }

html.dark .status-completed,
html.dark .status-verified,
html.dark .status-delivered { background:rgba(22,163,74,.16) !important; color:#86efac !important; }
html.dark .status-pending,
html.dark .status-unpaid { background:rgba(217,119,6,.16) !important; color:#fcd34d !important; }
html.dark .status-failed,
html.dark .status-rejected { background:rgba(220,38,38,.16) !important; color:#fca5a5 !important; }
html.dark .status-processing,
html.dark .status-paid,
html.dark .status-ready,
html.dark .status-shipped,
html.dark .status-under_review { background:rgba(37,99,235,.16) !important; color:#93c5fd !important; }
html.dark .status-flagged,
html.dark .status-reverification_required { background:rgba(147,51,234,.16) !important; color:#d8b4fe !important; }
html.dark .status-voided,
html.dark .status-cancelled,
html.dark .status-expired { background:#1e293b !important; color:#cbd5e1 !important; }

/* Muted semantic borders in dark mode so alert/feature cards do not glow. */
html.dark .border-green-100,
html.dark .border-green-200,
html.dark .border-emerald-100,
html.dark .border-emerald-200 { border-color:rgba(74,222,128,.25) !important; }
html.dark .border-blue-100,
html.dark .border-blue-200,
html.dark .border-cyan-200 { border-color:rgba(96,165,250,.25) !important; }
html.dark .border-red-100,
html.dark .border-red-200,
html.dark .border-red-300 { border-color:rgba(248,113,113,.25) !important; }
html.dark .border-amber-100,
html.dark .border-amber-200,
html.dark .border-amber-300,
html.dark .border-orange-300 { border-color:rgba(251,191,36,.25) !important; }
html.dark .border-purple-100,
html.dark .border-purple-200 { border-color:rgba(192,132,252,.25) !important; }
html.dark .border-brand-100,
html.dark .border-brand-200,
html.dark .border-brand-300 { border-color:rgba(74,222,128,.25) !important; }


/* 2026-08-31 blmAgent Knowledge Base dark-mode hardening */
html.dark #blmagent-knowledge.blmagent-kb-card {
  background:#111827 !important;
  border-color:#334155 !important;
  color:#e5e7eb !important;
}
html.dark #blmagent-knowledge .blmagent-kb-header {
  background:#111827 !important;
  border-color:#334155 !important;
}
html.dark #blmagent-knowledge .blmagent-kb-editor {
  background:#0b1220 !important;
  border-color:#334155 !important;
}
html.dark #blmagent-knowledge .blmagent-kb-toggle {
  background:#111827 !important;
  border-color:#475569 !important;
  color:#e5e7eb !important;
}
html.dark #blmagent-knowledge .form-label,
html.dark #blmagent-knowledge label,
html.dark #blmagent-knowledge .text-gray-700,
html.dark #blmagent-knowledge .text-gray-800,
html.dark #blmagent-knowledge .text-gray-900 {
  color:#e5e7eb !important;
}
html.dark #blmagent-knowledge .text-gray-400,
html.dark #blmagent-knowledge .text-gray-500,
html.dark #blmagent-knowledge .text-gray-600 {
  color:#94a3b8 !important;
}
html.dark #blmagent-knowledge .form-input,
html.dark #blmagent-knowledge .form-select,
html.dark #blmagent-knowledge input:not([type='checkbox']):not([type='radio']),
html.dark #blmagent-knowledge textarea,
html.dark #blmagent-knowledge select {
  background:#0f172a !important;
  border-color:#475569 !important;
  color:#f8fafc !important;
  box-shadow:none !important;
}
html.dark #blmagent-knowledge .form-input:focus,
html.dark #blmagent-knowledge .form-select:focus,
html.dark #blmagent-knowledge input:focus,
html.dark #blmagent-knowledge textarea:focus,
html.dark #blmagent-knowledge select:focus {
  border-color:#22c55e !important;
  box-shadow:0 0 0 3px rgba(34,197,94,.14) !important;
  outline:none !important;
}
html.dark #blmagent-knowledge input::placeholder,
html.dark #blmagent-knowledge textarea::placeholder {
  color:#64748b !important;
  opacity:1;
}
html.dark #blmagent-knowledge select,
html.dark #blmagent-knowledge option {
  color-scheme:dark;
}
html.dark #blmagent-knowledge option {
  background:#0f172a !important;
  color:#f8fafc !important;
}
html.dark #blmagent-knowledge input[type='checkbox'] {
  accent-color:#16a34a;
}
html.dark #blmagent-knowledge .blmagent-kb-table-head {
  background:#172033 !important;
  color:#aebbd0 !important;
}
html.dark #blmagent-knowledge tbody tr {
  background:#111827 !important;
  border-color:#263247 !important;
}
html.dark #blmagent-knowledge tbody tr:hover {
  background:#172033 !important;
}
html.dark #blmagent-knowledge .btn-secondary {
  background:#172033 !important;
  border-color:#475569 !important;
  color:#e5e7eb !important;
}
html.dark #blmagent-knowledge .btn-secondary:hover {
  background:#1f2937 !important;
  border-color:#64748b !important;
  color:#fff !important;
}


/* 2026-10-13 i18n/public language UI + production-safe KYC preview polish */
.sidebar-link { min-width:0; }
.sidebar-link > svg { flex:0 0 auto; }
.sidebar-link-label { flex:1 1 auto; }
.sidebar-link .feature-badge { flex:0 1 64px; }

.blm-language-menu,
.blm-language-floating {
  position: relative;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color:#334155;
}
.blm-language-menu summary,
.blm-language-floating summary {
  list-style:none;
  -webkit-user-select:none;
  user-select:none;
  cursor:pointer;
}
.blm-language-menu summary::-webkit-details-marker,
.blm-language-floating summary::-webkit-details-marker { display:none; }
.blm-language-trigger {
  height:36px;
  min-width:72px;
  padding:0 10px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  border:1px solid #e2e8f0;
  border-radius:10px;
  background:rgba(255,255,255,.92);
  color:#334155;
  font-size:12px;
  font-weight:750;
  line-height:1;
  box-shadow:0 1px 2px rgba(15,23,42,.04);
  transition:border-color .16s ease,background .16s ease,box-shadow .16s ease;
}
.blm-language-trigger:hover,
.blm-language-menu[open] .blm-language-trigger,
.blm-language-floating[open] .blm-language-trigger {
  border-color:#cbd5e1;
  background:#f8fafc;
  box-shadow:0 4px 14px rgba(15,23,42,.08);
}
.blm-language-trigger svg { width:15px;height:15px;flex:0 0 auto; }
.blm-language-trigger .blm-language-code { min-width:20px;text-align:center;letter-spacing:.04em; }
.blm-language-trigger .blm-language-chevron { width:12px;height:12px;color:#94a3b8;transition:transform .15s ease; }
.blm-language-menu[open] .blm-language-chevron,
.blm-language-floating[open] .blm-language-chevron { transform:rotate(180deg); }
.blm-language-popover {
  position:absolute;
  right:0;
  top:calc(100% + 8px);
  width:178px;
  padding:6px;
  border:1px solid #e2e8f0;
  border-radius:12px;
  background:#fff;
  box-shadow:0 16px 40px rgba(15,23,42,.16);
  z-index:80;
}
.blm-language-option {
  min-width:0;
  display:flex;
  align-items:center;
  gap:9px;
  padding:9px 10px;
  border-radius:9px;
  color:#475569;
  font-size:12.5px;
  font-weight:650;
  text-decoration:none;
  transition:background .14s ease,color .14s ease;
}
.blm-language-option:hover { background:#f8fafc;color:#0f172a; }
.blm-language-option.is-active { background:#f0fdf4;color:#15803d; }
.blm-language-option .blm-language-check { margin-left:auto;width:14px;height:14px; }

.blm-language-floating {
  position:fixed;
  left:16px;
  bottom:16px;
  z-index:70;
}
.blm-language-floating .blm-language-trigger {
  height:38px;
  min-width:76px;
  background:rgba(255,255,255,.96);
  box-shadow:0 10px 30px rgba(15,23,42,.14);
  backdrop-filter:blur(12px);
}
.blm-language-floating .blm-language-popover {
  top:auto;
  right:auto;
  left:0;
  bottom:calc(100% + 8px);
}

html.dark .blm-language-trigger {
  border-color:#334155;
  background:rgba(15,23,42,.94);
  color:#e2e8f0;
}
html.dark .blm-language-trigger:hover,
html.dark .blm-language-menu[open] .blm-language-trigger,
html.dark .blm-language-floating[open] .blm-language-trigger { background:#111827;border-color:#475569; }
html.dark .blm-language-popover { background:#0f172a;border-color:#334155;box-shadow:0 18px 44px rgba(0,0,0,.38); }
html.dark .blm-language-option { color:#cbd5e1; }
html.dark .blm-language-option:hover { background:#1e293b;color:#fff; }
html.dark .blm-language-option.is-active { background:rgba(34,197,94,.12);color:#86efac; }

.kyc-file-label {
  display:block;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.kyc-preview-frame {
  width:100%;
  max-width:520px;
  margin:0 auto;
  overflow:hidden;
  border:1px solid #dbe3ee;
  border-radius:12px;
  background:#fff;
  box-shadow:0 1px 2px rgba(15,23,42,.04);
}
.kyc-preview-image {
  display:block;
  width:100%;
  max-height:230px;
  object-fit:contain;
  background:#f8fafc;
}
.kyc-preview-meta,
.kyc-document-preview {
  display:flex;
  align-items:center;
  gap:9px;
  min-width:0;
}
.kyc-preview-meta {
  padding:8px 10px;
  border-top:1px solid #e2e8f0;
  color:#64748b;
  font-size:11px;
}
.kyc-preview-name {
  min-width:0;
  flex:1 1 auto;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  text-align:left;
}
.kyc-preview-size { flex:0 0 auto;color:#94a3b8; }
.kyc-document-preview {
  width:100%;
  max-width:520px;
  margin:0 auto;
  padding:11px 12px;
  border:1px solid #dbe3ee;
  border-radius:12px;
  background:#fff;
  color:#475569;
  text-align:left;
}
.kyc-document-preview-icon {
  width:34px;
  height:34px;
  flex:0 0 34px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:9px;
  background:#f1f5f9;
  color:#64748b;
  font-size:10px;
  font-weight:800;
}
.kyc-document-preview-copy { min-width:0;flex:1 1 auto; }
.kyc-document-preview-copy strong,
.kyc-document-preview-copy span { display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.kyc-document-preview-copy strong { font-size:12px;color:#334155; }
.kyc-document-preview-copy span { margin-top:2px;font-size:10.5px;color:#94a3b8; }
.kyc-preview-loading { font-size:11px;color:#64748b; }
html.dark .kyc-preview-frame,
html.dark .kyc-document-preview { background:#0f172a;border-color:#334155; }
html.dark .kyc-preview-image { background:#0b1220; }
html.dark .kyc-preview-meta { border-color:#334155;color:#94a3b8; }
html.dark .kyc-document-preview-icon { background:#1e293b;color:#cbd5e1; }
html.dark .kyc-document-preview-copy strong { color:#e2e8f0; }

@media (max-width:639px) {
  .blm-language-floating { left:12px;bottom:12px; }
  .blm-language-trigger { min-width:64px;padding:0 8px; }
  .blm-language-popover { width:166px; }
}
