/* ==========================================================================
   Fam.DeadMojo — Liquid Glass design system
   Frosted, translucent panels that let content/imagery bleed through from
   behind, per Apple's Liquid Glass material guidance: "clear" variant for
   panels over rich imagery (login), "regular" variant for panels over plain
   content (dashboard, admin) where legibility matters more.
   ========================================================================== */

/* A class that sets its own `display` (flex/inline-flex/grid/etc.) beats the
   browser's built-in `[hidden] { display: none }` rule, since both are
   equal-specificity but author styles always outrank user-agent styles.
   Without this, toggling `.hidden = true` in JS silently does nothing on
   any element whose class declares display — this bit us on the photo
   gallery's bottom bars. Global reset so it can't happen again. */
[hidden] { display: none !important; }

:root {
    --bg-base: #08080c;
    --bg-base-2: #101018;

    --glass-bg-clear: rgba(255, 255, 255, 0.055);
    --glass-bg-regular: rgba(255, 255, 255, 0.09);
    --glass-bg-strong: rgba(255, 255, 255, 0.13);
    --glass-border: rgba(255, 255, 255, 0.16);
    --glass-border-strong: rgba(255, 255, 255, 0.24);
    --glass-highlight: rgba(255, 255, 255, 0.4);
    --glass-blur: 26px;

    --accent: #8b5cf6;
    --accent-2: #6366f1;
    --accent-soft: rgba(139, 92, 246, 0.35);

    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #60a5fa;

    --text-primary: #f5f5f7;
    --text-secondary: rgba(245, 245, 247, 0.68);
    --text-tertiary: rgba(245, 245, 247, 0.45);

    --radius-xl: 32px;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;

    --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.09);
    --shadow-glass-lg: 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);

    --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }

/* ---- Base glass panel ---------------------------------------------- */

.glass {
    position: relative;
    background: var(--glass-bg-regular);
    backdrop-filter: blur(var(--glass-blur)) saturate(200%) brightness(1.05);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(200%) brightness(1.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass);
    overflow: hidden;
}

.glass::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(180deg, var(--glass-highlight), transparent 40%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0.5;
    z-index: 1;
}

/* The glossy specular highlight that makes glass read as "liquid" rather
   than a flat frosted panel — a soft light source glinting off the top edge. */
.glass::after {
    content: "";
    position: absolute;
    top: -55%;
    left: -15%;
    width: 75%;
    height: 90%;
    background: radial-gradient(ellipse at top left, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.06) 45%, transparent 70%);
    pointer-events: none;
    transform: rotate(-8deg);
}

/* ::before/::after are positioned (paint above plain in-flow content per
   CSS stacking rules) — lift real content above the decorative overlay. */
.glass > * { position: relative; z-index: 1; }

/* "Clear" variant — for use over rich photographic backgrounds (login) */
.glass-clear {
    background: var(--glass-bg-clear);
    backdrop-filter: blur(34px) saturate(220%) brightness(1.1);
    -webkit-backdrop-filter: blur(34px) saturate(220%) brightness(1.1);
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: var(--shadow-glass-lg);
}

/* "Strong" variant — higher opacity, for elements needing max legibility */
.glass-strong {
    background: var(--glass-bg-strong);
    border-color: var(--glass-border-strong);
    /* Popups that use this without .glass (AI info/confirm/lightbox) were
       square-cornered. */
    border-radius: var(--radius-lg);
}

/* ---- Buttons ---------------------------------------------------------- */

.btn-glass {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.75rem;
    border-radius: 999px;
    background: var(--glass-bg-strong);
    backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    /* Shiny-edge-over-frosted-center material: no flat border at all - a
       crisp inset rim plus two off-center specular highlights (light
       catching the top-left and bottom-right of the glass) standing in for
       an actual reflective edge, same recipe as the calendar/nav pills
       (css/liquid-kit.css's .lk-switcher__toggle and .app-nav-pill). The
       backdrop-filter blur above is what gives the frosted center; this is
       purely the rim. */
    box-shadow:
        inset 0 0 0 1px var(--glass-border-strong),
        inset 2px 1px 0 -1px rgba(255, 255, 255, 0.55),
        inset -1.5px -1px 0 -1px rgba(255, 255, 255, 0.3),
        0 3px 6px rgba(0, 0, 0, 0.25);
    /* The transform's easing is a hand-tuned elastic overshoot curve (via
       linear(), which plays back a fixed sequence of stops rather than
       interpolating a bezier) instead of a plain ease - ported from a
       reference "liquid glass" button's press animation. Since it drives a
       real CSS transition (not a JS spring like the calendar/nav pills),
       both the press-in AND the release bounce-back play automatically:
       :active applies the pressed transform, and leaving :active reverses
       it, both animated by this same curve. */
    transition: transform 380ms linear(0, 0.01 0.9%, 0.037 1.8%, 0.148 3.8%, 0.762 11%, 0.985 14.2%, 1.062 15.7%, 1.125 17.3%, 1.167 18.9%, 1.191 20.5%, 1.199 22.5%, 1.185 24.8%, 1.012 35.7%, 0.979 39%, 0.963 42.4%, 0.963 47%, 0.997 57.7%, 1.007 64%, 1), background 0.15s ease, box-shadow 0.15s ease;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
    box-shadow:
        inset 0 0 0 1px var(--glass-border-strong),
        inset 2px 1px 0 -1px rgba(255, 255, 255, 0.7),
        inset -1.5px -1px 0 -1px rgba(255, 255, 255, 0.4),
        0 6px 14px rgba(0, 0, 0, 0.3);
}
/* Presses down and tilts back in 3D (perspective() is applied per-element
   here rather than needing a parent with its own `perspective` set) instead
   of just retracting the hover lift - the frosted background/blur/rim above
   are untouched, only the motion changed. */
.btn-glass:active { transform: perspective(400px) rotateX(14deg) scale(0.92); }

/* Apple's actual Liquid Glass material (see css/liquid-kit.css's own
   research note on lk-lens-bloom) isn't a saturated brand-color fill - it's
   a brighter/more opaque pane of the same frosted glass as every other
   button, with depth coming from shadow, not color, and it darkens rather
   than glows on interaction (the material "flexing" inward). Kept as its
   own class rather than folded into .btn-glass since a "primary" action
   still needs to read as more prominent than a plain glass button - just
   through more opacity/shadow, not a purple gradient. --accent/--accent-2
   themselves are untouched (badges, focus rings, the "today" calendar
   highlight, etc. still use them) since only the buttons were the complaint. */
.btn-accent {
    background: rgba(255, 255, 255, 0.24);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.4),
        inset 2px 1px 0 -1px rgba(255, 255, 255, 0.75),
        inset -1.5px -1px 0 -1px rgba(255, 255, 255, 0.4),
        0 8px 24px rgba(0, 0, 0, 0.35);
}

.btn-accent:hover {
    background: rgba(255, 255, 255, 0.15);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.3),
        inset 2px 1px 0 -1px rgba(255, 255, 255, 0.55),
        inset -1.5px -1px 0 -1px rgba(255, 255, 255, 0.3),
        0 6px 18px rgba(0, 0, 0, 0.4);
}

.btn-danger {
    background: rgba(248, 113, 113, 0.18);
    color: #ffd6d6;
    box-shadow:
        inset 0 0 0 1px rgba(248, 113, 113, 0.45),
        inset 2px 1px 0 -1px rgba(255, 255, 255, 0.45),
        inset -1.5px -1px 0 -1px rgba(255, 255, 255, 0.2),
        0 3px 6px rgba(0, 0, 0, 0.25);
}

.btn-sm { padding: 0.5rem 1.1rem; font-size: 0.85rem; }

/* ---- Form inputs -------------------------------------------------------- */

.input-glass {
    width: 100%;
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.06);
    /* Unlike .btn-glass (which has always carried its own blur), this only
       had a flat translucent tint - so it read as proper frosted glass when
       nested inside an already-blurred .glass card, and flat everywhere it
       wasn't (e.g. Notes' New/Edit form, which sits directly on <main> with
       no card wrapper around it). Matching .btn-glass's own blur here makes
       every .input-glass self-sufficient regardless of what, if anything, is
       behind it. */
    backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color 0.15s ease, background 0.15s ease;
    /* Without this, a native date/time picker (used by the personal
       calendar's event form) renders its calendar/clock icon assuming a
       light background, which is nearly invisible against this field's dark
       fill. Scoped to inputs rather than :root so it can't affect anything
       else on the page. */
    color-scheme: dark;

    /* A multi-line .input-glass (chat composer, AI chat box, calendar
       description, profile bio) otherwise falls back to the plain OS
       scrollbar the instant its content overflows - the one part of these
       fields the color-scheme:dark rule above doesn't reach, since that
       only themes native form-control chrome (date/time pickers), not
       scrollbars. Firefox honors scrollbar-width/-color directly; the
       -webkit- rules below cover Chrome/Edge/Safari the same way
       .lk-select-panel's own scrollbar already does. */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Site rule: no visible scrollbars anywhere. Everything still scrolls. */
html, body, * { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }
.input-glass::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* A <input type="file">'s "Choose File(s)" button is a pseudo-element the
   OS/browser draws itself (like a native <select> popup - see .lk-select in
   liquid-kit.css for that one) - no amount of styling .input-glass itself
   touches it. ::file-selector-button is the standard hook (Baseline since
   2023); ::-webkit-file-upload-button is the older Chrome/Safari-only alias,
   kept alongside it for any engine that hasn't picked up the standard name
   yet. Matches .btn-glass/.btn-sm exactly so it reads as the same pill
   button used everywhere else, not a leftover OS control. */
.input-glass[type="file"] { padding: 0.5rem 0.9rem; cursor: pointer; }
.input-glass[type="file"]::file-selector-button,
.input-glass[type="file"]::-webkit-file-upload-button {
    margin-right: 0.75rem;
    padding: 0.5rem 1.1rem;
    border-radius: 999px;
    border: 1px solid var(--glass-border-strong);
    background: var(--glass-bg-strong);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}
.input-glass[type="file"]:hover::file-selector-button,
.input-glass[type="file"]:hover::-webkit-file-upload-button {
    background: rgba(255, 255, 255, 0.18);
}

.input-glass::placeholder { color: var(--text-tertiary); }
.input-glass:focus { border-color: var(--accent); background: rgba(255, 255, 255, 0.09); }

/* Visually masks a plain text input like a password field, without ever
   using type="password" - that attribute is what triggers Chrome's "Save/
   Update password?" prompt, which we don't want for things like a Secure
   Folder PIN that isn't an account credential. */
.masked-input { -webkit-text-security: disc; text-security: disc; }

/* ---- Layout shell for logged-in pages ---------------------------------- */

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.5rem;
    background: rgba(10, 10, 15, 0.55);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
}

.app-topbar .brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.1rem; }
.app-topbar .brand img { width: 28px; height: 28px; border-radius: 8px; }

.nav-toggle-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg-regular);
    color: var(--text-primary);
    cursor: pointer;
}
.nav-toggle-btn .icon-close { display: none; }
.nav-toggle-btn.is-open .icon-open { display: none; }
.nav-toggle-btn.is-open .icon-close { display: block; }

.nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    /* Below .app-topbar's own z-index (50), not above it: .app-topbar sets
       position + z-index, which makes it a stacking context of its own, so
       .app-nav's z-index only ranks it within that context — it can't
       outrank a sibling of .app-topbar no matter how high it's set. A
       backdrop z-index higher than 50 sits on top of the whole sidebar
       (invisible through the transparency, but still the topmost hit-test
       target), which swallows every tap on a nav link into "close sidebar"
       instead of letting the link navigate. Staying under 50 keeps the
       backdrop below the topbar's whole subtree while still sitting above
       .app-main's content (z-index: 1) to dim it.
    */
    z-index: 45;
    background: rgba(5, 5, 10, 0.55);
}
.nav-backdrop.is-open { display: block; }

.app-nav { display: flex; align-items: center; gap: 0.4rem; position: relative; }

/* Desktop-only sliding pill behind whichever top-level nav item is active -
   same spring-physics glide as .lk-switcher (js/liquid-kit.js's
   lkInitNavPill), inserted as #appNav's first child so it paints below the
   links/triggers (see their own z-index below) without needing its own
   stacking rules. Hidden by JS under the 700px breakpoint, where #appNav
   becomes the vertical off-canvas sidebar and .active falls back to the
   plain background+border below instead. */
.app-nav-pill {
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: 0;
    border-radius: 999px;
    z-index: 0;
    background: var(--glass-bg-strong);
    box-shadow:
        inset 0 0 0 1px var(--glass-border-strong),
        inset 2px 1px 0 -1px rgba(255, 255, 255, 0.55),
        inset -1.5px -1px 0 -1px rgba(255, 255, 255, 0.3),
        0 3px 6px rgba(0, 0, 0, 0.25);
    transform-origin: center center;
    pointer-events: none;
}

.app-nav a {
    position: relative;
    z-index: 1;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.app-nav a:hover { background: rgba(255, 255, 255, 0.08); color: var(--text-primary); }
.app-nav a.active { color: var(--text-primary); }
.app-nav a.admin-link { color: var(--warning); }

/* Fallback highlight for whenever the animated pill isn't running - the
   mobile sidebar (re-declared under the 700px breakpoint below) and the
   brief window before JS finishes measuring on first paint. */
body:not(.has-nav-pill) .app-nav a.active { background: var(--glass-bg-strong); border: 1px solid var(--glass-border); }

/* Unread-count pill on the Chat link. inline-flex on the anchor rather than
   an absolutely-positioned dot: the nav is a flex row of pills with no
   positioning context of its own, and an overlaid badge would be clipped by
   the mobile sidebar's overflow-y:auto. */
.app-nav a.nav-with-badge { display: inline-flex; align-items: center; gap: 0.45rem; }
/* Same badge pattern reused inside the user dropdown (Admin/Profile) - those
   links need to stay block-level and full-width like every other dropdown
   item (.nav-dropdown-menu a below sets display:block), so inline-flex here
   would wrongly put them side-by-side with their neighbor instead of
   stacking. flex + space-between keeps the stack but pushes the badge to
   the link's own right edge. */
.nav-dropdown-menu a.nav-with-badge { display: flex; align-items: center; justify-content: space-between; gap: 0.45rem; }
/* Bell icon and "Chat" label stay glued together as one unit so the mobile
   space-between rule below only ever pushes the badge to the far edge,
   never the label away from its own icon. */
.nav-with-badge-label { display: inline-flex; align-items: center; gap: 0.45rem; }

.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 19px;
    height: 19px;
    padding: 0 0.34rem;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 0 12px var(--accent-soft);
}
.nav-badge[hidden] { display: none; }

/* Bell icon on the Chat link - flat/muted until there's something unread,
   then switches to a lit, glowing accent color so a new DM/group message
   reads as a real notification at a glance, not just a number that happens
   to be nonzero. */
.nav-chat-bell { flex-shrink: 0; color: var(--text-secondary); transition: color 0.15s ease; }
.app-nav a.nav-with-badge.has-unread .nav-chat-bell {
    color: var(--accent);
    filter: drop-shadow(0 0 4px var(--accent-soft));
}
/* Every page load is a full navigation on this site (no SPA routing), so
   tying the ring to .has-unread itself would replay it on every single page
   view for as long as something's unread - naggy rather than a genuine "new
   message" cue. Instead js/header's famSetChatBadge adds this class only
   for the one transition from 0 unread to >0 during the current page view,
   and removes it once the animation finishes. */
.nav-chat-bell.bell-ring { animation: lk-bell-ring 0.6s ease; }
@keyframes lk-bell-ring {
    0%, 100% { transform: rotate(0deg); }
    20% { transform: rotate(-14deg); }
    40% { transform: rotate(11deg); }
    60% { transform: rotate(-7deg); }
    80% { transform: rotate(4deg); }
}
@media (prefers-reduced-motion: reduce) {
    .nav-chat-bell.bell-ring { animation: none; }
}

.nav-dropdown { position: relative; z-index: 1; }

.nav-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    gap: 0.35rem;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-dropdown-trigger:hover { background: rgba(255, 255, 255, 0.08); color: var(--text-primary); }
.nav-dropdown-trigger.active { color: var(--text-primary); }
/* Same pill-or-fallback split as .app-nav a.active above. */
body:not(.has-nav-pill) .nav-dropdown-trigger.active { background: var(--glass-bg-strong); border: 1px solid var(--glass-border); }

/* Plain frosted-glass panel again - no longer split into a separate
   .nav-dropdown-glass sibling. That split (and moving these menus outside
   .app-topbar in header.php) existed only to give mix-blend-mode:difference
   an unbroken path past backdrop-filter's stacking-context isolation; both
   are gone now that the adaptive-text-color below is JS pixel-sampling
   instead (js/liquid-kit.js's lkAdaptiveContrast(), via elementsFromPoint on
   real screen coordinates), which doesn't care about DOM position or
   stacking contexts at all. Keeping the old split around here was dead
   complexity - and on mobile it was actively broken: the responsive
   override below drops .nav-dropdown-menu to position:static so it can
   flow inline in the sidebar accordion, which left the old .nav-dropdown-
   glass child's position:absolute with no positioned ancestor to anchor to,
   so it expanded to cover the whole viewport the instant a dropdown opened. */
.nav-dropdown-menu {
    /* fixed, not absolute: .app-nav has overflow-x:auto on mobile (for its
       own horizontal scroll), which would otherwise clip an absolutely
       positioned menu nested inside it. Top/left are set via JS on open. */
    position: fixed;
    min-width: 170px;
    /* Explicitly matched to .calendar-cell's own background/blur (the
       Month view's day squares) per direct request, rather than the
       lighter .glass-strong card formula - a white-tinted overlay can't
       dim white text sitting behind it (white blended with white is still
       white at any opacity, confirmed by testing up to 0.85 opacity and
       still reading the calendar's own white day-number/event text right
       through it), so this needed a dark tint like .calendar-cell's to
       actually obscure what's behind it. Text is plain white (see
       .nav-dropdown-menu a below) - no more JS color-swapping. */
    background: rgba(10, 10, 15, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border-strong);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow-glass-lg);
    z-index: 60;
}

.nav-dropdown-menu a {
    display: block;
    padding: 0.7rem 1.1rem;
    font-size: 0.88rem;
    text-decoration: none;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
    transition: background 0.15s ease, border-color 0.15s ease;
    border-left: 2px solid transparent;
}

/* Same purple "today" accent .calendar-cell.today uses on the Month view,
   per direct request - a highlighted link should read as the same "this
   one's special" color language as a highlighted day on the calendar. */
.nav-dropdown-menu a:hover {
    background: rgba(139, 92, 246, 0.22);
    border-left-color: var(--accent);
}
.nav-dropdown-menu a.active { font-weight: 700; }

.nav-avatar-trigger { padding: 0.3rem 0.9rem 0.3rem 0.3rem; gap: 0.55rem; }

.nav-avatar-img, .nav-avatar-placeholder {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.nav-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
}

/* Name label is hidden on desktop (avatar + chevron only, to save space
   alongside the rest of the nav) and only shown in the mobile sidebar
   accordion below, where the trigger is a full-width row anyway. */
.nav-avatar-name { display: none; }

.app-main {
    position: relative;
    z-index: 1;
    flex: 1;
    padding: 2rem 1.5rem 3rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* ---- Dashboard grid ----------------------------------------------------- */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
}

.grid-span-2 { grid-column: span 2; }

/* Caps each card's content to about 4 rows, with the rest reachable by
   scrolling inside the card rather than pushing the whole page (or, on
   desktop, the card itself) taller. Applies at every width — originally
   mobile-only, widened to desktop too so a long list (Recently Added, TV/
   Movie history, etc.) doesn't stretch the card past its neighbors.
   Scrollbar hidden cross-browser (still fully scrollable, just no visible
   track/thumb) to keep the look clean. */
.card-scroll {
    max-height: 22rem;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.card-scroll::-webkit-scrollbar { display: none; }

@media (max-width: 900px) {
    .grid-span-2 { grid-column: span 1; }
}

/* Shared horizontal-row utility (form action rows, inline field pairs,
   etc.) - used across many pages, but was only ever actually defined inside
   design-kit.php's own local <style> block. Everywhere it wrapped plain
   buttons this went unnoticed (buttons are naturally inline-block, so they
   sat side by side anyway); it broke visibly the moment a page put a
   width:100% .input-glass field inside one (e.g. Wish List's gift-exchange
   exclusion-pair rows), which had nothing to stop it stacking every child
   onto its own line instead of flowing them horizontally. */
.lk-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

.card {
    padding: 1.5rem;
}

.card h2 {
    margin: 0 0 1rem;
    font-size: 1.05rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card h2 .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.media-list-item {
    display: flex;
    gap: 0.85rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.media-list-item:last-child { border-bottom: none; }

.media-poster {
    width: 46px;
    height: 68px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.media-info { min-width: 0; font-size: 0.88rem; }
.media-info strong { display: block; font-size: 0.92rem; margin-bottom: 0.15rem; }
.media-info .meta { color: var(--text-tertiary); font-size: 0.8rem; }

.status-pill {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.2rem;
}

.progress-track {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transition: width 0.4s ease;
}

.download-item { padding: 0.75rem 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.download-item:last-child { border-bottom: none; }
.download-item .row { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.download-item .title { font-size: 0.9rem; font-weight: 600; }
.download-item .pct { font-size: 0.85rem; color: var(--success); font-weight: 700; }

.empty-note { color: var(--text-tertiary); font-size: 0.88rem; padding: 0.5rem 0; }
.error-note { color: var(--danger); font-size: 0.85rem; }

/* ---- Login page --------------------------------------------------------- */

.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 1.5rem;
}

.poster-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; }

.poster-bg .poster-layer {
    position: absolute;
    inset: -5%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 2.5s ease-in-out;
    filter: saturate(1.1);
}

.poster-bg .poster-layer.active { opacity: 1; }

.poster-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at center, rgba(8, 8, 12, 0.25) 0%, rgba(8, 8, 12, 0.6) 78%),
        linear-gradient(180deg, rgba(8,8,12,0.15), rgba(8,8,12,0.45));
}

/* The Family/My Calendar seasonal backgrounds (fam_render_calendar_month_bg()
   in includes/posters.php) should show these images exactly as designed -
   no vignette, no filter. Scoped to #famCalPosterBg so every other
   .poster-bg usage (login, dashboard, AI Assistant, admin pages) keeps the
   original moody vignette. */
#famCalPosterBg::after {
    content: none;
}
/* These images are composed with their color concentrated right at the
   edges/corners around a dark center - the shared .poster-layer's inset:-5%
   (an overscan margin meant for the rotating-backdrop pages, where it hides
   seams during a crossfade that also pans/scales) crops roughly another 10%
   off every edge before cover-fit even runs, pushing exactly that color
   out of frame on a typical wide viewport. This pair only ever crossfades
   via opacity (no pan/scale), so the overscan buys nothing here and just
   costs visible color - dropped back to a plain inset:0. */
#famCalPosterBg .poster-layer {
    inset: 0;
}

.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    padding: 2.5rem 2.25rem;
    text-align: center;
}

.login-card .brand-mark { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; margin-bottom: 1.75rem; }
.login-card .brand-mark img { width: 64px; height: 64px; border-radius: 18px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.login-card .brand-mark h1 { margin: 0; font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }
.login-card .brand-mark p { margin: 0; color: var(--text-secondary); font-size: 0.88rem; }

.login-form { display: flex; flex-direction: column; gap: 0.85rem; }
.login-error {
    background: rgba(248, 113, 113, 0.15);
    border: 1px solid rgba(248, 113, 113, 0.35);
    color: #ffd6d6;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* Neutral variant of .login-error - for informational messages (e.g. "you
   were signed out after being idle") that aren't actually errors. */
.login-notice {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border-strong);
    color: var(--text-secondary);
    padding: 0.65rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.login-card .btn-glass { width: 100%; margin-top: 0.4rem; }

.login-footnote { margin-top: 1.5rem; font-size: 0.78rem; color: var(--text-tertiary); }
.login-footnote a { color: var(--text-secondary); text-decoration: none; }
.login-footnote a:hover { color: var(--accent); text-decoration: underline; }
/* Two stacked .login-footnote lines (forgot-password + the Emby blurb)
   would otherwise double up that 1.5rem top margin - collapse it between
   them so only the gap above the first one stays. */
.login-footnote + .login-footnote { margin-top: 0.4rem; }

.password-field { position: relative; }
.password-field .input-glass { padding-right: 2.75rem; }
.password-toggle {
    position: absolute;
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%);
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text-tertiary);
    transition: color 0.15s ease;
}
.password-toggle:hover { color: var(--text-primary); }
.password-toggle svg { width: 18px; height: 18px; }
.password-toggle .icon-eye-off { display: none; }
.password-toggle[aria-pressed="true"] .icon-eye { display: none; }
.password-toggle[aria-pressed="true"] .icon-eye-off { display: block; }

/* ---- Requests paused page ------------------------------------------------ */

.notice-screen {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
}

.notice-card {
    max-width: 520px;
    padding: 2.5rem;
    text-align: center;
}

.notice-card .icon-badge {
    width: 64px; height: 64px;
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 1.25rem;
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.35);
}

.notice-card h1 { font-size: 1.4rem; margin: 0 0 0.75rem; }
.notice-card p { color: var(--text-secondary); line-height: 1.6; margin: 0 0 0.5rem; }

/* ---- Admin -------------------------------------------------------------- */

.admin-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.admin-row:last-child { border-bottom: none; }
.admin-row .label { font-weight: 600; font-size: 0.95rem; }
.admin-row .desc { font-size: 0.82rem; color: var(--text-tertiary); margin-top: 0.15rem; }

.toggle-switch {
    position: relative;
    width: 52px;
    height: 30px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.toggle-switch.on { background: var(--accent); }

.toggle-switch .knob {
    position: absolute;
    top: 2px; left: 2px;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    transition: transform 0.2s ease;
}

.toggle-switch.on .knob { transform: translateX(22px); }

.admin-textarea {
    width: 100%;
    min-height: 90px;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    resize: vertical;

    /* Same themed scrollbar as .input-glass - without it this field falls
       back to the plain OS scrollbar the moment its content overflows. */
    scrollbar-width: none;
}

.admin-textarea::-webkit-scrollbar { display: none; width: 0; height: 0; }

.page-title { font-size: 1.6rem; font-weight: 800; margin: 0 0 0.35rem; letter-spacing: -0.02em; }
.page-subtitle { color: var(--text-secondary); font-size: 0.92rem; margin: 0 0 1.75rem; }

/* ---- Calendar ------------------------------------------------------------ */

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.calendar-nav h2 { font-size: 1.3rem; margin: 0; font-weight: 800; letter-spacing: -0.01em; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85); }
.calendar-nav-btns { display: flex; gap: 0.5rem; }

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

/* Grid view by default; the agenda list takes over at phone widths (see
   the max-width:700px block below) since 7 columns can't fit anything
   readable in ~45px each. */
.calendar-agenda-view { display: none; }

.agenda-day { padding: 1.1rem 1.25rem; display: flex; flex-direction: column; gap: 0.6rem; }
.agenda-day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft) inset; }
.agenda-date { font-weight: 800; font-size: 0.95rem; margin-bottom: 0.15rem; }
.agenda-item { display: block; white-space: normal; font-size: 0.85rem; padding: 0.55rem 0.8rem; }

.calendar-day-header {
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 0.5rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

.calendar-cell {
    position: relative;
    min-height: 100px;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    background: rgba(10, 10, 15, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

.calendar-cell.other-month { opacity: 0.4; }

.calendar-cell.today {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-soft) inset;
    background: rgba(139, 92, 246, 0.22);
}

.calendar-day-num {
    font-size: 0.8rem;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}
.calendar-cell.today .calendar-day-num { color: #e9e0ff; }

.cal-chip {
    font-size: 0.66rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.cal-chip.movie { background: rgba(139, 92, 246, 0.55); color: #f3effe; }
.cal-chip.tv { background: rgba(59, 130, 246, 0.55); color: #eef4ff; }

/* Month-grid chips split a title span + trailing release-type icon - only
   this usage needs flex (the legend swatches, agenda rows, personal-calendar
   color chips etc. still render a single text node and keep the plain
   block/ellipsis behavior above). */
.cal-chip-flex { display: flex; align-items: center; gap: 0.25rem; }
.cal-chip-flex .cal-chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.cal-chip-flex .release-icon-wrap { flex-shrink: 0; opacity: 0.9; }

/* Personal calendar event colors (pages/personal-calendar.php) — the same
   palette keys as FAM_CALENDAR_COLORS in includes/calendar_personal.php.
   Also covers .hour-event (the Day/Week hour-grid blocks) - it never had a
   background of its own, so a multi-hour event rendered as bare floating
   text with no colored block behind it instead of actually "blocking out"
   its time range the way a real calendar app does. */
.cal-chip.color-blue, .hour-event.color-blue { background: rgba(59, 130, 246, 0.55); color: #eef4ff; }
.cal-chip.color-green, .hour-event.color-green { background: rgba(34, 197, 94, 0.55); color: #eafff1; }
.cal-chip.color-purple, .hour-event.color-purple { background: rgba(168, 85, 247, 0.55); color: #f5eeff; }
.cal-chip.color-orange, .hour-event.color-orange { background: rgba(249, 115, 22, 0.55); color: #fff2e8; }
.cal-chip.color-red, .hour-event.color-red { background: rgba(239, 68, 68, 0.55); color: #ffecec; }
.cal-chip.color-pink, .hour-event.color-pink { background: rgba(236, 72, 153, 0.55); color: #ffeef7; }

.cal-more { font-size: 0.64rem; font-weight: 600; color: #ffffff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85); }

.calendar-cell.has-items { cursor: pointer; transition: transform 0.15s ease, background 0.15s ease; }
.calendar-cell.has-items:hover { background: rgba(255, 255, 255, 0.1); transform: translateY(-2px); }

/* ---- Liquid touch ripple — a droplet of light spreading from the exact
   point of contact, the tactile-touch feedback Liquid Glass is built on. */

.fam-ripple-host { position: relative; overflow: hidden; }

.fam-ripple {
    position: absolute;
    width: 12px;
    height: 12px;
    margin-left: -6px;
    margin-top: -6px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 70%);
    pointer-events: none;
    transform: scale(0);
    animation: fam-ripple-spread 0.65s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

@keyframes fam-ripple-spread {
    0% { transform: scale(0); opacity: 0.9; }
    100% { transform: scale(22); opacity: 0; }
}

/* ---- Day detail modal — the fullest expression of the Liquid Glass look:
   heavy blur, high saturation, a glossy sheen, floating over a dimmed,
   blurred backdrop so the page behind visibly refracts through it. ---- */

.day-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(5, 5, 10, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.day-modal-overlay.open { display: flex; }
/* Follows the admin's chosen Popup Animation (Admin > Popup Animation) —
   same --lk-popup-anim-* variables every other modal/dropdown/toast uses
   (see css/liquid-kit.css). Previously a bespoke click-origin-aware
   "liquid pour" effect (clip-path circle expanding from the clicked day
   cell); replaced so this modal is consistent with the rest of the site's
   popups instead of always looking different regardless of the admin's
   selection. Entrance-only, like every other migrated popup — no separate
   close animation. Fallback values cover this even if liquid-kit.css
   somehow didn't load. */
.day-modal-overlay.open .day-modal { animation: var(--lk-popup-anim-name) var(--lk-popup-anim-duration, 0.55s) var(--lk-popup-anim-easing, cubic-bezier(0.22, 1, 0.36, 1)) both; }

.day-modal {
    width: 100%;
    max-width: 440px;
    max-height: 80vh;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.day-modal h3 { margin: 0; font-size: 1.15rem; font-weight: 800; padding-right: 1.5rem; }

.day-modal-close {
    position: absolute;
    top: 1.1rem;
    right: 1.1rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}

.day-modal-close:hover { background: rgba(255, 255, 255, 0.16); }

.day-modal-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
    min-height: 0;
}

.day-modal-item {
    display: block;
    white-space: normal;
    text-overflow: initial;
    padding: 0.6rem 0.85rem;
    font-size: 0.85rem;
}

/* ---- Clickable rows inside the day modal — each opens the item detail
   popup below (poster thumbnail + title + release-type/episode meta). ---- */

.day-modal-item-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.6rem;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.day-modal-item-row:hover { background: rgba(255, 255, 255, 0.08); }

.day-modal-item-poster {
    width: 42px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
}

.day-modal-item-info { min-width: 0; flex: 1; }
.day-modal-item-title { font-size: 0.88rem; font-weight: 700; white-space: normal; line-height: 1.25; }
.day-modal-item-meta { display: flex; align-items: center; gap: 0.3rem; font-size: 0.72rem; opacity: 0.75; margin-top: 2px; }
.day-modal-item-arrow { opacity: 0.5; font-size: 1.3rem; flex-shrink: 0; }

.agenda-item-sub {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.68rem;
    font-weight: 500;
    opacity: 0.8;
    margin-top: 2px;
}

/* Small inline SVG icon (ticket/cloud/disc) marking a movie's release type
   - day modal rows, the mobile agenda view, and the detail popup's release
   badge all share this one wrapper. */
.release-icon-wrap { display: inline-flex; flex-shrink: 0; }
.release-icon-wrap .release-icon { display: block; }

/* ---- Item detail modal — poster, overview and trailer for a single
   calendar entry, opened from a day modal row or agenda item. Layered
   above the day modal (higher z-index) so Escape/backdrop click steps
   back to the day list instead of closing everything at once. ---- */

.detail-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(5, 5, 10, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.detail-modal-overlay.open { display: flex; }
.detail-modal-overlay.open .detail-modal { animation: var(--lk-popup-anim-name) var(--lk-popup-anim-duration, 0.55s) var(--lk-popup-anim-easing, cubic-bezier(0.22, 1, 0.36, 1)) both; }

.detail-modal {
    width: 100%;
    max-width: 520px;
    max-height: 86vh;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.detail-modal-poster-wrap {
    width: 100%;
    max-height: 280px;
    overflow: hidden;
}

.detail-modal-poster {
    width: 100%;
    max-height: 280px;
    display: block;
    object-fit: cover;
}

.detail-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.detail-modal-body h3 { margin: 0; font-size: 1.25rem; font-weight: 800; padding-right: 1.5rem; }

.detail-modal-badges { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.detail-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid var(--glass-border);
    white-space: nowrap;
}

.detail-badge.movie { background: rgba(139, 92, 246, 0.55); }
.detail-badge.tv { background: rgba(59, 130, 246, 0.55); }

.detail-modal-overview { font-size: 0.88rem; line-height: 1.55; opacity: 0.9; margin: 0; }

.detail-modal-trailer {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    overflow: hidden;
    background: #000;
}

.detail-modal-trailer iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

@media (max-width: 700px) {
    .detail-modal-poster-wrap { max-height: 200px; }
    .detail-modal-poster { max-height: 200px; }
}

@media (max-width: 700px) {
    .calendar-grid-view { display: none; }
    .calendar-agenda-view { display: flex; flex-direction: column; gap: 0.75rem; }
}

@media (max-width: 700px) {
    .app-topbar { padding: 0.75rem 1rem; }
    .nav-toggle-btn { display: flex; }

    .app-nav {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        height: 100dvh;
        width: 270px;
        max-width: 82vw;
        z-index: 60;
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
        padding: 4.75rem 1rem 1.5rem;
        background: rgba(15, 15, 22, 0.97);
        backdrop-filter: blur(24px) saturate(180%);
        -webkit-backdrop-filter: blur(24px) saturate(180%);
        border-right: 1px solid var(--glass-border);
        box-shadow: 16px 0 48px rgba(0, 0, 0, 0.45);
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    .app-nav.is-open { transform: translateX(0); }
    .app-nav a { width: 100%; text-align: left; }
    /* The sidebar's links are full-width rows, so the badge reads better
       pushed to the far edge than trailing the word by a fixed gap. */
    .app-nav a.nav-with-badge { display: flex; justify-content: space-between; }

    .nav-dropdown { width: 100%; }
    .nav-dropdown-trigger { width: 100%; justify-content: space-between; }
    .nav-dropdown-trigger svg { transition: transform 0.15s ease; }
    .nav-dropdown-trigger[aria-expanded="true"] svg { transform: rotate(180deg); }

    /* Inline accordion, not a floating popup: the sidebar is a narrow column,
       so a position:fixed menu (the desktop behavior, needed there to escape
       the topbar's own clipping) would float on top of Admin/Settings/Log Out
       instead of making room for itself. Static positioning drops it back
       into normal flow so it pushes the links below it down instead. */
    .nav-dropdown-menu {
        position: static;
        width: 100%;
        margin-top: 0.15rem;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 10px;
        box-shadow: none;
    }

    .nav-avatar-name {
        display: inline;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        text-align: left;
    }

    .app-main { padding: 1.25rem 1rem 2rem; }

    /* Collapses a button down to just its icon/symbol at phone width - e.g.
       the calendar's "&larr; Prev"/"Next &rarr;"/"+Add Event" nav buttons,
       which otherwise crowd the header-nav row on narrow screens. The
       symbol itself (arrow, "+Add") stays outside this span so it's always
       visible; only the extra word(s) collapse. */
    .btn-label-collapse { display: none; }
}
