.label {
    display: inline-block;
}

/* Command trigger input with "!" prefix (matches currency stat-card inputs) */
.control.command-prefix-input.has-icons-left {
    position: relative;
    width: 100%;
    max-width: 100%;
}

.control.command-prefix-input.has-icons-left .input {
    /* radius / bg / border come from global --input-* tokens */
    width: 100%;
    box-sizing: border-box;
    display: block;
    height: 2.5rem;
    font-size: 0.875rem;
    line-height: 2.5rem;
    padding-top: 0;
    padding-bottom: 0;
    padding-left: 2.25rem;
    padding-right: 0.75rem;
}

.control.command-prefix-input.has-icons-left .input:focus {
    border-color: var(--input-border-focus);
    box-shadow: 0 0 0 0.125em color-mix(in srgb, var(--input-border-focus) 25%, transparent);
}

.control.command-prefix-input.has-icons-left > .icon.is-left {
    position: absolute;
    left: 0;
    top: 0;
    width: 2.25rem;
    height: 2.5rem;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    display: block;
    text-align: center;
    font-size: 0.875rem;
    line-height: 2.5rem;
    pointer-events: none;
    color: #7a7a7a;
}

html[data-theme="dark"] .control.command-prefix-input.has-icons-left > .icon.is-left,
body[data-theme="dark"] .control.command-prefix-input.has-icons-left > .icon.is-left {
    color: #b5b5b5;
}

/* Bulma has-icons-left: keep search/field icons above the input on focus */
.control.has-icons-left > .icon.is-left,
.control.has-icons-left > .icon.is-right {
    z-index: 4;
    pointer-events: none;
    color: var(--muted);
}

.control.has-icons-left > .input,
.control.has-icons-left > .select select {
    position: relative;
    z-index: 1;
}

.control.has-icons-left > .input:focus ~ .icon.is-left,
.control.has-icons-left > .select select:focus ~ .icon.is-left,
.control.has-icons-right > .input:focus ~ .icon.is-right,
.control.has-icons-right > .select select:focus ~ .icon.is-right {
    color: var(--muted);
}

#dvd {
    position: absolute;
    width: 512px;
    height: 512px;
    border: 0 !important;
}

/* Main content column: centered (overrides Bulma .section spacing/layout where included) */
.section {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-left: 20px;
    padding-right: 20px;
    padding-top: 6rem;
}

@media (max-width: 1024px) {
    .section {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
}

/* Moderation grid needs normal block flow, not flex-centered section */
.section:has(#moderation-grid-container) {
    display: unset !important;
}

/* Donate overlay: minimal chrome, no standard header include */
html.donate-page .section {
    display: block;
    width: 100%;
    background: transparent;
    border-radius: 8px;
    padding: 0;
}

html {
    overflow-y: auto !important;
}

/* -------------------------------------------------- */
/* Theme variables                                    */
/* Light defaults on :root and dark overrides below   */
/* -------------------------------------------------- */
:root {
    --bg: #ffffff;
    --text: #1f2937; /* gray-800 */
    --muted: #6b7280; /* gray-500 */
    --border: rgba(0, 0, 0, 0.08);
    --surface: #ffffff;
    --surface-elev: #ffffff;
    --shadow: 0 2px 6px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 18px rgba(0,0,0,0.12);
    --link: #2563eb;
    --link-hover: #1d4ed8;
    --input-bg: #ffffff;
    --input-bg-hover: #f9fafb;
    --input-bg-focus: #ffffff;
    --input-bg-disabled: #e5e7eb;
    --input-text: #1f2937;
    --input-text-disabled: #9ca3af;
    --input-border: #d1d5db;
    --input-border-focus: #2563eb;
    --input-radius: 8px;
}

[data-theme="dark"] :root, html[data-theme="dark"], body[data-theme="dark"] {
    --bg: #121212;
    --text: #e0e0e0;
    --muted: #9ca3af; /* gray-400 */
    --border: #2a2a2a;
    --surface: #1e1e1e;
    --surface-elev: #1f1f1f;
    --shadow: 0 2px 6px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 18px rgba(0,0,0,0.5);
    --link: #9ec3ff;
    --link-hover: #c6ddff;
    --input-bg: #363636;
    --input-bg-hover: #404040;
    --input-bg-focus: #4a4a4a;
    --input-bg-disabled: #1a1a1a;
    --input-text: #e0e0e0;
    --input-text-disabled: #aeb6c2;
    --input-border: #4a4a4a;
    --input-border-focus: #9ec3ff;
}

/* Modal: keep content visible between fixed header (72px) and footer (64px) */
.modal {
    padding-top: 80px;
    padding-bottom: 72px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap:10px;
}

.checkbox:hover{
    color: darkgray;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* --------------------------------------------- */
/* Dark theme (activated by [data-theme="dark"] on <html> or <body>) */
/* --------------------------------------------- */
[data-theme="dark"] {
    color-scheme: dark;
}

html[data-theme="dark"],
body[data-theme="dark"] {
    background-color: var(--bg);
    color: var(--text);
}

/* Theme switch: left-to-right wipe (View Transitions API) */
::view-transition-group(root) {
    animation-duration: 0.78s;
    animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

::view-transition-old(root),
::view-transition-new(root) {
    inset: 0;
    mix-blend-mode: normal;
    overflow: clip;
}

::view-transition-old(root) {
    animation: none;
    opacity: 1;
    z-index: 0;
}

::view-transition-new(root) {
    animation: sh-theme-wipe-ltr-vt 0.78s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 1;
    z-index: 1;
}

@keyframes sh-theme-wipe-ltr-vt {
    from {
        clip-path: polygon(0 0, 0 0, -18% 100%, -36% 100%);
    }
    to {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }
}

/* Theme switch: clip-path overlay fallback */
.sh-theme-transition-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483646;
    pointer-events: none;
    clip-path: inset(0 100% 0 0);
    will-change: clip-path;
}

.sh-theme-transition-overlay.is-animating {
    animation: sh-theme-wipe-ltr 0.78s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes sh-theme-wipe-ltr {
    from {
        clip-path: polygon(0 0, 0 0, -18% 100%, -36% 100%);
    }
    to {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }
}

/* Links */
html[data-theme="dark"] a,
body[data-theme="dark"] a { color: var(--link); }
html[data-theme="dark"] a:hover,
body[data-theme="dark"] a:hover { color: var(--link-hover); }

/* Headings */
html[data-theme="dark"] .title,
body[data-theme="dark"] .title { color: #ffffff; }

html[data-theme="dark"] .subtitle,
body[data-theme="dark"] .subtitle { color: #c0c0c0; }

/* Labels */
html[data-theme="dark"] .label,
body[data-theme="dark"] .label { color: var(--text); }

/* Navbar (Bulma .is-light variant overridden for dark) */
html[data-theme="dark"] .navbar.is-light,
body[data-theme="dark"] .navbar.is-light {
    background-color: var(--surface-elev) !important;
    color: var(--text) !important;
    border-bottom: 1px solid var(--border);
}
html[data-theme="dark"] .navbar.is-light .navbar-item,
body[data-theme="dark"] .navbar.is-light .navbar-link {
    color: #e0e0e0;
    background-color: #1f1f1f;
}
html[data-theme="dark"] .navbar.is-light .navbar-item:hover,
body[data-theme="dark"] .navbar.is-light .navbar-link:hover {
    background-color: #2a2a2a;
    color: #ffffff;
}
/* Navbar dropdown caret arrow color in dark theme */
html[data-theme="dark"] .navbar.is-light .navbar-link::after,
body[data-theme="dark"] .navbar.is-light .navbar-link::after {
    border-color: #e0e0e0;
}
html[data-theme="dark"] .navbar.is-light .navbar-item.has-dropdown:hover .navbar-link::after,
body[data-theme="dark"] .navbar.is-light .navbar-item.has-dropdown:hover .navbar-link::after,
html[data-theme="dark"] .navbar.is-light .navbar-item.has-dropdown.is-active .navbar-link::after,
body[data-theme="dark"] .navbar.is-light .navbar-item.has-dropdown.is-active .navbar-link::after {
    border-color: #ffffff;
}
html[data-theme="dark"] .navbar-dropdown,
body[data-theme="dark"] .navbar-dropdown {
    background-color: var(--surface-elev);
    border-color: var(--border);
}
html[data-theme="dark"] .navbar-dropdown .navbar-item:hover,
body[data-theme="dark"] .navbar-dropdown .navbar-item:hover {
    background-color: #2a2a2a;
    color: #ffffff;
}

/* Mobile navbar menu and burger */
html[data-theme="dark"] .navbar-burger,
body[data-theme="dark"] .navbar-burger {
    color: #ffffff;
}
html[data-theme="dark"] .navbar-burger span,
body[data-theme="dark"] .navbar-burger span {
    background-color: #ffffff;
}
html[data-theme="dark"] .navbar-burger:hover,
body[data-theme="dark"] .navbar-burger:hover {
    background-color: var(--border);
}
html[data-theme="dark"] .navbar-menu,
body[data-theme="dark"] .navbar-menu,
html[data-theme="dark"] .navbar-menu.is-active,
body[data-theme="dark"] .navbar-menu.is-active {
    background-color: #1f1f1f !important;
}
html[data-theme="dark"] .navbar-menu .navbar-item,
body[data-theme="dark"] .navbar-menu .navbar-item,
html[data-theme="dark"] .navbar-menu .navbar-link,
body[data-theme="dark"] .navbar-menu .navbar-link {
    color: #e0e0e0;
}
html[data-theme="dark"] .navbar-menu .navbar-item:hover,
body[data-theme="dark"] .navbar-menu .navbar-item:hover,
html[data-theme="dark"] .navbar-menu .navbar-link:hover,
body[data-theme="dark"] .navbar-menu .navbar-link:hover {
    background-color: #2a2a2a;
    color: #ffffff;
}

/* Mobile layout: left align theme toggle, center profile */
@media screen and (max-width: 1023px) {
    .desktop-second {
        position: relative !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
    }
    .mobile-theme-toggle {
        position: absolute !important;
        left: 60px !important;
        z-index: 1002 !important; /* above dropdown */
    }
    /* Center profile dropdown trigger explicitly */
    #dropdown-menu {
        width: auto !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        position: relative !important;
        z-index: 1001 !important; /* below toggle */
    }
    #dropdown-menu .dropdown-trigger .image.is-64x64 {
        margin-right: 0 !important;
    }
}

/* Remove padding from .box */
.box {
    padding: 0 !important;
}

/* Generic containers and surfaces */
html[data-theme="dark"] .box,
body[data-theme="dark"] .card,
html[data-theme="dark"] .modal-card,
body[data-theme="dark"] .menu,
html[data-theme="dark"] .content,
body[data-theme="dark"] .panel,
html[data-theme="dark"] .message-body,
body[data-theme="dark"] .login-container {
    background-color: var(--surface) !important;
    color: var(--text) !important;
}

/* Ensure login container also responds when data-theme is on <html> */
html[data-theme="dark"] .login-container {
    background-color: #1e1e1e !important;
    color: #e0e0e0 !important;
}

/* Dropdowns in header custom CSS */
html[data-theme="dark"] .dropdown-menu,
body[data-theme="dark"] .dropdown-menu {
    background-color: var(--surface) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-lg) !important;
}
html[data-theme="dark"] .dropdown-item,
body[data-theme="dark"] .dropdown-item {
    color: #e0e0e0;
}
html[data-theme="dark"] .dropdown-item:hover,
body[data-theme="dark"] .dropdown-item:hover {
    background-color: #2a2a2a;
    color: #ffffff;
}

/* Dropdown focus state (avoid light focus background in dark theme) */
html[data-theme="dark"] .dropdown-item:focus,
body[data-theme="dark"] .dropdown-item:focus,
html[data-theme="dark"] .dropdown-item:focus-visible,
body[data-theme="dark"] .dropdown-item:focus-visible {
    background-color: #2a2a2a;
    color: #ffffff;
    outline: 2px solid #3273dc;
    outline-offset: -2px;
}

/* Tables */
html[data-theme="dark"] .table,
body[data-theme="dark"] .table {
    background-color: var(--surface);
    color: var(--text);
}
html[data-theme="dark"] .table td,
body[data-theme="dark"] .table th {
    border-color: var(--border);
}


/* Legacy alias: prefer .data-table on new pages */
.statistics-table {
    width: 100%;
    border-collapse: collapse;
}

/* Table striped rows in dark mode */
html[data-theme="dark"] .table.is-striped tbody tr:nth-child(even),
body[data-theme="dark"] .table.is-striped tbody tr:nth-child(even) {
    background-color: #2a2a2a !important;
    color: var(--text) !important;
}

html[data-theme="dark"] .table.is-striped tbody tr:nth-child(odd),
body[data-theme="dark"] .table.is-striped tbody tr:nth-child(odd) {
    background-color: var(--surface) !important;
    color: var(--text) !important;
}

/* Table hover states */
html[data-theme="dark"] .table.is-hoverable tbody tr:not(.is-selected):hover,
body[data-theme="dark"] .table.is-hoverable tbody tr:not(.is-selected):hover,
html[data-theme="dark"] .table tbody tr:hover,
body[data-theme="dark"] .table tbody tr:hover {
    background-color: #222;
}

/* -------------------------------------------------- */
/* Unified form controls — single source of truth.    */
/* Covers Bulma classes AND raw native elements so    */
/* that <select>, <textarea> and text-like <input>    */
/* fields all share the same look without per-page    */
/* overrides. Checkbox / radio / range / color / file */
/* are intentionally excluded.                        */
/* -------------------------------------------------- */
.input,
.textarea,
.select select,
select,
textarea,
input:not([type]),
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"],
input[type="week"] {
    background-color: var(--input-bg);
    color: var(--input-text);
    border: 1px solid var(--input-border);
    border-radius: var(--input-radius);
    transition: background-color 150ms ease-out, border-color 150ms ease-out;
}

.input:hover,
.textarea:hover,
.select select:hover,
select:hover,
textarea:hover,
input:not([type]):hover,
input[type="text"]:hover,
input[type="number"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="search"]:hover,
input[type="tel"]:hover,
input[type="url"]:hover,
input[type="date"]:hover,
input[type="time"]:hover,
input[type="datetime-local"]:hover,
input[type="month"]:hover,
input[type="week"]:hover {
    background-color: var(--input-bg-hover);
    border-color: var(--input-border);
}

.input:focus,
.textarea:focus,
.select select:focus,
select:focus,
textarea:focus,
input:not([type]):focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus,
input[type="month"]:focus,
input[type="week"]:focus {
    background-color: var(--input-bg-focus);
    border-color: var(--input-border-focus);
    outline: none;
}

.input:disabled,
.textarea:disabled,
.select select:disabled,
select:disabled,
textarea:disabled,
input:not([type]):disabled,
input[type="text"]:disabled,
input[type="number"]:disabled,
input[type="email"]:disabled,
input[type="password"]:disabled,
input[type="search"]:disabled,
input[type="tel"]:disabled,
input[type="url"]:disabled,
input[type="date"]:disabled,
input[type="time"]:disabled,
input[type="datetime-local"]:disabled,
input[type="month"]:disabled,
input[type="week"]:disabled {
    background-color: var(--input-bg-disabled);
    color: var(--input-text-disabled);
    -webkit-text-fill-color: var(--input-text-disabled);
    border-color: var(--input-border);
    cursor: not-allowed;
    opacity: 1;
}

.input:disabled::placeholder,
.textarea:disabled::placeholder,
textarea:disabled::placeholder,
input:disabled::placeholder {
    color: var(--input-text-disabled);
    opacity: 1;
}

.input::placeholder,
.textarea::placeholder,
textarea::placeholder,
input::placeholder {
    color: var(--muted);
}

/* App login (app_login.html): border/background live on .sh-v1-field, not the input */
.sh-v1-field .sh-v1-input,
.sh-v1-field .sh-v1-input:hover,
.sh-v1-field .sh-v1-input:focus,
.sh-v1-field .sh-v1-input:disabled {
    background-color: transparent;
    color: var(--text);
    border: 0;
    border-radius: 0;
    transition: none;
    -webkit-text-fill-color: currentColor;
}
.sh-v1-field .sh-v1-input:disabled {
    color: var(--muted);
    cursor: not-allowed;
    opacity: 1;
}

/* Hide Bulma's default arrow (blue indicator) — we render our own SVG */
.select::after {
    display: none !important;
}

/* Select: custom dropdown arrow rendered via background-image.
   Height + padding + font-size match Bulma's .input rhythm so that
   <select> tags without `.input`/`.select` wrapper still size identically. */
select,
select.input {
    position: relative;
    height: 2.5em;
    font-size: 1rem;
    line-height: 1.5;
    padding: calc(0.5em - 1px) 2.5em calc(0.5em - 1px) calc(0.75em - 1px);
    box-sizing: border-box;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234a4a4a' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75em center;
    background-size: 0.75em 0.75em;
}

/* Dark theme: only the arrow SVG color changes — bg/border/radius come from tokens */
html[data-theme="dark"] select,
html[data-theme="dark"] select.input,
body[data-theme="dark"] select,
body[data-theme="dark"] select.input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e0e0e0' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

/* Ensure form controls in settings cards never overflow their container */
.login-container .tile.is-parent {
    overflow: hidden;
}

.login-container .tile.is-parent.is-vertical,
.login-container .field {
    max-width: 100%;
}

.login-container .field .control,
.login-container .input,
.login-container .textarea,
.login-container select,
.login-container textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Controls in grouped headers (title + switch) should not be full width */
.login-container .field .control {
    width: auto;
    max-width: 100%;
}

.login-container .field .control.command-prefix-input.has-icons-left {
    width: 100%;
}

/* Prevent nested flex rows from pushing content outside */
.login-container .field[style*="display: flex"] > * {
    min-width: 0;
}

/* Buttons */
html[data-theme="dark"] .button,
body[data-theme="dark"] .button {
    color: #e0e0e0;
}
html[data-theme="dark"] .button.is-light,
body[data-theme="dark"] .button.is-white {
    background-color: #2a2a2a;
    color: #e0e0e0;
    border-color: #3a3a3a;
}

/* Buttons: default (no color variant) in dark theme */
html[data-theme="dark"] .button:not(.is-primary):not(.is-info):not(.is-success):not(.is-warning):not(.is-danger):not(.is-link):not(.is-light):not(.is-white):not(.is-black):not(.is-dark):not(.is-text):not(.custom-button),
body[data-theme="dark"] .button:not(.is-primary):not(.is-info):not(.is-success):not(.is-warning):not(.is-danger):not(.is-link):not(.is-light):not(.is-white):not(.is-black):not(.is-dark):not(.is-text):not(.custom-button) {
    background-color: #2a2a2a;
    border-color: #3a3a3a;
    color: #e0e0e0;
}

html[data-theme="dark"] .button:not(.is-primary):not(.is-info):not(.is-success):not(.is-warning):not(.is-danger):not(.is-link):not(.is-light):not(.is-white):not(.is-black):not(.is-dark):not(.is-text):not(.custom-button):not(:disabled):hover,
body[data-theme="dark"] .button:not(.is-primary):not(.is-info):not(.is-success):not(.is-warning):not(.is-danger):not(.is-link):not(.is-light):not(.is-white):not(.is-black):not(.is-dark):not(.is-text):not(.custom-button):not(:disabled):hover {
    background-color: #333333;
    border-color: #3a3a3a;
    color: #ffffff;
}

html[data-theme="dark"] .button:not(.is-primary):not(.is-info):not(.is-success):not(.is-warning):not(.is-danger):not(.is-link):not(.is-light):not(.is-white):not(.is-black):not(.is-dark):not(.is-text):not(.custom-button):active,
body[data-theme="dark"] .button:not(.is-primary):not(.is-info):not(.is-success):not(.is-warning):not(.is-danger):not(.is-link):not(.is-light):not(.is-white):not(.is-black):not(.is-dark):not(.is-text):not(.custom-button):active {
    background-color: #2a2a2a;
    border-color: #3a3a3a;
    color: #ffffff;
}

html[data-theme="dark"] .button:not(.is-primary):not(.is-info):not(.is-success):not(.is-warning):not(.is-danger):not(.is-link):not(.is-light):not(.is-white):not(.is-black):not(.is-dark):not(.is-text):not(.custom-button):focus,
body[data-theme="dark"] .button:not(.is-primary):not(.is-info):not(.is-success):not(.is-warning):not(.is-danger):not(.is-link):not(.is-light):not(.is-white):not(.is-black):not(.is-dark):not(.is-text):not(.custom-button):focus {
    box-shadow: 0 0 0 0.125em rgba(255, 255, 255, 0.08);
}


/* Buttons: success variant in light theme */
.save-button.is-success {
    background-color: #4CAF50;
    border-color: #4CAF50;
    color: #ffffff;
}

.save-button.is-success:not(:disabled):hover {
    background-color: #45a049;
    border-color: #45a049;
    color: #ffffff;
}

.save-button.is-success:active {
    background-color: #3abb67;
    border-color: #3abb67;
    color: #ffffff;
}

.save-button.is-success:focus {
    box-shadow: 0 0 0 0.125em rgba(72, 199, 116, 0.4);
}

/* Buttons: success variant in dark theme */
html[data-theme="dark"] .button.is-success,
body[data-theme="dark"] .button.is-success,
html[data-theme="dark"] .save-button.is-success,
body[data-theme="dark"] .save-button.is-success {
    background-color: #2d6a4f;
    border-color: #2d6a4f;
    color: #ffffff;
}

html[data-theme="dark"] .button.is-success:not(:disabled):hover,
body[data-theme="dark"] .button.is-success:not(:disabled):hover,
html[data-theme="dark"] .save-button.is-success:not(:disabled):hover,
body[data-theme="dark"] .save-button.is-success:not(:disabled):hover {
    background-color: #2f7d59;
    border-color: #2f7d59;
    color: #ffffff;
}

html[data-theme="dark"] .button.is-success:active,
body[data-theme="dark"] .button.is-success:active,
html[data-theme="dark"] .save-button.is-success:active,
body[data-theme="dark"] .save-button.is-success:active {
    background-color: #256148;
    border-color: #256148;
    color: #ffffff;
}

html[data-theme="dark"] .button.is-success:focus,
body[data-theme="dark"] .button.is-success:focus,
html[data-theme="dark"] .save-button.is-success:focus,
body[data-theme="dark"] .save-button.is-success:focus {
    box-shadow: 0 0 0 0.125em rgba(45, 106, 79, 0.4);
}

/* Buttons: info variant in dark theme */
html[data-theme="dark"] .button.is-info,
body[data-theme="dark"] .button.is-info,
html[data-theme="dark"] .save-button.is-info,
body[data-theme="dark"] .save-button.is-info {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
    color: #ffffff;
}

html[data-theme="dark"] .button.is-info:not(:disabled):hover,
body[data-theme="dark"] .button.is-info:not(:disabled):hover,
html[data-theme="dark"] .save-button.is-info:not(:disabled):hover,
body[data-theme="dark"] .save-button.is-info:not(:disabled):hover {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

html[data-theme="dark"] .button.is-info:active,
body[data-theme="dark"] .button.is-info:active,
html[data-theme="dark"] .save-button.is-info:active,
body[data-theme="dark"] .save-button.is-info:active {
    background-color: #1e40af;
    border-color: #1e40af;
    color: #ffffff;
}

html[data-theme="dark"] .button.is-info:focus,
body[data-theme="dark"] .button.is-info:focus,
html[data-theme="dark"] .save-button.is-info:focus,
body[data-theme="dark"] .save-button.is-info:focus {
    box-shadow: 0 0 0 0.125em rgba(29, 78, 216, 0.4);
}

/* Buttons: warning variant in dark theme */
html[data-theme="dark"] .button.is-warning,
body[data-theme="dark"] .button.is-warning,
html[data-theme="dark"] .save-button.is-warning,
body[data-theme="dark"] .save-button.is-warning {
    background-color: #8a6d1a;
    border-color: #8a6d1a;
    color: #ffffff;
}

html[data-theme="dark"] .button.is-warning:not(:disabled):hover,
body[data-theme="dark"] .button.is-warning:not(:disabled):hover,
html[data-theme="dark"] .save-button.is-warning:not(:disabled):hover,
body[data-theme="dark"] .save-button.is-warning:not(:disabled):hover {
    background-color: #9a7b1d;
    border-color: #9a7b1d;
    color: #ffffff;
}

html[data-theme="dark"] .button.is-warning:active,
body[data-theme="dark"] .button.is-warning:active,
html[data-theme="dark"] .save-button.is-warning:active,
body[data-theme="dark"] .save-button.is-warning:active {
    background-color: #6f5314;
    border-color: #6f5314;
    color: #ffffff;
}

html[data-theme="dark"] .button.is-warning:focus,
body[data-theme="dark"] .button.is-warning:focus,
html[data-theme="dark"] .save-button.is-warning:focus,
body[data-theme="dark"] .save-button.is-warning:focus {
    box-shadow: 0 0 0 0.125em rgba(138, 109, 26, 0.4);
}

/* Buttons: danger variant in light theme */
.save-button.is-danger {
    background-color: #f14668;
    border-color: #f14668;
    color: #ffffff;
}

.save-button.is-danger:not(:disabled):hover {
    background-color: #ee2e52;
    border-color: #ee2e52;
    color: #ffffff;
}

.save-button.is-danger:active {
    background-color: #ed1c3d;
    border-color: #ed1c3d;
    color: #ffffff;
}

.save-button.is-danger:focus {
    box-shadow: 0 0 0 0.125em rgba(241, 70, 104, 0.4);
}

/* Buttons: danger variant in dark theme */
html[data-theme="dark"] .button.is-danger,
body[data-theme="dark"] .button.is-danger,
html[data-theme="dark"] .save-button.is-danger,
body[data-theme="dark"] .save-button.is-danger {
    background-color: #b91c1c;
    border-color: #b91c1c;
    color: #ffffff;
}

html[data-theme="dark"] .button.is-danger:not(:disabled):hover,
body[data-theme="dark"] .button.is-danger:not(:disabled):hover,
html[data-theme="dark"] .save-button.is-danger:not(:disabled):hover,
body[data-theme="dark"] .save-button.is-danger:not(:disabled):hover {
    background-color: #c81e1e;
    border-color: #c81e1e;
    color: #ffffff;
}

html[data-theme="dark"] .button.is-danger:active,
body[data-theme="dark"] .button.is-danger:active,
html[data-theme="dark"] .save-button.is-danger:active,
body[data-theme="dark"] .save-button.is-danger:active {
    background-color: #991b1b;
    border-color: #991b1b;
    color: #ffffff;
}

html[data-theme="dark"] .button.is-danger:focus,
body[data-theme="dark"] .button.is-danger:focus,
html[data-theme="dark"] .save-button.is-danger:focus,
body[data-theme="dark"] .save-button.is-danger:focus {
    box-shadow: 0 0 0 0.125em rgba(185, 28, 28, 0.4);
}

/* Buttons: primary variant in dark theme */
html[data-theme="dark"] .button.is-primary,
body[data-theme="dark"] .button.is-primary,
html[data-theme="dark"] .save-button.is-primary,
body[data-theme="dark"] .save-button.is-primary {
    background-color: #4f46e5;
    border-color: #4f46e5;
    color: #ffffff;
}

html[data-theme="dark"] .button.is-primary:not(:disabled):hover,
body[data-theme="dark"] .button.is-primary:not(:disabled):hover,
html[data-theme="dark"] .save-button.is-primary:not(:disabled):hover,
body[data-theme="dark"] .save-button.is-primary:not(:disabled):hover {
    background-color: #4338ca;
    border-color: #4338ca;
    color: #ffffff;
}

html[data-theme="dark"] .button.is-primary:active,
body[data-theme="dark"] .button.is-primary:active,
html[data-theme="dark"] .save-button.is-primary:active,
body[data-theme="dark"] .save-button.is-primary:active {
    background-color: #3730a3;
    border-color: #3730a3;
    color: #ffffff;
}

html[data-theme="dark"] .button.is-primary:focus,
body[data-theme="dark"] .button.is-primary:focus,
html[data-theme="dark"] .save-button.is-primary:focus,
body[data-theme="dark"] .save-button.is-primary:focus {
    box-shadow: 0 0 0 0.125em rgba(79, 70, 229, 0.4);
}

/* Tags: info variant in dark theme */
html[data-theme="dark"] .tag.is-info,
body[data-theme="dark"] .tag.is-info {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
    color: #ffffff;
}

/* Notifications: match button variants in dark theme */
html[data-theme="dark"] .notification.is-success,
body[data-theme="dark"] .notification.is-success {
    background-color: #2d6a4f;
    border-color: #2d6a4f;
    color: #ffffff;
}

html[data-theme="dark"] .notification.is-warning,
body[data-theme="dark"] .notification.is-warning {
    background-color: #8a6d1a;
    border-color: #8a6d1a;
    color: #ffffff;
}

html[data-theme="dark"] .notification.is-danger,
body[data-theme="dark"] .notification.is-danger {
    background-color: #b91c1c;
    border-color: #b91c1c;
    color: #ffffff;
}

/* Help/Hint message dark styles */
html[data-theme="dark"] .message.is-info .message-header,
body[data-theme="dark"] .message.is-info .message-header {
    background-color: #1e3a8a !important; /* deeper blue for header */
    color: #ffffff !important;
    border-color: #1e3a8a !important;
}
html[data-theme="dark"] .message.is-info .message-body,
body[data-theme="dark"] .message.is-info .message-body {
    background-color: #162033 !important; /* very dark blue for body */
    color: #d6e4ff !important;
    border-color: #1e3a8a !important;
}
html[data-theme="dark"] .message.is-info code,
body[data-theme="dark"] .message.is-info code {
    background: rgba(255,255,255,0.06);
    color: #e8f0ff;
}

/* Dividers */
html[data-theme="dark"] hr,
body[data-theme="dark"] .navbar-divider,
html[data-theme="dark"] .dropdown-divider {
    background-color: #2a2a2a;
}

/* Footer */
html[data-theme="dark"] .footer,
body[data-theme="dark"] .footer {
    background-color: #1f1f1f;
    color: #e0e0e0;
    border-top: 1px solid #2a2a2a;
}
html[data-theme="dark"] .footer a,
body[data-theme="dark"] .footer a {
    color: #9ec3ff;
}
html[data-theme="dark"] .footer a:hover,
body[data-theme="dark"] .footer a:hover {
    color: #c6ddff;
}

/* Override Bulma light semantic backgrounds in dark theme */
html[data-theme="dark"] .has-background-danger-light,
body[data-theme="dark"] .has-background-danger-light {
    background-color: #3a1f25 !important; /* dark muted red */
}

html[data-theme="dark"] .has-background-danger-light strong,
body[data-theme="dark"] .has-background-danger-light strong {
    color: #ffffff !important;
}

html[data-theme="dark"] .has-background-success-light,
body[data-theme="dark"] .has-background-success-light {
    background-color: #1f3a2a !important; /* dark muted green */
}

html[data-theme="dark"] .has-background-success-light strong,
body[data-theme="dark"] .has-background-success-light strong {
    color: #ffffff !important;
}

/* Modals */
html[data-theme="dark"] .modal-card,
body[data-theme="dark"] .modal-card,
html[data-theme="dark"] .modal-content,
body[data-theme="dark"] .modal-content {
    background-color: #1e1e1e !important;
    color: #e0e0e0 !important;
}
html[data-theme="dark"] .modal-card-head,
body[data-theme="dark"] .modal-card-head,
html[data-theme="dark"] .modal-card-foot,
body[data-theme="dark"] .modal-card-foot {
    background-color: #1f1f1f !important;
    border-color: #2a2a2a !important;
}
html[data-theme="dark"] .modal-card-title,
body[data-theme="dark"] .modal-card-title {
    color: #e0e0e0 !important;
}
html[data-theme="dark"] .modal-card-body,
body[data-theme="dark"] .modal-card-body {
    background-color: #1e1e1e !important;
}
html[data-theme="dark"] .modal-content .box,
body[data-theme="dark"] .modal-content .box {
    background-color: #1e1e1e !important;
    color: #e0e0e0 !important;
}

/* Sticky save container */
html[data-theme="dark"] .sticky-save-container,
body[data-theme="dark"] .sticky-save-container {
    background-color: #1e1e1e !important;
    color: #e0e0e0 !important;
    border: 1px solid #2a2a2a;
}

/* Username text in profile dropdown */
#copyLabel {
    color: #363636; /* Bulma's default text color for light theme */
}
html[data-theme="dark"] #copyLabel,
body[data-theme="dark"] #copyLabel {
    color: #e0e0e0;
}

/* Header profile dropdown (ensure dark background in content area) */
html[data-theme="dark"] .dropdown-content,
body[data-theme="dark"] .dropdown-content {
    background-color: #1e1e1e !important;
    border: 1px solid #2a2a2a !important;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4) !important;
}

/* Navbar parent items with children: dark hover */
html[data-theme="dark"] .navbar.is-light .navbar-item.has-dropdown:hover .navbar-link,
body[data-theme="dark"] .navbar.is-light .navbar-item.has-dropdown:hover .navbar-link,
html[data-theme="dark"] .navbar.is-light .navbar-item.has-dropdown.is-active .navbar-link,
body[data-theme="dark"] .navbar.is-light .navbar-item.has-dropdown.is-active .navbar-link,
html[data-theme="dark"] .navbar.is-light .navbar-link:focus,
body[data-theme="dark"] .navbar.is-light .navbar-link:focus,
html[data-theme="dark"] .navbar.is-light .navbar-link:focus-within,
body[data-theme="dark"] .navbar.is-light .navbar-link:focus-within {
    background-color: #2a2a2a !important;
    color: #ffffff !important;
}

/* Recorder (moderation) - dark theme */
html[data-theme="dark"] .recorder-card,
body[data-theme="dark"] .recorder-card {
    background-color: #1f1f1f !important;
    border-color: #2a2a2a !important;
    color: #e0e0e0 !important;
}

html[data-theme="dark"] .recorder-header,
body[data-theme="dark"] .recorder-header {
    color: #e0e0e0;
}

html[data-theme="dark"] .rec-status,
body[data-theme="dark"] .rec-status,
html[data-theme="dark"] .rec-timer,
body[data-theme="dark"] .rec-timer {
    color: #e0e0e0;
}

html[data-theme="dark"] .rec-dot,
body[data-theme="dark"] .rec-dot {
    background-color: #555; /* idle dot color in dark */
}

html[data-theme="dark"] .vu-meter,
body[data-theme="dark"] .vu-meter {
    background-color: #2a2a2a;
}

html[data-theme="dark"] .vu-fill,
body[data-theme="dark"] .vu-fill {
    background: linear-gradient(90deg, #22c55e, #ef4444);
}

/* Media sender (moderation) - dark theme */
html[data-theme="dark"] .media-card,
body[data-theme="dark"] .media-card {
    background-color: #1f1f1f !important;
    border-color: #2a2a2a !important;
    color: #e0e0e0 !important;
}
/* Match .sound-dropzone (dialogs.css); avoid !important so :hover / .is-dragover can override */
html[data-theme="dark"] .media-preview,
body[data-theme="dark"] .media-preview {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--border);
}
html[data-theme="dark"] .media-preview .placeholder,
body[data-theme="dark"] .media-preview .placeholder {
    color: #a0a0a0 !important;
}

/* ========================================== */
/* Skeleton Loading System                    */
/* ========================================== */

/* Base skeleton class with unified shimmer animation */
.skeleton {
    position: relative;
    overflow: hidden;
    background-color: #eee;
    border-radius: 4px;
}

.skeleton::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    height: 100%;
    width: 150%;
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.6), rgba(255,255,255,0));
    animation: skeleton-shimmer 1.2s infinite;
}

@keyframes skeleton-shimmer {
    100% { left: 150%; }
}

/* Skeleton variants */
.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-input {
    height: 2.5rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.skeleton-button {
    height: 2.5rem;
    border-radius: 4px;
    margin-top: 1rem;
}

.skeleton-tag {
    height: 1.5rem;
    width: 4rem;
    border-radius: 1rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    display: inline-block;
}

.skeleton-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-bottom: 1px solid #ddd;
}

.skeleton-line {
    height: 12px;
    margin-top: 8px;
    border-radius: 6px;
}

/* Width modifiers */
.skeleton-short {
    width: 60%;
}

.skeleton-medium {
    width: 80%;
}

.skeleton-long {
    width: 100%;
}

/* Loading skeleton - dark theme */
html[data-theme="dark"] .skeleton,
body[data-theme="dark"] .skeleton {
    background-color: #2a2a2a !important;
}

html[data-theme="dark"] .skeleton::after,
body[data-theme="dark"] .skeleton::after {
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.08), rgba(255,255,255,0)) !important;
}

html[data-theme="dark"] .skeleton-thumb,
body[data-theme="dark"] .skeleton-thumb {
    border-bottom: 1px solid #2f2f2f !important;
}

/* Config reset dialog - dark theme */
html[data-theme="dark"] #resetConfirmDialog,
body[data-theme="dark"] #resetConfirmDialog {
    background-color: rgba(0, 0, 0, 0.7) !important;
}

html[data-theme="dark"] #resetConfirmDialog > div,
body[data-theme="dark"] #resetConfirmDialog > div {
    background-color: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-lg) !important;
}

html[data-theme="dark"] #resetConfirmDialog h3,
body[data-theme="dark"] #resetConfirmDialog h3 {
    color: #ff6b6b !important;
}

html[data-theme="dark"] #resetConfirmDialog p,
body[data-theme="dark"] #resetConfirmDialog p {
    color: var(--text) !important;
}

html[data-theme="dark"] #confirmReset,
body[data-theme="dark"] #confirmReset {
    background-color: #dc3545 !important;
    color: white !important;
    border: none !important;
}

html[data-theme="dark"] #confirmReset:hover,
body[data-theme="dark"] #confirmReset:hover {
    background-color: #c82333 !important;
}

html[data-theme="dark"] #cancelReset,
body[data-theme="dark"] #cancelReset {
    background-color: #6c757d !important;
    color: white !important;
    border: none !important;
}

html[data-theme="dark"] #cancelReset:hover,
body[data-theme="dark"] #cancelReset:hover {
    background-color: #5a6268 !important;
}

/* ============================================ */
/* Toast Notification System                    */
/* ============================================ */
#toast-container {
    position: fixed !important;
    top: 1rem;
    right: 1rem;
    z-index: 99999 !important;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 400px;
    width: calc(100vw - 2rem);
}

/* Ensure toasts are always above modals and modal backgrounds */
body > #toast-container {
    z-index: 99999 !important;
}

#toast-container .notification {
    transition: opacity 0.3s ease, transform 0.3s ease;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease;
    z-index: inherit;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

#toast-container .notification.fade-out {
    opacity: 0;
    transform: translateX(100%);
}

/* Toast Close Button */
#toast-container .notification .toast-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 1;
    cursor: pointer;
}

#toast-container .notification .toast-close:hover {
    opacity: 0.8;
}

/* Toast Progress Bar */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background-color: rgba(0, 0, 0, 0.1);
    width: 100%;
    overflow: hidden;
}

.toast-progress-bar {
    height: 100%;
    background-color: currentColor;
    animation: toastProgress 3s linear forwards;
}

@keyframes toastProgress {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* Responsive Toast Container */
@media (max-width: 768px) {
    #toast-container {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }
}

/* ============================================ */
/* Overlay Appearance Box (Browser Source UI)   */
/* ============================================ */
.overlay-appearance-box {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.overlay-appearance-box:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
    transform: translateY(-2px);
}

html[data-theme="dark"] .overlay-appearance-box,
body[data-theme="dark"] .overlay-appearance-box {
    background: #2a2a2a;
    border-color: #4a4a4a;
}

html[data-theme="dark"] .overlay-appearance-box:hover,
body[data-theme="dark"] .overlay-appearance-box:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

/* Maxlength character counters (maxlengthCounter.js) */
.sh-char-counter {
    font-size: 0.75rem;
    line-height: 1.3;
    text-align: right;
    margin-top: 0.25rem;
    color: var(--muted, #6b7280);
    user-select: none;
}

.sh-char-counter.is-warning {
    color: #b45309;
}

.sh-char-counter.is-danger {
    color: #dc2626;
}

html[data-theme="dark"] .sh-char-counter,
[data-theme="dark"] .sh-char-counter {
    color: var(--muted, #9ca3af);
}

html[data-theme="dark"] .sh-char-counter.is-warning,
[data-theme="dark"] .sh-char-counter.is-warning {
    color: #fbbf24;
}

html[data-theme="dark"] .sh-char-counter.is-danger,
[data-theme="dark"] .sh-char-counter.is-danger {
    color: #f87171;
}

/* AI sparkles: static/images/sparkle--fill.svg via mask so color follows currentColor */
.sh-ai-sparkles-icon {
    display: block;
    flex-shrink: 0;
    width: 1em;
    height: 1em;
    background-color: currentColor;
    -webkit-mask-image: url("/images/sparkle--fill-91225505365e65c1572d06089a15e2a1.svg");
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    mask-image: url("/images/sparkle--fill-91225505365e65c1572d06089a15e2a1.svg");
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
}

.icon .sh-ai-sparkles-icon,
.icon.is-small .sh-ai-sparkles-icon {
    width: 100%;
    height: 100%;
}

.dialog-icon-badge .sh-ai-sparkles-icon {
    width: 1.125rem;
    height: 1.125rem;
}

.qm-btn .sh-ai-sparkles-icon {
    width: 0.95em;
    height: 0.95em;
}

.qm-ai-icon .sh-ai-sparkles-icon {
    width: 1rem;
    height: 1rem;
}

/* -------------------------------------------------- */
/* Editorial table system                             */
/* -------------------------------------------------- */
:root {
    --accent: var(--link);
    --accent-soft: rgba(37, 99, 235, 0.08);
    --accent-soft-strong: rgba(37, 99, 235, 0.16);
    --hairline: rgba(0, 0, 0, 0.08);
    --hairline-strong: rgba(0, 0, 0, 0.14);
    --row-hover: rgba(37, 99, 235, 0.04);
    --eyebrow: var(--muted);
}

html[data-theme="dark"],
body[data-theme="dark"] {
    --accent: #6ea8ff;
    --accent-soft: rgba(110, 168, 255, 0.12);
    --accent-soft-strong: rgba(110, 168, 255, 0.22);
    --hairline: rgba(255, 255, 255, 0.08);
    --hairline-strong: rgba(255, 255, 255, 0.16);
    --row-hover: rgba(110, 168, 255, 0.06);
}

.page-stack {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Master control card (legacy stat-card pattern) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.25rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
    transform: translateY(-2px);
}

.stat-card.master-card {
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    border: 2px solid #667eea;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.15);
    position: relative;
    grid-column: 1 / -1;
}

.stat-card.master-card::before {
    content: attr(data-master-label);
    position: absolute;
    top: -10px;
    left: 1rem;
    background: #667eea;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.stat-card.master-card--badge-span::before {
    content: none;
}

.stat-card.master-card .master-control-badge {
    position: absolute;
    top: -10px;
    left: 1rem;
    background: #667eea;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.stat-card.master-card:hover {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.25);
    border-color: #5568d3;
}

.stat-card.master-card .stat-card-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
}

.stat-card.master-card .stat-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #363636;
}

.master-description {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.5rem;
    margin-bottom: 0;
    line-height: 1.5;
}

.stat-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    color: #667eea;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-card-title {
    font-weight: 600;
    color: #363636;
    font-size: 1rem;
    margin: 0;
    flex: 1;
}

.stat-card-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stat-card.full-width > .field:not(.is-grouped) {
    margin-bottom: 0.125rem;
}

.stat-card.full-width > .field.is-grouped {
    margin-bottom: 1rem;
}

.stat-card.master-card .stat-card-header {
    justify-content: space-between;
    margin-bottom: 0;
}

.stat-card.master-card .stat-card-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.stat-card-header-actions .count-badge,
.count-badge {
    display: inline-flex;
    align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: 2.5em;
  min-height: 2.5em;
  padding: 0 0.875rem;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
    color: var(--muted);
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid var(--border);
  border-radius: var(--input-radius, 8px);
    white-space: nowrap;
}

.field.is-grouped .control .count-badge {
  align-self: stretch;
}

html[data-theme="dark"] .stat-card-header-actions .count-badge,
body[data-theme="dark"] .stat-card-header-actions .count-badge,
html[data-theme="dark"] .count-badge,
body[data-theme="dark"] .count-badge {
    background: rgba(148, 163, 184, 0.15);
    color: var(--muted);
    border-color: var(--border);
}

.stat-card.full-width {
    grid-column: 1 / -1;
}

.stats-grid > .data-card {
    grid-column: 1 / -1;
}

html[data-theme="dark"] .stat-card,
body[data-theme="dark"] .stat-card {
    background: #2a2a2a;
    border-color: #4a4a4a;
}

html[data-theme="dark"] .stat-card:hover,
body[data-theme="dark"] .stat-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

html[data-theme="dark"] .master-description,
body[data-theme="dark"] .master-description {
    color: #9ca3af;
}

html[data-theme="dark"] .stat-card.master-card,
body[data-theme="dark"] .stat-card.master-card {
    background: linear-gradient(135deg, #2a2a3a 0%, #2a2a2a 100%);
    border-color: #5a8fff;
}

html[data-theme="dark"] .stat-card.master-card::before,
body[data-theme="dark"] .stat-card.master-card::before,
html[data-theme="dark"] .stat-card.master-card .master-control-badge,
body[data-theme="dark"] .stat-card.master-card .master-control-badge {
    background: #5a8fff;
}

html[data-theme="dark"] .stat-card.master-card .stat-card-icon,
body[data-theme="dark"] .stat-card.master-card .stat-card-icon {
    background: linear-gradient(135deg, #5a8fff 0%, #764ba2 100%);
}

html[data-theme="dark"] .stat-card.master-card .stat-card-title,
body[data-theme="dark"] .stat-card.master-card .stat-card-title {
    color: #e0e0e0;
}

html[data-theme="dark"] .stat-card-icon,
body[data-theme="dark"] .stat-card-icon {
    background: #3a3a3a;
    color: #5a8fff;
}

html[data-theme="dark"] .stat-card-title,
body[data-theme="dark"] .stat-card-title {
    color: #e0e0e0;
}

.page-master {
    background: var(--surface);
    border: 1px solid var(--hairline-strong);
    border-radius: 12px;
    padding: 1.5rem 1.5rem 1.25rem;
    box-shadow: 0 1px 0 var(--hairline);
}

.page-master__eyebrow {
    display: block;
    margin: 0 0 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--eyebrow);
}

.page-master__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-master__title-block {
    flex: 1;
    min-width: 12rem;
}

.page-master__title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
}

.page-master__description {
    margin: 0.35rem 0 0;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--muted);
}

.page-master__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.page-master__footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--hairline);
}

.page-master__search {
    max-width: 24rem;
}

.page-master__search .input {
    border-color: var(--hairline-strong);
    background: var(--input-bg);
}

.page-master__search .input:focus {
    border-color: var(--input-border-focus);
    box-shadow: 0 0 0 0.125em color-mix(in srgb, var(--input-border-focus) 20%, transparent);
}

.eyebrow {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--eyebrow);
}

.data-card {
    background: var(--surface);
    border: 1px solid var(--hairline-strong);
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 1px 0 var(--hairline);
    overflow: hidden;
}

.data-card__header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--hairline);
}

.data-card__eyebrow {
    display: block;
    margin-bottom: 0.35rem;
}

.data-card__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.data-card__body {
    padding: 0;
}

.data-card__body .table-container {
    overflow-x: auto;
}

.page-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 768px) {
    .page-settings-grid {
        grid-template-columns: 1fr;
    }
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    color: var(--text);
}

.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 0.65rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: left;
    color: var(--muted);
    background: var(--surface-elev);
    border-bottom: 1px solid var(--hairline-strong);
    box-shadow: inset 0 -1px 0 var(--accent);
}

.data-table thead th.actions-cell {
    text-align: right;
}

.data-table tbody td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--hairline);
    vertical-align: middle;
}

/* Inline table fields: same box height as Bulma .input (2.5rem), full cell width */
.data-table tbody td > .input {
    width: 100%;
    box-sizing: border-box;
    display: block;
    height: 2.5rem;
    min-height: 2.5rem;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: var(--row-hover);
}

.data-table td.is-numeric,
.data-table td.is-mono {
    font-variant-numeric: tabular-nums;
}

.data-table td.is-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.875rem;
}

.data-table .actions-cell {
    white-space: nowrap;
    width: 1%;
    text-align: right;
}

.data-table .row-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    justify-content: flex-end;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
    background: var(--accent-soft);
    color: var(--text);
}

.icon-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.icon-btn--danger:hover {
    background: rgba(241, 70, 104, 0.12);
    color: #e63950;
}

html[data-theme="dark"] .icon-btn--danger:hover,
body[data-theme="dark"] .icon-btn--danger:hover {
    background: rgba(241, 70, 104, 0.18);
    color: #f87171;
}

.btn-primary-accent {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--accent);
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-primary-accent:hover {
    background: var(--link-hover);
    border-color: var(--link-hover);
    color: #fff;
}

.btn-primary-accent:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.url-cell {
    max-width: 250px;
}

.url-cell-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-width: 0;
}

.url-text,
.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.copy-affordance,
.url-copy-icon {
    opacity: 0.55;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
    color: var(--muted);
    transition: opacity 0.15s ease, color 0.15s ease;
}

.copy-affordance:hover,
.url-copy-icon:hover {
    opacity: 1;
    color: var(--accent);
}

.data-table thead th.is-center,
.data-table td.enabledCheckbox,
.data-table td.showInAppCheckbox {
    text-align: center;
    vertical-align: middle;
}

.enabledCheckbox,
.showInAppCheckbox {
    width: 1%;
    white-space: nowrap;
}

.enabledCheckbox .audio-source-state-icon,
.showInAppCheckbox .audio-source-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
}

.audio-source-state-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.audio-source-state-icon--on,
.state-on {
    color: #16a34a;
}

.audio-source-state-icon--off,
.state-off {
    color: var(--muted);
}

html[data-theme="dark"] .audio-source-state-icon--on,
body[data-theme="dark"] .audio-source-state-icon--on {
    color: #5ce08a;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

.skeleton-loader {
    display: block;
}

.table-content {
    display: none;
}

.table-content.loaded {
    display: block;
}

#scrollToTopBtn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2147483647;
    border-radius: 50%;
    width: 3rem;
    height: 3rem;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    border: 1px solid var(--hairline-strong);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
}

#scrollToTopBtn.show {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

#scrollToTopBtn:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

@media (max-width: 768px) {
    #scrollToTopBtn {
        bottom: 1rem;
        right: 1rem;
        width: 2.5rem;
        height: 2.5rem;
    }
}

html[data-theme="dark"] .page-master,
body[data-theme="dark"] .page-master,
html[data-theme="dark"] .data-card,
body[data-theme="dark"] .data-card {
    background: var(--surface);
    border-color: var(--hairline-strong);
}

html[data-theme="dark"] .data-table thead th,
body[data-theme="dark"] .data-table thead th {
    background: var(--surface-elev);
    color: var(--muted);
}

html[data-theme="dark"] #scrollToTopBtn,
body[data-theme="dark"] #scrollToTopBtn {
    background: var(--surface);
    border-color: var(--hairline-strong);
    color: var(--text);
}

/* ================================================
   AFFILIATE-ONLY GATING — corner ribbon (Eck-Banderole)
   ================================================ */

/* Transparent click blocker for compact gated cards (keeps card visible,
   ribbon communicates the restriction). */
.affiliate-only-blocker {
    position: absolute;
    inset: 0;
    z-index: 10;
    border-radius: inherit;
    cursor: not-allowed;
}

/* Clip a gated card so the corner ribbon follows its rounded corner.
   Applied only while gated, to avoid clipping dropdowns for allowed users. */
.is-affiliate-clipped {
    overflow: hidden;
}

/* The diagonal sash itself. */
.corner-ribbon {
    position: absolute;
    top: 0;
    right: 0;
    width: 150px;
    height: 150px;
    overflow: hidden;
    pointer-events: none;
    z-index: 12;
}

.corner-ribbon span {
    position: absolute;
    top: 38px;
    right: -45px;
    display: block;
    width: 200px;
    padding: 6px 0;
    background: #9146ff;
    color: #ffffff;
    text-align: center;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    line-height: 1.1;
    text-transform: uppercase;
    transform: rotate(45deg);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
