/* ABRIPSA member portal chrome — built strictly on tokens.css.
   Layout: fixed dark sidebar (desktop) / top bar (mobile), paper content pane. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--abripsa-font-sans);
  font-size: var(--abripsa-text-sm);
  color: var(--abripsa-black);
  background: var(--abripsa-paper);
  min-height: 100vh;
}

.portal { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.portal-side {
  width: 264px; flex: 0 0 264px;
  background: var(--abripsa-black);
  color: var(--abripsa-ivory);
  display: flex; flex-direction: column;
  border-right: var(--abripsa-rule-gold);
}
.portal-side__brand {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--abripsa-charcoal);
}
.portal-side__brand img { width: 44px; height: 44px; }
.portal-side__wordmark {
  font-family: var(--abripsa-font-display);
  font-weight: 700; font-size: 19px; letter-spacing: .10em; color: var(--abripsa-white);
}
.portal-side__strap {
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--abripsa-gold-light); margin-top: 2px;
}
.portal-nav { padding: 14px 0; flex: 1; }
.portal-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px;
  color: var(--abripsa-gray-light); text-decoration: none;
  font-size: 13.5px; letter-spacing: .02em;
  border-left: 3px solid transparent;
}
.portal-nav a:hover { color: var(--abripsa-ivory); background: var(--abripsa-ink); }
.portal-nav a.is-active {
  color: var(--abripsa-gold-light);
  border-left-color: var(--abripsa-gold);
  background: var(--abripsa-ink);
}
.portal-nav__badge {
  margin-left: auto; font-size: 11px; padding: 1px 8px;
  border-radius: var(--abripsa-radius-full);
  background: var(--abripsa-charcoal); color: var(--abripsa-gold-light);
}
.portal-side__user {
  padding: 16px 20px; border-top: 1px solid var(--abripsa-charcoal);
  display: flex; align-items: center; gap: 12px;
}
.portal-side__avatar {
  width: 40px; height: 40px; border-radius: var(--abripsa-radius-full);
  background: var(--abripsa-charcoal); color: var(--abripsa-gold-light);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--abripsa-font-display); font-size: 14px; letter-spacing: .04em;
}
.portal-side__username { font-size: 13.5px; color: var(--abripsa-white); }
.portal-side__usermeta { font-size: 11.5px; color: var(--abripsa-gray-light); margin-top: 2px; }
.portal-side__signout {
  display: block; padding: 12px 20px 18px;
  color: var(--abripsa-gray-light); font-size: 12.5px; text-decoration: none;
}
.portal-side__signout:hover { color: var(--abripsa-gold-light); }
/* Sign-out posts, so the control is a <button>. These reset the browser's
   button chrome so it renders exactly as the link it replaced; the mobile
   rules at the foot of this file target the class, so they still apply. */
.portal-side__signout--button {
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  font-family: inherit; font-size: 12.5px; letter-spacing: inherit;
}

/* ---- Content pane ---- */
.portal-main { flex: 1; min-width: 0; }
.portal-head {
  background: var(--abripsa-white);
  border-bottom: var(--abripsa-rule-hairline);
  padding: 20px 32px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
}
.portal-head h1 {
  margin: 0; font-family: var(--abripsa-font-serif);
  font-size: 24px; font-weight: 600;
}
.portal-head__meta { font-size: 12.5px; color: var(--abripsa-gray); }
.portal-content { padding: 28px 32px 48px; max-width: 1080px; }

/* ---- Shared primitives (prototype idiom) ---- */
.pcard {
  background: var(--abripsa-white);
  border: var(--abripsa-rule-hairline);
  border-radius: var(--abripsa-radius-md);
  box-shadow: var(--abripsa-shadow-card);
  padding: 22px 24px;
}
.pcard--dark { background: var(--abripsa-black); color: var(--abripsa-ivory); border-color: var(--abripsa-charcoal); }
.pgrid { display: grid; gap: 18px; }
.pgrid--3 { grid-template-columns: repeat(3, 1fr); }
.pgrid--4 { grid-template-columns: repeat(4, 1fr); }
.pstat__label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--abripsa-gray); }
.pcard--dark .pstat__label { color: var(--abripsa-gray-light); }
.pstat__value { font-family: var(--abripsa-font-serif); font-size: 28px; font-weight: 600; margin-top: 6px; }
.pstat__sub { font-size: 12px; color: var(--abripsa-gray); margin-top: 4px; }
.pbadge {
  display: inline-block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  padding: 3px 10px; border-radius: var(--abripsa-radius-full);
}
.pbadge--good { background: rgba(30,107,60,.12); color: var(--abripsa-green); }
.pbadge--warn { background: rgba(201,162,39,.15); color: var(--abripsa-gold-deep); }
.pbadge--bad { background: var(--abripsa-danger-soft); color: var(--abripsa-danger); }

/* Validation / rejection copy. Replaces the ad-hoc
   `class="pstat__sub" style="color:#8B2020"` that several screens rolled
   their own version of; renders identically. */
.perror { font-size: 12px; color: var(--abripsa-danger); margin-top: 4px; }

/* Progress meter — sibling of .adm-meter on the admin side. */
.pmeter__track {
  height: 6px; border-radius: 3px; margin-top: 12px;
  background: var(--abripsa-line);
  background: color-mix(in srgb, var(--abripsa-line) 55%, var(--abripsa-white));
}
.pmeter__fill { height: 6px; border-radius: 3px; background: var(--abripsa-gold); }
.pbtn {
  display: inline-block; font-family: var(--abripsa-font-sans); font-size: 13px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; text-decoration: none; cursor: pointer;
  padding: 11px 20px; border-radius: var(--abripsa-radius-sm); border: 1px solid transparent;
}
.pbtn--primary { background: var(--abripsa-gold); color: var(--abripsa-black); }
.pbtn--primary:hover { background: var(--abripsa-gold-light); }
.pbtn--outline { border-color: var(--abripsa-gold); color: var(--abripsa-gold-deep); background: transparent; }
.pbtn--outline:hover { border-color: var(--abripsa-black); color: var(--abripsa-black); }
/* Wrapper so wide tables scroll inside their card instead of pushing the
   page sideways at 375px. Mirrors .adm-table-wrap on the admin side. */
.ptable-wrap { width: 100%; }
.ptable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ptable th {
  text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--abripsa-gray); padding: 10px 12px; border-bottom: 2px solid var(--abripsa-line);
}
.ptable td { padding: 12px; border-bottom: var(--abripsa-rule-hairline); }
/* Record table: a two-column key/value list. The key cell is a real row
   header (WCAG 1.3.1) but keeps the quiet look the screens already had. */
.ptable--record th {
  width: 220px; text-align: left; font-weight: 400; font-size: inherit;
  text-transform: none; letter-spacing: normal;
  color: var(--abripsa-gray); padding: 12px;
  border-bottom: var(--abripsa-rule-hairline);
}

/* ---- Focus visibility (WCAG 2.4.7) ----
   The admin shell rings inputs via --adm-focus-ring; the portal had no
   equivalent, so buttons, nav links and table links fell back to whatever
   the browser drew. One rule, applied to everything focusable. */
.portal a:focus-visible,
.portal button:focus-visible,
.portal input:focus-visible,
.portal select:focus-visible,
.portal textarea:focus-visible,
.pbtn:focus-visible,
.skip-link:focus-visible {
  outline: 2px solid var(--abripsa-gold);
  outline-offset: 2px;
}
.portal-side a:focus-visible,
.portal-nav a:focus-visible { outline-color: var(--abripsa-gold-light); }

/* ---- Skip link (WCAG 2.4.1) ---- */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--abripsa-gold); color: var(--abripsa-black);
  font-family: var(--abripsa-font-sans); font-size: 13px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; text-decoration: none;
  padding: 12px 20px; border-radius: var(--abripsa-radius-sm);
}
.skip-link:focus { left: 8px; top: 8px; }

/* ---- Visually hidden (labels that must not be seen) ---- */
.psr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---- Mobile ---- */
.portal-side__toggle { display: none; }
.portal-side__burger { display: none; }
@media (max-width: 900px) {
  .portal { flex-direction: column; }
  .portal-side { width: 100%; flex: none; border-right: 0; border-bottom: var(--abripsa-rule-gold); }
  .portal-side__burger {
    display: block; margin-left: auto; cursor: pointer; padding: 8px;
  }
  .portal-side__burger span {
    display: block; width: 22px; height: 2px; background: var(--abripsa-gold); margin: 5px 0;
  }
  .portal-side__brand { border-bottom: 0; }
  /* .portal-side__signout-form is the sign-out POST form. It has to be named
     here as well as the button: these are sibling selectors off the toggle
     checkbox, and once the button was wrapped in a form the button stopped
     being that sibling — leaving sign-out visible when the menu was closed. */
  .portal-nav, .portal-side__user, .portal-side__signout,
  .portal-side__signout-form { display: none; }
  .portal-side__toggle:checked ~ .portal-nav,
  .portal-side__toggle:checked ~ .portal-side__user,
  .portal-side__toggle:checked ~ .portal-side__signout-form,
  .portal-side__toggle:checked ~ .portal-side__signout { display: block; }
  .portal-side__toggle:checked ~ .portal-side__user { display: flex; }
  .portal-nav { border-top: 1px solid var(--abripsa-charcoal); }
  .pgrid--3, .pgrid--4 { grid-template-columns: 1fr; }
  .portal-head, .portal-content { padding-left: 18px; padding-right: 18px; }
  .ptable-wrap { overflow-x: auto; }
  .ptable { min-width: 560px; }
}

/* ---- W8-B: content links and the member-side form control -------------- */
/* W8-B: admin.css has `.adm-content a:not([class])` so an unstyled link in a
   card renders gold-deep; portal.css never had the sibling rule, so the same
   link on the member side fell through to the browser's blue. tokens.css
   note 3: links on light are var(--abripsa-gold-deep). Colour only — the
   underline is left as the browser draws it (WCAG 1.4.1). */
.portal-content a:not([class]) { color: var(--abripsa-gold-deep); }
.portal-content a:not([class]):hover { color: var(--abripsa-black); }

/* W8-B: the sibling of .adm-input for the member side. The library,
   mentorship and AGM screens each carried their own copy of this rule in a
   style attribute, with three different paddings and two different borders.
   Narrow fields keep an inline width, exactly as .adm-input does. */
.pinput {
  width: 100%; box-sizing: border-box;
  font-family: var(--abripsa-font-sans); font-size: 14px;
  color: var(--abripsa-black); background: var(--abripsa-white);
  border: 1px solid var(--abripsa-line); border-radius: var(--abripsa-radius-sm);
  padding: 10px 12px;
}
.pinput:focus { border-color: var(--abripsa-gold); }
