@font-face {
    font-family: 'Mulish';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/mulish-v18-latin-regular.woff2') format('woff2');
}
@font-face {
    font-family: 'Mulish';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('fonts/mulish-v18-latin-500.woff2') format('woff2');
}
@font-face {
    font-family: 'Mulish';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('fonts/mulish-v18-latin-600.woff2') format('woff2');
}
@font-face {
    font-family: 'Mulish';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/mulish-v18-latin-700.woff2') format('woff2');
}

html, body {
    font-family: 'Mulish', system-ui, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    margin: 0;
}

/* ============================================================
   Design tokens. Dark is the default; [data-theme="light"] is set on <html>
   by the anti-flash script in App.razor and kept in sync by MainLayout's
   theme toggle. The same values live in StreamionBotTheme so MudBlazor
   components inherit them. Colours only ever come from these tokens.
   --tx3 (both themes) and the light --ok / --warn sit slightly darker or
   lighter than the design values so text keeps 4.5:1 on every surface,
   including --surf2.
   ============================================================ */
:root, [data-theme="dark"] {
    --bg: #101013;                       /* page background, input fields */
    --side: #131317;                     /* sidebar, live bar */
    --surf: #18181d;                     /* cards, tables, panels, dialogs */
    --surf2: #202026;                    /* hover, active nav item, active tab */
    --bd: rgba(255, 255, 255, 0.08);     /* default border, dividers */
    --bd2: rgba(255, 255, 255, 0.15);    /* field borders, secondary buttons */
    --tx: #ededf1;                       /* primary text */
    --tx2: #a6a6b2;                      /* secondary text */
    --tx3: #868691;                      /* help text, placeholder, inactive icons */
    --ac: #a988ff;                       /* accent as text / icon */
    --acbg: rgba(157, 107, 255, 0.14);   /* subtle accent area */
    --acfill: #7446e8;                   /* primary button, switch on (text #fff) */
    --ok: #3ecf8e;                       /* success, connected, active */
    --warn: #e5a93d;                     /* warning, pending */
    --dng: #f47a7a;                      /* danger, delete, live dot */
    --gold: #d9b25c;                     /* founder mark, rank 1 */
}

[data-theme="light"] {
    --bg: #f5f5f6;
    --side: #fafafb;
    --surf: #ffffff;
    --surf2: #ececef;
    --bd: rgba(20, 16, 40, 0.10);
    --bd2: rgba(20, 16, 40, 0.18);
    --tx: #19181f;
    --tx2: #55535f;
    --tx3: #6c6a75;
    --ac: #6d35d9;
    --acbg: rgba(124, 58, 237, 0.09);
    --acfill: #6d35d9;
    --ok: #127a56;
    --warn: #955f0a;
    --dng: #c43535;
    --gold: #8a6410;
}

/* Shape and type. Shadows only on floating surfaces (dialogs, menus, the
   side panel); resting cards have none. */
:root {
    --r-control: 6px;                    /* buttons, fields, tabs */
    --r-card: 8px;                       /* cards, tables */
    --r-dialog: 10px;
    --r-switch: 12px;
    --shadow-dialog: 0 20px 50px rgba(0, 0, 0, 0.4);
    --shadow-panel: -16px 0 40px rgba(0, 0, 0, 0.3);
    --backdrop-dialog: rgba(0, 0, 0, 0.55);
    --backdrop-panel: rgba(0, 0, 0, 0.5);
    --stage: #0c0c0f;                    /* stand-in for the stream picture (previews), both themes */
    --font-sans: "Mulish", system-ui, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

/* A flat page background: no glows. MudThemeProvider sets the palette
   background on body as well, hence !important. */
body {
    background: var(--bg) !important;
}

.mud-appbar {
    border-bottom: 1px solid var(--bd) !important;
}
/* One header height (52 px, theme AppbarHeight) on every screen: MudBlazor
   shrinks the bar by an eighth on phones, which would leave the sticky live
   bar under it misaligned. */
.mud-appbar .mud-toolbar-appbar { height: var(--mud-appbar-height); }
.mud-main-content { padding-top: var(--mud-appbar-height); }
.mud-drawer {
    border-right: 1px solid var(--bd) !important;
}

/* ============================================================
   Global component defaults: the building blocks of the design applied to
   MudBlazor's own components, so pages that are not rebuilt yet already
   match. app.css loads after MudBlazor.min.css (App.razor), so a selector
   of the same weight wins; !important only where MudBlazor itself uses it
   or sets the value inline.
   ============================================================ */

/* ---------- Buttons ----------
   34 px by default (page header), 32 px small (in a row), 36 px large and
   in dialogs. Flat: no shadow, no gradient, no uppercase. */
.mud-button-root.mud-button {
    box-sizing: border-box;
    min-height: 34px;
    padding: 0 14px;
    border-radius: var(--r-control);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0;
    text-transform: none;
    box-shadow: none;
}
.mud-button-root.mud-button[class*="-size-small"] { min-height: 32px; padding: 0 12px; font-size: 13px; }
.mud-button-root.mud-button[class*="-size-large"],
.mud-dialog .mud-dialog-actions .mud-button-root.mud-button { min-height: 36px; padding: 0 16px; font-size: 13px; }
.mud-button-root.mud-button:hover,
.mud-button-root.mud-button:active,
.mud-button-root.mud-button:focus-visible { box-shadow: none; }

/* Primary: the accent fill with white text. */
.mud-button-filled.mud-button-filled-primary {
    background-color: var(--acfill);
    color: #fff;
}
.mud-button-filled.mud-button-filled-primary:hover {
    background-color: color-mix(in srgb, var(--acfill) 88%, var(--tx));
}

/* Secondary: everything outlined that is not a danger or warning button —
   transparent, a 1 px field border, primary text. */
.mud-button-outlined:not(.mud-button-outlined-error):not(.mud-button-outlined-warning) {
    color: var(--tx);
    border: 1px solid var(--bd2);
    background-color: transparent;
}
.mud-button-outlined:not(.mud-button-outlined-error):not(.mud-button-outlined-warning):hover {
    background-color: var(--surf2);
}

/* Text buttons: no border; the primary one keeps the accent as a link. */
.mud-button-text { color: var(--tx); }
.mud-button-text.mud-button-text-primary { color: var(--ac); }
.mud-button-text:hover { background-color: var(--surf2); }

/* Danger: outlined in --dng; filled (confirmation dialog) in --dng with dark text. */
.mud-button-outlined.mud-button-outlined-error {
    color: var(--dng);
    border: 1px solid var(--dng);
    background-color: transparent;
}
.mud-button-text.mud-button-text-error { color: var(--dng); }
.mud-button-outlined.mud-button-outlined-error:hover,
.mud-button-text.mud-button-text-error:hover { background-color: var(--surf2); }
.mud-button-filled.mud-button-filled-error {
    background-color: var(--dng);
    color: #16090a;
}
.mud-button-filled.mud-button-filled-error:hover {
    background-color: color-mix(in srgb, var(--dng) 88%, var(--tx));
}
.mud-button-outlined.mud-button-outlined-warning {
    color: var(--warn);
    border: 1px solid var(--warn);
    background-color: transparent;
}
.mud-button-outlined.mud-button-outlined-warning:hover { background-color: var(--surf2); }

/* Disabled: one muted look for every variant. */
.mud-button-root.mud-button:disabled,
.mud-button-root.mud-button.mud-disabled {
    color: var(--tx3);
    background-color: transparent;
    border-color: var(--bd);
}
.mud-button-filled.mud-button-root:disabled,
.mud-button-filled.mud-button-root.mud-disabled {
    background-color: var(--surf2);
    border-color: transparent;
}

/* Icon buttons: 32 px (28 px small), no border, the icon in --tx3; delete
   in --dng, an explicit primary in the accent. */
.mud-icon-button {
    padding: 6px;
    border-radius: var(--r-control);
    color: var(--tx3);
}
.mud-icon-button .mud-icon-root { font-size: 20px; }
.mud-icon-button.mud-icon-button-size-small { padding: 5px; }
.mud-icon-button.mud-icon-button-size-small .mud-icon-root { font-size: 18px; }
.mud-icon-button:hover:not(:disabled):not(.mud-disabled) { background-color: var(--surf2); }
.mud-icon-button.mud-icon-button-color-inherit { color: inherit; }
.mud-icon-button.mud-error-text { color: var(--dng); }
.mud-icon-button.mud-primary-text { color: var(--ac); }
.mud-icon-button.mud-button-filled { box-shadow: none; }
.mud-icon-button.mud-button-outlined { border: 1px solid var(--bd2); }

/* ---------- Icons ----------
   Material Icons Outlined in the colour of the text they sit in: 20 px by
   default, 18 px small. Large icons (empty states, status tiles) keep
   MudBlazor's size. */
.mud-icon-root.mud-icon-size-medium { font-size: 20px; }
.mud-icon-root.mud-icon-size-small { font-size: 18px; }

/* ---------- Switch ----------
   40 × 24 track, radius 12, 18 px white knob; on --acfill, off --bd2. One
   size for every MudSwitch, whatever its Size or Color. */
.mud-switch .mud-switch-span {
    width: 40px;
    height: 24px;
    padding: 0;
    margin: 0 4px;
    overflow: visible;
}
.mud-switch .mud-switch-span .mud-switch-track {
    border-radius: var(--r-switch);
    background-color: var(--bd2);
    opacity: 1;
}
.mud-switch .mud-switch-base {
    padding: 3px;
    border-radius: 50%;
    color: #fff;
}
.mud-switch .mud-switch-base:hover,
.mud-switch .mud-switch-base:focus-visible,
.mud-switch .mud-switch-base:active { background-color: transparent; }
.mud-switch .mud-switch-base.mud-checked { transform: translateX(16px); }
/* MudBlazor colours the checked track through .mud-primary & co., which
   are !important. */
.mud-switch .mud-switch-base.mud-checked + .mud-switch-track {
    background-color: var(--acfill) !important;
    opacity: 1;
}
.mud-switch .mud-switch-button [class*="mud-switch-thumb-"] {
    width: 18px;
    height: 18px;
    background-color: #fff;
    box-shadow: none;
}
.mud-switch .mud-switch-base.mud-switch-disabled { color: #fff !important; }
.mud-switch .mud-switch-base.mud-switch-disabled + .mud-switch-track { opacity: 1 !important; }
.mud-switch.mud-disabled .mud-switch-span { opacity: 0.45; }
.mud-switch .mud-switch-span:has(.mud-switch-input:focus-visible) {
    outline: 2px solid var(--ac);
    outline-offset: 2px;
    border-radius: var(--r-switch);
}
.mud-switch > .mud-typography { font-size: 13px; }

/* ---------- Text field, select, numeric, autocomplete, pickers ----------
   Every variant looks the same: the label (600) above, a 36 px box with a
   1 px --bd2 border, radius 6, --bg inside, the border --ac on focus, help
   text 12 px --tx3 below. MudBlazor's floating label is pinned above the
   box instead of animating into it. */
.mud-input-control > .mud-input-control-input-container > .mud-input-label-inputcontrol {
    position: static;
    order: -1;
    transform: none !important;
    max-width: 100%;
    margin: 0 0 6px;
    padding: 0 !important;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--tx) !important;
    pointer-events: auto;
    background: none;
}
.mud-input-control > .mud-input-control-input-container > .mud-input-label-inputcontrol.mud-disabled { color: var(--tx3) !important; }
.mud-input-control > .mud-input-control-input-container > .mud-input-label-inputcontrol.mud-input-error { color: var(--dng) !important; }
.mud-input-control > .mud-input-control-input-container > div.mud-input.mud-input-text.mud-input-text-with-label { margin-top: 0; }

.mud-input-control .mud-input.mud-input-text,
.mud-input-control .mud-input.mud-input-outlined,
.mud-input-control .mud-input.mud-input-filled {
    box-sizing: border-box;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid var(--bd2);
    border-radius: var(--r-control);
    background-color: var(--bg);
    color: var(--tx);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    transition: border-color 150ms ease;
}
.mud-input-control .mud-input.mud-input-text:focus-within,
.mud-input-control .mud-input.mud-input-outlined:focus-within,
.mud-input-control .mud-input.mud-input-filled:focus-within { border-color: var(--ac); }
.mud-input-control .mud-input.mud-input-error { border-color: var(--dng); }
.mud-input-control .mud-input.mud-disabled { color: var(--tx3); border-color: var(--bd); }
.mud-input-control .mud-input.mud-input-margin-dense { min-height: 32px; }
/* MudBlazor's own chrome of the three variants: underline, notched
   outline, filled background. */
.mud-input.mud-input-underline::before,
.mud-input.mud-input-underline::after { content: none; }
.mud-input.mud-input-outlined > .mud-input-outlined-border { display: none; }
.mud-input.mud-input-filled.mud-focused { background-color: var(--bg); }

.mud-input > input.mud-input-root,
.mud-input > div.mud-input-slot.mud-input-root {
    box-sizing: border-box;
    height: 34px;
    padding: 0;
    color: var(--tx);
}
.mud-input > div.mud-input-slot.mud-input-root { height: auto; line-height: 34px; }
.mud-input > input.mud-input-root.mud-input-root-margin-dense,
.mud-input > div.mud-input-slot.mud-input-root.mud-input-root-margin-dense { height: 30px; line-height: 30px; padding: 0; }
.mud-input > textarea.mud-input-root,
.mud-input > .mud-input-root.mud-input-root-multiline {
    box-sizing: border-box;
    height: auto;
    /* MudBlazor leaves room for the floating label inside the box; the label sits above. */
    margin-top: 0;
    padding: 8px 0;
    line-height: 1.5;
}
.mud-input > input.mud-input-root::placeholder,
.mud-input > textarea.mud-input-root::placeholder { color: var(--tx3); opacity: 1; }
.mud-input .mud-input-adornment { color: var(--tx3); }
.mud-input .mud-input-adornment .mud-icon-root { font-size: 18px; }
.mud-input .mud-input-adornment-start { margin-inline-end: 8px; }
.mud-input .mud-input-adornment-end { margin-inline-start: 8px; }
.mud-input .mud-input-adornment .mud-icon-button { padding: 4px; }

.mud-input-control > .mud-input-control-helper-container {
    margin-top: 5px;
    padding: 0 !important;
}
.mud-input-control .mud-input-helper-text {
    font-family: var(--font-sans);
    font-size: 12px;
    line-height: 1.45;
    letter-spacing: 0;
    color: var(--tx3);
}
.mud-input-control .mud-input-helper-text.mud-input-error { color: var(--dng) !important; }

/* ---------- Slider ----------
   The track in --bd2, the filled part and the thumb in --acfill; no
   glow. Label and value sit above it (Common/SliderField.razor). */
.mud-slider .mud-slider-input { accent-color: var(--acfill); }
.mud-slider.mud-slider-primary .mud-slider-filled { background-color: var(--acfill); }
.mud-slider.mud-slider-primary .mud-slider-input::-webkit-slider-runnable-track { background-color: var(--bd2); }
.mud-slider.mud-slider-primary .mud-slider-input::-moz-range-track { background-color: var(--bd2); }
.mud-slider.mud-slider-primary .mud-slider-input::-webkit-slider-thumb { background-color: var(--acfill); box-shadow: none; }
.mud-slider.mud-slider-primary .mud-slider-input::-moz-range-thumb { background-color: var(--acfill); box-shadow: none; }
.mud-slider.mud-slider-primary .mud-slider-input:focus-visible::-webkit-slider-thumb,
.mud-slider.mud-slider-primary .mud-slider-input:active::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--acbg); }
.mud-slider.mud-slider-primary .mud-slider-input:focus-visible::-moz-range-thumb,
.mud-slider.mud-slider-primary .mud-slider-input:active::-moz-range-thumb { box-shadow: 0 0 0 4px var(--acbg); }

/* ---------- Tabs ----------
   MudTabs is not in use; tabs are FilterPills (Common/FilterPills.razor.css). */

/* ---------- Cards, tables ----------
   Resting surfaces: --surf, a 1 px --bd border, radius 8, no shadow. */
.mud-paper:not(.mud-popover):not(.mud-dialog):not(.mud-drawer):not(.mud-appbar):not(.mud-alert):not(.mud-snackbar) {
    background-color: var(--surf);
    border: 1px solid var(--bd);
    border-radius: var(--r-card);
}
/* Papers inside a menu or picker take the popover's frame. */
.mud-popover .mud-paper:not(.mud-popover) { border: 0; }
.mud-table,
.mud-simple-table {
    background-color: var(--surf);
    border: 1px solid var(--bd);
    border-radius: var(--r-card);
    overflow: hidden;
}
/* A table inside a card (or another table) takes the card's frame. */
.mud-paper .mud-table,
.mud-paper .mud-simple-table { border: 0; border-radius: 0; }

.mud-table-root .mud-table-head .mud-table-cell,
.mud-simple-table table * tr > th {
    height: 40px;
    padding: 8px 16px;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0;
    text-transform: none;
    color: var(--tx3);
    border-bottom: 1px solid var(--bd);
}
.mud-table-root .mud-table-body .mud-table-cell,
.mud-simple-table table * tr > td {
    height: 48px;
    padding: 8px 16px;
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.5;
    color: var(--tx);
    border-bottom: 1px solid var(--bd);
}
.mud-table-dense * .mud-table-row .mud-table-cell,
.mud-simple-table.mud-table-dense * tr td,
.mud-simple-table.mud-table-dense * tr th { height: 40px; padding: 6px 16px; }
.mud-table-hover .mud-table-container .mud-table-root .mud-table-body .mud-table-row:hover,
.mud-simple-table.mud-table-hover .mud-table-container table tbody tr:hover { background-color: var(--surf2); }
.mud-table-pagination { color: var(--tx2); border-top: 1px solid var(--bd); }

/* ---------- Dialogs ----------
   Floating: --surf, radius 10, the dialog shadow over a dark backdrop. No
   frosted glass. */
.mud-dialog {
    background-color: var(--surf);
    border: 1px solid var(--bd);
    border-radius: var(--r-dialog);
    box-shadow: var(--shadow-dialog);
}
.mud-dialog .mud-dialog-title {
    padding: 18px 20px 8px;
    font-size: 16px;
    font-weight: 700;
}
.mud-dialog .mud-dialog-title .mud-typography { font-size: 16px; font-weight: 700; }
.mud-dialog .mud-dialog-content { padding: 8px 20px; }
.mud-dialog .mud-dialog-actions { gap: 8px; padding: 12px 20px 18px; }
.mud-overlay.mud-overlay-dialog .mud-overlay-scrim.mud-overlay-dark {
    background-color: var(--backdrop-dialog);
    border-color: var(--backdrop-dialog);
}

/* Side panel (Common/SidePanel.razor): a MudDialog docked right, full
   height, 440 px (full width on phones), the panel shadow over a 50 %
   backdrop. MudBlazor renders this frame, so it is styled here; the head,
   body and foot style themselves (SidePanel.razor.css). */
.mud-dialog-container.mud-dialog-centerright:has(> .sb-panel),
.mud-dialog-container.mud-dialog-centerright:has(.mud-dialog.sb-panel) {
    align-items: stretch;
    padding: 0;
}
.mud-dialog.sb-panel {
    width: 440px;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    margin: 0;
    overflow: hidden;
    border: 0;
    border-left: 1px solid var(--bd2);
    border-radius: 0;
    box-shadow: var(--shadow-panel);
}
.mud-dialog.sb-panel .mud-dialog-title,
.mud-dialog.sb-panel .mud-dialog-actions { padding: 0; border-radius: 0; }
.mud-dialog.sb-panel .mud-dialog-content {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0;
    overflow-y: auto;
}
.sb-panel-backdrop.mud-overlay-scrim,
.sb-panel-backdrop .mud-overlay-scrim {
    background-color: var(--backdrop-panel) !important;
    border-color: var(--backdrop-panel) !important;
}

/* Menus, selects and pickers float as well: one shadow, a 1 px border. */
.mud-popover.mud-paper {
    background-color: var(--surf);
    border: 1px solid var(--bd);
    border-radius: var(--r-card);
    box-shadow: var(--shadow-dialog);
}

/* ---------- Alerts ----------
   No coloured areas: a hint or warning is a line — the icon and text in the
   severity's colour (hints in --tx2), no background. The outlined variant
   keeps a neutral frame for hints that need one. */
.mud-alert.mud-alert {
    padding: 4px 0;
    background-color: transparent;
    border: 0;
    border-radius: var(--r-control);
    box-shadow: none;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--tx2);
}
.mud-alert .mud-alert-icon {
    padding: 2px 0 0;
    margin-inline-end: 8px;
    font-size: 16px;
    opacity: 1;
    color: var(--tx3);
}
.mud-alert .mud-alert-icon .mud-icon-root { font-size: 16px; }
.mud-alert .mud-alert-message { padding: 0; }
.mud-alert .mud-alert-close { margin-inline-start: 8px; }
.mud-alert[class*="mud-alert-outlined-"] {
    padding: 10px 12px;
    border: 1px solid var(--bd);
}
.mud-alert[class*="-warning"],
.mud-alert[class*="-warning"] .mud-alert-icon { color: var(--warn); }
.mud-alert[class*="-error"],
.mud-alert[class*="-error"] .mud-alert-icon { color: var(--dng); }
.mud-alert[class*="-success"],
.mud-alert[class*="-success"] .mud-alert-icon { color: var(--ok); }
.mud-alert[class*="-info"] .mud-alert-icon { color: var(--ac); }
.mud-alert[class*="mud-alert-filled-"] .mud-button-root { color: inherit; }

/* ---------- Touch targets ----------
   On phones every control is at least 44 px to hit. */
@media (max-width: 819.98px) {
    .mud-button-root.mud-button,
    .mud-button-root.mud-button[class*="-size-"],
    .mud-dialog .mud-dialog-actions .mud-button-root.mud-button,
    .mud-input-control .mud-input.mud-input-text,
    .mud-input-control .mud-input.mud-input-outlined,
    .mud-input-control .mud-input.mud-input-filled { min-height: 44px; }
    /* Not the switch knob: it is an icon button, too, and sits in the track. */
    .mud-icon-button:not(.mud-switch-base) { min-width: 44px; min-height: 44px; }
    .mud-switch,
    .mud-checkbox,
    .mud-radio { min-height: 44px; }
    /* The spin arrows of number fields are 20 px and cannot grow inside the
       field; phones type numbers on the number keyboard instead. */
    .mud-input-control.mud-input-number-control .mud-input-numeric-spin { display: none; }
}

/* Dropdown panel for the topbar Help + User menus (applied via the MudMenu
   PopoverClass): a floating surface, so it keeps its shadow. */
.streamionbot-frosted-menu.mud-popover {
    background: var(--surf) !important;
    border: 1px solid var(--bd2);
    border-radius: 8px !important;
    box-shadow: var(--shadow-dialog) !important;
}
.streamionbot-frosted-menu .mud-list { background: transparent !important; }

/* Help-menu sub-labels in the accent colour. */
.streamionbot-help-sub { color: var(--ac) !important; font-weight: 600; }

/* Code, command triggers and {variables} → JetBrains Mono. */
code, kbd, samp, pre { font-family: var(--font-mono); }

/* Smooth scrollbar on dark backgrounds */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.18); }

/* Blazor's <FocusOnNavigate Selector="h1"> (Routes.razor) moves focus to the
   page's <h1> after every navigation so screen-reader/keyboard users land on
   the new content. That focus is programmatic — not a keyboard tab — so the
   default focus ring (e.g. the box around the Dashboard title) is just visual
   noise for mouse users. Suppress it on headings; they're never tab-reachable
   interactive controls, so keyboard usability is unaffected. */
h1:focus,
h1:focus-visible {
    outline: none;
}

/* AlertPreview — admin-side stand-in for the OBS browser-source
   toast. The structure mirrors wwwroot/overlays/alerts/alerts.css
   (same class names, same layout modifiers) so the preview reads as
   "what OBS will paint" minus animation/sound. Everything is scoped
   under .streamionbot-alert-preview so the global selectors of the live
   overlay can't leak into the admin UI. */
.streamionbot-alert-preview {
    padding: 16px;
    background: var(--surf);
    border: 1px solid var(--bd);
    border-radius: var(--r-card);
}
.streamionbot-alert-preview__caption {
    margin-bottom: 10px;
    font-size: 12px;
    color: var(--tx3);
}
/* The stage stands for the stream picture: dark in both themes. */
.streamionbot-alert-preview__stage {
    background: var(--stage);
    border: 1px solid var(--bd2);
    border-radius: var(--r-control);
    padding: 22px 16px;
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.streamionbot-alert-preview .toast {
    display: flex;
    align-items: center;
    gap: 14px;
    font-family: var(--font-family);
    color: var(--text-color);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    max-width: 100%;
}
.streamionbot-alert-preview .toast.layout-left   { flex-direction: row;            text-align: left;   }
.streamionbot-alert-preview .toast.layout-right  { flex-direction: row-reverse;    text-align: right;  }
.streamionbot-alert-preview .toast.layout-top    { flex-direction: column;         text-align: center; align-items: center; }
.streamionbot-alert-preview .toast.layout-bottom { flex-direction: column-reverse; text-align: center; align-items: center; }
.streamionbot-alert-preview .toast-icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    line-height: 1;
}
.streamionbot-alert-preview .toast-icon img {
    max-width: var(--image-max-size, 160px);
    max-height: var(--image-max-size, 160px);
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}
.streamionbot-alert-preview .toast-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.streamionbot-alert-preview .toast-title {
    /* Title scales with the same --font-size custom prop that drives
       the subtitle, with a fixed offset so the headline stays larger.
       At the 18 px subtitle default this resolves to 28 px — matches
       the hardcoded value the old layout shipped with, so existing
       configs paint identically. */
    font-size: calc(var(--font-size, 18px) + 10px);
    font-weight: 700;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.streamionbot-alert-preview .toast-subtitle {
    font-size: var(--font-size, 18px);
    font-weight: var(--font-weight, 400);
    opacity: 0.9;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.streamionbot-alert-preview .alert-var {
    color: var(--accent, inherit);
}
.streamionbot-alert-preview .toast-message {
    font-size: calc(var(--font-size, 18px) * 0.85);
    font-weight: var(--font-weight, 400);
    color: var(--text-color, inherit);
    opacity: 0.75;
    margin-top: 4px;
    line-height: 1.25;
    white-space: normal;
    word-break: break-word;
}

/* Drag-to-position handle inside the layout-preview rectangles
   (used by /alerts → "Alert Overlay Layout" and /media-commands →
   "Video overlay position"). cursor: grab while idle, grabbing
   while a drag is in flight. touch-action: none stops the browser
   from claiming the pointer for scroll / pinch on touch devices.
   user-select: none keeps a long-drag from accidentally selecting
   the glyph inside the box. The .is-dragging modifier is toggled
   from app.js, and disables the 120 ms position transition so the
   box stays under the cursor without visible lag. */
.media-preview-handle {
    cursor: grab;
    touch-action: none;
    user-select: none;
}
.media-preview-handle.is-dragging {
    cursor: grabbing;
    transition: none !important;
}

/* --------------------------------------------------------------------
   Overlay scene editor canvas (/overlays/scenes/{id}). Global rather than
   scoped: app.js toggles these classes while dragging. The stage stays
   dark in both themes (it stands for the stream picture); the boxes use
   the accent fill with white handles.
   -------------------------------------------------------------------- */
.scene-canvas {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--stage);
    border: 1px solid var(--bd2);
    border-radius: var(--r-control);
    overflow: hidden;
}

.scene-canvas-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: transparent;
}

/* While a widget is being dragged/resized the iframe must ignore pointer
   events, otherwise it can swallow the move events and the drag gets stuck. */
.scene-canvas.editor-busy .scene-canvas-frame {
    pointer-events: none;
}

/* Transparent layer above the iframe that captures pointer events for
   selecting / dragging widgets. The iframe shows pixels; this owns input. */
.scene-interaction {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.editor-hitbox {
    position: absolute;
    box-sizing: border-box;
    border: 1px dashed rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.04);
    cursor: move;
    touch-action: none;
}

.editor-hitbox:hover {
    border-color: rgba(255, 255, 255, 0.6);
}

.editor-hitbox.selected {
    border: 1px solid var(--acfill);
    background: color-mix(in srgb, var(--acfill) 16%, transparent);
}

/* A hidden widget: the preview no longer renders it (OBS gets the same
   filtered snapshot), so only the frame is left — faded, still draggable
   and selectable so it can be switched back on. */
.editor-hitbox.disabled {
    opacity: 0.45;
}

.editor-hitbox.disabled.selected {
    border-style: dashed;
}

.editor-hitbox-label {
    position: absolute;
    top: 0;
    left: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.4;
    color: #fff;
    background: rgba(255, 255, 255, 0.35);
    pointer-events: none;
    white-space: nowrap;
}

.editor-hitbox.selected .editor-hitbox-label {
    background: var(--acfill);
}

.editor-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #fff;
    border: 1px solid var(--acfill);
}

.editor-handle[data-handle="nw"] { top: -5px; left: -5px; cursor: nwse-resize; }
.editor-handle[data-handle="ne"] { top: -5px; right: -5px; cursor: nesw-resize; }
.editor-handle[data-handle="sw"] { bottom: -5px; left: -5px; cursor: nesw-resize; }
.editor-handle[data-handle="se"] { bottom: -5px; right: -5px; cursor: nwse-resize; }

/* Touch: bigger corner handles so a finger can catch them. */
@media (pointer: coarse) {
    .editor-handle { width: 18px; height: 18px; }
    .editor-handle[data-handle="nw"] { top: -9px; left: -9px; }
    .editor-handle[data-handle="ne"] { top: -9px; right: -9px; }
    .editor-handle[data-handle="sw"] { bottom: -9px; left: -9px; }
    .editor-handle[data-handle="se"] { bottom: -9px; right: -9px; }
}

/* ============================================================
   Sidebar: 232px, hosted in a MudDrawer (ClipMode.Never → full
   height, drawer background is --side via the Mud palette).
   Rows 32px, active entry --surf2 with an accent icon; no pills,
   no tiles. Token-driven, so light and dark both follow.
   Logo head and Pro/Settings foot are fixed; only the nav in
   between scrolls (rarely needed: one group is open at a time).
   ============================================================ */

/* Let the sidenav stretch and scroll inside the drawer's content column. */
.mud-drawer-content { display: flex; flex-direction: column; min-height: 0; }

.streamionbot-sidenav {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 14px 10px;
    overflow: hidden;
}

/* Logo, wordmark with plan word, version below. */
.streamionbot-sidenav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: none;
    padding: 2px 8px 14px;
    text-decoration: none;
    color: var(--tx);
}
.streamionbot-sidenav-logo-img {
    width: 28px;
    height: 28px;
    flex: none;
    border-radius: 7px;
    object-fit: cover;
}
.streamionbot-sidenav-brand-text { min-width: 0; }
.streamionbot-sidenav-wordmark {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: -0.01em;
    color: var(--tx);
    white-space: nowrap;
}
.streamionbot-sidenav-tier {
    font-size: 11px;
    font-weight: 600;
    color: var(--ac);
}
.streamionbot-sidenav-tier.is-founder { color: var(--gold); cursor: default; }
.streamionbot-sidenav-version {
    font-size: 11px;
    color: var(--tx3);
}

.streamionbot-sidenav-nav {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
}
/* Rows keep their height when the nav has to scroll. */
.streamionbot-sidenav-nav > * { flex: none; }

/* One row: direct links, group heads and the foot rows share it. */
.streamionbot-sidenav-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 32px;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--tx2);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.streamionbot-sidenav-row:hover { background: var(--surf2); }
.streamionbot-sidenav-row:focus-visible,
.streamionbot-sidenav-item:focus-visible {
    outline: 2px solid var(--ac);
    outline-offset: -2px;
}
.streamionbot-sidenav-row.active {
    background: var(--surf2);
    color: var(--tx);
    font-weight: 600;
}
.streamionbot-sidenav-group.holds-page { color: var(--tx); }

.streamionbot-sidenav-icon.mud-icon-root {
    flex: none;
    width: 18px;
    height: 18px;
    font-size: 18px;
    color: inherit;
}
.streamionbot-sidenav-row.active .streamionbot-sidenav-icon { color: var(--ac); }
/* The Pro row's crown reads in the accent, like the Pro mark on the areas. */
.streamionbot-sidenav-icon.is-pro.mud-icon-root { color: var(--ac); }

.streamionbot-sidenav-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.streamionbot-sidenav-chevron.mud-icon-root {
    flex: none;
    width: 16px;
    height: 16px;
    font-size: 16px;
    color: var(--tx3);
}
.streamionbot-sidenav-warn {
    flex: none;
    width: 15px;
    height: 15px;
    font-size: 15px;
    color: var(--warn);
}

.streamionbot-sidenav-section {
    padding: 18px 10px 6px;
    font-size: 11.5px;
    color: var(--tx3);
}
/* Hairline that sets the platform admin's section apart from the
   channel's areas. */
.streamionbot-sidenav-divider {
    height: 1px;
    margin: 14px 10px 0;
    background: var(--bd);
}
.streamionbot-sidenav-divider + .streamionbot-sidenav-section { padding-top: 12px; }

/* Sub-entries of an open group: indented, no rule, no icons. */
.streamionbot-sidenav-items {
    display: flex;
    flex-direction: column;
    padding-left: 28px;
}
.streamionbot-sidenav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 28px;
    padding: 0 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--tx2);
    text-decoration: none;
}
.streamionbot-sidenav-item:hover { background: var(--surf2); }
.streamionbot-sidenav-item.active {
    background: var(--surf2);
    color: var(--ac);
    font-weight: 600;
}

/* Quiet word on the right: "Pro" on sub-entries, "active"/"Upgrade" on the
   Pro row. */
.streamionbot-sidenav-aside {
    flex: none;
    font-size: 11px;
    font-weight: 500;
    color: var(--tx3);
}
.streamionbot-sidenav-foot .streamionbot-sidenav-aside { font-size: 11.5px; }
/* An active Pro plan reads in --ok, like a connected overlay. */
.streamionbot-sidenav-aside.is-active { color: var(--ok); }

/* Pro and Settings pinned at the foot. */
.streamionbot-sidenav-foot {
    flex: none;
    padding-top: 14px;
    display: flex;
    flex-direction: column;
}

/* ============================================================
   Header: the app bar sits on the page background with a hairline
   below; its content (TopBar) styles itself in TopBar.razor.css.
   ============================================================ */
.mud-appbar.mud-appbar-fixed-top {
    background: var(--bg) !important;
    box-shadow: none !important;
}
.mud-appbar .mud-toolbar-gutters { padding: 0 20px; }
@media (max-width: 819.98px) {
    .mud-appbar .mud-toolbar-gutters { padding: 0 6px 0 14px; }
}

/* Spotify attribution (SpotifyLogo.razor): the official full logo, 77 px wide
   (min. 70 px), clear space = half the icon height (11 px). Monochrome: white
   on the dark theme, black on the light one. */
.spotify-logo { display: inline-flex; flex: 0 0 auto; margin: 11px; line-height: 0; }
.spotify-logo img { width: 77px; height: auto; display: block; }
.spotify-logo .spotify-logo-on-light { display: none; }
[data-theme="light"] .spotify-logo .spotify-logo-on-dark { display: none; }
[data-theme="light"] .spotify-logo .spotify-logo-on-light { display: block; }

/* ==================================================================
   Mobile shell (below 820 px): tab bar at the bottom + the full-screen
   "More" sheet (MoreSheet.razor.css). The sidebar drawer is persistent
   on desktop and removed entirely here, together with the content offset
   MudBlazor gives it.
   ================================================================== */

/* Tab bar — hidden on desktop. */
.streamionbot-mnav { display: none; }

@media (max-width: 819.98px) {
    .mud-drawer, .mud-drawer-overlay, .mud-overlay-drawer { display: none !important; }
    .mud-drawer-open-persistent-left .mud-main-content { margin-left: 0 !important; }
    .mud-drawer-open-persistent-left.mud-drawer-left-clipped-never .mud-appbar {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* Content clears the fixed tab bar (incl. iOS safe area). */
    .mud-main-content { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
    .mud-main-content > .mud-container { padding: 16px !important; }

    /* Tab bar: 60 px on --side, hairline above; 22 px icons, 11 px labels.
       Active: label --tx 700, icon in the accent. */
    .streamionbot-mnav {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1300;
        height: calc(60px + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        box-sizing: border-box;
        border-top: 1px solid var(--bd);
        background: var(--side);
    }
    .streamionbot-mnav-tab {
        display: flex;
        flex: 1;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        min-width: 0;
        padding: 0;
        border: 0;
        background: transparent;
        color: var(--tx3);
        font: inherit;
        font-size: 11px;
        font-weight: 500;
        text-decoration: none;
        cursor: pointer;
    }
    .streamionbot-mnav-tab .streamionbot-mnav-icon {
        width: 22px;
        height: 22px;
        font-size: 22px;
    }
    .streamionbot-mnav-label {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .streamionbot-mnav-tab.active { color: var(--tx); font-weight: 700; }
    .streamionbot-mnav-tab.active .streamionbot-mnav-icon { color: var(--ac); }
    .streamionbot-mnav-tab:focus-visible { outline: 2px solid var(--ac); outline-offset: -2px; }
}
