/* Blur everything except the header while the init toast is visible */
/* Force a clean white backdrop while the toast is showing (prevents bg-gray-50 from reading as a grey slab) */
html.toast-open {
    min-height: 100vh;
    background: #ffffff !important;
}
html.toast-open body.is-loading {
    min-height: 100vh;
    background: #ffffff !important;
}
body.is-loading main {
    /* Hide the page content while the toast runs - only the toast should be visible */
    visibility: hidden;
    opacity: 0;
    filter: none;
    transition: opacity 120ms ease;
    will-change: opacity;
}
body.is-loading main * {
    pointer-events: none;
    user-select: none;
}
body:not(.is-loading) main {
    visibility: visible;
    filter: none;
    opacity: 1;
    transition: opacity 120ms ease;
}

/* Only restrict header during BOOT loading */
body.is-loading.is-boot header nav {
    opacity: 0.48;
    pointer-events: none;
}

body.is-loading.is-boot header nav a[aria-current="page"] {
    background: transparent;
    color: #4b5563;
    box-shadow: none;
}

body.is-loading.is-boot header nav a[aria-current="page"] > span:first-child {
    border-color: #e5e7eb;
    background: #ffffff;
    color: #6b7280;
}

body.is-loading.is-boot header nav a[aria-current="page"] > span:last-child > span:last-child {
    color: #9ca3af;
}
/* Small, clean header logo */
.app-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

/* Browser-local visual QA mode shown above the shared app header. */
.tester-mode-bar {
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    background:
        radial-gradient(circle at 26% -80%, rgba(59, 130, 246, 0.38), transparent 34%),
        linear-gradient(90deg, #0f172a 0%, #111c31 58%, #0f1b31 100%);
    color: #f8fafc;
}

.tester-mode-bar[hidden] {
    display: none;
}

.tester-mode-inner {
    display: flex;
    min-height: 40px;
    max-width: 80rem;
    margin: 0 auto;
    padding: 5px 1.5rem;
    align-items: center;
    gap: 16px;
}

.tester-mode-identity {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 9px;
    color: inherit;
    text-decoration: none;
}

.tester-mode-identity:hover .tester-mode-name {
    color: #ffffff;
}

.tester-mode-pill {
    display: inline-flex;
    min-height: 24px;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
    border: 1px solid rgba(147, 197, 253, 0.2);
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.2);
    padding: 4px 9px;
    color: #dbeafe;
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.1em;
    line-height: 1;
    text-transform: uppercase;
}

.tester-mode-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #60a5fa;
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.12);
}

.tester-mode-avatar {
    display: inline-flex;
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: 9px;
    font-weight: 750;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.tester-mode-name {
    max-width: 180px;
    overflow: hidden;
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.2;
    text-overflow: ellipsis;
    transition: color 150ms ease;
    white-space: nowrap;
}

.tester-mode-scope {
    border-left: 1px solid rgba(148, 163, 184, 0.2);
    padding-left: 16px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 550;
    line-height: 1.2;
    white-space: nowrap;
}

.tester-mode-week {
    display: inline-flex;
    min-height: 28px;
    flex: 0 0 auto;
    padding: 4px 8px;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(147, 197, 253, 0.16);
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.12);
    color: #dbeafe;
    font-size: 10px;
    font-weight: 680;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}

.tester-mode-week:hover {
    border-color: rgba(147, 197, 253, 0.28);
    background: rgba(37, 99, 235, 0.2);
    color: #ffffff;
}

.tester-mode-week svg {
    width: 13px;
    height: 13px;
}

.tester-mode-week-report {
    border-left: 1px solid rgba(147, 197, 253, 0.2);
    padding-left: 6px;
    color: #93c5fd;
    font-weight: 600;
}

.tester-mode-stats {
    display: flex;
    margin: 0 0 0 auto;
    align-items: stretch;
    gap: 5px;
}

.tester-mode-stat {
    display: flex;
    min-width: 112px;
    min-height: 29px;
    margin: 0;
    padding: 4px 9px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid rgba(148, 163, 184, 0.13);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.045);
}

.tester-mode-stat dt {
    display: inline-flex;
    margin: 0;
    align-items: center;
    gap: 6px;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.15;
    white-space: nowrap;
}

.tester-mode-stat dt svg {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
}

.tester-mode-stat dd {
    margin: 0;
    color: #f8fafc;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    font-weight: 720;
    line-height: 1;
    white-space: nowrap;
}

.tester-mode-stat--reported dd {
    color: #fda4af;
}

.tester-mode-stat--reward dd {
    color: #86efac;
}

.tester-mode-settings {
    display: inline-flex;
    min-height: 28px;
    padding: 4px 8px;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 0;
    border-radius: 7px;
    color: #94a3b8;
    cursor: pointer;
    font-size: 10px;
    font-weight: 650;
    text-decoration: none;
    transition: background 150ms ease, color 150ms ease;
    white-space: nowrap;
}

.tester-mode-settings:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #e2e8f0;
}

.tester-mode-settings:disabled {
    cursor: wait;
    opacity: 0.65;
}

.tester-mode-settings svg {
    width: 14px;
    height: 14px;
}

@media (max-width: 1100px) {
    .tester-mode-inner {
        gap: 10px;
    }

    .tester-mode-scope,
    .tester-mode-week-report,
    .tester-mode-settings span {
        display: none;
    }

    .tester-mode-stat {
        min-width: 0;
        gap: 8px;
    }
}

@media (max-width: 680px) {
    .tester-mode-inner {
        overflow-x: auto;
        padding-right: 1rem;
        padding-left: 1rem;
    }

    .tester-mode-avatar,
    .tester-mode-name,
    .tester-mode-stat dt svg {
        display: none;
    }

    .tester-mode-stat {
        padding-right: 8px;
        padding-left: 8px;
    }
}

/* Mode switch "model loading" toast */
#modeSwitchToast {
    position: fixed;
    inset: 0;
    z-index: 9999;
    opacity: 0;
    transition: opacity 180ms ease;
    pointer-events: none;
    --toast-color: rgba(37, 99, 235, 0.68);
}
#modeSwitchToast.show {
    opacity: 1;
}
#modeSwitchToast.interactive {
    pointer-events: auto;
}
#modeSwitchToast.interactive .centerMessage {
    pointer-events: auto;
}

/* Center overlay message */
#modeSwitchToast .centerMessage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    text-align: center;
    pointer-events: none;
    user-select: none;
}

#modeSwitchToast pre {
    margin: 0;
    padding: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: clamp(13px, 1.25vw, 16px);
    line-height: 1.35;
    color: var(--toast-color);
    background: transparent;
    white-space: pre-wrap;
    word-break: break-word;
    max-width: min(1100px, calc(100vw - 56px));
    max-height: calc(100vh - 240px);
    overflow: auto;
    padding-bottom: 10px;
    text-shadow: none;
    letter-spacing: 0.01em;
    text-transform: none;
}
#modeSwitchToast pre b {
    font-weight: 600;
}
#modeSwitchToast .spinnerline {
    color: rgba(96, 165, 250, 0.72);
    font-weight: 600;
    letter-spacing: 0.04em;
}
#modeSwitchToast .readyline {
    color: var(--toast-color);
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: none;
}
#modeSwitchToast .toastStack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-height: calc(100vh - 56px);
}
#modeSwitchToast .toastLogo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    opacity: 0.95;
    background: transparent;
    filter: none;
    user-select: none;
    pointer-events: none;
}
#modeSwitchToast .toastLogo.hidden {
    display: none;
}

#modeSwitchToast .toastActions {
    display: none;
    width: 100%;
    justify-content: center;
    gap: 10px;
    margin-top: 6px;
    pointer-events: auto;
}
#modeSwitchToast.interactive .toastActions {
    display: flex;
}

#modeSwitchToast .toastAck {
    appearance: none;
    border: 1px solid rgba(217,119,6,0.55);
    background: rgba(255,247,237,0.92);
    color: rgba(180,83,9,0.95);
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 10px 18px;
    border-radius: 9999px;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(0,0,0,0.18);
    user-select: none;
}
#modeSwitchToast .toastAck:hover {
    filter: brightness(0.98);
}
#modeSwitchToast .toastAck:active {
    transform: translateY(1px);
}
#modeSwitchToast.is-warning .toastAck {
    border-color: rgba(217,119,6,0.65);
    background: rgba(255,237,213,0.92);
    color: rgba(180,83,9,0.98);
}

/* Warning theme for BM25-only / vectors OFF */
#modeSwitchToast.is-warning {
    --toast-color: rgba(217,119,6,0.92); /* amber-600 */
}
#modeSwitchToast.is-warning .readyline {
    color: rgba(217,119,6,0.92);
}
#modeSwitchToast.is-warning .spinnerline {
    color: rgba(245,158,11,0.75); /* amber-500 */
}

/* -----------------------------
    Neural search refresh UX
    - Subtle top shimmer bar while fetching
    - No spinners, no layout shifts
    ----------------------------- */
#resultsContainer {
    position: relative;
}

/* A 3px shimmer bar at the top - purely decorative */
#resultsContainer.is-refreshing::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    background: linear-gradient(
    90deg,
    rgba(37, 99, 235, 0.00) 0%,
    rgba(37, 99, 235, 0.35) 15%,
    rgba(37, 99, 235, 1.00) 35%,
    rgba(37, 99, 235, 0.35) 55%,
    rgba(37, 99, 235, 0.00) 70%
    );
    background-size: 220% 100%;
    animation: resultsShimmer 1200ms linear infinite;
    pointer-events: none;
    z-index: 5;
    opacity: 0.85;
}

@keyframes resultsShimmer {
    0% { background-position: 200% 0; opacity: 0.35; }
    50% { opacity: 0.85; }
    100% { background-position: -40% 0; opacity: 0.35; }
}

/* -----------------------------
    MKN-10 range hover tooltip
    ----------------------------- */
.mkn-hover {
    position: relative;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
}
.mkn-hover { pointer-events: auto; }
.mkn-hover[href] { pointer-events: none; }

#mknRangeTooltip {
    position: fixed;
    z-index: 10000;
    max-width: min(1100px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid rgba(59,130,246,0.25);
    background: rgba(255,255,255,0.98);
    box-shadow: 0 18px 48px rgba(0,0,0,0.18);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
}

#mknRangeTooltip.show { display: block; }

#mknRangeTooltip .tipInner { padding: 12px 12px 10px 12px; }

#mknRangeTooltip .tipTitle {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(37, 99, 235, 0.95);
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* Subtle title for single-code tooltip ("MKN-10") */
#mknRangeTooltip.is-single .tipTitle {
    color: rgba(107,114,128,0.9); /* gray-500 */
}

#mknRangeTooltip .tipMeta {
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
    font-size: 11px;
    color: rgba(107,114,128,0.95);
    letter-spacing: 0.02em;
    text-transform: none;
    line-height: 1;
    position: relative;
    top: -1px;
}

#mknRangeTooltip .tipBody {
    border-top: 1px solid rgba(229,231,235,0.9);
    padding-top: 8px;
    max-height: none;
    overflow: visible;
}

/* Large result layout: two columns + optional remaining aside */
#mknRangeTooltip .tipGrid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
@media (min-width: 640px) {
    #mknRangeTooltip .tipGrid.hasAside {
    grid-template-columns: 1fr 220px;
    align-items: start;
    }
}

#mknRangeTooltip .tipCols {
    column-count: 1;
    column-gap: 14px;
}
@media (min-width: 640px) {
    #mknRangeTooltip .tipCols.isTwoCol {
    column-count: 2;
    }
}
@media (min-width: 1100px) {
    #mknRangeTooltip .tipCols.isThreeCol {
    column-count: 3;
    }
}

/* Prevent rows from splitting across columns */
#mknRangeTooltip .tipCols .tipRow {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
}

#mknRangeTooltip .tipAside {
    border: 1px solid rgba(229,231,235,0.9);
    background: rgba(249,250,251,0.95);
    border-radius: 12px;
    padding: 10px 10px;
}
#mknRangeTooltip .tipAsideTitle {
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
    font-size: 11px;
    letter-spacing: 0.02em;
    color: rgba(107,114,128,0.95);
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 6px;
}
#mknRangeTooltip .tipAsideCodes {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 11px;
    color: rgba(55,65,81,0.95);
    line-height: 1.35;
    word-break: break-word;
    white-space: normal;
}
#mknRangeTooltip.is-exclude .tipAsideCodes {
    color: rgb(190, 18, 60);
}

#mknRangeTooltip .tipRow {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 6px;
    padding: 6px 6px;
    border-radius: 10px;
}

#mknRangeTooltip .tipRow:hover { background: rgba(59,130,246,0.06); }

#mknRangeTooltip .tipCode {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    color: rgba(30, 64, 175, 0.95);
    white-space: nowrap;
    letter-spacing: 0.02em;
}

#mknRangeTooltip.is-exclude .tipTitle {
    color: rgb(190, 18, 60);
}
#mknRangeTooltip.is-exclude .tipCode {
    color: rgb(190, 18, 60);
}

/* Include theme (Zahrnuje) */
#mknRangeTooltip.is-include {
    border-color: rgba(37, 99, 235, 0.35); /* blue-600 */
}
#mknRangeTooltip.is-include .tipTitle {
    color: rgba(37, 99, 235, 0.95);
}
#mknRangeTooltip.is-include .tipCode {
    color: rgba(30, 64, 175, 0.95);
}

#mknRangeTooltip .tipName {
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
    font-size: 12px;
    color: rgba(31,41,55,0.95);
    line-height: 1.25rem;
}

/* Compact mode for large ranges: keep names single-line so more rows fit */
#mknRangeTooltip.is-compact .tipName {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    line-height: 1.1rem;
}
#mknRangeTooltip.is-compact .tipRow {
    padding: 5px 6px;
}

#mknRangeTooltip .tipLoading,
#mknRangeTooltip .tipError {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    color: rgba(107,114,128,0.95);
    padding: 10px 6px;
    white-space: pre-wrap;
}

/* Tiny loading spinner inside tooltip (no URL flash) */
#mknRangeTooltip .tipLoadingRow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
#mknRangeTooltip .tipSpinner {
    width: 12px;
    height: 12px;
    border-radius: 9999px;
    border: 2px solid rgba(107,114,128,0.28); /* gray */
    border-top-color: rgba(37, 99, 235, 0.85); /* blue */
    animation: tipSpin 700ms linear infinite;
    flex: 0 0 auto;
}
@keyframes tipSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#mknRangeTooltip .tipArrow {
    position: absolute;
    width: 14px;
    height: 14px;
    background: rgba(255,255,255,0.98);
    border-left: 1px solid rgba(59,130,246,0.25);
    border-top: 1px solid rgba(59,130,246,0.25);
    transform: rotate(45deg);
}

/* Scope label in tooltip title */
#mknRangeTooltip .tipScope-include {
    color: rgba(37, 99, 235, 0.9); /* blue */
}

#mknRangeTooltip .tipScope-exclude {
    color: rgb(190, 18, 60); /* rose */
}

/* Source of truth link */
#mknRangeTooltip .tipSource {
    font-size: 11px;
    color: rgba(107,114,128,0.9);
    text-decoration: underline;
}
#mknRangeTooltip .tipSource:hover {
    color: rgba(55,65,81,0.95);
}

/* Compact MKN-10 relevance score with a vertical indicator beside the text. */
.mkn10-relevance {
    --relevance-fill: #cbd5e1;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
    margin-left: 16px;
}

.mkn10-relevance-heading {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    white-space: nowrap;
}

.mkn10-relevance-label {
    color: #9ca3af;
    font-size: 11px;
    line-height: 16px;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.mkn10-relevance-value {
    color: #374151;
    font-size: 12px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    line-height: 18px;
}

.mkn10-relevance-track {
    display: flex;
    flex: 0 0 3px;
    flex-direction: column;
    justify-content: flex-end;
    width: 3px;
    height: 36px;
    overflow: hidden;
    border-radius: 999px;
    background: #edf2ef;
}

.mkn10-relevance-fill {
    width: 100%;
    border-radius: inherit;
    background: var(--relevance-fill);
}

.mkn10-relevance--high {
    --relevance-fill: #22c55e;
}

.mkn10-relevance--medium {
    --relevance-fill: #f59e0b;
}

.mkn10-relevance--low {
    --relevance-fill: #ef4444;
}

/* when we scroll a result into view, keep a small top gap */
.resultCard { scroll-margin-top: 12px; }
