* {
    box-sizing: border-box;
}

:root {
    /* Tells the browser how to render its OWN native form controls â€”
       scrollbars, the un-stylable "no file chosen" text portion of a
       file input, native date-picker popups, etc. â€” so they match the
       app's actual theme instead of falling back to the browser's own
       default assumptions. Without this, a native control can end up
       combining a dark background with dark (browser-default) text,
       or similar illegible mismatches, even though every CSS-driven
       part of the same page is themed correctly. */
    color-scheme: light;
    --charcoal: #1A1A1A;
    --primary: #5F8F35; /* green — renamed from --orange/--amber (both were this exact color; merged into one variable) */
    --accent: #29B6F6; /* cyan — renamed from --green; primary structural accent (borders, links) */
    --card: #FFFFFF;
    --stripe: #F0F4FA; /* faint blue-tinted stripe instead of neutral gray */
    --error: #C0392B;
    --border: #A3B4C7; /* faint blue-tinted border instead of neutral gray */
    --indigo: #5C4EE5;
    --rose: #E0607A; /* warm accent, distinct from every tier-pill color — used for the avatar edit badge */
    --muted: #8a8a8a; /* Basic-tier pill color and other deliberately-neutral spots */
    --success: #2e8b57;
    /* Used for the create/add-new row on every curation-style
       page. Same color-mix expression as before in light mode
       -- this is purely a refactor there -- but dark mode gets a
       distinctly stronger mix below, since 8% green against a
       near-black card reads as too dark/muddy to notice as a
       distinct row. */
    --create-row-bg: color-mix(in srgb, var(--primary) 8%, var(--card));
    /* Section-group header backgrounds (My Collection's detail page) -
       same reasoning as --create-row-bg just above: a light green mix
       that reads fine against the white light-mode card would go too
       dark/muddy against dark mode's near-black one, so dark mode gets
       a distinctly stronger mix below, not the same percentage. */
    --group-header-bg: color-mix(in srgb, var(--primary) 15%, var(--card));
    --activity-blue: #0033CC; /* kept on purpose, unlike --primary elsewhere — see dark-mode override below for why it needs one here specifically */
}

/* Dark mode — mechanism-first pass. Toggled via the [data-theme]
   attribute on <html>, set synchronously before paint by a boot-time
   script (see theme.js) to avoid a flash of the wrong theme. Accent
   colors (primary/accent/indigo/rose/error) are left unchanged for now
   — a deliberate choice, not an oversight — saturated colors tuned for
   a white background often look muddy on dark ones, and that tuning is
   exactly the page-by-page styling pass planned as a separate follow-up,
   not part of this mechanism-first pass. Only background/text/border/
   stripe are inverted here, since those are what's needed for the site
   to be legible and functional in dark mode at all.
*/
[data-theme="dark"] {
    color-scheme: dark;
    --create-row-bg: color-mix(in srgb, var(--primary) 20%, var(--card));
    --group-header-bg: color-mix(in srgb, var(--primary) 35%, var(--card));
    --charcoal: #E8E8E8;
    --card: #1A1A1A;
    --stripe: #262626;
    --border: #3A3A3A;
    --muted: #A8A8A8; /* lighter than the light-mode value — mid-gray reads too dim against a near-black background */
    --activity-blue: #5B9BFF; /* the light-mode blue (#0033CC) is too dark to read against a dark card background — lightened here, same hue */
}

.theme-toggle-pill {
    width: 52px;
    height: 26px;
    border-radius: 999px;
    background: #E4E7EC;
    border: 1px solid #C4CAD4;
    position: relative;
    cursor: pointer;
    padding: 2px;
    display: inline-flex;
    align-items: center;
}

.theme-toggle-pill.is-dark {
    background: #2B2D33;
    border-color: #40434B;
}

.theme-toggle-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #FFFFFF;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2B2D33;
    transition: transform 0.2s ease;
}

.theme-toggle-pill.is-dark .theme-toggle-thumb {
    background: #3A3D45;
    color: #FFFFFF;
    transform: translateX(26px);
}

body {
    background: var(--card);
    font-family: 'IBM Plex Sans', sans-serif;
    color: var(--charcoal);
    margin: 0;
}

h1, h2, h3 {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 700;
    color: var(--charcoal);
}

/* StatusMessage.razor's error state â€” used on Login and other Identity
   pages (Register, Forgot Password, etc.) */
.alert-danger {
    color: var(--error);
    font-weight: 700;
    margin-bottom: 1.25rem;
}

/* FocusOnNavigate (see Routes.razor) moves keyboard focus to the page's
   h1 after every navigation, for accessibility â€” this softens the
   browser's default stark black outline into something less jarring,
   without removing the underlying focus behavior itself. */
h1:focus {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 40%, transparent);
    border-radius: 4px;
}

/* Top nav */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    background: var(--card);
}

.site-title {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--charcoal);
    display: flex;
    align-items: center;
}

/* The logo is taller than the old text title but takes no more room: the negative margins let it reach into the
   header's own padding, so the header keeps its height. */
.site-logo {
    display: block;
    height: 52px;
    width: auto;
    margin: -8px 0;
}

.site-logo-dark { display: none; }
[data-theme="dark"] .site-logo-light { display: none; }
[data-theme="dark"] .site-logo-dark { display: block; }

.site-browse-and-search {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.site-browse-links {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.site-global-search {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 14px;
}

    .site-nav a {
        color: var(--charcoal);
        text-decoration: none;
        font-weight: 500;
    }

        .site-nav a:hover {
            color: var(--accent);
        }

/* Pill buttons — replaces the old sharp-edged btn-specimen entirely */
.btn-pill {
    display: inline-block;
    border: none;
    border-radius: 999px;
    padding: 0.6rem 1.6rem;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}

.btn-pill-accent {
    background: var(--accent);
    color: white;
}

    .btn-pill-accent:hover {
        background: #1a9fd8; /* darker cyan, same shade already used for .nav-link-button:hover */
    }

.btn-pill-outline {
    background: transparent;
    color: var(--charcoal);
    border: 1px solid var(--border);
}

/* A disabled pill button has to LOOK disabled. The outline pill sets its own text colour, which hides the browser's
   usual greyed-out look, so a disabled button (Clear, Up/Down at the end of a list, Previous/Next) looked exactly
   like a working one. */
.btn-pill:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

    .btn-pill-outline:hover {
        border-color: var(--accent);
        color: var(--accent);
    }

.nav-link-button {
    display: inline-block;
    background: var(--accent);
    border: none;
    border-radius: 999px;
    padding: 0.5rem 1.3rem;
    color: white !important;
    text-decoration: none;
    font-weight: 700 !important;
    font-size: 13px;
    cursor: pointer;
}

    .nav-link-button:hover {
        background: #1a9fd8;
        color: white !important;
    }

/* Form fields, restyled to match — rounded, quiet border */
.field-group {
    margin-bottom: 1.1rem;
    text-align: left;
}

.field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--charcoal);
    margin-bottom: 0.35rem;
}

/* Overrides the browser's default visited-link purple, which reads
   fine in light mode but is nearly illegible against a dark
   background â€” uses the theme-aware accent color instead of a literal
   color, since a literal fix for one theme would break the other. */
.data-link,
.data-link:visited {
    color: var(--accent);
}

.field-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    padding: 0.6rem 0.9rem;
    font-family: 'IBM Plex Sans', sans-serif;
    color: var(--charcoal);
}

/* Plain element selector, not scoped to a class â€” every <select> across
   the whole app picks this up automatically (Page Assignments' group
   picker, the Grant dropdowns on Users, this one, anywhere else one
   gets added later) without needing a class added to each one
   individually. No width:100% here unlike .field-input above â€” selects
   mostly sit inline inside table cells, where auto-sizing to content
   fits better than stretching to fill the cell. */
select {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 35%, white);
    padding: 0.4rem 1rem;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 13px;
    color: #1A1A1A; /* fixed, not var(--charcoal) â€” same reasoning as .pill-picker-trigger above */
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Styles the browser-native "Choose File" button portion of a file
   input to match .btn-pill.btn-pill-accent.btn-pill-sm exactly. The
   rest of a file input (the "no file chosen" text, its own border) is
   still browser-controlled and can't be restyled the same way â€” this
   pseudo-element is the only part CSS can actually reach. Apply the
   "file-input-styled" class directly on an <InputFile> (or a plain
   <input type="file">) to opt in. */
/* Every file picker on the site gets the pill button, class or not, so a new one can't be missed. */
.file-input-styled::file-selector-button,
input[type="file"]::file-selector-button {
    display: inline-block;
    border: none;
    border-radius: 999px;
    padding: 0.35rem 1rem;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    background: var(--accent);
    color: white;
    margin-right: 0.75rem;
}

.file-input-styled::file-selector-button:hover,
input[type="file"]::file-selector-button:hover {
    background: #1a9fd8; /* darker cyan, same shade already used for .btn-pill-accent:hover */
}

/* Click-outside-to-close via a full-screen invisible overlay rendered
   behind the popover â€” a plain Blazor @onclick handler on the overlay,
   no JS interop needed. */
.group-picker-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: transparent;
}

/* Same light-accent tint already used for history-table headers â€”
   reused here so both read as part of the same visual language rather
   than introducing a new color. Applied only to pickers showing an
   EXISTING row's current value, not the create-row's own trigger,
   which stays plain/outline like every other create-row control. */
.pill-picker-trigger {
    background: color-mix(in srgb, var(--accent) 35%, white);
    border-color: var(--accent);
    color: #1A1A1A; /* fixed, not var(--charcoal) â€” background stays a constant light blue regardless of theme, so text must too, same fix as history-table's header */
}

/* Background for the Formats/Sites expansion panel (Collectible
   Categories / Pricing Sources) -- same light-accent tint as above,
   deliberately fixed-light regardless of theme. The nested table
   inside these panels keeps its own normal theme-aware styling (it
   sits on a real --card background of its own, not this tint
   directly) -- these descendant rules are scoped only to the specific
   elements that sit DIRECTLY on the tinted background itself
   (headings, notes, pagination), not a blanket override of everything
   inside, which would incorrectly darken the nested table's own text
   too since color inherits down through descendants by default. */
.expansion-panel-tint {
    background: color-mix(in srgb, var(--accent) 15%, white);
}

    /* Plain descendant selectors, not depth-counted child combinators
       -- the "Recently Deleted" heading nests two levels deeper than
       the panel's own main heading, and neither h3 nor .admin-note
       ever appears inside the panel's own nested <table> in this
       markup, so matching at any depth is both safe and correct here. */
    .expansion-panel-tint h3,
    .expansion-panel-tint .admin-note,
    .expansion-panel-tint .activity-pagination {
        color: #1A1A1A;
    }

/* Multi-level grids (Brands > Product Lines > Sub-Lines, and the like): a panel
   nested inside another tinted panel gets its own tint, so each level is easy to
   tell apart. First level keeps the accent tint above; second level is rose
   (matches the sub-line headers), third is indigo. */
.expansion-panel-tint .expansion-panel-tint {
    background: color-mix(in srgb, var(--rose) 15%, white);
}

.expansion-panel-tint .expansion-panel-tint .expansion-panel-tint {
    background: color-mix(in srgb, var(--indigo) 15%, white);
}

.group-picker-popover {
    position: fixed;
    z-index: 101;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    width: max-content;
    max-width: 320px;
}

/* SearchPicker's results dropdown â€” same visual language as
   .activity-jump-results (vertical list, rounded card) but
   position:fixed instead of absolute, matching .group-picker-popover's
   own reasoning: escapes any ancestor's overflow:hidden clipping,
   which matters here since this renders inside table cells. */
.search-picker-results {
    position: fixed;
    z-index: 101;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    overflow: hidden;
    max-height: 280px;
    overflow-y: auto;
}

    .field-input:focus {
        outline: none;
        border-color: var(--accent);
    }

.admin-error {
    border: 1px solid var(--error);
    background: rgba(192, 57, 43, 0.06);
    border-radius: 8px;
    padding: 0.6rem 1rem;
    color: var(--error);
    font-size: 14px;
    margin-bottom: 1.5rem;
}

/* Specimen-style cards (Login, Register, Profile, ConsignorDashboard) —
   same structure as before, restyled: rounded corners, cyan label bar
   instead of the old sharp dark-ink one, no corner ticks (dropped, not
   part of this look). */
.specimen-wrapper {
    max-width: 420px;
    margin: 4rem auto;
    position: relative;
}

.specimen-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--card);
    overflow: hidden;
}

.specimen-label-bar {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    background: var(--accent);
    padding: 0.7rem 1.25rem;
}

    .specimen-label-bar span {
        font-size: 12px;
        font-weight: 600;
        letter-spacing: 0.05em;
        color: white;
        text-transform: uppercase;
    }

    .specimen-label-bar .reference {
        color: rgba(255, 255, 255, 0.8);
    }

.specimen-perforation {
    display: none;
}
/* not part of this visual language */

.specimen-body {
    padding: 1.25rem 1.5rem;
}

.btn-specimen {
    width: 100%;
    border: none;
    border-radius: 999px;
    background: var(--primary);
    color: white;
    padding: 0.7rem;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

    .btn-specimen:hover {
        background: #4C722A;
    }

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    font-size: 13px;
}

.helper-links {
    margin-top: 1rem;
    font-size: 13px;
}

    .helper-links a {
        color: var(--accent);
        text-decoration: none;
        font-weight: 500;
    }

        .helper-links a:hover {
            text-decoration: underline;
        }

.loading-text {
    text-align: center;
    margin-top: 4rem;
    color: var(--charcoal);
}

/* Profile page */
.profile-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent);
    font-weight: 700;
    font-size: 22px;
    color: white;
}

.profile-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--charcoal);
    margin: 0;
}

.profile-username {
    font-size: 13px;
    color: var(--muted);
    margin: 0;
}

/* Admin panel + Brands */
.admin-page {
    max-width: 1600px;
    margin: 2.5rem auto;
    padding: 0 1rem;
}

/* ===================== Public catalog pages ===================== */
/* Shares .admin-page's width/margin philosophy but its own class,
   since these pages are for anonymous visitors, not admin/curation
   work -- built entirely from the same theme variables as everything
   else (--card, --charcoal, --border, --primary, --accent, --muted),
   so dark mode is handled automatically, no separate dark-mode rules
   needed here. */
.public-page {
    max-width: 1200px;
    margin: 2.5rem auto;
    padding: 0 1rem;
}

.public-not-found {
    text-align: center;
    padding: 4rem 1rem;
}

.public-back-link {
    display: inline-block;
    margin-bottom: 1.25rem;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
}

    .public-back-link:hover {
        text-decoration: underline;
    }

/* ---- Filter bar (catalog/browse page) ---- */
.public-filter-bar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 1rem 0 1.5rem;
}

.public-filter-multiselect {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin: 0 0 1rem;
}

    .public-filter-multiselect .field-group {
        min-width: 260px;
        flex: 1;
    }

/* ---- Card grid (catalog/browse page) ---- */
.public-catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
}

.public-catalog-card {
    display: block;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: var(--charcoal);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

    .public-catalog-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    }

.public-catalog-card-image {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--stripe);
    overflow: hidden;
}

    .public-catalog-card-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.public-catalog-card-body {
    padding: 0.75rem;
}

.public-catalog-card-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.public-catalog-card-brand {
    font-size: 0.8rem;
    color: var(--muted);
}

/* ---- Item detail page ---- */
.public-detail-layout {
    display: grid;
    grid-template-columns: minmax(280px, 420px) 1fr;
    gap: 2.5rem;
    align-items: start;
}

    @media (max-width: 800px) {
        .public-detail-layout {
            grid-template-columns: 1fr;
        }
    }

.public-detail-main-image {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--stripe);
    border-radius: 10px;
    overflow: hidden;
}

    .public-detail-main-image img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

.public-detail-no-image {
    border: 1px dashed var(--border);
}

.public-detail-thumbnails {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.6rem;
    flex-wrap: wrap;
}

.public-detail-thumbnail {
    width: 56px;
    height: 56px;
    padding: 0;
    border: 2px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    background: var(--stripe);
}

    .public-detail-thumbnail img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .public-detail-thumbnail-active {
        border-color: var(--accent);
    }

.public-detail-breadcrumb {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 0.3rem;
}

.public-detail-brand-table {
    display: flex;
    gap: 2.5rem;
    margin-bottom: 1.25rem;
    color: var(--muted);
}

    .public-detail-brand-cell {
        text-align: center;
    }

    .public-detail-brand-cell-left {
        text-align: left;
    }

.public-detail-brand-logo {
    display: inline-block;
    max-width: 140px;
    max-height: 70px;
    object-fit: contain;
    margin-top: 0.3rem;
}

.public-detail-sticker-logo {
    display: inline-block;
    max-width: 90px;
    max-height: 45px;
    object-fit: contain;
    margin: 0.15rem 0.5rem 0.15rem 0;
}

.public-detail-fact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.public-detail-fact-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    margin-bottom: 0.15rem;
}

.public-detail-section {
    margin-bottom: 1.5rem;
}

    .public-detail-section h2 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }

.public-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.public-detail-tag {
    display: inline-block;
    background: var(--stripe);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
}

/* Exclusives and stickers as text badges (TagBadge.razor). --tag-color comes from the exclusive's colour (TagColors);
   without one the badge is plain grey. Mixed with the card colour so it reads in light and dark mode. */
.tag-badge {
    --tag-color: #8A8F98;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 999px;
    padding: 0.2rem 0.7rem;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--charcoal);
    background: color-mix(in srgb, var(--tag-color) 14%, var(--card));
    border: 1px solid color-mix(in srgb, var(--tag-color) 55%, var(--card));
    text-decoration: none;
    white-space: nowrap;
}
a.tag-badge:hover { background: color-mix(in srgb, var(--tag-color) 26%, var(--card)); color: var(--charcoal); }
.tag-badge-sm { font-size: 0.72rem; padding: 0.1rem 0.5rem; }
.tag-badge-version { font-weight: 500; opacity: 0.85; padding-left: 0.35rem; border-left: 1px solid color-mix(in srgb, var(--tag-color) 45%, var(--card)); }
/* A coloured exclusive or sticker: solid fill, lettering from TagColors (white, or dark on orange and gold). */
.tag-badge-solid { background: var(--tag-color); border-color: color-mix(in srgb, var(--tag-color) 80%, var(--charcoal)); color: var(--tag-text, #fff); }
a.tag-badge-solid:hover { background: color-mix(in srgb, var(--tag-color) 85%, var(--card)); color: var(--tag-text, #fff); }
.tag-badge-solid .tag-badge-version { border-left-color: color-mix(in srgb, var(--tag-text, #fff) 45%, transparent); }
.tag-badge-seal { width: 1.05em; height: 1.05em; flex-shrink: 0; margin-left: -0.1rem; }

.public-taxonomy-link {
    color: inherit;
    text-decoration: none;
}

    .public-taxonomy-link:hover {
        color: var(--accent);
        text-decoration: underline;
    }

.public-detail-tag-link {
    text-decoration: none;
    color: var(--charcoal);
    cursor: pointer;
}

    .public-detail-tag-link:hover {
        background: color-mix(in srgb, var(--accent) 15%, var(--stripe));
        border-color: var(--accent);
    }



.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

.admin-badge {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-section {
    margin-bottom: 2.5rem;
}

.admin-section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.75rem;
}

.admin-section-header-left {
    display: flex;
    align-items: baseline;
    gap: 1.25rem;
    flex-wrap: wrap;
}

    .admin-section-header span {
        font-size: 13px;
        color: var(--muted);
    }

    /* The count beside a section's heading keeps a gap from it (and stays beside it when a button sits on the right). */
    .admin-section-header > h2 + span:not(:last-child) {
        margin-left: 0.75rem;
        margin-right: auto;
    }

/* Applied to columns that should never wrap (Name, Slug, Actions) so
   they size tightly to their content, leaving whatever's left for a
   free-text column (Description, etc.) to wrap within â€” rather than
   long free text pushing action buttons onto their own line. */
.nowrap-cell {
    white-space: nowrap;
}

.admin-table {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card);
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    overflow: hidden;
}

    .admin-table th {
        text-align: left;
        padding: 0.75rem 1rem;
        font-weight: 700;
        color: var(--charcoal);
        background: var(--stripe);
    }

    .admin-table td {
        padding: 0.75rem 1rem;
        border-top: 1px solid var(--border);
        vertical-align: top;
    }

    .admin-table select {
        border: 1px solid var(--border);
        border-radius: 999px;
        padding: 0.3rem 0.9rem;
        font-size: 13px;
    }

.radio-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-right: 0.9rem;
    font-size: 13px;
    white-space: nowrap;
}

.activity-jump-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 10;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    overflow: hidden;
}

.activity-jump-result {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--charcoal);
    font-size: 13px;
    cursor: pointer;
}

.activity-jump-result:last-child {
    border-bottom: none;
}

.activity-jump-result:hover {
    background: var(--stripe);
}

/* Site Maintenance â€” see MainLayout.razor's own comments for the
   enforcement logic. These replace the ENTIRE app (no header/sidebar
   at all) when blocked, so deliberately don't reuse .admin-page or
   similar page-scoped classes. */
.maintenance-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: var(--charcoal);
}

.maintenance-screen-card {
    max-width: 420px;
    text-align: center;
    background: var(--card);
    border-radius: 12px;
    padding: 2.5rem 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

    .maintenance-screen-card h1 {
        font-size: 1.4rem;
        margin: 0 0 0.75rem;
    }

    .maintenance-screen-card p {
        margin: 0 0 0.5rem;
        color: var(--charcoal);
    }

.maintenance-warning-banner {
    background: color-mix(in srgb, var(--rose) 15%, white);
    color: #7a2e42; /* fixed, not var(--charcoal) â€” background is a constant light tint regardless of theme, same reasoning as history-table's own header fix */
    text-align: center;
    padding: 0.6rem 1rem;
    font-size: 13px;
    font-weight: 600;
}

/* SuperUser-only persistent indicator, shown in the header on every
   page while a window is active â€” see MainLayout.razor. More urgent
   than .maintenance-warning-banner (that one's an advance heads-up to
   everyone; this one means the site is actually blocked for everyone
   else right now), but still small and out of the way rather than a
   full banner, since the SuperUser viewing it isn't themselves
   affected. */
.maintenance-active-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #c0392b;
    color: #fff !important; /* the header's link colour otherwise wins, leaving dark red on red */
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 700 !important;
    text-decoration: none;
    white-space: nowrap;
}

    .maintenance-active-badge:hover {
        background: #a93226;
    }

.admin-toggle {
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: none;
    padding: 0.3rem 0.8rem;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: var(--accent);
}

    .admin-toggle.inactive {
        border-color: var(--error);
        color: var(--error);
    }

    .admin-toggle:hover {
        background: var(--accent);
        color: white;
    }

    .admin-toggle.inactive:hover {
        background: var(--error);
        color: white;
    }

.permission-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.4rem;
}

.permission-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: 999px;
    background: rgba(41, 182, 246, 0.12);
    padding: 0.2rem 0.7rem;
    font-size: 12px;
    color: var(--charcoal);
}

/* Bold treatment for chips representing a "this is currently assigned/
   granted" relationship â€” Users' held permissions, Page Groups'
   "Permission Access" (which permissions currently grant this group).
   NOT applied to Page Assignments' "Other pages" badges (group:/
   policy:/role: labels) â€” those describe a fixed protection mechanism
   on a non-reassignable page, closer to a static descriptive label
   than a live assignment someone can act on. */
.permission-chip-assigned {
    font-weight: 700;
}

    .permission-chip button {
        border: none;
        background: none;
        cursor: pointer;
        color: var(--error);
        font-weight: bold;
    }

.permission-add {
    display: flex;
    gap: 0.3rem;
}

    .permission-add input, .permission-add select {
        border: 1px solid var(--border);
        border-radius: 999px;
        padding: 0.3rem 0.7rem;
        font-size: 12px;
        width: 100px;
    }

    .permission-add button {
        border: 1px solid var(--accent);
        border-radius: 6px;
        background: none;
        cursor: pointer;
        font-size: 12px;
        padding: 0.3rem 0.6rem;
        color: var(--accent);
    }

.admin-note {
    margin-top: 0.75rem;
    font-size: 12px;
    color: var(--muted);
}

.admin-note-danger {
    margin-top: 0.75rem;
    font-size: 12px;
    color: var(--error);
    font-weight: 700;
}

.nav-btn-primary {
    background: var(--primary) !important;
}

    .nav-btn-primary:hover {
        background: #4C722A !important;
    }

.nav-btn-indigo {
    background: var(--indigo) !important;
}

    .nav-btn-indigo:hover {
        background: #4636c9 !important;
    }

.site-shell {
    display: flex;
    min-height: calc(100vh - 65px);
}

/* Wide enough that longer links (Unassigned Sales with its count, Import from hobbyDB) stay on one line. */
.site-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--card);
    border-right: 1px solid var(--border);
    padding: 1.25rem 1rem;
}

.site-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

    .site-sidebar-nav a {
        color: var(--charcoal);
        text-decoration: none;
        font-weight: 500;
        font-size: 14px;
    }

        .site-sidebar-nav a:hover {
            color: var(--accent);
        }

/* The nav scrolls once menus are expanded; without this, flexbox shrinks the 1px dividers to nothing. */
.site-sidebar-nav > * {
    flex-shrink: 0;
}

.sidebar-break {
    height: 1px;
    background: var(--border);
    margin: 0.75rem 0;
}

.sidebar-sub-break {
    height: 1px;
    background: var(--border);
    opacity: 0.5;
    margin: 0.5rem 0.75rem;
}

.sidebar-section-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 0.4rem;
}

.sidebar-sub-link {
    padding-left: 0.75rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Count badge on a sidebar link (Support Inbox: requests needing a reply) */
.sidebar-badge {
    margin-left: auto;
    min-width: 1.25rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25rem;
    text-align: center;
    letter-spacing: 0;
    text-transform: none;
}

/* Green count: good news (wish list targets reached) */
.sidebar-badge-good {
    background: #2e7d32;
}

/* Collapsible sub-group inside a sidebar section (Reference Lists) */
.sidebar-group-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0 0 0 0.75rem;
    border: none;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    text-align: left;
}

    .sidebar-group-toggle:hover {
        color: var(--accent);
    }

/* Desktop: the nav scrolls on its own so a long sidebar never stretches the page */
@media (min-width: 901px) {
    .site-sidebar-nav {
        position: sticky;
        top: 1rem;
        max-height: calc(100vh - 9rem);
        overflow-y: auto;
        scrollbar-width: thin;
    }
}

.site-main {
    flex-grow: 1;
    padding: 1.5rem 2rem 1.5rem 0.5rem;
}

.dashboard-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    min-width: 0;
}

.nav-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
}

.nav-avatar-initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--indigo);
    color: white;
    font-weight: 700;
    font-size: 13px;
}


.profile-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
}

.profile-cards .profile-header {
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 0.75rem;
}

.profile-cards .profile-avatar {
    width: 64px;
    height: 64px;
    font-size: 22px;
}

.btn-pill-header {
    background: var(--card);
    color: var(--charcoal) !important;
    border-radius: 999px;
    padding: 0.3rem 0.9rem;
    font-size: 12px;
    font-weight: 700;
    border: none;
    cursor: pointer;
}

    .btn-pill-header:hover {
        background: var(--stripe);
    }

.profile-field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem 1.5rem;
}

.profile-field-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 0.25rem;
}

.profile-field-value {
    font-size: 14px;
    color: var(--charcoal);
}

.profile-card-note {
    font-size: 12px;
    color: var(--muted);
    margin-top: 0.5rem;
}

.btn-pill-sm {
    padding: 0.35rem 1rem;
    font-size: 12px;
}

.profile-meta {
    font-size: 12px;
    color: var(--muted);
    margin: 0.1rem 0 0;
}

.profile-field-full {
    grid-column: 1 / -1;
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-editable {
    position: relative;
    display: inline-block;
}

.avatar-edit-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--rose);
    color: #fff;
    border: 2px solid var(--card); /* blends with the surrounding page background instead of always being white */
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .avatar-edit-badge:hover {
        background: #C94860; /* darker rose */
    }

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 26, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-card {
    width: 400px;
    max-width: 90vw;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 1.1rem;
}

.modal-body {
    padding: 1.25rem 1.5rem;
}

.modal-footer {
    padding: 0.75rem 1.5rem 1.25rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
}

.source-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.source-tab {
    padding: 6px 12px;
    border-radius: 999px; /* pill, matches project button style */
    border: 1px solid var(--border);
    background: var(--card);
    cursor: pointer;
}

    .source-tab.active {
        background: var(--primary);
        color: #fff;
        border-color: var(--primary);
    }

    .source-tab.disabled {
        color: var(--muted);
        cursor: not-allowed;
        pointer-events: none;
    }

.avatar-preview img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    margin-top: 8px;
}

.form-error {
    color: var(--error);
    font-size: 0.85rem;
    margin-top: 6px;
}

.btn-inline-edit {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--rose);
    margin-left: 6px;
    padding: 0;
    vertical-align: middle;
}

    .btn-inline-edit:hover {
        color: #C94860; /* darker rose */
    }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.profile-visual {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.tier-seal {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--primary);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.activity-filter {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

    .activity-filter label {
        display: flex;
        align-items: center;
        gap: 0.35rem;
        font-size: 0.85rem;
        color: var(--muted);
    }

.activity-context-chips {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.3rem;
    flex-wrap: wrap;
}

.activity-chip {
    display: inline-block;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 999px;
}

.activity-chip-ip {
    background: rgba(90, 78, 229, 0.12);
    color: var(--indigo);
}

.activity-chip-device {
    background: color-mix(in srgb, var(--primary) 15%, transparent);
    color: var(--primary);
}

.activity-category-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
    cursor: pointer;
    border: none;
    transition: opacity 0.15s ease;
}

.activity-category-login {
    background: rgba(90, 78, 229, 0.12);
    color: var(--indigo);
}

.activity-category-profile {
    background: rgba(76, 209, 217, 0.15);
    color: var(--accent);
}

.activity-category-account-access {
    background: color-mix(in srgb, var(--primary) 15%, transparent);
    color: var(--primary);
}

.activity-event-success {
    color: var(--success);
    font-weight: 600;
}

.activity-event-failure {
    color: var(--error);
    font-weight: 600;
}

.activity-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.activity-stat {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem 1.25rem;
    display: flex;
    flex-direction: column;
    min-width: 130px;
}

.activity-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--activity-blue);
}

.activity-stat-warn .activity-stat-value {
    color: var(--error);
}

.activity-stat-label {
    font-size: 0.8rem;
    color: var(--muted);
}

.page-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--primary), var(--accent)); /* green to cyan */
    color: #fff;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

.page-banner-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-banner-icon svg {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    opacity: 0.9;
}

.page-banner-title h1 {
    margin: 0;
    color: #fff;
}

.page-banner-subtitle {
    margin: 2px 0 0;
    font-size: 0.85rem;
    opacity: 0.85;
}

.page-banner-badge {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 999px;
    flex-shrink: 0;
}

.activity-table thead th {
    background: var(--accent); /* matches .specimen-label-bar exactly */
    color: #fff;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
    font-weight: 700;
    padding: 0.75rem 1rem;
    text-align: left;
}

    .activity-table thead th:first-child {
        border-top-left-radius: 8px;
    }

    .activity-table thead th:last-child {
        border-top-right-radius: 8px;
    }

table.history-table thead th {
    background: color-mix(in srgb, var(--accent) 35%, white); /* lighter shade of the same accent blue */
    color: #1A1A1A; /* fixed, not var(--charcoal) â€” this header's background stays a constant light blue regardless of theme (mixed with literal white above), so its text must stay a constant dark color too, not flip light in dark mode */
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
    font-weight: 700;
    padding: 0.75rem 1rem;
    text-align: left;
}

    table.history-table thead th:first-child {
        border-top-left-radius: 8px;
    }

    table.history-table thead th:last-child {
        border-top-right-radius: 8px;
    }

.admin-table-primary thead th {
    background: var(--primary);
    color: #fff;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
    font-weight: 700;
    padding: 0.75rem 1rem;
    text-align: left;
}

    .admin-table-primary thead th:first-child {
        border-top-left-radius: 8px;
    }

    .admin-table-primary thead th:last-child {
        border-top-right-radius: 8px;
    }

.admin-table-indigo thead th {
    background: var(--indigo);
    color: #fff;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
    font-weight: 700;
    padding: 0.75rem 1rem;
    text-align: left;
}

    .admin-table-indigo thead th:first-child {
        border-top-left-radius: 8px;
    }

    .admin-table-indigo thead th:last-child {
        border-top-right-radius: 8px;
    }

/* Visual separation between the Line/Brand/Global sections of
   GroupedPillPicker.razor -- each present group gets its own divider
   above it, per-group labels already handle the "which is which" part,
   this handles the "each visually separated" part. */
.grouped-pill-picker-group {
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    margin-top: 0.6rem;
}

    .grouped-pill-picker-group:first-child {
        margin-top: 0;
    }

    /* Same reused accent colors as elsewhere in this app, not new
       ones -- indigo already marks the nested/more-specific tier on
       Categories/Sources' own sub-tables, accent already marks their
       expansion panels, primary already marks "add new". Reused here
       with the same most-specific-to-broadest logic: Line (indigo) ->
       Brand (accent) -> Global (primary). Light-mode percentages stay
       low since these are small pill-container backgrounds, not a
       full page-width panel; dark-mode gets a stronger mix, same
       reasoning as --create-row-bg's own light/dark split -- a light
       tint fades to invisible against a near-black card otherwise. */
    .grouped-pill-picker-group-line {
        background: color-mix(in srgb, var(--indigo) 10%, var(--card));
    }

    .grouped-pill-picker-group-brand {
        background: color-mix(in srgb, var(--accent) 10%, var(--card));
    }

    .grouped-pill-picker-group-global {
        background: color-mix(in srgb, var(--primary) 10%, var(--card));
    }

    [data-theme="dark"] .grouped-pill-picker-group-line {
        background: color-mix(in srgb, var(--indigo) 22%, var(--card));
    }

    [data-theme="dark"] .grouped-pill-picker-group-brand {
        background: color-mix(in srgb, var(--accent) 22%, var(--card));
    }

    [data-theme="dark"] .grouped-pill-picker-group-global {
        background: color-mix(in srgb, var(--primary) 22%, var(--card));
    }

.activity-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.activity-category-filter {
    display: flex;
    gap: 0.4rem;
    margin-right: 0.5rem;
}

.activity-category-off {
    background: var(--stripe) !important;
    color: var(--muted) !important;
    opacity: 1;
}

/* A cycling palette for badge sets whose values aren't fixed and known
   ahead of time (Users page: staff role, and especially permission
   bundle names, which can be anything an admin creates) â€” unlike
   Activity's category badges, which hardcode one class per known
   category name, these are assigned by position/index instead. */
.badge-color-0 { background: color-mix(in srgb, var(--primary) 15%, white); color: var(--primary); }
.badge-color-1 { background: color-mix(in srgb, var(--indigo) 15%, white); color: var(--indigo); }
.badge-color-2 { background: color-mix(in srgb, var(--accent) 18%, white); color: var(--accent); }
.badge-color-3 { background: color-mix(in srgb, var(--rose) 18%, white); color: var(--rose); }
.badge-color-4 { background: color-mix(in srgb, var(--error) 15%, white); color: var(--error); }
.badge-color-5 { background: color-mix(in srgb, var(--muted) 22%, white); color: var(--muted); }

.activity-filter-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding-right: 1.25rem;
    margin-right: 0.25rem;
    border-right: 1px solid var(--border);
}

    .activity-filter-group:last-of-type {
        border-right: none;
    }

.activity-filter-group-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-right: 0.25rem;
}

.account-level-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0.4rem 0;
}

.tier-pill {
    display: inline-block;
    background: var(--tier-color);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 3px 14px;
    border-radius: 999px;
}

/* ---- Dropped-connection banner (markup in App.razor, behaviour in js/reconnect.js) ---- */
#components-reconnect-modal {
    display: none;
    position: fixed;
    left: 0; right: 0; top: 0;
    z-index: 10000;
    justify-content: center;
    padding: 0.6rem 1rem;
    pointer-events: none;
}
#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex;
    /* A brief blip (a page change, a fast reconnect) shouldn't flash a banner, so it fades in after a short wait. */
    animation: reconnect-in 0.25s ease 1.2s both;
}
#components-reconnect-modal .reconnect-card {
    pointer-events: auto;
    background: var(--charcoal);
    color: #fff;
    border-radius: 8px;
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    text-align: center;
}
#components-reconnect-modal .reconnect-msg { display: none; }
#components-reconnect-modal.components-reconnect-show .reconnect-msg-show,
#components-reconnect-modal.components-reconnect-failed .reconnect-msg-failed,
#components-reconnect-modal.components-reconnect-rejected .reconnect-msg-rejected { display: block; }
#components-reconnect-modal .reconnect-actions { margin-top: 0.4rem; display: flex; gap: 0.5rem; justify-content: center; }
#components-reconnect-modal .reconnect-actions button {
    background: #fff;
    color: var(--charcoal);
    border: 0;
    border-radius: 999px;
    padding: 0.2rem 0.8rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
@keyframes reconnect-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---- Small screens: header collapse + slide-out sidebar drawer ---- */
.site-menu-button, .site-sidebar-close { display: none; }
.site-sidebar-backdrop { display: none; }

@media (max-width: 900px) {
    .hide-mobile { display: none !important; }

    .site-header { flex-wrap: wrap; gap: 0.5rem 0.75rem; padding: 0.6rem 1rem; }
    .site-menu-button { order: 1; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--charcoal); cursor: pointer; }
    .site-menu-button svg { width: 22px; height: 22px; }
    .site-title { order: 2; flex: 1 1 auto; font-size: 1.1rem; }
    .site-logo { height: 40px; margin: 0; }
    .site-nav { order: 3; gap: 0.4rem; }
    .site-browse-and-search { order: 4; flex: 1 1 100%; flex-direction: column; align-items: stretch; gap: 0.5rem; }
    .site-browse-links { gap: 0.4rem; }
    .site-browse-links .nav-link-button { flex: 1 1 0; text-align: center; padding: 0.5rem 0.5rem; }
    .site-global-search .field-input { max-width: none !important; flex: 1 1 auto; }

    .site-shell { display: block; min-height: 0; }
    .site-main { padding: 1rem; min-width: 0; }

    .site-sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: min(290px, 85vw); z-index: 1100; overflow-y: auto; padding-top: 3.25rem; transform: translateX(-100%); visibility: hidden; transition: transform 0.2s ease, visibility 0s linear 0.2s; box-shadow: none; }
    .site-sidebar.is-open { transform: none; visibility: visible; transition: transform 0.2s ease; box-shadow: 4px 0 18px rgba(0, 0, 0, 0.3); }
    .site-sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 1050; background: rgba(0, 0, 0, 0.45); }
    .site-sidebar-close { display: inline-flex; align-items: center; justify-content: center; position: absolute; top: 0.6rem; right: 0.75rem; width: 36px; height: 36px; padding: 0; border: none; background: transparent; color: var(--charcoal); cursor: pointer; }
    .site-sidebar-close svg { width: 22px; height: 22px; }
    .site-sidebar-nav a { padding: 0.3rem 0; }
}

.site-sidebar-logout { display: none; }
@media (max-width: 900px) {
    .site-sidebar-logout { display: block; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
    .site-sidebar-logout .nav-link-button { width: 100%; text-align: center; }
}

/* ---- Small screens: shared page pieces (banner, page padding) and My Profile's card grids ---- */
@media (max-width: 1100px) {
    .profile-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
    .admin-page { margin: 1rem auto; padding: 0; }
    .page-banner { flex-wrap: wrap; gap: 0.5rem 1rem; padding: 1rem; }
    .page-banner-title h1 { font-size: 1.4rem; }
    .page-banner-icon svg { width: 26px; height: 26px; }
    .profile-cards { margin-top: 1rem; gap: 1rem; }
}
@media (max-width: 640px) {
    .profile-cards { grid-template-columns: 1fr; }
    .profile-field-grid { grid-template-columns: 1fr; }
    .mp-fee-grid { grid-template-columns: 1fr !important; }
    .specimen-label-bar { padding: 0.7rem 1rem; }
}

/* Section headers (title + buttons) wrap instead of squeezing on a phone. */
@media (max-width: 640px) {
    .admin-section-header { flex-wrap: wrap; gap: 0.5rem 1rem; }
}

/* Picker dropdowns never run wider than the screen. */
.group-picker-popover { max-width: min(320px, calc(100vw - 1rem)); }
.search-picker-results { max-width: calc(100vw - 1rem); }

/* ---- Small screens: wide tables scroll sideways inside their own box (the wrapper does nothing on a wide screen) ---- */
@media (max-width: 900px) {
    .table-scroll { overflow-x: auto; max-width: 100%; }
    .dashboard-row { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
}
@media (max-width: 520px) {
    .dashboard-row { grid-template-columns: 1fr; }
}

/* ---- Small screens: the collection entry form's multi-column field grids (set inline, hence !important) ---- */
@media (max-width: 900px) {
    .entry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 520px) {
    .entry-grid-2 { grid-template-columns: 1fr !important; }
}

/* ---- Charts (TrendChart.razor): bars or a line over time, plain HTML/CSS plus a little SVG ---- */
.pc-chart { margin: 0; }
.pc-plot { position: relative; padding-left: 3.4rem; padding-top: 0.5rem; }
.pc-area { position: relative; height: 100%; }
.pc-grid { position: absolute; left: 0; right: 0; border-top: 1px solid color-mix(in srgb, var(--border) 45%, transparent); }
.pc-grid-base { border-top-color: var(--border); }
.pc-ylabel { position: absolute; right: calc(100% + 0.45rem); transform: translateY(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pc-cols { position: absolute; inset: 0; display: flex; align-items: stretch; gap: 2px; }
.pc-cols-line { gap: 0; }
.pc-col { position: relative; flex: 1 1 0; min-width: 0; display: flex; align-items: flex-end; justify-content: center; border-radius: 4px; outline: none; }
.pc-col:hover, .pc-col:focus-visible { background: color-mix(in srgb, var(--stripe) 70%, transparent); }
.pc-col:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.pc-bar { width: min(72%, 44px); min-height: 2px; background: var(--primary); border-radius: 4px 4px 0 0; }
.pc-col:hover .pc-bar, .pc-col:focus-visible .pc-bar { filter: brightness(1.12); }
.pc-line { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.pc-line-stroke { fill: none; stroke: var(--primary); stroke-width: 2px; stroke-linejoin: round; stroke-linecap: round; }
.pc-line-fill { fill: color-mix(in srgb, var(--primary) 12%, transparent); stroke: none; }
.pc-dot { position: absolute; left: 50%; width: 9px; height: 9px; margin: 0 0 -4.5px -4.5px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 2px var(--card); opacity: 0; }
.pc-dot-last, .pc-col:hover .pc-dot, .pc-col:focus-visible .pc-dot { opacity: 1; }
.pc-tip { position: absolute; left: 50%; transform: translateX(-50%); z-index: 5; display: none; flex-direction: column; gap: 0.1rem; min-width: 8.5rem; padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: 6px; background: var(--card); color: var(--charcoal); font-size: 0.78rem; white-space: nowrap; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15); pointer-events: none; }
.pc-tip strong { font-weight: 600; color: var(--muted); font-size: 0.72rem; }
.pc-tip span { font-weight: 700; font-variant-numeric: tabular-nums; }
.pc-tip .pc-tip-detail { font-weight: 400; color: var(--muted); }
.pc-tip-start { left: 0; transform: none; }
.pc-tip-end { left: auto; right: 0; transform: none; }
.pc-col:hover .pc-tip, .pc-col:focus-visible .pc-tip { display: flex; }
.pc-xlabels { display: flex; gap: 2px; padding-left: 3.4rem; margin-top: 0.3rem; }
.pc-xlabels span { flex: 1 1 0; min-width: 0; text-align: center; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: visible; }
@media (max-width: 640px) {
    .pc-xlabel-alt { visibility: hidden; }
}

/* ---- Entry form purchase fields: small italic hint under a price box, and a box with a $ / % picker ---- */
.price-hint { display: block; margin-top: 0.2rem; font-size: 0.7rem; color: var(--muted); line-height: 1.3; }
.amount-unit { display: flex; flex-direction: column; gap: 0.3rem; }
.amount-unit input { width: 100%; min-width: 0; }
.amount-unit select { width: 100%; }
/* Your Copies table: the row buttons (Duplicate, Remove, ...) sit at the right edge. */
/* Row actions (Listed chip, Details, Duplicate, Remove, then Confirm Remove + Cancel) wrap inside their own cell
   instead of pushing the table past the card's right edge. */
td.copies-actions { text-align: right; white-space: normal; min-width: 15rem; }
td.copies-actions > .btn-pill, td.copies-actions > a.btn-pill, td.copies-actions > .permission-chip, td.copies-actions > strong { display: inline-block; vertical-align: middle; margin: 2px 0 2px 0.3rem; }

/* ---- Admin Help area ---- */
.help-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 1rem; }
.help-card { display: flex; flex-direction: column; gap: 0.35rem; padding: 1rem 1.1rem; border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12); color: inherit; text-decoration: none; }
.help-card:hover { border-color: var(--accent, currentColor); }
.help-card span { font-size: 0.9rem; color: var(--muted); }
.help-card em { font-size: 0.75rem; color: var(--muted); }
.help-article { max-width: 52rem; line-height: 1.55; }
.help-article h2 { margin: 2rem 0 0.5rem; padding-top: 0.5rem; border-top: 2px dashed var(--border); }
.help-article h2:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.help-article h3 { margin: 1.5rem 0 0.4rem; }
.help-article ul, .help-article ol { margin: 0.4rem 0 0.8rem; padding-left: 1.5rem; }
.help-article li { margin: 0.25rem 0; }
.help-article p { margin: 0.5rem 0; }
.help-article .help-contents { margin: 0 0 1rem; padding: 0.75rem 1rem; background: var(--group-header-bg); border-radius: 6px; }
.help-article .help-contents ul { margin: 0.3rem 0 0; }

/* Public Help & FAQ (/support) */
.help-search { max-width: 28rem; margin: 0 0 1rem; }
.help-faq details { border: 1px solid var(--border); border-radius: 6px; margin: 0.4rem 0; background: var(--card); }
.help-faq summary { cursor: pointer; padding: 0.6rem 0.9rem; font-weight: 600; }
.help-faq details[open] summary { border-bottom: 1px dashed var(--border); }
.help-faq details p { margin: 0; padding: 0.6rem 0.9rem 0.8rem; }
.help-contact { max-width: 52rem; margin-top: 2rem; padding: 0.9rem 1.1rem; border: 1px solid var(--border); border-radius: 6px; background: var(--group-header-bg); display: flex; flex-wrap: wrap; gap: 0.35rem 0.75rem; align-items: baseline; }

/* "Continue with Google / Microsoft / ..." under the login and register forms (ExternalLoginPicker) */
.external-login { margin-top: 1.1rem; }
.external-login-divider { display: flex; align-items: center; gap: 0.6rem; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.7rem; }
.external-login-divider::before, .external-login-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.external-login-buttons { display: flex; flex-direction: column; gap: 0.45rem; }
.external-login-button { width: 100%; }

/* Date boxes (js/date-guard.js): a typed box in front of the hidden browser date box, with a calendar button and a
   message under it saying which part of a date is wrong. The browser box stays rendered (invisible) so its picker opens. */
.ph-date { display: inline-flex; flex-direction: column; gap: 0.2rem; width: 100%; max-width: 100%; vertical-align: middle; }
.ph-date-row { position: relative; display: flex; align-items: center; }
.ph-date-text { width: 100%; padding-right: 2.3rem !important; }
.ph-date-btn { position: absolute; right: 0.35rem; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center;
    width: 1.8rem; height: 1.8rem; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted, #6b7280); cursor: pointer; }
.ph-date-btn:hover:not(:disabled) { background: color-mix(in srgb, var(--charcoal) 8%, transparent); color: var(--charcoal); }
.ph-date-btn:disabled { cursor: default; opacity: 0.5; }
.ph-date-btn svg { width: 1.05rem; height: 1.05rem; }
.ph-date-text.ph-date-invalid { border-color: #c0392b !important; box-shadow: 0 0 0 2px color-mix(in srgb, #c0392b 20%, transparent); }
.ph-date-msg { color: #c0392b; font-size: 0.8rem; font-weight: 600; line-height: 1.3; white-space: normal; text-align: left; }
.ph-date-msg.ph-date-msg-stale { opacity: 0.6; }
[data-theme="dark"] .ph-date-msg { color: #ff8a7a; }
input[type="date"][data-ph-date] { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; border: 0 !important;
    opacity: 0 !important; pointer-events: none !important; overflow: hidden; }

/* Badges under a variant card (SetApartBadges): a long name ("Signed by Liam O'Brien") wraps inside the card instead of running past it. */
.set-apart-badges { min-width: 0; max-width: 100%; }
.set-apart-badges .tag-badge { max-width: 100%; white-space: normal; overflow-wrap: break-word; text-align: left; border-radius: 0.75rem; }
.set-apart-badges .tag-badge { flex-wrap: wrap; row-gap: 0.1rem; }   /* name, version and seal wrap as whole pieces */
.set-apart-badges .tag-badge-version { white-space: nowrap; }

/* Every dropdown's open list, rounded like the site's own pickers (Categories, Brands). Browsers that let a page style
   the list (Chrome and Edge 135+) get this; others keep their own list, and the closed dropdown looks the same either
   way. Multi-row lists (multiple / size) are left native. */
@supports (appearance: base-select) {
    select:not([multiple]):not([size]), select:not([multiple]):not([size])::picker(select) { appearance: base-select; }
    select:not([multiple]):not([size]) { display: inline-flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
    select:not([multiple]):not([size])::picker-icon { content: "\25BE"; font-size: 0.85em; color: inherit; transition: rotate 0.15s ease; }
    select:not([multiple]):not([size]):open::picker-icon { rotate: 180deg; }
    select:not([multiple]):not([size])::picker(select) {
        border: 1px solid var(--border);
        border-radius: 12px;
        background: var(--card);
        color: var(--charcoal);
        padding: 0.3rem;
        margin-block: 0.25rem;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
        max-height: min(22rem, 60vh);
        overflow-y: auto;
    }
    select:not([multiple]):not([size]) option { border-radius: 8px; padding: 0.4rem 0.7rem; font-size: 13px; color: var(--charcoal); cursor: pointer; }
    select:not([multiple]):not([size]) option:hover, select:not([multiple]):not([size]) option:focus-visible { background: color-mix(in srgb, var(--accent) 22%, var(--card)); outline: none; }
    select:not([multiple]):not([size]) option:checked { font-weight: 600; background: color-mix(in srgb, var(--primary) 16%, var(--card)); }
    select:not([multiple]):not([size]) option::checkmark { display: none; }
    select:not([multiple]):not([size]) option:disabled { color: var(--muted); cursor: default; }
    select:not([multiple]):not([size]) optgroup { font-weight: 700; font-size: 12px; color: var(--muted); padding: 0.3rem 0.4rem 0; }
}

/* DateParts: a date as Month / Day / Year boxes. A missing part's message waits (ph-dp-later) until the year is typed or a
   button is tried (date-guard.js sets data-date-show). */
.ph-dateparts { display: inline-flex; flex-direction: column; gap: 0.2rem; min-width: max-content; vertical-align: middle; }
.ph-dateparts-row { display: flex; gap: 0.35rem; align-items: center; flex-wrap: nowrap; }   /* one line; its column makes room (min-width above) */
.ph-dateparts .ph-dp-month { width: 5.3rem; flex: 0 0 auto; }
.ph-dateparts .ph-dp-day { width: 4.3rem; flex: 0 0 auto; }
.ph-dateparts .ph-dp-year { width: 4.4rem; flex: 0 0 auto; }
.ph-dp-clear { flex: 0 0 auto; border: 0; background: none; color: var(--muted); font-size: 1.1rem; line-height: 1; padding: 0.1rem 0.3rem; cursor: pointer; border-radius: 999px; }
.ph-dp-clear:hover { color: var(--charcoal); background: var(--stripe); }
.ph-dp-hint { font-size: 0.75rem; color: var(--muted); }
.ph-dateparts .ph-dp-later { display: none; }
.ph-dateparts[data-date-show="true"] .ph-dp-later { display: inline; }
.ph-dateparts [data-date-missing="true"] { border-color: #c0392b; }

/* A date sits in a narrow grid column (sale forms, filters): it takes two columns so it stays on one line. A field holding
   a date never squeezes it (its min-width), and on a phone the boxes may wrap rather than run off the screen. */
.isp-row > .field-group:has(> .ph-dateparts), .isp-filters > .field-group:has(> .ph-dateparts) { grid-column: span 2; }
.field-group:has(> .ph-dateparts) { min-width: max-content; }
@media (max-width: 520px) {
    .ph-dateparts, .field-group:has(> .ph-dateparts) { min-width: 0; max-width: 100%; }
    .ph-dateparts-row { flex-wrap: wrap; }
    .isp-row > .field-group:has(> .ph-dateparts), .isp-filters > .field-group:has(> .ph-dateparts) { grid-column: auto; }
}

/* PickOnePanel: one choice from a long list, like Browse Collectibles' Brands filter (button, then a search and a scrolling list). */
.pick-one { position: relative; display: inline-block; }
.pick-one-button { max-width: 24rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-one-backdrop { position: fixed; inset: 0; z-index: 6; }
.pick-one-panel { position: absolute; top: calc(100% + 0.35rem); left: 0; z-index: 7; width: 22rem; max-width: 85vw; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 0.5rem; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); color: var(--charcoal); }
.pick-one-panel .field-input { width: 100%; margin-bottom: 0.4rem; }
.pick-one-list { max-height: 18rem; overflow-y: auto; display: flex; flex-direction: column; }
.pick-one-option { display: block; width: 100%; text-align: left; background: none; border: none; border-radius: 6px; padding: 0.4rem 0.5rem; font: inherit; font-size: 0.85rem; color: var(--charcoal); cursor: pointer; }
.pick-one-option:hover { background: var(--stripe); }
.pick-one-option-on { background: var(--group-header-bg); font-weight: 600; }
.pick-one-none { font-size: 0.82rem; color: var(--muted); padding: 0.4rem 0.5rem; }
.pick-one-foot { font-size: 0.78rem; color: var(--muted); border-top: 1px solid var(--border); margin-top: 0.4rem; padding-top: 0.4rem; }
@media (max-width: 640px) { .pick-one-panel { position: fixed; top: auto; left: 0.5rem; right: 0.5rem; bottom: 0.5rem; width: auto; max-width: none; max-height: 75vh; } .pick-one-list { max-height: 45vh; } }

/* A folding group's links (Reference Lists, Site Settings, Access Control, Finances) start under the group's name, past
   its arrow, the way a section's links start under the section name; and a little room after them before the next
   group's heading (only while open: folded headings sit together as before). */
.sidebar-group-links {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding-left: calc(12px + 0.4rem);
    margin-bottom: 0.4rem;
}
