:root{
  --ink:#161e2b;
  --ink-soft:#4b556a;
  --line:#dde2ec;
  --bg:#f2f4f8;
  --panel:#ffffff;
  --brand:#1a2ec8;          /* SFA Royal Blue (tuned to logo #0606df, slightly softened for UI) */
  --brand-dark:#111f8f;      /* deeper royal blue for sidebar / hovers */
  --brand-tint:#e7eafb;      /* pale blue tint for badges / active states */
  --amber:#b8790a;
  --amber-tint:#fdf2e0;
  --red:#d2232a;             /* SFA logo red */
  --red-tint:#fbe7e7;
  --green:#2f9a3a;           /* SFA logo green — for success/active/pass states */
  --green-tint:#e6f4e8;
  --radius:8px;

  /* =====================================================================
     UI MODERNIZATION — DESIGN SYSTEM TOKENS (Phase 1)
     Foundation layer only: these tokens are additive and, on their own,
     change nothing visually yet. Existing rules keep using their current
     hardcoded values and existing variable names (--radius, --brand, etc.
     above are untouched) so nothing on any page shifts in this phase.
     From Phase 2 onward, component rules (buttons, inputs, badges, cards,
     tables...) are refactored one at a time to consume these tokens
     instead of one-off px values, which is what actually makes the
     shadcn/Linear/Vercel-inspired look consistent site-wide. Reference
     this block instead of hardcoding a new size/radius/shadow anywhere.

     Spacing — 8px grid (4px half-step for tight cases like badge padding)
  ===================================================================== */
  --space-1:4px;
  --space-2:8px;
  --space-3:12px;
  --space-4:16px;
  --space-5:20px;
  --space-6:24px;
  --space-8:32px;
  --space-10:40px;

  /* Radius scale — --radius (8px) above stays the default/most-used size.
     sm = compact controls (pills/badges already use ~20px, unaffected).
     lg = larger surfaces (modals, popovers) where a slightly softer
     corner reads calmer, per the "medium radius, not oversized" rule. */
  --radius-sm:6px;
  --radius-md:8px;   /* same value as --radius, kept as an alias */
  --radius-lg:12px;

  /* Shadow scale — deliberately subtle (shadcn/Vercel avoid heavy
     drop-shadows). xs/sm are for everyday surfaces like dropdowns and
     hover states; md/lg are for modals/popovers that sit above content. */
  --shadow-xs:0 1px 2px rgba(20,24,50,.06);
  --shadow-sm:0 2px 8px rgba(20,24,50,.08);
  --shadow-md:0 10px 28px rgba(20,24,50,.14);
  --shadow-lg:0 20px 48px rgba(20,24,50,.20);

  /* Typography scale — named after the current actual sizes already in
     use across the app (topbar h1, panel-title h2, stat value, etc.), so
     naming them doesn't change anything now. Future phases apply these
     tokens instead of repeating raw px, and can tune the *scale* in one
     place if the hierarchy needs adjusting later. */
  --text-xs:11px;      /* metadata, helper text */
  --text-sm:12.5px;    /* secondary text, table sub-rows */
  --text-base:14px;    /* body text — matches body{font-size:14px} below */
  --text-md:15px;      /* card/section title — matches .panel-title h2 */
  --text-lg:18px;      /* page title — matches .topbar h1 */
  --text-xl:23px;      /* large emphasis — matches login greeting */
  --text-2xl:26px;     /* stat/metric value */

  font-family:"Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,Arial,sans-serif;
}

/* Accessible focus ring — WCAG requires a visible focus indicator; most
   elements here had none beyond the browser default (invisible in some
   OS/browser combos). :focus-visible only shows for keyboard navigation
   (not mouse clicks), so this is purely additive and doesn't change the
   click/hover experience anywhere. Component-specific :focus rules (e.g.
   .topbar-search input:focus below) are more specific and keep winning
   where they already exist. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible{
  outline:2px solid var(--brand);
  outline-offset:2px;
  border-radius:4px;
}
/* ---------- Shared "Actions" dropdown -----------------------------------
   Used on list-page tables that have several action links/forms stacked
   in one cell (e.g. Mark Under Review / Approve / Reject / Remove).
   Positioned via JS as position:fixed (not absolute) specifically because
   .card above has overflow:hidden -- an absolutely-positioned menu would
   get clipped by that; fixed positioning escapes it. See
   toggleActionMenu() in footer.php. ------------------------------------- */
.action-dropdown{position:relative;display:inline-block;}
.action-dropdown-menu{
  display:none;position:fixed;background:var(--panel);border:1px solid var(--line);
  border-radius:var(--radius-md);box-shadow:var(--shadow-md);padding:6px;
  min-width:200px;z-index:200;
}
.action-dropdown-menu.is-open{display:flex;flex-direction:column;gap:2px;}
.action-dropdown-menu form{width:100%;margin:0;}
.action-dropdown-menu .link,
.action-dropdown-menu button.link{
  display:block;width:100%;text-align:left;padding:7px 10px;border-radius:6px;
  font-size:13px;background:none;border:none;cursor:pointer;font-family:inherit;
}
.action-dropdown-menu a.link{text-decoration:none;}
.action-dropdown-menu .link:hover{background:var(--bg);}
.action-dropdown-menu .action-subform{padding:6px 10px;}
.action-dropdown-menu .action-subform input[type="date"],
.action-dropdown-menu .action-subform input[type="text"]{width:100%;box-sizing:border-box;margin-bottom:6px;}
.action-dropdown-menu hr{border:none;border-top:1px solid var(--line);margin:4px 0;}

*{box-sizing:border-box;}
body{margin:0;background:var(--bg);color:var(--ink);font-size:14px;}
a{color:inherit;}
.app{display:flex;min-height:100vh;}

/* ---------- Sidebar (Royal Blue theme, icon+label, collapsible groups,
   desktop icon-only collapse mode with hover flyouts) ----------
   Font sizes/spacing tuned to feel closer to the reference the person
   provided: bigger, more legible labels and generous row height rather
   than a dense list. */
.sidebar{
  width:246px;background:var(--brand-dark);color:#fff;display:flex;flex-direction:column;
  flex-shrink:0;position:sticky;top:0;height:100vh;overflow-y:auto;
  border-right:1px solid rgba(255,255,255,.1);transition:width .18s ease;
}
.sidebar .brand{padding:16px;border-bottom:1px solid rgba(255,255,255,.14);display:flex;align-items:center;gap:10px;}
.sidebar .brand img{width:34px;height:34px;border-radius:8px;background:#fff;padding:3px;flex-shrink:0;}
.sidebar .brand .brand-text{font-weight:700;font-size:14.5px;letter-spacing:.2px;line-height:1.15;color:#fff;white-space:nowrap;}
.sidebar .brand .brand-text span{display:block;font-weight:400;font-size:10.5px;opacity:.7;margin-top:2px;letter-spacing:.4px;}

/* A plain full-width row, not a floating circle -- simple and impossible
   to accidentally clip regardless of the sidebar's overflow settings. */
.sidebar-collapse-btn{
  display:flex;align-items:center;gap:9px;width:100%;
  padding:10px 16px;margin:2px 0 4px;border:none;border-top:1px solid rgba(255,255,255,.12);border-bottom:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.06);color:#e2e7ff;font-size:12.5px;font-weight:700;cursor:pointer;font-family:inherit;
}
.sidebar-collapse-btn:hover{background:rgba(255,255,255,.14);color:#fff;}
.sidebar-collapse-btn svg{flex-shrink:0;transition:transform .18s ease;}
.sidebar.collapsed .sidebar-collapse-btn{justify-content:center;padding:10px 0;}
.sidebar.collapsed .sidebar-collapse-btn svg{transform:rotate(180deg);}

.nav-section-label{padding:10px 20px 4px;font-size:10.5px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:#8f9bd6;}

.nav{list-style:none;margin:0;padding:2px 0 10px;flex:1;}
.nav li{margin-bottom:2px;}

/* Shared "row" style for the Dashboard link and every group's summary row */
.nav-link{
  display:flex;align-items:center;gap:12px;padding:10px 14px;margin:0 8px;border-radius:8px;
  color:#c9d2f5;text-decoration:none;font-size:14.5px;font-weight:500;position:relative;
  cursor:pointer;list-style:none;user-select:none;transition:background .15s ease,color .15s ease;
}
.nav-link::-webkit-details-marker{display:none;}
.nav-link::marker{content:'';}
.nav-link:hover{background:rgba(255,255,255,.08);color:#fff;}
.nav-link.active{background:rgba(255,255,255,.16);color:#fff;font-weight:700;}
.nav-group.has-active > details > .nav-link{background:rgba(255,255,255,.1);color:#fff;}

/* PHASE 3 — SIDEBAR/TOPBAR: Linear-style active-item indicator. A thin
   accent bar flush with the sidebar's outer edge (offset to cancel out
   .nav-link's own 8px margin) rather than relying on background tint
   alone -- easier to scan at a glance which section you're in. Hidden in
   the icon-only collapsed mode below, where .nav-link's margin becomes
   14px (not 8px) and is horizontally centered, so a left-aligned bar
   would land in the wrong place. */
.nav-link.active::before,
.nav-group.has-active > details > .nav-link::before{
  content:'';position:absolute;left:-8px;top:8px;bottom:8px;width:3px;
  border-radius:0 3px 3px 0;background:#fff;
}
.nav-icon{flex-shrink:0;opacity:.85;}
.nav-link.active .nav-icon,.nav-group.has-active .nav-icon{opacity:1;}
.nav-link .label{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.nav-link .chevron{flex-shrink:0;opacity:.6;transition:transform .18s ease;}
.nav-group details[open] > .nav-link .chevron{transform:rotate(90deg);}

.nav-sub{list-style:none;margin:2px 8px 8px;padding:2px 0 2px 28px;position:relative;}
.nav-sub::before{content:'';position:absolute;left:20px;top:0;bottom:8px;width:1px;background:rgba(255,255,255,.18);}
.nav-sub li{margin-bottom:1px;}
.nav-sub li a{display:block;padding:8px 10px;border-radius:6px;color:#b9c3ec;text-decoration:none;font-size:13.5px;}
.nav-sub li a:hover{background:rgba(255,255,255,.08);color:#fff;}
.nav-sub li a.active{background:rgba(255,255,255,.16);color:#fff;font-weight:700;}
.nav-sub-nested{padding-left:20px !important;font-size:12.5px !important;opacity:.85;}

.sidebar-foot{display:flex;align-items:center;gap:10px;padding:14px 16px;border-top:1px solid rgba(255,255,255,.14);}
.sidebar-foot-avatar{width:32px;height:32px;border-radius:50%;flex-shrink:0;background:#fff;color:var(--brand-dark);display:flex;align-items:center;justify-content:center;font-weight:700;font-size:13px;}
.sidebar-foot-text{min-width:0;flex:1;display:flex;flex-direction:column;}
.sidebar-foot-text strong{font-size:13px;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.sidebar-foot-text span{font-size:11.5px;color:#a8b3e8;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.sidebar-foot-logout{display:flex;align-items:center;justify-content:center;flex-shrink:0;width:30px;height:30px;border-radius:8px;color:#a8b3e8;}
.sidebar-foot-logout:hover{background:rgba(255,255,255,.1);color:#fff;}
.sidebar.collapsed .sidebar-foot-logout{display:none;}

/* PHASE 3 — SIDEBAR/TOPBAR: the global :focus-visible ring from Phase 1
   uses --brand (a mid-blue), which has weak contrast against this
   sidebar's dark navy background. Override it here to white specifically
   for sidebar-internal interactive elements, and pull the ring inward
   (negative offset) so it can't get clipped by the sidebar's own
   overflow-y:auto scrolling. */
.sidebar a:focus-visible,
.sidebar button:focus-visible,
.sidebar summary:focus-visible{
  outline:2px solid #fff;
  outline-offset:-2px;
}

/* ---- Desktop-only: icon-only collapsed mode + hover flyouts ----
   Scoped to min-width:721px so mobile (which has its own slide-out
   overlay below) is never affected by the collapsed cookie state.
   Note: label/chevron elements are omitted entirely by PHP when
   collapsed (see includes/header.php's nav_label()) rather than hidden
   with CSS -- so this block only needs to handle sizing/centering/the
   hover flyout, not visibility of text that was never rendered. */
@media (min-width:721px){
  .sidebar.collapsed{width:76px;}
  .sidebar.collapsed .brand{padding:16px 0;justify-content:center;}
  .sidebar.collapsed .brand-text{display:none;}
  .sidebar.collapsed .nav-section-label{display:none;}
  .sidebar.collapsed .nav-link{justify-content:center;padding:11px 0;margin:0 14px;}
  .sidebar.collapsed .sidebar-foot{padding:14px 0;justify-content:center;}
  .sidebar.collapsed .nav-link.active::before,
  .sidebar.collapsed .nav-group.has-active > details > .nav-link::before{display:none;}
  .sidebar.collapsed .label,
  .sidebar.collapsed .chevron,
  .sidebar.collapsed .sidebar-foot-text{display:none;}

  .sidebar.collapsed .nav-group{position:relative;}
  /* Override the browser's default "hide everything but <summary> when
     <details> is closed" behavior, so the flyout can be shown by :hover
     regardless of the accordion's actual open/closed state. */
  .sidebar.collapsed details:not([open]) .nav-sub{display:block;}
  .sidebar.collapsed .nav-sub{
    position:absolute;left:100%;top:0;margin:0;padding:8px;min-width:200px;
    background:#fff;border:1px solid var(--line);border-radius:10px;
    box-shadow:0 12px 28px rgba(20,30,60,.16);
    opacity:0;visibility:hidden;pointer-events:none;transition:opacity .12s ease;z-index:80;
  }
  .sidebar.collapsed .nav-sub::before{display:none;}
  .sidebar.collapsed .nav-sub li a{padding:8px 10px;font-size:13.5px;color:var(--ink-soft);}
  .sidebar.collapsed .nav-sub li a:hover{background:var(--bg);color:var(--ink);}
  .sidebar.collapsed .nav-sub li a.active{background:var(--brand-tint);color:var(--brand-dark);}
  .sidebar.collapsed .nav-sub-nested{padding-left:18px !important;}
  .sidebar.collapsed .nav-group:hover .nav-sub{opacity:1;visibility:visible;pointer-events:auto;}
  /* Small invisible bridge so moving the cursor from icon to flyout
     doesn't momentarily leave the hoverable area and close it early. */
  .sidebar.collapsed .nav-group::after{content:'';position:absolute;left:100%;top:0;bottom:0;width:8px;}
}

/* ---------- Global search in the top bar (reverted to its original spot) ---------- */
.topbar-search{flex:1;max-width:320px;margin:0 8px;}
.topbar-search input{
  width:100%;padding:7px 12px;border:1px solid var(--line);border-radius:20px;
  font-size:13px;background:#fafbff;color:var(--ink);font-family:inherit;
}
.topbar-search input:focus{outline:none;border-color:var(--brand);background:#fff;}
@media (max-width: 720px){
  .topbar-search{max-width:none;margin:8px 0 0;flex-basis:100%;order:3;}
  .topbar{flex-wrap:wrap;}
}

/* ---------- Main ---------- */
.main{flex:1;display:flex;flex-direction:column;min-width:0;}
.topbar{background:var(--panel);border-bottom:1px solid var(--line);padding:14px 26px;display:flex;justify-content:space-between;align-items:center;}
.topbar h1{font-size:var(--text-lg);margin:0;letter-spacing:-.01em;}
.topbar .who{display:flex;align-items:center;gap:10px;font-size:13px;color:var(--ink-soft);}
.topbar-actions{display:flex;align-items:center;gap:16px;}
.badge-role{background:var(--brand-tint);color:var(--brand-dark);padding:3px 9px;border-radius:20px;font-size:11.5px;font-weight:600;border:1px solid rgba(26,46,200,.08);}
.content{padding:26px;overflow:auto;}

/* ---------- Cards / Stat grid ---------- */
.stat-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:24px;}
.stat{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);padding:18px;text-align:center;transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease;}
.stat:hover{transform:translateY(-3px);box-shadow:0 10px 24px -8px rgba(26,46,200,.28);border-color:var(--brand-tint,#d7ddfb);}
.stat .label{font-size:12px;color:var(--ink-soft);text-transform:uppercase;letter-spacing:.4px;}
.stat .value{font-size:26px;font-weight:700;margin-top:6px;}
.stat .sub{font-size:12px;color:var(--ink-soft);margin-top:4px;}
.stat.warn .value{color:var(--amber);}

.panel-title{display:flex;justify-content:space-between;align-items:center;margin:26px 0 12px;}
.panel-title h2{font-size:15px;margin:0;display:flex;align-items:center;gap:8px;}
.panel-title .hint{font-size:12px;color:var(--ink-soft);}
.panel-title.compact h2{font-size:13px;}

/* PHASE 5 — MODAL/DROPDOWN POLISH + CARD REFINEMENT: .card is used on
   basically every list/detail page as the main content container --
   same class name, just adds a barely-there shadow (--shadow-xs) on top
   of the existing border for a touch more definition against the page
   background, without turning into a "heavy floating card". */
.card{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;box-shadow:var(--shadow-xs);}

/* =========================================================================
   PHASE 6 — MODULE ROLLOUT: Dashboard
   .section-spacing is a general-purpose utility (any page's stacked
   .card sections can use it) -- the rest below is dashboard-specific,
   replacing what was previously a page full of inline style=""
   attributes on index.php with semantic, reusable classes.
   ========================================================================= */
.section-spacing{margin-bottom:var(--space-6);}
.section-spacing-sm{margin-bottom:var(--space-4);}
.section-subhead{margin-bottom:10px;font-weight:600;font-size:12.5px;color:var(--ink-soft);}

.birthday-group{margin-bottom:18px;}
.birthday-group:last-child{margin-bottom:0;}
.birthday-list{display:flex;flex-wrap:wrap;gap:14px;}
.birthday-card{display:flex;align-items:center;gap:10px;background:var(--brand-tint);border-radius:var(--radius-md);padding:10px 16px 10px 10px;flex-wrap:wrap;row-gap:8px;}
.birthday-avatar{width:38px;height:38px;border-radius:50%;object-fit:cover;flex-shrink:0;}
.birthday-avatar-fallback{width:38px;height:38px;border-radius:50%;background:var(--brand);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;flex-shrink:0;}
.birthday-name{font-weight:600;font-size:13px;white-space:nowrap;}
.birthday-card .btn{white-space:nowrap;}

.overdue-text{color:var(--red);font-weight:600;}

/* =========================================================================
   PHASE 7 — MODULE ROLLOUT: Members
   General-purpose utility classes (not Members-specific names) so later
   module phases can reuse the same ones instead of re-inventing them.
   ========================================================================= */
.panel-actions{display:flex;gap:10px;align-items:center;}
.inline-form{display:inline;}
.link-brand{color:var(--brand);}
.text-danger{color:var(--red);}
.form-contents{display:contents;}
.mt-sm{margin-top:var(--space-2);}
.ml-sm{margin-left:var(--space-2);}
.mb-md{margin-bottom:var(--space-4);}
.mr-sm{margin-right:var(--space-2);}
.mt-md{margin-top:var(--space-3);}
.mt-neg-sm{margin-top:-8px;}
.mt-0{margin-top:0;}
.field-optional{font-weight:400;color:var(--ink-soft);}
.field-align-end{justify-content:flex-end;}
.profile-photo-lg{max-width:140px;border-radius:var(--radius-md);border:1px solid var(--line);}
.card-danger{border-color:#e0b3b3;}
.card-danger-strong{border-color:var(--red);}
.btn-ghost-danger{color:var(--red);border-color:#e0b3b3;}
.panel-title.tight{margin:0;}
.text-heading-danger{font-size:13px;color:var(--red);}
.mt-tight{margin:6px 0 12px;}
.message-box{white-space:pre-wrap;line-height:1.6;margin:0;}
.col-narrow{width:70px;}
.col-actions{width:140px;}
.w-full{width:100%;}
.text-xs{font-size:var(--text-xs);}
.subform-input{padding:4px 6px;border:1px solid var(--line);border-radius:var(--radius-sm);}
.marks-override-input{width:70px;padding:4px 6px;border:1px solid var(--line);border-radius:var(--radius-sm);}
.form-divider{margin-top:16px;border-top:1px solid var(--line);padding-top:16px;}
.label-checkbox{font-weight:400;}
.checkbox-row{display:flex;gap:6px;align-items:center;font-weight:400;}
.checkbox-group{display:flex;flex-wrap:wrap;gap:14px;}
.field-self-end{align-self:end;}
.form-row-flex{display:flex;gap:8px;align-items:center;}
.form-row-flex-end{display:flex;gap:8px;align-items:flex-end;}
.form-row-flex-start{display:flex;gap:8px;}
.flex-1{flex:1;}
.w-130{width:130px;}
.col-checkbox{width:34px;}
.section-spacing-xs{margin-bottom:14px;}
.form-grid.pad-tight{padding:8px 0;}
.sponsors-card{margin-bottom:14px;padding:16px;}
.sponsor-list{display:flex;flex-wrap:wrap;gap:14px;margin-bottom:14px;}
.sponsor-item{border:1px solid var(--line);border-radius:var(--radius-md);padding:10px;text-align:center;width:140px;}
.sponsor-logo{height:40px;max-width:100%;object-fit:contain;margin-bottom:6px;}
.sponsor-name-text{margin-bottom:6px;}
.editor-mount{background:#fff;border-radius:var(--radius-sm);}
.stat-value-sm{font-size:16px;}
.form-actions-start{justify-content:flex-start;gap:10px;}
.thumb-sm{height:36px;max-width:80px;object-fit:cover;vertical-align:middle;border-radius:4px;margin-top:4px;}
.mt-18{margin-top:18px;}
.text-nowrap{white-space:nowrap;}
.w-70{width:70px;}
.stat-number-lg{font-size:18px;font-weight:700;}
.flash-tight{margin:0;}
.form-row-flex-sm{display:flex;gap:6px;}
.form-row-flex-plain{display:flex;}
.pw-meter.thick{height:10px;}
.field-flex-row{flex-direction:row;gap:10px;}
.pagination-row{display:flex;justify-content:space-between;align-items:center;margin-top:14px;}
.pagination-controls{display:flex;gap:8px;}
.pad-18{padding:18px;}
.mt-14{margin-top:14px;}
.mt-24{margin-top:24px;}
.mb-6{margin-bottom:6px;}

.olympiad-status-badge{display:inline-flex;align-items:center;gap:10px;padding:12px 22px;border-radius:999px;font-size:16px;font-weight:800;background:var(--paper-alt);color:var(--ink);}
.olympiad-status-dot{width:11px;height:11px;border-radius:50%;background:var(--ink-faint);flex-shrink:0;}
.olympiad-status-badge.status-registration_open{background:var(--green-tint);color:var(--green);}
.olympiad-status-badge.status-registration_open .olympiad-status-dot{background:var(--green);}
.olympiad-status-badge.status-result_published{background:var(--green-tint);color:var(--green);}
.olympiad-status-badge.status-result_published .olympiad-status-dot{background:var(--green);}
.olympiad-status-badge.status-cancelled{background:var(--red-tint);color:var(--red);}
.olympiad-status-badge.status-cancelled .olympiad-status-dot{background:var(--red);}
.olympiad-status-badge.status-exam_ready,.olympiad-status-badge.status-registration_closed,.olympiad-status-badge.status-evaluation,.olympiad-status-badge.status-result_review{background:var(--brand-tint);color:var(--brand);}
.olympiad-status-badge.status-exam_ready .olympiad-status-dot,.olympiad-status-badge.status-registration_closed .olympiad-status-dot,.olympiad-status-badge.status-evaluation .olympiad-status-dot,.olympiad-status-badge.status-result_review .olympiad-status-dot{background:var(--brand);}
.olympiad-status-badge.status-exam_running{background:var(--brand-tint);color:var(--brand);}
.olympiad-status-badge.status-exam_running .olympiad-status-dot{background:var(--brand);animation:status-pulse 1.6s ease-in-out infinite;}
@keyframes status-pulse{0%,100%{box-shadow:0 0 0 0 rgba(26,46,200,0.45);}50%{box-shadow:0 0 0 6px rgba(26,46,200,0);}}
@media (prefers-reduced-motion: reduce){.olympiad-status-badge.status-exam_running .olympiad-status-dot{animation:none;}}

.danger-zone-card{border:1.5px solid var(--red-tint);}

.modal-overlay{position:fixed;inset:0;background:rgba(20,25,45,.55);z-index:1000;align-items:center;justify-content:center;padding:20px;}
.modal-box{background:#fff;border-radius:10px;padding:22px;max-width:420px;width:100%;box-shadow:0 20px 50px rgba(0,0,0,.25);}

.scan-shell{max-width:480px;margin:0 auto;text-align:center;}
.scan-video-wrap{position:relative;border-radius:10px;overflow:hidden;background:#000;aspect-ratio:1;max-width:360px;margin:0 auto;}
.scan-video-wrap video{width:100%;height:100%;object-fit:cover;}
.scan-frame-guide{position:absolute;inset:15%;border:3px solid rgba(255,255,255,.85);border-radius:12px;pointer-events:none;}
.scan-result-box{text-align:left;border-top:1px solid var(--line);margin-top:18px;padding-top:18px;}
.scan-result-field{display:flex;justify-content:space-between;padding:8px 0;border-bottom:1px solid var(--line);}
.scan-success-box{text-align:center;padding:20px 0;}
.scan-success-icon{display:inline-flex;align-items:center;justify-content:center;width:64px;height:64px;border-radius:50%;background:#e6f4e8;color:#2f9a3a;font-size:2rem;}
.ml-10{margin-left:10px;}
.branding-current-preview{display:flex;align-items:center;gap:10px;margin-bottom:8px;}
.branding-current-preview img{height:36px;max-width:120px;object-fit:contain;background:#f4f5f8;border:1px solid var(--line);border-radius:4px;padding:4px;}

.theme-swatch-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:12px;}
.theme-swatch-option{display:flex;flex-direction:column;align-items:center;gap:6px;cursor:pointer;padding:8px;border-radius:8px;border:2px solid transparent;}
.theme-swatch-option input{position:absolute;opacity:0;pointer-events:none;}
.theme-swatch-option.is-selected{border-color:var(--brand);background:var(--brand-tint);}
.theme-swatch-option.is-locked{cursor:default;opacity:.6;}
.theme-swatch-preview{width:64px;height:44px;border-radius:6px;border:1px solid;display:flex;align-items:flex-end;justify-content:center;gap:6px;padding-bottom:6px;}
.theme-swatch-dot{width:10px;height:10px;border-radius:50%;}
.theme-swatch-label{font-size:12px;font-weight:600;text-align:center;}

.theme-mini-preview{padding:20px;border-radius:10px;}
.theme-mini-card{max-width:280px;margin:0 auto;padding:16px;border-radius:8px;border:1px solid;}
.theme-mini-num{font-size:11px;font-weight:700;margin-bottom:6px;}
.theme-mini-text{font-size:14px;margin-bottom:10px;}
.theme-mini-option{display:flex;align-items:center;gap:8px;padding:7px 10px;border:1.5px solid;border-radius:6px;margin-bottom:6px;font-size:13px;}
.mb-14{margin-bottom:14px;}
.mt-10{margin-top:10px;}
.text-sm{font-size:var(--text-sm);}
.form-row-flex-tight{display:flex;gap:6px;margin-top:6px;}
.form-row-flex-xs{display:flex;gap:4px;margin-bottom:4px;}
.form-row-flex-mt{display:flex;gap:6px;align-items:center;margin-top:12px;}
.form-row-flex-12{display:flex;gap:12px;}
.col-wide{width:160px;}
.grid-span-all{grid-column:1/-1;}
.photo-sq-sm{width:56px;height:56px;}
.col-extra-wide{width:220px;}
.col-md-wide{width:200px;}
.avatar-round-sm{width:40px;height:40px;border-radius:50%;object-fit:cover;}
.max-w-260{max-width:260px;}
.col-180{width:180px;}
.thumb-yt{height:45px;border-radius:4px;}
.code-textarea{font-family:monospace;font-size:0.85rem;}
.form-grid.pad-12{padding:12px 0;}
.form-grid.pad-10{padding:10px 0;}
.panel-title.xs h2{font-size:13px;}
.form-justify-end{display:flex;gap:8px;justify-content:flex-end;}
.input-num-md{width:110px;padding:6px 8px;border:1px solid var(--line);border-radius:var(--radius-sm);}
.select-compact{padding:6px 8px;border:1px solid var(--line);border-radius:var(--radius-sm);}
.col-230{width:230px;}
.form-row-flex-pad{display:flex;gap:8px;align-items:center;padding:6px 0;}
.input-rename{flex:1;max-width:320px;padding:7px 10px;border:1px solid var(--line);border-radius:var(--radius-sm);}
.rename-btn{margin-left:8px;font-size:11px;}
.form-row-flex-wrap{display:flex;gap:12px;align-items:center;flex-wrap:wrap;}
.label-inline-checkbox{display:flex;gap:6px;align-items:center;font-weight:400;}
/* Gallery album grid -- .grid-3 previously had NO CSS backing at all
   (100% inline style did the work); formalized here. Also fixes an
   undefined --paper-alt token (never declared anywhere) that was
   silently falling back to a hardcoded #f1f1f1 -- now uses the real
   --bg token, same as every other neutral-background surface. */
.grid-3{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin-bottom:22px;}
.album-cover-link{display:block;aspect-ratio:16/10;background:var(--bg);}
.album-cover-img{width:100%;height:100%;object-fit:cover;}
.album-body{padding:14px 16px;}
.album-meta-row{display:flex;justify-content:space-between;align-items:center;margin-top:8px;}
.photo-grid-4{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;}
.photo-sq-ratio{aspect-ratio:1/1;border-radius:var(--radius-md);overflow:hidden;}
.mt-xs{margin-top:4px;}
.preview-strip{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px;}
.checkbox-group-wide{display:flex;gap:22px;margin-top:4px;}
.checkbox-group-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:10px 16px;margin-top:6px;}
.photo-sq-xs{width:48px;height:48px;}
.avatar-round-md{width:56px;height:56px;border-radius:50%;object-fit:cover;}
.max-w-280{max-width:280px;}
.form-col-flex{display:flex;flex-direction:column;gap:6px;}
.input-compact{padding:5px 8px;border:1px solid var(--line);border-radius:var(--radius-sm);font-size:0.85rem;}
.self-start{align-self:flex-start;}
.logo-thumb{height:32px;max-width:100px;object-fit:contain;}
.logo-preview-box{height:50px;border-radius:4px;margin-top:6px;background:var(--bg);padding:4px;}
.photo-sq-xxs{width:36px;height:36px;}
.col-100{width:100px;}
.mb-xs{margin-bottom:6px;}
.col-150{width:150px;}
.col-170{width:170px;}
.photo-thumb-60{height:60px;border-radius:6px;display:block;margin-bottom:6px;}
.col-80{width:80px;}
.pill-xs{font-size:10px;}
.media-thumb-dark{aspect-ratio:1/1;border-radius:var(--radius-md);overflow:hidden;background:#0b1220;display:flex;align-items:center;justify-content:center;}
.video-link-overlay{color:#fff;font-size:13px;text-align:center;padding:8px;}
.mt-2{margin-top:2px;}
.grid-2col{display:grid;grid-template-columns:1fr 1fr;gap:20px;}
.story-gallery-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:12px;}
.story-gallery-item{position:relative;border-radius:8px;overflow:hidden;aspect-ratio:1;}
.story-gallery-item img{width:100%;height:100%;object-fit:cover;display:block;}
.story-gallery-remove-btn{position:absolute;top:6px;right:6px;background:rgba(0,0,0,.6);color:#fff;border:none;border-radius:50%;width:24px;height:24px;cursor:pointer;font-size:13px;}
.role-checkbox-row{display:flex;gap:8px;align-items:flex-start;font-weight:400;margin-bottom:8px;}
.mt-3{margin-top:3px;}
.profile-photo-md{max-width:110px;border-radius:var(--radius-md);border:1px solid var(--line);}
.col-130{width:130px;}
.input-wide{width:240px;padding:6px 8px;border:1px solid var(--line);border-radius:var(--radius-sm);}
.pill-btn{border:none;cursor:pointer;}
.input-narrow{width:140px;padding:4px 6px;border:1px solid var(--line);border-radius:var(--radius-sm);}
.hr-divider{border:none;border-top:1px solid var(--line);margin:18px 0;}
.action-row{display:flex;gap:20px;flex-wrap:wrap;}
.form-inline-flex{display:flex;gap:8px;align-items:flex-end;}

/* ---------- Tables ---------- */
/* PHASE 4 — TABLE + FILTER TOOLBAR STANDARD: table. Same table/thead/tbody
   elements used by every list page's <table> -- no markup change needed
   anywhere, this is a global element-selector refinement. Row padding
   nudged up slightly (11px -> 12px) for a touch more breathing room
   while staying compact/dense per the Linear-style density goal; header
   gets a marginally stronger bottom border so it reads as a clear
   anchor above the data rows. */
table{width:100%;border-collapse:collapse;font-size:13.5px;}
thead th{text-align:left;background:#fafbfb;color:var(--ink-soft);font-weight:600;font-size:12px;text-transform:uppercase;letter-spacing:.3px;padding:10px 16px;border-bottom:1px solid var(--line);}
tbody td{padding:12px 16px;border-bottom:1px solid var(--line);vertical-align:middle;}
tbody tr:last-child td{border-bottom:none;}
tbody tr{transition:background .12s ease;}
tr.row-link{cursor:pointer;}
tbody tr:hover{background:var(--brand-tint,#eef0fd);}
.cell-name{font-weight:600;}
.cell-sub{color:var(--ink-soft);font-size:12px;}

/* =========================================================================
   PHASE 2 — CORE COMPONENTS: Badge / Pill
   Same class names/colors kept exactly (status_pill_class() in
   functions.php returns these class names across every module) -- only
   a subtle border and slightly tighter letter-spacing added for a more
   defined, less "flat sticker" look. ========================================================================= */
.pill{display:inline-block;padding:3px 10px;border-radius:20px;font-size:11.5px;font-weight:600;letter-spacing:.1px;border:1px solid rgba(0,0,0,.05);}
.pill-active{background:var(--green-tint);color:var(--green);}
.pill-pending{background:var(--amber-tint);color:var(--amber);}
.pill-review{background:#eef0fb;color:#3d4ba3;}
.pill-inactive{background:#eef1f2;color:#68767c;}
.pill-rejected{background:var(--red-tint);color:var(--red);}

/* =========================================================================
   PHASE 4 — TABLE + FILTER TOOLBAR STANDARD
   .toolbar's two-group layout (a .search box pushed left, a .filters
   group pushed right via justify-content:space-between) is already the
   established pattern across ~35 list pages -- kept exactly as-is. This
   phase formalizes .filters as the one correct place to put *any* extra
   filter control (dropdowns, date range, buttons, "Clear" link) instead
   of leaving them as loose direct children of .toolbar, which is what
   caused the internship-applications date filter to visually spread
   apart edge-to-edge before (see that page's toolbar markup, now fixed
   to use class="filters" instead of a one-off inline-style wrapper).
   ========================================================================= */
.toolbar{display:flex;justify-content:space-between;align-items:center;padding:14px 16px;border-bottom:1px solid var(--line);gap:12px;flex-wrap:wrap;}
.search{flex:1;max-width:320px;}
.search input{width:100%;padding:8px 12px;border:1px solid var(--line);border-radius:var(--radius-sm);font-size:13px;}
.filters{display:flex;gap:8px;flex-wrap:wrap;align-items:center;}
.filters label{font-size:12px;color:var(--ink-soft);display:inline-flex;align-items:center;gap:5px;}
.filters input[type="date"]{padding:6px 8px;border:1px solid var(--line);border-radius:var(--radius-sm);font-size:13px;color:var(--ink);font-family:inherit;}
.filters input[type="number"]{width:90px;padding:6px 8px;border:1px solid var(--line);border-radius:var(--radius-sm);font-size:13px;color:var(--ink);font-family:inherit;}
select{padding:8px 10px;border:1px solid var(--line);border-radius:var(--radius-sm);font-size:13px;background:#fff;color:var(--ink);}
.table-total-row{background:#fafbfb;}

/* =========================================================================
   PHASE 2 — CORE COMPONENTS: Button
   .btn / .btn-primary / .btn-ghost / .btn-sm / .btn-danger keep their exact
   class names and behaviour (hundreds of pages already use them) -- only
   the visual polish and missing states are added here. New variants
   (.btn-secondary, .btn-outline, .btn-success, disabled, loading) are
   additive so nothing that already renders a button anywhere breaks.
   ========================================================================= */
.btn{display:inline-flex;align-items:center;gap:6px;padding:9px 16px;border-radius:var(--radius-sm);font-size:13px;font-weight:600;border:1px solid transparent;cursor:pointer;text-decoration:none;background:none;font-family:inherit;transition:transform .12s ease,box-shadow .12s ease,background .15s ease,border-color .15s ease;}
.btn-primary:hover{transform:translateY(-1px);box-shadow:0 4px 12px -2px rgba(26,46,200,.28);}
.btn-primary:active{transform:translateY(0);box-shadow:none;}
.btn-primary{background:var(--brand);color:#fff;}
.btn-primary:hover{background:var(--brand-dark);}
.btn-ghost{background:#fff;border-color:var(--line);color:var(--ink);}
.btn-ghost:hover{background:#f5f7f7;}
.btn-sm{padding:5px 11px;font-size:12px;}
.btn-danger{color:#fff;background:var(--red);}
.btn-danger:hover{background:#b81c22;transform:translateY(-1px);}
.btn-danger:active{transform:translateY(0);}

/* New variants — additive, for use in Phase 2 onward where a page needs
   a clearer secondary/outline/success action than .btn-ghost/.btn-danger
   already provide. Existing pages using .btn-ghost etc. are unaffected. */
.btn-secondary{background:var(--bg);color:var(--ink);border-color:var(--bg);}
.btn-secondary:hover{background:#e7e9ef;}
.btn-outline{background:transparent;color:var(--brand);border-color:var(--brand);}
.btn-outline:hover{background:var(--brand-tint);}
.btn-success{color:#fff;background:var(--green);}
.btn-success:hover{background:#267d30;transform:translateY(-1px);}
.btn-success:active{transform:translateY(0);}

.btn[disabled],.btn:disabled{opacity:.5;cursor:not-allowed;pointer-events:none;transform:none!important;box-shadow:none!important;}

/* Loading state — toggled by adding class="is-loading" to a .btn (no
   page does this yet; the CSS groundwork is here for when a future phase
   wires up a "submitting..." spinner via JS on long-running form posts). */
.btn.is-loading{position:relative;color:transparent!important;pointer-events:none;}
.btn.is-loading::after{
  content:'';position:absolute;top:50%;left:50%;width:14px;height:14px;margin:-7px 0 0 -7px;
  border:2px solid rgba(255,255,255,.4);border-top-color:#fff;border-radius:50%;
  animation:btn-spin .6s linear infinite;
}
.btn-ghost.is-loading::after,.btn-outline.is-loading::after,.btn-secondary.is-loading::after{
  border-color:rgba(26,46,200,.25);border-top-color:var(--brand);
}
@keyframes btn-spin{to{transform:rotate(360deg);}}
@media (prefers-reduced-motion: reduce){.btn.is-loading::after{animation:none;}}

.action-links{display:flex;gap:14px;}
.action-links a, .action-links button.link{font-size:12.5px;color:var(--brand);text-decoration:none;font-weight:600;cursor:pointer;background:none;border:none;padding:0;font-family:inherit;display:inline-flex;align-items:center;gap:4px;}
.action-links .danger{color:var(--red);}

/* ---------- Forms ---------- */
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px;padding:20px;}
.form-grid.full{grid-template-columns:1fr;}
.field{display:flex;flex-direction:column;gap:6px;}
.field.span-2{grid-column:span 2;}
.field label{font-size:12.5px;font-weight:600;color:var(--ink-soft);}
.field .req{color:var(--red);}
.field input, .field select, .field textarea{padding:9px 11px;border:1px solid var(--line);border-radius:6px;font-size:13.5px;color:var(--ink);font-family:inherit;background:#fff;}
.field textarea{resize:vertical;min-height:70px;}
.field .note{font-size:11.5px;color:var(--ink-soft);}

/* =========================================================================
   PHASE 2 — CORE COMPONENTS: Input / Select / Textarea
   Placed after the .field rules above on purpose: ".field input" and
   this block's selectors are the same specificity, so source order
   decides -- being later here is what lets the focus/hover states apply
   inside .field without needing to touch that rule at all. Covers plain
   inputs (e.g. .search input, toolbar <select>) too since those are
   defined even earlier in the file. Text-like input types are listed
   explicitly (rather than :not([type=checkbox]) etc.) so this stays at
   the same specificity level as other input selectors in this file and
   doesn't unexpectedly out-rank a more specific rule like
   .topbar-search input:focus below. No name/id/type/required attribute
   touched anywhere -- purely a shared visual layer.
   ========================================================================= */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="month"],
input[type="time"], input[type="url"], input[type="search"],
select, textarea{
  transition:border-color .12s ease, box-shadow .12s ease, background .12s ease;
}
input[type="text"]:hover, input[type="email"]:hover, input[type="password"]:hover,
input[type="number"]:hover, input[type="date"]:hover, input[type="month"]:hover,
input[type="time"]:hover, input[type="url"]:hover, input[type="search"]:hover,
select:hover, textarea:hover{
  border-color:#c3cadb;
}
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus,
input[type="number"]:focus, input[type="date"]:focus, input[type="month"]:focus,
input[type="time"]:focus, input[type="url"]:focus, input[type="search"]:focus,
select:focus, textarea:focus{
  outline:none;
  border-color:var(--brand);
  box-shadow:0 0 0 3px var(--brand-tint);
}
input:disabled, select:disabled, textarea:disabled{
  background:var(--bg);
  color:var(--ink-soft);
  cursor:not-allowed;
  opacity:.75;
}
::placeholder{color:#9aa2b5;opacity:1;}
.form-actions{display:flex;justify-content:flex-end;gap:10px;padding:16px 20px;border-top:1px solid var(--line);background:#fafbfb;}
.section-label{grid-column:1/-1;font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.4px;color:var(--brand-dark);border-bottom:1px solid var(--line);padding-bottom:8px;margin-top:6px;}
.section-label:first-child{margin-top:0;}
.warn-box{background:var(--amber-tint);color:#8a5b06;padding:10px 12px;border-radius:6px;font-size:12.5px;}

/* ---------- Login ---------- */
.login-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;background:linear-gradient(160deg,#0c1a7a,#1a2ec8);position:relative;padding:70px 20px 20px;overflow:hidden;}

/* ---------------------------------------------------- Animated Background Icons
   Purely decorative (aria-hidden). Sits behind everything else in the
   stacking order; .login-main is lifted onto its own layer (below) so it
   always paints above these regardless of DOM order, since an absolutely
   positioned element otherwise always paints above a static one. */
.login-bg-icons{position:absolute;inset:0;overflow:hidden;z-index:0;pointer-events:none;}
.bg-icon{position:absolute;width:46px;height:46px;color:#fff;opacity:0.1;animation:bg-icon-drift linear infinite;will-change:transform;}
.bg-icon:nth-child(1){top:8%;left:6%;width:42px;animation-duration:34s;animation-delay:-2s;}
.bg-icon:nth-child(2){top:70%;left:9%;width:56px;animation-duration:44s;animation-delay:-18s;}
.bg-icon:nth-child(3){top:15%;left:88%;width:50px;animation-duration:38s;animation-delay:-9s;}
.bg-icon:nth-child(4){top:82%;left:85%;width:40px;animation-duration:30s;animation-delay:-4s;}
.bg-icon:nth-child(5){top:38%;left:3%;width:48px;animation-duration:40s;animation-delay:-24s;}
.bg-icon:nth-child(6){top:5%;left:45%;width:38px;animation-duration:32s;animation-delay:-14s;}
.bg-icon:nth-child(7){top:60%;left:50%;width:52px;animation-duration:46s;animation-delay:-30s;}
.bg-icon:nth-child(8){top:90%;left:40%;width:44px;animation-duration:36s;animation-delay:-11s;}
.bg-icon:nth-child(9){top:25%;left:70%;width:40px;animation-duration:33s;animation-delay:-20s;}
.bg-icon:nth-child(10){top:48%;left:92%;width:54px;animation-duration:42s;animation-delay:-6s;}
.bg-icon:nth-child(11){top:12%;left:25%;width:36px;animation-duration:29s;animation-delay:-16s;}
.bg-icon:nth-child(12){top:75%;left:65%;width:46px;animation-duration:39s;animation-delay:-27s;}
@keyframes bg-icon-drift{
  0%{transform:translate(0,0) rotate(0deg);}
  25%{transform:translate(26px,-22px) rotate(6deg);}
  50%{transform:translate(-14px,26px) rotate(-5deg);}
  75%{transform:translate(-26px,-14px) rotate(4deg);}
  100%{transform:translate(0,0) rotate(0deg);}
}
/* Fewer icons + lower opacity on small screens: keeps things calm and
   avoids animating elements the visitor is unlikely to even notice behind
   a full-width card, while being lighter on mobile GPUs/battery. */
@media (max-width:640px){
  .bg-icon{opacity:0.07;}
  .bg-icon:nth-child(n+7){display:none;}
}
@media (prefers-reduced-motion: reduce){
  .bg-icon{animation:none;}
}

.login-topbar{position:absolute;top:20px;right:24px;display:flex;gap:12px;align-items:center;z-index:10;}
.login-topbar .btn-public-site{background:rgba(255,255,255,.15);color:#fff;border:1px solid rgba(255,255,255,.4);padding:9px 18px;border-radius:8px;text-decoration:none;font-size:13.5px;font-weight:700;display:flex;align-items:center;gap:7px;transition:background .15s ease;}
.login-topbar .btn-public-site:hover{background:rgba(255,255,255,.28);}
.login-topbar .btn-public-site svg{width:16px;height:16px;}
.login-help-btn{width:36px;height:36px;border-radius:50%;border:1px solid rgba(255,255,255,.4);background:rgba(255,255,255,.15);color:#fff;font-weight:700;font-size:15px;cursor:pointer;line-height:1;}
.login-help-btn:hover{background:rgba(255,255,255,.28);}
.login-help-popover{display:none;position:absolute;top:64px;right:24px;background:#fff;color:var(--ink);border-radius:10px;padding:18px 20px;width:250px;box-shadow:0 14px 34px rgba(0,0,0,.28);z-index:20;}
.login-help-popover.is-open{display:block;}
.login-help-popover h4{margin:0 0 10px;font-size:14px;}
.login-help-popover p{margin:5px 0;font-size:13px;color:var(--ink-soft);}
.login-main{display:flex;gap:44px;align-items:stretch;justify-content:center;flex-wrap:wrap;max-width:900px;position:relative;z-index:1;}
.login-motivation-panel{width:320px;border:1px solid rgba(255,255,255,.35);border-radius:12px;padding:30px 26px;color:#fff;display:flex;flex-direction:column;justify-content:center;}
.login-motivation-panel .greeting{font-size:23px;font-weight:700;margin-bottom:14px;}
.login-motivation-panel .typewriter-text{font-size:14px;line-height:1.7;min-height:120px;color:rgba(255,255,255,.92);}
.login-motivation-panel .cursor{display:inline-block;width:2px;height:1em;vertical-align:text-bottom;background:#fff;margin-left:2px;animation:login-cursor-blink 0.85s steps(1) infinite;}
@keyframes login-cursor-blink{50%{opacity:0;}}
@media (max-width:820px){.login-motivation-panel{display:none;}}
@media (prefers-reduced-motion: reduce){.login-motivation-panel .cursor{animation:none;}}
.login-card{background:#fff;border-radius:10px;width:360px;padding:34px 30px;box-shadow:0 20px 50px rgba(0,0,0,.25);}
.login-card .login-logo{display:block;max-width:210px;height:auto;margin:0 auto 18px;}
.login-card h1{font-size:16px;margin:0 0 2px;}
.login-card .org{font-size:12px;color:var(--ink-soft);margin-bottom:22px;}
.login-card .field{margin-bottom:14px;}
.login-card .btn{width:100%;justify-content:center;margin-top:6px;padding:11px;}
.login-error{background:var(--red-tint);color:var(--red);padding:9px 12px;border-radius:6px;font-size:12.5px;margin-bottom:14px;}

/* PHASE 2 — CORE COMPONENTS: Empty state. Same .empty class (used on ~83
   list pages via "<div class="empty">No X yet.</div>") -- just more
   breathing room and readable text size. An icon/illustration would need
   per-page markup changes, so that's left for a later module-by-module
   phase rather than done here as a blanket CSS change. */
.empty{padding:var(--space-10) var(--space-6);text-align:center;color:var(--ink-soft);font-size:var(--text-base);line-height:1.6;}
.note-banner{background:var(--brand-tint);color:var(--brand-dark);border:1px solid #c3ccf4;border-radius:6px;padding:10px 14px;font-size:12.5px;margin-bottom:18px;}
.topbar-public-site-link{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:50%;color:var(--ink-soft);background:var(--panel-alt,rgba(0,0,0,.04));flex-shrink:0;}
.topbar-public-site-link:hover{color:var(--brand);background:var(--brand-tint);}

/* ---------- Top-bar notification bell ----------
   Native <details>/<summary> again -- same reliable, JS-free pattern as
   the sidebar's collapsible groups. */
.notif-bell{position:relative;flex-shrink:0;}
.notif-bell summary{
  display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:50%;
  color:var(--ink-soft);background:var(--panel-alt,rgba(0,0,0,.04));cursor:pointer;list-style:none;position:relative;
}
.notif-bell summary::-webkit-details-marker{display:none;}
.notif-bell summary::marker{content:'';}
.notif-bell summary:hover{color:var(--brand);background:var(--brand-tint);}
.notif-badge{
  position:absolute;top:-3px;right:-3px;min-width:16px;height:16px;padding:0 3px;border-radius:9px;
  background:var(--red,#d2232a);color:#fff;font-size:10px;font-weight:700;line-height:16px;text-align:center;
  animation:notif-pulse 2.2s ease-in-out infinite;
}
@keyframes notif-pulse{
  0%,100%{box-shadow:0 0 0 0 rgba(210,35,42,.5);}
  50%{box-shadow:0 0 0 4px rgba(210,35,42,0);}
}
.notif-panel{
  position:absolute;top:calc(100% + 8px);right:0;width:340px;max-height:70vh;overflow-y:auto;
  background:#fff;border:1px solid var(--line);border-radius:12px;box-shadow:0 16px 40px rgba(20,30,60,.18);
  z-index:90;padding:6px 0;
}
.notif-panel-head{padding:10px 16px;font-size:12px;font-weight:700;color:var(--ink-soft);text-transform:uppercase;letter-spacing:.04em;border-bottom:1px solid var(--line);}
.notif-empty{padding:24px 16px;text-align:center;color:var(--ink-soft);font-size:13px;}
.notif-group{padding:8px 0;border-bottom:1px solid var(--line);}
.notif-group:last-child{border-bottom:none;}
.notif-group-head{display:flex;justify-content:space-between;align-items:center;padding:4px 16px;font-size:12.5px;font-weight:700;color:var(--ink);}
.notif-group-count{background:var(--brand-tint);color:var(--brand-dark);border-radius:10px;padding:1px 8px;font-size:11px;}
.notif-item{display:flex;flex-direction:column;gap:1px;padding:7px 16px;text-decoration:none;}
.notif-item:hover{background:var(--bg);}
.notif-item-ref{font-size:13px;font-weight:600;color:var(--ink);}
.notif-item-detail{font-size:11.5px;color:var(--ink-soft);}
.notif-view-all{display:block;padding:7px 16px;font-size:12px;font-weight:600;color:var(--brand);text-decoration:none;}
.notif-view-all:hover{text-decoration:underline;}
@media (max-width:720px){ .notif-panel{position:fixed;top:60px;right:8px;left:8px;width:auto;} }
.notice-rich-content{line-height:1.6;}
.notice-rich-content p{margin:0 0 10px;}
.notice-rich-content h1,.notice-rich-content h2,.notice-rich-content h3,.notice-rich-content h4{margin:14px 0 6px;}
.notice-rich-content ul,.notice-rich-content ol{margin:0 0 10px;padding-left:20px;}
.notice-rich-content blockquote{border-left:3px solid var(--line);margin:0 0 10px;padding-left:12px;color:var(--ink-soft);}
.notice-rich-content a{color:var(--brand);}
.notice-rich-content .ql-align-center{text-align:center;}
.notice-rich-content .ql-align-right{text-align:right;}
.notice-rich-content .ql-align-justify{text-align:justify;}
.settings-tabs{display:flex;gap:4px;border-bottom:2px solid var(--line);margin-bottom:22px;}
.settings-tab-btn{background:none;border:none;cursor:pointer;padding:11px 18px;font-size:13.5px;font-weight:600;color:var(--ink-soft);border-bottom:2px solid transparent;margin-bottom:-2px;}
.settings-tab-btn:hover{color:var(--brand);}
.settings-tab-btn.active{color:var(--brand);border-bottom-color:var(--brand);}
.settings-tab-content{display:none;}

/* ---------- Flash messages ---------- */
/* PHASE 2 — CORE COMPONENTS: Alert. .flash-success/.flash-error keep their
   exact class names (used across every module via flash()/get_flashes()
   in functions.php) -- a left accent border is added for stronger visual
   hierarchy, plus two new variants (.flash-warning/.flash-info) for future
   use; no page currently renders those two so this is purely additive. */
.flash{padding:11px 16px;border-radius:var(--radius-sm);font-size:13px;margin-bottom:16px;border-left:3px solid transparent;}
.flash-success{background:var(--green-tint);color:var(--green);border-left-color:var(--green);}
.flash-error{background:var(--red-tint);color:var(--red);border-left-color:var(--red);}
.flash-warning{background:var(--amber-tint);color:var(--amber);border-left-color:var(--amber);}
.flash-info{background:var(--brand-tint);color:var(--brand-dark);border-left-color:var(--brand);}

/* ============================================================
   Password strength meter (Users module)
   ============================================================ */
.pw-meter{height:6px;background:#e8ebf2;border-radius:4px;overflow:hidden;margin-top:6px;}
.pw-meter span{display:block;height:100%;width:0;transition:width .2s ease,background .2s ease;}
.pw-meter span.weak{background:var(--red);}
.pw-meter span.medium{background:var(--amber);}
.pw-meter span.strong{background:var(--green);}
.pw-rules{list-style:none;margin:8px 0 0;padding:0;font-size:11.5px;color:var(--ink-soft);}
.pw-rules li{padding-left:18px;position:relative;margin-bottom:3px;}
.pw-rules li:before{content:"○";position:absolute;left:0;color:var(--ink-soft);}
.pw-rules li.ok{color:var(--green);}
.pw-rules li.ok:before{content:"●";color:var(--green);}
.ok-text{color:var(--green);}
.err-text{color:var(--red);}

/* Horizontal scroll wrapper for wide tables */
.table-scroll{width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;}

/* ============================================================
   Mobile menu button (hidden on desktop)
   ============================================================ */
.menu-btn{display:none;background:none;border:1px solid var(--line);border-radius:6px;padding:7px 11px;
  font-size:17px;line-height:1;cursor:pointer;color:var(--ink);font-family:inherit;}
.sidebar-backdrop{display:none;}

/* ============================================================
   RESPONSIVE — tablet
   ============================================================ */
@media (max-width: 1024px){
  .stat-grid{grid-template-columns:repeat(2,1fr);}
  .sidebar{width:190px;}
  .content{padding:20px;}
}

/* ============================================================
   RESPONSIVE — phone
   ============================================================ */
@media (max-width: 720px){
  body{font-size:14.5px;}

  /* Sidebar slides in from the left instead of taking permanent space */
  .app{flex-direction:column;}
  .sidebar{
    position:fixed;top:0;left:0;bottom:0;width:250px;z-index:60;
    transform:translateX(-100%);transition:transform .22s ease;overflow-y:auto;
  }
  .sidebar.open{transform:translateX(0);box-shadow:4px 0 24px rgba(0,0,0,.3);}
  .sidebar-backdrop.show{display:block;position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:50;}
  .nav-link{padding:14px;font-size:15px;}   /* bigger tap targets */
  .nav-sub li a{padding:12px 12px 12px 32px;font-size:14.5px;}
  .sidebar-collapse-btn{display:none;}   /* icon-only collapse is a desktop-only concept */

  .menu-btn{display:inline-flex;align-items:center;}
  .topbar{padding:12px 16px;gap:12px;position:sticky;top:0;z-index:30;}
  .topbar h1{font-size:16px;flex:1;}
  .topbar .who{font-size:12px;gap:6px;flex-wrap:wrap;justify-content:flex-end;}
  .badge-role{font-size:10.5px;padding:2px 7px;}

  .content{padding:16px 14px;}

  /* One column everywhere */
  .stat-grid{grid-template-columns:1fr;gap:12px;}
  .form-grid{grid-template-columns:1fr;padding:16px;gap:14px;}
  .field.span-2{grid-column:span 1;}
  .stat .value{font-size:22px;}

  /* Panel headings stack above their action buttons */
  .panel-title{flex-direction:column;align-items:flex-start;gap:10px;}
  .panel-title .btn{width:100%;justify-content:center;}

  /* Wide tables scroll sideways inside their card instead of breaking layout */
  .card{overflow-x:auto;}
  table{min-width:620px;}

  /* Toolbars / filters stack */
  .toolbar{flex-direction:column;align-items:stretch;}
  .search{max-width:none;}
  .filters{flex-direction:column;}
  .filters select,.filters .btn{width:100%;}

  /* Form action buttons full width and easy to hit */
  .form-actions{flex-direction:column-reverse;gap:8px;padding:14px 16px;}
  .form-actions .btn{width:100%;justify-content:center;padding:12px;}

  /* Inputs at 16px stop iOS Safari from zooming on focus */
  .field input,.field select,.field textarea,.search input,select{font-size:16px;padding:11px 12px;}

  .login-card{width:100%;max-width:360px;margin:0 14px;padding:26px 20px;}
  .login-card .login-logo{max-width:180px;}

  .action-links{gap:12px;flex-wrap:wrap;}
}

@media (max-width: 400px){
  .content{padding:12px 10px;}
  .topbar h1{font-size:15px;}
}

/* ---------- Chart cards ---------- */
.chart-grid{display:grid;grid-template-columns:2fr 1fr;gap:16px;margin-bottom:22px;}
.chart-card{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);padding:18px;text-align:center;}
.chart-card h3{margin:0 0 4px;font-size:13.5px;color:var(--brand-dark);}
.chart-card .chart-sub{font-size:11.5px;color:var(--ink-soft);margin-bottom:12px;}
.chart-donut-wrap{display:flex;gap:18px;align-items:center;flex-wrap:wrap;}
.chart-donut-wrap > svg{flex-shrink:0;}
.chart-donut-wrap > div{flex:1;min-width:150px;}
@media (max-width: 900px){ .chart-grid{grid-template-columns:1fr;} }

/* ---------- Bulk action bar ---------- */
.bulk-bar{
  display:flex;align-items:center;gap:12px;flex-wrap:wrap;
  padding:12px 16px;background:var(--brand-tint);border-bottom:1px solid var(--line);
  font-size:13px;
}
.bulk-bar select,.bulk-bar input[type=number]{padding:6px 9px;border:1px solid var(--line);border-radius:6px;font-size:13px;}
@media (max-width:720px){ .bulk-bar{flex-direction:column;align-items:stretch;} .bulk-bar .btn{width:100%;justify-content:center;} }

/* ---------- CR-18: constrained photo previews ----------
   Photo previews (both existing "Current" thumbnails and the live
   pre-upload preview) used to render at a fixed height only, so an
   unusually wide/panorama source photo would blow out sideways across
   the whole card. These two shapes cover every use case in the app:
   square/portrait for profile-style photos, wide for cover/banner photos. */
.photo-preview-sq{
  width:96px;height:96px;object-fit:cover;border-radius:8px;
  border:1px solid var(--line);display:block;margin-top:6px;background:#f4f5fa;
}
.photo-preview-wide{
  max-width:220px;height:90px;object-fit:cover;border-radius:8px;
  border:1px solid var(--line);display:block;margin-top:6px;background:#f4f5fa;
}
.hidden{display:none;}

/* ---------- Shared delete-confirmation modal (replaces browser confirm()) ---------- */
/* PHASE 5 — MODAL/DROPDOWN POLISH: same markup/JS as before (footer.php's
   toggleActionMenu()/confirm-modal logic untouched) -- radius and shadow
   now pull from the Phase 1 tokens, and the shadow itself is toned down
   (was a fairly heavy 0 30px 60px shadow; --shadow-lg is the same idea
   but noticeably softer, matching the "minimal shadow" direction). Icon
   colors switched from one-off hex values to the existing --red/--red-tint
   tokens already used for danger states everywhere else in the app. */
.sfa-confirm-modal{
  display:none; position:fixed; inset:0; z-index:200;
  background:rgba(15,25,55,.5); align-items:center; justify-content:center; padding:20px;
}
.sfa-confirm-modal.is-open{display:flex;}
.sfa-confirm-box{
  background:#fff; border-radius:var(--radius-lg); padding:28px 26px; max-width:380px; width:100%;
  box-shadow:var(--shadow-lg); text-align:center;
  animation:sfa-confirm-in .18s cubic-bezier(.2,.8,.3,1);
}
@keyframes sfa-confirm-in{ from{opacity:0;transform:translateY(-10px) scale(.97);} to{opacity:1;transform:translateY(0) scale(1);} }
.sfa-confirm-icon{
  width:44px;height:44px;border-radius:50%;background:var(--red-tint);color:var(--red);
  display:flex;align-items:center;justify-content:center;font-weight:800;font-size:20px;
  margin:0 auto 14px;
}
#sfa-confirm-message{font-size:14px;color:var(--ink);line-height:1.6;margin-bottom:20px;}
.sfa-confirm-actions{display:flex;gap:10px;justify-content:center;}
.sfa-confirm-type-input{
  width:100%;padding:8px 10px;border:1px solid var(--line);border-radius:var(--radius-sm);font-size:13.5px;font-family:inherit;
}
.sfa-confirm-actions .btn[disabled]{opacity:.45;cursor:not-allowed;}
.sfa-confirm-actions .btn[disabled]:hover{transform:none;box-shadow:none;}
@media (prefers-reduced-motion: reduce){ .sfa-confirm-box{animation:none;} }
