/*
 * Action Support: presentation-only refinements over the existing app.css.
 * No hidden actions, replacement components, scripts, fonts, or network assets.
 * Existing semantic error/warning colors and all application behavior are retained.
 */
:root {
    --support-green: #145a43;
    --support-green-deep: #104d39;
    --support-green-tint: #edf4f0;
    --support-ink: #18251f;
    --support-muted: #67726c;
    --support-line: #e2e8e4;
    --support-surface: #ffffff;
    --support-canvas: #fafcfb;
}

.shell, .public-shell, .support-loading {
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Keep Mud typography on the same local font stack as the surrounding shell. */
.shell .mud-typography, .shell .mud-button, .shell .mud-nav-link, .shell .mud-chip { font-family: inherit; }

.shell {
    grid-template-columns: 208px minmax(0, 1fr);
    height: 100vh;
    height: 100dvh;
    background: var(--support-canvas);
}
.shell *, .shell *::before, .shell *::after { box-sizing: border-box; }
.shell-main { overflow: hidden; }
.app-rail {
    padding: 28px 14px 18px;
    background: #f5f7f6;
    border-color: var(--support-line);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    min-height: 0;
}
.support-brand { display: flex; flex-direction: column; align-items: flex-start; padding: 0 12px 30px; flex-shrink: 0; }
.support-brand-logo { display: block; width: 126px; max-width: 100%; height: auto; }
.support-brand-name { margin-top: 16px; color: var(--support-ink); font-size: 24px; font-weight: 600; letter-spacing: -.035em; line-height: 1.25; }
.support-brand-tagline { color: var(--support-muted); font-size: 11px; margin-top: 4px; }
.rail-nav { flex: 0 1 auto; width: 100%; min-width: 0; max-width: 100%; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; margin-bottom: 24px; }
.rail-nav .mud-nav-group, .rail-nav .mud-navmenu { min-width: 0; width: 100%; max-width: 100%; }
.rail-nav .mud-nav-link { width: 100%; min-width: 0; min-height: 42px; border: 1px solid transparent; border-radius: 9px; font-size: 12.5px; color: #526057; transition: background-color 140ms ease, color 140ms ease; }
.rail-nav .mud-nav-link-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rail-nav .mud-nav-group .mud-nav-link { margin-left: 0; }
.rail-nav .mud-nav-link .mud-nav-link-icon { color: #78847c; }
.rail-nav .mud-nav-link.active { background: #f0f5f2; border-color: #dfe9e2; color: var(--support-green-deep); font-weight: 600; box-shadow: none; }
.rail-nav .mud-nav-link.active .mud-nav-link-icon { color: var(--support-green); }
.rail-nav .mud-nav-link:hover { background: #eaf0ec; }
.rail-nav .mud-nav-group { margin-top: 10px; }
/* Menu sections (Resources, Environmental): not collapsible, set off by a rule above and below.
   Adjacent sections share one rule. In the collapsed rail the heading text is hidden. */
.rail-section { border-top: 1px solid var(--support-line); border-bottom: 1px solid var(--support-line); margin: 10px 0; padding: 6px 0 2px; }
.rail-section + .rail-section { border-top: 0; margin-top: -10px; }
.rail-heading { margin: 4px 12px 4px; color: var(--support-muted); font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.rail-divider { height: 1px; margin: 10px 10px; background: var(--support-line); }
.rail-footer { border-top-color: var(--support-line); padding: 14px 6px 0; flex-shrink: 0; }
.support-rail-caption { font-size: 9px !important; font-weight: 650 !important; letter-spacing: .15em !important; }
.user-row { margin-top: 15px; gap: 9px; }
.user-row .mud-avatar { flex-shrink: 0; background: #e1eae5; color: var(--support-green); font-size: 11px; font-weight: 650; }
.user-display-name { font-size: 12px !important; font-weight: 600 !important; }
.user-upn { font-size: 10px !important; max-width: 130px; }
.rail-signout { margin-top: 12px; min-height: 34px; border-radius: 7px; font-size: 11px; }
.rail-signout:hover { background: #e8efeb; color: var(--support-green); }

/* Conversation history and persistent header. */
.chat-page { height: 100%; min-height: 0; grid-template-columns: 252px minmax(0, 1fr); background: #fff; }
.session-pane, .helpdesk-page .session-pane { min-width: 0; padding: 24px 14px 16px; background: #fff; border-color: var(--support-line); }
.session-pane-header { align-items: center; padding: 0 2px 15px; }
.session-pane-title { font-size: 13px; font-weight: 650; letter-spacing: -.01em; }
.session-pane .new-session-button {
    background: var(--support-green) !important;
    border: 1px solid var(--support-green);
    border-radius: 9px;
    box-shadow: 0 2px 4px rgba(20,90,67,.08);
    min-height: 40px;
    font-size: 12px;
}
.session-pane .new-session-button:hover { background: var(--support-green-deep) !important; }
.session-list { margin-top: 18px; min-height: 0; scrollbar-width: thin; padding-right: 2px; }
.session-row { border: 1px solid transparent; margin-bottom: 4px; border-radius: 9px; }
.session-row:hover { background: #f5f8f6; }
.session-row.selected { background: #f0f5f2; border-color: #dfe9e2; }
.session-item { gap: 8px; padding: 12px 3px 12px 9px; }
.session-leading-icon { color: #7a887f; }
.session-row.selected .session-leading-icon { color: var(--support-green); }
.session-title { font-size: 12px; font-weight: 600; }
.session-age { font-size: 10.5px; margin-top: 3px; }
.session-delete { opacity: .6; }
.conversation-pane, .helpdesk-page .conversation-pane { background: var(--support-canvas); }
.conversation-topbar { height: auto; min-height: 62px; flex-shrink: 0; padding: 12px 26px; gap: 12px; background: rgba(255,255,255,.98); border-color: var(--support-line); }
.conversation-topbar-title { min-width: 0; }
.support-breadcrumb { font-size: 11.5px !important; letter-spacing: .01em; }
.conversation-topbar-right { flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.conversation-topbar-right .mud-chip { font-size: 10px; border-color: #e0e6e2; color: #6c7770; background: #fafcfb; margin: 0; }
.conversation-topbar-right .mud-button { text-transform: none; font-size: 11px; font-weight: 600; }
.session-usage { font-size: 11px; gap: 8px; }

/* Welcome screen: familiar heading, real composer, unchanged prompt actions. */
.empty-chat {
    min-height: 0;
    flex: 1 1 0;
    overflow-y: auto;
    overflow-x: hidden;
    justify-content: flex-start;
    padding: 36px 32px;
    transform: none;
    scrollbar-gutter: stable;
    background: radial-gradient(ellipse at 50% 12%, rgba(225,237,229,.35), transparent 58%);
}
.empty-chat::before, .empty-chat::after { content: ""; flex: 1 0 0; }
.empty-chat > * { flex-shrink: 0; }
.support-welcome-kicker { display: flex; align-items: center; gap: 11px; color: var(--support-green); font-size: 10px; font-weight: 650; letter-spacing: .21em; text-transform: uppercase; margin: 0 0 17px; }
.support-welcome-kicker > span { width: 22px; height: 5px; border-top: 2px solid currentColor; border-bottom: 1px solid currentColor; }
.support-welcome-title { color: var(--support-ink); font-family: Georgia, "Times New Roman", serif; font-size: clamp(32px, 3.2vw, 46px); font-weight: 400; line-height: 1.11; letter-spacing: -.038em; text-align: center; margin: 0 0 18px; }
.support-welcome-copy { width: min(540px, 100%); text-align: center; font-size: 13px !important; line-height: 1.75 !important; margin-bottom: 28px !important; }
.empty-composer-wrap, .suggestions, .test-skill-warning { width: min(720px, 100%); min-width: 0; }
.empty-greeting { text-align: center; }
.empty-chat > .mud-typography-body2 { max-width: 600px; text-align: center; }
.support-suggestions { margin-top: 26px; padding: 0; border: 0 !important; background: transparent !important; box-shadow: none; }
.support-suggestions-title { display: block; font-size: 9px !important; letter-spacing: .15em !important; line-height: 1.5 !important; margin-bottom: 12px !important; color: #68786e !important; font-weight: 600 !important; }
.support-suggestion-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.support-suggestion-grid .suggestion { align-items: flex-start; gap: 12px; padding: 15px 14px; border: 1px solid var(--support-line); border-radius: 10px; background: #fff; height: 100%; min-height: 98px; transition: border-color 140ms ease, background-color 140ms ease; }
.support-suggestion-grid .suggestion:hover { background: #f5f9f6; border-color: #a8c1b1; }
.support-suggestion-icon { width: 29px; height: 29px; flex: 0 0 29px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: var(--support-green); background: #eff5f1; }
.support-suggestion-icon .mud-icon-root { width: 18px; height: 18px; }
.support-suggestion-copy { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.support-suggestion-copy strong { font-size: 11.5px; font-weight: 650; color: #273a2f; line-height: 1.4; }
.support-suggestion-copy > span { color: #69766d; font-size: 11px; line-height: 1.6; }

/* The composer is in normal flex flow, so a growing input never covers messages. */
.conversation-scroll { padding: 28px 26px 18px; scrollbar-width: thin; }
.conversation-width { width: min(840px, 100%); min-width: 0; margin: 0 auto; }
.composer-dock, .helpdesk-page .composer-dock { position: relative; flex: 0 0 auto; padding: 12px 26px 24px; background: var(--support-canvas); border-top: 1px solid transparent; }
.chat-composer { border-radius: 12px !important; border-color: #dbe5df !important; box-shadow: 0 4px 20px rgba(22,48,34,.045); transition: border-color 140ms ease, box-shadow 140ms ease; }
.chat-composer:focus-within { border-color: #85aa94 !important; box-shadow: 0 0 0 3px rgba(20,90,67,.06), 0 4px 20px rgba(22,48,34,.045); }
.chat-composer .mud-input-root { font-family: inherit; font-size: 13px; line-height: 1.6; }
.chat-composer .mud-input::before, .chat-composer .mud-input::after { border-bottom: none !important; }
.chat-composer .composer-toolbar { border-top-color: #eef2ef; gap: 10px; padding-top: 8px; }
.helpdesk-composer-label { font-size: 10.5px; letter-spacing: .01em; color: #718076; }
.helpdesk-composer-label::before { content: ""; display: inline-block; width: 12px; height: 4px; border-top: 1px solid #648a73; border-bottom: 1px solid #648a73; margin-right: 7px; }
.composer-actions { flex: 0 0 auto; gap: 4px; }
/* MudIconButton's primary color can also color its nested SVG. Set both explicitly. */
.composer-actions .composer-send:not(:disabled):not(.mud-disabled) {
    color: #fff !important;
    background: var(--support-green);
    border-radius: 9px;
}
.composer-actions .composer-send:not(:disabled):not(.mud-disabled) svg,
.composer-actions .composer-send:not(:disabled):not(.mud-disabled) .mud-icon-root {
    color: #fff !important;
    fill: currentColor;
}
.composer-actions .composer-send:disabled,
.composer-actions .composer-send.mud-disabled {
    background: #edf1ee;
    color: #85968c !important;
    border-radius: 9px;
}
.composer-actions .composer-send:disabled svg,
.composer-actions .composer-send.mud-disabled svg { color: #85968c !important; fill: currentColor; }
.attachment-picker { border-radius: 9px; }
.attachment-picker:hover { background: #edf4f0; color: var(--support-green); }
.provider-controls { flex-wrap: wrap; min-width: 0; }
.provider-select { max-width: 100%; }
.model-input { max-width: 100%; }
.message-block { margin-bottom: 26px; min-width: 0; }
.user-bubble { background: #edf3ef; border: 1px solid #e1e9e3; border-radius: 14px 14px 4px 14px; padding: 13px 16px; max-width: 85%; color: #23382c; overflow-wrap: anywhere; }
.assistant-answer { color: #27322c; }
.markdown-body { font-size: 14px; line-height: 1.78; overflow-wrap: anywhere; }
.markdown-body a { color: var(--support-green); text-underline-offset: 3px; }
.markdown-body pre { max-width: 100%; }
.markdown-body table { display: block; overflow-x: auto; max-width: 100%; }
.trace-title { min-width: 0; flex-wrap: wrap; }
.trace-name { overflow-wrap: anywhere; }
.trace-content, .trace-panels { min-width: 0; }
.trace-panels .mud-expand-panel-header { border-radius: 7px; }
.trace-summary { font-size: 10.5px; }
.trace-skill-chip { border-color: #d5e1d9; background: #f0f6f2; color: #3c654b; }
.agent-working { font-size: 12px; color: #6d7d71; }

/* Quiet shared treatment for knowledge, user admin, history, and test pages. */
.admin-page, .knowledge-page, .auth-diagnostics-page, .skills-page {
    height: 100%; min-height: 0; box-sizing: border-box;
    padding: 34px 34px 48px;
    background: linear-gradient(155deg, #f7faf8 0%, #fbfcfc 44%, #fafcfb 100%);
    scrollbar-width: thin;
}
.admin-page-header, .knowledge-header, .auth-diagnostics-header, .page-header { gap: 20px; margin-bottom: 26px; }
.admin-page-header > div, .knowledge-header > div, .auth-diagnostics-header > div, .page-header > div { min-width: 0; }
.admin-page-header .mud-typography-h5, .knowledge-header .mud-typography-h5,
.auth-diagnostics-header .mud-typography-h5, .page-header .mud-typography-h5 {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 400; letter-spacing: -.03em; font-size: 32px; line-height: 1.25;
    color: var(--support-ink); margin: 9px 0 10px !important;
}
.admin-page-header .mud-typography-body2, .knowledge-header .mud-typography-body2,
.auth-diagnostics-header .mud-typography-body2, .page-header .mud-typography-body2 { max-width: 800px; line-height: 1.75; font-size: 12px; }
.admin-page-header .mud-typography-caption, .auth-diagnostics-header .mud-typography-caption,
.knowledge-header .mud-typography-caption, .page-header .mud-typography-caption { font-size: 10.5px; letter-spacing: .025em; }
.admin-card, .knowledge-card, .auth-diagnostics-card, .skill-list-card, .skill-editor-card, .usage-summary-card {
    border-radius: 12px !important;
    border-color: var(--support-line) !important;
    box-shadow: 0 3px 12px rgba(24,48,32,.025);
}
.usage-summary-grid { gap: 14px; }
.usage-summary-card { border-radius: 16px !important; }
.usage-summary-card strong { color: #23412f; font-size: 25px; letter-spacing: -.02em; }
.admin-table-wrap { border-radius: 11px; }
.admin-table th { background: #f5f8f6; color: #516558; font-weight: 650; }
.admin-table th, .admin-table td { padding: 14px 16px; border-color: #edf1ee; }
.admin-table tbody tr:hover td { background: #f8fbf9; }
.admin-section-title .mud-typography-h6 { font-size: 16px; }
.admin-page .mud-button, .knowledge-page .mud-button, .auth-diagnostics-page .mud-button, .skills-page .mud-button { text-transform: none; font-size: 12px; border-radius: 8px; }
.knowledge-empty { border-color: #d5e2d9; background: #fbfdfb; border-radius: 10px; }
.knowledge-upload { border-color: #d2dfd6; color: #41604b; }
.knowledge-upload:hover { background: #f0f6f2; }
.skill-list-item.selected { background: #edf4ef; }
.skill-list-item:hover { background: #f5f8f6; }
.mode-pill { background: #f2f6f3; border-color: #dce6df; color: #53705d; }
.shell .mud-button:focus-visible, .shell button:focus-visible, .shell a:focus-visible,
.auth-message-wrap a:focus-visible { outline: 2px solid #477e61; outline-offset: 3px; }

/* Public sign-in-required/denied messages and initial WASM loading screen. */
.public-shell { background: #fff; }
.auth-message-wrap { height: 100vh; height: 100dvh; overflow-y: auto; background: linear-gradient(145deg, #fbfcfb 35%, #edf4ef 100%); }
.auth-message-card { border-radius: 16px !important; border-color: #dfe8e1 !important; box-shadow: 0 12px 38px rgba(17,48,30,.055) !important; padding: 36px !important; }
.support-auth-logo { display: block; width: 140px; height: auto; margin-bottom: 28px; }
.support-auth-kicker { color: var(--support-green); font-size: 10px; letter-spacing: .17em; font-weight: 650; text-transform: uppercase; margin-bottom: 20px; }
.auth-message-card .mud-typography-h5 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: 28px; }
.auth-message-card .mud-typography-body2 { line-height: 1.75; font-size: 13px; }
.auth-message-card .mud-button { text-transform: none; }
.support-loading { height: 100vh; height: 100dvh; overflow: auto; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 18px; background: #fafcfb; padding: 24px; text-align: center; }
.support-loading img { width: 150px; height: auto; }
.support-loading h1 { font-family: Georgia, "Times New Roman", serif; font-size: 30px; font-weight: 400; margin: 12px 0 0; letter-spacing: -.03em; color: var(--support-ink); }
.support-loading p { font-size: 13px; color: #6d7971; margin: 0; }

@media (max-width: 1200px) {
    .shell { grid-template-columns: 180px minmax(0,1fr); }
    .support-brand { padding-inline: 6px; }
    .support-brand-logo { width: 116px; }
    .chat-page { grid-template-columns: 222px minmax(0,1fr); }
    .session-pane { padding-inline: 10px; }
    .empty-chat { padding-inline: 24px; }
    .support-suggestion-grid .suggestion { padding: 12px; gap: 9px; }
    .support-suggestion-copy > span { font-size: 10.5px; }
    .user-upn { max-width: 105px; }
    .skills-grid { grid-template-columns: minmax(210px, .65fr) minmax(0,1fr); }
}
@media (max-width: 1000px) {
    .shell { grid-template-columns: 72px minmax(0,1fr); }
    .app-rail { padding: 22px 7px 14px; }
    .support-brand { align-items: center; padding: 0 0 25px; }
    .support-brand-logo { width: 56px; }
    .support-brand-name { font-size: 11px; margin-top: 10px; letter-spacing: 0; }
    .support-brand-tagline, .support-rail-caption { display: none !important; }
    .rail-nav .mud-nav-link { padding: 10px 12px; min-height: 42px; }
    .rail-nav .mud-nav-link-icon { margin-inline-end: 0; }
    .rail-nav .mud-nav-link-text, .rail-footer .mud-typography, .user-copy { display: none !important; }
    .rail-nav .mud-nav-group .mud-nav-link { margin-left: 0; }
    .rail-nav .mud-nav-group .mud-nav-link-expand-icon { width: 10px; margin-left: 0; }
    .rail-nav .mud-nav-group .mud-navmenu { margin-left: 0; padding-left: 0; }
    .rail-footer { padding-inline: 0; }
    .user-row { justify-content: center; }
    .user-row > .mud-avatar { display: inline-flex !important; }
    .rail-signout { justify-content: center; min-height: 40px; }
    .rail-signout > span { display: none; }
    .chat-page { grid-template-columns: 214px minmax(0,1fr); }
    .conversation-topbar { padding-inline: 18px; }
    .conversation-topbar-right { gap: 6px; }
    .empty-chat { padding: 26px 20px; }
    .support-welcome-title { font-size: 36px; }
    .admin-page, .knowledge-page, .auth-diagnostics-page, .skills-page { padding: 26px 24px 40px; }
}
@media (max-width: 760px) {
    .shell { grid-template-columns: 60px minmax(0,1fr); }
    .support-brand-logo { width: 46px; }
    .support-brand-name { font-size: 10px; }
    .app-rail { padding-inline: 5px; }
    .rail-nav .mud-nav-link { padding-inline: 10px; }
    .chat-page { grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(0,1fr); }
    .session-pane, .helpdesk-page .session-pane { display: grid; grid-template-columns: minmax(0,1fr) auto; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--support-line); }
    .session-pane-header { padding: 0; gap: 4px; align-self: center; }
    .session-pane-title { font-size: 11px; }
    .session-pane .new-session-button { min-height: 36px; font-size: 11px; width: auto; padding-inline: 10px; align-self: center; }
    .session-list { grid-column: 1 / -1; display: flex; overflow-x: auto; overflow-y: hidden; gap: 6px; margin-top: 8px; padding-bottom: 3px; max-height: 74px; }
    .session-row { flex: 0 0 170px; margin: 0; }
    .session-item { padding-block: 9px; }
    .session-list > .mud-typography { padding: 3px 0 !important; font-size: 10px !important; }
    .session-title { font-size: 10.5px; }
    .session-age { font-size: 9px; }
    .session-delete { opacity: .8; }
    .conversation-topbar { min-height: 50px; padding: 8px 14px; align-items: center; }
    .support-breadcrumb { font-size: 10px !important; }
    .conversation-topbar-right { column-gap: 4px; row-gap: 4px; }
    .session-usage { flex-wrap: wrap; gap: 3px 6px; font-size: 10px; }
    .empty-chat { padding: 25px 18px; }
    .support-welcome-kicker { font-size: 9px; letter-spacing: .15em; margin-bottom: 13px; }
    .support-welcome-title { font-size: 32px; margin-bottom: 14px; }
    .support-welcome-copy { font-size: 12px !important; margin-bottom: 22px !important; }
    .support-suggestion-grid { grid-template-columns: 1fr; }
    .support-suggestion-grid .suggestion { min-height: 78px; }
    .support-suggestion-copy > span { font-size: 11px; }
    .support-suggestions { margin-top: 22px; }
    .conversation-scroll { padding: 20px 16px 12px; }
    .composer-dock, .helpdesk-page .composer-dock { padding: 10px 12px max(14px, env(safe-area-inset-bottom)); }
    .user-bubble { max-width: 92%; padding: 11px 13px; font-size: 13px; }
    .markdown-body { font-size: 13px; }
    .chat-composer .composer-toolbar { flex-wrap: wrap; }
    .composer-actions { margin-left: auto; }
    .provider-controls.helpdesk-composer-label { font-size: 9px; }
    .admin-page, .knowledge-page, .auth-diagnostics-page, .skills-page { padding: 22px 18px 36px; }
    .admin-page-header, .knowledge-header, .auth-diagnostics-header, .page-header { flex-direction: column; gap: 14px; }
    .usage-summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
    .usage-summary-card { padding: 14px !important; }
    .usage-summary-card strong { font-size: 21px; }
    .skills-grid, .knowledge-grid { grid-template-columns: minmax(0,1fr); }
    .skill-editor-card { min-height: 0; }
    .skill-empty { min-height: 220px; }
    .skill-editor-top { grid-template-columns: 1fr; }
    .editor-actions, .knowledge-card-title, .admin-section-title { flex-wrap: wrap; }
    .knowledge-card-title { gap: 10px; }
    .pipeline-list > div { grid-template-columns: 12px 72px minmax(0,1fr); font-size: 11px; }
    .admin-card { padding: 12px !important; }
    .diagnostic-grid { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 420px) {
    .session-pane, .helpdesk-page .session-pane { grid-template-columns: 1fr; padding: 8px 12px; }
    .session-pane-header { justify-content: space-between; margin-bottom: 4px; }
    .session-pane .new-session-button { width: 100%; }
    .session-list { max-height: 65px; }
    .conversation-topbar { flex-wrap: wrap; gap: 4px; }
    .conversation-topbar-title { flex: 1 0 100%; }
    .conversation-topbar-right { width: 100%; justify-content: flex-start; }
    .empty-chat { padding-inline: 14px; }
    .support-welcome-title { font-size: 28px; }
    .support-welcome-copy { font-size: 11.5px !important; }
    .support-suggestion-grid .suggestion { padding: 11px 10px; gap: 9px; }
    .support-suggestion-icon { width: 25px; height: 25px; flex-basis: 25px; }
    .helpdesk-composer-label::before { display: none; }
    .usage-summary-grid { grid-template-columns: minmax(0,1fr); }
    .auth-message-card { padding: 24px !important; }
}
@media (prefers-reduced-motion: reduce) {
    .shell *, .shell *::before, .shell *::after { scroll-behavior: auto !important; transition-duration: 0s !important; }
}

@media (max-width: 1000px) {
    .rail-nav .mud-nav-link { gap: 0; }
}
@media (max-width: 760px) {
    .rail-nav .mud-nav-group > .mud-nav-link { padding-inline: 8px; }
}
@media (max-width: 760px) and (max-height: 520px) {
    /* Short landscape windows can scroll the stacked panels; no controls are removed. */
    .chat-page { grid-template-rows: auto minmax(380px, 1fr); overflow-y: auto; }
}
@media (max-height: 600px) {
    .auth-message-wrap { align-items: flex-start; }
}

/* Closed Helpdesk sessions: visible for review, unavailable for further interaction. */
.helpdesk-page .session-row.session-closed { background: #f3f4f6; border-color: #e5e7eb; opacity: .68; }
.helpdesk-page .session-row.session-closed.selected { background: #e8ebed; border-color: #cbd1d6; opacity: .86; }
.helpdesk-page .session-closed .session-leading-icon { color: #78838c; }
.helpdesk-page .session-closed .session-title { color: #5f6c76; }
.helpdesk-page .session-outcome { font-weight: 600; color: #6e7780; }
.helpdesk-page .helpdesk-transcript-closed { background: #f6f7f8; }
.helpdesk-page .helpdesk-transcript-closed .conversation-width > :not(.helpdesk-closed-notice) { opacity: .8; }
.helpdesk-page .helpdesk-closed-notice { margin-top: 18px; margin-bottom: 16px; opacity: 1; }
.helpdesk-page .helpdesk-closed-dock { background: #f0f2f3; border-top: 1px solid #e2e5e8; color: #66727d; }
.helpdesk-page .helpdesk-closed-dock .conversation-width { display: flex; align-items: center; gap: 9px; font-size: 12px; padding-block: 5px; }
.helpdesk-page .helpdesk-outcome-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; margin-top: 10px; flex-wrap: wrap; }
.helpdesk-page .helpdesk-outcome-hint { font-size: 12px; color: #687782; }
.helpdesk-page .helpdesk-outcome-buttons { display: flex; align-items: center; gap: 8px; }
.helpdesk-page .helpdesk-outcome-buttons .mud-button-root { font-size: 12px; }
@media (max-width: 760px) {
    .helpdesk-page .helpdesk-outcome-actions { align-items: flex-start; flex-direction: column; }
    .helpdesk-page .helpdesk-outcome-buttons { flex-wrap: wrap; width: 100%; }
}

/* Admin information architecture: rounded cards without accent stripes. */
.reference-folder-label { display:block; font-size:12px; font-weight:650; color:#344c3d; margin-bottom:8px; }
.reference-folder-controls { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.reference-folder-input { flex:1 1 340px; padding:11px 12px; border-radius:10px; border:1px solid #cad8cf; font:13px Consolas,monospace; background:#fff; min-width:0; }
.reference-folder-input:focus { outline:2px solid #85b098; outline-offset:1px; }
.admin-filter-row { display:flex; flex-wrap:wrap; gap:16px; align-items:end; margin-bottom:18px; }
.admin-filter-field { min-width:170px; display:flex; flex-direction:column; gap:6px; font-size:12px; color:#50665a; }
.admin-filter-field input,.admin-filter-field select { border:1px solid #ccd9d0; padding:9px 12px; background:#fff; border-radius:9px; color:#25352b; min-height:38px; }
.admin-sessions-row { cursor:default; }
.admin-sessions-row[aria-selected="true"] td { background:#edf6ef !important; }
.session-status { display:inline-flex; padding:4px 9px; background:#f0f5f1; color:#345a41; border:1px solid #dee9df; border-radius:999px; font-size:11px; white-space:nowrap; }
.session-status.deleted { color:#737b82; background:#f3f4f6; border-color:#e2e5e8; }
.admin-transcript { padding:20px; margin-top:20px; }
.admin-transcript-messages { display:flex; flex-direction:column; gap:13px; }
.admin-transcript-message { padding:13px 16px; background:#f8fbf9; border:1px solid #e2eae4; border-radius:12px; }
.admin-transcript-message.user { background:#f2f5f8; border-color:#dee5ea; }
.admin-transcript-message-label { font-size:11px; font-weight:700; margin-bottom:7px; color:#46604e; }
.admin-transcript-message-body { font-size:13px; line-height:1.6; overflow-wrap:anywhere; white-space:pre-wrap; }
.admin-transcript-message-body.markdown-body { white-space:normal; }


/* Admin transcript and ticket detail dialogs: open over the current table,
   rather than invisibly below a long sessions list. */
.admin-session-modal-scrim {
    position: fixed; inset: 0; z-index: 1300; display:flex;
    align-items:center; justify-content:center; padding: 18px;
    background: rgba(20, 32, 27, .58);
}
.admin-session-modal-wrap { width: min(860px, 100%); max-height: min(88vh, 980px); display:flex; }
.admin-session-modal {
    width: 100%; max-height: min(88vh, 980px);
    display:flex; flex-direction:column; overflow:hidden;
    border-radius:18px !important; background: #fff;
    box-shadow:0 22px 65px rgba(0,0,0,.22) !important;
    padding: 22px;
}
.admin-session-modal-header { flex: 0 0 auto; margin-bottom: 12px; }
.admin-session-modal-content { overflow-y:auto; min-height: 0; padding: 2px 4px 6px 0; }
.admin-ticket-links { display:flex; flex-wrap:wrap; gap:6px; max-width:220px; }
.admin-ticket-link { display:inline-block; font-size:11px; font-weight:700;
    border:1px solid #b8d6c4; padding:4px 7px; border-radius:8px;
    text-decoration:none; color:#185b3d; background:#f2f9f3; }
.admin-ticket-link:hover { background:#e3f1e7; text-decoration:underline; }
.admin-search-wide { flex: 1 1 280px; }
.knowledge-pager { display:flex; gap:16px; align-items:center; justify-content:space-between;
    flex-wrap:wrap; padding:14px 20px; border-top:1px solid #e4eae5; }
.knowledge-pager-buttons { display:flex; align-items:center; gap:8px; }
.knowledge-detail-meta { display:flex; flex-wrap:wrap; gap:9px 20px; margin:10px 0 20px;
    padding:14px; background:#f6faf7; border-radius:10px; font-size:12px; color:#43594b; }
.knowledge-detail-section { margin:14px 0; font-size:13px; line-height:1.6; }
.knowledge-detail-section > strong { display:block; margin-bottom:4px; color:#183e28; }
.knowledge-detail-section p { margin:0; white-space:pre-wrap; overflow-wrap:anywhere; }
.knowledge-review-actions { display:flex; align-items:center; gap:9px; flex-wrap:wrap; margin-top:20px; }
@media (max-width: 760px) {
    .admin-session-modal-scrim { padding:8px; }
    .admin-session-modal { max-height:94vh; padding:14px; }
}

/* v0.19: collapsible rail + resizable helpdesk split */
.app-rail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 0 6px 22px;
}
.support-brand {
    padding: 0;
}
.support-brand-logo-stacked {
    width: 150px;
    max-width: 100%;
    height: auto;
}
.rail-collapse-button {
    flex: 0 0 auto;
    color: #526057 !important;
    margin-top: 4px;
}
.shell.nav-collapsed {
    grid-template-columns: 86px minmax(0,1fr);
}
.shell.nav-collapsed .app-rail {
    padding: 22px 8px 14px;
}
.shell.nav-collapsed .app-rail-header {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding-bottom: 18px;
}
.shell.nav-collapsed .support-brand {
    align-items: center;
}
.shell.nav-collapsed .support-brand-logo-stacked {
    width: 54px;
}
.shell.nav-collapsed .rail-nav .mud-nav-link {
    padding-inline: 12px;
    justify-content: center;
}
.shell.nav-collapsed .rail-nav .mud-nav-link-icon {
    margin-inline-end: 0;
}
.shell.nav-collapsed .rail-nav .mud-nav-link-text,
.shell.nav-collapsed .rail-footer .mud-typography,
.shell.nav-collapsed .user-copy,
.shell.nav-collapsed .mud-nav-group-expand-icon {
    display: none !important;
}
.shell.nav-collapsed .rail-footer {
    padding-inline: 0;
}
.shell.nav-collapsed .user-row {
    justify-content: center;
}
.shell.nav-collapsed .rail-signout {
    justify-content: center;
}
.shell.nav-collapsed .rail-signout > span {
    display: none;
}
.shell.nav-collapsed .collapsed-admin-links {
    width: 100%;
}
.helpdesk-page {
    grid-template-columns: minmax(220px, var(--helpdesk-session-width, 292px)) 12px minmax(0, 1fr);
}
.helpdesk-page .session-pane {
    min-width: 0;
}
.conversation-splitter {
    position: relative;
    cursor: col-resize;
    background: transparent;
}
.conversation-splitter::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    transform: translateX(-50%);
    background: var(--support-line);
}
.conversation-splitter::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 4px;
    height: 48px;
    border-radius: 999px;
    transform: translate(-50%, -50%);
    background: #d3dad5;
    box-shadow: 0 0 0 4px rgba(255,255,255,.92);
}
.conversation-splitter:hover::after,
body.helpdesk-resizing .conversation-splitter::after {
    background: #98afa2;
}
body.helpdesk-resizing,
body.helpdesk-resizing * {
    cursor: col-resize !important;
    user-select: none !important;
}

@media (max-width: 1000px) {
    .shell:not(.nav-collapsed) .support-brand-logo-stacked {
        width: 132px;
    }
}
@media (max-width: 760px) {
    .conversation-splitter {
        display: none;
    }
    .helpdesk-page {
        grid-template-columns: minmax(0,1fr);
        grid-template-rows: auto minmax(0,1fr);
    }
}


/* Dialog owned by Helpdesk: independent of MudBlazor's changing dialog API. */
.helpdesk-confirm-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1400;
    background: rgba(12, 26, 19, .48);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.helpdesk-confirm-modal {
    width: min(450px, 100%);
    background: white;
    padding: 25px;
    border: 1px solid var(--support-line);
    border-radius: 14px;
    box-shadow: 0 18px 45px rgba(0,0,0,.16);
}
.helpdesk-confirm-modal h2 { font-size: 19px; margin: 0 0 12px; }
.helpdesk-confirm-modal p { font-size: 13px; line-height: 1.6; margin: 0 0 12px; }
.helpdesk-confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* Phone rail: no clipped branding or indentation on icon-only Admin links. */
@media (max-width: 760px) {
  .shell .app-rail-header .support-brand { display: none !important; }
  .shell .app-rail-header { justify-content: center; padding-bottom: 12px; }
  .shell .app-rail { overflow-x: hidden; }
  .shell .rail-nav .mud-nav-group .mud-nav-link,
  .shell .rail-nav .mud-nav-group .mud-navmenu .mud-nav-link,
  .shell .rail-nav .collapsed-admin-links .mud-nav-link {
    margin-left: 0 !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    justify-content: center;
  }
  .shell .rail-nav .mud-nav-group .mud-nav-link-icon,
  .shell .rail-nav .collapsed-admin-links .mud-nav-link-icon { margin-inline-end: 0 !important; }
}

.knowledge-expand-button { border:0; background:transparent; text-align:left; cursor:pointer; display:flex; flex-direction:column; gap:4px; padding:0; width:100%; }
.knowledge-expand-button:hover .knowledge-file-name { text-decoration:underline; }
.knowledge-document-details { padding:14px; border:1px solid #dce7df; border-radius:8px; margin-top:10px; font-size:13px; line-height:1.55; }
.knowledge-document-image { max-width:300px; max-height:220px; object-fit:contain; margin:6px; border:1px solid #ddd; }
@media(max-width:760px) { .shell .app-rail-header .support-brand { display:none !important; } .shell .rail-nav .mud-nav-group .mud-nav-link { margin-left:0 !important; padding-left:10px !important; } .shell .rail-nav .mud-nav-group .mud-navmenu { padding-left:0 !important; margin-left:0 !important; } }

/* Server-attached reference images for Helpdesk answers */
.knowledge-image-gallery { margin: 18px 0 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px,100%), 1fr)); gap: 12px; }
.knowledge-image-heading { grid-column: 1 / -1; font-size: 12px; color: #526057; font-weight: 600; }
.knowledge-image-link { display:flex; flex-direction:column; gap:6px; padding: 9px; border:1px solid #dde6e0; border-radius:10px; background:#fff; text-decoration:none; font-size:11px; color:#145a43; }
.knowledge-image-link img { display:block; width:100%; height:auto; max-height:280px; object-fit:contain; }

/* Company reference images: bounded thumbnails and accessible full-screen preview. */
.knowledge-vic-panels { margin: 8px 0 12px; }
.knowledge-vic-title { color: #2f5942; gap: 9px; align-items:center; font-size: 12px; }
.knowledge-vic-title strong { font-weight: 750; }
.knowledge-inline-images { display:flex; flex-wrap:wrap; align-items:flex-start; gap:12px; margin: 12px 0 16px; min-width:0; }
.knowledge-inline-thumbnail { display:flex; flex-direction:column; align-items:stretch; width:min(248px, 100%); max-width:100%; min-width:0; border:1px solid #dbe5df; padding:9px; border-radius:11px; background:#fff; cursor:zoom-in; color:#345744; text-align:center; box-shadow:0 3px 9px rgba(0,0,0,.035); }
.knowledge-inline-thumbnail img { display:block; flex:none; width:100%; max-width:100%; height:176px; object-fit:contain; background:#f5f8fa; border-radius:6px; }
.knowledge-inline-thumbnail .knowledge-thumbnail-source { display:block; margin-top:8px; font-size:10px; color:#5f7568; overflow-wrap:anywhere; }
.knowledge-inline-thumbnail .knowledge-thumbnail-caption { display:block; margin-top:8px; font-size:12px; font-weight:600; line-height:1.4; overflow-wrap:anywhere; }
.knowledge-inline-thumbnail .knowledge-thumbnail-action { display:flex; align-items:center; justify-content:center; gap:5px; margin-top:5px; font-size:11px; line-height:1.4; color:#526c5b; }
.knowledge-inline-thumbnail:focus-visible { outline:2px solid #34775b; outline-offset:2px; }
.knowledge-inline-thumbnail:hover { border-color:#8ba995; background:#f8fbf8; }
.knowledge-source-footer { margin-top:8px; color:#5a7263; font-size:12px; }
.knowledge-image-backdrop { position:fixed; z-index:1500; inset:0; display:flex; align-items:center; justify-content:center; background:rgba(12,20,18,.84); padding:clamp(12px,4vw,42px); cursor:zoom-out; }
.knowledge-image-preview { max-width:100%; max-height:100%; position:relative; padding:14px; border-radius:12px; background:white; display:flex; flex-direction:column; gap:7px; cursor:default; }
.knowledge-image-preview img { max-width:min(92vw,1400px); max-height:calc(88vh - 65px); width:auto; height:auto; object-fit:contain; }
.knowledge-preview-caption { font-size:12px; color:#526057; text-align:center; }
.knowledge-preview-close { position:absolute; top:-12px; right:-12px; border:0; border-radius:50%; width:34px; height:34px; background:#fff; color:#172a1d; cursor:pointer; font-size:26px; box-shadow:0 3px 12px #0005; }
.assistant-answer img { max-width:min(100%,340px); height:auto; object-fit:contain; }


/* Admin polish: compact search card, with no inherited 320px minimum. */
.knowledge-page .knowledge-card.jitbit-search-card { min-height: 0; height: auto; }
.knowledge-page .jitbit-search-card .admin-filter-row { margin-bottom: 12px; }

/* Processed documents: controls and metadata occupy the left side as one group. */
.knowledge-page .knowledge-file-row { justify-content: flex-start; align-items: flex-start; gap: 14px; padding: 13px 2px; }
.knowledge-page .knowledge-file-delete { flex: 0 0 auto; margin-top: 1px; }
.knowledge-page .knowledge-file-copy { flex: 1 1 auto; text-align: left; align-items: flex-start; min-width: 0; }
.knowledge-page .knowledge-expand-button { text-align: left; align-items: flex-start; min-width: 0; }
.knowledge-page .knowledge-file-name { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.knowledge-page .knowledge-file-meta { max-width: 100%; overflow-wrap: anywhere; text-align: left; }
@media (max-width: 540px) {
    .knowledge-page .knowledge-file-row { gap: 10px; }
}

/* Image lightbox: arrows are visible and keyboard focus is apparent. */
.knowledge-image-preview { min-width: 0; max-width: min(96vw, 1450px); outline: none; }
.knowledge-image-preview:focus-visible { outline: 2px solid #8fc1a4; outline-offset: 5px; }
.knowledge-preview-image-frame { display: flex; align-items: center; justify-content: center; position: relative; min-width: 0; }
.knowledge-preview-image-frame img { display: block; }
.knowledge-preview-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    display: flex; align-items: center; justify-content: center;
    width: 42px; height: 48px; border: 0; border-radius: 8px;
    background: rgba(20, 35, 29, .82); color: white; font-size: 30px;
    line-height: 1; cursor: pointer; z-index: 1;
}
.knowledge-preview-nav:hover { background: #1e513b; }
.knowledge-preview-nav:focus-visible { outline: 3px solid #85bba0; outline-offset: 2px; }
.knowledge-preview-prev { left: 8px; }
.knowledge-preview-next { right: 8px; }
.knowledge-preview-count { font-size: 12px; color: #526057; text-align: center; }
.knowledge-preview-source { font-size: 11px; color: #5c7766; text-align: center; overflow-wrap: anywhere; }
@media (max-width: 560px) {
    .knowledge-preview-nav { width: 36px; height: 42px; font-size: 26px; }
    .knowledge-preview-prev { left: 3px; }
    .knowledge-preview-next { right: 3px; }
}

/* Agent2 only: use the browser document scroll bar on the outer window edge.
   The Helpdesk and old Agent page retain their own independent scroll panes. */
body:has(.agent2-page) {
    height: auto;
    min-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}
.shell:has(.agent2-page) {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    align-items: start;
}
.shell:has(.agent2-page) > .app-rail {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    align-self: start;
}
.shell:has(.agent2-page) > .shell-main {
    overflow: visible;
}
.shell .agent2-page {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
    overscroll-behavior: auto;
}

/* Thinking steps: small, muted, collapsed by default so they read as process, not answer. */
.thinking-steps { margin: 2px 0 10px; font-size: 11.5px; color: #7a8580; }
.thinking-steps summary { list-style: none; cursor: pointer; }
.thinking-steps summary::-webkit-details-marker { display: none; }
.thinking-steps-summary { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 2px 8px 2px 4px;
    border-radius: 6px; user-select: none; }
.thinking-steps-summary::after { content: "›"; font-size: 13px; line-height: 1; transition: transform .15s; }
.thinking-steps[open] > .thinking-steps-summary::after { transform: rotate(90deg); }
.thinking-steps-summary:hover { background: #f2f5f3; color: #4d5a53; }
.thinking-steps-names { color: #a0aaa5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.thinking-steps-names::before { content: "· "; }
.thinking-icon.mud-icon-root { font-size: 14px !important; width: 14px; height: 14px; color: #9aa59f; flex: none; }
.thinking-step-list { list-style: none; margin: 4px 0 0 10px; padding: 0 0 0 10px; border-left: 2px solid #e6ece8; }
.thinking-step > summary { display: flex; align-items: center; gap: 6px; padding: 2px 4px; border-radius: 5px; min-width: 0; }
.thinking-step > summary:hover { background: #f4f7f5; }
.thinking-step-kind { font-weight: 600; color: #66716b; flex: none; }
.thinking-step-name { color: #8a948f; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10.5px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.thinking-step-meta { margin-left: auto; padding-left: 8px; color: #a0aaa5; font-size: 10.5px; flex: none; }
.thinking-step .trace-content { padding: 4px 4px 8px 24px; font-size: 11px; }
.thinking-step .json-box { font-size: 10.5px; }
.thinking-step .json-label { font-size: 10.5px; margin-top: 4px; }
.thinking-step-detail { color: #66716b; margin-bottom: 6px; line-height: 1.45; }

/* Admin > Helpdesk */
.helpdesk-category-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid #eef2ef; }
.helpdesk-category-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.helpdesk-category-edit { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(200px, 2fr) auto; gap: 10px; align-items: center; width: 100%; }
.helpdesk-category-actions { display: flex; gap: 6px; flex: none; }
.helpdesk-category-add { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(200px, 2fr) auto; gap: 10px; align-items: center; margin-top: 14px; }
.helpdesk-upload-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.helpdesk-upload-category { max-width: 260px; }
.helpdesk-upload-button { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid #d2dfd6;
    border-radius: 8px; color: #41604b; font-size: 12px; cursor: pointer; background: #fff; }
.helpdesk-upload-button:hover { background: #f0f6f2; }
.helpdesk-upload-button.disabled { opacity: .5; cursor: not-allowed; }
.helpdesk-hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.helpdesk-upload-failures { margin: 6px 0 0; padding-left: 18px; font-size: 12px; }
.helpdesk-doc-list-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.helpdesk-doc-filter { max-width: 220px; }
.knowledge-file-row .helpdesk-doc-category { max-width: 190px; flex: none; }
@media (max-width: 720px) {
    .helpdesk-category-edit, .helpdesk-category-add { grid-template-columns: minmax(0, 1fr); }
    .helpdesk-category-row { flex-wrap: wrap; }
}
