/* App shell: teal/slate accent (no purple/magenta). Radzen theme variables overridden so toggles + buttons match. */
:root,
html {
    --app-radius: 8px;
    --app-radius-sm: 6px;

    /* Dark palette (GitHub Dark-ish). Defined globally so scoped dark rules can safely reference it. */
    --app-dark-bg-0: #0d1117;
    --app-dark-bg-1: #161b22;
    --app-dark-bg-2: #21262d;
    --app-dark-border: #30363d;
    --app-dark-border-2: #3d444d;

    --app-dark-text: #c9d1d9;
    --app-dark-text-muted: #8b949e;
    --app-dark-text-subtle: #6e7681;
    --app-dark-text-title: #f0f6fc;

    --app-dark-danger: #f85149;
    --app-dark-warning: #d29922;
    --app-dark-success: #3fb950;
    --app-dark-info: #58a6ff;
    /* Primary = vivid teal (600/500). Darker #0f766e looked washed-out on checkboxes / switches. */
    --rz-primary: #0d9488 !important;
    --rz-primary-dark: #0f766e !important;
    --rz-primary-darker: #115e59 !important;
    --rz-primary-light: #14b8a6 !important;
    --rz-primary-lighter: rgba(13, 148, 136, 0.22) !important;
    --rz-on-primary: #ffffff !important;
    --rz-on-primary-light: #ffffff !important;
    --rz-on-primary-lighter: #ffffff !important;
    --rz-on-primary-dark: #ffffff !important;
    --rz-on-primary-darker: #ffffff !important;
    --rz-outline-color: #0d9488 !important;
    --rz-secondary: #64748b !important;
    --rz-secondary-dark: #475569 !important;
    --rz-secondary-darker: #334155 !important;
    --rz-secondary-light: #94a3b8 !important;
    --rz-secondary-lighter: rgba(100, 116, 139, 0.16) !important;
    --rz-on-secondary: #ffffff !important;
    --rz-on-secondary-lighter: #64748b !important;
    --rz-link-color: #0d9488 !important;
    --rz-link-hover-color: #0f766e !important;
    /* Checkbox / switch "on": brighter fill (Radzen checkbox uses --rz-primary by default) */
    --rz-checkbox-checked-background-color: #14b8a6 !important;
    --rz-checkbox-checked-hover-background-color: #0d9488 !important;
    /* Switch track / thumb */
    --rz-switch-checked-background-color: #14b8a6 !important;
    --rz-switch-checked-circle-background-color: #ffffff !important;
}

/* HtmlEditor toolbar: keep neutral / teal (Material theme can tint icon buttons purple/blue) */
.rz-html-editor-toolbar .rz-button.rz-variant-text {
    color: var(--rz-base-800) !important;
}

.rz-html-editor-toolbar .rz-button.rz-variant-text:hover:not(:disabled) {
    background-color: var(--rz-base-200) !important;
    color: var(--rz-primary-darker) !important;
}

/* Switches: Radzen material theme uses --rz-on-primary-lighter for thumb; we reset tokens above — enforce track + thumb */
.rz-switch.rz-switch-checked .rz-switch-circle {
    background: var(--rz-switch-checked-background-color) !important;
}

.rz-switch.rz-switch-checked .rz-switch-circle:before {
    background: var(--rz-switch-checked-circle-background-color) !important;
}

/* Switch: Radzen adds a second box-shadow on thumb hover (10px "ripple"); it sits only behind the circle and can stay purple from theme — keep only the normal thumb shadow */
.rz-switch .rz-switch-circle:hover:not(.rz-disabled):before,
.rz-switch.rz-switch-checked .rz-switch-circle:hover:not(.rz-disabled):before {
    box-shadow: var(--rz-switch-box-shadow) !important;
}

/* Checkbox: ensure vivid "on" state (tokens above + hard fallback) */
.rz-chkbox-box.rz-state-active {
    background-color: #14b8a6 !important;
}

.rz-chkbox-box.rz-state-active:hover:not(.rz-state-disabled) {
    background-color: #0d9488 !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-chkbox-box.rz-state-active {
    background-color: #2dd4bf !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-chkbox-box.rz-state-active:hover:not(.rz-state-disabled) {
    background-color: #14b8a6 !important;
}

/* Filled primary: explicit hex so Radzen material.css (#4340D2) cannot leak through */
.rz-button.rz-variant-filled.rz-primary,
.rz-button.rz-button-primary {
    background-color: #0d9488 !important;
    border-color: #0d9488 !important;
    color: #ffffff !important;
}

.rz-button.rz-variant-filled.rz-primary:hover:not(:disabled),
.rz-button.rz-button-primary:hover:not(:disabled) {
    background-color: #0f766e !important;
    border-color: #0f766e !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-button.rz-variant-filled.rz-primary,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-button.rz-button-primary {
    background-color: #14b8a6 !important;
    border-color: #14b8a6 !important;
    color: #0f172a !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-button.rz-variant-filled.rz-primary:hover:not(:disabled),
html:has(#radzen-theme-link[href*="material-dark"]) .rz-button.rz-button-primary:hover:not(:disabled) {
    background-color: #0d9488 !important;
    border-color: #0d9488 !important;
    color: #ffffff !important;
}

.rz-button.rz-variant-filled.rz-primary:focus-visible,
.rz-button.rz-button-primary:focus-visible {
    box-shadow: 0 0 0 2px var(--rz-base-100), 0 0 0 4px rgba(15, 118, 110, 0.35) !important;
}

html, body {
    font-family: Roboto, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    min-height: 100%;
    margin: 0;
    background-color: var(--rz-body-background-color);
    color: var(--rz-text-color);
    max-width: 100%;
    overflow-x: hidden;
}

/* Header */
.culture-picker__btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--rz-base-800);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 999px;
    cursor: pointer;
    line-height: 1.25;
}

.culture-picker__btn:hover:not(:disabled) {
    background: var(--rz-base-200);
}

.culture-picker__btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.culture-picker__sep {
    color: var(--rz-base-500);
    user-select: none;
    font-size: 0.875rem;
}

/* Keep header neutral — never primary (purple) bar */
.rz-header.app-header {
    background: var(--rz-base-100) !important;
    color: var(--rz-text-title-color) !important;
    border-bottom: 1px solid var(--rz-base-300) !important;
    box-shadow: none !important;
}

.app-header__bar {
    min-height: 60px;
    padding: 14px 22px;
    box-sizing: border-box;
}

.rz-header.app-header .rz-text-h5,
.rz-header.app-header .rz-text {
    color: var(--rz-text-title-color) !important;
    letter-spacing: -0.01em;
}

.app-header__brand {
    text-decoration: none;
    color: inherit;
    gap: 12px;
    min-width: 0;
}

.app-header__logo {
    flex-shrink: 0;
    display: block;
}

.app-header__title {
    min-width: 0;
}

.app-version {
    font-size: 0.75rem;
    font-weight: 650;
    letter-spacing: 0.02em;
    color: var(--rz-text-tertiary-color);
    user-select: none;
}

.rz-header.app-header .rz-button {
    color: var(--rz-text-color);
    border-radius: 999px;
}

.rz-header.app-header .rz-button:hover {
    background-color: var(--rz-base-200) !important;
}

.rz-header.app-header .rz-toggle-button.rz-state-active,
.rz-header.app-header .rz-toggle-button:hover {
    background-color: var(--rz-base-200) !important;
}

/* Sidebar */
.rz-sidebar {
    background: var(--rz-base-50) !important;
    border-right: 1px solid var(--rz-base-200) !important;
    padding: 0 !important;
}

.rz-sidebar .rz-panel-menu {
    margin: 0;
    padding: 8px;
    border-radius: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.rz-sidebar .rz-navigation-item-link {
    border-radius: 999px;
    color: var(--rz-base-800);
}

.rz-sidebar .rz-navigation-item-wrapper-active .rz-navigation-item-link-active {
    background: var(--rz-primary-lighter) !important;
    color: var(--rz-primary-darker) !important;
    font-weight: 600;
}

/* Sidebar: Blazor NavLink + inline SVG (no Material ligatures) */
.app-sidenav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 14px 20px 18px;
    box-sizing: border-box;
    min-height: 100%;
}

.app-sidenav__top {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.app-sidenav__spacer {
    flex: 1;
}

.app-sidenav__link--feedback {
    margin-top: 10px;
}

.app-sidenav__link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 10px;
    color: var(--rz-text-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    line-height: 1.35;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.app-sidenav__link:hover {
    background-color: var(--rz-base-200);
    color: var(--rz-text-title-color);
}

.app-sidenav__link.active {
    background: var(--rz-primary-lighter);
    color: var(--rz-primary-darker);
    font-weight: 600;
}

.app-sidenav__glyph {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: var(--rz-text-secondary-color);
}

.app-sidenav__link.active .app-sidenav__glyph {
    color: var(--rz-primary-darker);
}

.app-sidenav__svg {
    width: 22px;
    height: 22px;
    display: block;
}

.app-sidenav__text {
    flex: 1;
    min-width: 0;
}

.app-badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    margin-left: 10px;
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff;
    font-weight: 750;
    font-size: 0.75rem;
    line-height: 1;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.18);
    vertical-align: middle;
}

/* Body canvas */
.rz-body {
    background-color: var(--rz-base-100) !important;
    display: flex !important;
    overflow: hidden !important;
}

.app-body {
    background: var(--rz-base-50);
    border: none;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: auto;
    padding: 1.35rem 1.75rem 2rem 1.5rem;
    box-sizing: border-box;
}

.rz-text-h4, .rz-text-h5 {
    letter-spacing: -0.02em;
    color: var(--rz-base-900);
}

/* Tabs */
.app-tab-panel {
    min-height: 14rem;
    height: 100%;
    display: flex;
    overflow: auto;
}

.app-page-title {
    margin-top: 0;
    letter-spacing: -0.02em;
}

.app-tabsbar {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--rz-base-200);
    margin-bottom: 14px;
    padding-bottom: 2px;
}

.app-tab {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--rz-base-800);
    padding: 10px 12px;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font: inherit;
    font-weight: 500;
}

.app-tab:hover {
    background: var(--rz-base-200);
}

.app-tab.is-active {
    color: #0d9488 !important;
    font-weight: 600;
    box-shadow: inset 0 -3px 0 #0d9488 !important;
}

/* Admin: news form — full-width fields, compact hints (not half-page side text) */
.app-admin-news-form {
    max-width: 52rem;
}

.app-admin-news-form__field {
    width: 100%;
}

.app-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.app-field__label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--rz-text-color);
}

.app-field__editor {
    width: 100%;
}

.app-field-hint {
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--rz-base-600);
    margin-top: 6px;
    max-width: 42rem;
}

.app-feedback-admin-message {
    white-space: pre-wrap;
    line-height: 1.45;
}

.app-feedback-admin-img {
    max-width: 100%;
    height: auto;
    border-radius: var(--app-radius-sm);
    border: 1px solid var(--rz-base-300);
    background: var(--rz-base-100);
}

.app-feedback-card {
    max-width: 52rem;
}

.app-feedback-upload {
    display: grid;
    gap: 0.35rem;
}

.app-requests-layout {
    display: grid;
    gap: 18px;
    align-items: start;
}

.app-request-card {
    cursor: pointer;
    border-radius: var(--app-radius);
}

.app-request-card--unread {
    border-color: rgba(239, 68, 68, 0.45) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.app-request-card__top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.app-request-card__title {
    font-weight: 650;
    color: var(--rz-text-title-color);
    font-size: 0.9375rem;
}

.app-request-card__status {
    font-size: 0.8125rem;
    font-weight: 650;
    color: var(--rz-text-secondary-color);
    white-space: nowrap;
}

.app-request-card__body {
    white-space: pre-wrap;
    line-height: 1.45;
}

.app-request-card__admin {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--rz-base-200);
}

.app-request-card__admin-label {
    font-weight: 650;
    font-size: 0.8125rem;
    color: var(--rz-base-700);
    margin-bottom: 6px;
}

.app-request-card__admin-text {
    white-space: pre-wrap;
    line-height: 1.45;
}

.app-request-card__img {
    max-width: 100%;
    height: auto;
    border-radius: var(--app-radius-sm);
    border: 1px solid var(--rz-base-300);
    background: var(--rz-base-100);
    display: block;
}

/* Admin: settings row — label + switch */
.app-settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    max-width: 36rem;
    padding: 12px 16px;
    border: 1px solid var(--rz-base-200);
    border-radius: var(--app-radius);
    background: var(--rz-base-50);
}

/* Home tab: news + popular servers (two columns on wide screens) */
.app-home-layout {
    display: grid;
    gap: 1.5rem;
    align-items: start;
}

.app-home-layout__col {
    min-height: 0;
}

@media (min-width: 960px) {
    .app-home-layout__col {
        max-height: calc(100vh - 220px);
        overflow: auto;
        padding-right: 6px;
    }
}

@media (min-width: 960px) {
    .app-home-layout {
        grid-template-columns: 1fr 1fr;
    }
}

.app-home-section-title {
    margin-top: 0;
    letter-spacing: -0.02em;
    color: var(--rz-text-title-color);
}

/* Servers: responsive cards */
.server-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.server-card-grid--home-popular {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.server-card--compact {
    padding: 14px 14px 12px;
    gap: 10px;
}

.server-card--compact .server-card__title {
    font-size: 1rem;
}

.server-card--compact .server-card__qr {
    padding: 8px;
    align-self: center;
}

.server-card--compact .server-card__qr img {
    width: 200px;
    height: 200px;
}

.server-card--compact .server-card__hint {
    font-size: 0.6875rem;
}

.server-card {
    border: 1px solid var(--rz-base-200);
    border-radius: var(--app-radius);
    background: var(--rz-base-50);
    padding: 18px 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.server-card__title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--rz-text-title-color);
    line-height: 1.3;
    margin: 0;
}

.server-card__meta {
    font-size: 0.8125rem;
    color: var(--rz-text-secondary-color);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.server-card__endpoint {
    font-weight: 600;
    color: var(--rz-text-color);
    letter-spacing: 0.01em;
}

.server-card__location {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    color: var(--rz-text-color);
}

.server-card__flag {
    font-size: 1.35rem;
    line-height: 1;
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

/* Unicode regional-indicator flags (no external images) — force color emoji stack */
.server-card__flag-emoji {
    display: inline-block;
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
    font-variant-emoji: emoji;
    font-style: normal;
    letter-spacing: normal;
}

.server-card__flag-svg {
    width: 32px;
    height: 24px;
    flex-shrink: 0;
    border-radius: 4px;
    object-fit: cover;
    box-shadow: 0 0 0 1px var(--rz-base-300);
    display: block;
}

.server-card__flagimg {
    width: 32px;
    height: 24px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px var(--rz-base-300);
}

/* Admin: user ↔ server checkboxes */
.app-user-servers-editor {
    max-width: 48rem;
}

.app-user-servers-editor__row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
}

.app-user-servers-editor__server-block {
    padding: 10px 0 6px;
    border-bottom: 1px solid var(--rz-base-200);
}

.app-user-servers-editor__server-block:last-child {
    border-bottom: 0;
}

.app-user-servers-editor__connections {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.app-user-servers-editor__conn-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.app-admin-user-note-preview {
    display: inline-block;
    max-width: 7.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
    font-size: 0.8125rem;
    color: var(--rz-base-700);
}

/* User servers: connection variant tabs above card */
.server-card-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.server-card__connection-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.server-card__connection-tabs--compact {
    gap: 4px;
}

.server-conn-tab {
    appearance: none;
    border: 1px solid var(--rz-base-300);
    background: var(--rz-base-100);
    color: var(--rz-base-800);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    line-height: 1.25;
    transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.server-conn-tab:hover {
    background: var(--rz-base-200);
    border-color: var(--rz-base-400);
}

.server-conn-tab.is-active {
    background: var(--rz-primary-lighter);
    border-color: var(--rz-primary);
    color: var(--rz-primary-darker);
    font-weight: 600;
}

.server-conn-tab--compact {
    font-size: 0.75rem;
    padding: 4px 10px;
}

.server-card__url {
    font-size: 0.75rem;
    color: var(--rz-text-tertiary-color);
    line-height: 1.4;
    word-break: break-all;
}

.server-card__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.server-chip {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--rz-base-200);
    color: var(--rz-base-900);
}

.server-chip--ok {
    background: var(--rz-success-lighter);
    color: var(--rz-success-darker);
}

.server-chip--bad {
    background: var(--rz-danger-lighter);
    color: var(--rz-danger-darker);
}

.server-chip--ping {
    background: rgba(59, 130, 246, 0.14);
    color: #1d4ed8;
}

.server-card__qr {
    align-self: center;
    border: 2px solid var(--rz-base-300);
    border-radius: var(--app-radius-sm);
    padding: 12px;
    background: var(--rz-base-100);
    cursor: pointer;
    line-height: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.server-card__qr--empty {
    cursor: default;
    min-height: 160px;
    min-width: 160px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    line-height: normal;
    box-shadow: none;
}

.server-card__qr:focus-visible {
    outline: 2px solid var(--rz-primary);
    outline-offset: 2px;
}

.server-card__qr img {
    display: block;
    width: 220px;
    height: 220px;
    image-rendering: pixelated;
}

.server-card__hint {
    font-size: 0.75rem;
    color: var(--rz-base-700);
    text-align: center;
    max-width: 22rem;
    margin-left: auto;
    margin-right: auto;
}

/* Auth */
.auth-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.auth-layout__toolbar {
    flex-shrink: 0;
    min-height: 56px;
    padding: 10px 18px 10px 16px;
    box-sizing: border-box;
    background: var(--rz-base-100);
    border-bottom: 1px solid var(--rz-base-300);
    gap: 12px;
}

.auth-layout__brand {
    gap: 12px;
    text-decoration: none;
    color: var(--rz-text-title-color);
    min-width: 0;
}

.auth-layout__logo {
    flex-shrink: 0;
    display: block;
}

.auth-layout__title {
    font-weight: 650;
    font-size: 1rem;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.auth-shell {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    flex: 1;
    width: 100%;
    max-width: 26rem;
    margin-left: auto;
    margin-right: auto;
    padding: 2rem 1.5rem 2.75rem;
}

.auth-layout__toolbar .app-version {
    display: none;
}

/* ---- Mobile (<=600px) ---- */
@media (max-width: 600px) {
    .app-header__bar {
        padding: 10px 12px;
        gap: 10px;
    }

    .app-header__brand {
        gap: 10px;
    }

    .app-version {
        display: none;
    }

    .app-body {
        padding: 1rem 0.9rem calc(1.35rem + 78px);
    }

    .server-card-grid {
        grid-template-columns: 1fr;
    }

    .server-card {
        padding: 14px 14px 12px;
    }

    .server-card__qr img {
        width: 160px;
        height: 160px;
    }

    .server-card__connection-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }

    .server-card__connection-tabs::-webkit-scrollbar {
        height: 6px;
    }

    .server-card__url {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .auth-shell {
        padding: 1.25rem 1rem 2rem;
        max-width: 26rem;
    }

    .auth-card {
        padding: 1.5rem 1.25rem 1.6rem;
    }

    .auth-layout__toolbar {
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* Bottom navigation (mobile only) */
.app-bottomnav {
    display: none;
}

/* Nav breakpoint: must match sidebar responsive collapse */
@media (max-width: 900px) {
    .rz-sidebar {
        display: none !important;
    }

    /* Ensure content isn't covered by the bottom bar */
    .app-body {
        padding-bottom: calc(2rem + 78px) !important;
    }

    .app-bottomnav {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 1fr;
        align-items: stretch;
        gap: 6px;
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: 10px;
        box-sizing: border-box;
        padding: 8px 10px;
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
        border-radius: 16px;
        border: 1px solid var(--rz-base-200);
        background: rgba(255, 255, 255, 0.82);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        box-shadow: 0 18px 50px rgba(2, 6, 23, 0.12);
        z-index: 10000;
    }

    html:has(#radzen-theme-link[href*="material-dark"]) .app-bottomnav {
        background: rgba(13, 18, 24, 0.78);
        border-color: rgba(148, 163, 184, 0.18);
        box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
    }

    .app-bottomnav__item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 10px 8px;
        border-radius: 14px;
        text-decoration: none;
        color: var(--rz-text-secondary-color);
        min-width: 0;
        transition: background-color 0.15s ease, color 0.15s ease;
    }

    .app-bottomnav__item:hover {
        background: rgba(13, 148, 136, 0.12);
        color: var(--rz-text-title-color);
    }

    .app-bottomnav__item.active {
        background: var(--rz-primary-lighter);
        color: var(--rz-primary-darker);
        font-weight: 650;
    }

    html:has(#radzen-theme-link[href*="material-dark"]) .app-bottomnav__item.active {
        background: rgba(45, 212, 191, 0.14);
        color: #5eead4;
    }

    .app-bottomnav__icon {
        width: 24px;
        height: 24px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: relative;
    }

    .app-bottomnav__icon svg {
        width: 22px;
        height: 22px;
        display: block;
    }

    .app-bottomnav__label {
        font-size: 0.75rem;
        line-height: 1.1;
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        text-align: center;
    }

    .app-bottomnav__badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 18px;
        height: 18px;
        padding: 0 6px;
        margin-left: 6px;
        border-radius: 999px;
        background: #ef4444;
        color: #ffffff;
        font-weight: 750;
        font-size: 0.75rem;
        line-height: 1;
        box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.18);
        vertical-align: middle;
    }
}

.auth-card {
    width: 100%;
    border-radius: var(--app-radius);
    border: 1px solid var(--rz-base-200);
    background: var(--rz-base-50);
    padding: 2rem 1.75rem 2.25rem;
    box-sizing: border-box;
}

.auth-card--register .auth-card__form--register {
    margin-top: 0.25rem;
}

.auth-card__intro {
    margin-bottom: 1.75rem;
}

.auth-card__subtitle {
    color: var(--rz-text-secondary-color) !important;
    line-height: 1.45;
}

.auth-card__form .rz-inputtext {
    width: 100%;
    box-sizing: border-box;
    border-radius: var(--app-radius-sm);
    margin-top: 0;
    padding: 0.65rem 0.75rem;
    min-height: 2.75rem;
}

.auth-card__label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--rz-text-color);
}

.auth-card__field {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* News list cards: Radzen dark theme can yield low-contrast body text; force theme tokens. */
.news-card.rz-card {
    background-color: var(--rz-base-100) !important;
    border: 1px solid var(--rz-base-300) !important;
    color: var(--rz-text-color) !important;
}

.news-card .news-card__title {
    color: var(--rz-text-title-color) !important;
}

.news-card .news-card__meta {
    color: var(--rz-text-secondary-color) !important;
    opacity: 1 !important;
}

.news-body {
    line-height: 1.55;
    color: var(--rz-text-color);
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* Override pasted inline colors (e.g. #333 on dark card) so content stays readable */
.news-card .news-body,
.news-card .news-body p,
.news-card .news-body li,
.news-card .news-body td,
.news-card .news-body th,
.news-card .news-body dd,
.news-card .news-body dt,
.news-card .news-body span,
.news-card .news-body div {
    color: var(--rz-text-color) !important;
}

.news-card .news-body h1,
.news-card .news-body h2,
.news-card .news-body h3,
.news-card .news-body h4 {
    color: var(--rz-text-title-color) !important;
}

.news-card .news-body a {
    color: var(--rz-primary) !important;
}

.news-card .news-body pre,
.news-card .news-body code {
    color: var(--rz-base-900) !important;
    background-color: var(--rz-base-200) !important;
}

.news-card .news-body pre code {
    color: inherit !important;
    background: transparent !important;
}

.news-body img {
    max-width: 100%;
    height: auto;
}

.news-body a {
    color: var(--rz-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.news-body p,
.news-body li,
.news-body td,
.news-body th,
.news-body dd,
.news-body dt {
    color: var(--rz-text-color);
}

.news-body pre,
.news-body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.875em;
    background: var(--rz-base-200);
    color: var(--rz-base-900);
    border-radius: 6px;
}

.news-body pre {
    padding: 0.75rem 1rem;
    overflow-x: auto;
    border: 1px solid var(--rz-base-300);
}

.news-body code {
    padding: 0.12em 0.35em;
}

.news-body pre code {
    padding: 0;
    background: transparent;
    color: inherit;
    border-radius: 0;
}

.news-body h1,
.news-body h2,
.news-body h3,
.news-body h4 {
    color: var(--rz-text-title-color);
    font-weight: 600;
}

a, .btn-link {
    color: var(--rz-primary);
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e52790;
}

.validation-message {
    color: #e52790;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* --- Dark appearance: Radzen swaps #radzen-theme-link to material-dark; harmonize shell + grids --- */
html:has(#radzen-theme-link[href*="material-dark"]) {
    color-scheme: dark;
    /*
      Dark palette inspired by GitHub Dark, adapted to app branding (teal primary).
      Goal: readable text everywhere + consistent surfaces/borders across ALL Radzen controls used in the app.
    */
    /* Surfaces (GitHub Dark-ish) */
    --app-dark-bg-0: #0d1117;
    --app-dark-bg-1: #161b22;
    --app-dark-bg-2: #21262d;
    --app-dark-border: #30363d;
    --app-dark-border-2: #3d444d;
    /* Text */
    --app-dark-text: #c9d1d9;
    --app-dark-text-muted: #8b949e;
    --app-dark-text-subtle: #6e7681;
    --app-dark-text-title: #f0f6fc;
    /* Status */
    --app-dark-danger: #f85149;
    --app-dark-warning: #d29922;
    --app-dark-success: #3fb950;
    --app-dark-info: #58a6ff;
    /* Primary (brand teal) */
    --rz-primary: #2dd4bf !important;
    --rz-primary-light: #5eead4 !important;
    --rz-primary-lighter: rgba(45, 212, 191, 0.18) !important;
    --rz-primary-dark: #14b8a6 !important;
    --rz-primary-darker: #0f766e !important;
    --rz-on-primary: #0b1220 !important;
    --rz-on-primary-light: #0b1220 !important;
    --rz-on-primary-lighter: #ecfdf5 !important;
    --rz-on-primary-dark: #ffffff !important;
    --rz-on-primary-darker: #ffffff !important;
    --rz-outline-color: #2dd4bf !important;
    /* Radzen base tokens used throughout this app */
    --rz-body-background-color: var(--app-dark-bg-0) !important;
    --rz-text-color: var(--app-dark-text) !important;
    --rz-text-title-color: var(--app-dark-text-title) !important;
    --rz-text-secondary-color: var(--app-dark-text-muted) !important;
    --rz-text-tertiary-color: var(--app-dark-text-subtle) !important;
    /* "base" scale (app.css heavily uses --rz-base-*) */
    --rz-base-50: var(--app-dark-bg-0) !important;
    --rz-base-100: var(--app-dark-bg-1) !important;
    --rz-base-200: var(--app-dark-bg-2) !important;
    --rz-base-300: var(--app-dark-border) !important;
    --rz-base-400: var(--app-dark-border-2) !important;
    --rz-base-500: var(--app-dark-text-subtle) !important;
    --rz-base-600: var(--app-dark-text-muted) !important;
    --rz-base-700: #b1bac4 !important;
    --rz-base-800: var(--app-dark-text) !important;
    --rz-base-900: var(--app-dark-text-title) !important;
    /* Links */
    --rz-link-color: #79c0ff !important;
    --rz-link-hover-color: #a5d6ff !important;
    /* Checkboxes / switches */
    --rz-checkbox-checked-background-color: #2dd4bf !important;
    --rz-checkbox-checked-hover-background-color: #14b8a6 !important;
    --rz-switch-checked-background-color: #2dd4bf !important;
    --rz-switch-checked-circle-background-color: #ffffff !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-sidebar {
    background: var(--app-dark-bg-1) !important;
    border-right-color: var(--app-dark-border) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .app-body {
    background: var(--app-dark-bg-0) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-body {
    background-color: var(--app-dark-bg-0) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-header.app-header {
    background: var(--app-dark-bg-0) !important;
    border-bottom-color: var(--app-dark-border) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .app-sidenav__link:hover {
    background-color: var(--app-dark-bg-2) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .server-card {
    background: var(--app-dark-bg-1) !important;
    border-color: var(--app-dark-border) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .server-card__hint {
    color: var(--app-dark-text-muted) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .app-settings-row {
    background: var(--app-dark-bg-1) !important;
    border-color: var(--app-dark-border) !important;
}

/* DataGrid: avoid pure black cells; match slate panel */
html:has(#radzen-theme-link[href*="material-dark"]) .app-admin-datagrid .rz-datatable,
html:has(#radzen-theme-link[href*="material-dark"]) .app-admin-datagrid .rz-grid-table,
html:has(#radzen-theme-link[href*="material-dark"]) .app-admin-datagrid table {
    background-color: var(--app-dark-bg-1) !important;
    color: var(--app-dark-text) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .app-admin-datagrid .rz-datatable-thead th,
html:has(#radzen-theme-link[href*="material-dark"]) .app-admin-datagrid thead th {
    background-color: var(--app-dark-bg-2) !important;
    color: var(--app-dark-text-title) !important;
    border-color: var(--app-dark-border) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .app-admin-datagrid .rz-datatable-data td,
html:has(#radzen-theme-link[href*="material-dark"]) .app-admin-datagrid tbody td {
    background-color: var(--app-dark-bg-1) !important;
    color: var(--app-dark-text) !important;
    border-color: var(--app-dark-border) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .app-admin-datagrid .rz-datatable-data tr.rz-state-highlight td,
html:has(#radzen-theme-link[href*="material-dark"]) .app-admin-datagrid tbody tr:hover td {
    background-color: var(--app-dark-bg-2) !important;
}

/* Dark: sidebar + tabs — inactive items were nearly invisible on slate */
html:has(#radzen-theme-link[href*="material-dark"]) .app-sidenav__link {
    color: var(--app-dark-text) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .app-sidenav__link:hover {
    color: var(--app-dark-text-title) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .app-sidenav__link.active {
    background: rgba(45, 212, 191, 0.16) !important;
    color: #5eead4 !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .app-sidenav__glyph {
    color: var(--app-dark-text-muted) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .app-sidenav__link.active .app-sidenav__glyph {
    color: #5eead4 !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .app-tab {
    color: var(--app-dark-text-muted) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .app-tab:hover {
    color: var(--app-dark-text-title) !important;
    background: var(--app-dark-bg-2) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .app-tab.is-active {
    color: #2dd4bf !important;
    box-shadow: inset 0 -3px 0 #2dd4bf !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .app-tabsbar {
    border-bottom-color: var(--app-dark-border) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .app-page-title,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-text-h4 {
    color: var(--app-dark-text-title) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-header.app-header .rz-text-h5,
html:has(#radzen-theme-link[href*="material-dark"]) .app-header__title {
    color: var(--app-dark-text-title) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .culture-picker__btn {
    color: var(--app-dark-text) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .culture-picker__btn:hover:not(:disabled) {
    background: var(--app-dark-bg-2) !important;
    color: var(--app-dark-text-title) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .culture-picker__sep {
    color: var(--app-dark-text-subtle) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .auth-layout__toolbar {
    background: var(--app-dark-bg-0) !important;
    border-bottom-color: var(--app-dark-border) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .auth-layout__title {
    color: var(--app-dark-text-title) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-header.app-header .rz-button {
    color: var(--app-dark-text) !important;
}

/* News cards: Radzen dark cards can stay mid-grey; lift surface + text for WCAG-like contrast */
html:has(#radzen-theme-link[href*="material-dark"]) .news-card.rz-card {
    background-color: var(--app-dark-bg-1) !important;
    border-color: var(--app-dark-border) !important;
    color: var(--app-dark-text) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .news-card .news-card__title {
    color: var(--app-dark-text-title) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .news-card .news-card__meta {
    color: var(--app-dark-text-muted) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .news-card .news-body,
html:has(#radzen-theme-link[href*="material-dark"]) .news-card .news-body p,
html:has(#radzen-theme-link[href*="material-dark"]) .news-card .news-body li,
html:has(#radzen-theme-link[href*="material-dark"]) .news-card .news-body td,
html:has(#radzen-theme-link[href*="material-dark"]) .news-card .news-body th,
html:has(#radzen-theme-link[href*="material-dark"]) .news-card .news-body dd,
html:has(#radzen-theme-link[href*="material-dark"]) .news-card .news-body dt,
html:has(#radzen-theme-link[href*="material-dark"]) .news-card .news-body span,
html:has(#radzen-theme-link[href*="material-dark"]) .news-card .news-body div {
    color: var(--app-dark-text) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .news-card .news-body h1,
html:has(#radzen-theme-link[href*="material-dark"]) .news-card .news-body h2,
html:has(#radzen-theme-link[href*="material-dark"]) .news-card .news-body h3,
html:has(#radzen-theme-link[href*="material-dark"]) .news-card .news-body h4 {
    color: var(--app-dark-text-title) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .news-card .news-body a {
    color: #79c0ff !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .news-card .news-body pre,
html:has(#radzen-theme-link[href*="material-dark"]) .news-card .news-body code {
    color: var(--app-dark-text) !important;
    background-color: var(--app-dark-bg-2) !important;
    border-color: var(--app-dark-border) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .news-card .news-body pre code {
    color: inherit !important;
    background: transparent !important;
}

/* ---- Dark: Radzen + native controls (inputs, dropdowns, overlays) ---- */
html:has(#radzen-theme-link[href*="material-dark"]) .rz-card,
html:has(#radzen-theme-link[href*="material-dark"]) .auth-card {
    background: var(--app-dark-bg-1) !important;
    border-color: var(--app-dark-border) !important;
    color: var(--app-dark-text) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-inputtext,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-textarea,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-dropdown,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-autocomplete,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-spinner,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-password {
    background-color: var(--app-dark-bg-2) !important;
    color: var(--app-dark-text) !important;
    border-color: var(--app-dark-border) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-inputtext::placeholder,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-textarea::placeholder {
    color: var(--app-dark-text-subtle) !important;
    opacity: 1 !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-inputtext:focus,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-textarea:focus,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-dropdown:focus-within {
    border-color: #2dd4bf !important;
    box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.25) !important;
    outline: none !important;
}

/* DropDown popup panel */
html:has(#radzen-theme-link[href*="material-dark"]) .rz-dropdown-panel,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-popup,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-context-menu,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-tooltip {
    background: var(--app-dark-bg-2) !important;
    color: var(--app-dark-text) !important;
    border-color: var(--app-dark-border) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-dropdown-panel .rz-dropdown-items li,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-context-menu .rz-menuitem,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-context-menu .rz-menuitem-text {
    color: var(--app-dark-text) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-dropdown-panel .rz-state-highlight,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-dropdown-panel li:hover,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-context-menu .rz-menuitem:hover {
    background: var(--app-dark-bg-1) !important;
}

/* DropDown: trigger icon + filter input */
html:has(#radzen-theme-link[href*="material-dark"]) .rz-dropdown-trigger,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-dropdown-trigger-icon,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-dropdown-label {
    color: var(--app-dark-text) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-dropdown-filter,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-dropdown-filter input {
    background: var(--app-dark-bg-2) !important;
    color: var(--app-dark-text) !important;
    border-color: var(--app-dark-border) !important;
}

/* Buttons: Light/Base/Text variants should stay readable on dark */
html:has(#radzen-theme-link[href*="material-dark"]) .rz-button.rz-button-light,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-button.rz-variant-filled.rz-light,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-button.rz-button-base,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-button.rz-variant-filled.rz-base {
    background: var(--app-dark-bg-2) !important;
    border-color: var(--app-dark-border) !important;
    color: var(--app-dark-text) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-button.rz-button-light:hover:not(:disabled),
html:has(#radzen-theme-link[href*="material-dark"]) .rz-button.rz-button-base:hover:not(:disabled),
html:has(#radzen-theme-link[href*="material-dark"]) .rz-button.rz-variant-filled.rz-light:hover:not(:disabled),
html:has(#radzen-theme-link[href*="material-dark"]) .rz-button.rz-variant-filled.rz-base:hover:not(:disabled) {
    background: #2a313c !important;
    border-color: var(--app-dark-border-2) !important;
    color: var(--app-dark-text-title) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-button.rz-variant-text,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-button.rz-variant-text.rz-base {
    color: var(--app-dark-text) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-button.rz-variant-text:hover:not(:disabled) {
    background: var(--app-dark-bg-2) !important;
    color: var(--app-dark-text-title) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-button:disabled,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-button[disabled] {
    opacity: 0.6 !important;
}

/* DataGrid: pager / paging buttons */
html:has(#radzen-theme-link[href*="material-dark"]) .rz-paginator,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-paginator-pages,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-paginator-element {
    color: var(--app-dark-text) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-paginator .rz-button,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-paginator .rz-button.rz-variant-text {
    color: var(--app-dark-text) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-paginator .rz-button:hover:not(:disabled) {
    background: var(--app-dark-bg-2) !important;
}

/* HtmlEditor: keep toolbar + editable surface readable */
html:has(#radzen-theme-link[href*="material-dark"]) .rz-html-editor,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-html-editor-content,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-html-editor iframe {
    background: var(--app-dark-bg-1) !important;
    color: var(--app-dark-text) !important;
    border-color: var(--app-dark-border) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-html-editor-toolbar {
    background: var(--app-dark-bg-2) !important;
    border-color: var(--app-dark-border) !important;
}

/* Admin / News form: force consistent dark inputs + editor buttons */
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form .rz-inputtext,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form .rz-textarea,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form input.rz-inputtext,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form textarea.rz-textarea {
    background: var(--app-dark-bg-2, #21262d) !important;
    color: var(--app-dark-text, #c9d1d9) !important;
    border-color: var(--app-dark-border, #30363d) !important;
}

/* Title textbox (Radzen may render non-.rz-inputtext class) */
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form input[type="text"],
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form textarea {
    background: var(--app-dark-bg-2, #21262d) !important;
    color: var(--app-dark-text, #c9d1d9) !important;
    border-color: var(--app-dark-border, #30363d) !important;
}

/* Radzen TextBox can render a wrapper that carries the background; force dark on wrappers too */
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form .rz-form-field-content,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form .rz-form-field,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form .rz-textbox,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form .rz-textarea {
    background: var(--app-dark-bg-2, #21262d) !important;
    color: var(--app-dark-text, #c9d1d9) !important;
    border-color: var(--app-dark-border, #30363d) !important;
}

:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form .rz-form-field-content label,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form .rz-form-field-content .rz-form-field-label {
    color: var(--app-dark-text-muted, #8b949e) !important;
}

:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form input[type="text"]::placeholder,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form textarea::placeholder {
    color: var(--app-dark-text-subtle) !important;
    opacity: 1 !important;
}

:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form input[type="text"]:focus,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form textarea:focus {
    border-color: #2dd4bf !important;
    box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.25) !important;
    outline: none !important;
}

:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form .rz-inputtext:focus,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form .rz-textarea:focus,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form input.rz-inputtext:focus,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form textarea.rz-textarea:focus {
    border-color: #2dd4bf !important;
    box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.25) !important;
    outline: none !important;
}

:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form .app-field-hint {
    color: var(--app-dark-text-muted, #8b949e) !important;
}

:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form .rz-html-editor-toolbar .rz-button,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form .rz-html-editor-toolbar button {
    background: var(--app-dark-bg-2, #21262d) !important;
    color: var(--app-dark-text, #c9d1d9) !important;
    border-color: var(--app-dark-border, #30363d) !important;
    box-shadow: none !important;
}

:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form .rz-html-editor-toolbar .rz-button:hover:not(:disabled),
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form .rz-html-editor-toolbar button:hover:not(:disabled) {
    background: #2a313c !important;
    color: var(--app-dark-text-title, #f0f6fc) !important;
    border-color: var(--app-dark-border-2, #3d444d) !important;
}

:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form .rz-html-editor-toolbar select,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .app-admin-news-form .rz-html-editor-toolbar .rz-dropdown {
    background: var(--app-dark-bg-2, #21262d) !important;
    color: var(--app-dark-text, #c9d1d9) !important;
    border-color: var(--app-dark-border, #30363d) !important;
}

/* Quill (HtmlEditor) pickers: dropdown + color pickers */
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .rz-html-editor .ql-toolbar {
    background: var(--app-dark-bg-2, #21262d) !important;
    border-color: var(--app-dark-border, #30363d) !important;
}

:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .rz-html-editor .ql-toolbar .ql-picker,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .rz-html-editor .ql-toolbar .ql-picker-label,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .rz-html-editor .ql-toolbar .ql-picker-item,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .rz-html-editor .ql-toolbar button {
    color: var(--app-dark-text, #c9d1d9) !important;
}

:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .rz-html-editor .ql-toolbar button:hover,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .rz-html-editor .ql-toolbar button:focus,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .rz-html-editor .ql-toolbar .ql-picker-label:hover,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .rz-html-editor .ql-toolbar .ql-picker-label:focus {
    background: #2a313c !important;
    color: var(--app-dark-text-title, #f0f6fc) !important;
}

:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .rz-html-editor .ql-toolbar .ql-stroke {
    stroke: currentColor !important;
}

:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .rz-html-editor .ql-toolbar .ql-fill {
    fill: currentColor !important;
}

:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .rz-html-editor .ql-picker-options {
    background: var(--app-dark-bg-2, #21262d) !important;
    border: 1px solid var(--app-dark-border, #30363d) !important;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55) !important;
}

:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .rz-html-editor .ql-picker-options .ql-picker-item:hover,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .rz-html-editor .ql-picker-options .ql-picker-item.ql-selected {
    background: var(--app-dark-bg-1, #161b22) !important;
}

/* Pickr color picker (Radzen HtmlEditor uses it for color/background) */
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .pcr-app {
    background: var(--app-dark-bg-1, #161b22) !important;
    color: var(--app-dark-text, #c9d1d9) !important;
    border: 1px solid var(--app-dark-border, #30363d) !important;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6) !important;
    /* Pickr supports theme via CSS variables; set them defensively */
    --pcr-color: var(--app-dark-text, #c9d1d9);
    --pcr-bg-color: var(--app-dark-bg-1, #161b22);
    --pcr-border-color: var(--app-dark-border, #30363d);
    --pcr-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
}

:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .pcr-app,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .pcr-app * {
    color: inherit;
}

:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .pcr-app .pcr-selection,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .pcr-app .pcr-swatches,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .pcr-app .pcr-interaction,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .pcr-app .pcr-type {
    background: var(--app-dark-bg-1, #161b22) !important;
    border-color: var(--app-dark-border, #30363d) !important;
}

:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .pcr-app .pcr-type.active {
    background: var(--app-dark-bg-2, #21262d) !important;
}

:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .pcr-app .pcr-last-color,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .pcr-app .pcr-current-color {
    box-shadow: 0 0 0 1px var(--app-dark-border, #30363d) inset !important;
}

:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .pcr-app .pcr-interaction input,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .pcr-app .pcr-interaction .pcr-result {
    background: var(--app-dark-bg-2, #21262d) !important;
    color: var(--app-dark-text, #c9d1d9) !important;
    border-color: var(--app-dark-border, #30363d) !important;
}

:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .pcr-app .pcr-interaction input::placeholder {
    color: var(--app-dark-text-subtle, #6e7681) !important;
    opacity: 1 !important;
}

:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .pcr-app .pcr-interaction .pcr-save,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .pcr-app .pcr-interaction .pcr-cancel {
    background: var(--app-dark-bg-2, #21262d) !important;
    border: 1px solid var(--app-dark-border, #30363d) !important;
    color: var(--app-dark-text, #c9d1d9) !important;
}

:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .pcr-app .pcr-interaction .pcr-save:hover,
:is(
  html:has(#radzen-theme-link[href*="material-dark"]),
  html[data-bs-theme="dark"],
  body[data-bs-theme="dark"],
  html.rz-dark,
  body.rz-dark,
  html.dark,
  body.dark
) .pcr-app .pcr-interaction .pcr-cancel:hover {
    background: #2a313c !important;
    border-color: var(--app-dark-border-2, #3d444d) !important;
    color: var(--app-dark-text-title, #f0f6fc) !important;
}

/* Tooltip: ensure contrast (Radzen can render near-black text on dark) */
html:has(#radzen-theme-link[href*="material-dark"]) .rz-tooltip {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45) !important;
}

/* Dialog */
html:has(#radzen-theme-link[href*="material-dark"]) .rz-dialog-wrapper .rz-dialog {
    background: var(--app-dark-bg-1) !important;
    border: 1px solid var(--app-dark-border) !important;
    color: var(--app-dark-text) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-dialog-titlebar {
    background: var(--app-dark-bg-1) !important;
    border-bottom: 1px solid var(--app-dark-border) !important;
    color: var(--app-dark-text-title) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-dialog-content {
    background: var(--app-dark-bg-1) !important;
    color: var(--app-dark-text) !important;
}

/* Notifications */
html:has(#radzen-theme-link[href*="material-dark"]) .rz-notification-item {
    background: var(--app-dark-bg-1) !important;
    border-color: var(--app-dark-border) !important;
    color: var(--app-dark-text) !important;
}

/* Alerts: keep readable fills */
html:has(#radzen-theme-link[href*="material-dark"]) .rz-alert.rz-alert-danger {
    background: rgba(248, 81, 73, 0.12) !important;
    border-color: rgba(248, 81, 73, 0.35) !important;
    color: var(--app-dark-text-title) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-alert.rz-alert-warning {
    background: rgba(210, 153, 34, 0.14) !important;
    border-color: rgba(210, 153, 34, 0.35) !important;
    color: var(--app-dark-text-title) !important;
}

/* Legacy validation colors from template (magenta) were unreadable on dark */
html:has(#radzen-theme-link[href*="material-dark"]) .valid.modified:not([type=checkbox]) {
    outline: 1px solid rgba(63, 185, 80, 0.9) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .invalid {
    outline: 1px solid rgba(248, 81, 73, 0.9) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .validation-message {
    color: var(--app-dark-danger) !important;
}

/* ---- Dark: FormField labels + admin editors (server editor / server edit) ---- */
html:has(#radzen-theme-link[href*="material-dark"]) .rz-form-field-label,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-form-field label,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-form-field .rz-form-field-label {
    color: #c9d1d9 !important;
    /* Radzen material can paint a light "pill" behind the label; force dark. */
    background: #161b22 !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-form-field-content,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-textbox,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-textarea,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-inputtext.rz-state-empty {
    background: #21262d !important;
    border-color: #30363d !important;
    color: #c9d1d9 !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-inputtext::placeholder,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-textarea::placeholder,
html:has(#radzen-theme-link[href*="material-dark"]) input.rz-inputtext::placeholder,
html:has(#radzen-theme-link[href*="material-dark"]) textarea.rz-textarea::placeholder {
    color: #8b949e !important;
    opacity: 1 !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-form-field-content:focus-within,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-textbox:focus-within,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-textarea:focus-within {
    border-color: #2dd4bf !important;
    box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.25) !important;
}

/* DropDown in server edit: selected text + arrow */
html:has(#radzen-theme-link[href*="material-dark"]) .rz-dropdown,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-dropdown .rz-dropdown-label,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-dropdown .rz-dropdown-trigger-icon {
    background: #21262d !important;
    border-color: #30363d !important;
    color: #c9d1d9 !important;
}

/* QR preview cards in editor: ensure URL text readable */
html:has(#radzen-theme-link[href*="material-dark"]) .server-card__url {
    color: #8b949e !important;
}

/* ---- FORCE Pickr popup colors in dark mode (DevTools-style) ---- */
html:has(#radzen-theme-link[href*="material-dark"]) .pcr-app {
    background: #161b22 !important;
    border: 1px solid #30363d !important;
    color: #c9d1d9 !important;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6) !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .pcr-app .pcr-interaction input,
html:has(#radzen-theme-link[href*="material-dark"]) .pcr-app .pcr-interaction .pcr-result,
html:has(#radzen-theme-link[href*="material-dark"]) .pcr-app .pcr-type,
html:has(#radzen-theme-link[href*="material-dark"]) .pcr-app .pcr-save,
html:has(#radzen-theme-link[href*="material-dark"]) .pcr-app .pcr-cancel {
    background: #21262d !important;
    border-color: #30363d !important;
    color: #c9d1d9 !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .pcr-app .pcr-save:hover,
html:has(#radzen-theme-link[href*="material-dark"]) .pcr-app .pcr-cancel:hover {
    background: #2a313c !important;
    border-color: #3d444d !important;
    color: #f0f6fc !important;
}

/* ---- HtmlEditor colorpicker (use the actual class from DOM) ---- */
html:has(#radzen-theme-link[href*="material-dark"]) .rz-html-editor-colorpicker {
    background: var(--app-dark-bg-2, #21262d) !important;
    color: #c9d1d9 !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-html-editor-colorpicker input,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-html-editor-colorpicker select,
html:has(#radzen-theme-link[href*="material-dark"]) .rz-html-editor-colorpicker button {
    background: #21262d !important;
    border-color: #30363d !important;
    color: #c9d1d9 !important;
}

html:has(#radzen-theme-link[href*="material-dark"]) .rz-html-editor-colorpicker button:hover:not(:disabled) {
    background: #2a313c !important;
    border-color: #3d444d !important;
    color: #f0f6fc !important;
}
