@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.fade {
    animation-duration: 0.75s;
    animation-delay: 0.5s;
    animation-name: fadeIn;
    animation-timing-function: cubic-bezier(.26, .53, .74, 1.48);
    animation-fill-mode: backwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

.fade-out {
    animation-duration: 0.5s;
    animation-name: fadeOut;
    animation-timing-function: cubic-bezier(.26, .53, .74, 1.48);
    animation-fill-mode: backwards;
}

.delay-1 {
    animation-delay: 0.6s;
}

.delay-2 {
    animation-delay: 0.7s;
}

.delay-3 {
    animation-delay: 0.8s;
}

.delay-4 {
    animation-delay: 0.9s;
}

.delay-5 {
    animation-delay: 1s;
}

.delay-6 {
    animation-delay: 1.1s;
}

.delay-7 {
    animation-delay: 1.2s;
}

.delay-8 {
    animation-delay: 1.3s;
}

.delay-9 {
    animation-delay: 1.4s;
}

.delay-10 {
    animation-delay: 1.5s;
}

.delay-11 {
    animation-delay: 1.6s;
}

.delay-12 {
    animation-delay: 1.7s;
}

.delay-13 {
    animation-delay: 1.8s;
}

.delay-14 {
    animation-delay: 1.9s;
}

.delay-15 {
    animation-delay: 2s;
}

.app-centered-element {
    display: block;
    margin: 0 auto;
}

.app-centering-container {
    align-items: center;
    display: flex;
    width: 100%;
    height: 100vh;
}

.app-centering-container-inapp {
    align-items: center;
    display: flex;
    width: 100%;
    height: calc(100vh - 72px);
}

.app-no-margin-nav-item a div.mud-nav-link-text {
    margin-left: 0;
}

.app-text-response {
/*    font-size: 0.9em;*/
}

    .app-text-response ol,
    .app-text-response ul {
        padding-left: 20px;
        margin-bottom: 1em;
    }

        .app-text-response ol li,
        .app-text-response ul li {
            margin-bottom: 0.5em;
            /* the markdown library is suppressing the bullet point  */
            list-style-type: disc;
        }

    .app-text-response p {
        margin-bottom: 0.75em;
    }

    .app-text-response p:last-child {
        margin-bottom: 0;
    }

    /* Markdown tables (rendered via MarkdownHelper's pipe-table support). Wide
       tables scroll inside the message, never the page. */
    .app-text-response table {
        border-collapse: collapse;
        margin-bottom: 1em;
        font-size: 0.875rem;
        display: block;
        max-width: 100%;
        overflow-x: auto;
    }

    .app-text-response th,
    .app-text-response td {
        border: 1px solid var(--mud-palette-lines-default);
        padding: 6px 10px;
        text-align: left;
    }

    .app-text-response th {
        background-color: var(--mud-palette-background-gray);
        font-weight: 600;
    }

    .app-text-response tr:nth-child(even) {
        background-color: var(--mud-palette-background-gray);
    }

/* ── Chat surface ──────────────────────────────────────────────────────── */

/* The chat page fills the viewport under the dense app bar (same expression
   the acquire page uses — MudBlazor pads .mud-main-content by
   appbar-height − appbar-height/4 when the bar is Dense). The scroll region
   is the conversation, never the page. */
.chat-page {
    height: calc(100vh - (var(--mud-appbar-height, 64px) - var(--mud-appbar-height, 64px)/4));
    overflow: hidden;
}

/* User message: a tinted bubble, indented from the right margin's assistant
   text (silc-pcpa's tinted-paper pattern, quieter). */
.chat-user-message {
    background-color: var(--mud-palette-background-gray);
    border-radius: 10px;
    padding: 10px 14px;
    margin: 16px 0 12px auto;
    max-width: 85%;
    width: fit-content;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

/* Assistant message: plain page text, no paper chrome — the answer is the
   surface (nsti pattern). */
.chat-assistant-message {
    padding: 0 2px;
    margin-bottom: 4px;
}

/* The live activity line while the agent works ("Searching the data for…"). */
.chat-activity {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--mud-palette-text-secondary);
    font-size: 0.875rem;
    margin: 8px 0;
}

/* Sources block under an assistant message. */
.chat-sources {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid var(--mud-palette-lines-default);
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92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cuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

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

/* Back row at the top of a contextual side-nav section (see SideNav.razor) —
   swaps the drawer to the main menu without navigating. */
.sidenav-back {
    align-items: center;
    color: var(--mud-palette-text-secondary);
    cursor: pointer;
    display: flex;
    font-size: 0.85rem;
    gap: 8px;
    padding: 10px 16px;
}

    .sidenav-back:hover {
        background-color: var(--mud-palette-action-default-hover);
        color: var(--mud-palette-text-primary);
    }

.home-card {
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.home-card:hover {
    border-color: var(--mud-palette-primary);
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}

/* Refined shared surfaces. System fonts only; no new font/image requests. */
:root { --app-ink: #243746; --app-muted: #586c78; --app-line: #dce5e9; }
html { scrollbar-gutter: stable; }
body { color: var(--app-ink); -webkit-font-smoothing: antialiased; }
:focus-visible { outline: 3px solid #087f8c; outline-offset: 3px; }
.app-topbar { background: #fff !important; color: var(--app-ink) !important; border-bottom: 1px solid var(--app-line); }
.app-brand { font-size: 1.08rem !important; font-weight: 750 !important; letter-spacing: -.025em; }
.app-sidebar { border-right: 1px solid var(--app-line); background: #fff; }
.app-sidebar .mud-navmenu { padding: 12px 10px; }
.app-sidebar .mud-nav-link { border-radius: 8px; padding: 11px 12px; margin-bottom: 3px; }
.app-sidebar .mud-nav-link.active { background: #e8f4f4; color: #086b77; font-weight: 650; }
.app-sidebar .mud-nav-link-text { overflow-wrap: anywhere; }
.sidenav-back { width: 100%; border: 0; background: transparent; text-align: left; font: inherit; }
.app-main { background: #f5f7f8; }
.app-main-chat { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: #fff; }
.app-main-chat > .mud-alert { flex: 0 0 auto; }
.mud-paper-outlined { border-color: var(--app-line); border-radius: 12px; }
.mud-dialog { border-radius: 16px !important; }
.mud-dialog-title { border-bottom: 1px solid #edf1f3; }
.mud-dialog-actions { padding: 14px 24px !important; border-top: 1px solid #edf1f3; }
.mud-table-head .mud-table-cell { color: var(--app-muted); font-size: .76rem; font-weight: 650; background: #f7f9fa; }
.mud-table-cell { border-bottom-color: #edf1f3; }
.mud-button-root { border-radius: 8px; }
.mud-input-outlined-border { border-radius: 9px !important; }
.eyebrow { color: #08727e; font-size: .72rem; text-transform: uppercase; letter-spacing: .14em; font-weight: 750; margin-bottom: 12px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 28px 0 22px; }
.page-heading h1 { font-size: 1.8rem; letter-spacing: -.035em; font-weight: 650; margin-bottom: 6px; }
.page-heading p { color: var(--app-muted); max-width: 650px; line-height: 1.6; }
.page-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.home-page { padding-top: clamp(24px, 4vh, 48px); padding-bottom: 32px; }
.home-hero { text-align: center; }
.home-title { font-size: clamp(2rem, 4vw, 3.1rem) !important; font-weight: 650 !important; letter-spacing: -.045em !important; line-height: 1.12 !important; }
.home-hero .mud-typography-body1 { line-height: 1.8; }
.home-start { padding: 12px 22px !important; box-shadow: 0 3px 8px #087f8c18 !important; }
.home-page .mud-paper-outlined { box-shadow: 0 2px 5px #20394703; }
.home-page .mud-typography-h4 { font-size: clamp(1.45rem, 2.4vw, 2rem); font-weight: 650; letter-spacing: -.04em; margin-bottom: 8px; }
.question-card { display: flex; align-items: flex-start; gap: 12px; padding: 20px; height: 100%; background: #fff; border: 1px solid var(--app-line); border-radius: 12px; color: var(--app-ink); font-size: .9rem; line-height: 1.6; transition: border-color 140ms, box-shadow 140ms; }
.question-card > .mud-icon-root { color: #087f8c; flex-shrink: 0; margin-top: 3px; }
.question-card:hover { border-color: #087f8c; box-shadow: 0 4px 14px #173d4810; }
.question-arrow { margin-left: auto; opacity: .55; }
.login-shell { background: radial-gradient(ellipse at top, #e9f4f4, #f5f7f8 70%); padding: 24px; min-height: 100dvh; height: auto; }
.login-card { border: 1px solid var(--app-line); border-radius: 18px; padding: 16px; box-shadow: 0 16px 50px #2437460c !important; }

/* Chat: a single scrolling conversation with a stationary, quiet composer. */
.chat-page { position: relative; flex: 1 1 auto; height: auto; min-height: 0; max-width: 900px !important; padding: 0 28px; }
.chat-page > .mud-stack { padding: 10px 0; }
.chat-page .app-centering-container-inapp { flex: 1; height: auto; min-height: 0; padding-bottom: 7vh; }
.chat-page .app-centered-element { width: 100%; }
.chat-welcome { max-width: 700px; margin: auto; }
.chat-welcome-mark { width: 54px; height: 54px; display: grid; place-items: center; background: #e8f4f4; color: #087f8c; border-radius: 16px; margin-bottom: 24px; }
.chat-welcome h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 650; letter-spacing: -.04em; margin-bottom: 16px; }
.chat-welcome-copy { max-width: 580px; color: var(--app-muted); line-height: 1.75; margin-bottom: 28px; }
.chat-thread { padding: 8px 6px 24px; }
#chat-scroll-container { min-height: 0; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #cad6dc transparent; overflow-anchor: none; }
.chat-user-message { background: #edf4f5; border: 1px solid #e3edef; padding: 13px 18px; border-radius: 16px 16px 4px 16px; margin: 18px 0 24px auto; max-width: 87%; font-size: .95rem; line-height: 1.7; }
.chat-assistant-message { padding: 0 6px; margin: 0 0 28px; }
.app-text-response { line-height: 1.8; font-size: .96rem; overflow-wrap: anywhere; }
.app-text-response h1, .app-text-response h2, .app-text-response h3 { font-weight: 650; letter-spacing: -.02em; line-height: 1.4; margin: 1.4em 0 .55em; }
.app-text-response h1 { font-size: 1.5rem; } .app-text-response h2 { font-size: 1.24rem; } .app-text-response h3 { font-size: 1.08rem; }
.app-text-response > :first-child { margin-top: 0; }
.app-text-response ol li { list-style-type: decimal; }
.app-text-response ul li { list-style-type: disc; }
.app-text-response li > p { margin-bottom: .3em; }
.app-text-response blockquote { border-left: 3px solid #b7d9dc; margin: 1em 0; padding: 4px 18px; color: var(--app-muted); }
.app-text-response pre { white-space: pre; max-width: 100%; overflow-x: auto; background: #f3f6f8; border-radius: 10px; padding: 16px; }
.app-text-response code { font-size: .88em; }
.app-text-response table { border: 1px solid var(--app-line); border-radius: 9px; font-variant-numeric: tabular-nums; line-height: 1.55; }
.app-text-response td, .app-text-response th { border: 0; border-bottom: 1px solid #e8edef; padding: 10px 14px; }
.app-text-response th { background: #eff5f6; color: #395561; }
.app-text-response tr:nth-child(even) { background: #f8fafb; }
.chat-sources { margin-top: 20px; padding: 12px 0 8px; border-top: 1px solid #e5edef; }
.chat-sources::before { content: 'Sources'; display: block; font-size: .7rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--app-muted); margin-bottom: 6px; }
.chat-sources .mud-link { display: block; border-radius: 5px; padding: 3px 0; }
.chat-sources .mud-typography-caption { font-size: .79rem; line-height: 1.6; }
.chat-activity { min-height: 26px; line-height: 1.5; font-size: .83rem; }
.chat-activity .mud-progress-circular { width: 17px !important; height: 17px !important; }
.stream-reveal-tail { mask-image: linear-gradient(to right, #000 0%, #000b 75%, #0006); -webkit-mask-image: linear-gradient(to right, #000 0%, #000b 75%, #0006); }
.chat-composer { flex: 0 0 auto; background: #fff; padding: 14px 0 max(14px, env(safe-area-inset-bottom)); }
.chat-input-shell { position: relative; width: 100%; }
.chat-input-shell .mud-input-control { margin-top: 0; }
.chat-input-shell .mud-input-outlined { border-radius: 15px; background: #fff; }
.chat-input-shell .mud-input-outlined-border { border-radius: 15px !important; border-color: #cbd9df; }
.chat-input-shell .mud-input-slot { padding: 18px 62px 18px 18px !important; line-height: 1.6; }
.chat-input-shell .chat-send { position: absolute; bottom: 10px; right: 10px; background: #087f8c; color: white; width: 36px; height: 36px; }
.chat-input-shell .chat-send:disabled { background: #edf2f4; color: #94a5ae; }
.chat-input-caption { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; color: #617581; font-size: .68rem; padding: 9px 4px 0; line-height: 1.45; }
.chat-jump { display: none; align-self: center; border: 1px solid #cbd9df; border-radius: 20px; background: white; color: #32616b; font-size: .78rem; padding: 8px 16px; box-shadow: 0 2px 7px #20394710; margin: 6px 0 0; cursor: pointer; }
#chat-scroll-container[data-following="false"] + .chat-jump { display: block; }
/* Short, intentional entrance; no staggered multi-second waits on navigation. */
.fade { animation: fadeIn 160ms ease-out both; }
@media (max-width: 600px) {
    .chat-page { padding: 0 14px; }
    .chat-user-message { max-width: 94%; padding: 12px 14px; }
    .chat-thread { padding-left: 0; padding-right: 0; }
    .chat-assistant-message { padding: 0 2px; }
    .chat-key-hint { display: none; }
    .chat-welcome-mark { margin-bottom: 16px; }
    .app-brand { font-size: .98rem !important; }
    .app-account .mud-button-root { font-size: .75rem; padding-left: 5px; padding-right: 5px; }
    .page-heading { align-items: flex-start; flex-direction: column; margin-top: 22px; }
    .home-page { padding-top: 30px; }
    .page-toolbar > * { flex: 1 1 200px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
    .stream-reveal-tail { mask-image: none; -webkit-mask-image: none; }
}

.section-card-title { font-size: 1.05rem; font-weight: 650; margin-bottom: 8px; }
.source-toolbar { align-items: flex-start; }
.source-toolbar .mud-typography-h6 { overflow-wrap: anywhere; min-width: 0; font-size: 1.05rem; }
.mud-grid-item { min-width: 0; }

.settings-toolbar { flex-wrap: wrap; gap: 12px; }
@media (max-height: 650px) { .chat-page .app-centering-container-inapp { overflow-y: auto; display: block; padding-top: 20px; padding-bottom: 20px; } }

.app-text-response table { width: fit-content; }

.app-brand { white-space: nowrap; }
.app-account { flex-shrink: 0; }
.account-name { margin-left: 7px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Size the picker from the space left after the app bar and anonymous banner,
   not a second full viewport. Only a long history needs its own scrollbar. */
.app-main:has(> .tools-page) { height: 100dvh; display: flex; flex-direction: column; }
.app-main:has(> .tools-page) > .mud-alert { flex: 0 0 auto; }
.tools-page { flex: 1; min-height: 0; padding-top: 24px; padding-bottom: 24px; overflow-y: auto; }
.assistant-picker { max-width: 640px; max-height: 100%; margin: 0 auto; display: flex; flex-direction: column; }
.assistant-picker-content { display: flex; flex-direction: column; min-height: 0; }
.assistant-picker-content > .mud-paper { flex: 0 0 auto; }
.assistant-picker-content > .recent-conversations-card { flex: 0 1 auto; display: flex; flex-direction: column; min-height: 160px; }
.recent-conversations-card > .mud-typography { flex: 0 0 auto; }
.recent-conversations { min-height: 0; overflow-y: auto; }
.responsive-toolbar { flex-wrap: wrap; gap: 12px; }
.responsive-toolbar > .mud-input-control { flex: 1 1 220px; min-width: 0; }
.responsive-toolbar > div:not(.mud-spacer):not(.mud-chip):not(.mud-input-control) { min-width: 0; }
@media (max-width: 600px) { .account-name { display: none; } .app-account .mud-button-root { min-width: 40px; } }

/* Tool receipts stay with the answer rather than appearing/disappearing above it. */
.tool-activity-panel { border: 1px solid #e0e9ed; background: #f8fafb; border-radius: 10px; margin: 0 0 20px; font-size: .8rem; color: var(--app-muted); }
.tool-activity-panel > summary { display: flex; align-items: center; gap: 9px; padding: 11px 13px; cursor: pointer; list-style: none; }
.tool-activity-panel > summary::-webkit-details-marker { display: none; }
.tool-status-icon, .tool-step-state .mud-icon-root, .tool-step-state .mud-progress-circular { width: 17px !important; height: 17px !important; flex-shrink: 0; }
.tool-status-icon { color: #087f8c; }
.tool-activity-title { flex: 1; }
.tool-activity-chevron { font-size: 1rem; transition: transform 120ms; }
.tool-activity-panel[open] .tool-activity-chevron { transform: rotate(180deg); }
.tool-activity-list { list-style: none; padding: 3px 14px 0; margin: 0; }
.tool-step { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid #e7edf0; }
.tool-step-state { color: #197259; padding-top: 2px; }
.tool-step-error { color: #956619; }
.tool-step-name { color: var(--app-ink); font-weight: 600; }
.tool-step-status { font-size: .65rem; margin-left: 9px; color: var(--app-muted); }
.tool-step-detail { margin: 3px 0 0; line-height: 1.6; overflow-wrap: anywhere; }
.tool-source-link { border: 0; background: transparent; color: #086b77; font: inherit; font-size: .74rem; padding: 4px 0; cursor: pointer; }
.tool-source-link:hover { text-decoration: underline; }
.tool-activity-note, .tool-empty { font-size: .69rem; padding: 8px 14px; margin: 0; color: var(--app-muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.account-trigger { display: inline-flex; align-items: center; padding: 8px; font-size: .8rem; font-weight: 600; }

.source-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: .75rem; line-height: 1.6; color: var(--app-muted); margin-bottom: 14px; }

.data-browser-table .mud-table-container { max-height: min(60dvh, 600px); }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-iteration-count: 1 !important; }
}
