/* ============================================================================
   PF FRIENDS DESIGN TOKENS
   ----------------------------------------------------------------------------
   Semantic roles, not colour names. The two brand hues do OPPOSITE jobs, which
   is why --accent resolves to a different hue per theme:

     lime   #B8FF3C on charcoal = 15.0:1  -> fine as text
     lime           on white    =  1.2:1  -> INVISIBLE; fill only
     indigo #5B3FD6 on white    =  6.7:1  -> fine as text
     indigo         on charcoal =  2.7:1  -> fails; fill only
     offwhite       on indigo   =  6.2:1  -> the button pairing, both themes

   Both hues are legally load-bearing: trade-dress proximity to Planet Fitness
   would strip the nominative-fair-use defence protecting the domain name.
   #5B3FD6 and #B8FF3C must always be present; Planet Fitness's purple and
   yellow must never appear.
   Guarded by tests/test_legal_and_brand.py + tests/test_design_system.py.

   Greys are deliberately VIOLET-SHIFTED, never neutral: charcoal plus a lone
   acid-green accent is a generic look, and the indigo tint is what makes this
   read as ours.
   ========================================================================== */
:root {
  /* brand constants (identical in both themes) */
  --pff-indigo: #5B3FD6;
  --pff-lime:   #B8FF3C;

  /* --- light palette (the default; also the bare-:root fallback) --- */
  --surface-page:   #FBFAFF;
  --surface-raised: #FFFFFF;
  --surface-sunken: #F1EFF9;
  --ink:            #14161A;
  --ink-muted:      #55516B;
  --line:           #E2DEF2;
  --line-strong:    #CFC8E8;
  --line-control:   #767085;   /* interactive control boundaries, 3:1+ (WCAG 1.4.11) */

  --accent:     #5B3FD6;   /* links + active state          */
  --accent-on:  #F5F6F8;   /* text on an --accent fill      */
  --action:     #5B3FD6;   /* primary button fill, both themes */
  --action-on:  #F5F6F8;
  --signal:     #B8FF3C;   /* FILL ONLY, both themes        */
  --signal-on:  #14161A;
  --danger:     #B3261E;
  --danger-on:  #FFFFFF;   /* text/icon colour on a --danger fill */
  /* Elevation. Two levels, and DELIBERATELY asymmetric between themes.
     In light, --surface-raised (#FFFFFF) against --surface-page (#FBFAFF) is
     1.04:1 -- visually identical -- so a card floats on a ground it cannot be
     told apart from, and shadow is what actually conveys lift. In dark that
     same pair is 1.13:1, a real step, so surface lightness already does the job
     and the shadows stay far subtler (they barely read on a dark ground).
     Tinted with the indigo hue, not neutral black: the greys here are
     violet-shifted, so a pure-black shadow reads as foreign. */
  --elev-1: 0 1px 2px rgba(91, 63, 214, .06), 0 2px 8px -2px rgba(91, 63, 214, .10);
  --elev-2: 0 2px 4px rgba(91, 63, 214, .08), 0 12px 24px -8px rgba(91, 63, 214, .18);

  /* --- scales --- */
  --space-1: .25rem; --space-2: .5rem;  --space-3: .75rem; --space-4: 1rem;
  --space-5: 1.5rem; --space-6: 2rem;   --space-7: 3rem;   --space-8: 4rem;
  --radius-sm: .35rem; --radius-md: .6rem; --radius-lg: .9rem;
  --measure-prose: 34rem;
  --measure-app:   72rem;
  --measure-hero:  90rem;
}

/* Default "system" viewer state: no data-theme attribute is stamped, so only
   prefers-color-scheme separates the two. Guarded so an explicit light choice
   still wins under a dark OS. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface-page:   #14161A;
    --surface-raised: #1E212A;
    --surface-sunken: #0E1014;
    --ink:            #F5F6F8;
    --ink-muted:      #A29DBA;
    --line:           #2C313D;
    --line-strong:    #3C4353;
    --line-control:   #8A83A3;
    --accent:         #B8FF3C;
    --accent-on:      #14161A;
    --danger:         #FF6B6B;
    --danger-on:      #14161A;
    --elev-1: 0 1px 2px rgba(0, 0, 0, .35);
    --elev-2: 0 2px 4px rgba(0, 0, 0, .40), 0 12px 24px -8px rgba(0, 0, 0, .55);
  }
}

/* Explicit dark choice wins even under a light OS. */
:root[data-theme="dark"] {
  --surface-page:   #14161A;
  --surface-raised: #1E212A;
  --surface-sunken: #0E1014;
  --ink:            #F5F6F8;
  --ink-muted:      #A29DBA;
  --line:           #2C313D;
  --line-strong:    #3C4353;
  --line-control:   #8A83A3;
  --accent:         #B8FF3C;
  --accent-on:      #14161A;
  --danger:         #FF6B6B;
  --danger-on:      #14161A;
  --elev-1: 0 1px 2px rgba(0, 0, 0, .35);
  --elev-2: 0 2px 4px rgba(0, 0, 0, .40), 0 12px 24px -8px rgba(0, 0, 0, .55);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--surface-page);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.55;
}
main { margin: 0 auto; padding: var(--space-7) var(--space-5) var(--space-8); width: 100%; }
main.pff-measure-prose { max-width: var(--measure-prose); }
main.pff-measure-app   { max-width: var(--measure-app); }
main.pff-measure-hero  { max-width: var(--measure-hero); }
.lede { font-size: 1.15rem; opacity: .85; max-width: 40ch; }
.pff-disclaimer {
  font-size: .8rem; color: var(--ink-muted); padding: var(--space-6) var(--space-5);
  text-align: center; border-top: 1px solid var(--line);
}

/* --- brand system ------------------------------------------------------- */
a { color: var(--accent); }
a:hover { text-decoration: underline; }
h1 span { color: var(--accent); }
label { display: block; margin: var(--space-3) 0; color: var(--ink); }
input, select, textarea {
  width: 100%; max-width: 28rem; padding: .6rem .7rem;
  background: var(--surface-raised); color: var(--ink);
  border: 1px solid var(--line-control); border-radius: var(--radius-sm); font: inherit;
}
input::placeholder, textarea::placeholder { color: var(--ink-muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
button {
  background: var(--action); color: var(--action-on); border: 0;
  border-radius: 999px; padding: .6rem 1.15rem; font: inherit; font-weight: 650;
  font-family: var(--font-display); cursor: pointer;
}
button:hover { filter: brightness(1.08); }
fieldset { border: 1px solid var(--line-control); border-radius: var(--radius-md); margin: var(--space-4) 0; }
blockquote {
  margin: var(--space-3) 0; padding: var(--space-3) var(--space-4);
  background: var(--surface-sunken); border-left: 3px solid var(--line-strong);
  border-radius: 0 var(--radius-md) var(--radius-md) 0; color: var(--ink-muted);
}
.pff-error { color: var(--danger); font-weight: 600; }
.pff-danger-zone { border: 1px solid var(--danger); border-radius: var(--radius-lg);
  padding: var(--space-4); margin: var(--space-6) 0; background: var(--surface-raised); }
.pff-danger-zone button { background: var(--danger); color: var(--danger-on); }
.pff-tag { display: inline-block; background: var(--surface-sunken);
  border: 1px solid var(--line-strong); border-radius: 999px;
  padding: .15rem .7rem; margin-right: .35rem; font-size: .85rem; color: var(--ink); }
/* .pff-report (the old report-queue border-left treatment) is retired by
   Task 17's .pff-queue-item -- its only user, admin/reports.html, now uses
   that class instead. */

/* --- navigation --------------------------------------------------------- */
.pff-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4); flex-wrap: wrap;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--line);
  background: var(--surface-raised);
}
.pff-brand {
  font-family: var(--font-display); font-weight: 800; font-size: 1.15rem;
  color: var(--ink); text-decoration: none; letter-spacing: -.02em;
}
.pff-brand span { color: var(--accent); }
.pff-nav nav {
  display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap;
  font-size: .95rem;
}
.pff-nav nav a { color: var(--ink-muted); text-decoration: none; }
.pff-nav nav a:hover, .pff-nav nav a:focus-visible { color: var(--accent); }
.pff-nav-controls { display: flex; align-items: center; gap: var(--space-2); }
.pff-nav-toggle {
  display: none;                      /* desktop shows every link; no disclosure */
  position: relative; align-items: center; gap: .35rem;
  background: transparent; color: var(--ink); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: .3rem .6rem; font: inherit; font-size: .95rem;
  cursor: pointer; line-height: 1;
}
.pff-nav-toggle:hover { border-color: var(--accent); color: var(--accent); }
.pff-nav-dot {
  position: absolute; top: .1rem; right: .1rem;
  width: .5rem; height: .5rem; border-radius: 50%;
  background: var(--signal); border: 1px solid var(--surface-raised);
}

@media (max-width: 640px) {
  .pff-nav { gap: var(--space-2); }
  .pff-nav-toggle { display: inline-flex; }
  .pff-nav-controls { order: 2; }
  /* Collapsed by default below 640px; the disclosure button reveals it.
     ⛔ 'pff-nav-open' is toggled by the inline script in base.html -- rename
     one and you get a dead button with no error anywhere. */
  .pff-nav nav {
    order: 3; width: 100%; display: none;
    gap: var(--space-3); font-size: .9rem;
  }
  .pff-nav nav.pff-nav-open {
    display: flex; flex-direction: column; align-items: flex-start;
    padding-top: var(--space-2);
  }
}
.pff-inline { display: inline; margin: 0; }
.pff-linkbutton {
  background: none; border: 0; padding: 0; color: var(--ink-muted);
  font: inherit; font-size: .95rem; cursor: pointer;
}
.pff-linkbutton:hover { color: var(--accent); }
.pff-cta { background: var(--action); color: var(--action-on) !important;
  padding: .55rem 1.1rem; border-radius: 999px; font-weight: 700; text-decoration: none; }
.pff-secondary { border: 1px solid var(--accent); color: var(--accent) !important;
  padding: .5rem 1.05rem; border-radius: 999px; text-decoration: none; background: transparent; }

/* --- landing ------------------------------------------------------------ */
.pff-hero { padding: 3rem 0 2rem; }
.pff-hero-band { margin: var(--space-6) 0 var(--space-4); max-width: 38rem; }
.pff-hero-band .pff-eyebrow { margin-top: var(--space-3); min-height: calc(2 * 1.55em); }
.pff-band-hero .pff-band-cell { height: clamp(18px, 3.6vw, 30px); border-radius: 4px; }
.pff-hero h1 span { color: var(--accent); }
.pff-actions { display: flex; gap: var(--space-3); flex-wrap: wrap;
  margin: var(--space-5) 0 var(--space-2); }
.pff-actions a { display: inline-block; }
.pff-intents-grid {
  display: grid; gap: var(--space-4); margin: var(--space-6) 0;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}
.pff-intents-grid article {
  background: var(--surface-raised); border: 1px solid var(--line);
  border-top: 3px solid var(--accent); border-radius: var(--radius-md);
  padding: var(--space-5);
}
.pff-intents-grid h2 { margin: 0 0 var(--space-1); font-size: 1.05rem; }
.pff-intents-grid p { margin: 0; color: var(--ink-muted); font-size: .95rem; }
.pff-how ol { line-height: 1.9; }

/* --- photos + safety ---------------------------------------------------- */
.pff-photo-grid { display: grid; gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); margin-top: var(--space-5); }
.pff-photo { margin: 0; background: var(--surface-raised); border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: var(--space-2); }
.pff-photo img { width: 100%; border-radius: var(--radius-sm); display: block; }
.pff-photo-placeholder { aspect-ratio: 1; display: grid; place-items: center;
  border-radius: var(--radius-sm); background: var(--surface-sunken); color: var(--ink-muted);
  font-size: .85rem; }
.pff-photo figcaption { font-size: .8rem; opacity: .75; margin: .4rem 0; }
.pff-photo form { display: inline; }
.pff-photo button { padding: .3rem .6rem; font-size: .8rem; margin-top: .3rem; }
.pff-safety-actions { display: flex; gap: .6rem; align-items: center; margin-top: 2rem; }
.pff-safety-actions form { margin: 0; }
.pff-verified { background: var(--signal); color: var(--signal-on); font-weight: 700;
  padding: .05rem .45rem; border-radius: 999px; font-size: .75rem;
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: .07em; }

.pff-profile > p,
.pff-profile > h1,
.pff-profile .pff-intents,
.pff-profile > .pff-band,
.pff-profile > .pff-band-labels { max-width: var(--measure-prose); }

/* ---- Discovery (P2) ------------------------------------------------- */
/* Palette is the violet-shifted brand: indigo #5B3FD6, lime #B8FF3C,
   charcoal #14161A. Deliberately NOT Planet Fitness purple/yellow --
   trade-dress proximity is what would strip the nominative-fair-use
   defence that protects the domain name itself. */

.pff-browse { max-width: 1100px; margin: 0 auto; padding: 0 1rem 3rem; }
.pff-browse-head h1 { margin-bottom: .25rem; }

.pff-pool-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0; }
.pff-tab {
  display: inline-block; padding: .45rem .85rem; border-radius: 999px;
  border: 1px solid var(--line); text-decoration: none; color: var(--ink);
  font-size: .92rem; background: var(--surface-raised);
}
.pff-tab:hover { border-color: var(--accent); }
.pff-tab.is-active { background: var(--action); border-color: var(--action); color: var(--action-on); }
.pff-tab.is-active .pff-fineprint { color: var(--action-on); opacity: .85; }

.pff-notice {
  background: var(--surface-sunken); border-left: 3px solid var(--accent);
  color: var(--ink); padding: var(--space-3) var(--space-4);
  border-radius: 0 var(--radius-md) var(--radius-md) 0; margin: var(--space-4) 0;
}
.pff-notice a { color: var(--accent); }

.pff-filters {
  background: var(--surface-sunken); border: 1px solid var(--line);
  border-radius: var(--radius-lg); color: var(--ink);
  padding: var(--space-4); margin: var(--space-4) 0 var(--space-5);
}
.pff-filters .pff-secondary { color: var(--accent) !important; }
.pff-filter-row { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: .75rem; }
.pff-filters label { display: flex; align-items: center; gap: .4rem; font-size: .9rem; }
.pff-filters input[type="number"] { width: 4.5rem; }
.pff-filters input, .pff-filters select {
  padding: .35rem .5rem; border: 1px solid var(--line-control);
  border-radius: var(--radius-sm); font: inherit;
  background: var(--surface-raised); color: var(--ink);
}
/* Same specificity (0,1,1) as the generic input:focus-visible rule above, and
   declared later, so without this the filters border silently wins even while
   focused. Two classes + a pseudo-class beats one class + a type, so this
   makes the focus state win deliberately instead of by accident of order. */
.pff-filters input:focus-visible, .pff-filters select:focus-visible {
  border-color: var(--accent);
}
.pff-filters .pff-check { gap: .35rem; }
.pff-filter-actions { display: flex; align-items: center; gap: .9rem; }

.pff-card-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.pff-card {
  display: block; text-decoration: none; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden;
  background: var(--surface-raised); box-shadow: var(--elev-1);
  transition: border-color .14s ease, transform .14s ease, box-shadow .14s ease;
}
.pff-card:hover { border-color: var(--accent); transform: translateY(-2px);
  box-shadow: var(--elev-2); }
.pff-card-photo { width: 100%; aspect-ratio: 4/5; object-fit: cover; display: block;
  background: var(--surface-sunken); }
.pff-card-photo.pff-photo-placeholder {
  display: flex; align-items: center; justify-content: center;
  color: var(--ink); opacity: 1; font-size: .85rem;
}
.pff-card-body { padding: .7rem .8rem .9rem; }
.pff-card-body h3 { margin: 0 0 .2rem; font-size: 1rem; }
/* Task 7 (H2): the shared @handle-under-name pattern -- profiles/show.html,
   discovery/_cards.html, discovery/viewed_me.html, messaging/inbox.html,
   messaging/thread.html, safety/report.html. Never colour-only: the '@'
   prefix carries the distinction for anyone who cannot see the tone. */
.pff-handle {
  display: block; font-size: .85rem; color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
.pff-card-headline { margin: 0 0 .35rem; font-size: .88rem; color: var(--ink-muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pff-card-meta { margin: 0 0 var(--space-2); font-size: .82rem; color: var(--ink-muted); }
.pff-card-dist { margin-left: .4rem; padding: .05rem .4rem; border-radius: 999px;
  background: var(--surface-sunken); color: var(--accent); font-size: .76rem; }

.pff-pager { display: flex; align-items: center; gap: 1rem; margin-top: 1.5rem; }
.pff-empty {
  border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); color: var(--ink);
  padding: var(--space-6) var(--space-5); text-align: center; background: var(--surface-sunken);
}
.pff-empty .pff-secondary { color: var(--accent) !important; }
.pff-badge { display: inline-block; min-width: 1.15rem; padding: 0 .3rem; border-radius: 999px;
  background: var(--signal); color: var(--signal-on); font-size: .75rem; font-weight: 700;
  text-align: center; font-variant-numeric: tabular-nums; }

/* ---- Public directory (P2) ------------------------------------------ */
.pff-directory { max-width: var(--measure-app); margin: 0 auto; padding: 0 var(--space-4) var(--space-7); }
.pff-dir-grid { display: grid; gap: var(--space-2) var(--space-5); margin: var(--space-5) 0;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.pff-dir-grid a { text-decoration: none; color: var(--accent); }
.pff-dir-grid a:hover { text-decoration: underline; }
.pff-dir-count { color: var(--ink-muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.pff-gym-card { border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface-raised); padding: var(--space-4); margin: var(--space-3) 0; }
.pff-crumbs { font-size: .85rem; color: var(--ink-muted); margin: var(--space-3) 0 0; }
.pff-crumbs a { color: var(--accent); }

/* P3c Task 6: the paid trainer card on the gym page. A visible border
   (not colour alone) distinguishes it from the plain .pff-gym-card "nearby
   locations" list -- this one is paid advertising and D52 requires it to
   read as such, never as a Planet Fitness endorsement. */
.pff-featured-trainer { border-color: var(--line-strong); }
.pff-placement-badge {
  display: inline-block; margin-bottom: var(--space-2); padding: .1rem .5rem;
  border: 1px solid var(--line-strong); border-radius: 999px;
  color: var(--ink-muted); font-size: .72rem; font-weight: 700;
  letter-spacing: .02em; text-transform: uppercase;
}

@media (max-width: 640px) {
  .pff-filter-row { gap: .6rem; }
  .pff-card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ---- Messaging (P3a) -------------------------------------------------- */
.pff-inbox { max-width: 700px; margin: 0 auto; padding: 0 1rem 3rem; }
.pff-thread-list { list-style: none; margin: 1.5rem 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.pff-thread-row {
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-raised);
}
.pff-thread-row.is-unread { border-color: var(--accent); }
.pff-thread-row a {
  display: flex; align-items: center; gap: .7rem; padding: .8rem 1rem;
  text-decoration: none; color: var(--ink); flex-wrap: wrap;
}
.pff-thread-main { display: flex; align-items: center; gap: .5rem; flex: 1; flex-wrap: wrap; }
/* display:block on .pff-handle is ignored once it is a flex ITEM (this
   container is flex) -- it sits beside the name, not beneath it, so give
   it the full row explicitly. Scoped here only; the base .pff-handle rule
   is correct everywhere else it appears (plain block-flow ancestors). */
.pff-thread-main .pff-handle { flex-basis: 100%; }
.pff-thread-name { font-weight: 600; }

.pff-thread-avatar {
  width: 2.6rem; height: 2.6rem; min-width: 2.6rem; border-radius: 50%;
  object-fit: cover; background: var(--surface-sunken); display: flex; align-items: center;
  justify-content: center; font-weight: 700; color: var(--ink); flex-shrink: 0;
}
/* Explicit tie-break: an avatar showing an initial letter (no photo) is content,
   not a muted placeholder caption, so it keeps full-strength --ink even though it
   also carries .pff-photo-placeholder (which uses --ink-muted for its own,
   different context: "No photo yet" / "In review" captions). Without this rule the
   two single-class selectors have equal specificity and whichever is declared last
   in the file wins by accident; this compound selector wins on specificity instead,
   so the choice no longer depends on file order. */
.pff-thread-avatar.pff-photo-placeholder { color: var(--ink); }

.pff-thread { max-width: 700px; margin: 0 auto; padding: 0 1rem 3rem; }
.pff-thread-head { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.5rem; }
.pff-thread-head .pff-thread-avatar { width: 3.4rem; height: 3.4rem; min-width: 3.4rem; font-size: 1.1rem; }
.pff-thread-head h1 { font-size: 1.3rem; margin: 0; }

.pff-messages { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1.5rem; }
.pff-message { background: var(--surface-sunken); color: var(--ink);
  max-width: 75%; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  align-self: flex-start; }
.pff-message.is-mine { align-self: flex-end; background: var(--action); color: var(--action-on); }
.pff-message.is-mine .pff-fineprint { color: var(--action-on); opacity: .85; }
.pff-message-body { margin: 0 0 .25rem; white-space: pre-wrap; word-break: break-word; }

.pff-compose { display: flex; flex-direction: column; gap: .5rem; max-width: 32rem; }
.pff-compose textarea { max-width: 100%; resize: vertical; }

.pff-message-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.5rem; }

/* ---- Scheduled workout sessions (Task 8) -------------------------------
   Semantic tokens only -- never --pff-indigo/--pff-lime as a `color:`, see
   the file header and tests/test_design_system.py. */
.pff-sessions {
  margin-top: var(--space-6); padding-top: var(--space-5);
  border-top: 1px solid var(--line); max-width: 32rem;
}
.pff-sessions h2 { font-size: 1.05rem; margin: 0 0 var(--space-3); }
.pff-session-list {
  list-style: none; margin: 0 0 var(--space-5); padding: 0;
  display: flex; flex-direction: column; gap: var(--space-3);
}
.pff-session {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-2) var(--space-3);
  background: var(--surface-raised); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}
/* Declined/cancelled are settled, dead-end states -- the danger border reads
   as "this did not happen", not as an active alert to act on. */
.pff-session--declined, .pff-session--cancelled { border-left-color: var(--danger); opacity: .75; }
.pff-session-when { font-weight: 650; }
.pff-session-where { color: var(--ink-muted); flex-basis: 100%; }
.pff-session-note { color: var(--danger); font-style: normal; font-size: .85rem; margin-left: .4rem; }
.pff-session-status {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .03em;
  color: var(--ink-muted); margin-left: auto;
}
.pff-session--declined .pff-session-status,
.pff-session--cancelled .pff-session-status { color: var(--danger); }
.pff-session-form {
  display: flex; flex-direction: column; gap: var(--space-2); max-width: 24rem;
  background: var(--surface-raised); border: 1px solid var(--line-control);
  border-radius: var(--radius-md); padding: var(--space-4);
}
.pff-session-hint { font-size: .8rem; color: var(--ink-muted); margin: 0; }

/* ---- Theme toggle (Task 2) --------------------------------------------- */
.pff-theme-toggle {
  background: transparent; color: var(--ink); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: .3rem .6rem; font: inherit; font-size: .95rem;
  cursor: pointer; line-height: 1;
}
.pff-theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.pff-visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- Typography (Task 3) ------------------------------------------------ */
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-var.woff2") format("woff2-variations");
  font-weight: 400 800;
  font-stretch: 62% 125%;
  font-display: swap;
}
/* Metric-matched fallback so the swap causes ZERO layout shift.
   Values computed by /root/cwv-tools/font_metrics.py -- do not hand-edit. */
@font-face {
  font-family: "Archivo Fallback";
  src: local("Arial");
  size-adjust: 106.26%;
  ascent-override: 82.63%;
  descent-override: 19.76%;
  line-gap-override: 0.00%;
}
:root {
  --font-display: "Archivo", "Archivo Fallback", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2, h3, .pff-brand, .pff-eyebrow {
  font-family: var(--font-display);
  letter-spacing: -.015em;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 6vw, 3.4rem); font-variation-settings: "wdth" 118; font-weight: 800;
     line-height: 1.03; margin: 0 0 var(--space-2); }
h2 { font-size: clamp(1.2rem, 2.6vw, 1.6rem); font-weight: 700; line-height: 1.15;
     margin: var(--space-6) 0 var(--space-2); }
h3 { font-size: 1.02rem; font-weight: 600; margin: 0 0 var(--space-1); }
.pff-eyebrow {
  font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .14em;
  color: var(--ink-muted); font-variant-numeric: tabular-nums;
}
.pff-fineprint { font-size: .85rem; color: var(--ink-muted); }

/* ---- The rhythm band (signature) -------------------------------------- */
.pff-band { display: flex; gap: 2px; width: 100%; }
.pff-band-cell { flex: 1; background: var(--line); border-radius: 2px; }
.pff-band-card .pff-band-cell { height: 6px; }
.pff-band-lg .pff-band-cell { height: 11px; border-radius: 3px; }
.pff-band-cell.is-on { background: var(--accent); }
.pff-band-cell.is-shared {
  box-shadow: 0 0 0 2px var(--surface-raised), 0 0 0 3.5px var(--ink);
}
.pff-band-labels {
  display: flex; gap: 2px; margin-top: var(--space-1);
  font-family: var(--font-display); font-size: .58rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; color: var(--ink-muted);
}
.pff-band-labels span { flex: 1; text-align: center; min-width: 0; }
.pff-band-note { font-size: .78rem; color: var(--ink-muted); margin: var(--space-2) 0 0; }
.pff-band-note b { color: var(--ink); font-weight: 650; }

.pff-band-picker { display: flex; gap: var(--space-1); flex-wrap: wrap; }
.pff-band-seg {
  font-family: var(--font-display); font-size: .72rem; font-weight: 600;
  padding: .34rem .6rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface-raised);
  color: var(--ink-muted); cursor: pointer; margin: 0;
}
.pff-band-seg:has(input:checked) {
  background: var(--accent); color: var(--accent-on); border-color: var(--accent);
}
.pff-band-seg:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.pff-filter-band { border: 0; padding: 0; margin: 0 0 var(--space-3); display: flex;
  align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.pff-filter-band legend { float: left; font-size: .9rem; color: var(--ink-muted);
  padding: 0 var(--space-2) 0 0; }

/* ---- Legal long-form typography (Task 15) ------------------------------ */
.pff-legal h2 { margin-top: var(--space-7); }
.pff-legal p, .pff-legal li { max-width: 68ch; }
.pff-legal ul, .pff-legal ol { line-height: 1.75; }

/* ---- Report-reason choice list (Task 16) -------------------------------
   Wraps the {% for %} loop of radio <label>s INSIDE the existing
   <fieldset><legend> -- never applied to the fieldset itself, since a
   fieldset with display:grid renders its legend unpredictably. */
.pff-reason-list { display: grid; gap: var(--space-2); margin: var(--space-4) 0; }
.pff-reason-list label { display: flex; gap: var(--space-3); align-items: flex-start; margin: 0;
  border: 1px solid var(--line-control); border-radius: var(--radius-md); padding: var(--space-3);
  background: var(--surface-raised); cursor: pointer; }
.pff-reason-list label:focus-within { border-color: var(--accent); }

/* ---- Error surfaces (Task 18) ------------------------------------------ */
.pff-error-page { max-width: var(--measure-prose); margin: 0 auto; }
.pff-error-page h1 { margin-bottom: var(--space-3); }

/* ---- Admin & moderation queues (Task 17) --------------------------------
   There are ZERO <table> elements anywhere under app/templates/admin/ --
   verified directly. Two shapes cover the six templates: a stat grid for
   the dashboard's four counted <li>s, and a queue of decision cards for
   reports/appeals/verifications/photos (each a <ul>/<article> list of
   pending work, filtered server-side to open/pending rows only). gym_refresh
   is untouched -- it already runs the .pff-directory/.pff-gym-card system
   shared with the public gym directory (Task "Public directory" above).

   The dashboard's four counted <li>s keep their ORIGINAL inline shape,
   <a>Label</a>: <strong>N</strong>, byte-for-byte: tests/test_appeals.py
   ::test_dashboard_links_to_appeals_and_shows_the_open_count asserts the
   literal rendered substring "Appeals pending</a>: <strong>0</strong>" (and
   ...1</strong> after a fresh appeal is filed), so the label can never move
   into a nested span and the count can never move off a bare <strong>. The
   "count gets typographic weight before the label is read" effect is
   produced by INHERITANCE instead of new wrapper elements: .pff-stat sets
   the small caption look (size/case/colour) on the <li>, which the bare <a>
   and the literal ": " text both inherit unchanged, and .pff-stat strong
   overrides size/weight/colour back up for the count. There is no
   .pff-stat-label/.pff-stat-count pair of classes -- there is nothing left
   for them to attach to without breaking that assertion, and an unused
   class is dead CSS. */
.pff-admin { max-width: var(--measure-app); margin: 0 auto; }

.pff-stat-grid { display: grid; gap: var(--space-3); list-style: none; margin: var(--space-5) 0;
  padding: 0; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
.pff-stat { position: relative; background: var(--surface-raised); border: 1px solid var(--line);
  box-shadow: var(--elev-1);
  border-radius: var(--radius-lg); padding: var(--space-4);
  font-family: var(--font-display); font-size: .7rem; text-transform: uppercase;
  letter-spacing: .1em; color: var(--ink-muted); }
/* Stretched link: the <a> wraps only the caption (tests/test_appeals.py hard-asserts
   the literal markup), so the click target is grown to the full tile with a full-bleed
   ::after instead of touching the HTML. */
.pff-stat a::after { content: ""; position: absolute; inset: 0; }
/* Resting-state link cue: inherit removed the only signal a tile was clickable at all.
   var(--accent) matches the site-wide `a` colour and the precedent already set by
   .pff-stat.is-link a below, instead of leaving the caption looking like plain text. */
.pff-stat a { color: var(--accent); text-decoration: none; }
.pff-stat a:hover, .pff-stat a:focus-visible { color: var(--accent); text-decoration: underline; }
/* The stretched ::after grows the click target but not the <a>'s own box, so the generic
   :focus-visible ring would still ring just the small caption text. Move it to the tile. */
.pff-stat a:focus-visible { outline: none; }
.pff-stat:has(a:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px;
  border-radius: var(--radius-lg); }
.pff-stat strong { display: block; margin-top: var(--space-1);
  font-family: var(--font-display); font-weight: 800; font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-variant-numeric: tabular-nums; line-height: 1.05; text-transform: none;
  letter-spacing: normal; color: var(--ink); }
.pff-stat.is-actionable strong { color: var(--accent); }
/* The fifth <li> (gym-refresh) carries no count -- it is an action link, not
   a stat, so reset it out of the tiny-caption look rather than leave an
   empty-looking tile with no number in it. */
.pff-stat.is-link { display: flex; align-items: center; font-size: 1rem;
  text-transform: none; letter-spacing: normal; color: var(--ink); }
.pff-stat.is-link a { color: var(--accent); font-weight: 650; }

/* Queues: each pending item is an <article> with its decision form(s).
   Capped narrower than the 72rem `app` measure on purpose -- a queue is
   read top to bottom, not scanned in columns (carried from Task 4's
   review); only the stat grid above spans the full measure. */
.pff-queue { display: grid; gap: var(--space-3); margin: var(--space-5) 0; max-width: 46rem; }
.pff-queue-item { background: var(--surface-raised); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: var(--radius-md);
  padding: var(--space-4); }
.pff-queue-item h2 { margin-top: 0; }
.pff-queue-actions { display: flex; gap: var(--space-2); flex-wrap: wrap;
  margin-top: var(--space-3); }
.pff-queue-actions form { margin: 0; }
/* Only reports.html has a second, discriminating status (open vs. the
   involves_a_minor "priority" queue-jumper) -- appeals/verifications/photos
   are each queried down to a single status already, so a repeated "Pending"
   chip on every card would carry no signal. is-urgent uses --danger-on, not
   a hardcoded #FFFFFF: the brief's literal white-on-danger is 2.78:1 against
   dark theme's --danger (#FF6B6B) and fails AA; --danger-on resolves to the
   correct per-theme pairing (#FFFFFF light / #14161A dark) the same way
   .pff-danger-zone button already does. */
/* The moderation decision surface. Capped so a 1600px review image cannot
   blow out the queue column, and given a sunken ground so a transparent or
   very light upload still reads as an image rather than as blank space. */
.pff-review-photo {
  display: block; max-width: 100%; height: auto; margin: var(--space-3) 0;
  border-radius: var(--radius-md); border: 1px solid var(--line);
  background: var(--surface-sunken);
}

.pff-status { display: inline-block; padding: .1rem .5rem; border-radius: 999px;
  font-size: .75rem; font-weight: 650; font-family: var(--font-display);
  margin-left: var(--space-2); vertical-align: middle; }
.pff-status.is-open { background: var(--signal); color: var(--signal-on); }
.pff-status.is-urgent { background: var(--danger); color: var(--danger-on); }
