/* =============================================================================
   BITOTRON Service Hub — global styles (06 §6.15.2, GRAPHICS-TEMPLATE 2/4/5/7).
   Only tokens, reset and the bt-* classes shared by several components live here;
   component specific rules are in the .razor.css files (06 §6.15.3).
   Order: 1 tokens · 2 dark tokens · 3 reset · 4 layout · 5 typography helpers · 6 cards ·
          7 chips, status panel, page parts · 8 presence · 9 footer · 10 AI mode ·
          11 markdown · 12 boot + error UI · 13 reduced motion
   ============================================================================= */

/* --- 1. Tokens (light) ------------------------------------------------------- */
:root {
    /* GRAPHICS 5.1 — what the MudBlazor palette does not cover (source: www.bitotron.com) */
    --bt-turq-700: #10715e;
    --bt-turq-100: #ddf5ef;
    --bt-turq-050: #eef9f6;
    --bt-ink: #16212b;
    --bt-ink-2: #1f2d3a;
    --bt-ink-3: #2b3b4a;
    --bt-ink-line: rgba(255, 255, 255, 0.12);
    --bt-on-dark: #f4f7f8;
    --bt-on-dark-2: rgba(244, 247, 248, 0.72);
    --bt-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    --bt-shadow-1: 0 1px 2px rgba(22, 33, 43, 0.06), 0 12px 32px -16px rgba(22, 33, 43, 0.22);
    --bt-focus-ring: 0 0 0 3px rgba(26, 188, 156, 0.22);

    /* Service Hub additions */
    --bt-radius-s: 4px;
    --bt-radius-m: 10px;
    --bt-radius-l: 18px;
    --bt-footer-height: 44px;
    --bt-content-max: 72rem;
    --bt-link: var(--bt-turq-700);                       /* text accent on light surfaces (WCAG AA) */
    --bt-selected-bg: var(--bt-turq-050);
    --bt-bubble-own-bg: #ddf5ef;
    --bt-bubble-own-text: #1c262e;
    --bt-bubble-other-bg: #ffffff;
    --bt-bubble-other-border: #dce4e7;
    --bt-code-bg: #f3f7f6;
    --bt-illustration-bg: #f3f7f6;                       /* the same light panel in dark mode too (06 §6.19) */
    --bt-warning-bg: #fff4de;
    --bt-warning-text: #6b4a00;

    /* Status bands (GRAPHICS 2.4) — StatusPanel */
    --bt-status-success-bg: #ddf5ef;  --bt-status-success-fg: #10715e;  --bt-status-success-border: #1abc9c;
    --bt-status-error-bg: #fde8eb;    --bt-status-error-fg: #9b1327;    --bt-status-error-border: #d71a38;
    --bt-status-warning-bg: #fff4de;  --bt-status-warning-fg: #6b4a00;  --bt-status-warning-border: #ffcd78;
    --bt-status-info-bg: #f3f7f6;     --bt-status-info-fg: #55656f;     --bt-status-info-border: #dce4e7;

    /* Status chips (06 §6.11.3) */
    --bt-chip-success-bg: #ddf5ef;         --bt-chip-success-fg: #10715e;         --bt-chip-success-border: #1abc9c;
    --bt-chip-success-strong-bg: #10715e;  --bt-chip-success-strong-fg: #ffffff;  --bt-chip-success-strong-border: #10715e;
    --bt-chip-active-bg: #eef9f6;          --bt-chip-active-fg: #10715e;          --bt-chip-active-border: #1abc9c;
    --bt-chip-warning-bg: #fff4de;         --bt-chip-warning-fg: #6b4a00;         --bt-chip-warning-border: #ffcd78;
    --bt-chip-error-bg: #fde8eb;           --bt-chip-error-fg: #9b1327;           --bt-chip-error-border: #d71a38;
    --bt-chip-neutral-bg: #f3f7f6;         --bt-chip-neutral-fg: #55656f;         --bt-chip-neutral-border: #dce4e7;
    --bt-chip-info-bg: #f3f7f6;            --bt-chip-info-fg: #55656f;            --bt-chip-info-border: #dce4e7;

    /* Monogram avatars (06 §6.11.1) — all >= 4.5:1 with white text */
    --bt-avatar-1: #1f2d3a;
    --bt-avatar-2: #10715e;
    --bt-avatar-3: #55656f;
    --bt-avatar-4: #6b4a00;
    --bt-avatar-text: #ffffff;
}

/* --- 2. Dark mode tokens (<html data-bt-theme="dark">, set by preboot.js / ThemeService) --- */
[data-bt-theme="dark"] {
    --bt-link: #1abc9c;
    --bt-selected-bg: var(--bt-ink-3);
    --bt-bubble-own-bg: rgba(26, 188, 156, 0.18);
    --bt-bubble-own-text: #f4f7f8;
    --bt-bubble-other-bg: #2b3b4a;
    --bt-bubble-other-border: transparent;
    --bt-code-bg: #16212b;
    --bt-warning-bg: rgba(255, 205, 120, 0.16);
    --bt-warning-text: #ffcd78;

    --bt-status-success-bg: rgba(26, 188, 156, 0.16);   --bt-status-success-fg: #1abc9c;  --bt-status-success-border: #1abc9c;
    --bt-status-error-bg: rgba(255, 107, 127, 0.16);    --bt-status-error-fg: #ff6b7f;    --bt-status-error-border: #ff6b7f;
    --bt-status-warning-bg: rgba(255, 205, 120, 0.16);  --bt-status-warning-fg: #ffcd78;  --bt-status-warning-border: #ffcd78;
    --bt-status-info-bg: rgba(255, 255, 255, 0.06);     --bt-status-info-fg: rgba(244, 247, 248, 0.72); --bt-status-info-border: rgba(255, 255, 255, 0.12);

    --bt-chip-success-bg: rgba(26, 188, 156, 0.16);   --bt-chip-success-fg: #1abc9c;         --bt-chip-success-border: transparent;
    --bt-chip-success-strong-bg: #1abc9c;             --bt-chip-success-strong-fg: #16212b;  --bt-chip-success-strong-border: transparent;
    --bt-chip-active-bg: #2b3b4a;                     --bt-chip-active-fg: #1abc9c;          --bt-chip-active-border: transparent;
    --bt-chip-warning-bg: rgba(255, 205, 120, 0.16);  --bt-chip-warning-fg: #ffcd78;         --bt-chip-warning-border: transparent;
    --bt-chip-error-bg: rgba(255, 107, 127, 0.16);    --bt-chip-error-fg: #ff6b7f;           --bt-chip-error-border: transparent;
    --bt-chip-neutral-bg: rgba(255, 255, 255, 0.08);  --bt-chip-neutral-fg: rgba(244, 247, 248, 0.72); --bt-chip-neutral-border: transparent;
    --bt-chip-info-bg: rgba(255, 255, 255, 0.08);     --bt-chip-info-fg: #a9b7bf;            --bt-chip-info-border: transparent;

    --bt-avatar-1: #2b3b4a;
}

/* --- 3. Reset (GRAPHICS 5.1) -------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    font-family: 'Lato', 'Segoe UI', system-ui, sans-serif;
    margin: 0;
    padding: 0;
    max-width: 100%;
    overflow-x: hidden;
}

body { background: var(--mud-palette-background, #f3f7f6); }

::selection {
    background: var(--mud-palette-primary);
    color: var(--bt-ink);
}

a:focus-visible, button:focus-visible, [role="button"]:focus-visible, summary:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
    box-shadow: var(--bt-focus-ring);
}

[tabindex="-1"]:focus { outline: none; }

.bt-visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- 4. Layout ------------------------------------------------------------------ */
.bt-skip-link {
    position: absolute;
    left: 0.75rem;
    top: -100px;
    z-index: 2000;
    padding: 0.5rem 1rem;
    border-radius: var(--bt-radius-s);
    background: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
    font-weight: 700;
    text-decoration: none;
}

.bt-skip-link:focus { top: 0.75rem; }

/* AppBar: ink with a 1px light line (GRAPHICS 4.3) */
.bt-appbar { border-bottom: 1px solid var(--bt-ink-line); }

.bt-appbar .mud-toolbar { gap: 0.25rem; }

.bt-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    margin-inline-start: 0.25rem;
    color: inherit;
    text-decoration: none;
    border-radius: var(--bt-radius-s);
}

.bt-brand-name {
    font-family: 'Lato', 'Segoe UI', system-ui, sans-serif;
    font-weight: 700;
    font-size: 1.125rem;
    line-height: 1.3;
    white-space: nowrap;
}

.bt-brand-logo {
    display: inline-flex;
    align-items: center;
    color: inherit;
    flex: 0 0 auto;
}

.bt-brand-logo svg {
    display: block;
    height: 100%;
    width: auto;
}

img.bt-brand-logo--custom { display: block; width: auto; }

/* Drawer + NavMenu (GRAPHICS 4.3, 06 §6.8.4) */
.bt-drawer .mud-nav-link {
    color: var(--mud-palette-drawer-text);
    transition: background-color 0.2s var(--bt-ease), color 0.2s var(--bt-ease);
}

.bt-drawer .mud-nav-link:hover:not(.mud-nav-link-disabled) {
    color: #ffffff;
    background: var(--bt-ink-3);
}

.bt-drawer .mud-nav-link.active:not(.mud-nav-link-disabled) {
    color: #ffffff;
    background: var(--bt-ink-3);
    box-shadow: inset 3px 0 0 var(--mud-palette-primary);
}

.bt-drawer .mud-nav-link:hover .mud-nav-link-icon,
.bt-drawer .mud-nav-link.active .mud-nav-link-icon { color: #ffffff; }

.bt-drawer .mud-nav-link-text { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }

.bt-nav-link__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bt-nav-group-title {
    margin: 0;
    padding: 0.75rem 1rem 0.25rem;
    color: var(--mud-palette-drawer-text);
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s var(--bt-ease);
}

.mud-drawer--closed .bt-nav-group-title { opacity: 0; }

.bt-drawer .bt-nav-divider { border-color: var(--bt-ink-line); margin: 0.5rem 0 0; }

.bt-unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    margin-inline-start: auto;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--mud-palette-error);
    color: var(--mud-palette-error-text);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
}

/* Main column: content grows, footer at the bottom */
.bt-main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.bt-main-inner { flex: 1 0 auto; }

.bt-connection-banner {
    position: fixed;
    top: var(--mud-appbar-height, 64px);
    left: 0;
    right: 0;
    z-index: 1250;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.25rem 1rem;
    background: var(--bt-warning-bg);
    color: var(--bt-warning-text);
    font-size: 0.875rem;
}

/* User menu (06 §6.8.3) */
.bt-user-menu__activator {
    display: inline-flex;
    margin-inline-start: 0.25rem;
    padding: 4px;
    border: 0;
    border-radius: 50%;
    background: none;
    color: inherit;
    cursor: pointer;
}

.bt-user-menu__header { padding: 0.75rem 1rem 0.5rem; min-width: 240px; }

.bt-user-menu__header p { margin: 0; }

.bt-user-menu__email,
.bt-user-menu__section { color: var(--mud-palette-text-secondary); }

.bt-user-menu__section { margin: 0; padding: 0.5rem 1rem 0; }

.bt-presence-option__row { display: flex; align-items: center; gap: 0.75rem; width: 100%; }

.bt-menu-item--current { font-weight: 700; }

.bt-menu-item--indented { padding-inline-start: 52px; }

/* Loading indicator */
.bt-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
}

.bt-loading--fullscreen {
    position: fixed;
    inset: 0;
    z-index: 1500;
    background: var(--mud-palette-background);
}

.bt-loading-text { color: var(--mud-palette-text-secondary); }

/* --- 5. Typography helpers ---------------------------------------------------- */
.bt-kicker {
    margin: 0 0 0.25rem;
    color: var(--bt-link);
}

.bt-mono { font-family: ui-monospace, Consolas, 'Cascadia Mono', monospace; }

.bt-text-secondary { color: var(--mud-palette-text-secondary); }

.bt-link { color: var(--bt-link); }

/* MudLink defaults to Color.Primary → .mud-primary-text { color: var(--mud-palette-primary) !important }, i.e.
   #1abc9c text on white (2.4:1). Link text follows --bt-link (light #10715e, dark #1abc9c — 06 §6.17, GRAPHICS 2.3);
   the disabled colour of MudBlazor stays. */
.mud-link.mud-primary-text:not(.mud-link-disabled) { color: var(--bt-link) !important; }

/* --- 6. Cards (GRAPHICS 7.1/7.2) ---------------------------------------------- */
.mud-card,
.mud-paper.bt-panel { border-radius: var(--bt-radius-m); }

.bt-panel-l { border-radius: var(--bt-radius-l); }

.bt-hover-lift { transition: transform 0.2s var(--bt-ease), box-shadow 0.2s var(--bt-ease); }

.bt-hover-lift:hover { transform: translateY(-4px); box-shadow: var(--bt-shadow-1); }

/* --- 7. Status chips (06 §6.11.3), StatusPanel (GRAPHICS 2.4), page parts ------ */
.mud-chip.bt-chip { border: 1px solid transparent; font-weight: 700; }

.mud-chip.bt-chip .mud-chip-icon { color: inherit; }

.mud-chip.bt-chip.bt-chip--success { background: var(--bt-chip-success-bg); color: var(--bt-chip-success-fg); border-color: var(--bt-chip-success-border); }
.mud-chip.bt-chip.bt-chip--success-strong { background: var(--bt-chip-success-strong-bg); color: var(--bt-chip-success-strong-fg); border-color: var(--bt-chip-success-strong-border); }
.mud-chip.bt-chip.bt-chip--active { background: var(--bt-chip-active-bg); color: var(--bt-chip-active-fg); border-color: var(--bt-chip-active-border); }
.mud-chip.bt-chip.bt-chip--warning { background: var(--bt-chip-warning-bg); color: var(--bt-chip-warning-fg); border-color: var(--bt-chip-warning-border); }
.mud-chip.bt-chip.bt-chip--error { background: var(--bt-chip-error-bg); color: var(--bt-chip-error-fg); border-color: var(--bt-chip-error-border); }
.mud-chip.bt-chip.bt-chip--neutral { background: var(--bt-chip-neutral-bg); color: var(--bt-chip-neutral-fg); border-color: var(--bt-chip-neutral-border); }
.mud-chip.bt-chip.bt-chip--info { background: var(--bt-chip-info-bg); color: var(--bt-chip-info-fg); border-color: var(--bt-chip-info-border); }

/* Primary as a text colour (GRAPHICS 2.3: #1abc9c text on a light surface is forbidden). MudBlazor colours these
   labels with the palette primary: Outlined / Text primary buttons (also the MudMenu activator and the stepper's
   Complete button), Outlined / Text primary chips, the active tab and the focused input label. The selected
   MudPagination / MudToggleGroup items are Filled (ink on turquoise) and need nothing. --bt-link is turq-700 in light
   mode and #1abc9c in dark mode, so one rule serves both themes. */
.mud-button-root.mud-button-outlined.mud-button-outlined-primary,
.mud-button-root.mud-button-text.mud-button-text-primary { color: var(--bt-link); }

.mud-chip.mud-chip-outlined.mud-chip-color-primary:not(.bt-chip),
.mud-chip.mud-chip-text.mud-chip-color-primary:not(.bt-chip) { color: var(--bt-link); }

.mud-chip.mud-chip-outlined.mud-chip-color-primary.mud-chip-selected:not(.bt-chip),
.mud-chip.mud-chip-text.mud-chip-color-primary:not(.bt-chip) { background-color: var(--bt-selected-bg); }

.mud-tab.mud-tab-active { color: var(--bt-link); }

.mud-input:focus-within ~ label.mud-input-label.mud-input-label-inputcontrol { color: var(--bt-link); }

/* MudStepper: the current / completed step circle is turquoise, so its digit and check mark are ink
   (PrimaryContrastText, GRAPHICS 2.3) instead of MudBlazor's white; MudBlazor's :disabled rule (!important) stays. */
.mud-stepper .mud-stepper-nav .mud-step .mud-step-label .mud-step-label-icon.mud-primary { color: var(--mud-palette-primary-text); }

.bt-status-panel {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid;
    border-inline-start-width: 4px;
    border-radius: var(--bt-radius-s);
}

.bt-status-panel--success { background: var(--bt-status-success-bg); color: var(--bt-status-success-fg); border-color: var(--bt-status-success-border); }
.bt-status-panel--error { background: var(--bt-status-error-bg); color: var(--bt-status-error-fg); border-color: var(--bt-status-error-border); }
.bt-status-panel--warning { background: var(--bt-status-warning-bg); color: var(--bt-status-warning-fg); border-color: var(--bt-status-warning-border); }
.bt-status-panel--info { background: var(--bt-status-info-bg); color: var(--bt-status-info-fg); border-color: var(--bt-status-info-border); }

.bt-status-panel__icon { flex: 0 0 auto; margin-top: 1px; }

.bt-status-panel__body { flex: 1 1 auto; min-width: 0; }

.bt-status-panel__title { margin: 0 0 0.125rem; font-weight: 700; }

.bt-status-panel__actions { flex: 0 0 auto; align-self: center; }

.bt-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.75rem 1rem;
    margin-bottom: 1.5rem;
}

.bt-page-header__titles { flex: 1 1 auto; min-width: 0; }

.bt-page-header__title { margin: 0; }

.bt-page-header__subtitle { margin-top: 0.25rem; color: var(--mud-palette-text-secondary); }

.bt-page-header__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }

@media (max-width: 599.98px) {
    .bt-page-header__actions { width: 100%; }
}

.bt-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
    text-align: center;
}

.bt-empty-state--compact { padding: 1rem; }

.bt-empty-state .bt-empty-state__image { width: 100%; max-width: 220px; margin-bottom: 0.5rem; }

.bt-empty-state .bt-empty-state__icon { font-size: 56px; color: var(--mud-palette-text-secondary); }

.bt-empty-state__title { margin: 0; }

.bt-empty-state__text { max-width: 36rem; color: var(--mud-palette-text-secondary); }

.bt-empty-state__action { margin-top: 0.75rem; }

.bt-illustration {
    overflow: hidden;
    border-radius: var(--bt-radius-l);
    background: var(--bt-illustration-bg);
    line-height: 0;
}

.bt-illustration img { display: block; width: 100%; height: auto; }

/* --- 8. Presence (06 §6.11.2 — palette variables only, colour + shape + text) ---- */
.bt-presence-dot {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--mud-palette-surface);
    border-radius: 50%;
    vertical-align: middle;
}

.bt-presence-dot--tiny { width: 6px; height: 6px; border-width: 1px; }
.bt-presence-dot--small { width: 10px; height: 10px; }
.bt-presence-dot--medium { width: 12px; height: 12px; }
.bt-presence-dot--large { width: 18px; height: 18px; }

.bt-presence-dot--small, .bt-presence-dot--medium, .bt-presence-dot--large { box-sizing: content-box; }

.bt-presence-dot--available { background: var(--mud-palette-success); color: var(--mud-palette-success-text); }
.bt-presence-dot--busy { background: var(--mud-palette-error); color: var(--mud-palette-error-text); }
.bt-presence-dot--dnd { background: var(--mud-palette-error); color: var(--mud-palette-error-text); }
.bt-presence-dot--away { background: var(--mud-palette-warning); color: var(--mud-palette-warning-text); }
.bt-presence-dot--offline { background: var(--mud-palette-surface); box-shadow: inset 0 0 0 2px var(--mud-palette-text-disabled); }

/* Do not disturb: a white horizontal bar (the large size shows the DoNotDisturbOn icon instead) */
.bt-presence-dot--dnd:not(.bt-presence-dot--large)::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 22%;
    right: 22%;
    height: 2px;
    margin-top: -1px;
    border-radius: 1px;
    background: #ffffff;
}

.bt-presence-dot--on-dark { border-color: var(--bt-ink); }

.bt-presence-dot .bt-presence-dot__icon { font-size: 14px; }

/* --- 9. Footer (GRAPHICS 5.5) --------------------------------------------------- */
.copyright-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.25rem 0.5rem;
    min-height: var(--bt-footer-height);
    padding: 0.75rem;
    background: var(--bt-ink);
    color: var(--bt-on-dark-2);
    border-top: 2px solid var(--mud-palette-primary);
    font-size: 0.8125rem;
    text-align: center;
}

.copyright-footer a { color: inherit; }

.copyright-footer a:hover { color: #ffffff; }

.copyright-footer--subtle {
    background: transparent;
    border-top: 0;
    color: var(--mud-palette-text-secondary);
}

.copyright-footer--subtle a:hover { color: var(--mud-palette-text-primary); }

/* --- 10. Craft Studio AI mode (06 §6.14) ------------------------------------------ */
.bt-ai-toggle,
.bt-ai-toggle__control {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.bt-ai-toggle { margin-inline-end: 0.25rem; }

.bt-ai-toggle__icon { display: block; border-radius: 6px; }

.bt-ai-toggle__label { font-size: 0.875rem; font-weight: 700; white-space: nowrap; }

.ai-hotspot {
    position: relative;
    outline: 2px dashed var(--mud-palette-primary);
    outline-offset: 3px;
    border-radius: var(--bt-radius-s);
}

.ai-hotspot--inline { display: inline-block; }

.ai-hotspot__button,
.app-ai-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 2px solid var(--mud-palette-primary);
    border-radius: 50%;
    background: var(--mud-palette-surface);
    cursor: pointer;
    transition: transform 0.2s var(--bt-ease);
}

.ai-hotspot__button {
    position: absolute;
    top: -14px;
    right: -14px;
    z-index: 20;
}

.ai-hotspot__button:hover,
.app-ai-button:hover { transform: scale(1.15); }

.ai-hotspot__button:focus-visible,
.app-ai-button:focus-visible { outline: none; box-shadow: var(--bt-focus-ring); }

.ai-hotspot__button img,
.app-ai-button img { display: block; border-radius: 50%; }

/* --- 11. Markdown (06 §6.11.4) ---------------------------------------------------- */
.bt-markdown {
    max-width: var(--bt-content-max);
    color: var(--mud-palette-text-primary);
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.bt-markdown h1, .bt-markdown h2, .bt-markdown h3,
.bt-markdown h4, .bt-markdown h5, .bt-markdown h6 {
    font-family: 'Montserrat', 'Segoe UI', system-ui, sans-serif;
    font-weight: 500;
    line-height: 1.25;
    margin: 1.5em 0 0.5em;
    scroll-margin-top: calc(var(--mud-appbar-height, 64px) + 1rem);
}

.bt-markdown a { color: var(--bt-link); }

.bt-markdown code, .bt-markdown pre {
    font-family: ui-monospace, Consolas, 'Cascadia Mono', monospace;
    background: var(--bt-code-bg);
    border-radius: var(--bt-radius-s);
}

.bt-markdown code { padding: 0.1em 0.35em; font-size: 0.9em; }

.bt-markdown pre { padding: 0.75rem 1rem; overflow-x: auto; }

.bt-markdown pre code { padding: 0; background: none; }

.bt-markdown blockquote {
    margin: 1em 0;
    padding: 0.25em 1em;
    border-inline-start: 3px solid var(--mud-palette-primary);
    color: var(--mud-palette-text-secondary);
}

.bt-markdown table { border-collapse: collapse; margin: 1em 0; width: 100%; }

.bt-markdown th, .bt-markdown td {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--mud-palette-table-lines);
    text-align: start;
}

.bt-markdown img { max-width: 100%; height: auto; }

/* --- 12. Boot screen + Blazor error UI (06 §6.3.3) ---------------------------------- */
.bt-boot {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: #16212b;
    color: #f4f7f8;
}

.bt-boot img { display: block; width: 180px; height: auto; }

.bt-boot p {
    margin: 0;
    font-family: 'Lato', 'Segoe UI', system-ui, sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: #1abc9c;
}

.bt-boot-bar {
    width: 180px;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, #1abc9c, transparent);
    background-size: 200% 100%;
    animation: bt-boot-slide 1.2s linear infinite;
}

@keyframes bt-boot-slide {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 3000;
    padding: 0.6rem 2.5rem 0.7rem 1.25rem;
    background: #fde8eb;
    color: #9b1327;
    border-top: 3px solid #d71a38;
}

#blazor-error-ui .reload { margin-inline-start: 0.75rem; color: inherit; font-weight: 700; }

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

/* --- 13. Reduced motion (GRAPHICS 7.4) ------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }

    .bt-boot-bar { animation: none; background: #1abc9c; }
}

/* --- 14. Quick chat (06 §6.13.5) ------------------------------------------------------- */
/* The floating button must not cover the last row / button of a page. */
body:has(.bt-quickchat__fab) .bt-main-inner { padding-bottom: 88px; }

/* Hidden under an open dialog (it stays mounted, its state is kept). */
body:has(.mud-dialog-container) .bt-quickchat { display: none; }

/* xs: the open quick chat is a sheet, the page behind it does not scroll. */
@media (max-width: 599.98px) {
    body:has(.bt-quickchat--list),
    body:has(.bt-quickchat--conversation) { overflow: hidden; }
}

/* --- 15. Drag and drop: project custom field board, table column settings ------------------ */
/* A drop zone takes drops only on its own box, so each board column is the zone itself (title included) and has a
   height even when it is empty. While a field is dragged over it, the column is highlighted. */
.bt-field-board__zone {
    min-height: 160px;
    background-color: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.bt-field-board__zone.mud-border-primary {
    border-style: dashed;
    border-color: var(--mud-palette-primary);
    background-color: var(--mud-palette-primary-hover);
}

.bt-field-board__empty {
    display: block;
    padding: 24px 8px;
    text-align: center;
    pointer-events: none;
}

.bt-field-board__item,
.bt-table-columns__item { cursor: grab; }

.bt-field-board__item--dragging,
.bt-table-columns__item--dragging { opacity: 0.5; }

.bt-table-columns { display: inline-flex; }

.bt-table-columns__panel { min-width: 280px; max-width: 360px; }

/* A reorderable zone starts with MudBlazor's 20 px "insert first" strip (absolute, top: 0); the padding keeps it off
   the first row, which could not be picked up otherwise. */
.bt-table-columns__list { min-height: 40px; max-height: 60vh; overflow-y: auto; padding-top: 20px; }

.bt-table-columns__item {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 4px;
    border-radius: var(--mud-default-borderradius);
}

.bt-table-columns__item:hover { background-color: var(--mud-palette-action-default-hover); }

.bt-table-columns__handle { color: var(--mud-palette-text-secondary); }

/* --- 16. Create wizards: /tickets/new, /warranty-claims/new (06 §6.10.2) ----------------------------------- */
/* Radio cards (project, subject / device), the read-only summary list and its pre-wrapped long text. */
.bt-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
}

.bt-choice-grid--three {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.bt-choice-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    min-height: 64px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--bt-radius-m);
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    font: inherit;
    text-align: start;
    cursor: pointer;
    transition: border-color 0.2s var(--bt-ease), box-shadow 0.2s var(--bt-ease), background-color 0.2s var(--bt-ease);
}

.bt-choice-card:hover {
    border-color: var(--mud-palette-primary);
}

.bt-choice-card:focus-visible {
    outline: none;
    box-shadow: var(--bt-focus-ring);
    border-color: var(--mud-palette-primary);
}

.bt-choice-card--selected {
    border-color: var(--mud-palette-primary);
    background: var(--bt-selected-bg);
    box-shadow: inset 0 0 0 1px var(--mud-palette-primary);
}

.bt-choice-card--large {
    flex-direction: column;
    align-items: flex-start;
    min-height: 132px;
    padding: 1rem;
}

.bt-choice-card__body {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.bt-choice-card__title {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.bt-choice-card__hint {
    color: var(--mud-palette-text-secondary);
    font-size: 0.8125rem;
}

.bt-summary-list {
    display: grid;
    grid-template-columns: minmax(8rem, max-content) 1fr;
    gap: 0.5rem 1.25rem;
    margin: 0;
}

.bt-summary-list dt {
    color: var(--mud-palette-text-secondary);
    font-size: 0.875rem;
}

.bt-summary-list dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.bt-pre-wrap {
    white-space: pre-wrap;
    max-height: 16rem;
    overflow: auto;
}

@media (max-width: 599.98px) {
    .bt-summary-list {
        grid-template-columns: 1fr;
        gap: 0.125rem;
    }

    .bt-summary-list dd {
        margin-bottom: 0.5rem;
    }
}

/* --- 17. Filter bars ------------------------------------------------------------------------------------- */
/* A dense outlined field sits 8 px from the top with a label and 4 px without one (MudBlazor), so every filter field
   has a label and every other control of a filter row (switch, toggle group) is wrapped in .bt-filter-inline: the
   box of a dense outlined field (40 px high, 8 px above, 4 px below), its content centred vertically. */
.bt-filter-inline {
    display: flex;
    align-items: center;
    min-height: 40px;
    margin: 8px 0 4px;
}
