/* Тёмная тема панели: html[data-theme="dark"] (+ data-bs-theme="dark" для компонентов темы main.css).
   Цвета страниц — переменные из rp_tokens.css; здесь — то, что задают тема, Choices.js и flatpickr,
   и переключатель. Гамма — нейтральный графит, акцент — бренд (var(--brand)). */

/* ── переключатель ─────────────────────────────────────────────────────────── */
.rp-theme-btn { width:34px; height:34px; border-radius:50%; padding:0; flex-shrink:0; cursor:pointer;
    display:inline-flex; align-items:center; justify-content:center;
    background:var(--rpc-bg-fff, #fff); color:var(--rpc-fg-495057, #495057);
    border:1px solid var(--rpc-bd-e9ecef, #e9ecef); transition:border-color .15s, color .15s; }
.rp-theme-btn:hover { border-color:var(--brand); color:var(--rpc-fg-3a8b78, #3a8b78); }
.rp-theme-btn svg { width:17px; height:17px; }
.rp-theme-btn .i-moon { fill:currentColor; }
.rp-theme-btn .i-sun { fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; display:none; }
.rp-theme-btn .i-sun circle { fill:currentColor; stroke:none; }
[data-theme="dark"] .rp-theme-btn .i-sun { display:block; }
[data-theme="dark"] .rp-theme-btn .i-moon { display:none; }

/* ── основа ────────────────────────────────────────────────────────────────── */
[data-theme="dark"] {
    color-scheme: dark;
    --brand-l: color-mix(in srgb, var(--brand) 20%, #1b1e22);
    --x-body-bg: #121416; --x-body-bg-rgb: 18, 20, 22;
    --x-body-color: #e6e8ea; --x-body-color-rgb: 230, 232, 234;
    --x-emphasis-color: #fff; --x-heading-color: #e6e8ea;
    --x-secondary-color: #9aa1a8; --x-secondary-bg: #1b1e22; --x-secondary-bg-rgb: 27, 30, 34;
    --x-tertiary-color: #8c949c; --x-tertiary-bg: #121416; --x-tertiary-bg-rgb: 18, 20, 22;
    --x-border-color: #2e3338; --x-border-color-translucent: rgba(255, 255, 255, .08);
    --x-card-bg: #1b1e22; --x-surface-primary: #1b1e22; --x-surface-secondary: #202327;
    --x-link-color: #6dc6ae; --x-link-hover-color: #8fdcc6;
}
[data-theme="dark"] body,
[data-theme="dark"] .bg-body-tertiary { background-color:#121416 !important; color:#e6e8ea; }
[data-theme="dark"] .bg-white, [data-theme="dark"] .bg-light { background-color:#1b1e22 !important; }
[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3,
[data-theme="dark"] h4, [data-theme="dark"] h5, [data-theme="dark"] h6 { color:#e6e8ea; }
[data-theme="dark"] .text-dark { color:#e6e8ea !important; }
[data-theme="dark"] .text-muted, [data-theme="dark"] .text-secondary { color:#9aa1a8 !important; }
[data-theme="dark"] hr { border-color:#2e3338; opacity:1; }
[data-theme="dark"] ::placeholder { color:#6f767d !important; }

/* ── поля ──────────────────────────────────────────────────────────────────── */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] textarea,
[data-theme="dark"] input[type=text], [data-theme="dark"] input[type=number], [data-theme="dark"] input[type=date],
[data-theme="dark"] input[type=email], [data-theme="dark"] input[type=password], [data-theme="dark"] input[type=search],
[data-theme="dark"] input[type=tel], [data-theme="dark"] input[type=url] {
    background-color:#16191c !important; color:#e6e8ea !important; border-color:#30353b !important; }
[data-theme="dark"] .form-control:disabled, [data-theme="dark"] .form-select:disabled,
[data-theme="dark"] .form-control[readonly] { background-color:#202327 !important; color:#9aa1a8 !important; }
[data-theme="dark"] .form-check-input { background-color:#16191c; border-color:#454c53; }
[data-theme="dark"] .form-check-input:checked { background-color:var(--brand); border-color:var(--brand); }
[data-theme="dark"] input[type=date]::-webkit-calendar-picker-indicator { filter:invert(.85); }

/* ── таблицы, карточки, выпадашки темы ─────────────────────────────────────── */
[data-theme="dark"] .table { --x-table-bg: transparent; --x-table-color: #e6e8ea; --x-table-border-color: #2e3338;
    --x-table-striped-bg: rgba(255, 255, 255, .03); --x-table-hover-bg: rgba(255, 255, 255, .04); color:#e6e8ea; }
[data-theme="dark"] .table > :not(caption) > * > * { background-color:transparent; color:inherit; border-color:#2e3338; }
[data-theme="dark"] .card, [data-theme="dark"] .modal-content, [data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .list-group-item { background-color:#1b1e22; color:#e6e8ea; border-color:#2e3338; }
[data-theme="dark"] .dropdown-item { color:#e6e8ea; }
[data-theme="dark"] .dropdown-item:hover { background-color:#25292d; }
[data-theme="dark"] .badge.bg-light, [data-theme="dark"] .bg-light.text-dark { background-color:#2a2e33 !important; color:#e6e8ea !important; }
[data-theme="dark"] .btn-light { background-color:#25292d; border-color:#30353b; color:#e6e8ea; }
[data-theme="dark"] .btn-outline-secondary { color:#c2c7cd; border-color:#454c53; }
[data-theme="dark"] .navbar-light .navbar-nav .nav-link, [data-theme="dark"] #sidebar .nav-link { color:#c2c7cd; }
[data-theme="dark"] #sidebar .nav-link:hover { color:#fff; }
[data-theme="dark"] #sidebar .nav-link.is-active { color:#e6e8ea; }
[data-theme="dark"] .navbar-brand, [data-theme="dark"] .navbar-brand h1 { color:#e6e8ea; }
[data-theme="dark"] .btn-close { filter:invert(1) grayscale(100%) brightness(200%); }

/* ── Choices.js ───────────────────────────────────────────────────────────── */
[data-theme="dark"] .choices__inner:not(.rp-need) { background:#16191c !important; border-color:#30353b !important; }   /* у .rp-need фон — бегущая рамка */
[data-theme="dark"] .choices__inner { color:#e6e8ea; }
[data-theme="dark"] .choices.is-disabled .choices__inner { background:#202327 !important; }
[data-theme="dark"] .choices__list--dropdown, [data-theme="dark"] .choices__list[aria-expanded] { background:#1b1e22 !important; color:#e6e8ea; }
[data-theme="dark"] .choices__list--dropdown .choices__item, [data-theme="dark"] .choices__list[aria-expanded] .choices__item { color:#e6e8ea; }
[data-theme="dark"] .choices__list--dropdown .choices__item--selectable.is-highlighted,
[data-theme="dark"] .choices__list[aria-expanded] .choices__item--selectable.is-highlighted { background:color-mix(in srgb, var(--brand) 22%, #1b1e22) !important; }
[data-theme="dark"] .choices__input { background:#1b1e22 !important; color:#e6e8ea; border-color:#2e3338 !important; }
[data-theme="dark"] .choices[data-type*=select-one]::after { border-color:#9aa1a8 transparent transparent !important; }
[data-theme="dark"] .choices[data-type*=select-one].is-open::after { border-color:transparent transparent #9aa1a8 !important; }
[data-theme="dark"] .choices__placeholder { opacity:.6; }

/* ── flatpickr ────────────────────────────────────────────────────────────── */
[data-theme="dark"] .flatpickr-calendar { background:#1b1e22; box-shadow:0 6px 24px rgba(0,0,0,.5) !important; }
[data-theme="dark"] .flatpickr-months .flatpickr-month, [data-theme="dark"] .flatpickr-current-month,
[data-theme="dark"] .flatpickr-weekday, [data-theme="dark"] .flatpickr-day { color:#e6e8ea; fill:#e6e8ea; }
[data-theme="dark"] .flatpickr-day:hover { background:#2a2e33; border-color:#2a2e33; }
[data-theme="dark"] .flatpickr-day.prevMonthDay, [data-theme="dark"] .flatpickr-day.nextMonthDay,
[data-theme="dark"] .flatpickr-day.flatpickr-disabled { color:#5d646b; }
[data-theme="dark"] .flatpickr-months .flatpickr-prev-month svg, [data-theme="dark"] .flatpickr-months .flatpickr-next-month svg { fill:#e6e8ea; }

/* ── изображения-иконки, которые рисуются тёмным по прозрачному ──────────────── */
[data-theme="dark"] .rp-copy { filter:invert(.8); }

/* бегущая обводка незаполненного (.rp-need в форме подачи) — рамка должна остаться прозрачной */
[data-theme="dark"] .form-control.rp-need, [data-theme="dark"] .choices__inner.rp-need,
[data-theme="dark"] input.rp-need, [data-theme="dark"] .rp-need { border-color:transparent !important; }
[data-theme="dark"] .form-control.rp-need, [data-theme="dark"] .choices__inner.rp-need, [data-theme="dark"] input.rp-need { --rp-need-fill:#16191c; }   /* внутри — цвет поля */

/* «чернила» графиков (серия «Мерч» в студии): тёмные в светлой теме, светлые — в тёмной */
:root { --rp-chart-ink: #1a1a1a; }
[data-theme="dark"] { --rp-chart-ink: #c2c7cd; }

/* пастельные метки студии (категории, услуги) — тёмный текст на светлой плашке и в тёмной теме */
[data-theme="dark"] .st-tag[style*="background"] { color:#1a1a1a; }
