/* Sdílený kontrast členské sekce a Správy.
   Plochy i text mají stejný motiv. Výrazná tlačítka a barevné tečky se nemění.
   Barevné hodnoty jsou v draci-tokens.css. */
:is(html.cleni-theme-light, html.cleni-theme-dark, html.cleni-sprava-embed),
:is(body.cleni-clenske-app, body.cleni-sprava-app) {
    --ds-muted: var(--draci-readable-muted) !important;
}

:is(html.cleni-theme-light, html.cleni-theme-dark, html.cleni-sprava-embed) body :is(.text-draci-pink, .cloud-home-tile__go),
:is(body.cleni-clenske-app, body.cleni-sprava-app) .text-draci-pink,
:is(html.cleni-theme-light, html.cleni-theme-dark) body .doch-day.is-today .doch-day__dow {
    color: var(--draci-pink-dark) !important;
}

:is(html.cleni-theme-light, html.cleni-theme-dark) body .vykon-kal__den.is-volno,
:is(body.cleni-clenske-app, body.cleni-sprava-app) .vykon-kal__den.is-volno {
    background: var(--ds-surface-2) !important;
    color: var(--ds-muted) !important;
}

/* Citace a reakce uvnitř růžové zprávy: bílý průsvitný podklad text zesvětloval. */
:is(html.cleni-theme-light, html.cleni-theme-dark) body .chat-bubble-mine .chat-reply-quote,
body.cleni-clenske-app .chat-bubble-mine .chat-reply-quote,
:is(html.cleni-theme-light, html.cleni-theme-dark) body .chat-bubble-mine .chat-reaction-pill:not(.mine),
body.cleni-clenske-app .chat-bubble-mine .chat-reaction-pill:not(.mine) {
    background: var(--draci-message-inset);
    color: var(--draci-on-solid-dark);
}
:is(html.cleni-theme-light, html.cleni-theme-dark) body .chat-bubble-other .chat-reply-name,
body.cleni-clenske-app .chat-bubble-other .chat-reply-name {
    color: var(--draci-pink-dark);
}

:is(html.cleni-theme-light, html.cleni-theme-dark, html.cleni-sprava-embed) body :is(.bg-green-50, .bg-green-100, .bg-green-200, .bg-emerald-50, .bg-emerald-100, .bg-emerald-200):not(.vykon-kal__den),
:is(body.cleni-clenske-app, body.cleni-sprava-app) :is(.bg-green-50, .bg-green-100, .bg-green-200, .bg-emerald-50, .bg-emerald-100, .bg-emerald-200):not(.vykon-kal__den) {
    background: var(--draci-note-success-bg) !important;
    color: var(--draci-note-success-ink) !important;
}
:is(html.cleni-theme-light, html.cleni-theme-dark, html.cleni-sprava-embed) body :is(.text-green-500, .text-green-600, .text-green-700, .text-green-800, .text-green-900, .text-emerald-500, .text-emerald-600, .text-emerald-700, .text-emerald-800, .text-emerald-900),
:is(body.cleni-clenske-app, body.cleni-sprava-app) :is(.text-green-500, .text-green-600, .text-green-700, .text-green-800, .text-green-900, .text-emerald-500, .text-emerald-600, .text-emerald-700, .text-emerald-800, .text-emerald-900) {
    color: var(--draci-note-success-ink) !important;
}

:is(html.cleni-theme-light, html.cleni-theme-dark, html.cleni-sprava-embed) body :is(.bg-amber-50, .bg-amber-100, .bg-amber-200, .bg-yellow-50, .bg-yellow-100, .bg-yellow-200, .bg-orange-50, .bg-orange-100, .bg-orange-200, .bg-yellow-50\/30):not(.vykon-kal__den),
:is(body.cleni-clenske-app, body.cleni-sprava-app) :is(.bg-amber-50, .bg-amber-100, .bg-amber-200, .bg-yellow-50, .bg-yellow-100, .bg-yellow-200, .bg-orange-50, .bg-orange-100, .bg-orange-200, .bg-yellow-50\/30):not(.vykon-kal__den) {
    background: var(--draci-note-warning-bg) !important;
    color: var(--draci-note-warning-ink) !important;
}
:is(html.cleni-theme-light, html.cleni-theme-dark, html.cleni-sprava-embed) body :is(.text-amber-500, .text-amber-600, .text-amber-700, .text-amber-800, .text-amber-900, .text-yellow-500, .text-yellow-600, .text-yellow-700, .text-yellow-800, .text-yellow-900, .text-orange-500, .text-orange-600, .text-orange-700, .text-orange-800, .text-orange-900),
:is(body.cleni-clenske-app, body.cleni-sprava-app) :is(.text-amber-500, .text-amber-600, .text-amber-700, .text-amber-800, .text-amber-900, .text-yellow-500, .text-yellow-600, .text-yellow-700, .text-yellow-800, .text-yellow-900, .text-orange-500, .text-orange-600, .text-orange-700, .text-orange-800, .text-orange-900) {
    color: var(--draci-note-warning-ink) !important;
}

:is(html.cleni-theme-light, html.cleni-theme-dark, html.cleni-sprava-embed) body :is(.bg-red-50, .bg-red-100, .bg-red-200, .bg-rose-50, .bg-rose-100, .bg-rose-200):not(.vykon-kal__den),
:is(body.cleni-clenske-app, body.cleni-sprava-app) :is(.bg-red-50, .bg-red-100, .bg-red-200, .bg-rose-50, .bg-rose-100, .bg-rose-200):not(.vykon-kal__den) {
    background: var(--draci-note-danger-bg) !important;
    color: var(--draci-note-danger-ink) !important;
}
:is(html.cleni-theme-light, html.cleni-theme-dark, html.cleni-sprava-embed) body :is(.text-red-500, .text-red-600, .text-red-700, .text-red-800, .text-red-900, .text-rose-500, .text-rose-600, .text-rose-700, .text-rose-800, .text-rose-900),
:is(body.cleni-clenske-app, body.cleni-sprava-app) :is(.text-red-500, .text-red-600, .text-red-700, .text-red-800, .text-red-900, .text-rose-500, .text-rose-600, .text-rose-700, .text-rose-800, .text-rose-900) {
    color: var(--draci-note-danger-ink) !important;
}

:is(html.cleni-theme-light, html.cleni-theme-dark, html.cleni-sprava-embed) body :is(.bg-blue-50, .bg-blue-100, .bg-blue-200, .bg-sky-50, .bg-sky-100, .bg-sky-200, .bg-indigo-50, .bg-indigo-100, .bg-indigo-200):not(.vykon-kal__den),
:is(body.cleni-clenske-app, body.cleni-sprava-app) :is(.bg-blue-50, .bg-blue-100, .bg-blue-200, .bg-sky-50, .bg-sky-100, .bg-sky-200, .bg-indigo-50, .bg-indigo-100, .bg-indigo-200):not(.vykon-kal__den) {
    background: var(--draci-note-info-bg) !important;
    color: var(--draci-note-info-ink) !important;
}
:is(html.cleni-theme-light, html.cleni-theme-dark, html.cleni-sprava-embed) body :is(.text-blue-500, .text-blue-600, .text-blue-700, .text-blue-800, .text-blue-900, .text-sky-500, .text-sky-600, .text-sky-700, .text-sky-800, .text-sky-900, .text-indigo-500, .text-indigo-600, .text-indigo-700, .text-indigo-800, .text-indigo-900),
:is(body.cleni-clenske-app, body.cleni-sprava-app) :is(.text-blue-500, .text-blue-600, .text-blue-700, .text-blue-800, .text-blue-900, .text-sky-500, .text-sky-600, .text-sky-700, .text-sky-800, .text-sky-900, .text-indigo-500, .text-indigo-600, .text-indigo-700, .text-indigo-800, .text-indigo-900) {
    color: var(--draci-note-info-ink) !important;
}

:is(html.cleni-theme-light, html.cleni-theme-dark, html.cleni-sprava-embed) body :is(.bg-teal-50, .bg-teal-100, .bg-teal-200, .bg-cyan-50, .bg-cyan-100, .bg-cyan-200, .bg-cyan-50\/70, .bg-cyan-50\/30, .bg-teal-50\/40):not(.vykon-kal__den),
:is(body.cleni-clenske-app, body.cleni-sprava-app) :is(.bg-teal-50, .bg-teal-100, .bg-teal-200, .bg-cyan-50, .bg-cyan-100, .bg-cyan-200, .bg-cyan-50\/70, .bg-cyan-50\/30, .bg-teal-50\/40):not(.vykon-kal__den) {
    background: var(--draci-note-teal-bg) !important;
    color: var(--draci-note-teal-ink) !important;
}
:is(html.cleni-theme-light, html.cleni-theme-dark, html.cleni-sprava-embed) body :is(.text-teal-500, .text-teal-600, .text-teal-700, .text-teal-800, .text-teal-900, .text-cyan-500, .text-cyan-600, .text-cyan-700, .text-cyan-800, .text-cyan-900),
:is(body.cleni-clenske-app, body.cleni-sprava-app) :is(.text-teal-500, .text-teal-600, .text-teal-700, .text-teal-800, .text-teal-900, .text-cyan-500, .text-cyan-600, .text-cyan-700, .text-cyan-800, .text-cyan-900) {
    color: var(--draci-note-teal-ink) !important;
}

:is(html.cleni-theme-light, html.cleni-theme-dark, html.cleni-sprava-embed) body :is(.bg-purple-50, .bg-purple-100, .bg-purple-200, .bg-violet-50, .bg-violet-100, .bg-violet-200, .bg-purple-50\/60):not(.vykon-kal__den),
:is(body.cleni-clenske-app, body.cleni-sprava-app) :is(.bg-purple-50, .bg-purple-100, .bg-purple-200, .bg-violet-50, .bg-violet-100, .bg-violet-200, .bg-purple-50\/60):not(.vykon-kal__den) {
    background: var(--draci-note-purple-bg) !important;
    color: var(--draci-note-purple-ink) !important;
}
:is(html.cleni-theme-light, html.cleni-theme-dark, html.cleni-sprava-embed) body :is(.text-purple-500, .text-purple-600, .text-purple-700, .text-purple-800, .text-purple-900, .text-violet-500, .text-violet-600, .text-violet-700, .text-violet-800, .text-violet-900),
:is(body.cleni-clenske-app, body.cleni-sprava-app) :is(.text-purple-500, .text-purple-600, .text-purple-700, .text-purple-800, .text-purple-900, .text-violet-500, .text-violet-600, .text-violet-700, .text-violet-800, .text-violet-900) {
    color: var(--draci-note-purple-ink) !important;
}

:is(html.cleni-theme-light, html.cleni-theme-dark, html.cleni-sprava-embed) body :is(.bg-pink-50, .bg-pink-100, .bg-pink-200, .bg-pink-50\/50, .bg-pink-50\/40, .bg-pink-50\/60):not(.vykon-kal__den),
:is(body.cleni-clenske-app, body.cleni-sprava-app) :is(.bg-pink-50, .bg-pink-100, .bg-pink-200, .bg-pink-50\/50, .bg-pink-50\/40, .bg-pink-50\/60):not(.vykon-kal__den) {
    background: var(--draci-note-pink-bg) !important;
    color: var(--draci-note-pink-ink) !important;
}
:is(html.cleni-theme-light, html.cleni-theme-dark, html.cleni-sprava-embed) body :is(.text-pink-500, .text-pink-600, .text-pink-700, .text-pink-800, .text-pink-900),
:is(body.cleni-clenske-app, body.cleni-sprava-app) :is(.text-pink-500, .text-pink-600, .text-pink-700, .text-pink-800, .text-pink-900) {
    color: var(--draci-note-pink-ink) !important;
}

:is(html.cleni-theme-light, html.cleni-theme-dark, html.cleni-sprava-embed) body :is(.text-gray-400, .text-gray-500, .text-slate-400, .text-slate-500),
:is(body.cleni-clenske-app, body.cleni-sprava-app) :is(.text-gray-400, .text-gray-500, .text-slate-400, .text-slate-500) {
    color: var(--ds-muted) !important;
}

:is(html.cleni-theme-light, html.cleni-theme-dark, html.cleni-sprava-embed) body :is(.text-gray-900, .text-gray-800, .text-gray-700, .text-slate-900, .text-slate-800, .text-slate-700),
:is(body.cleni-clenske-app, body.cleni-sprava-app) :is(.text-gray-900, .text-gray-800, .text-gray-700, .text-slate-900, .text-slate-800, .text-slate-700) {
    color: var(--ds-ink) !important;
}
:is(html.cleni-theme-light, html.cleni-theme-dark, html.cleni-sprava-embed) body :is(.text-gray-600, .text-slate-600),
:is(body.cleni-clenske-app, body.cleni-sprava-app) :is(.text-gray-600, .text-slate-600) {
    color: var(--ds-ink-2) !important;
}

/* Zelená/tyrkysová tlačítka s bílým textem měla nízký kontrast i za dne. */
:is(html.cleni-theme-light, html.cleni-theme-dark, html.cleni-sprava-embed) body :is(button, a).text-white:is(.bg-green-600, .bg-emerald-600),
:is(body.cleni-clenske-app, body.cleni-sprava-app) :is(button, a).text-white:is(.bg-green-600, .bg-emerald-600) {
    background: var(--draci-note-success-ink) !important;
    color: var(--draci-note-success-bg) !important;
}
:is(html.cleni-theme-light, html.cleni-theme-dark, html.cleni-sprava-embed) body :is(button, a).text-white:is(.bg-cyan-600, .bg-teal-600),
:is(body.cleni-clenske-app, body.cleni-sprava-app) :is(button, a).text-white:is(.bg-cyan-600, .bg-teal-600) {
    background: var(--draci-note-teal-ink) !important;
    color: var(--draci-note-teal-bg) !important;
}

/* Zvýrazněný tmavý řádek členského žebříčku se nepřevrací jako tlačítka Správy. */
:is(html.cleni-theme-light, html.cleni-theme-dark) body .bg-gray-900 :is(.text-gray-900, .text-gray-800, .text-gray-700),
body.cleni-clenske-app .bg-gray-900 :is(.text-gray-900, .text-gray-800, .text-gray-700) {
    color: var(--draci-on-solid-dark) !important;
}
:is(html.cleni-theme-light, html.cleni-theme-dark) body .bg-gray-900 :is(.text-gray-400, .text-gray-500, .text-gray-600),
body.cleni-clenske-app .bg-gray-900 :is(.text-gray-400, .text-gray-500, .text-gray-600) {
    color: var(--draci-on-dark-muted) !important;
}

/* Správa převrací tmavé ovladače podle motivu: převrátit i jejich vnitřní text. */
html.cleni-sprava-embed body :is(.bg-gray-900, .bg-black, button.bg-gray-800) :is(.text-white, .text-gray-900, .text-gray-800, .text-gray-700, .text-gray-600, .text-gray-500, .text-gray-400, .font-sport) {
    color: var(--draci-action-ink) !important;
}

/* Výkon: čísla na jasně žlutých/zelených dnech potřebují tmavý text i v noci. */
:is(html.cleni-theme-dark, html.cleni-sprava-embed) body .vykon-kal__den:is(.bg-amber-200, .bg-amber-400, .bg-emerald-500, .bg-rose-500, .bg-sky-500),
:is(body.cleni-clenske-app, body.cleni-sprava-app) .vykon-kal__den:is(.bg-amber-200, .bg-amber-400, .bg-emerald-500, .bg-rose-500, .bg-sky-500) {
    color: var(--draci-on-bright) !important;
}

/* Popisky na sytějším šedém podkladu potřebují o stupeň silnější text. */
:is(html.cleni-theme-light, html.cleni-theme-dark, html.cleni-sprava-embed) body :is(.bg-gray-200, .bg-slate-200, .bg-zinc-200) :is(.text-gray-400, .text-gray-500, .text-slate-400, .text-slate-500),
:is(body.cleni-clenske-app, body.cleni-sprava-app) :is(.bg-gray-200, .bg-slate-200, .bg-zinc-200) :is(.text-gray-400, .text-gray-500, .text-slate-400, .text-slate-500),
:is(html.cleni-theme-light, html.cleni-theme-dark, html.cleni-sprava-embed) body :is(.bg-gray-200, .bg-slate-200, .bg-zinc-200):is(.text-gray-400, .text-gray-500, .text-slate-400, .text-slate-500),
:is(body.cleni-clenske-app, body.cleni-sprava-app) :is(.bg-gray-200, .bg-slate-200, .bg-zinc-200):is(.text-gray-400, .text-gray-500, .text-slate-400, .text-slate-500) {
    color: var(--ds-ink-2) !important;
}

/* Bílé poloprůhledné řádky na tmavých kartách jsou jinak světlejší než jejich text. */
@media (prefers-color-scheme: dark) {
:is(html.cleni-theme-dark, html.cleni-sprava-embed) body :is(.odd\:bg-gray-50:nth-child(odd), .bg-gray-50, .bg-gray-50\/40, .bg-gray-50\/80, .bg-gray-100, .bg-gray-200, .bg-slate-50, .bg-slate-100, .bg-slate-200, .bg-zinc-50, .bg-zinc-100, .bg-zinc-200),
:is(body.cleni-clenske-app, body.cleni-sprava-app) :is(.odd\:bg-gray-50:nth-child(odd), .bg-white, .bg-gray-50, .bg-gray-50\/40, .bg-gray-50\/80, .bg-gray-100, .bg-gray-200, .bg-slate-50, .bg-slate-100, .bg-slate-200, .bg-zinc-50, .bg-zinc-100, .bg-zinc-200) {
    background: var(--ds-surface) !important;
    color: var(--ds-ink);
}
:is(html.cleni-theme-light, html.cleni-theme-dark, html.cleni-sprava-embed) body :is(.bg-white\/50, .bg-white\/60, .bg-white\/70, .bg-white\/80, .bg-white\/90):not(.vykon-kal__den),
:is(body.cleni-clenske-app, body.cleni-sprava-app) :is(.bg-white\/50, .bg-white\/60, .bg-white\/70, .bg-white\/80, .bg-white\/90):not(.vykon-kal__den) {
    background: var(--ds-surface-2) !important;
    color: var(--ds-ink);
}
}

/* Oprava nepodporovaných funkcí pouze pro starší prohlížeče.
   Základní tokeny mají vlastní fallback; zde se neopakují palety. */
@supports not (color: light-dark(white, black)) {
    body.cleni-sprava-app { --draci-canvas: var(--ds-canvas) !important; }
    .cleni-bell-panel {
        --bell-bg: var(--ds-surface) !important;
        --bell-ink: var(--ds-ink) !important;
        --bell-muted: var(--ds-muted) !important;
        --bell-line: var(--ds-line) !important;
        --bell-soft: var(--ds-surface-2) !important;
        --bell-hover: var(--ds-surface-3) !important;
        --bell-new: var(--draci-note-pink-bg) !important;
        --bell-full: var(--ds-ink-2) !important;
    }
    html.ck-page, body.ck-page, #cleni-native-chat, .ck {
        --ck-pink-soft: var(--draci-pink-soft) !important;
        --ck-pink-dark: var(--draci-pink-dark) !important;
        --ck-teal-soft: var(--draci-pink-soft) !important;
        --ck-teal-dark: var(--draci-pink-dark) !important;
        --ck-ink: var(--ds-ink) !important;
        --ck-muted: var(--ds-ink-2) !important;
        --ck-bg: var(--ds-canvas) !important;
        --ck-sheet: var(--ds-surface) !important;
        --ck-glass-border: var(--ds-line) !important;
        --ck-soft: var(--ds-fill) !important;
        --ck-row-line: var(--ds-line) !important;
        --ck-row-hover: var(--ds-fill) !important;
    }
    body.karta-page {
        --karta-ink: var(--ds-ink) !important;
        --karta-muted: var(--ds-ink-2) !important;
        --karta-line: var(--ds-line) !important;
        --karta-fill: var(--ds-fill) !important;
        --karta-sheet: var(--ds-surface) !important;
        --karta-canvas: var(--ds-canvas) !important;
        --karta-warn: var(--draci-note-warning-ink) !important;
        --karta-warn-bg: var(--draci-note-warning-bg) !important;
    }
    .aia-zprava.ja .aia-bublina, .aia-zprava.ai .aia-avatar,
    .aia-tlacitko-navrhy, .aia-btn-provest, .aia-uvod-icon {
        background: var(--draci-solid-dark);
        color: var(--draci-on-solid-dark);
    }
    .aia-varovani {
        background: var(--draci-note-warning-bg);
        color: var(--draci-note-warning-ink);
    }
}
