/*
 * Светлая тема — ручные правки поверх сгенерированных *.light.css (tools/theme-light/gen.mjs).
 * Подключается последней на всех страницах (includes/ac_theme.php → ac_theme_links()).
 * Всё здесь действует только при html[data-theme="light"] — тёмная тема не меняется.
 */

html[data-theme="light"] {
  color-scheme: light;
  --ac-light-ink: #0f172a;
  --ac-light-text: #1e293b;
  --ac-light-muted: #64748b;
  --ac-light-faint: #94a3b8;
  --ac-light-line: rgba(15, 23, 42, 0.1);
  --ac-light-line-strong: rgba(15, 23, 42, 0.16);
  --ac-light-surface: #ffffff;
  --ac-light-surface-2: #f6f8fb;
  --ac-light-page: #eef1f6;
}

/* ── Белый текст на цветных кнопках/бейджах остаётся белым (tailwind: text-white + цветная заливка) ── */
html[data-theme="light"] .text-white:is(
  [class*="accent)]"], [class*="accent-"], [class*="primary"], [class*="bg-gradient"], [class*="bg-linear"], [class*="from-"],
  [class*="bg-red-"], [class*="bg-rose-"], [class*="bg-orange-"], [class*="bg-amber-"], [class*="bg-lime-"], [class*="bg-green-"],
  [class*="bg-emerald-"], [class*="bg-teal-"], [class*="bg-cyan-"], [class*="bg-sky-"], [class*="bg-blue-"], [class*="bg-indigo-"],
  [class*="bg-violet-"], [class*="bg-purple-"], [class*="bg-fuchsia-"], [class*="bg-pink-"], [class*="bg-[#"], [class*="bg-[hsl"], [class*="bg-[rgb"]
) {
  color: #fff;
}
html[data-theme="light"] .text-white:is([class*="violet)]"], [class*="bg-black/"], [class*="bg-[var(--color-"][class*="accent"]) {
  color: #fff;
}

/* ── Полосы прокрутки ── */
html[data-theme="light"] {
  scrollbar-color: rgba(15, 23, 42, 0.22) transparent;
}
html[data-theme="light"] ::-webkit-scrollbar-thumb {
  background-color: rgba(15, 23, 42, 0.2);
}
html[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background-color: rgba(15, 23, 42, 0.32);
}

/* Классический стиль: единый вид полос прокрутки на всех страницах.
   Сгенерированные *.light.css (crm.light.css, tasks.light.css, tete и др.) «осветляли»
   тёмную дорожку в rgba(15,23,42,.3) — выходила толстая серая полоса с тёмным ползунком.
   Здесь — мягкий ползунок на прозрачной дорожке, как в светлом modern. !important нужен,
   чтобы перебить локальные правила страниц; ширину (scrollbar-width) не трогаем —
   иначе вернулись бы полосы, скрытые намеренно (scrollbar-width: none). */
html[data-theme="light"]:not([data-ui-style="modern"]),
html[data-theme="light"]:not([data-ui-style="modern"]) * {
  scrollbar-color: rgba(15, 23, 42, 0.2) transparent !important;
}
html[data-theme="light"]:not([data-ui-style="modern"]) *:hover {
  scrollbar-color: rgba(15, 23, 42, 0.32) transparent !important;
}
/* Safari и браузеры без scrollbar-color */
html[data-theme="light"]:not([data-ui-style="modern"]) ::-webkit-scrollbar-track,
html[data-theme="light"]:not([data-ui-style="modern"]) ::-webkit-scrollbar-corner {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
html[data-theme="light"]:not([data-ui-style="modern"]) ::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.2) !important;
  border: 2px solid transparent !important;
  background-clip: padding-box !important;
  border-radius: 999px !important;
  box-shadow: none !important;
}
html[data-theme="light"]:not([data-ui-style="modern"]) ::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 23, 42, 0.34) !important;
  background-clip: padding-box !important;
}
html[data-theme="light"]:not([data-ui-style="modern"]) ::-webkit-scrollbar-button {
  display: none !important;
}

/* ── Выделение текста ── */
html[data-theme="light"] ::selection {
  background: hsl(var(--accent-h) var(--accent-s) var(--accent-l) / 0.22);
  color: inherit;
}

/* ── Окно «Цветовая тема» ── */
html[data-theme="light"] .ac-accent-modal__label {
  color: #64748b;
}
html[data-theme="light"] .ac-theme-seg {
  border-color: rgba(15, 23, 42, 0.08);
  background: #f1f4f8;
}
html[data-theme="light"] .ac-theme-seg__btn {
  color: #475569;
}
html[data-theme="light"] .ac-theme-seg__btn:hover {
  color: #0f172a;
  background: rgba(15, 23, 42, 0.04);
}
html[data-theme="light"] .ac-theme-seg__btn.is-active {
  color: #0f172a;
  background: #fff;
  border-color: var(--accent-border-strong);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

/* ── Участники: липкая панель фильтров должна перекрывать карточки (старое светлое правило давало 64% прозрачности) ── */
html[data-theme="light"] .acusers {
  --au-surface: rgba(255, 255, 255, 0.94);
}

/* ── Плейсхолдеры полей ── */
html[data-theme="light"] :is(input, textarea)::placeholder {
  color: #8a94a6;
  opacity: 1;
}

/* ── Фон страницы под островами (в <style> страниц задан тёмный цвет) ── */
html[data-theme="light"],
html[data-theme="light"] body {
  background-color: #eef1f6;
}
html[data-theme="light"] .man-shell {
  background: transparent;
}
html[data-theme="light"] .crm-wait-access-card {
  border-color: rgba(15, 23, 42, 0.1);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}
html[data-theme="light"] .tasks-react-shell { background: var(--tm-bg, #f1f2f6); }

/* ── Тосты sonner (острова задают тёмный стиль инлайном) ── */
html[data-theme="light"] [data-sonner-toast] {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid rgba(15, 23, 42, 0.1) !important;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12) !important;
}
html[data-theme="light"] [data-sonner-toast] [data-description] {
  color: #475569 !important;
}

/* ── Окно «Цветовая тема»: превью стилей интерфейса в светлом режиме ── */
html[data-theme="light"] .ac-style-pick {
  --sp-line: rgba(15, 23, 42, 0.1);
  --sp-bg: #f8fafc;
  --sp-text: #0f172a;
  --sp-hint: #64748b;
  --sp-c-page: #e4eaf6;
  --sp-c-panel: linear-gradient(180deg, #ffffff 0%, #f3f6fb 100%);
  --sp-c-line: rgba(15, 23, 42, 0.1);
  --sp-c-block: rgba(15, 23, 42, 0.1);
  --sp-m-page: #fafafa;
  --sp-m-panel: #ffffff;
  --sp-m-line: rgba(9, 9, 11, 0.09);
  --sp-m-block: rgba(9, 9, 11, 0.08);
}
html[data-theme="light"] .ac-style-pick__preview--classic .ac-style-pick__side,
html[data-theme="light"] .ac-style-pick__preview--classic .ac-style-pick__main {
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}
