/* App-shell scaffolding layered on top of the stock Telerik theme. The theme
   styles the components; this file supplies only what the theme does not — the
   header/drawer layout chrome, viewport fill, and a few app-specific surfaces
   (avatar menu, theme picker, switch-institution page). No density/scale token
   overrides: components render at Telerik's stock size, spacing and typography. */

html, body {
    margin: 0;
    height: 100%;
    /* Telerik's swatch sets body{background}, but <html> isn't styled; pin it
       to the same surface so any layout gap doesn't flash the browser white.
       --mp-splash-bg is stamped by the inline boot script in App.razor so the
       background matches the persisted theme before any stylesheet arrives. */
    background: var(--kendo-color-app-surface, var(--mp-splash-bg, #ffffff));
    color: var(--kendo-color-on-app-surface, inherit);
}

/* ---------------------------------------------------------------------------
   Pre-Blazor initialization splash
   Covers the page while the WASM bundle downloads and the theme CSS settles.
   --mp-splash-bg/fg/accent are stamped by the inline boot script before first
   paint so the loader matches the persisted theme from byte zero.
   hideSplashWhenReady() (MainLayout.OnAfterRenderAsync) waits for the active
   swatch stylesheet to load before fading this out, preventing a flash of the
   wrong theme.

   Aesthetic: clinical-precise indeterminate orbital — two counter-rotating
   arcs over a faint track, a pulsing core "vital" dot, a soft accent glow, an
   atmospheric radial tint, and a quietly breathing tracked-caps wordmark.
   --------------------------------------------------------------------------- */
#mp-splash {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.65rem;
    /* Layered atmosphere: a faint accent glow above the loader fading into the
       flat theme background, so the screen reads as designed depth, not a slab
       of solid colour. color-mix degrades to the bare bg on older engines. */
    background:
        radial-gradient(120% 75% at 50% 42%,
            color-mix(in srgb, var(--mp-splash-accent, #1A6EA6) 9%, transparent),
            transparent 62%),
        var(--mp-splash-bg, #ffffff);
    color: var(--mp-splash-fg, #1a1a1a);
    z-index: 10000;
    transition: opacity 320ms ease, visibility 320ms ease;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

#mp-splash.mp-splash--out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ── Orbital loader ───────────────────────────────────────────────────────── */
.mp-splash-stage {
    width: 4.25rem;
    height: 4.25rem;
    /* gentle scale-in on first paint */
    animation: mp-splash-rise 520ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.mp-splash-orbit {
    width: 100%;
    height: 100%;
    overflow: visible;
    /* soft accent halo around the whole ring */
    filter: drop-shadow(0 0 9px color-mix(in srgb, var(--mp-splash-accent, #1A6EA6) 45%, transparent));
}

.mp-splash-orbit circle {
    fill: none;
    transform-box: fill-box;
    transform-origin: center;
}

/* Faint full-circle guide the moving arcs travel over. */
.mp-orbit-track {
    stroke: color-mix(in srgb, var(--mp-splash-fg, #1a1a1a) 14%, transparent);
    stroke-width: 2.25;
}

/* Outer + inner arcs: partial dashes that rotate. Counter-rotation + different
   periods reads as depth rather than a flat spinner. Rounded caps soften it. */
.mp-orbit-arc {
    stroke: var(--mp-splash-accent, #1A6EA6);
    stroke-width: 3;
    stroke-linecap: round;
    /* r=26 → circumference ≈ 163; ~40% lit arc, rest gap */
    stroke-dasharray: 66 200;
    animation: mp-orbit-cw 1.5s cubic-bezier(0.55, 0.15, 0.4, 0.9) infinite;
}

.mp-orbit-arc--inner {
    stroke: color-mix(in srgb, var(--mp-splash-fg, #1a1a1a) 38%, transparent);
    stroke-width: 2.25;
    /* r=17 → circumference ≈ 107; ~30% lit arc */
    stroke-dasharray: 30 130;
    animation: mp-orbit-ccw 2.4s linear infinite;
}

/* Central dot — the steady "vital" pulse. */
.mp-orbit-core {
    fill: var(--mp-splash-accent, #1A6EA6);
    stroke: none;
    animation: mp-orbit-pulse 1.5s ease-in-out infinite;
}

/* ── Wordmark ─────────────────────────────────────────────────────────────── */
.mp-splash-brand {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.34em;
    /* trailing letter-spacing pushes text off-centre; nudge back */
    padding-left: 0.34em;
    color: color-mix(in srgb, var(--mp-splash-fg, #1a1a1a) 68%, transparent);
    animation:
        mp-splash-rise 560ms cubic-bezier(0.2, 0.7, 0.2, 1) 80ms both,
        mp-splash-breathe 3s ease-in-out 640ms infinite;
}

@keyframes mp-orbit-cw   { to { transform: rotate(360deg); } }
@keyframes mp-orbit-ccw  { to { transform: rotate(-360deg); } }

@keyframes mp-orbit-pulse {
    0%, 100% { transform: scale(0.7);  opacity: 0.55; }
    50%      { transform: scale(1.15); opacity: 1; }
}

@keyframes mp-splash-rise {
    from { opacity: 0; transform: translateY(8px) scale(0.94); }
    to   { opacity: 1; transform: none; }
}

@keyframes mp-splash-breathe {
    0%, 100% { opacity: 0.55; }
    50%      { opacity: 0.9; }
}

/* Respect reduced-motion: hold a calm, legible static state. */
@media (prefers-reduced-motion: reduce) {
    #mp-splash .mp-splash-stage,
    #mp-splash .mp-orbit-arc,
    #mp-splash .mp-orbit-arc--inner,
    #mp-splash .mp-orbit-core,
    #mp-splash .mp-splash-brand {
        animation: none;
    }
    .mp-orbit-core { opacity: 1; transform: scale(1); }
    .mp-splash-brand { opacity: 0.8; }
}

/* The Blazor app root needs an explicit height for the drawer chain to
   resolve `height: 100%` all the way down. Without this, every ancestor
   collapses to content height and the drawer ends partway down the page. */
#app {
    height: 100%;
}

:root {
    --header-h: 0px;
}

.contentFillViewPort {
    height: calc(100vh - var(--header-h) - 6px);
}

/* Use Kendo's warning-subtle so the error toast tints with the active theme
   (light yellow on light swatch, muted amber on dark) instead of a fixed
   light-only colour. */
#blazor-error-ui {
    background: var(--kendo-color-warning-subtle, lightyellow);
    color: var(--kendo-color-on-warning-subtle, inherit);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.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." }

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #1b6ec2;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after { content: var(--blazor-load-percentage-text, "Loading"); }

/* code { color: #c02d76; } */

/* ---------------------------------------------------------------------------
   Monaco Editor Error Decorations
   --------------------------------------------------------------------------- */

/* Line background highlight for error lines */
.errorLineDecoration {
    background-color: rgba(255, 0, 0, 0.1) !important;
}

/* Red circle glyph in the gutter */
.errorGlyph {
    background-color: #e51400;
    border-radius: 50%;
    width: 8px !important;
    height: 8px !important;
    margin-left: 5px;
    margin-top: 6px;
}

/* Inline error message shown after the line content */
.inlineErrorMessage {
    color: #e51400;
    font-style: italic;
    opacity: 0.9;
}

/* ---------------------------------------------------------------------------
   Script Editor Container (VSCode-style layout)
   --------------------------------------------------------------------------- */

.script-editor-container {
    display: flex;
    flex-direction: column;
    height: 600px;
    border: 1px solid var(--kendo-color-border, #ccc);
}

.script-editor-wrapper {
    flex: 1;
    min-height: 100px;
    overflow: hidden;
}

.script-editor-wrapper #report-script-editor {
    height: 100% !important;
    width: 100% !important;
}

/* ---------------------------------------------------------------------------
   Script Output Panel (VSCode-style)
   --------------------------------------------------------------------------- */

.script-output-panel {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    height: 150px;
    flex-shrink: 0;
}

.script-output-panel.collapsed {
    height: auto !important;
}

.script-output-panel.collapsed .script-output-resize-bar {
    display: none;
}

.script-output-resize-bar {
    height: 4px;
    background: var(--kendo-color-border, #e0e0e0);
    cursor: ns-resize;
    flex-shrink: 0;
}

.script-output-resize-bar:hover {
    background: var(--kendo-color-primary, #0078d4);
}

.script-output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 10px;
    background: var(--kendo-color-surface-alt, #f3f3f3);
    color: var(--kendo-color-on-app-surface, inherit);
    border-bottom: 1px solid var(--kendo-color-border, #ddd);
    flex-shrink: 0;
    user-select: none;
    cursor: pointer;
}

.script-output-header span {
    flex: 1;
}

.script-output-header:hover {
    background: var(--kendo-color-base-hover, #e8e8e8);
}

.script-output-clear {
    padding: 2px 8px;
    font-size: 11px;
    background: var(--kendo-color-surface, #fff);
    color: var(--kendo-color-on-app-surface, inherit);
    border: 1px solid var(--kendo-color-border, #ccc);
    border-radius: 3px;
    cursor: pointer;
    margin-left: auto;
}

.script-output-clear:hover {
    background: var(--kendo-color-base-hover, #e8e8e8);
}

.script-output-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px;
    background: #1e1e1e;
    color: #d4d4d4;
}

.output-log {
    padding: 2px 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.output-error {
    color: #f44336;
    padding: 2px 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.output-empty {
    color: #666;
    font-style: italic;
}

/* =============================================================================
 * MainLayout navigation drawer (Pages/Layout/MainLayout.razor)
 *
 * Layout: a fixed-width TelerikDrawer (push mode) wraps a custom <Template>
 * body that hosts a header bar (title + pin) and a TelerikTreeView for
 * hierarchical navigation.
 *
 * Styles live here (global) instead of MainLayout.razor.css because Telerik
 * renders its own DOM wrappers around the Template content — those wrappers
 * don't carry our Blazor scope attribute, so ::deep selectors from a scoped
 * stylesheet can't reach .mp-drawer-shell. Global rules keyed on our distinct
 * `mp-drawer-*` class names sidestep the scoping problem entirely.
 * =============================================================================*/

/* Pin the drawer + its content area to fill the viewport below the AppBar.
   Telerik's default drawer height is content-driven so a short tree collapses
   the panel vertically. Reports' DockManager already uses the same
   `calc(100vh - var(--header-h))` formula (see .contentFillViewPort);
   re-using --header-h keeps drawer + page content vertically aligned.

   `!important` overrides Telerik's own height rule on the container; the
   inner .k-drawer + .k-drawer-content already use height: 100% so once
   the container has a real height they fill it. */
.k-drawer-container {
    height: calc(100vh - var(--header-h)) !important;
}

/* In Push mode Telerik renders:
     .k-drawer-container > .k-drawer-wrapper (sidebar)
                         > .k-drawer-content (page area)
   Force both to 100% so they inherit the container's viewport-minus-header
   height (per Drawer docs: "height is dynamic based on the height of the
   content — you can change it with CSS"). */
.k-drawer-wrapper,
.k-drawer-content {
    height: 100% !important;
}

/* AppBar carries a default elevation shadow that bleeds onto the drawer +
   content area, and some swatches round its outer edges. Flatten both so
   the header reads as a single edge-to-edge strip. */
.k-appbar {
    box-shadow: none !important;
    border-radius: 0 !important;
}

.mp-drawer-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* ── Header (title + pin toggle) ───────────────────────────────────────── */

.mp-drawer-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 8px 8px 10px;
    border-bottom: 1px solid var(--kendo-color-border, rgba(0, 0, 0, 0.08));
    min-height: 32px;
    flex: 0 0 auto;
    font-size: 0.95rem;
    font-weight: 500;
    background: var(--kendo-color-surface, #fafafa);
}

.mp-drawer-header .mp-drawer-pin {
    border: none;
    background: transparent;
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    line-height: 1;
}

.mp-drawer-header .mp-drawer-pin:hover {
    background: var(--kendo-color-base-hover, rgba(0, 0, 0, 0.06));
}

.mp-drawer-header .mp-drawer-title {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mp-drawer-header .mp-drawer-pin.is-pinned {
    color: var(--kendo-color-primary, #1a6ea6);
}

/* ── Tree container ────────────────────────────────────────────────────── */

/* Menu content scrolls vertically as usual; when a node label is wider than the
   fixed-width panel it scrolls horizontally instead of being clipped. */
.mp-drawer-items {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: auto;
    padding: 4px 0;
}

/* Let the TelerikTreeView use the full panel width; nowrap so long labels
   overflow horizontally (driving the panel's horizontal scroll) instead of
   wrapping inside the fixed 220px width. */
.mp-drawer-items .k-treeview {
    width: 100%;
    padding-right: 6px;
}
.mp-drawer-items .k-treeview .k-treeview-leaf {
    white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   Update-available sticky toast (UpdateAvailableNotification.razor)
   --------------------------------------------------------------------------- */
.mpTelerikUpdateNotification .k-notification {
    min-width: 320px;
    padding: 12px 14px;
}

.mp-update-toast {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mp-update-toast__msg {
    font-weight: 600;
}

.mp-update-toast__sub {
    font-weight: 400;
    font-size: 0.85em;
    opacity: 0.85;
}

/* ---------------------------------------------------------------------------
   Avatar dropdown (AvatarMenu.razor)
   Teams-style profile menu anchored to the avatar button in the top AppBar.
   Telerik components don't accept attribute splatting, so styling lives here
   keyed on .mp-avatar-* class names assigned via the components' `Class` prop
   (or on plain HTML inside the popup).
   --------------------------------------------------------------------------- */
.mp-avatar-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    margin: 0;
    background: transparent;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    line-height: 0;
}

.mp-avatar-button:hover {
    background: var(--kendo-color-base-hover, rgba(0, 0, 0, 0.06));
}

.mp-avatar-button:focus-visible {
    outline: 2px solid var(--kendo-color-primary, #1a6ea6);
    outline-offset: 2px;
}

.mp-avatar-menu {
    display: flex;
    flex-direction: column;
    background: var(--kendo-color-surface, #fff);
    color: var(--kendo-color-on-app-surface, #1f1f1f);
    border: 1px solid var(--kendo-color-border, rgba(0, 0, 0, 0.08));
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    padding: 12px 0 6px;
    overflow: hidden;
}

.mp-avatar-menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 16px 12px;
}

.mp-avatar-menu-identity {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mp-avatar-menu-name {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mp-avatar-menu-institution {
    font-size: 0.82rem;
    opacity: 0.75;
    line-height: 1.2;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mp-avatar-menu-separator {
    height: 1px;
    background: var(--kendo-color-border, rgba(0, 0, 0, 0.08));
    margin: 0 0 4px;
}

.mp-avatar-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    background: transparent;
    border: 0;
    text-align: left;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.mp-avatar-menu-item:hover,
.mp-avatar-menu-item:focus-visible {
    background: var(--kendo-color-base-hover, rgba(0, 0, 0, 0.04));
    outline: none;
}

/* Sign-out item — same chrome as the others, but the icon + label turn
   destructive on hover/focus so an accidental click reads as a stop sign. */
.mp-avatar-menu-item--danger:hover,
.mp-avatar-menu-item--danger:focus-visible {
    color: var(--kendo-color-error, #d9534f);
}
.mp-avatar-menu-item--danger:hover .k-svg-icon,
.mp-avatar-menu-item--danger:focus-visible .k-svg-icon {
    color: var(--kendo-color-error, #d9534f);
}
.mp-avatar-menu-item[disabled] {
    opacity: 0.6;
    cursor: default;
    pointer-events: none;
}

/* Trailing chevron on items that open further UI (Switch institution). */
.mp-avatar-menu-chevron {
    margin-left: auto;
    opacity: 0.55;
    font-size: 1.1em;
    line-height: 1;
}

/* ThemeToggle embedded as a menu row. Stretch its trigger button to the full
   menu width and align padding/hover with the sibling .mp-avatar-menu-item
   rows; push the trailing chevron to the right edge like the other rows. */
.mp-avatar-menu-theme .mp-theme-toggle-button {
    width: 100%;
    padding: 10px 16px;
    gap: 10px;
    border-radius: 0;
}
.mp-avatar-menu-theme .mp-theme-current-label {
    margin-right: auto;
}

/* About dialog --------------------------------------------------------------- */
.mp-about-dialog {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 2px;
}

.mp-about-product {
    font-size: 1.1rem;
    font-weight: 600;
}

.mp-about-version,
.mp-about-copyright {
    font-size: 0.9rem;
    opacity: 0.85;
}

/* ---------------------------------------------------------------------------
   Switch Institution page (Pages/Institution/Switch.razor)
   --------------------------------------------------------------------------- */
.mp-switch-inst-page {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 980px;
    padding: 12px 4px 4px;
}

.mp-switch-inst-page > h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.mp-switch-inst-context {
    margin: 0;
    font-size: 0.95rem;
    color: var(--kendo-color-on-app-surface, #1f1f1f);
    opacity: 0.85;
}

.mp-switch-inst-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mp-switch-inst-filter {
    flex: 1 1 auto;
    min-width: 0;
}

.mp-switch-inst-refresh {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    color: var(--kendo-color-primary, #1a6ea6);
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
}
.mp-switch-inst-refresh:hover {
    text-decoration: underline;
}
.mp-switch-inst-refresh.is-busy {
    opacity: 0.55;
    pointer-events: none;
    cursor: default;
}

/* Current-institution capsule rendered next to the active row's name. */
.mp-current-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--kendo-color-base-hover, rgba(0, 0, 0, 0.08));
    color: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.85;
    vertical-align: middle;
}

/* Inline error block — same look used for both load + switch failures. */
.mp-switch-inst-error {
    padding: 8px 12px;
    border-radius: 4px;
    background: rgba(217, 83, 79, 0.08);
    color: var(--kendo-color-error, #b94a48);
    font-size: 0.9rem;
}

/* Small "Institutions cache refreshed." note that appears after a refresh. */
.mp-switch-inst-toast {
    font-size: 0.85rem;
    color: var(--kendo-color-on-app-surface, #1f1f1f);
    opacity: 0.75;
}

/* Footer button row (Cancel + Switch) under the grid. */
.mp-switch-inst-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 8px;
}

/* Inline text-button used inside error blocks (the [Retry] link). */
.mp-link-button {
    background: none;
    border: 0;
    padding: 0 4px;
    color: var(--kendo-color-primary, #1a6ea6);
    text-decoration: underline;
    cursor: pointer;
    font: inherit;
}

/* =============================================================================
 * Theme picker (Pages/Layout/ThemeToggle.razor)
 *
 * Modelled on Telerik's own "Change Theme" demo (the top-right popup at
 * https://demos.telerik.com/blazor-ui). Everything visual is wired to Kendo
 * theme tokens so the picker recolors with the active swatch.
 * =============================================================================*/

/* AppBar trigger button — flat, picks up Kendo button hover/active states. */
.mp-theme-toggle-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: transparent;
    border: 0;
    border-radius: var(--kendo-border-radius-md, 4px);
    color: inherit;
    font: inherit;
    cursor: pointer;
    line-height: 1.2;
}
.mp-theme-toggle-button:hover {
    background: var(--kendo-color-base-hover, rgba(0, 0, 0, 0.06));
}
.mp-theme-toggle-button:focus-visible {
    outline: 2px solid var(--kendo-color-primary, #1a6ea6);
    outline-offset: 2px;
}

.mp-theme-trigger-label {
    font-size: 0.85rem;
    opacity: 0.85;
}

.mp-theme-current-label {
    font-size: 0.9rem;
}

/* Two-circle preview ("before"/"after"). Outer is the surface colour, inner
   is the primary accent — same pattern Telerik uses in its picker. */
.mp-theme-dots {
    position: relative;
    display: inline-block;
    width: 28px;
    height: 16px;
    flex: 0 0 auto;
}
.mp-theme-dot {
    position: absolute;
    top: 0;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 1px solid var(--kendo-color-border, rgba(0, 0, 0, 0.18));
    box-sizing: border-box;
}
.mp-theme-dot--outer { left: 0; }
.mp-theme-dot--inner { left: 12px; }

/* Popup body. TelerikPopup gives us the chrome (border, shadow, animation);
   the inner layout is plain flex. */
.mp-theme-picker {
    display: flex;
    flex-direction: column;
    padding: 6px 0;
    background: var(--kendo-color-surface, #fff);
    color: var(--kendo-color-on-app-surface, inherit);
    max-height: 70vh;
    overflow-y: auto;
}

.mp-theme-section-header {
    padding: 8px 16px 4px;
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0.85;
    letter-spacing: 0.01em;
}

.mp-theme-section-separator {
    height: 1px;
    background: var(--kendo-color-border, rgba(0, 0, 0, 0.08));
    margin: 6px 12px 4px;
}

/* Swatch row. Behaves like a Kendo list item — flat button, full-width hit
   target, hover/selected backgrounds from theme tokens. */
.mp-theme-swatch-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 8px 16px;
    background: transparent;
    border: 0;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.mp-theme-swatch-row:hover,
.mp-theme-swatch-row:focus-visible {
    background: var(--kendo-color-base-hover, rgba(0, 0, 0, 0.04));
    outline: none;
}
.mp-theme-swatch-row.is-selected {
    background: var(--kendo-color-base-active, rgba(0, 0, 0, 0.06));
}

.mp-theme-swatch-label {
    flex: 1 1 auto;
    font-size: 0.95rem;
}

.mp-theme-swatch-trail {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    opacity: 0.75;
}
