/* =====================================================================
   SPECTRE — base theme
   Rodinium Technologies

   Sections 1-6 are the shared base every theme builds on: a dark product
   UI whose tokens hold the LCARS palette. The primary accent (the --pp
   family, orange) drives buttons, active states and focus; a set of
   secondary --lc-* colours (gold, peach, tan, lilac, periwinkle, light
   blue, red) gives headings, labels, links and data their own hue.
   Every other theme (themes/*.css) redefines the tokens under its own
   body class and restyles the ornaments.

   Section 8 is the LCARS theme's own construction (frame, elbows, colour
   block menu, heading bars, pill buttons), scoped to body.theme-lcars so
   no other theme inherits those shapes.

   Sections
     1. Tokens
     2. Reset + base elements
     3. Layout: header, top menu, account, rail, drawer, main, footer
     4. Typography helpers (page-head, nav labels, colour classes)
     5. Components: buttons, forms, tables, cards, panels, flash,
        badges, pills, stat bar, pagination
     6. Bridge for hard-coded purple in inline styles
     7. Architecture hooks (off by default) + masthead banner + emblem
     8. LCARS construction (body.theme-lcars)

   ---------------------------------------------------------------------
   ARCHITECTURE HOOKS
   ---------------------------------------------------------------------
   layouts/app.blade.php carries a few empty, aria-hidden elements that a
   theme can shape into its own structure (frames, elbows, bars, plates,
   rivets...). They hold no content except short decorative readout
   numbers (e.g. "47-2390"), and they are display:none until a theme turns
   them on (section 7). A theme that styles none of them looks exactly as
   it did before they existed. Turn on only what you use, under your body
   class, e.g.  body.theme-x .sp-frame__elbow--top { display: block; ... }

   Header (inside .sp-header__inner, after the menu buttons):
     .sp-header__ornament              a strip for the header (LCARS: the
                                       bottom bar of the top frame)
       .sp-header__seg--1 ... --4      four segments, in this order:
                                       seg--1, seg--2, .sp-header__code,
                                       seg--3, seg--4
       .sp-header__code                readout number

   Masthead (the banner under the header; only rendered when a banner is
   shown, see section 7):
     .sp-masthead__cap--start / --end  blocks before and after the banner
       .sp-masthead__code              readout number (in the start cap)
     .sp-masthead__frame               always visible: the box round the
                                       picture (style it to frame the banner)

   Shell (children of .sp-shell, around the rail and main):
     .sp-frame__elbow--top             first child of .sp-shell
     .sp-frame__bars--top              second child: four .sp-frame__bar
       .sp-frame__bar--1 ... --4       segments (in order)
     .sp-frame__elbow--bottom          after .sp-main
     .sp-frame__bars--bottom           last child: four .sp-frame__bar
     .sp-frame__code                   readout number inside each elbow
     (LCARS turns .sp-shell into a grid for these at 901px and up; see
     section 8. .sp-shell stays display:flex for every other theme, where
     hidden hooks take no space.)

   Rail (inside aside.sp-rail):
     .sp-rail__cap--top                between .sp-rail__head and the nav
     .sp-rail__cap--bottom             after the nav
       .sp-rail__code                  readout number in each cap

   Page head (first child of main.sp-main, above flash messages and the
   page's own <h1 class="page-head">):
     .sp-main__ornament                a strip above the page heading
       .sp-main__code                  readout number (first)
       .sp-main__seg--1 ... --3        three segments (after the code)

   Brand:
     .sp-brand__emblem                 <img> that replaces .sp-brand__mark
                                       when an emblem is uploaded
     .sp-brand--emblem-small/medium/large   on .sp-brand when an emblem
                                       is shown (its chosen size). A theme
                                       sets --sp-emblem-max on .sp-brand to
                                       keep the emblem inside its header or
                                       brand block, and may size the block
                                       by these classes

   Uploaded banner (.sp-masthead--custom) also carries
     .sp-masthead--h-short/medium/tall and
     .sp-masthead--fit-fill/whole, and its <img> --sp-banner-focus
     (section 7). A theme only needs to style the frame round it.

   The Theme Builder's "Decorative bars" switch, when off, hides every
   hook above (App\Support\ThemeCss::ornamentCss, segmented_bars).
   ===================================================================== */


/* ---------------------------------------------------------------------
   1. TOKENS
   The --pp* names are the platform's accent contract: about a hundred
   views use them inline as var(--pp, …). Change the accent here and the
   whole site follows.
   --------------------------------------------------------------------- */
:root {
    color-scheme: dark;

    /* LCARS-inspired palette (secondary accents) */
    --lc-orange:  #ff9900;  --lc-orange-rgb: 255,153,0;
    --lc-gold:    #ffcc66;  --lc-gold-rgb:   255,204,102;
    --lc-peach:   #ff9966;  --lc-peach-rgb:  255,153,102;
    --lc-tan:     #ffcc99;  --lc-tan-rgb:    255,204,153;
    --lc-lilac:   #cc99cc;  --lc-lilac-rgb:  204,153,204;
    --lc-violet:  #9999ff;  --lc-violet-rgb: 153,153,255;   /* periwinkle */
    --lc-blue:    #99ccff;  --lc-blue-rgb:   153,204,255;
    --lc-blue-lt: #cce5ff;
    --lc-red:     #cc6666;  --lc-red-rgb:    204,102,102;

    /* primary accent (orange) */
    --pp:        #ff9900;
    --pp-lt:     #ffcc66;
    --pp-dk:     #cc7700;
    --pp-bg:     #1c1204;
    --pp-rgb:    255,153,0;
    --pp-lt-rgb: 255,204,102;
    --pp-dk-rgb: 204,119,0;
    --pp-ink:    #000000;            /* text placed on a solid accent fill */

    /* neutrals: pure black page, warm near-black surfaces */
    --sp-bg:          #000000;  --sp-bg-rgb:      0,0,0;
    --sp-bg-raised:   #000000;  --sp-bg-raised-rgb: 0,0,0;
    --sp-surface:     #111114;  --sp-surface-rgb: 17,17,20;
    --sp-surface-2:   #18181c;
    --sp-surface-3:   #222228;
    --sp-field:       #0a0a0c;
    --sp-line:        rgba(255,204,153,0.12);
    --sp-line-strong: rgba(255,204,153,0.22);
    --sp-text:        #f3e3cf;   /* light peach-white */
    --sp-text-dim:    #b9a994;
    --sp-text-hi:     #fff5e8;

    /* status */
    --sp-success: #33cc99;  --sp-success-rgb: 51,204,153;
    --sp-danger:  #f0605d;  --sp-danger-rgb:  240,96,93;
    --sp-warning: #ffd23f;  --sp-warning-rgb: 255,210,63;
    --sp-info:    var(--lc-blue);

    /* type */
    --sp-font-display: 'Antonio', 'Oxanium', 'Segoe UI', system-ui, sans-serif;
    --sp-font-body:    'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --sp-font-mono:    ui-monospace, 'Cascadia Code', Consolas, 'Liberation Mono', monospace;

    /* shape + layout */
    --sp-radius:    8px;
    --sp-radius-sm: 5px;
    --sp-header-h:  60px;
    --sp-rail-w:    244px;
    --sp-shell-max: 1480px;
    --sp-gutter:    clamp(16px, 2.4vw, 32px);
    --sp-ease:      cubic-bezier(0.2, 0.7, 0.2, 1);

    /* aliases still read by a few views */
    --sh-text:   var(--sp-text);
    --sh-dim:    var(--sp-text-dim);
    --sh-blue:   var(--pp);
    --sh-orange: var(--pp-lt);
    --accent:    var(--pp);
}


/* ---------------------------------------------------------------------
   2. RESET + BASE ELEMENTS
   Margins are zeroed and lists are unstyled by default (views were built
   on that); rich-text containers get their spacing and bullets back.
   --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body, h1, h2, h3, h4, h5, h6, p, blockquote, pre, figure, dl, dd, ol, ul, fieldset, legend { margin: 0; padding: 0; }
ol, ul { list-style: none; }
fieldset { border: 0; min-width: 0; }
img, svg, video, canvas { max-width: 100%; }
img { border: 0; height: auto; }
iframe { border: 0; max-width: 100%; }

body {
    min-height: 100vh;
    background-color: var(--sp-bg);
    background-image:
        radial-gradient(1100px 520px at 78% -220px, rgba(var(--pp-rgb),0.06), transparent 70%),
        radial-gradient(900px 600px at -10% 110%, rgba(var(--lc-lilac-rgb),0.05), transparent 70%);
    background-attachment: fixed;
    color: var(--sp-text);
    font: 400 1rem/1.6 var(--sp-font-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection { background: rgba(var(--pp-rgb),0.35); color: var(--sp-text-hi); }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--sp-font-display);
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: 0.01em;
    color: var(--sp-text-hi);
    margin: 0 0 0.6em;
}
h1 { font-size: 1.9rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; color: var(--pp-lt); }
h4 { font-size: 1.02rem; }
h5, h6 { font-size: 0.9rem; }

p { margin: 0 0 0.85em; }
p:last-child { margin-bottom: 0; }

a {
    color: var(--lc-blue);
    text-decoration: none;
    text-underline-offset: 0.18em;
    transition: color 0.15s;
}
a:hover { color: var(--lc-blue-lt); text-decoration: underline; }
a.image, a.image:hover { text-decoration: none; border: 0; }

strong, b { font-weight: 600; color: inherit; }
small { font-size: 0.85em; }

hr {
    height: 0;
    margin: 1.5em 0;
    border: 0;
    border-top: 1px solid var(--sp-line-strong);
}

blockquote {
    margin: 0 0 1em;
    padding: 0.6em 1em;
    border-left: 3px solid var(--pp-dk);
    background: rgba(var(--pp-rgb),0.05);
    border-radius: 0 var(--sp-radius-sm) var(--sp-radius-sm) 0;
}

code, pre, samp { font-family: var(--sp-font-mono); font-size: 0.9em; }
code {
    padding: 0.1em 0.35em;
    background: var(--sp-surface-2);
    border: 1px solid var(--sp-line);
    border-radius: 4px;
}
pre {
    padding: 12px 14px;
    background: var(--sp-field);
    border: 1px solid var(--sp-line);
    border-radius: var(--sp-radius-sm);
    overflow-x: auto;
}
pre code { padding: 0; border: 0; background: none; }

details > summary { cursor: pointer; }
legend { font-family: var(--sp-font-display); color: var(--lc-tan); font-weight: 600; margin-bottom: 0.4em; }
dt { font-weight: 600; color: var(--sp-text-hi); }
dd { margin: 0 0 0.6em; }

/* <kbd> is used as the field label in the classic "p > kbd + input" forms */
kbd {
    display: block;
    margin: 0 0 5px;
    font-family: var(--sp-font-display);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--lc-tan);
}

/* Rich text written by players / staff */
.post-content-wrap ul, .sp-prose ul { list-style: disc; padding-left: 1.4em; margin: 0 0 1em; }
.post-content-wrap ol, .sp-prose ol { list-style: decimal; padding-left: 1.6em; margin: 0 0 1em; }
.post-content-wrap li, .sp-prose li { margin: 0.2em 0; }

/* skip link */
.sp-skip {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 10001;
    padding: 8px 14px;
    background: var(--pp);
    color: var(--pp-ink);
    font-weight: 600;
    border-radius: var(--sp-radius-sm);
    transition: top 0.15s;
}
.sp-skip:focus { top: 10px; color: var(--pp-ink); text-decoration: none; }

/* screen-reader only */
.sp-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }


/* ---------------------------------------------------------------------
   3. LAYOUT
   --------------------------------------------------------------------- */

/* ---- header bar ---- */
.sp-header {
    position: sticky;
    top: 0;
    z-index: 900;
    background: rgba(var(--sp-bg-rgb),0.88);
    -webkit-backdrop-filter: saturate(140%) blur(12px);
    backdrop-filter: saturate(140%) blur(12px);
    border-bottom: 1px solid var(--sp-line);
}
.sp-header::after {             /* segmented LCARS-style bar under the brand */
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: min(calc(var(--sp-rail-w) + 120px), 60vw);
    height: 3px;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(90deg,
        var(--pp) 0 58%, transparent 58% 60%,
        var(--lc-lilac) 60% 78%, transparent 78% 80%,
        var(--lc-blue) 80% 100%);
    pointer-events: none;
}
.sp-header__inner {
    display: flex;
    align-items: center;
    gap: 18px;
    max-width: var(--sp-shell-max);
    height: var(--sp-header-h);
    margin: 0 auto;
    padding: 0 var(--sp-gutter);
}

/* brand */
.sp-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 0 1 auto;
    color: var(--sp-text-hi);
    text-decoration: none;
}
.sp-brand:hover { color: var(--sp-text-hi); text-decoration: none; }
.sp-brand__mark {
    position: relative;
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
}
.sp-brand__mark::before,
.sp-brand__mark::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    border: 2px solid var(--pp);
    transform: rotate(45deg);
    border-radius: 3px;
}
.sp-brand__mark::after {
    inset: 0;
    width: 8px;
    height: 8px;
    border: 0;
    background: var(--lc-gold);
    box-shadow: 0 0 10px rgba(var(--pp-rgb),0.7);
}
.sp-brand__mark::before { width: 18px; height: 18px; }
.sp-brand__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.sp-brand__name {
    font-family: var(--sp-font-display);
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sp-brand__tag {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sp-text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* top bar = main menu + account buttons (a dropdown panel on narrow screens) */
.sp-topbar {
    display: flex;
    align-items: center;
    gap: 18px;
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
}
.sp-topnav { flex: 1 1 auto; min-width: 0; height: 100%; }
.sp-topnav__list {
    display: flex;
    align-items: stretch;
    gap: 2px;
    height: 100%;
    overflow-x: auto;
    scrollbar-width: none;
}
.sp-topnav__list::-webkit-scrollbar { display: none; }
.sp-topnav__list > li { display: flex; }
.sp-topnav__link {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0 13px;
    font-family: var(--sp-font-display);
    font-size: 0.84rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--sp-text-dim);
    text-decoration: none;
    transition: color 0.15s, background-color 0.15s;
}
.sp-topnav__link::after {
    content: '';
    position: absolute;
    left: 13px;
    right: 13px;
    bottom: 0;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: var(--pp);
    transform: scaleX(0);
    transition: transform 0.2s var(--sp-ease);
}
.sp-topnav__link:hover { color: var(--sp-text-hi); text-decoration: none; }
.sp-topnav__link:hover::after { transform: scaleX(0.4); background: var(--lc-gold); }
.sp-topnav__link.active { color: var(--sp-text-hi); }
.sp-topnav__link.active::after { transform: scaleX(1); }

/* account buttons */
.sp-account { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.sp-account form { margin: 0; }
.sp-account__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    padding: 0 14px;
    font-family: var(--sp-font-display);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--sp-text);
    background: transparent;
    border: 1px solid var(--sp-line-strong);
    border-radius: var(--sp-radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}
.sp-account__btn:hover { color: var(--sp-text-hi); border-color: var(--pp); text-decoration: none; }
.sp-account__btn--primary { background: var(--pp); border-color: var(--pp); color: var(--pp-ink); border-radius: 999px; }
.sp-account__btn--primary:hover { background: var(--pp-lt); border-color: var(--pp-lt); color: var(--pp-ink); }

/* header icon buttons (drawer + menu toggles) */
.sp-iconbtn {
    display: none;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    padding: 0;
    color: var(--sp-text);
    background: transparent;
    border: 1px solid var(--sp-line-strong);
    border-radius: var(--sp-radius-sm);
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
    transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}
.sp-iconbtn:hover { color: var(--sp-text-hi); border-color: var(--pp); background: rgba(var(--pp-rgb),0.08); }
.sp-iconbtn svg { width: 20px; height: 20px; display: block; }
.sp-iconbtn .sp-ico-close { display: none; }
.sp-iconbtn[aria-expanded="true"] .sp-ico-open { display: none; }
.sp-iconbtn[aria-expanded="true"] .sp-ico-close { display: block; }
.sp-iconbtn[aria-expanded="true"] { border-color: var(--pp); color: var(--pp-lt); }

/* ---- shell: rail + main ---- */
.sp-shell {
    display: flex;
    align-items: flex-start;
    max-width: var(--sp-shell-max);
    margin: 0 auto;
    padding: 0 var(--sp-gutter);
    gap: clamp(18px, 2.2vw, 34px);
}

/* side navigation rail */
.sp-rail {
    position: sticky;
    top: var(--sp-header-h);
    flex: 0 0 var(--sp-rail-w);
    width: var(--sp-rail-w);
    max-height: calc(100vh - var(--sp-header-h));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px 0 28px;
    scrollbar-width: thin;
    scrollbar-color: var(--sp-surface-3) transparent;
}
/* Menu scroll bar on the left (Admin > Site Settings > Appearance "Menu scroll bar side",
   or the member's own choice in Account > Site Theme; App\Support\MenuScrollbar puts
   .sp-menu-scroll-left on <body>). #sp-rail is the menu's scroll box in every layout and
   theme, desktop rail and phone drawer alike: laid out right-to-left, the browser draws
   its vertical scroll bar on the left. Everything inside is set back to left-to-right, so
   text, icons, hover / current states and keyboard focus are unchanged. Only scrollTop is
   used to bring the current page's link into view, and it is not affected by direction. */
body.sp-menu-scroll-left #sp-rail { direction: rtl; }
body.sp-menu-scroll-left #sp-rail > * { direction: ltr; }
.sp-rail__head { display: none; }
.sp-rail__nav ul { margin: 0; padding: 0; list-style: none; }
.sp-rail__nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px 6px 14px;
    margin: 1px 0;
    font-size: 0.9rem;
    line-height: 1.35;
    color: var(--sp-text);
    text-decoration: none;
    border-radius: var(--sp-radius-sm);
    transition: color 0.15s, background-color 0.15s;
}
.sp-rail__nav a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: var(--pp);
    opacity: 0;
    transition: opacity 0.15s;
}
.sp-rail__nav a:hover { color: var(--sp-text-hi); background: rgba(var(--pp-rgb),0.07); text-decoration: none; }
.sp-rail__nav a.active { color: var(--sp-text-hi); background: rgba(var(--pp-rgb),0.12); font-weight: 500; }
.sp-rail__nav a.active::before { opacity: 1; }

/* count bubble on a rail link (e.g. open content flags) */
.sp-count {
    display: inline-block;
    min-width: 20px;
    margin-left: auto;
    padding: 0 6px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    color: #fff;
    background: var(--sp-danger);
    border-radius: 999px;
}

/* section labels + spacers inside the rail */
.nav-label {
    display: block;
    padding: 16px 14px 6px;
    font-family: var(--sp-font-display);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--lc-lilac);
    list-style: none;
}
.sp-rail__nav li.nav-label:first-child { padding-top: 4px; }
.spacer {
    display: block;
    height: 1px;
    margin: 12px 14px 4px;
    background: var(--sp-line);
    list-style: none;
}

/* scrim behind the mobile drawer */
.sp-scrim {
    position: fixed;
    inset: 0;
    z-index: 950;
    background: rgba(0,0,0,0.66);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0s linear 0.25s;
}

/* main content */
.sp-main {
    flex: 1 1 auto;
    min-width: 0;
    padding: 28px 0 48px;
    line-height: 1.6;
}
.sp-main:focus { outline: none; }
#sp-main:focus-visible, #sp-rail:focus-visible { outline: none !important; }   /* skip-link / drawer focus targets, not controls */
.sp-main::after { content: ''; display: table; clear: both; }   /* contain floated view content */

/* footer */
.sp-footer {
    border-top: 1px solid var(--sp-line);
    background: rgba(var(--sp-bg-raised-rgb),0.75);
}
.sp-footer__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 24px;
    max-width: var(--sp-shell-max);
    margin: 0 auto;
    padding: 22px var(--sp-gutter) 26px;
    font-size: 0.84rem;
    color: var(--sp-text-dim);
}
.sp-footer__links { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.sp-footer a { color: var(--sp-text); }
.sp-footer a:hover { color: var(--lc-blue-lt); }
.sp-footer__credit { text-align: right; }
.sp-footer__credit strong { color: var(--sp-text-hi); font-weight: 600; }
.sp-footer__legal { display: block; margin-top: 3px; font-size: 0.76rem; color: rgba(166,158,146,0.85); }

.sp-noscript {
    padding: 8px 16px;
    text-align: center;
    background: rgba(var(--sp-danger-rgb),0.18);
    border-bottom: 1px solid rgba(var(--sp-danger-rgb),0.5);
    color: var(--sp-text-hi);
}

/* ---- top menu collapses into a dropdown panel ---- */
@media (max-width: 1100px) {
    .sp-header__menu { display: inline-flex; margin-left: auto; }
    .sp-topbar {
        position: absolute;
        top: 100%;
        right: var(--sp-gutter);
        width: min(300px, calc(100vw - 2 * var(--sp-gutter)));
        height: auto;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px;
        margin-top: 8px;
        background: var(--sp-surface);
        border: 1px solid var(--sp-line-strong);
        border-radius: var(--sp-radius);
        box-shadow: 0 18px 40px rgba(0,0,0,0.55);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-6px);
        transition: opacity 0.18s, transform 0.18s var(--sp-ease), visibility 0s linear 0.18s;
    }
    .sp-topbar.is-open {
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: opacity 0.18s, transform 0.18s var(--sp-ease), visibility 0s;
    }
    .sp-topnav { height: auto; }
    .sp-topnav__list { flex-direction: column; height: auto; gap: 2px; overflow: visible; }
    .sp-topnav__list > li { display: block; }
    .sp-topnav__link {
        padding: 10px 12px;
        border-radius: var(--sp-radius-sm);
        color: var(--sp-text);
    }
    .sp-topnav__link::after { left: 0; right: auto; top: 9px; bottom: 9px; width: 2px; height: auto; transform: scaleY(0); }
    .sp-topnav__link:hover { background: rgba(var(--pp-rgb),0.08); }
    .sp-topnav__link:hover::after { transform: scaleY(0); }
    .sp-topnav__link.active { background: rgba(var(--pp-rgb),0.12); }
    .sp-topnav__link.active::after { transform: scaleY(1); }
    .sp-account {
        padding: 10px 4px 4px;
        margin-top: 6px;
        border-top: 1px solid var(--sp-line);
    }
    .sp-account > * { flex: 1 1 0; }
    .sp-account__btn { width: 100%; height: 38px; }
}

/* ---- rail becomes a slide-in drawer ---- */
@media (max-width: 900px) {
    .sp-header__drawer { display: inline-flex; }
    .sp-shell { display: block; }
    .sp-rail {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 1000;
        width: min(300px, 86vw);
        max-height: none;
        padding: 0 10px 40px;
        background: var(--sp-bg-raised);
        border-right: 1px solid var(--sp-line-strong);
        box-shadow: 18px 0 50px rgba(0,0,0,0.5);
        transform: translateX(-105%);
        visibility: hidden;
        transition: transform 0.26s var(--sp-ease), visibility 0s linear 0.26s;
    }
    .sp-rail.is-open {
        transform: none;
        visibility: visible;
        transition: transform 0.26s var(--sp-ease), visibility 0s;
    }
    .sp-rail__head {
        position: sticky;
        top: 0;
        z-index: 1;
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: var(--sp-header-h);
        margin: 0 -10px 6px;
        padding: 0 10px 0 24px;
        background: var(--sp-bg-raised);
        border-bottom: 1px solid var(--sp-line);
    }
    .sp-rail__title {
        font-family: var(--sp-font-display);
        font-size: 0.78rem;
        font-weight: 600;
        letter-spacing: 0.16em;
        text-transform: uppercase;
        color: var(--sp-text-dim);
    }
    .sp-rail__head .sp-iconbtn { display: inline-flex; }
    .sp-rail__nav a { padding: 10px 14px; font-size: 0.95rem; }
    .sp-scrim.is-open { opacity: 1; visibility: visible; transition: opacity 0.25s, visibility 0s; }
    .sp-main { padding-top: 22px; }
    html.sp-lock, html.sp-lock body { overflow: hidden; }
}

@media (max-width: 640px) {
    :root { --sp-header-h: 56px; --sp-gutter: 16px; }
    body { font-size: 15px; background-attachment: scroll; }
    .sp-header__inner { gap: 10px; }
    .sp-brand { gap: 10px; flex: 1 1 auto; }
    .sp-brand__mark { width: 22px; height: 22px; }
    .sp-brand__mark::before { width: 15px; height: 15px; }
    .sp-brand__mark::after { width: 6px; height: 6px; }
    .sp-brand__name { font-size: 0.98rem; letter-spacing: 0.04em; }
    .sp-brand__tag { display: none; }
    .sp-topbar { right: 0; left: 0; width: auto; margin: 0; border-radius: 0 0 var(--sp-radius) var(--sp-radius); border-left: 0; border-right: 0; }
    .sp-header::after { width: 40vw; }
    .sp-footer__inner { flex-direction: column; align-items: flex-start; }
    .sp-footer__credit { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
    .sp-rail, .sp-scrim, .sp-topbar, .sp-topnav__link::after { transition: none !important; }
}


/* ---------------------------------------------------------------------
   4. TYPOGRAPHY HELPERS
   --------------------------------------------------------------------- */
h1.page-head, .page-head {
    position: relative;
    margin: 0 0 0.9rem;
    padding-bottom: 0.55rem;
    font-family: var(--sp-font-display);
    font-size: 1.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--sp-text-hi);
    text-shadow: none;
}
h1.page-head::after, .page-head::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 120px;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg,
        var(--pp) 0 56px, transparent 56px 62px,
        var(--lc-lilac) 62px 92px, transparent 92px 98px,
        var(--lc-blue) 98px 120px);
}
h2.page-subhead, .page-subhead {
    margin: 1.6em 0 0.7em;
    padding-bottom: 6px;
    font-family: var(--sp-font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--lc-tan);
    border-bottom: 1px solid var(--sp-line-strong);
}

.text-muted, .gray { color: var(--sp-text-dim); }
.text-white       { color: var(--sp-text-hi); }
.text-purple      { color: var(--pp); }
.purple           { color: var(--pp-lt); }
.green            { color: var(--sp-success); }
.red              { color: var(--sp-danger); }
.orange           { color: var(--sp-warning); }
.blue             { color: var(--lc-blue); }

.bold      { font-weight: 700; }
.uppercase { text-transform: uppercase; }
.small     { font-size: 0.85em; }
.medium    { font-size: 1.08em; }
.nowrap    { white-space: nowrap; }
.align-right  { text-align: right !important; }
.align-center { text-align: center !important; }
.hidden    { display: none; }

/* "name" banner text (sign-in style pages) */
.name {
    font-family: var(--sp-font-display);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--sp-text-hi);
}

/* department colours (data-dept is the lower-cased department name) */
.dept-header { font-family: var(--sp-font-display); text-shadow: none !important; }
.dept-header a { color: inherit; }
.dept-header[data-dept*="command"]     { color: #e2b54a; }
.dept-header[data-dept="navigation"],
.dept-header[data-dept*="helm"]        { color: #f06a5a; }
.dept-header[data-dept*="tactical"],
.dept-header[data-dept*="security"],
.dept-header[data-dept*="weapon"],
.dept-header[data-dept*="combat"]      { color: #c9ced8; }
.dept-header[data-dept*="engineering"],
.dept-header[data-dept*="operations"],
.dept-header[data-dept*="systems"]     { color: #f3c94d; }
.dept-header[data-dept*="science"]     { color: #43d8c4; }
.dept-header[data-dept*="medical"],
.dept-header[data-dept*="counsel"]     { color: #eef2f8; }
.dept-header[data-dept*="general"],
.dept-header[data-dept*="crew"]        { color: #d79a62; }


/* ---------------------------------------------------------------------
   5. COMPONENTS
   --------------------------------------------------------------------- */

/* ---- buttons ---- */
button, .btn, input[type=submit], input[type=button], input[type=reset],
input.button-main, input.button-sec {
    display: inline-block;
    padding: 8px 18px;
    font-family: var(--sp-font-display);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    text-decoration: none;
    vertical-align: middle;
    color: var(--sp-text-hi);
    background: var(--sp-surface-2);
    border: 1px solid var(--sp-line-strong);
    border-radius: var(--sp-radius-sm);
    cursor: pointer;
    transition: color 0.15s, background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
button:hover, .btn:hover, input[type=submit]:hover, input[type=button]:hover, input[type=reset]:hover,
input.button-sec:hover {
    color: var(--sp-text-hi);
    background: var(--sp-surface-3);
    border-color: rgba(var(--pp-rgb),0.6);
    text-decoration: none;
}
.btn-primary, button.button-main, input.button-main {
    color: var(--pp-ink);
    background: var(--pp);
    border-color: var(--pp);
    border-radius: 999px;
}
.btn-primary:hover, button.button-main:hover, input.button-main:hover {
    color: var(--pp-ink);
    background: var(--pp-lt);
    border-color: var(--pp-lt);
    box-shadow: 0 0 0 3px rgba(var(--pp-rgb),0.18);
}
.btn-success { color: #d6fbe9; background: rgba(var(--sp-success-rgb),0.16); border-color: rgba(var(--sp-success-rgb),0.7); }
.btn-success:hover { color: #fff; background: rgba(var(--sp-success-rgb),0.3); border-color: var(--sp-success); }
.btn-danger { color: #ffe0df; background: rgba(var(--sp-danger-rgb),0.16); border-color: rgba(var(--sp-danger-rgb),0.7); }
.btn-danger:hover { color: #fff; background: rgba(var(--sp-danger-rgb),0.3); border-color: var(--sp-danger); }
.btn-sm, button.button-small, button.button-sec { padding: 4px 11px; font-size: 0.72rem; }
button[disabled], .btn[disabled], .btn.disabled, input[type=submit][disabled] {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

/* bookmark / like toggle */
.btn-bookmark {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 3px 12px;
    font-family: var(--sp-font-display);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--sp-text-dim);
    background: transparent;
    border: 1px solid var(--sp-line-strong);
    border-radius: 999px;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}
.btn-bookmark:hover { color: var(--pp-lt); border-color: var(--pp); background: rgba(var(--pp-rgb),0.06); text-decoration: none; }
.btn-bookmark.bookmarked { color: var(--pp-lt); border-color: var(--pp); background: rgba(var(--pp-rgb),0.14); }
.btn-bookmark.liked { color: #ffb4b2; border-color: rgba(var(--sp-danger-rgb),0.8); background: rgba(var(--sp-danger-rgb),0.12); }
.like-heart, .bm-star { font-size: 1.2em; line-height: 1; vertical-align: -0.05em; }

/* ---- form fields ---- */
input[type=text], input[type=email], input[type=password], input[type=search],
input[type=number], input[type=url], input[type=tel], input[type=date],
input[type=time], input[type=datetime-local], input[type=month], input[type=week],
input:not([type]), select, textarea, .form-control {
    max-width: 100%;
    padding: 7px 11px;
    font-family: var(--sp-font-body);
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--sp-text-hi);
    background: var(--sp-field);
    border: 1px solid var(--sp-line-strong);
    border-radius: var(--sp-radius-sm);
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
input[type=text], input[type=email], input[type=password], input[type=search],
input[type=url], input[type=tel], input:not([type]) { width: 18rem; }
textarea { width: 100%; min-height: 5.5em; resize: vertical; }
select { padding-right: 30px; cursor: pointer; }
input::placeholder, textarea::placeholder { color: rgba(166,158,146,0.75); }
input:hover, select:hover, textarea:hover, .form-control:hover { border-color: rgba(var(--pp-rgb),0.45); }
input:focus, select:focus, textarea:focus, .form-control:focus {
    outline: none;
    border-color: var(--pp);
    background: var(--sp-surface);
    box-shadow: 0 0 0 3px rgba(var(--pp-rgb),0.2);
}
input[disabled], select[disabled], textarea[disabled] { opacity: 0.55; cursor: not-allowed; }
input[type=checkbox], input[type=radio], input[type=range], progress { accent-color: var(--pp); }
input[type=checkbox], input[type=radio] { width: auto; cursor: pointer; }
input[type=file] { max-width: 100%; color: var(--sp-text-dim); font-size: 0.9rem; }
input[type=file]::file-selector-button {
    margin-right: 10px;
    padding: 6px 12px;
    font: 600 0.75rem var(--sp-font-display);
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--sp-text-hi);
    background: var(--sp-surface-3);
    border: 1px solid var(--sp-line-strong);
    border-radius: var(--sp-radius-sm);
    cursor: pointer;
}
input.small  { width: 4.5rem; }
input.medium { width: 8rem; }
input[type=color] { width: 44px; height: 34px; padding: 2px; background: var(--sp-field); border: 1px solid var(--sp-line-strong); border-radius: var(--sp-radius-sm); }

label { cursor: default; }
.form-group { display: block; margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-family: var(--sp-font-display);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--lc-tan);
}
/* a label wrapping a checkbox / radio reads as normal text */
.form-group label:has(> input[type=checkbox]), .form-group label:has(> input[type=radio]) {
    font-family: var(--sp-font-body);
    font-size: 0.92rem;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    color: var(--sp-text);
    cursor: pointer;
}
.form-group input[type=text], .form-group input[type=email], .form-group input[type=number],
.form-group input[type=date], .form-group input[type=time], .form-group input[type=url],
.form-group input[type=password], .form-group input[type=search], .form-group input[type=tel],
.form-group select, .form-group textarea {
    width: 100%;
    max-width: 600px;
}
.help, .form-group small, .form-group .help {
    display: block;
    margin-top: 5px;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--sp-text-dim);
}

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; border-spacing: 0; font-size: 0.94rem; }
th {
    padding: 9px 10px;
    text-align: left;
    vertical-align: bottom;
    font-family: var(--sp-font-display);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--lc-violet);
    border-bottom: 1px solid var(--sp-line-strong);
}
td {
    padding: 9px 10px;
    vertical-align: middle;
    border-bottom: 1px solid var(--sp-line);
}
tr:nth-child(even) td, tr.alt td { background: rgba(255,255,255,0.018); }
tr:hover td { background: rgba(var(--pp-rgb),0.05) !important; }
tr.light_gray td { background: var(--sp-surface-2); }

/* ---- cards + panels ---- */
.card, .panel {
    margin-bottom: 1rem;
    padding: 1rem 1.1rem;
    background: var(--sp-surface);
    border: 1px solid var(--sp-line);
    border-radius: var(--sp-radius);
    transition: border-color 0.2s;
}
.card:hover { border-color: var(--sp-line-strong); }
.card-header, .panel-header {
    margin: 0 0 12px;
    padding-bottom: 8px;
    font-family: var(--sp-font-display);
    font-size: 0.86rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--lc-lilac);
    border-bottom: 1px solid var(--sp-line);
}
.card-body, .panel-body { padding: 2px 0; }

/* ---- flash messages + alerts ---- */
.flash-success, .flash-error, .flash-info, .alert {
    position: relative;
    margin-bottom: 16px;
    padding: 11px 14px 11px 16px;
    font-size: 0.94rem;
    color: var(--sp-text-hi);
    background: var(--sp-surface);
    border: 1px solid var(--sp-line-strong);
    border-left-width: 3px;
    border-radius: var(--sp-radius-sm);
}
.flash-success, .alert-success { border-color: rgba(var(--sp-success-rgb),0.45); border-left-color: var(--sp-success); background: rgba(var(--sp-success-rgb),0.08); }
.flash-error, .alert-danger, .alert-error { border-color: rgba(var(--sp-danger-rgb),0.45); border-left-color: var(--sp-danger); background: rgba(var(--sp-danger-rgb),0.08); }
.flash-info, .alert-info { border-color: rgba(var(--lc-blue-rgb),0.4); border-left-color: var(--lc-blue); background: rgba(var(--lc-blue-rgb),0.07); }
.alert-warning { border-color: rgba(var(--sp-warning-rgb),0.45); border-left-color: var(--sp-warning); background: rgba(var(--sp-warning-rgb),0.08); }

/* ---- badges ---- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-family: var(--sp-font-display);
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    vertical-align: middle;
    color: var(--sp-text);
    background: var(--sp-surface-3);
    border: 1px solid var(--sp-line-strong);
    border-radius: 999px;
}
.badge-gray   { color: var(--sp-text-dim); }
.badge-purple { color: var(--pp-lt); background: rgba(var(--pp-rgb),0.12); border-color: rgba(var(--pp-rgb),0.5); }
.badge-green  { color: #a3f0d4; background: rgba(var(--sp-success-rgb),0.12); border-color: rgba(var(--sp-success-rgb),0.5); }
.badge-red    { color: #ffb4b2; background: rgba(var(--sp-danger-rgb),0.12); border-color: rgba(var(--sp-danger-rgb),0.5); }
.badge-yellow, .badge-warning { color: #ffe58f; background: rgba(var(--sp-warning-rgb),0.12); border-color: rgba(var(--sp-warning-rgb),0.5); }

/* ---- pills (filter chips) ---- */
a.pill, .pill {
    display: inline-block;
    margin: 2px 1px;
    padding: 2px 10px;
    font-family: var(--sp-font-display);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--sp-text);
    background: var(--sp-surface-2);
    border: 1px solid var(--sp-line-strong);
    border-radius: 999px;
    text-decoration: none;
    transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}
a.pill:hover { color: var(--sp-text-hi); border-color: var(--pp); text-decoration: none; }
a.pill.active, a.pill-active, .pill.active { color: var(--pp-ink); background: var(--pp); border-color: var(--pp); }

/* ---- stat bar ---- */
.stat-bar {
    display: flex;
    align-items: stretch;
    min-height: 84px;
    overflow: hidden;
    background: var(--sp-surface);
    border: 1px solid var(--sp-line);
    border-radius: var(--sp-radius);
}
.stat-item {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 112px;
    padding: 12px 8px;
    text-align: center;
    border-right: 1px solid var(--sp-line);
}
.stat-item:last-child { border-right: 0; }
.stat-item.stat-mission { flex: 1 1 auto; width: auto; padding: 12px 18px; }
.stat-number {
    font-family: var(--sp-font-display);
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--pp-lt);
}
.stat-mission .stat-number { font-size: 1.1rem; color: var(--sp-text-hi); }
.stat-label {
    margin-top: 3px;
    font-family: var(--sp-font-display);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sp-text-dim);
}

/* ---- images ---- */
.mission-banner {
    display: block;
    max-width: 100%;
    height: auto;
    border: 1px solid var(--sp-line);
    border-radius: var(--sp-radius);
}

/* ---- edit links ---- */
a.edit { color: var(--sp-warning); }
a.edit:hover { color: #ffe58f; }

/* ---- pagination (Laravel "default" / bootstrap views) ---- */
.pagination { display: flex; flex-wrap: wrap; gap: 4px; margin: 1em 0; padding: 0; list-style: none; }
.pagination li > a, .pagination li > span, .pagination .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    font-size: 0.88rem;
    color: var(--sp-text);
    background: var(--sp-surface);
    border: 1px solid var(--sp-line-strong);
    border-radius: var(--sp-radius-sm);
    text-decoration: none;
}
.pagination li > a:hover, .pagination .page-link:hover { border-color: var(--pp); color: var(--sp-text-hi); }
.pagination .active > span, .pagination .active .page-link { color: var(--pp-ink); background: var(--pp); border-color: var(--pp); font-weight: 600; }
.pagination .disabled > span, .pagination .disabled .page-link { opacity: 0.45; }


/* ---------------------------------------------------------------------
   6. BRIDGE: HARD-CODED PURPLE IN INLINE STYLES
   Older views carry the original purple as literal values in style=""
   attributes (stored content, or views not yet converted). Values
   written with var(--pp...) already follow the accent, so those elements
   are excluded; only literal purple is repainted. Purple inside <style>
   blocks can't be reached from here and is converted to the tokens in
   the views themselves.
   --------------------------------------------------------------------- */
:is(
    [style*="color:#a855f7" i], [style*="color: #a855f7" i],
    [style*="color:#8b5cf6" i], [style*="color: #8b5cf6" i],
    [style*="color:#7c3aed" i], [style*="color: #7c3aed" i]
):not([style*="var(--pp" i]):not(.dept-header):not([style*="background:#a855f7" i]):not([style*="background: #a855f7" i]):not([style*="background-color:#a855f7" i]) {
    color: var(--pp) !important;
}
:is(
    [style*="color:#c084fc" i], [style*="color: #c084fc" i],
    [style*="color:#a78bfa" i], [style*="color: #a78bfa" i],
    [style*="color:#818cf8" i], [style*="color: #818cf8" i]
):not([style*="var(--pp" i]):not(.dept-header):not([style*="background:#c084fc" i]):not([style*="background: #c084fc" i]) {
    color: var(--pp-lt) !important;
}
:is([style*="color:#6b21a8" i], [style*="color: #6b21a8" i]):not([style*="var(--pp" i]):not(.dept-header) {
    color: var(--pp-dk) !important;
}
:is(
    [style*="solid #a855f7" i], [style*="solid #c084fc" i], [style*="solid #6b21a8" i],
    [style*="solid rgba(168,85,247" i], [style*="solid rgba(168, 85, 247" i],
    [style*="solid rgba(107,33,168" i], [style*="solid rgba(192,132,252" i]
):not([style*="var(--pp" i]):not(.dept-header) {
    border-color: rgba(var(--pp-rgb),0.4) !important;
}
:is(
    [style*="background:#a855f7" i], [style*="background: #a855f7" i], [style*="background-color:#a855f7" i],
    [style*="background:#6b21a8" i], [style*="background: #6b21a8" i]
):not([style*="var(--pp" i]):not(.dept-header) {
    background: var(--pp) !important;
    color: var(--pp-ink) !important;
}
:is(
    [style*="background:rgba(168,85,247" i], [style*="background: rgba(168,85,247" i],
    [style*="background:rgba(107,33,168" i], [style*="background: rgba(107,33,168" i]
):not([style*="var(--pp" i]):not(.dept-header) {
    background-color: rgba(var(--pp-rgb),0.12) !important;
}
:is([style*="linear-gradient" i]):is([style*="#2d0a4e" i], [style*="#6b21a8" i]):not([style*="var(--pp" i]) {
    background-image: linear-gradient(135deg, var(--pp-bg), var(--pp-dk)) !important;
}

/* Example values shown under form fields */
.eg { display: block; margin-top: 3px; font-size: .85rem; color: var(--sp-text-dim); }
.eg::before { content: ''; display: inline-block; width: 14px; height: 6px; border-radius: 3px; background: var(--lc-lilac); margin-right: 7px; vertical-align: 2px; opacity: .8; }
.eg code { color: var(--lc-gold); }


/* ---------------------------------------------------------------------
   7. ARCHITECTURE HOOKS (default off) + MASTHEAD BANNER + EMBLEM
   The hook elements are documented at the top of this file. They stay
   hidden for every theme that does not switch them on.
   --------------------------------------------------------------------- */
.sp-header__ornament,
.sp-frame__elbow,
.sp-frame__bars,
.sp-rail__cap,
.sp-main__ornament,
.sp-masthead__cap { display: none; }

/* header emblem (Admin > Site Settings > Appearance), in place of the brand mark.
   --sp-emblem is the chosen size (Emblem size: .sp-brand--emblem-small / -medium /
   -large on .sp-brand; smaller on phones, see the 640px block below). It never
   grows past --sp-emblem-max, which each theme sets on .sp-brand to the room its
   header (or its brand block) has; the fallback is the header height less a margin. */
.sp-brand { --sp-emblem: 34px; }
.sp-brand--emblem-medium { --sp-emblem: 46px; }
.sp-brand--emblem-large  { --sp-emblem: 60px; }
.sp-brand__emblem {
    display: block;
    flex: 0 0 auto;
    width: min(var(--sp-emblem), var(--sp-emblem-max, calc(var(--sp-header-h) - 14px)));
    height: min(var(--sp-emblem), var(--sp-emblem-max, calc(var(--sp-header-h) - 14px)));
    object-fit: contain;
}

/* masthead banner: the uploaded banner, or the theme's own default banner
   (public/images/banners/<root theme>.svg, 1600 x 360) with the sim's name
   written over it in the theme's display face */
.sp-masthead {
    display: flex;
    align-items: stretch;
    max-width: var(--sp-shell-max);
    margin: 14px auto 0;
    padding: 0 var(--sp-gutter);
}
.sp-masthead__frame {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    background: var(--sp-bg-raised);
    border: 1px solid var(--sp-line);
    border-radius: var(--sp-radius);
}
.sp-masthead__img {
    display: block;
    width: 100%;
    height: clamp(110px, 16vw, 240px);
    max-width: none;
    object-fit: cover;
    object-position: center;
}
/* An uploaded banner: Banner height / Banner fit / Banner focus point
   (App\Support\BannerDisplay puts the classes on .sp-masthead and the focus on the
   img as --sp-banner-focus). Heights follow the frame's own width (container
   units: about the first figure on a phone, the last on a wide screen), so the
   settings preview draws exactly what the site draws; the vw line before each is
   for browsers without container units. A filled banner is cropped around the
   focus point at every width ("x% y%" keeps that point of the picture in view);
   "whole" never crops, and the frame's background shows round it. */
.sp-masthead--custom .sp-masthead__frame { container-type: inline-size; }
.sp-masthead--custom .sp-masthead__img { object-position: var(--sp-banner-focus, 50% 50%); }
.sp-masthead--h-short .sp-masthead__img {
    height: clamp(64px, 41px + 9.2vw, 170px);
    height: clamp(64px, 41px + 9.2cqw, 170px);
}
.sp-masthead--h-medium .sp-masthead__img {
    height: clamp(90px, 51px + 15.3vw, 260px);
    height: clamp(90px, 51px + 15.3cqw, 260px);
}
.sp-masthead--h-tall .sp-masthead__img {
    height: clamp(130px, 75px + 23.5vw, 400px);
    height: clamp(130px, 75px + 23.5cqw, 400px);
}
/* Sim name over an uploaded banner: a soft wash from the left keeps it readable on any picture. */
.sp-masthead--custom .sp-masthead__name {
    z-index: 2;
    padding: 0.5em 1.4em 0.5em 0;
}
.sp-masthead--custom .sp-masthead__name::before {
    content: "";
    position: absolute;
    inset: -35% -20% -35% -12%;
    z-index: -1;
    background: radial-gradient(closest-side, rgba(0,0,0,0.6), rgba(0,0,0,0));
    pointer-events: none;
}
.sp-masthead--fit-whole .sp-masthead__img { object-fit: contain; object-position: 50% 50%; }
.sp-masthead__name {
    position: absolute;
    left: clamp(16px, 5%, 72px);
    top: 50%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: min(62%, 760px);
    margin: 0;
    transform: translateY(-50%);
    pointer-events: none;
}
.sp-masthead__title {
    font-family: var(--sp-font-display);
    font-size: clamp(1.35rem, 3.4vw, 3rem);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sp-text-hi);
    text-shadow: 0 2px 14px rgba(0,0,0,0.85), 0 0 2px rgba(0,0,0,0.9);
    overflow-wrap: anywhere;
}
.sp-masthead__tag {
    font-family: var(--sp-font-display);
    font-size: clamp(0.72rem, 1.1vw, 0.95rem);
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--pp-lt);
    text-shadow: 0 1px 8px rgba(0,0,0,0.9);
}
@media (max-width: 640px) {
    .sp-masthead { margin-top: 10px; }
    .sp-masthead__img { height: clamp(84px, 27vw, 150px); }
    .sp-brand { --sp-emblem: 28px; }
    .sp-brand.sp-brand--emblem-medium { --sp-emblem: 34px; }
    .sp-brand.sp-brand--emblem-large  { --sp-emblem: 40px; }
}


/* =====================================================================
   8. LCARS CONSTRUCTION (body.theme-lcars)
   The LCARS theme's own structure, built on the hooks above. Everything
   is scoped to body.theme-lcars (Theme Builder themes built on LCARS get
   it too: their body has both classes). Shapes use the palette tokens, so
   a recoloured custom theme recolours the frame.

     8a. frame tokens + page
     8b. header: elbow block, segmented bottom bar, menu blocks, pills
     8c. masthead banner frame
     8d. shell frame (901px and up): elbows, bars, column, rail blocks
     8e. rail colour blocks (all widths)
     8f. headings: page head, sub head, card header bars
     8g. components: buttons, fields, tables, cards, flash, badges...
     8h. narrow screens: no elbows, compact header, drawer
   Low-specificity rules (:where(body.theme-lcars) + the base selector)
   restyle shared components without beating a view's own classes.
   ===================================================================== */

/* ---- 8a. frame tokens + page ---- */
body.theme-lcars {
    --sp-rail-w:   224px;
    --sp-header-h: 76px;
    --lcars-ink:   var(--pp-ink);  /* text on colour blocks */
    --lcars-gap:   4px;            /* black gap between blocks */
    --lcars-hbar:  14px;           /* header bottom bar */
    --lcars-bar:   20px;           /* shell frame bars */
    --lcars-outer-x: 72px;         /* elbow outer radius (horizontal / vertical) */
    --lcars-outer-y: 48px;
    --lcars-inner: 24px;           /* elbow inner (concave) radius */
    --lcars-pill:  999px;          /* pill ends; the Theme Builder's pill switch can square it */
    background-image: none;
}

/* readout numbers in bar ends and blocks */
body.theme-lcars :is(.sp-header__code, .sp-frame__code, .sp-rail__code, .sp-main__code, .sp-masthead__code) {
    font-family: var(--sp-font-display);
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.12em;
    white-space: nowrap;
    user-select: none;
}

/* ---- 8b. header ---- */
body.theme-lcars .sp-header {
    background: var(--sp-bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-bottom: 0;
}
body.theme-lcars .sp-header::after { display: none; }   /* the ornament draws the bar */
body.theme-lcars .sp-header__inner {
    position: relative;
    align-items: stretch;
    gap: 10px;
    padding-bottom: calc(var(--lcars-hbar) + 8px);
}
/* brand = the upper frame's column, sweeping down into the bottom bar */
body.theme-lcars .sp-brand {
    flex: 0 0 var(--sp-rail-w);
    width: var(--sp-rail-w);
    margin-bottom: calc(-1 * (var(--lcars-hbar) + 8px));
    padding: 6px 16px calc(var(--lcars-hbar) + 10px) 18px;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    color: var(--lcars-ink);
    background: var(--lc-orange);
    border-bottom-left-radius: var(--lcars-outer-x) var(--lcars-outer-y);
}
body.theme-lcars .sp-brand:hover { color: var(--lcars-ink); background: var(--lc-gold); }
body.theme-lcars .sp-brand__text { align-items: flex-end; text-align: right; }
body.theme-lcars .sp-brand__name { font-size: 1.4rem; font-weight: 700; letter-spacing: 0.05em; line-height: 1.05; }
body.theme-lcars .sp-brand__tag { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.16em; color: var(--lcars-ink); }
body.theme-lcars .sp-brand__mark::before { border-color: var(--lcars-ink); }
body.theme-lcars .sp-brand__mark::after { background: var(--lcars-ink); box-shadow: none; }
body.theme-lcars .sp-brand:focus-visible { outline-offset: -5px !important; outline-color: var(--lcars-ink) !important; }

/* the bottom bar of the upper frame */
body.theme-lcars .sp-header__ornament {
    position: absolute;
    left: calc(var(--sp-gutter) + var(--sp-rail-w));
    right: var(--sp-gutter);
    bottom: 0;
    display: flex;
    align-items: stretch;
    gap: var(--lcars-gap);
    height: var(--lcars-hbar);
    pointer-events: none;
}
body.theme-lcars .sp-header__ornament::before {   /* inner curve where the column meets the bar */
    content: '';
    position: absolute;
    left: 0;
    bottom: 100%;
    width: var(--lcars-inner);
    height: var(--lcars-inner);
    background: radial-gradient(circle at 100% 0, transparent calc(var(--lcars-inner) - 0.5px), var(--lc-orange) var(--lcars-inner));
}
body.theme-lcars .sp-header__seg--1 { flex: 1 1 auto; background: var(--lc-orange); }
body.theme-lcars .sp-header__seg--2 { flex: 0 0 14%; background: var(--lc-lilac); }
body.theme-lcars .sp-header__seg--3 { flex: 0 0 8%; background: var(--lc-violet); }
body.theme-lcars .sp-header__seg--4 { flex: 0 0 44px; background: var(--lc-tan); border-radius: 0 var(--lcars-pill) var(--lcars-pill) 0; }
body.theme-lcars .sp-header__code {
    display: flex;
    align-items: center;
    padding: 0 4px;
    color: var(--lc-orange);
}
body.theme-lcars .sp-header__seg { display: block; }

/* main menu: a row of colour blocks, pill ends at both ends of the row */
@media (min-width: 1101px) {
    body.theme-lcars .sp-topbar { align-items: center; gap: 12px; height: auto; }
    body.theme-lcars .sp-topnav { height: auto; }
    body.theme-lcars .sp-topnav__list { align-items: center; gap: var(--lcars-gap); height: auto; }
    body.theme-lcars .sp-topnav__link {
        height: 34px;
        padding: 0 12px 4px 14px;
        align-items: flex-end;
        font-size: 1rem;
        font-weight: 600;
        letter-spacing: 0.06em;
        color: var(--lcars-ink);
        background: var(--lc-peach);
    }
    body.theme-lcars .sp-topnav__list > li:nth-child(6n+2) > .sp-topnav__link { background: var(--lc-lilac); }
    body.theme-lcars .sp-topnav__list > li:nth-child(6n+3) > .sp-topnav__link { background: var(--lc-tan); }
    body.theme-lcars .sp-topnav__list > li:nth-child(6n+4) > .sp-topnav__link { background: var(--lc-violet); }
    body.theme-lcars .sp-topnav__list > li:nth-child(6n+5) > .sp-topnav__link { background: var(--lc-gold); }
    body.theme-lcars .sp-topnav__list > li:nth-child(6n+6) > .sp-topnav__link { background: var(--lc-blue); }
    body.theme-lcars .sp-topnav__list > li:first-child > .sp-topnav__link { padding-left: 20px; border-radius: var(--lcars-pill) 0 0 var(--lcars-pill); }
    body.theme-lcars .sp-topnav__list > li:last-child > .sp-topnav__link { padding-right: 20px; border-radius: 0 var(--lcars-pill) var(--lcars-pill) 0; }
    body.theme-lcars .sp-topnav__link::after { display: none; }
    body.theme-lcars .sp-topnav__link:hover { color: var(--lcars-ink); background-image: linear-gradient(rgba(255,255,255,0.3), rgba(255,255,255,0.3)); }
    body.theme-lcars .sp-topnav__list > li > .sp-topnav__link.active { color: var(--lcars-ink); background: var(--sp-text-hi); box-shadow: inset 0 -6px 0 var(--pp); }
}
/* menu blocks sit in a scrolling row: draw the focus ring inside the block */
body.theme-lcars .sp-topnav__link:focus-visible,
body.theme-lcars .sp-rail__nav a:focus-visible {
    outline: 3px solid var(--lcars-ink) !important;
    outline-offset: -6px !important;
    text-decoration: underline;
}

/* account buttons + header toggles: pills */
body.theme-lcars .sp-account__btn {
    height: 34px;
    padding: 0 18px 1px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--lcars-ink);
    background: var(--lc-violet);
    border: 0;
    border-radius: var(--lcars-pill);
}
body.theme-lcars .sp-account__btn--primary { background: var(--lc-orange); }
body.theme-lcars .sp-account__btn:hover { color: var(--lcars-ink); background-image: linear-gradient(rgba(255,255,255,0.3), rgba(255,255,255,0.3)); }
body.theme-lcars .sp-iconbtn {
    align-self: center;
    width: 52px;
    height: 36px;
    color: var(--lcars-ink);
    background: var(--lc-lilac);
    border: 0;
    border-radius: var(--lcars-pill);
}
body.theme-lcars .sp-iconbtn:hover { color: var(--lcars-ink); background: var(--lc-gold); }
body.theme-lcars .sp-iconbtn[aria-expanded="true"] { color: var(--lcars-ink); background: var(--sp-text-hi); }
body.theme-lcars .sp-header__menu { background: var(--lc-violet); }

/* ---- 8c. masthead: framed by bars and end caps ---- */
body.theme-lcars .sp-masthead { gap: var(--lcars-gap); margin-top: 8px; }
body.theme-lcars .sp-masthead__cap {
    display: flex;
    flex: 0 0 22px;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 0 10px 8px 0;
    color: var(--lcars-ink);
    background: var(--lc-violet);
}
body.theme-lcars .sp-masthead__cap--start {
    flex-basis: 96px;
    background: var(--lc-peach);
    border-radius: 40px 0 0 40px;
}
body.theme-lcars .sp-masthead__cap--end { border-radius: 0 40px 40px 0; flex-basis: 40px; }
body.theme-lcars .sp-masthead__frame {
    padding: var(--lcars-gap) 0;
    background: var(--sp-bg);
    border: 0;
    border-top: 10px solid var(--lc-orange);
    border-bottom: 10px solid var(--lc-lilac);
    border-radius: 0;
}
body.theme-lcars .sp-masthead__title { letter-spacing: 0.08em; color: var(--sp-text-hi); }
body.theme-lcars .sp-masthead__tag { color: var(--lc-orange); }

/* ---- 8d. shell frame: elbows + bars round the content (wide screens) ----
   grid:      column 1 (rail width)        column 2 (content)
   row 1      .sp-frame__elbow--top        .sp-frame__bars--top
   row 2      .sp-rail (sticky)            .sp-main
   row 2-3    .sp-frame__elbow--bottom     (row 3) .sp-frame__bars--bottom
   The bottom elbow fills column 1 behind the rail, so the frame column
   runs unbroken from the rail down into the bottom sweep. */
@media (min-width: 901px) {
    body.theme-lcars .sp-shell {
        display: grid;
        grid-template-columns: var(--sp-rail-w) minmax(0, 1fr);
        grid-template-rows: auto 1fr 64px;
        align-items: start;
        gap: 0;
        margin-top: 10px;
    }
    body.theme-lcars .sp-frame__elbow--top {
        position: relative;
        display: flex;
        align-items: flex-end;
        justify-content: flex-end;
        grid-column: 1;
        grid-row: 1;
        height: 64px;
        padding: 0 14px 8px 0;
        color: var(--lcars-ink);
        background: var(--lc-lilac);
        border-top-left-radius: var(--lcars-outer-x) var(--lcars-outer-y);
    }
    body.theme-lcars .sp-frame__elbow--top::after {
        content: '';
        position: absolute;
        left: 100%;
        top: var(--lcars-bar);
        width: var(--lcars-inner);
        height: var(--lcars-inner);
        background: radial-gradient(circle at 100% 100%, transparent calc(var(--lcars-inner) - 0.5px), var(--lc-lilac) var(--lcars-inner));
    }
    body.theme-lcars .sp-frame__bars {
        display: flex;
        gap: var(--lcars-gap);
        grid-column: 2;
        height: var(--lcars-bar);
    }
    body.theme-lcars .sp-frame__bars--top { grid-row: 1; align-self: start; }
    body.theme-lcars .sp-frame__bars--bottom { grid-row: 3; align-self: end; }
    body.theme-lcars .sp-frame__bar { display: block; }
    body.theme-lcars .sp-frame__bars--top .sp-frame__bar--1 { flex: 1 1 auto; background: var(--lc-lilac); }
    body.theme-lcars .sp-frame__bars--top .sp-frame__bar--2 { flex: 0 0 16%; background: var(--lc-orange); }
    body.theme-lcars .sp-frame__bars--top .sp-frame__bar--3 { flex: 0 0 72px; background: var(--lc-gold); }
    body.theme-lcars .sp-frame__bars--top .sp-frame__bar--4 { flex: 0 0 40px; background: var(--lc-peach); border-radius: 0 var(--lcars-pill) var(--lcars-pill) 0; }
    body.theme-lcars .sp-frame__bars--bottom .sp-frame__bar--1 { flex: 1 1 auto; background: var(--lc-peach); }
    body.theme-lcars .sp-frame__bars--bottom .sp-frame__bar--2 { flex: 0 0 9%; background: var(--lc-violet); }
    body.theme-lcars .sp-frame__bars--bottom .sp-frame__bar--3 { flex: 0 0 22%; background: var(--lc-tan); }
    body.theme-lcars .sp-frame__bars--bottom .sp-frame__bar--4 { flex: 0 0 40px; background: var(--lc-red); border-radius: 0 var(--lcars-pill) var(--lcars-pill) 0; }
    body.theme-lcars .sp-frame__elbow--bottom {
        position: relative;
        display: flex;
        align-items: flex-end;
        justify-content: flex-end;
        grid-column: 1;
        grid-row: 2 / 4;
        align-self: stretch;
        padding: 0 14px calc(var(--lcars-bar) + 10px) 0;
        color: var(--lcars-ink);
        background: var(--lc-peach);
        border-bottom-left-radius: var(--lcars-outer-x) var(--lcars-outer-y);
    }
    body.theme-lcars .sp-frame__elbow--bottom::after {
        content: '';
        position: absolute;
        left: 100%;
        bottom: var(--lcars-bar);
        width: var(--lcars-inner);
        height: var(--lcars-inner);
        background: radial-gradient(circle at 100% 0, transparent calc(var(--lcars-inner) - 0.5px), var(--lc-peach) var(--lcars-inner));
    }
    body.theme-lcars .sp-rail {
        z-index: 1;
        grid-column: 1;
        grid-row: 2;
        align-self: start;
        padding: var(--lcars-gap) 0;
        background: var(--sp-bg);
        scrollbar-color: var(--lc-lilac) var(--sp-bg);
    }
    body.theme-lcars .sp-main {
        grid-column: 2;
        grid-row: 2;
        padding: 12px 0 36px 34px;
    }
}

/* ---- 8e. rail: a column of colour blocks (all widths) ---- */
body.theme-lcars .sp-rail__cap {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 0 12px 5px;
    color: var(--lcars-ink);
}
body.theme-lcars .sp-rail__cap--top { height: 28px; margin-bottom: var(--lcars-gap); background: var(--lc-lilac); }
body.theme-lcars .sp-rail__cap--bottom { height: 46px; background: var(--lc-peach); }
body.theme-lcars .sp-rail__nav li { margin: 0 0 var(--lcars-gap); }
body.theme-lcars .sp-rail__nav a {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 8px;
    min-height: 34px;
    margin: 0;
    padding: 6px 14px 4px;
    font-family: var(--sp-font-display);
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: 0.05em;
    text-align: right;
    text-transform: uppercase;
    color: var(--lcars-ink);
    background: var(--lc-orange);
    border-radius: 0;
}
body.theme-lcars .sp-rail__list > li:nth-child(7n+2) > a { background: var(--lc-tan); }
body.theme-lcars .sp-rail__list > li:nth-child(7n+3) > a { background: var(--lc-lilac); }
body.theme-lcars .sp-rail__list > li:nth-child(7n+4) > a { background: var(--lc-violet); }
body.theme-lcars .sp-rail__list > li:nth-child(7n+5) > a { background: var(--lc-peach); }
body.theme-lcars .sp-rail__list > li:nth-child(7n+6) > a { background: var(--lc-gold); }
body.theme-lcars .sp-rail__list > li:nth-child(7n+7) > a { background: var(--lc-blue); }
body.theme-lcars .sp-rail__nav a:hover {
    color: var(--lcars-ink);
    background-image: linear-gradient(rgba(255,255,255,0.3), rgba(255,255,255,0.3));
    text-decoration: none;
}
/* current page: bright block with an inset bar on the content side */
body.theme-lcars .sp-rail__list > li > a.active {
    color: var(--lcars-ink);
    background: var(--sp-text-hi);
    font-weight: 700;
}
body.theme-lcars .sp-rail__nav a::before {
    left: auto;
    right: 0;
    top: 0;
    bottom: 0;
    width: 10px;
    border-radius: 0;
    background: var(--pp);
}
body.theme-lcars .sp-rail__nav a .sp-count {
    order: -1;
    margin: 0 auto 1px 0;
    font-family: var(--sp-font-body);
    color: var(--sp-text-hi);
    background: var(--sp-bg);
}
/* section label: a red block; spacer: a blank block */
body.theme-lcars .sp-rail__nav li.nav-label,
body.theme-lcars .sp-rail__nav li.nav-label:first-child {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    min-height: 42px;
    padding: 6px 14px 5px;
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    line-height: 1.1;
    text-align: right;
    color: var(--lcars-ink);
    background: var(--lc-red);
}
body.theme-lcars .sp-rail__nav li.spacer {
    height: 18px;
    margin: 0 0 var(--lcars-gap);
    background: var(--pp-dk);
}
body.theme-lcars .sp-rail__nav li.menu-filter-search a { font-style: normal; }
/* "Find in menu" box at the top of the rail */
body.theme-lcars .menu-filter { padding: 2px 0 8px; }
body.theme-lcars .menu-filter .menu-filter__input {
    padding: 6px 14px;
    color: var(--sp-text-hi);
    background: var(--sp-bg);
    border: 2px solid var(--lc-violet);
    border-radius: var(--lcars-pill);
}
body.theme-lcars .menu-filter .menu-filter__input:focus { border-color: var(--lc-orange); box-shadow: 0 0 0 2px rgba(var(--pp-rgb),0.3); }
body.theme-lcars .menu-filter .menu-filter__input::placeholder { color: var(--sp-text-dim); opacity: 1; }
body.theme-lcars .menu-filter__status { padding: 4px 6px 0; text-align: right; color: var(--lc-tan); opacity: 1; }

/* page head ornament: a small readout strip above the heading */
body.theme-lcars .sp-main__ornament {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--lcars-gap);
    height: 10px;
    margin: 0 0 14px;
}
body.theme-lcars .sp-main__code { margin-right: 6px; color: var(--lc-violet); }
body.theme-lcars .sp-main__seg { display: block; height: 10px; }
body.theme-lcars .sp-main__seg--1 { width: 64px; background: var(--lc-violet); border-radius: var(--lcars-pill) 0 0 var(--lcars-pill); }
body.theme-lcars .sp-main__seg--2 { width: 24px; background: var(--lc-gold); }
body.theme-lcars .sp-main__seg--3 { width: 120px; background: var(--lc-tan); border-radius: 0 var(--lcars-pill) var(--lcars-pill) 0; }

/* ---- 8f. headings ---- */
body.theme-lcars :is(.page-head, .page-subhead, h1, h2) { text-transform: uppercase; letter-spacing: 0.05em; }
/* page title: accent text between a capped block and a bar that fills the line */
body.theme-lcars :is(h1.page-head, .page-head) {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 14px;
    margin: 0 0 1.1rem;
    padding-bottom: 0;
    font-size: 2.1rem;
    font-weight: 600;
    line-height: 1.08;
    color: var(--pp);
}
body.theme-lcars :is(h1.page-head, .page-head)::before,
body.theme-lcars :is(h1.page-head, .page-head)::after {
    content: '';
    position: static;
    height: 0.62em;
    min-height: 16px;
    clip-path: none;
    box-shadow: none;
}
body.theme-lcars :is(h1.page-head, .page-head)::before {
    flex: 0 0 34px;
    background: var(--lc-violet);
    border-radius: var(--lcars-pill) 0 0 var(--lcars-pill);
}
body.theme-lcars :is(h1.page-head, .page-head)::after {
    flex: 1 1 0;
    width: auto;
    min-width: 40px;
    background: var(--lc-lilac);
    border-radius: 0 var(--lcars-pill) var(--lcars-pill) 0;
}
/* section title: tan text, a short cap and a thin bar */
body.theme-lcars :is(h2.page-subhead, .page-subhead) {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 0;
    font-size: 1.3rem;
    color: var(--lc-tan);
    border-bottom: 0;
}
body.theme-lcars :is(h2.page-subhead, .page-subhead)::before,
body.theme-lcars :is(h2.page-subhead, .page-subhead)::after {
    content: '';
    height: 0.5em;
    background: var(--lc-tan);
}
body.theme-lcars :is(h2.page-subhead, .page-subhead)::before { flex: 0 0 18px; border-radius: var(--lcars-pill) 0 0 var(--lcars-pill); }
body.theme-lcars :is(h2.page-subhead, .page-subhead)::after { flex: 1 1 0; min-width: 30px; height: 0.3em; opacity: 0.55; border-radius: 0 var(--lcars-pill) var(--lcars-pill) 0; }
:where(body.theme-lcars) h3 { letter-spacing: 0.04em; }
:where(body.theme-lcars) legend, :where(body.theme-lcars) kbd { font-size: 0.9rem; letter-spacing: 0.08em; }

/* ---- 8g. components ---- */
/* panels: black body with a coloured rule on the left; the header is a
   colour bar with a pill end that meets the rule in a small elbow */
:where(body.theme-lcars) .card,
:where(body.theme-lcars) .panel {
    position: relative;
    padding: 0 0 14px 22px;
    background: var(--sp-bg);
    border: 0;
    border-radius: 0;
}
:where(body.theme-lcars) .card::before,
:where(body.theme-lcars) .panel::before {
    content: '';
    position: absolute;
    left: 0;
    top: 16px;
    bottom: 0;
    width: 6px;
    background: var(--lc-lilac);
    border-radius: 0 0 0 3px;
}
:where(body.theme-lcars) .card:hover { border-color: transparent; }
:where(body.theme-lcars) .card-header,
:where(body.theme-lcars) .panel-header {
    position: relative;
    min-height: 32px;
    margin: 0 0 14px;
    padding: 6px 24px 5px 16px;
    font-size: 1.02rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    line-height: 1.25;
    color: var(--lcars-ink);
    background: var(--lc-lilac);
    border: 0;
    border-radius: 16px var(--lcars-pill) var(--lcars-pill) 0;
}
/* the header reaches back over the rule (cards with their own inline padding keep it inside) */
:where(body.theme-lcars) :is(.card, .panel):not([style*="padding"]) > :is(.card-header, .panel-header) { margin-left: -22px; }
:where(body.theme-lcars) :is(.card, .panel):not([style*="padding"]) > :is(.card-header, .panel-header)::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 100%;
    width: 12px;
    height: 12px;
    background: radial-gradient(circle at 100% 100%, transparent 11.5px, var(--lc-lilac) 12px);
}
:where(body.theme-lcars) .card-header a, :where(body.theme-lcars) .panel-header a { color: var(--lcars-ink); text-decoration: underline; }
:where(body.theme-lcars) .card-body, :where(body.theme-lcars) .panel-body { padding: 2px 6px 2px 0; }

/* buttons: solid pills, black condensed capitals, no borders */
:where(body.theme-lcars) button,
:where(body.theme-lcars) .btn,
:where(body.theme-lcars) input[type=submit],
:where(body.theme-lcars) input[type=button],
:where(body.theme-lcars) input[type=reset],
:where(body.theme-lcars) input.button-sec {
    padding: 8px 20px 7px;
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    line-height: 1.15;
    color: var(--lcars-ink);
    background: var(--lc-violet);
    border: 0;
    border-radius: var(--lcars-pill);
}
:where(body.theme-lcars) button:hover,
:where(body.theme-lcars) .btn:hover,
:where(body.theme-lcars) input[type=submit]:hover,
:where(body.theme-lcars) input[type=button]:hover,
:where(body.theme-lcars) input[type=reset]:hover,
:where(body.theme-lcars) input.button-sec:hover {
    color: var(--lcars-ink);
    background-color: var(--lc-blue);
    border-color: transparent;
}
:where(body.theme-lcars) .btn-primary,
:where(body.theme-lcars) button.button-main,
:where(body.theme-lcars) input.button-main { color: var(--lcars-ink); background: var(--lc-orange); border: 0; }
:where(body.theme-lcars) .btn-primary:hover,
:where(body.theme-lcars) button.button-main:hover,
:where(body.theme-lcars) input.button-main:hover { color: var(--lcars-ink); background: var(--lc-gold); box-shadow: none; }
:where(body.theme-lcars) .btn-success { color: var(--lcars-ink); background: var(--sp-success); border: 0; }
:where(body.theme-lcars) .btn-success:hover { color: var(--lcars-ink); background: #6fe0b9; }
:where(body.theme-lcars) .btn-danger { color: var(--lcars-ink); background: var(--lc-red); border: 0; }
:where(body.theme-lcars) .btn-danger:hover { color: var(--lcars-ink); background: var(--sp-danger); }
:where(body.theme-lcars) .btn-sm,
:where(body.theme-lcars) button.button-small,
:where(body.theme-lcars) button.button-sec { padding: 5px 14px 4px; font-size: 0.85rem; }
:where(body.theme-lcars) input[type=file]::file-selector-button {
    padding: 6px 16px 5px;
    font: 600 0.9rem var(--sp-font-display);
    color: var(--lcars-ink);
    background: var(--lc-violet);
    border: 0;
    border-radius: var(--lcars-pill);
}
:where(body.theme-lcars) .btn-bookmark { font-size: 0.9rem; }

/* fields: black wells with a periwinkle edge */
:where(body.theme-lcars) input[type=text], :where(body.theme-lcars) input[type=email],
:where(body.theme-lcars) input[type=password], :where(body.theme-lcars) input[type=search],
:where(body.theme-lcars) input[type=number], :where(body.theme-lcars) input[type=url],
:where(body.theme-lcars) input[type=tel], :where(body.theme-lcars) input[type=date],
:where(body.theme-lcars) input[type=time], :where(body.theme-lcars) input[type=datetime-local],
:where(body.theme-lcars) input:not([type]), :where(body.theme-lcars) select,
:where(body.theme-lcars) textarea, :where(body.theme-lcars) .form-control {
    background-color: var(--sp-field);
    border-color: rgba(var(--lc-violet-rgb),0.5);
}
:where(body.theme-lcars) .form-group label { font-size: 0.92rem; }

/* tables: colour header bars with pill ends, gaps between cells
   (separate borders: cells only take rounded corners in that model) */
:where(body.theme-lcars) table { border-collapse: separate; border-spacing: 0; }
:where(body.theme-lcars) th {
    padding: 6px 12px 5px;
    vertical-align: middle;
    font-size: 0.92rem;
    color: var(--lcars-ink);
    background: var(--lc-violet);
    background-clip: padding-box;
    border: solid transparent;
    border-width: 0 var(--lcars-gap) var(--lcars-gap) 0;
}
:where(body.theme-lcars) th:last-child { border-right-width: 0; }
:where(body.theme-lcars) th a { color: inherit; }
:where(body.theme-lcars) thead th { background-color: var(--lc-orange); }
:where(body.theme-lcars) thead th:first-child,
:where(body.theme-lcars) tbody:first-child > tr:first-child:not(:has(td)) > th:first-child { border-radius: 16px 0 0 16px; }
:where(body.theme-lcars) thead th:last-child,
:where(body.theme-lcars) tbody:first-child > tr:first-child:not(:has(td)) > th:last-child { border-radius: 0 16px 16px 0; }
:where(body.theme-lcars) thead th:only-child { border-radius: 16px; }
:where(body.theme-lcars) td { border-bottom-color: rgba(var(--lc-violet-rgb),0.22); }

/* post cards, list rows, tag chips: in components.css (it loads after this file) */

/* flash messages: a status-colour block on the left */
:where(body.theme-lcars) .flash-success, :where(body.theme-lcars) .flash-error,
:where(body.theme-lcars) .flash-info, :where(body.theme-lcars) .alert {
    border-width: 0 0 0 14px;
    border-radius: 14px 0 0 14px;
}

/* badges and filter pills: solid pills with black text */
:where(body.theme-lcars) .badge {
    padding: 2px 10px 1px;
    font-size: 0.78rem;
    color: var(--lcars-ink);
    background: var(--lc-tan);
    border: 0;
    border-radius: var(--lcars-pill);
}
:where(body.theme-lcars) .badge-gray   { color: var(--lcars-ink); background: #a49c90; }
:where(body.theme-lcars) .badge-purple { color: var(--lcars-ink); background: var(--lc-orange); }
:where(body.theme-lcars) .badge-green  { color: var(--lcars-ink); background: var(--sp-success); }
:where(body.theme-lcars) .badge-red    { color: var(--lcars-ink); background: var(--sp-danger); }
:where(body.theme-lcars) .badge-yellow, :where(body.theme-lcars) .badge-warning { color: var(--lcars-ink); background: var(--sp-warning); }
:where(body.theme-lcars) a.pill, :where(body.theme-lcars) .pill {
    padding: 3px 14px 2px;
    font-size: 0.85rem;
    color: var(--lcars-ink);
    background: var(--lc-lilac);
    border: 0;
    border-radius: var(--lcars-pill);
}
:where(body.theme-lcars) a.pill:hover { color: var(--lcars-ink); background: var(--lc-gold); }
:where(body.theme-lcars) a.pill.active, :where(body.theme-lcars) a.pill-active, :where(body.theme-lcars) .pill.active { color: var(--lcars-ink); background: var(--lc-orange); }

/* pagination: pills */
:where(body.theme-lcars) .pagination li > a, :where(body.theme-lcars) .pagination li > span,
:where(body.theme-lcars) .pagination .page-link {
    font-family: var(--sp-font-display);
    font-size: 0.95rem;
    color: var(--lcars-ink);
    background: var(--lc-violet);
    border: 0;
    border-radius: var(--lcars-pill);
}
:where(body.theme-lcars) .pagination li > a:hover { color: var(--lcars-ink); background: var(--lc-blue); }
:where(body.theme-lcars) .pagination .active > span,
:where(body.theme-lcars) .pagination .active .page-link { color: var(--lcars-ink); background: var(--lc-orange); }

/* stat bar: readouts under a colour bar */
:where(body.theme-lcars) .stat-bar { background: var(--sp-bg); border: 0; border-top: 10px solid var(--lc-violet); border-radius: 0; }
:where(body.theme-lcars) .stat-item { border-right: var(--lcars-gap) solid var(--sp-bg); background: rgba(var(--lc-violet-rgb),0.08); }
:where(body.theme-lcars) .stat-number { color: var(--lc-orange); font-size: 1.9rem; }

:where(body.theme-lcars) blockquote { border-left: 8px solid var(--lc-lilac); border-radius: 0; background: rgba(var(--lc-lilac-rgb),0.06); }
:where(body.theme-lcars) .sp-kicker { font-size: 0.86rem; color: var(--lc-violet); }

/* footer: plain black under the frame */
body.theme-lcars .sp-footer { background: var(--sp-bg); border-top: 0; }
body.theme-lcars .sp-footer__credit strong { font-family: var(--sp-font-display); letter-spacing: 0.06em; color: var(--lc-orange); }

/* ---- 8h. narrow screens ---- */
/* main menu dropdown: a black panel with a colour column; links are blocks */
@media (max-width: 1100px) {
    body.theme-lcars .sp-header__menu { margin-left: auto; }
    body.theme-lcars .sp-topbar {
        top: calc(100% + 6px);
        padding: 10px 10px 10px 30px;
        background: var(--sp-bg);
        border: 2px solid var(--lc-violet);
        border-left: 22px solid var(--lc-violet);
        border-radius: 28px 0 0 28px;
    }
    body.theme-lcars .sp-topnav__list { gap: var(--lcars-gap); }
    body.theme-lcars .sp-topnav__link {
        justify-content: flex-end;
        padding: 10px 14px 6px;
        font-size: 1.05rem;
        letter-spacing: 0.06em;
        color: var(--lcars-ink);
        background: var(--lc-peach);
        border-radius: 0;
    }
    body.theme-lcars .sp-topnav__list > li:nth-child(even) > .sp-topnav__link { background: var(--lc-tan); }
    body.theme-lcars .sp-topnav__link::after { display: none; }
    body.theme-lcars .sp-topnav__link:hover { color: var(--lcars-ink); background-image: linear-gradient(rgba(255,255,255,0.3), rgba(255,255,255,0.3)); }
    body.theme-lcars .sp-topnav__list > li > .sp-topnav__link.active { color: var(--lcars-ink); background: var(--sp-text-hi); box-shadow: inset -10px 0 0 var(--pp); }
    body.theme-lcars .sp-account { border-top: 0; }
}

/* below 900px: no frame elbows; the header becomes a compact pill row
   over a full-width segmented bar, and the rail is the drawer */
@media (max-width: 900px) {
    body.theme-lcars { --sp-header-h: 64px; --lcars-hbar: 10px; }
    body.theme-lcars .sp-header__inner { align-items: center; padding-bottom: calc(var(--lcars-hbar) + 6px); }
    body.theme-lcars .sp-brand {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        height: 40px;
        margin-bottom: 0;
        padding: 0 18px 0 16px;
        border-radius: var(--lcars-pill) 0 0 var(--lcars-pill);
    }
    body.theme-lcars .sp-brand__name { font-size: 1.15rem; }
    body.theme-lcars .sp-header__ornament { left: var(--sp-gutter); }
    body.theme-lcars .sp-header__ornament::before { display: none; }
    body.theme-lcars .sp-header__seg--1 { border-radius: var(--lcars-pill) 0 0 var(--lcars-pill); }
    body.theme-lcars .sp-header__seg--2 { flex-basis: 18%; }
    body.theme-lcars .sp-main { padding-top: 16px; }
    body.theme-lcars .sp-rail { padding: 0 12px 40px; background: var(--sp-bg); border-right: 6px solid var(--lc-lilac); }
    body.theme-lcars .sp-rail__head { background: var(--sp-bg); border-bottom: 0; margin-bottom: var(--lcars-gap); }
    body.theme-lcars .sp-rail__title { font-size: 1rem; letter-spacing: 0.12em; color: var(--lc-orange); }
    body.theme-lcars .sp-rail__nav a { min-height: 40px; padding: 10px 14px 6px; font-size: 1.05rem; }
    body.theme-lcars .sp-rail__cap--top { border-radius: 20px 0 0 0; }
    body.theme-lcars .sp-rail__cap--bottom { height: 34px; border-radius: 0 0 0 20px; }
    body.theme-lcars .sp-masthead__cap--start { flex-basis: 30px; border-radius: 22px 0 0 22px; }
    body.theme-lcars .sp-masthead__cap--end { flex-basis: 18px; border-radius: 0 22px 22px 0; }
    body.theme-lcars .sp-masthead__code { display: none; }
    body.theme-lcars .sp-masthead__frame { border-top-width: 6px; border-bottom-width: 6px; }
}
@media (max-width: 640px) {
    body.theme-lcars { --sp-header-h: 60px; }
    body.theme-lcars .sp-header__inner { gap: 6px; }
    body.theme-lcars .sp-brand { height: 36px; padding: 0 14px 0 12px; gap: 8px; }
    body.theme-lcars .sp-brand__name { font-size: 1.05rem; }
    body.theme-lcars .sp-iconbtn { width: 46px; height: 34px; }
    body.theme-lcars .sp-header__code { display: none; }
    body.theme-lcars :is(h1.page-head, .page-head) { gap: 10px; font-size: 1.6rem !important; }
    body.theme-lcars :is(h1.page-head, .page-head)::before { flex-basis: 20px; }
    body.theme-lcars .sp-main__seg--3 { width: 64px; }
    /* beats responsive.css's phone padding for cards (12px all round) */
    body.theme-lcars :is(.card, .panel) { padding: 0 0 12px 16px; }
    :where(body.theme-lcars) :is(.card, .panel):not([style*="padding"]) > :is(.card-header, .panel-header) { margin-left: -16px; }
}

/* ---- 8i. header emblem (Emblem size, section 7) ----
   Wide screens: the emblem sits in the orange brand block; a large one is
   centred on the whole block (it reaches down into the sweep) and the name
   steps down a size to make room. Narrow screens: the brand pill grows a
   little for a medium or large emblem, staying inside the header. */
body.theme-lcars .sp-brand { --sp-emblem-max: 46px; }
body.theme-lcars :is(.sp-brand--emblem-small, .sp-brand--emblem-medium, .sp-brand--emblem-large) .sp-brand__text > * { max-width: 100%; }
body.theme-lcars .sp-brand--emblem-medium .sp-brand__name { font-size: 1.3rem; }
body.theme-lcars .sp-brand--emblem-large { padding-left: 22px; gap: 8px; --sp-emblem-max: 56px; }
body.theme-lcars .sp-brand--emblem-large .sp-brand__emblem { margin-bottom: calc(-1 * (var(--lcars-hbar) + 4px)); }
body.theme-lcars .sp-brand--emblem-large .sp-brand__name { font-size: 1.2rem; }
@media (max-width: 900px) {
    body.theme-lcars .sp-brand { --sp-emblem-max: 32px; }
    body.theme-lcars .sp-brand--emblem-medium { height: 44px; --sp-emblem-max: 36px; }
    body.theme-lcars .sp-brand--emblem-large { height: 46px; padding-left: 16px; gap: 10px; --sp-emblem-max: 38px; }
    body.theme-lcars .sp-brand--emblem-large .sp-brand__emblem { margin-bottom: 0; }
    body.theme-lcars :is(.sp-brand--emblem-medium, .sp-brand--emblem-large) .sp-brand__name { font-size: 1.15rem; }
}
@media (max-width: 640px) {
    body.theme-lcars .sp-brand { --sp-emblem-max: 28px; }
    body.theme-lcars .sp-brand--emblem-medium { height: 40px; --sp-emblem-max: 32px; }
    body.theme-lcars .sp-brand--emblem-large { height: 42px; padding-left: 12px; gap: 8px; --sp-emblem-max: 34px; }
    body.theme-lcars :is(.sp-brand--emblem-medium, .sp-brand--emblem-large) .sp-brand__name { font-size: 1.05rem; }
}
