/* ==========================================================================
   Rogue Asylum — in-game stylesheet (fixed)
   ========================================================================== */

/* FIX 1: @import must be the very first rule or browsers ignore it. */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Courier+Prime:wght@400;700&family=Inter:wght@400;600;700&family=Reenie+Beanie&family=Special+Elite&display=swap');

:root {
    --ra-red: #e5393a;
    --ra-cream: #ece8dc;
    --ra-text: #a9a6a0;
    --ra-muted: #6f6c68;
    --ra-bg: #0c0c0e;
    --ra-panel: #121112;
    --ra-field: #151414;
    --ra-line: rgba(255, 255, 255, .09);
    --ra-serif: "Cinzel", "Trajan Pro", "Times New Roman", serif;
    --ra-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --ra-type: "Special Elite", "Courier New", monospace;
    --ra-bar-h: 58px;
}

/* ---------- Bootstrap dark theme tuned to the site colors ---------- */
[data-bs-theme="dark"] {
    --bs-body-bg: #0c0c0e;
    --bs-body-color: #a9a6a0;
    --bs-emphasis-color: #ece8dc;
    --bs-border-color: rgba(255, 255, 255, .12);
    --bs-link-color: #ece8dc;
    --bs-link-color-rgb: 236, 232, 220;
    --bs-link-hover-color: #e5393a;
    --bs-link-hover-color-rgb: 229, 57, 58;
    --bs-primary: #e5393a;
    --bs-primary-rgb: 229, 57, 58;
}
.btn-primary {
    --bs-btn-color: #fff; --bs-btn-bg: var(--ra-red); --bs-btn-border-color: var(--ra-red);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #f0494a; --bs-btn-hover-border-color: #f0494a;
    --bs-btn-active-color: #fff; --bs-btn-active-bg: #c93030; --bs-btn-active-border-color: #c93030;
    --bs-btn-disabled-color: #fff; --bs-btn-disabled-bg: var(--ra-red); --bs-btn-disabled-border-color: var(--ra-red);
    --bs-btn-focus-shadow-rgb: 229, 57, 58;
}

/* ---------- Page ---------- */
/* Background v4: on body.ra-app (same selector the original grid used, so site/Bootstrap
   html/body rules can't override it). Red glow + vignette + film grain. No line patterns, no moire. */
body.ra-app {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background-color: #09090b; /* darker base: the grain adds ~6 brightness, landing near the old #0c0c0e look */
    background-image:
        radial-gradient(ellipse 70% 600px at 50% 0, rgba(229, 57, 58, .07), transparent 75%),
        radial-gradient(ellipse 120% 100% at 50% 35%, transparent 50%, rgba(0, 0, 0, .55) 100%),
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n' x='0' y='0' width='100%' height='100%'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    background-repeat: no-repeat, no-repeat, repeat;
    background-size: 100% 100%, 100% 100%, 220px 220px;
    color: var(--ra-text);
    font-family: var(--ra-sans);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
/* Background stays still while the page scrolls (glow + vignette frame the screen, not the whole page).
   Desktop only: iOS/Android ignore or stutter on fixed backgrounds, so phones keep normal scrolling. */
@media (min-width: 960px) and (hover: hover) {
    body.ra-app { background-attachment: fixed; }
}
.ra-app a { color: var(--ra-cream); text-decoration: none; }
.ra-app a:hover { color: var(--ra-red); }
.ra-app ::selection { color: #fff; background: rgba(229, 57, 58, .5); }
.ra-app :focus-visible { outline: 2px solid var(--ra-red); outline-offset: 2px; }
.ra-app img { max-width: 100%; height: auto; }
.ra-accent, .text-main-1 { color: var(--ra-red) !important; }
.ra-skip { position: absolute; left: -9999px; top: 0; z-index: 2000; padding: .6rem 1rem; background: var(--ra-red); color: #fff; }
.ra-skip:focus { left: 0; }

/* ---------- Top strip ---------- */
.ra-topstrip {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    padding: .25rem 1rem;
    background: rgba(0, 0, 0, .6);
    border-bottom: 1px solid var(--ra-line);
}
.ra-topstrip ul { display: flex; gap: .15rem; margin: 0; padding: 0; list-style: none; }
.ra-iconlink {
    display: inline-grid; place-items: center; width: 36px; height: 36px;
    border-radius: 8px; color: #8a8782 !important; font-size: 1.15rem;
}
.ra-iconlink:hover { color: var(--ra-cream) !important; background: rgba(255, 255, 255, .06); }

/* ---------- Bar ---------- */
.ra-bar {
    position: sticky; top: 0; z-index: 1030;
    background: rgba(8, 8, 10, .94);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--ra-line);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
}
.ra-bar__inner {
    display: flex; align-items: center; gap: 1rem;
    max-width: 1320px; min-height: var(--ra-bar-h); margin: 0 auto; padding: .5rem 1rem;
}
.ra-brand { display: flex; align-items: center; gap: .7rem; color: var(--ra-cream) !important; }
.ra-brand img { display: block; width: auto; height: 40px; }
.ra-brand__name {
    font-family: var(--ra-serif); font-size: 1.15rem; font-weight: 700;
    letter-spacing: .08em; line-height: 1; text-transform: uppercase;
}
.ra-bar__quick { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.ra-bar__link {
    display: inline-flex; align-items: center; gap: .5rem; min-height: 40px; padding: 0 .9rem;
    border-radius: 8px; font-size: .9rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
}
.ra-bar__link:hover { background: rgba(255, 255, 255, .06); }
.ra-burger {
    display: none; margin-left: auto; width: 46px; height: 46px; padding: 0;
    place-content: center; gap: 5px; background: transparent;
    border: 1px solid var(--ra-line); border-radius: 10px; cursor: pointer;
}
.ra-burger span { display: block; width: 22px; height: 2px; background: var(--ra-cream); border-radius: 2px; }
.ra-burger:hover { border-color: rgba(255, 255, 255, .3); }

/* ---------- Shell: sidebar + content ---------- */
.ra-shell {
    display: grid; grid-template-columns: 288px minmax(0, 1fr); gap: 1.25rem; align-items: start;
    max-width: 1320px; margin: 1.25rem auto 2rem; padding: 0 1rem;
}
.ra-side {
    display: flex; flex-direction: column; gap: 1rem;
    position: sticky; top: calc(var(--ra-bar-h) + 1rem);
    max-height: calc(100vh - var(--ra-bar-h) - 2rem);
    overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
}
.ra-bar-off .ra-side { top: 1rem; max-height: calc(100vh - 2rem); }
.ra-side__close, .ra-overlay { display: none; }
.ra-content { min-width: 0; }
.ra-main { min-height: 40vh; }

.ra-statusrow { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.ra-brandline { display: none; align-items: center; gap: .8rem; }
.ra-brandline img { height: 52px; width: auto; }
.ra-brandline .ra-brand__name { font-size: 1.35rem; }

@media (min-width: 960px) {
    .ra-bar-off .ra-bar { display: none; }
    .ra-bar-off .ra-brandline { display: flex; }
}
@media (max-width: 959.98px) {
    .ra-bar__quick { display: none; }
    .ra-burger { display: grid; }
    .ra-bar-off .ra-bar { position: static; }
    .ra-shell { display: block; margin-top: 1rem; }
    .ra-side {
        position: fixed; inset: 0 0 0 auto; z-index: 1100;
        width: min(88vw, 360px); max-height: none; padding: 1rem;
        background: #0f0f11; border-left: 1px solid var(--ra-line);
        box-shadow: -20px 0 60px rgba(0, 0, 0, .6);
        transform: translateX(100%); visibility: hidden;
        transition: transform .25s ease, visibility 0s linear .25s;
    }
    body.ra-drawer-open .ra-side { transform: none; visibility: visible; transition: transform .25s ease; }
    .ra-side__close {
        display: grid; place-items: center; align-self: flex-end; flex: none;
        width: 42px; height: 42px; padding: 0; background: transparent;
        border: 1px solid var(--ra-line); border-radius: 10px; color: var(--ra-cream); cursor: pointer;
    }
    .ra-overlay {
        display: block; position: fixed; inset: 0; z-index: 1090; background: rgba(0, 0, 0, .7);
        opacity: 0; pointer-events: none; transition: opacity .25s;
    }
    body.ra-drawer-open .ra-overlay { opacity: 1; pointer-events: auto; }
    body.ra-drawer-open { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
    .ra-side, .ra-overlay, .ra-stat__bar { transition: none !important; }
}

/* ---------- Side panels: information + menu ---------- */
.ra-info, .ra-sec {
    padding: 1rem; background: var(--ra-panel);
    border: 1px solid var(--ra-line); border-radius: 14px;
}
.ra-sec__title, .as-widget-title {
    display: flex; align-items: center; gap: .8rem; margin: 0 0 .75rem;
    font-family: var(--ra-serif); font-size: .8rem; font-weight: 700;
    letter-spacing: .2em; text-transform: uppercase; color: var(--ra-cream);
}
.ra-sec__title::after, .as-widget-title::after {
    content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--ra-red), transparent);
}
.ra-menu { display: flex; flex-direction: column; gap: 1rem; }
.ra-sec ul { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.ra-link {
    display: flex; align-items: center; gap: .7rem; min-height: 40px; padding: .5rem .7rem;
    border-radius: 8px; color: var(--ra-text) !important; font-size: .95rem;
}
/* =========================================
   ROGUE ASYLUM - IN-GAME WORN STAMPED PRINT
========================================= */

/* Navigation brand */
.ra-brand__name {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 1.15rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    line-height: 1;
    text-transform: uppercase;
    color: #e6dfd3;
    text-shadow: 0 0 1px rgba(230, 223, 211, 0.35);
}

/* Main brand heading (if used in-game) */
.ra-brand-title {
    margin: 0;
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: clamp(1.35rem, 3.2vw, 2.6rem);
    font-weight: 400;
    letter-spacing: 0.06em;
    line-height: 1.1;
    text-transform: uppercase;
    color: #e6dfd3;
    text-shadow: 0 0 1px rgba(230, 223, 211, 0.35);
}

.ra-brand-title-accent {
    color: #a83226 !important;
    text-shadow: 0 0 1px rgba(168, 50, 38, 0.35);
}

.ra-brand-subtitle {
    display: block;
    margin-top: 6px;
    font-family: 'Courier Prime', 'Courier New', monospace;
    font-size: clamp(0.85rem, 1.5vw, 1.15rem);
    font-weight: 400;
    letter-spacing: 0.16em;
    line-height: 1.2;
    text-transform: uppercase;
    color: #a83226;
    opacity: 0.9;
}

/* Page & section headings (typography only — keeps panel backgrounds intact) */
.ra-page-title {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 1.5rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    line-height: 1.25;
    text-transform: uppercase;
    color: #e6dfd3;
}

.ra-section-title {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 1.05rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    line-height: 1.3;
    text-transform: uppercase;
    color: #e6dfd3;
}

.ra-panel-title,
.ra-sec__title,
.as-widget-title {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin: 0 0 0.75rem;
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.18em;
    line-height: 1.3;
    text-transform: uppercase;
    color: #e6dfd3;
}

/* Apply worn ink mask ONLY to standalone brand text or inner spans — never panel blocks.
   NOTE: if /images/ra-ink-worn.png 404s, masked text becomes invisible. Make sure the file exists. */
.ra-brand-title,
.ra-brand__name,
.ra-worn-text {
    display: inline-block;
    background: transparent !important;
    -webkit-mask-image: url('/images/ra-ink-worn.png');
    mask-image: url('/images/ra-ink-worn.png');
    -webkit-mask-size: 320px auto;
    mask-size: 320px auto;
    -webkit-mask-repeat: repeat;
    mask-repeat: repeat;
    -webkit-mask-position: top left;
    mask-position: top left;
    mask-mode: alpha;
}

/* FIX 2 (v2): sidebar headings. Kill the flex gap that split "INFORM" / "ATION",
   keep inner spans inline, keep the red fading rule. Covers every heading class used in the sidebar. */
.ra-side .ra-sec__title,
.ra-side .as-widget-title,
.ra-side .as-decorated-h-3,
.ra-side .ra-panel-title {
    display: block;
    gap: 0;
    column-gap: 0;
    overflow: hidden;
    text-align: left;
    white-space: nowrap;
    word-spacing: 0;
}
.ra-side .ra-sec__title > *,
.ra-side .as-widget-title > *,
.ra-side .as-decorated-h-3 > *,
.ra-side .ra-panel-title > * {
    display: inline;
    margin: 0;
    padding: 0;
    letter-spacing: inherit;
    word-spacing: 0;
}
.ra-side .ra-sec__title::after,
.ra-side .as-widget-title::after,
.ra-side .as-decorated-h-3::after,
.ra-side .ra-panel-title::after {
    content: "";
    display: inline-block;
    flex: none;
    width: 100%;
    height: 1px;
    margin: 0 -100% 0 .8rem;
    vertical-align: middle;
    background: linear-gradient(90deg, var(--ra-red), transparent);
}

/* Layout - keep sidebar pinned to top */
.page-grid, .layout-grid, .main-grid { align-items: start; }
.sidebar, .left-sidebar { align-self: start; position: sticky; top: 20px; }



.ra-link .iconify { flex: none; width: 1.2rem; height: 1.2rem; color: #8a8782; }
.ra-link:hover { background: rgba(255, 255, 255, .05); color: var(--ra-cream) !important; }
.ra-link.is-active { background: rgba(229, 57, 58, .12); color: var(--ra-cream) !important; box-shadow: inset 2px 0 0 var(--ra-red); }
.ra-link.is-active .iconify { color: var(--ra-red); }
.ra-link.is-new { color: var(--ra-cream) !important; font-weight: 600; }
.ra-link.is-new::after { content: ""; width: 8px; height: 8px; margin-left: auto; border-radius: 50%; background: var(--ra-red); box-shadow: 0 0 8px var(--ra-red); }

.ra-info__body { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .9rem; align-items: center; }
.ra-info__pic .iconify, .ra-info__pic img { border-radius: 10px; }
.ra-info__list { display: grid; gap: .1rem; margin: 0; font-size: .85rem; }
.ra-info__list div { display: flex; gap: .4rem; }
.ra-info__list dt { margin: 0; font-weight: 600; color: var(--ra-cream); }
.ra-info__list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ra-info__actions { display: flex; flex-wrap: wrap; gap: .4rem .9rem; margin-top: .8rem; padding-top: .7rem; border-top: 1px solid var(--ra-line); font-size: .8rem; }
.ra-info__actions a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Stat circles ---------- */
.ra-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; width: 100%; max-width: 520px; margin-left: auto; position: relative; z-index: 5; }
.ra-stat { --c: var(--ra-red); position: relative; width: 100%; max-width: 112px; margin: 0 auto; aspect-ratio: 1 / 1; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ra-stat--energy  { --c: #e0a030; }
.ra-stat--stamina { --c: #4f8fd6; }
.ra-stat--nerve   { --c: #e5393a; }
.ra-stat--health  { --c: #3fae6a; }
.ra-stat:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; border-radius: 50%; }
.ra-stat svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
.ra-stat__track, .ra-stat__bar { fill: none; stroke-width: 6; }
.ra-stat__track { stroke: rgba(255, 255, 255, .08); }
.ra-stat__bar { stroke: var(--c); stroke-linecap: round; filter: drop-shadow(0 0 3px var(--c)); transition: stroke-dashoffset .6s ease; animation: ra-fill .9s ease-out; }
.ra-stat--empty .ra-stat__bar { stroke-opacity: 0; }
.ra-stat__text { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.15; }

.ra-stat__label { font-size: 10px; line-height: 1.2; letter-spacing: .08em; text-transform: uppercase; color: #c4c7cb; }
.ra-stat__val { font-family: var(--ra-serif); font-size: 14px; line-height: 1.2; font-weight: 700; color: #fff; }
.ra-stat--showing .ra-stat__val { font-size: 12px; }

/* low state (20% or below) */
.ra-stat--low .ra-stat__val,
.ra-stat--low.ra-stat--showing .ra-stat__val { color: #ff7a7a; }
.ra-stat--low .ra-stat__bar { animation: ra-fill .9s ease-out, ra-pulse 1.4s ease-in-out .9s infinite; }

@keyframes ra-fill  { from { stroke-dashoffset: 276.46; } }
@keyframes ra-pulse { 50% { opacity: .45; } }

@media (max-width: 575.98px) {
    .ra-stats { max-width: none; gap: .25rem; }
    .ra-stat__label { letter-spacing: .04em; }
    .ra-stat__val { font-size: 12px; }
    .ra-stat--showing .ra-stat__val { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
    .ra-stat__bar, .ra-stat--low .ra-stat__bar { animation: none; }
}
/* ---------- Headings in page content ---------- */
.ra-main h1, .ra-main h2, .ra-main h3, .ra-main h4, .ra-main h5, .ra-main h6,
.ra-main .h1, .ra-main .h2, .ra-main .h3, .ra-main .h4, .ra-main .h5, .ra-main .h6 {
    margin: 0 0 1rem; font-family: var(--ra-serif); font-weight: 700;
    letter-spacing: .06em; line-height: 1.25; text-transform: uppercase; color: var(--ra-cream);
}
.ra-main h1 { font-size: 1.9rem; } .ra-main h2 { font-size: 1.5rem; } .ra-main h3 { font-size: 1.25rem; }
.ra-main h4, .ra-main .h4 { font-size: 1.05rem; } .ra-main h5 { font-size: .95rem; } .ra-main h6 { font-size: .85rem; }
/* =========================================
   ROGUE ASYLUM - WORN STAMPED HEADINGS & ACCENTS
========================================= */

.as-decorated-h-3 {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0 0 1rem;
    font-family: 'Special Elite', 'Courier New', monospace !important;
    font-size: 1rem;
    font-weight: 400 !important;
    letter-spacing: 0.14em !important;
    line-height: 1.25;
    text-transform: uppercase;
    color: #e6dfd3;
    background: transparent;
}

/* Distressed worn-ink mask on the full heading text and ::after accent line */
.as-decorated-h-3,
.as-decorated-h-3::after {
    -webkit-mask-image: url('/images/ra-ink-worn.png');
    mask-image: url('/images/ra-ink-worn.png');
    -webkit-mask-size: 320px auto;
    mask-size: 320px auto;
    -webkit-mask-repeat: repeat;
    mask-repeat: repeat;
    -webkit-mask-position: top left;
    mask-position: top left;
    mask-mode: alpha;
}

/* Red accent portion inside the heading */
.as-decorated-h-3 .ra-red,
.as-decorated-h-3 .ra-heading-red,
.as-decorated-h-3 .ra-brand-title-accent {
    color: #a83226 !important;
    text-shadow: 0 0 1px rgba(168, 50, 38, 0.35);
}

/* Fading red rule to the right of the heading text */
.as-decorated-h-3::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--ra-red, #a83226), transparent);
}

.ra-main p { margin: 0 0 1rem; }
.ra-main strong, .ra-main b { color: var(--ra-cream); font-weight: 600; }

/* ---------- Panels (old main-container / main-row markup) ---------- */
.main-container, .box, .as-widget-highlighted, .as-feature-2, .card {
    --bs-gutter-x: 0;
    max-width: none; margin: 0 0 1.25rem; padding: 0;
    background: var(--ra-panel); border: 1px solid var(--ra-line); border-radius: 14px;
    color: var(--ra-text); overflow: hidden; overflow: clip;
}
/* FIX 3: don't crop the patient folder (its art uses negative insets / negative margins). */
.main-container:has(.patient-file-wrap),
.box:has(.patient-file-wrap),
.card:has(.patient-file-wrap),
.as-widget-highlighted:has(.patient-file-wrap),
.as-feature-2:has(.patient-file-wrap) { overflow: visible; }

.main-container .row, .box .row { --bs-gutter-x: 0; }
.container.main-container { padding: 0; }
.card { --bs-card-bg: transparent; --bs-card-border-color: transparent; }
.as-widget-highlighted .as-widget-title { padding: 1rem 1.1rem 0; }
.as-widget-content { padding: 1rem 1.1rem; }
.main-thead {
    padding: .85rem 1.1rem; background: linear-gradient(90deg, rgba(229, 57, 58, .18), transparent);
    border-left: 3px solid var(--ra-red); border-bottom: 1px solid var(--ra-line);
    font-family: var(--ra-serif); font-size: .9rem; font-weight: 700;
    letter-spacing: .14em; text-transform: uppercase; color: var(--ra-cream);
}
.main-row { padding: .8rem 1.1rem; margin: 0; border-top: 1px solid rgba(255, 255, 255, .05); }
.main-row:nth-of-type(odd) { background: rgba(255, 255, 255, .02); }
.main-row > * + * { border-left: 1px solid rgba(255, 255, 255, .05); }
.main-row > [class*="col"] { padding-inline: .5rem; }
@media (max-width: 575.98px) {
    .main-row { padding: .7rem .8rem; font-size: .9rem; }
    .main-row > * + * { border-left: 0; }
}
.as-blockquote { margin: 0; padding-left: 1rem; border-left: 3px solid var(--ra-red); font-style: italic; }
.as-badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--ra-red); color: #fff; font-size: .65rem; font-weight: 700; line-height: 18px; text-align: center; }
.as-gap, .as-gap-1, .as-gap-2 { display: block; height: 1rem; }
.as-gap-2 { height: 1.5rem; }
.as-img { max-width: 100%; height: auto; }
.text-small { font-size: .85em; }

/* ---------- Tables ---------- */
.ra-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 1.25rem; border-radius: 12px; }
.as-table { width: 100%; margin: 0; border-collapse: separate; border-spacing: 0; color: var(--ra-text); }
.as-table thead th, .as-table thead td {
    padding: .8rem 1rem; background: rgba(255, 255, 255, .03); border-bottom: 1px solid rgba(229, 57, 58, .45);
    font-family: var(--ra-serif); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ra-cream); white-space: nowrap;
}
.as-table th { font-weight: 700; color: var(--ra-cream); }
.as-table td, .as-table tbody th { padding: .8rem 1rem; border-top: 1px solid rgba(255, 255, 255, .05); vertical-align: middle; }
.as-table tbody tr:nth-child(odd) { background: rgba(255, 255, 255, .02); }
.as-table tbody tr:hover { background: rgba(255, 255, 255, .04); }
@media (max-width: 575.98px) { .as-table td, .as-table thead th { padding: .6rem .7rem; font-size: .85rem; } }

/* ---------- Tabs ---------- */
.nav-tabs { gap: .4rem; flex-wrap: nowrap; overflow-x: auto; border: 0; padding-bottom: .35rem; scrollbar-width: thin; }
.nav-tabs .nav-link {
    display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap; min-height: 42px; padding: 0 1rem;
    background: var(--ra-panel); border: 1px solid var(--ra-line); border-radius: 10px;
    font-family: var(--ra-serif); font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
    color: var(--ra-text);
}
.nav-tabs .nav-link:hover { color: var(--ra-cream); border-color: rgba(255, 255, 255, .25); }
.nav-tabs .nav-link.active { background: var(--ra-red); border-color: var(--ra-red); color: #fff; box-shadow: 0 0 14px rgba(229, 57, 58, .35); }

/* ---------- Buttons ---------- */
.as-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 42px; padding: 0 1.2rem;
    border: 1px solid transparent; border-radius: 8px; background: #2a2a30; color: #fff !important; cursor: pointer;
    font-family: var(--ra-serif); font-size: .8rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
    transition: filter .15s ease, box-shadow .15s ease, transform .15s ease;
}
.as-btn:hover { filter: brightness(1.12); }
.as-btn-color-main-1 { background: var(--ra-red); box-shadow: 0 6px 20px rgba(229, 57, 58, .3); }
.as-btn-color-white { background: transparent; border-color: rgba(255, 255, 255, .25); color: var(--ra-cream) !important; }
.as-btn-color-dark-3 { background: #1b1b20; border-color: var(--ra-line); color: var(--ra-cream) !important; }
.as-btn-hover-color-main-1:hover { background: var(--ra-red); }
.as-btn-block { display: flex; width: 100%; }
.as-btn-sm, .as-btn-xs { min-height: 34px; padding: 0 .9rem; font-size: .72rem; }
.btn { border-radius: 8px; }

/* ---------- Forms ---------- */
.ra-app .form-control, .ra-app .form-select, .ra-app textarea {
    min-height: 44px; background-color: var(--ra-field); border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 10px; color: var(--ra-cream); font-size: 1rem;
}
.ra-app .form-control:focus, .ra-app .form-select:focus {
    background-color: var(--ra-field); border-color: var(--ra-red); color: var(--ra-cream);
    box-shadow: 0 0 0 3px rgba(229, 57, 58, .2);
}
.ra-app label { color: var(--ra-cream); font-weight: 600; }
.ra-app .form-text, .ra-app .text-muted { color: var(--ra-muted) !important; }
.modal-content { background: var(--ra-panel); border: 1px solid var(--ra-line); border-radius: 14px; }
.modal-header, .modal-footer { border-color: var(--ra-line); }
.modal-title { font-family: var(--ra-serif); letter-spacing: .1em; text-transform: uppercase; }
.ra-form-response:empty { display: none; }
.ra-form-response { margin-top: 1rem; }

/* ---------- Alert boxes (view/alerts/*.php) ---------- */
.as-info-box {
    display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .15rem 1rem; align-items: center;
    margin: 0 0 1.25rem; padding: 1rem 1.25rem; background: var(--ra-panel);
    border: 1px solid var(--ra-line); border-left: 3px solid currentColor; border-radius: 12px;
}
.as-info-box-icon { grid-row: 1 / span 2; display: grid; place-items: center; width: 48px; height: 48px; border: 2px solid currentColor; border-radius: 50%; }
.as-info-box-icon .iconify, .as-info-box-icon svg { width: 1.7rem !important; height: 1.7rem !important; }
.as-info-box h3 { margin: 0; font-family: var(--ra-serif); font-size: .85rem; letter-spacing: .16em; text-transform: uppercase; color: currentColor; }
.as-info-box em { font-style: normal; color: var(--ra-text); overflow-wrap: anywhere; }
.as-info-box em a { text-decoration: underline; }

/* ---------- Countdown hexagons (script builds .ra-hex) ---------- */
.as-countdown { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin: 1rem 0 1.5rem; }
.ra-hex {
    position: relative; display: grid; place-content: center; width: 112px; height: 128px; text-align: center;
    background: var(--ra-red); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.ra-hex::before { content: ""; position: absolute; inset: 4px; background: #0c0c0e; clip-path: inherit; }
.ra-hex > * { position: relative; }
.ra-hex__n { font-family: var(--ra-serif); font-size: 1.9rem; font-weight: 700; line-height: 1.1; color: var(--ra-cream); }
.ra-hex__l { font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: #8a8782; }
@media (max-width: 575.98px) {
    .as-countdown { flex-wrap: nowrap; gap: .35rem; }
    .ra-hex { flex: 1 1 0; width: auto; height: auto; max-width: 96px; aspect-ratio: 7 / 8; }
    .ra-hex__n { font-size: clamp(1rem, 5.4vw, 1.5rem); }
    .ra-hex__l { font-size: clamp(.42rem, 2.1vw, .56rem); letter-spacing: .04em; }
}

/* ---------- Landing announcements (div-based rows) ---------- */
.box .h4 .row > * { min-width: 0; font-size: clamp(.62rem, 2.9vw, 1rem); letter-spacing: .04em; }
.box .h4 .row > :nth-child(1) { flex: 0 0 auto; width: 44%; }
.box .h4 .row > :nth-child(2), .box .h4 .row > :nth-child(3) { flex: 0 0 auto; width: 28%; }
.box > .h4 { margin: 0; padding: .9rem 1rem !important; }
.ra-main .box.row { margin: 0; padding: .7rem 1rem; border-radius: 0; border-width: 0 0 1px; }
.ra-main .box .col { min-width: 0; overflow-wrap: anywhere; hyphens: none; }
@media (max-width: 575.98px) { .ra-main .box.row { font-size: .8rem; padding: .6rem .6rem; } }

/* ---------- Page numbers: vertical rail on the left of the content ---------- */
.row > .ra-rail { flex: 0 0 56px; width: 56px; max-width: 56px; padding: 0 .5rem 0 0; }
.ra-rail:empty { display: none; }
/* Keep the rail and the content on ONE line, and let the content shrink and scroll instead of wrapping below. */
.row:has(> .ra-rail) { flex-wrap: nowrap; }
.row > .ra-rail + .col, .ra-main .row > .col { min-width: 0; }
.ra-pages { position: sticky; top: calc(var(--ra-bar-h) + 1rem); }
.ra-bar-off .ra-pages { top: 1rem; }
.ra-pages__list { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ra-pages__btn {
    display: grid; place-items: center; width: 44px; height: 44px; background: var(--ra-panel);
    border: 1px solid var(--ra-line); border-radius: 10px; color: var(--ra-cream) !important;
    font-family: var(--ra-serif); font-size: 1rem; font-weight: 700;
}
a.ra-pages__btn:hover { border-color: var(--ra-red); background: rgba(229, 57, 58, .12); }
.ra-pages__btn svg { width: 18px; height: 18px; }
.ra-pages__list .is-current .ra-pages__btn { background: var(--ra-red); border-color: var(--ra-red); color: #fff !important; box-shadow: 0 0 14px rgba(229, 57, 58, .4); }
.ra-pages__list .is-disabled .ra-pages__btn { opacity: .3; }
.ra-pages__gap { line-height: 1; color: var(--ra-muted); }
.main-container .row > .ra-rail {
    flex: 0 0 68px; width: 68px; max-width: 68px; padding: .75rem .5rem;
    background: rgba(255, 255, 255, .015); border-right: 1px solid var(--ra-line);
}
@media (max-width: 575.98px) {
    .row > .ra-rail { flex-basis: 42px; width: 42px; max-width: 42px; padding-right: .25rem; }
    .main-container .row > .ra-rail { flex-basis: 54px; width: 54px; max-width: 54px; padding: .6rem .3rem; }
    .ra-pages__btn { width: 36px; height: 36px; font-size: .9rem; }
    .ra-pages__list li.is-far { display: none; }
}

/* ---------- Explore: six layouts, same links ---------- */
.ra-xp { margin: 0 0 1.5rem; }
.ra-xp-list { display: grid; gap: .4rem; margin: 0; padding: 0; list-style: none; }
.ra-xp-box { padding: 1.1rem; background: var(--ra-panel); border: 1px solid var(--ra-line); border-radius: 14px; }
.ra-xp-title {
    display: flex; align-items: center; gap: .6rem; margin: 0 0 .8rem !important;
    font-size: .85rem !important; letter-spacing: .18em !important;
}
.ra-xp-title .iconify { width: 1.4rem; height: 1.4rem; color: var(--ra-red); }
.ra-xp-link {
    display: flex; align-items: center; gap: .65rem; min-height: 44px; padding: .55rem .8rem;
    background: rgba(255, 255, 255, .03); border: 1px solid rgba(255, 255, 255, .05);
    border-radius: 10px; color: var(--ra-text) !important; font-size: .95rem;
}
.ra-xp-link .iconify { flex: none; width: 1.25rem; height: 1.25rem; color: #8a8782; }
.ra-xp-link:hover { background: rgba(229, 57, 58, .08); border-color: rgba(229, 57, 58, .5); color: var(--ra-cream) !important; }
.ra-xp-link:hover .iconify { color: var(--ra-red); }
.ra-xp-grid { display: grid; gap: 1rem; }
/* 1 Compass */
.ra-xp--compass .ra-xp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-areas: ". north ." "west center east" ". south ."; }
.ra-xp--compass .ra-xp-box--center { border-color: rgba(229, 57, 58, .45); box-shadow: 0 0 30px rgba(229, 57, 58, .08); }
/* 2 Cards */
.ra-xp--cards .ra-xp-grid { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.ra-xp--cards .ra-xp-box { border-top: 3px solid var(--ra-red); }
/* 3 Wings */
.ra-xp--wings .ra-xp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-areas: "north center east" "west center south"; }
.ra-xp--wings .ra-xp-box--center { display: flex; flex-direction: column; justify-content: center; background: linear-gradient(180deg, rgba(229, 57, 58, .1), var(--ra-panel)); }
.ra-xp-area-north { grid-area: north; } .ra-xp-area-west { grid-area: west; } .ra-xp-area-center { grid-area: center; }
.ra-xp-area-east { grid-area: east; } .ra-xp-area-south { grid-area: south; }
@media (max-width: 767.98px) {
    .ra-xp--compass .ra-xp-grid, .ra-xp--wings .ra-xp-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "north" "west" "center" "east" "south"; }
}
/* 4 Tabs */
.ra-xp-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .6rem; padding: 1rem; background: var(--ra-panel); border: 1px solid var(--ra-line); border-radius: 14px; margin-top: .6rem; }
/* 5 Index */
.ra-xp--index { background: var(--ra-panel); border: 1px solid var(--ra-line); border-radius: 14px; overflow: hidden; }
.ra-xp-row { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 1rem; align-items: center; padding: .9rem 1.1rem; border-top: 1px solid var(--ra-line); }
.ra-xp-row:first-child { border-top: 0; }
.ra-xp-row .ra-xp-title { margin: 0 !important; }
.ra-xp-inline { display: flex; flex-wrap: wrap; gap: .3rem .2rem; }
.ra-xp--index .ra-xp-link { min-height: 36px; padding: .3rem .6rem; background: transparent; border-color: transparent; }
.ra-xp--index .ra-xp-link::after { content: "/"; margin-left: .6rem; color: var(--ra-muted); }
.ra-xp--index .ra-xp-inline > .ra-xp-link:last-child::after { content: none; }
@media (max-width: 575.98px) { .ra-xp-row { grid-template-columns: minmax(0, 1fr); gap: .4rem; } }
/* 6 Honeycomb */
.ra-xp--hive .ra-xp-hexrow { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-bottom: 1.5rem; }
.ra-xp--hive .ra-xp-title { justify-content: center; }
.ra-xp-hex {
    position: relative; display: grid; place-content: center; justify-items: center; gap: .25rem;
    width: 118px; height: 136px; padding: 0 .9rem; text-align: center; background: rgba(229, 57, 58, .55);
    clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
    color: var(--ra-text) !important; font-size: .72rem; line-height: 1.2;
}
.ra-xp-hex::before { content: ""; position: absolute; inset: 2px; background: var(--ra-panel); clip-path: inherit; transition: background .15s; }
.ra-xp-hex > * { position: relative; }
.ra-xp-hex .iconify { width: 1.6rem; height: 1.6rem; color: var(--ra-cream); }
.ra-xp-hex:hover { background: var(--ra-red); color: var(--ra-cream) !important; }
.ra-xp-hex:hover::before { background: #1d1416; }
@media (max-width: 575.98px) { .ra-xp-hex { width: 98px; height: 113px; font-size: .64rem; padding: 0 .6rem; } }


/* ---------- Footer + back to top ---------- */
.ra-footer { margin-top: 2rem; background: linear-gradient(to top, rgba(229, 57, 58, .12), rgba(0, 0, 0, .5)); border-top: 1px solid rgba(255, 255, 255, .07); }
.ra-footer__inner {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem 1.5rem;
    max-width: 1320px; margin: 0 auto; padding: 1.1rem 1rem; font-size: .85rem; color: #7d7a76;
}
.ra-footer small { color: #4a4745; }
#btn-back-to-top {
    position: fixed; right: 1rem; bottom: 1rem; z-index: 1020; display: none; place-items: center;
    width: 46px; height: 46px; padding: 0; border: 0; border-radius: 10px; background: var(--ra-red);
    color: #fff; cursor: pointer; box-shadow: 0 6px 20px rgba(229, 57, 58, .4);
}
#btn-back-to-top.is-visible { display: grid; }
#btn-back-to-top svg { width: 22px; height: 22px; }


/* ---------- Users online grid/card ---------- */

/* Main Panel Container */
.asylum-card {
background: #0d0f12;
border: 1px solid rgba(138, 18, 18, 0.4);
border-radius: 8px;
padding: 16px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

/* Card Responsive Grid */
.patient-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
gap: 14px;
}

/* Individual Patient Card */
.patient-card {
background: #13161a;
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 6px;
padding: 12px;
display: flex;
flex-direction: column;
justify-content: space-between;
transition: all 0.2s ease-in-out;
}

.patient-card:hover {
transform: translateY(-2px);
background: #171b21;
border-color: rgba(230, 43, 43, 0.5);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), 0 0 10px rgba(230, 43, 43, 0.2);
}

/* Card Header & Avatar */
.patient-card-header {
display: flex;
align-items: center;
gap: 12px;
}

.patient-avatar-wrap {
position: relative;
width: 44px;
height: 44px;
flex-shrink: 0;
}

.patient-avatar-wrap img {
width: 44px;
height: 44px;
border-radius: 5px;
object-fit: cover;
border: 1px solid rgba(255, 255, 255, 0.15);
background: #08090b;
}

/* Level Badge & Online Dot */
.patient-lvl-badge {
position: absolute;
top: -5px;
right: -5px;
background: #e62b2b;
color: #ffffff;
border: 1px solid #8a1212;
font-size: 8px;
font-weight: 700;
padding: 1px 4px;
border-radius: 4px;
line-height: 1;
}

.patient-online-dot {
position: absolute;
bottom: -2px;
right: -2px;
width: 9px;
height: 9px;
background-color: #22c55e;
border: 2px solid #13161a;
border-radius: 50%;
box-shadow: 0 0 6px rgba(34, 197, 94, 0.8);
}

.patient-meta {
min-width: 0;
flex: 1;
}

.patient-name {
font-weight: 700;
font-size: 13px;
text-decoration: none;
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

.patient-name:hover {
text-decoration: underline;
}

/* Role Badges */
.patient-role-badge {
display: inline-block;
font-size: 8.5px;
font-weight: 700;
letter-spacing: 0.5px;
padding: 2px 6px;
border-radius: 3px;
margin-top: 3px;
border: 1px solid;
text-transform: uppercase;
}

.badge-owner       { background: rgba(37, 99, 235, 0.25); color: #60a5fa; border-color: #1d4ed8; }
.badge-admin       { background: rgba(75, 85, 99, 0.25);  color: #d1d5db; border-color: #4b5563; }
.badge-mod         { background: rgba(194, 65, 12, 0.25); color: #fb923c; border-color: #c2410c; }
.badge-entertainer { background: rgba(161, 98, 7, 0.25);  color: #facc15; border-color: #a16207; }
.badge-patient     { background: rgba(30, 41, 59, 0.4);   color: #94a3b8; border-color: #334155; }

/* Card Footer & Quick Actions */
.patient-card-footer {
margin-top: 10px;
padding-top: 8px;
border-top: 1px solid rgba(255, 255, 255, 0.05);
display: flex;
align-items: center;
justify-content: space-between;
}

.patient-time {
font-size: 11px;
color: #6b7280;
}

.text-emerald {
color: #22c55e;
}

.patient-actions {
display: flex;
gap: 4px;
}

.action-btn {
width: 24px;
height: 24px;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 4px;
color: #9ca3af;
background: rgba(255, 255, 255, 0.04);
border: 1px solid rgba(255, 255, 255, 0.06);
text-decoration: none;
font-size: 10px;
transition: all 0.15s ease;
}

.action-btn:hover {
background: rgba(255, 255, 255, 0.12);
color: #ffffff;
border-color: rgba(255, 255, 255, 0.2);
}

.action-btn.action-attack:hover {
background: #8a1212;
color: #ffffff;
border-color: #e62b2b;
}

/* Staff Legend Box & Pills */
.staff-legend-card {
background: #0d0f12;
border: 1px solid rgba(255, 255, 255, 0.08);
}

.staff-legend-title {
font-size: 11px;
font-weight: 700;
color: #9ca3af;
letter-spacing: 0.5px;
}

.legend-pill {
font-size: 10.5px;
font-weight: 600;
padding: 3px 10px;
border-radius: 12px;
border: 1px solid;
display: inline-flex;
align-items: center;
gap: 6px;
}

.legend-pill .dot {
width: 5px;
height: 5px;
border-radius: 50%;
}

.pill-owner       { background: rgba(37, 99, 235, 0.2); color: #60a5fa; border-color: #1d4ed8; }
.pill-owner .dot  { background: #3b82f6; }
.pill-admin       { background: rgba(75, 85, 99, 0.2);  color: #d1d5db; border-color: #4b5563; }
.pill-admin .dot  { background: #9ca3af; }
.pill-mod         { background: rgba(194, 65, 12, 0.2); color: #fb923c; border-color: #c2410c; }
.pill-mod .dot    { background: #f97316; }
.pill-entertainer { background: rgba(161, 98, 7, 0.2);  color: #facc15; border-color: #a16207; }
.pill-entertainer .dot { background: #eab308; }
.pill-patient     { background: rgba(30, 41, 59, 0.3);  color: #94a3b8; border-color: #334155; }
.pill-patient .dot { background: #64748b; }



/***START STAMP CSS***/
/* (the @import that used to be here now lives at the top of the file) */

.ink-stamp {
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  padding: 2.5px 6px;
  text-decoration: none !important;
  background-color: rgba(12, 12, 15, 0.85);
  border-width: 1.5px;
  border-style: solid;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  user-select: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

/* Individual Stamp Colors & Subtle Organic Tilts */
.ink-stamp.stamp-blue {
  transform: rotate(-1deg);
  color: #4196e1;
  border-color: rgba(65, 150, 225, 0.7);
  box-shadow: 0 0 4px rgba(65, 150, 225, 0.12);
}

.ink-stamp.stamp-gold {
  transform: rotate(1.2deg);
  color: #e2ac1b;
  border-color: rgba(226, 172, 27, 0.7);
  box-shadow: 0 0 4px rgba(226, 172, 27, 0.12);
}

.ink-stamp.stamp-red {
  transform: rotate(-1.5deg);
  color: #e52e3d;
  border-color: rgba(229, 46, 61, 0.7);
  box-shadow: 0 0 4px rgba(229, 46, 61, 0.12);
}
.ink-stamp.stamp-green {
  transform: rotate(-1deg);
  color: #43a047;
  border-color: rgba(67, 160, 71, 0.7);
  box-shadow: 0 0 4px rgba(67, 160, 71, 0.12);
}
.ink-stamp.stamp-purple {
  transform: rotate(-1deg);
  color: #7e57c2;
  border-color: rgba(126, 87, 194, 0.7);
  box-shadow: 0 0 4px rgba(126, 87, 194, 0.12);
}
/* FIX 5: was #212121 on a near-black background (invisible). Lightened so it reads. */
.ink-stamp.stamp-black {
  transform: rotate(-1deg);
  color: #b5b5ba;
  border-color: rgba(181, 181, 186, 0.7);
  box-shadow: 0 0 4px rgba(181, 181, 186, 0.12);
}
.ink-stamp.stamp-teal {
  transform: rotate(-1deg);
  color: #009688;
  border-color: rgba(0, 150, 136, 0.7);
  box-shadow: 0 0 4px rgba(0, 150, 136, 0.12);
}
.ink-stamp.stamp-brown {
  transform: rotate(-1deg);
  color: #8d6e63;
  border-color: rgba(141, 110, 99, 0.7);
  box-shadow: 0 0 4px rgba(141, 110, 99, 0.12);
}

.ink-stamp.stamp-amber,
.ink-stamp.stamp-energy,
.ink-stamp.stamp-orange {
  transform: rotate(-1deg);
  color: #ffb52e;
  border-color: rgba(255, 181, 46, 0.7);
  box-shadow: 0 0 4px rgba(255, 181, 46, 0.12);
}
.ink-stamp.stamp-steel {
  transform: rotate(-1deg);
  color: #a0a5b5;
  border-color: rgba(160, 165, 181, 0.6);
  box-shadow: 0 0 4px rgba(160, 165, 181, 0.12);
}
.ink-stamp.stamp-steel:hover {
  border-color: #a0a5b5;
  box-shadow: 0 0 8px rgba(160, 165, 181, 0.3);
}

/* Crisp Hover Effect (Flattens out like pressing a real stamp) */
.ink-stamp:hover {
  transform: scale(1.06) rotate(0deg) !important;
  background-color: rgba(255, 255, 255, 0.05);
  filter: brightness(1.2);
}

.ink-stamp.stamp-blue:hover { border-color: #4196e1; box-shadow: 0 0 8px rgba(65, 150, 225, 0.3); }
.ink-stamp.stamp-gold:hover { border-color: #e2ac1b; box-shadow: 0 0 8px rgba(226, 172, 27, 0.3); }
.ink-stamp.stamp-red:hover { border-color: #e52e3d; box-shadow: 0 0 8px rgba(229, 46, 61, 0.3); }
.ink-stamp:active {
  transform: scale(0.96) translateY(1px) !important;
}
@keyframes alert-pulse {
  0%, 100% {
    opacity: 1;
    text-shadow: 0 0 8px rgba(229, 46, 61, 0.8);
  }
  50% {
    opacity: 0.3;
    text-shadow: 0 0 2px rgba(229, 46, 61, 0.2);
  }
}

.asylum-flash-badge {
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #e52e3d; /* Nerve Crimson Red */
  background: rgba(229, 46, 61, 0.1);
  border: 1px solid rgba(229, 46, 61, 0.4);
  padding: 1px 4px;
  border-radius: 2px;
  display: inline-block;
  animation: alert-pulse 1.2s infinite ease-in-out;
  text-transform: uppercase;
}
/***END STAMPS***/

/* Work Release */

.wr-page {
    --wr-bg: #0f0f12;
    --wr-panel: #17171c;
    --wr-panel-2: #1e1e25;
    --wr-border: rgba(255, 255, 255, .09);
    --wr-text: #e6e6ea;
    --wr-muted: #8d8d99;
    --wr-accent: #c0392b;
    --wr-accent-soft: rgba(192, 57, 43, .18);
    --wr-good: #7fbf7f;
    --wr-warn: #e0b050;
    --wr-bad: #d9534f;
    color: var(--wr-text);
}

/* ---------- Header ---------- */
.wr-page .wr-header { margin-bottom: 1.25rem; }
.wr-page .wr-header h2 { margin: .15rem 0 .4rem; font-weight: 700; letter-spacing: .02em; }
.wr-page .wr-header p { margin: 0; color: var(--wr-muted); max-width: 60ch; }
.wr-page .wr-eyebrow {
    font-size: .7rem;
    letter-spacing: .18em;
    font-weight: 700;
    color: var(--wr-accent);
}

/* ---------- Panels ---------- */
.wr-page .wr-panel {
    background: var(--wr-panel);
    border: 1px solid var(--wr-border);
    border-radius: 8px;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.1rem;
}
.wr-page .wr-panel-heading {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1rem;
    font-size: .72rem;
    letter-spacing: .16em;
    font-weight: 700;
    color: var(--wr-muted);
}
.wr-page .wr-heading-line {
    flex: 1;
    height: 1px;
    background: var(--wr-border);
}
.wr-page .wr-muted { color: var(--wr-muted); font-size: .72rem; letter-spacing: .1em; font-weight: 600; }
.wr-page .wr-small { font-size: .78rem; margin-top: .6rem; letter-spacing: 0; font-weight: 400; }
.wr-page .wr-section-description { color: var(--wr-muted); font-size: .9rem; margin-bottom: 1rem; }
.wr-page .wr-empty {
    padding: 1rem;
    text-align: center;
    color: var(--wr-muted);
    border: 1px dashed var(--wr-border);
    border-radius: 6px;
}

/* ---------- Current assignment ---------- */
.wr-page .wr-current-info {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.wr-page .wr-current-main { flex: 1 1 260px; }
.wr-page .wr-current-main h3 { margin: .25rem 0 .35rem; font-size: 1.35rem; }
.wr-page .wr-current-main p { margin: 0; color: var(--wr-muted); }
.wr-page .wr-rank-display {
    margin-top: .25rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--wr-accent);
}
.wr-page .wr-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: .75rem;
}
.wr-page .wr-stat {
    background: var(--wr-panel-2);
    border: 1px solid var(--wr-border);
    border-radius: 6px;
    padding: .7rem .85rem;
}
.wr-page .wr-stat span {
    display: block;
    font-size: .66rem;
    letter-spacing: .12em;
    color: var(--wr-muted);
    margin-bottom: .25rem;
}
.wr-page .wr-stat strong { font-size: 1.05rem; }

/* ---------- Progress bars ---------- */
.wr-page .wr-progression { margin-bottom: 1rem; }
.wr-page .wr-progression-info {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .45rem;
    font-size: .88rem;
}
.wr-page .wr-progress-track,
.wr-page .wr-progress {
    height: 10px;
    background: var(--wr-panel-2);
    border: 1px solid var(--wr-border);
    border-radius: 999px;
    overflow: hidden;
}
.wr-page .wr-progress-fill,
.wr-page .wr-progress-bar {
    height: 100%;
    background: var(--wr-accent);
    border-radius: 999px;
    transition: width .4s ease;
}
.wr-page .wr-suspicion { margin-top: .75rem; }
.wr-page .wr-suspicion-heading {
    display: flex;
    justify-content: space-between;
    margin-bottom: .35rem;
    font-size: .85rem;
}

/* ---------- Rank list ---------- */
.wr-page .wr-rank-list { display: grid; gap: .5rem; }
.wr-page .wr-rank-row {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .6rem .8rem;
    background: var(--wr-panel-2);
    border: 1px solid var(--wr-border);
    border-radius: 6px;
}
.wr-page .wr-rank-row.is-current {
    border-color: var(--wr-accent);
    background: var(--wr-accent-soft);
}
.wr-page .wr-rank-level {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--wr-panel);
    border: 1px solid var(--wr-border);
    font-weight: 700;
    font-size: .85rem;
}
.wr-page .wr-rank-info { flex: 1; display: flex; flex-direction: column; }
.wr-page .wr-rank-info span { font-size: .78rem; color: var(--wr-muted); }
.wr-page .wr-rank-status { font-size: .68rem; letter-spacing: .1em; font-weight: 700; }
.wr-page .wr-rank-current  { color: var(--wr-accent); }
.wr-page .wr-rank-complete { color: var(--wr-good); }
.wr-page .wr-rank-locked   { color: var(--wr-muted); }

/* ---------- Salary ---------- */
.wr-page .wr-salary {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
.wr-page .wr-salary-amount { font-size: 1.9rem; font-weight: 700; margin: .15rem 0; }
.wr-page .wr-salary p { margin: 0; color: var(--wr-muted); font-size: .88rem; }

/* ---------- Work orders ---------- */
.wr-page .wr-assignment-action { margin-bottom: .9rem; }
.wr-page .wr-assigned-today,
.wr-page .wr-current-job,
.wr-page .wr-order-completed,
.wr-page .wr-order-status {
    font-size: .72rem;
    letter-spacing: .1em;
    font-weight: 700;
}
.wr-page .wr-assigned-today,
.wr-page .wr-order-completed { color: var(--wr-good); }
.wr-page .wr-current-job { color: var(--wr-accent); }
.wr-page .wr-order-status { color: var(--wr-muted); }
.wr-page .wr-order-list,
.wr-page .wr-department-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: .9rem;
}
.wr-page .wr-order-card,
.wr-page .wr-job-card {
    display: flex;
    flex-direction: column;
    background: var(--wr-panel-2);
    border: 1px solid var(--wr-border);
    border-radius: 8px;
    padding: 1rem;
}
.wr-page .wr-job-card.is-current { border-color: var(--wr-accent); background: var(--wr-accent-soft); }
.wr-page .wr-order-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .5rem;
}
.wr-page .wr-order-heading h4,
.wr-page .wr-job-card h4 { margin: 0 0 .4rem; font-size: 1.02rem; }
.wr-page .wr-order-difficulty {
    font-size: .68rem;
    letter-spacing: .08em;
    color: var(--wr-warn);
    white-space: nowrap;
}
.wr-page .wr-order-briefing,
.wr-page .wr-job-description { color: var(--wr-muted); font-size: .88rem; flex: 1; }
.wr-page .wr-order-rewards {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin: .8rem 0;
}
.wr-page .wr-order-rewards span {
    font-size: .75rem;
    padding: .2rem .55rem;
    border-radius: 999px;
    background: var(--wr-panel);
    border: 1px solid var(--wr-border);
}
.wr-page .wr-order-footer,
.wr-page .wr-job-card-footer { margin-top: .8rem; }
.wr-page .wr-job-department {
    font-size: .66rem;
    letter-spacing: .16em;
    font-weight: 700;
    color: var(--wr-accent);
    margin-bottom: .25rem;
}

/* ---------- Requirement checklists ---------- */
.wr-page .wr-req-list { list-style: none; margin: .75rem 0 0; padding: 0; font-size: .85rem; }
.wr-page .wr-req { padding: .15rem 0; }
.wr-page .wr-req.is-met   { color: var(--wr-good); }
.wr-page .wr-req.is-unmet { color: var(--wr-bad); }
.wr-page .wr-req-mark { display: inline-block; width: 1.1em; font-weight: 700; }
.wr-page .wr-req-locked,
.wr-page .wr-req-qualified {
    font-size: .74rem;
    letter-spacing: .08em;
    font-weight: 700;
}
.wr-page .wr-req-locked    { color: var(--wr-bad); }
.wr-page .wr-req-qualified { color: var(--wr-good); margin-right: .5rem; }

/* ---------- Promotion panel ---------- */
.wr-page .wr-promotion { margin: 1rem 0; }
.wr-page .wr-promo {
    padding: .9rem 1rem;
    border: 1px solid var(--wr-border);
    border-radius: 6px;
    background: rgba(0, 0, 0, .25);
}
.wr-page .wr-promo-title { font-size: .72rem; letter-spacing: .12em; font-weight: 700; opacity: .85; }
.wr-page .wr-promo-status {
    margin-top: .75rem;
    font-size: .76rem;
    letter-spacing: .06em;
    font-weight: 700;
}
.wr-page .wr-promo-status.is-eligible { color: var(--wr-good); }
.wr-page .wr-promo-status.is-pending  { color: var(--wr-warn); }
.wr-page .wr-promo-status.is-max      { color: var(--wr-muted); margin-top: 0; }
.wr-page .wr-promo-action { margin-top: .6rem; }
.wr-page .wr-promo-note   { margin-top: .6rem; font-size: .8rem; color: var(--wr-muted); }
.wr-page .wr-promo-note.is-denied { color: var(--wr-bad); }

/* ---------- Small screens ---------- */
@media (max-width: 576px) {
    .wr-page .wr-panel { padding: .9rem; }
    .wr-page .wr-salary-amount { font-size: 1.5rem; }
}

/* ==========================================================
   Work Release: small additions
   Headings, tables and layout come from your existing site classes
   (as-decorated-h-3, main-container, as-table). This only adds the
   few things your site does not already have, and every rule is
   scoped under .wr-page.
   ========================================================== */

.wr-page .wr-sub {
    display: block;
    font-size: .82rem;
    opacity: .7;
    margin-top: .15rem;
}
p.wr-sub { margin: .5rem 0 1rem; }

.wr-page .wr-eyebrow {
    font-size: .68rem;
    letter-spacing: .14em;
    font-weight: 700;
    color: var(--bs-danger, #dc3545);
}

/* Table helpers */
.wr-page .wr-row-current td { background: rgba(220, 53, 69, .12); }
.wr-page .wr-empty-cell { text-align: center; opacity: .7; padding: 1rem; }

/* Status text */
.wr-page .wr-rank-current   { color: var(--bs-danger, #dc3545); font-weight: 700; font-size: .78rem; letter-spacing: .06em; }
.wr-page .wr-rank-complete,
.wr-page .wr-order-completed,
.wr-page .wr-assigned-today,
.wr-page .wr-req-qualified  { color: #7fbf7f; font-weight: 700; font-size: .78rem; letter-spacing: .06em; }
.wr-page .wr-rank-locked,
.wr-page .wr-order-status   { opacity: .6; font-weight: 700; font-size: .78rem; letter-spacing: .06em; }
.wr-page .wr-current-job    { color: var(--bs-danger, #dc3545); font-weight: 700; font-size: .78rem; letter-spacing: .06em; }
.wr-page .wr-req-locked     { color: #d9534f; font-weight: 700; font-size: .78rem; letter-spacing: .06em; }
.wr-page .wr-req-qualified  { margin-right: .5rem; }

/* Requirement checklist */
.wr-page .wr-req-list { list-style: none; margin: .25rem 0 0; padding: 0; font-size: .85rem; }
.wr-page .wr-req { padding: .1rem 0; }
.wr-page .wr-req.is-met   { color: #7fbf7f; }
.wr-page .wr-req.is-unmet { color: #d9534f; }
.wr-page .wr-req-mark { display: inline-block; width: 1.1em; font-weight: 700; }

/* Progress bar */
.wr-page .wr-progression-info {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
    margin: .5rem 0 .4rem;
    font-size: .9rem;
}
.wr-page .wr-progress-track {
    height: 10px;
    background: rgba(255, 255, 255, .08);
    border-radius: 999px;
    overflow: hidden;
}
.wr-page .wr-progress-fill {
    height: 100%;
    background: var(--bs-danger, #dc3545);
    border-radius: 999px;
    transition: width .4s ease;
}

/* Promotion panel */
.wr-page .wr-promotion { margin: 1rem 0; }
.wr-page .wr-promo {
    padding: .8rem 1rem;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 6px;
    background: rgba(0, 0, 0, .25);
}
.wr-page .wr-promo-title { font-size: .72rem; letter-spacing: .12em; font-weight: 700; opacity: .85; }
.wr-page .wr-promo-status { margin-top: .7rem; font-size: .76rem; letter-spacing: .06em; font-weight: 700; }
.wr-page .wr-promo-status.is-eligible { color: #7fbf7f; }
.wr-page .wr-promo-status.is-pending  { color: #e0b050; }
.wr-page .wr-promo-status.is-max      { opacity: .7; margin-top: 0; }
.wr-page .wr-promo-action { margin-top: .6rem; }
.wr-page .wr-promo-note   { margin-top: .5rem; font-size: .8rem; opacity: .75; }
.wr-page .wr-promo-note.is-denied { color: #d9534f; opacity: 1; }

/* Salary */
.wr-page .wr-salary {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.wr-page .wr-salary-amount { font-size: 1.8rem; font-weight: 700; margin: .1rem 0; }
.wr-page .wr-assignment-action { margin-bottom: .75rem; }

.wr-page .wr-empty {
    padding: .9rem;
    text-align: center;
    opacity: .7;
    border: 1px dashed rgba(255, 255, 255, .15);
    border-radius: 6px;
}

/*end work release*/


/* =========PATIENT(profile) FILE============== */

.patient-file-wrap {
  --pf-paper: #eadbb0;
  --pf-paper-dim: #b79c68;
  --pf-ink: #1a1408;
  --pf-ink-soft: #4e3e22;
  --pf-blood: #a50e1a;
  --pf-type: "Special Elite", "Courier Prime", "Courier New", Courier, monospace;
  --pf-hand: "Reenie Beanie", "Caveat", "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  --pf-tex: url(/images/manila-paper-light.jpg);
  --pf-frame-img: url(/images/folder-frame.webp);
  --pf-paper-img: url(/images/folder-paper.jpg);
  /* paper grain (multiplied over the sheet) */
  --pf-grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n' x='0' y='0' width='100%' height='100%' color-interpolation-filters='sRGB'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .32  0 0 0 0 .22  0 0 0 0 .08  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  /* speckled mask that makes the rubber stamps look worn */
  --pf-wear: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='w' x='0' y='0' width='100%' height='100%' color-interpolation-filters='sRGB'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  7 0 0 0 -2'/></filter><rect width='100%' height='100%' filter='url(%23w)'/></svg>");

  /* blotchy browning + tiny foxing specks */
  --pf-stain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='520' height='520'><filter id='b' x='0' y='0' width='100%' height='100%' color-interpolation-filters='sRGB'><feTurbulence type='fractalNoise' baseFrequency='.007' numOctaves='3' seed='4' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .43  0 0 0 0 .27  0 0 0 0 .08  3.2 0 0 0 -1.35'/></filter><filter id='s' x='0' y='0' width='100%' height='100%' color-interpolation-filters='sRGB'><feTurbulence type='fractalNoise' baseFrequency='.28' numOctaves='2' seed='9' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .38  0 0 0 0 .22  0 0 0 0 .06  16 0 0 0 -12.4'/></filter><rect width='100%' height='100%' filter='url(%23b)' opacity='.07'/><rect width='100%' height='100%' filter='url(%23s)' opacity='.22'/></svg>");

  max-width: 880px;
  margin: 0 auto;
  position: relative;
  font-family: var(--pf-type);
  color: var(--pf-ink);
  padding: 0 70px 74px 44px;
  overflow: visible;
  box-sizing: border-box;
}

/* ---------- FOLDER ---------- */
.pf-folder { position: relative; isolation: isolate; filter: drop-shadow(0 10px 12px rgba(0,0,0,.55)); }

/* ---------- TABS (cream paper, part of the front sheet) ---------- */
.pf-tabs { position: relative; z-index: 3; display: flex; align-items: flex-end; margin: 0; }
.pf-tab-btn {
  -webkit-appearance: none; appearance: none;
  position: relative; z-index: 1; flex: 0 0 auto;
  display: flex; flex-direction: column; justify-content: flex-start;
  box-sizing: border-box; margin: 0 0 -6px; border: 0; border-radius: 0;
  height: 62px; min-width: 214px; padding: 13px 78px 0 40px;
  text-align: left; cursor: pointer; color: #2a1e0a;
  font-family: var(--pf-type);
  background-color: #e3cfa2;
  background-image: linear-gradient(180deg, rgba(110,66,18,.20), transparent 18px), linear-gradient(90deg, rgba(60,36,8,.30), transparent 30px), linear-gradient(270deg, rgba(110,66,18,.20), transparent 44px), var(--pf-paper-img);
  background-size: auto, auto, auto, 640px auto; background-position: 0 0, 0 0, 0 0, 0 0;
  filter: brightness(.86) saturate(.95);
  clip-path: polygon(0 100%, 4px 22px, 4.7px 16.3px, 6.9px 11px, 10.4px 6.4px, 15px 2.9px, 20.3px 0.7px, 26px 0, calc(100% - 64px) 0, calc(100% - 57.6px) 1.6px, calc(100% - 51.2px) 5.8px, calc(100% - 44.8px) 12.1px, calc(100% - 38.4px) 19.7px, calc(100% - 32px) 28px, calc(100% - 25.6px) 36.3px, calc(100% - 19.2px) 43.9px, calc(100% - 12.8px) 50.2px, calc(100% - 6.4px) 54.4px, 100% 56px, 100% 100%);
  transition: transform .14s ease, filter .14s ease;
}
.pf-tab-btn + .pf-tab-btn { margin-left: -64px; padding-left: 70px; padding-right: 46px; min-width: 318px; background-position: 0 0, 0 0, 0 0, -240px -20px; }
#pf-tab-file { min-width: 300px; }
.pf-tab-btn:hover { transform: translateY(-3px); filter: brightness(.96) saturate(1); }
.pf-tab-btn:focus { outline: none; }
.pf-tab-btn:focus-visible { box-shadow: inset 0 0 0 3px rgba(165,14,26,.85); }

.pf-tab-btn.is-active {
  z-index: 4; height: 78px; padding-top: 14px; cursor: default; filter: none; transform: none;
  background-image: linear-gradient(180deg, rgba(110,66,18,.16), transparent 18px), linear-gradient(90deg, rgba(60,36,8,.16), transparent 26px), linear-gradient(270deg, rgba(110,66,18,.16), transparent 46px), var(--pf-paper-img);
  clip-path: polygon(0 100%, 4px 26px, 4.9px 19.3px, 7.5px 13px, 11.6px 7.6px, 17px 3.5px, 23.3px 0.9px, 30px 0, calc(100% - 64px) 0, calc(100% - 57.6px) 2px, calc(100% - 51.2px) 7.5px, calc(100% - 44.8px) 15.6px, calc(100% - 38.4px) 25.3px, calc(100% - 32px) 36px, calc(100% - 25.6px) 46.7px, calc(100% - 19.2px) 56.4px, calc(100% - 12.8px) 64.5px, calc(100% - 6.4px) 70px, 100% 72px, 100% 100%);
}
.pf-tab-title { display: block; font-size: 1.5rem; font-weight: 900; letter-spacing: .05em; line-height: 1; white-space: nowrap; }
.pf-tab-sub   { display: block; font-size: 1.05rem; line-height: 1.1; margin-top: 3px; margin-left: 22px; white-space: nowrap; opacity: .9; }

/* ---------- FRONT SHEET ---------- */
.patient-file {
  position: relative; z-index: 2; box-sizing: border-box;
  width: 100%; color: var(--pf-ink); overflow: visible;
  background: none; border: 0; box-shadow: none; transform: none;
}
/* the extra class beats the site's .container padding so content stays centred */
.patient-file-wrap .patient-file { max-width: none; margin: 0; padding: 46px 54px 64px; }

/* The real photographed folder: torn edges, curled corner, peeling flakes, back cover.
   Image = /images/folder-frame.webp (9-slice, only the middle stretches). */
.pf-paper {
  position: absolute; z-index: 0; pointer-events: none; box-sizing: border-box;
  inset: -22.2px -66.6px -49.2px -41.4px;
  border-style: solid; border-color: transparent;
  border-width: 332.4px 120.0px 235.2px 72.0px;
  border-image-source: var(--pf-frame-img);
  border-image-slice: 554 200 392 120 fill;
  border-image-width: 332.4px 120.0px 235.2px 72.0px;
  border-image-repeat: stretch;
}

.patient-file a { color: #2a1e00; }
.patient-file strong { color: #14100a; }
.pf-inner { position: relative; z-index: 1; }

/* ---------- PANELS ---------- */
.pf-panel[hidden] { display: none !important; }
.pf-panel:focus { outline: none; }
.pf-panel:not([hidden]) { animation: pf-panel-in .26s ease-out both; }
@keyframes pf-panel-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pf-stamp-in {
  from { opacity: 0; transform: rotate(var(--r, 0deg)) scale(1.7); }
  to   { opacity: .88; transform: rotate(var(--r, 0deg)) scale(1); }
}

/* ---------- STAMPS ---------- */
.pf-stamp {
  position: absolute; z-index: 30; pointer-events: none;
  font-family: Impact, "Arial Black", sans-serif; font-weight: 900; letter-spacing: .03em; line-height: 1.1; text-transform: uppercase;
  color: var(--pf-blood); border: 4px double var(--pf-blood); border-radius: 4px; padding: 5px 10px;
  opacity: .88; background: transparent; mix-blend-mode: multiply;
  -webkit-mask-image: var(--pf-wear); mask-image: var(--pf-wear);
  -webkit-mask-size: 200px; mask-size: 200px;
  transform: rotate(var(--r, 0deg));
}
.pf-panel:not([hidden]) .pf-stamp { animation: pf-stamp-in .34s .12s cubic-bezier(.2,1.5,.4,1) both; }
.pf-stamp-top    { top: 12px; right: 58px; --r: -6deg; font-size: 1.12rem; padding: 4px 9px; }
.pf-stamp-bottom { bottom: 50px; left: 20px; --r: -10deg; font-size: 1.28rem; padding: 5px 10px; }

/* ---------- HEADER ---------- */
.pf-asylum-header { text-align: center; border-bottom: 1px dashed #5e4e28; padding: 14px 0 9px; margin-bottom: 18px; }
.pf-asylum-name { font-weight: 900; letter-spacing: .03em; font-size: 1.14rem; line-height: 1.1; text-transform: uppercase; white-space: nowrap; }
.pf-dos-subject { margin-top: 5px; font-size: .88rem; color: var(--pf-ink-soft); }

/* ---------- NAME / PHOTO / ID ---------- */
.pf-top { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: start; margin-bottom: 14px; }
.pf-top-left, .pf-top-right { padding-top: 12px; min-width: 0; }
.pf-field { border-bottom: 1px solid #4e3e22; padding: 7px 2px; min-width: 0; word-break: break-word; font-weight: 700; font-size: 1rem; }
.pf-right { text-align: right; }

.pf-scrawl { font-family: var(--pf-hand); color: #7a1414; font-size: 1.4rem; line-height: 1; margin-top: 16px; max-width: 210px; opacity: .92; }
.pf-scrawl-l { transform: rotate(-4deg); }
.pf-scrawl-r { margin-left: auto; text-align: right; transform: rotate(3deg); text-decoration: underline wavy rgba(122,20,20,.7); text-underline-offset: 5px; }

.pf-photo { position: relative; background: #f2e6c0; padding: 8px; box-shadow: 0 6px 14px rgba(0,0,0,.26); transform: rotate(-1deg); width: 170px; max-width: 100%; text-align: center; margin-top: -2px; border-radius: 3px; border: 1px solid #8a7a4a; box-sizing: border-box; }
.pf-photo::before, .pf-photo::after { content: ""; position: absolute; width: 80px; height: 26px; background: rgba(230,205,120,.4); top: -10px; z-index: 2; border-radius: 2px; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.pf-photo::before { left: -22px; transform: rotate(-35deg); }
.pf-photo::after  { right: -22px; transform: rotate(35deg); }
.pf-photo-label { margin-top: 8px; font-size: .88rem; white-space: nowrap; }
.pf-photo-img img { max-width: 100%; height: auto; display: block; margin: 0 auto; border: 1px solid #aaa; border-radius: 2px; filter: sepia(.28) contrast(1.05) brightness(.96); }

/* ---------- ACTION BUTTONS ---------- */
.pf-actions { width: 100%; margin-bottom: 16px; }
.pf-actions .nav-tabs { border-bottom: 0; gap: 8px; flex-wrap: wrap; justify-content: center; }
.pf-actions .nav-tabs .nav-item { margin-bottom: 6px; }
.pf-actions .nav-tabs .nav-link {
  background-color: #e8d6a9; background-image: linear-gradient(180deg, rgba(255,255,255,.38), rgba(0,0,0,.08));
  border: 1.5px solid #3b2d14 !important; border-radius: 2px !important; color: #1a1408 !important;
  font-family: var(--pf-type); font-weight: 400; font-size: .84rem; letter-spacing: .04em; text-transform: uppercase;
  padding: 6px 11px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  box-shadow: 2px 2px 0 rgba(40,25,8,.6), inset 0 1px 0 rgba(255,255,255,.5);
  transition: transform .08s ease, box-shadow .08s ease, background-color .12s ease, color .12s ease;
}
.pf-actions .nav-tabs .nav-link:hover { background-color: #f6e8c0; color: #000 !important; transform: translate(1px,1px); box-shadow: 1px 1px 0 rgba(40,25,8,.6), inset 0 1px 0 rgba(255,255,255,.5); }
.pf-actions .nav-tabs .nav-link:active { transform: translate(2px,2px); box-shadow: none; }
.pf-actions .nav-tabs #attack, .pf-actions .nav-tabs #tab-enemy { color: #7d0d18 !important; }
.pf-actions .nav-tabs #attack:hover, .pf-actions .nav-tabs #tab-enemy:hover { background-color: #8c0f1b; color: #f6e3c0 !important; }

/* ---------- BARCODE (top-left of the sheet, like a wristband tag) ---------- */
.patient-file-wrap .pf-barcode { position: absolute; top: 16px; left: 22px; z-index: 3; width: 110px; pointer-events: none; opacity: .9; }
.patient-file-wrap .pf-barcode-bars {
  width: 110px; height: 42px;
  background: repeating-linear-gradient(90deg, #111 0 2px, transparent 2px 4px, #111 4px 5px, transparent 5px 9px, #111 9px 12px, transparent 12px 13px, #111 13px 14px, transparent 14px 18px, #111 18px 21px, transparent 21px 23px, #111 23px 24px, transparent 24px 27px);
}
.patient-file-wrap .pf-barcode-num { color: #111; font-size: .68rem; letter-spacing: .12em; margin-top: 2px; white-space: nowrap; }

/* ---------- DETAIL ROWS ---------- */
.pf-details { position: relative; display: grid; grid-template-columns: 1.05fr .95fr; column-gap: 32px; margin-bottom: 10px; font-size: .95rem; }
.pf-details::after { content: ""; position: absolute; left: 50%; top: 4px; bottom: 4px; width: 1px; background: rgba(107,90,42,.22); }
.pf-detail { border-bottom: 1px solid #4e3e22; padding: 8px 2px; min-width: 0; word-break: break-word; font-weight: 600; }
.pf-detail.pf-right { text-align: right; white-space: nowrap; }
/* the {{PLAYER:LAST_SEEN_BLOCK}} output */
.pf-details .col-6 { border-bottom: 1px solid #4e3e22; padding: 8px 2px; width: auto; flex: none; max-width: none; white-space: nowrap; text-align: right; font-weight: 600; }
.pf-gang { text-align: center; border-bottom: 1px solid #4e3e22; padding: 11px 2px 12px; margin: 6px 0 18px; font-weight: 800; font-size: 1rem; }

/* ---------- SIGNATURE NOTE (clipped to the page, curled corner) ---------- */
.pf-signature-wrap {
  position: relative; z-index: 5; box-sizing: border-box; max-width: 400px;
  margin: 26px auto -108px; padding: 34px 14px 10px;
  transform: rotate(.4deg);
  filter: drop-shadow(0 7px 7px rgba(0,0,0,.36));
}
/* the paper: slightly uneven top edge, rounded top-left, corner cut away under the curl */
.pf-signature-wrap::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background-color: #fdf6d8;
  background-image: linear-gradient(180deg, rgba(120,90,40,.16), transparent 24px), repeating-linear-gradient(transparent, transparent 23px, rgba(100,130,170,.32) 24px);
  border-radius: 4px 0 2px 2px;
  box-shadow: inset 0 0 0 1px rgba(138,122,74,.65);
  clip-path: polygon(0 4px, 3px 1px, 14px .6px, 9% 1.6px, 22% .4px, 38% 1.4px, 52% 0, 68% 1.2px, 82% .3px, calc(100% - 33px) .8px, 100% 33px, 100% 100%, 0 100%);
}
.pf-signature-wrap > * { position: relative; z-index: 1; }
.pf-clip, .pf-clip-back { position: absolute; top: -22px; left: 50%; margin-left: -13px; width: 26px; height: 74px; transform: rotate(-4deg); pointer-events: none; }
.pf-clip { z-index: 6; filter: drop-shadow(1px 2px 1.5px rgba(0,0,0,.5)); }
.pf-clip-back { z-index: -1; }   /* goes behind the paper, so only the top loop shows above the edge */
.pf-note-curl { position: absolute; z-index: 6; top: 0; right: 0; width: 34px; height: 34px; pointer-events: none; overflow: visible; filter: drop-shadow(-1px 1px 1px rgba(0,0,0,.18)); }
.pf-signature-head { display: flex; align-items: baseline; gap: 40px; font-family: var(--pf-type); font-weight: 400; font-size: .78rem; white-space: nowrap; color: #7a1a1a; text-transform: uppercase; margin-bottom: 8px; padding-top: 2px; }
.pf-sig-a, .pf-sig-b { flex: 1 1 0; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.pf-sig-a { text-align: right; }
.pf-sig-b { text-align: left; }


.pf-signature-scroll { max-height: 260px; overflow-y: auto; overflow-x: hidden; padding: 6px 8px 10px; scrollbar-width: thin; scrollbar-color: #999 #ddd; }
.pf-signature-scroll::-webkit-scrollbar { width: 10px; }
.pf-signature-scroll::-webkit-scrollbar-track { background: #ddd; }
.pf-signature-scroll::-webkit-scrollbar-thumb { background: #999; border-radius: 5px; }
.pf-signature-scroll.is-expanded { max-height: none; overflow-y: visible; }
.pf-signature-content { line-height: 24px; font-size: .9rem; word-break: break-word; color: #8a1010; }
.pf-signature-content, .pf-signature-content * { color: #8a1010 !important; background: transparent !important; border-color: transparent !important; }
.pf-signature-content img { max-width: 100% !important; height: auto !important; }
.pf-signature-content iframe { max-width: 100% !important; width: 100% !important; aspect-ratio: 16/9; height: auto !important; border: 0; }
.pf-signature-actions { text-align: center; margin-top: 8px; }
.pf-signature-btn { display: inline-block; background: #e8e8e8; border: 1px solid #666; border-radius: 6px; padding: 5px 12px; font-family: inherit; font-weight: 700; font-size: .9rem; line-height: 1.3; cursor: pointer; color: #111; user-select: none; -webkit-user-select: none; margin: 0; }
.pf-signature-btn:hover { background: #f4f4f4; }
.pf-signature-btn:active { transform: translateY(1px); }
/* expand / collapse without JavaScript: a hidden checkbox + this label */
.pf-sig-check { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.pf-sig-close { display: none; }
.pf-sig-check:checked ~ .pf-signature-actions .pf-sig-open { display: none; }
.pf-sig-check:checked ~ .pf-signature-actions .pf-sig-close { display: inline; }
.pf-sig-check:checked ~ .pf-signature-scroll { max-height: none; overflow-y: visible; }
.pf-sig-check:focus-visible ~ .pf-signature-actions .pf-signature-btn { outline: 2px solid #8a1010; outline-offset: 2px; }

/* ---- player has no signature: the whole note disappears, only the plain line remains ---- */
.pf-signature-actions[hidden] { display: none !important; }
.pf-signature-wrap.pf-sig-none { max-width: none; margin: 22px 0 0; padding: 0; transform: none; filter: none; text-align: center; }
.pf-signature-wrap.pf-sig-none::before,
.pf-signature-wrap.pf-sig-none .pf-clip,
.pf-signature-wrap.pf-sig-none .pf-clip-back,
.pf-signature-wrap.pf-sig-none .pf-note-curl,
.pf-signature-wrap.pf-sig-none .pf-signature-head,
.pf-signature-wrap.pf-sig-none .pf-signature-actions,
.pf-signature-wrap.pf-sig-none .pf-sig-check { display: none !important; }
.pf-signature-wrap.pf-sig-none .pf-signature-scroll { max-height: none; overflow: visible; padding: 0; }
.pf-signature-wrap.pf-sig-none .pf-signature-content { font-size: .9rem; line-height: 1.45; }
.pf-signature-wrap.pf-sig-none .pf-signature-content,
.pf-signature-wrap.pf-sig-none .pf-signature-content * { color: var(--pf-ink-soft) !important; }
.pf-report { text-align: right; margin-top: 8px; }

/* =====================================================================
   CASE DOSSIER (tab 2)
   ===================================================================== */
.pf-dos-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; margin-bottom: 48px; }
.pf-dos-wide { grid-column: 1 / -1; }

.pf-dos-section { position: relative; min-width: 0; background: rgba(253,246,216,.40); border: 1.5px solid rgba(60,40,15,.75); box-shadow: 3px 3px 0 rgba(60,40,15,.28); }
.pf-dos-section-head {
  margin: 0; display: flex; align-items: center; gap: 8px; padding: 7px 12px;
  background-color: #3a1712; background-image: var(--pf-grain);
  color: #ecd9a8; font: 400 .92rem/1.2 var(--pf-type); letter-spacing: .06em; text-transform: uppercase;
}
.pf-dos-section-head .iconify { font-size: 1.15rem; color: #d2493f; flex: none; }
.pf-dos-body { padding: 14px 16px 16px; font-size: .92rem; }
.pf-dos-empty { margin: 0; padding: 8px 0; text-align: center; color: var(--pf-ink-soft); letter-spacing: .03em; }

.pf-dos-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid rgba(78,62,34,.6); }
.pf-dos-row:last-child { border-bottom: 0; }

/* awards */
.pf-awards { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 16px 12px; }
.pf-award { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; }
.pf-award-medal {
  display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; margin-bottom: 4px; font-size: 1.7rem; color: #2b1c04;
  background: radial-gradient(circle at 35% 30%, #e3c35c, #8a6414 72%);
  box-shadow: inset 0 0 0 3px rgba(0,0,0,.22), 0 3px 5px rgba(0,0,0,.4);
}
.pf-award-name { font-weight: 800; font-size: .82rem; line-height: 1.15; }
.pf-award-desc { font-size: .72rem; line-height: 1.2; color: var(--pf-ink-soft); }

/* handwritten staff note */
.pf-dos-note { margin: 0; font-family: var(--pf-hand); font-size: 1.6rem; line-height: 1.15; color: #7a1414; transform: rotate(-.8deg); }

/* redaction bars */
.pf-redact { display: block; height: 1.1em; margin: 0 0 8px; background: #14100a; border-radius: 1px; box-shadow: 0 1px 0 rgba(255,255,255,.12); }
.pf-w-90 { width: 90%; } .pf-w-70 { width: 70%; } .pf-w-45 { width: 45%; }

/* stamps on the dossier */
.pf-stamp-restricted { font-size: 1.12rem; }
.pf-stamp-observed { font-size: 1.15rem; bottom: 40px; left: 24px; }

/* ---------- MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  .pf-panel:not([hidden]), .pf-panel:not([hidden]) .pf-stamp { animation: none !important; }
  .pf-tab-btn, .pf-actions .nav-tabs .nav-link { transition: none; }
}

/* ---------- MOBILE ---------- */
@media (max-width: 768px) {
  .patient-file-wrap { padding: 0 36px 38px 22px; max-width: 100%; width: 100%; overflow: hidden; }
  .pf-folder { filter: drop-shadow(0 6px 8px rgba(0,0,0,.5)); }
  .pf-paper { inset: -11.1px -33.3px -24.6px -20.7px; border-width: 166.2px 60.0px 117.6px 36.0px; border-image-width: 166.2px 60.0px 117.6px 36.0px; }

  .pf-tabs { margin-left: 0; }
  .pf-tab-btn { min-width: 0; flex: 1 1 0; height: 52px; margin-bottom: -6px; padding: 8px 40px 0 18px; clip-path: polygon(0 100%, 3px 12px, 3.4px 8.9px, 4.6px 6px, 6.5px 3.5px, 9px 1.6px, 11.9px 0.4px, 15px 0, calc(100% - 34px) 0, calc(100% - 30.6px) 1.3px, calc(100% - 27.2px) 4.8px, calc(100% - 23.8px) 9.9px, calc(100% - 20.4px) 16.2px, calc(100% - 17px) 23px, calc(100% - 13.6px) 29.8px, calc(100% - 10.2px) 36.1px, calc(100% - 6.8px) 41.2px, calc(100% - 3.4px) 44.7px, 100% 46px, 100% 100%); }
  .pf-tab-btn + .pf-tab-btn { margin-left: -30px; padding-left: 40px; padding-right: 34px; min-width: 0; background-position: 0 0, 0 0, 0 0, -120px -10px; }
  #pf-tab-file { min-width: 0; }
  .pf-tab-btn.is-active { height: 64px; padding-top: 10px; clip-path: polygon(0 100%, 3px 14px, 3.5px 10.4px, 4.9px 7px, 7.1px 4.1px, 10px 1.9px, 13.4px 0.5px, 17px 0, calc(100% - 34px) 0, calc(100% - 30.6px) 1.6px, calc(100% - 27.2px) 6px, calc(100% - 23.8px) 12.5px, calc(100% - 20.4px) 20.4px, calc(100% - 17px) 29px, calc(100% - 13.6px) 37.6px, calc(100% - 10.2px) 45.5px, calc(100% - 6.8px) 52px, calc(100% - 3.4px) 56.4px, 100% 58px, 100% 100%); }
  .pf-tab-title { font-size: .84rem; letter-spacing: 0; }
  .pf-tab-sub { font-size: .62rem; margin-left: 6px; letter-spacing: -.01em; }
  .pf-tab-btn + .pf-tab-btn { padding-right: 34px; }

  .patient-file-wrap .patient-file { padding: 24px 14px 70px; }

  .pf-stamp-top { top: 8px; right: 30px; --r: -5deg; font-size: .8rem; padding: 3px 7px; border-width: 3px; }
  .pf-stamp-bottom { bottom: 8px; left: 8px; font-size: .9rem; padding: 4px 8px; }
  .pf-stamp-observed { font-size: .8rem; }

  /* barcode: sits in the flow above the header instead of on top of it */
  .patient-file-wrap .pf-barcode { position: static; width: 88px; margin: 0 0 8px; }
  .patient-file-wrap .pf-barcode-bars { width: 88px; height: 32px; }
  .patient-file-wrap .pf-barcode-num { font-size: .6rem; letter-spacing: .1em; }

  .pf-asylum-header { padding: 12px 0 6px; }
  .pf-stamp-bottom { bottom: 14px; }
  .pf-asylum-name { font-size: .95rem; white-space: normal; letter-spacing: .01em; line-height: 1.25; }

  .pf-top { grid-template-columns: 1fr; justify-items: center; gap: 8px; }
  .pf-top-left, .pf-top-right { width: 100%; padding-top: 0; }
  .pf-scrawl { display: none; }
  .pf-field { font-size: .95rem; padding: 6px 2px; }
  .pf-field.pf-right { text-align: left; white-space: normal; }
  .pf-photo { width: 160px; margin: 4px auto; }
  .pf-photo::before, .pf-photo::after { width: 56px; height: 20px; }
  .pf-photo-label { white-space: normal; font-size: .85rem; }

  .pf-actions .nav-tabs { gap: 6px; }
  .pf-actions .nav-tabs .nav-item { flex: 1 1 42%; max-width: 48%; display: flex; justify-content: center; margin-bottom: 3px; }
  .pf-actions .nav-tabs .nav-link { width: 100%; justify-content: center; font-size: .7rem; letter-spacing: .01em; padding: 6px 3px; white-space: nowrap; }

  .pf-details { grid-template-columns: 1fr; font-size: .95rem; }
  .pf-details::after { display: none; }
  .pf-detail { padding: 7px 2px; }
  .pf-detail.pf-right { text-align: left; white-space: normal; }
  .pf-details .col-6 { white-space: normal; text-align: left !important; font-size: .95rem; }
  .pf-gang { font-size: .95rem; line-height: 1.35; padding: 8px 2px; }

  .pf-signature-wrap { max-width: 100%; width: 100%; transform: none; margin: 22px 0 6px; padding: 34px 10px 10px; }
  .pf-signature-wrap.pf-sig-none { margin: 18px 0 34px; padding: 0; }
  .pf-signature-head { gap: 40px; font-size: .6rem; }
  .pf-clip, .pf-clip-back { width: 22px; height: 62px; margin-left: -11px; }
  .pf-signature-scroll { max-height: 220px; padding: 4px 4px 8px; }
  .pf-signature-btn { font-size: .85rem; padding: 5px 10px; }

  .pf-dos-grid { grid-template-columns: 1fr; gap: 16px; }
  .pf-dos-body { padding: 12px; }
  .pf-dos-note { font-size: 1.35rem; }
}
/*=======END PATIENT PROFILE FILE=======*/


/* === GYM V4 === */
#gym-v4{max-width:1120px;margin:0 auto;background:#0c0c0e;border:1px solid #1f1f1f;position:relative}
.gym-v4-header{border-left:3px solid #8b0000;border-bottom:2px solid #ffc107;padding:16px;background:#111113;text-align:center}
.gym-v4-title{letter-spacing:3px;font-size:14px;color:#e8e8e8} .gym-v4-title span{color:#ffc107}
.gym-v4-sub{font-size:10px;color:#666;margin-top:4px;letter-spacing:1px}
.gym-v4-label{font-size:10px;letter-spacing:2px;color:#555;padding:10px 14px;border-bottom:1px solid #1a1a1a;background:#0f0f11}
.gym-v4-label.red{color:#ff4444;border-left:3px solid #8b0000;background:#161011}
.gym-mem-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;padding:10px;background:#0a0a0a}
.mem-file{background:#151517;border:1px solid #222;border-left:3px solid var(--c);padding:12px;position:relative}
.mem-file.is-active{border-color:#ffc107;box-shadow:0 0 12px rgba(255,193,7,.15)}
.mem-file-top{display:flex;justify-content:space-between;font-weight:900;font-size:12px;color:#ddd;letter-spacing:1px}
.mem-file-desc{font-size:11px;color:#666;margin:8px 0;min-height:28px}
.mem-file-meta{font-size:10px;color:#555}
.mem-file-active{margin-top:10px;border:1px dashed #ffc107;color:#ffc107;font-size:10px;padding:4px;text-align:center;letter-spacing:1px}
.mem-buy{margin-top:10px;width:100%;background:#0a0a0a;border:1px solid #333;color:#aaa;padding:7px;font-size:11px;letter-spacing:2px;transition:.2s}
.mem-buy:hover{border-color:var(--c);color:#fff;background:#1a1a1a}
.admin-folder{border:1px solid #222;background:#0e0e0e;margin-bottom:18px}
.admin-folder-tab{background:#111;border-bottom:1px solid #222;color:#ffc107;font-size:11px;letter-spacing:2px;padding:8px 12px;font-weight:900}
.admin-folder-body{padding:12px}
.admin-form{display:grid;grid-template-columns:1fr 1.5fr 90px 90px 80px 60px 120px;gap:6px}
.admin-form input{background:#151515;border:1px solid #222;border-bottom:2px solid #333;color:#ccc;padding:8px;font-size:12px}
.admin-form input:focus{border-bottom-color:#ffc107;outline:none}
.admin-save{background:#ffc107;color:#000;font-weight:900;border:0;padding:8px;letter-spacing:1px}
.admin-list{margin-top:12px;border-top:1px solid #1a1a1a}
.admin-row{display:grid;grid-template-columns:1fr 1fr 200px;gap:8px;padding:8px 0;border-bottom:1px solid #151515;font-size:12px;color:#888}
.a-edit{background:#1a1a1a;border:1px solid #333;color:#ffc107;padding:3px 8px;font-size:11px}
.a-del{background:#1a0a0a;border:1px solid #331a1a;color:#ff4444;padding:3px 8px;font-size:11px}
.gym-burn-console{display:grid;grid-template-columns:140px 1fr 180px;gap:0;background:#101010;border-top:1px solid #222;border-bottom:1px solid #222;align-items:center}
.burn-left{text-align:center;padding:14px;border-right:1px solid #222}
.burn-label{font-size:9px;color:#666;letter-spacing:2px} .burn-val{font-size:28px;font-weight:900;color:#ffc107;line-height:1}
.burn-center{padding:12px 18px} #gym-energy-slider{width:100%;accent-color:#ffc107;height:4px}
.burn-presets{display:flex;gap:6px;margin-top:8px} .burn-presets button{background:#1a1a1a;border:1px solid #2a2a2a;color:#777;font-size:11px;padding:4px 10px} .burn-presets button.is-max{background:#ffc107;color:#000;font-weight:900}
.burn-right{padding:12px;border-left:1px solid #222;font-size:10px;color:#555;text-align:right;line-height:1.3}
.pit-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:1px;background:#1f1f1f}
.pit-station{position:relative;background:#121214;padding:28px 18px 18px;min-height:300px;overflow:hidden}
.pit-num{position:absolute;top:10px;right:12px;font-size:42px;font-weight:900;color:#1e1e20;line-height:1}
.pit-bar{position:absolute;left:0;top:0;bottom:0;width:3px;background:#222}
.s-strength .pit-bar{background:#ffc107} .s-speed .pit-bar{background:#00d4ff} .s-defense .pit-bar{background:#00ff88}
.pit-station h3{font-size:13px;letter-spacing:4px;color:#888;margin:0}
.pit-stat{font-size:32px;font-weight:900;letter-spacing:-1px;color:#e8e8e8;margin:10px 0;line-height:1}
.s-strength .pit-stat{color:#ffc107} .s-speed .pit-stat{color:#00d4ff} .s-defense .pit-stat{color:#00ff88}
.pit-station p{font-size:11px;color:#555;min-height:32px;margin:0}
.pit-btn{margin-top:18px;width:100%;background:#0a0a0a;border:1px solid #2a2a2a;color:#aaa;padding:12px 0;font-weight:900;letter-spacing:3px;font-size:12px;position:relative;overflow:hidden;transition:.15s}
.pit-btn:after{content:'';position:absolute;left:0;top:0;bottom:0;width:0;background:#ffc107;transition:.25s;z-index:1}
.s-speed .pit-btn:after{background:#00d4ff} .s-defense .pit-btn:after{background:#00ff88}
.pit-btn span{position:relative;z-index:2}
.pit-btn:hover{color:#000;border-color:transparent} .pit-btn:hover:after{width:100%}
#gym-toast{position:fixed;bottom:18px;left:50%;transform:translateX(-50%);z-index:9999}
#gym-toast .toast-msg{background:#0e0e0e;border-left:3px solid #ffc107;border-top:1px solid #222;padding:10px 14px;margin-top:6px;font-size:12px;color:#ddd;min-width:260px;box-shadow:0 10px 30px rgba(0,0,0,.8)}
@media(max-width:800px){.gym-mem-grid,.pit-grid,.gym-burn-console{grid-template-columns:1fr} .admin-form{grid-template-columns:1fr 1fr}}
#gym-toast .toast-msg.success{border-left-color:#00ff88 !important;background:#0a1a12 !important;color:#00ff88 !important;box-shadow:0 0 20px rgba(0,255,136,.25)}
#gym-toast .toast-msg.error{border-left-color:#ff4444 !important;background:#1a0a0a !important;color:#ff8888 !important}
.admin-brief{border:1px dashed #2a2a1a;background:#0e0e0b;margin-bottom:14px;padding:0}
.brief-header{background:#15150e;border-bottom:1px dashed #2a2a1a;color:#ffc107;font-size:10px;letter-spacing:2px;padding:7px 10px;font-weight:900}
.brief-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:1px;background:#1e1e16}
.brief-item{background:#12120e;padding:10px 12px}
.brief-item b{display:block;color:#e8e8e8;font-size:11px;letter-spacing:1px;margin-bottom:4px}
.brief-item span{display:block;color:#777;font-size:11px;line-height:1.4}
.brief-item code{background:#1a1a12;border:1px solid #2a2a1a;color:#ffc107;padding:1px 4px;font-size:10px}
.brief-example{padding:8px 12px;font-size:11px;color:#666;border-top:1px dashed #2a2a1a;background:#0f0f0a}
.brief-example b{color:#aaa}
@media(max-width:800px){.brief-grid{grid-template-columns:1fr}}


*, *::before, *::after { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
.ra-bar { background: #0b0b0d !important; }


/* ==========================================================
   FIX v2 additions
   ========================================================== */

/* Breathing room between tab buttons and the headings under them */
.ra-main .as-decorated-h-3 { margin-top: 1.5rem; }
.ra-main > .as-decorated-h-3:first-child { margin-top: 0; }
.ra-main .nav-tabs { margin-bottom: .25rem; }
/* Isolation: my page-wide heading/tab spacing tweaks must never touch the patient-file folder */
.patient-file-wrap .as-decorated-h-3 { margin-top: 0; }
.patient-file-wrap .nav-tabs { margin-bottom: 0; }

/* ==========================================================
   Sidebar: STICKY, with its own scroll only as a last resort.
   Research: sticky left nav is much faster to use (USAGov test: 12s vs 40s to first click),
   but long sticky menus that need their own scrollbar cause discoverability problems (Smashing/NN-g).
   So: stay sticky, and shrink spacing on shorter screens so the whole menu normally FITS.
   ========================================================== */
.ra-side {
    padding-bottom: 1px;
    scrollbar-width: thin;                       /* slim bar if it ever has to scroll */
    scrollbar-color: rgba(255,255,255,.18) transparent;
    overscroll-behavior: contain;                /* wheel at the end of the menu doesn't yank the page */
}
.ra-side::-webkit-scrollbar { width: 6px; }
.ra-side::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 3px; }
.ra-side::-webkit-scrollbar-track { background: transparent; }

/* Scroll hint: soft fade at the top/bottom edge of the sidebar ONLY while there is more to scroll in that direction.
   Works two ways:
   1) With ra-sidebar-fade.js loaded (recommended, works in every browser): the script sets
      data-ra-fade="top bottom" on .ra-side and the CSS below reads it.
   2) Without the script: browsers with scroll-driven animations (Chrome/Edge/Safari 26+) still get the fade. */
@property --ra-fade-t { syntax: '<length>'; inherits: false; initial-value: 0px; }
@property --ra-fade-b { syntax: '<length>'; inherits: false; initial-value: 0px; }
@keyframes ra-side-fade {
    0%   { --ra-fade-t: 0px;  --ra-fade-b: 30px; }
    4%   { --ra-fade-t: 30px; --ra-fade-b: 30px; }
    96%  { --ra-fade-t: 30px; --ra-fade-b: 30px; }
    100% { --ra-fade-t: 30px; --ra-fade-b: 0px; }
}
@media (min-width: 960px) {
    /* (2) CSS-only path */
    @supports (animation-timeline: scroll()) {
        .ra-side:not([data-ra-fade]) {
            -webkit-mask-image: linear-gradient(to bottom, transparent, #000 var(--ra-fade-t), #000 calc(100% - var(--ra-fade-b)), transparent);
            mask-image: linear-gradient(to bottom, transparent, #000 var(--ra-fade-t), #000 calc(100% - var(--ra-fade-b)), transparent);
            animation: ra-side-fade linear both;
            animation-timeline: scroll(self);
        }
    }
    /* (1) Script path */
    .ra-side[data-ra-fade] {
        --ra-fade-t: 0px; --ra-fade-b: 0px;
        -webkit-mask-image: linear-gradient(to bottom, transparent, #000 var(--ra-fade-t), #000 calc(100% - var(--ra-fade-b)), transparent);
        mask-image: linear-gradient(to bottom, transparent, #000 var(--ra-fade-t), #000 calc(100% - var(--ra-fade-b)), transparent);
    }
    .ra-side[data-ra-fade~="top"]    { --ra-fade-t: 30px; }
    .ra-side[data-ra-fade~="bottom"] { --ra-fade-b: 30px; }
}

/* Spacing tiers are driven by variables. Thresholds differ by 58px (the height of the top bar)
   depending on whether the top bar is showing (default) or hidden (body.ra-bar-off). */
@media (min-width: 960px) {
    .ra-side { gap: var(--rs-gap, 1rem); }
    .ra-info, .ra-sec { padding: var(--rs-pad, 1rem); }
    .ra-side .ra-sec__title, .ra-side .as-widget-title, .ra-side .as-decorated-h-3 { margin-bottom: var(--rs-title-mb, .75rem); }
    .ra-sec ul { gap: var(--rs-list-gap, 2px); }
    .ra-link { min-height: var(--rs-link-h, 40px); padding: var(--rs-link-py, .5rem) .7rem; font-size: var(--rs-link-fs, .95rem); }
    .ra-link .iconify { width: var(--rs-icon, 1.2rem); height: var(--rs-icon, 1.2rem); }
    .ra-info__list { font-size: var(--rs-info-fs, .85rem); }
    .ra-info__actions { margin-top: var(--rs-act-mt, .8rem); padding-top: var(--rs-act-pt, .7rem); }
}

/* Tier A: medium-height screens */
@media (min-width: 960px) and (max-height: 1110px) { body.ra-app:not(.ra-bar-off) { --rs-gap:.7rem; --rs-pad:.8rem; --rs-title-mb:.5rem; --rs-list-gap:0px; --rs-link-h:32px; --rs-link-py:.25rem; --rs-link-fs:.92rem; --rs-act-mt:.5rem; --rs-act-pt:.5rem; } }
@media (min-width: 960px) and (max-height: 1050px) { body.ra-bar-off { --rs-gap:.7rem; --rs-pad:.8rem; --rs-title-mb:.5rem; --rs-list-gap:0px; --rs-link-h:32px; --rs-link-py:.25rem; --rs-link-fs:.92rem; --rs-act-mt:.5rem; --rs-act-pt:.5rem; } }
/* Tier B: typical laptop heights */
@media (min-width: 960px) and (max-height: 910px) { body.ra-app:not(.ra-bar-off) { --rs-gap:.55rem; --rs-pad:.65rem .8rem; --rs-link-h:29px; --rs-link-py:.15rem; --rs-link-fs:.88rem; --rs-icon:1.05rem; --rs-info-fs:.8rem; } }
@media (min-width: 960px) and (max-height: 850px)  { body.ra-bar-off { --rs-gap:.55rem; --rs-pad:.65rem .8rem; --rs-link-h:29px; --rs-link-py:.15rem; --rs-link-fs:.88rem; --rs-icon:1.05rem; --rs-info-fs:.8rem; } }
/* Tier C: very short windows (may still scroll inside; that's the unavoidable last resort) */
@media (min-width: 960px) and (max-height: 850px) { body.ra-app:not(.ra-bar-off) { --rs-link-h:26px; --rs-link-fs:.84rem; } }
@media (min-width: 960px) and (max-height: 790px) { body.ra-bar-off { --rs-link-h:26px; --rs-link-fs:.84rem; } }

/* ---------- Mobile ---------- */
@media (max-width: 959.98px) {
    html, body { overflow-x: clip; max-width: 100%; }
    .ra-shell { padding: 0 .75rem; }

    /* logo + stat circles stack instead of squashing */
    .ra-statusrow { flex-wrap: wrap; justify-content: center; gap: .75rem; }
    .ra-stats { max-width: 420px; margin: 0 auto; }

    /* drawer fills the real visible height on mobile browsers */
    .ra-side { height: 100vh; height: 100dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; -webkit-mask-image: none; mask-image: none; }

    .ra-main h1 { font-size: 1.5rem; }
    .ra-main h2 { font-size: 1.25rem; }
    .ra-brand__name { font-size: 1rem; }

    /* headings never force the page wider */
    .as-decorated-h-3 { letter-spacing: .08em !important; }
    .ra-main { overflow-wrap: anywhere; }
}