/* =========================================================
   BNI Construct — Attendance (Candid Digital)
   Design tokens carried over from the GO GREEN project so the
   two tools feel like one family.
   Mobile-first: base styles target ~360px phones.
   ========================================================= */

:root {
  --green: #1FAE5C;
  --green-dark: #13773F;
  --green-mid: #8FD9AE;
  --green-soft: #E3F5EA;
  --green-softer: #F2FAF5;

  --z-grey: #8C8C8C;
  --z-red: #CF2030;
  --z-amber: #F2A900;
  --z-green: #1FAE5C;

  --red-text: #B0172A;
  --red-bg: #FDECEE;
  --amber-text: #8A5F00;
  --amber-bg: #FFF6E3;

  --wa: #25D366;
  --wa-dark: #128C4B;

  --text: #10201A;
  --text-2: #4A5A52;
  --text-3: #7C8A83;
  --border: #E3ECE7;
  --border-2: #CFE0D6;
  --bg-soft: #F6FAF8;
  --track: #E6ECE8;

  --green-border: #A9DFC1;

  --font-h: 'Outfit', system-ui, sans-serif;
  --font-b: 'Inter', system-ui, sans-serif;

  --r-card: 18px;
  --r-tile: 14px;
  --r-pill: 99px;

  /* Elevation, tinted with the brand's dark green rather than neutral black
     so shadows sit in the same colour family as everything else. */
  --shadow-sm: 0 1px 2px rgba(16,32,26,.06);
  --shadow-md: 0 4px 10px -2px rgba(16,32,26,.10);
  --shadow-lg: 0 18px 40px -12px rgba(16,32,26,.28);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: #fff; color: var(--text);
  font-family: var(--font-b); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; border-radius: 6px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ============ Header ============ */
.app-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px);
}
.app-header__inner {
  max-width: 720px; margin: 0 auto; height: 54px; padding: 0 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.brand-mark { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; }
.brand-mark__logo { width: 28px; height: 28px; border-radius: 7px; display: block; }
.brand-mark__text { font-family: var(--font-h); font-weight: 700; font-size: 16px; }
.brand-mark__accent { color: var(--green); }
.tagline { text-align: right; line-height: 1.05; }
.tagline__main {
  font-family: var(--font-h); font-weight: 800; font-size: 18px;
  color: var(--z-red); letter-spacing: .02em;
}
.tagline__sub {
  font-size: 10.5px; font-weight: 700; color: var(--text-3);
  letter-spacing: .04em; text-transform: uppercase;
}

/* ============ Layout ============ */
@keyframes popIn {
  0%   { opacity: 0; transform: scale(.97) translateY(12px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.app-main {
  max-width: 720px; margin: 0 auto; padding: 12px 10px 24px;
  display: flex; flex-direction: column; gap: 12px;
}
.app-main--wide { max-width: 1040px; }

.card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-card);
  padding: 14px 12px;
  box-shadow: 0 1px 3px rgba(16,32,26,.05), 0 6px 16px rgba(16,32,26,.04);
  animation: popIn .6s cubic-bezier(.16,1,.3,1) backwards;
}
.card:nth-child(2) { animation-delay: .08s; }
.card:nth-child(3) { animation-delay: .16s; }
.card:nth-child(4) { animation-delay: .24s; }

.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card__title { font-family: var(--font-h); font-weight: 800; font-size: 19px; line-height: 1.2; color: var(--green-dark); }
.card__sub { color: var(--text-2); font-size: 13.5px; margin-top: 2px; }
.field-label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.muted { color: var(--text-3); }

/* ============ Meeting strip ============ */
.meeting-strip {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--text-2);
}
.meeting-strip__date { font-weight: 700; color: var(--text); }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 700; letter-spacing: .01em;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--text-2);
}
.pill--open   { background: var(--green-soft); border-color: var(--green-mid); color: var(--green-dark); }
.pill--closed { background: var(--red-bg); border-color: #F3C7CD; color: var(--red-text); }
.pill--late   { background: var(--amber-bg); border-color: #F2DDAC; color: var(--amber-text); }
.pill.is-active { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ============ Search ============ */
.search { position: relative; margin-bottom: 12px; }
.search__input {
  width: 100%; height: 46px; padding: 0 38px 0 38px;
  border: 1.5px solid var(--border-2); border-radius: var(--r-pill);
  background: var(--bg-soft); font-size: 15px;
}
.search__input::placeholder { color: var(--text-3); }
.search__input:focus { background: #fff; border-color: var(--green); outline: none; }
.search__icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--text-3); pointer-events: none;
}
.search__clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: none; background: none; cursor: pointer;
  color: var(--text-3); font-size: 20px; line-height: 1; border-radius: 50%;
}
.search__clear:hover { background: var(--border); color: var(--text); }
.search__count { font-size: 12px; color: var(--text-3); margin-top: 6px; padding-left: 4px; }

/* ============ Power team sections ============ */
/* The roster is split into power teams so a member scans eight or ten
   familiar faces instead of twenty-eight. Headings are quiet on purpose —
   they are signposts, not content; the faces stay the loudest thing here. */
.teams { display: flex; flex-direction: column; gap: 18px; }
.team[hidden] { display: none; }

.team__head {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 10px; padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-h);
  font-size: 12.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-2);
}
.team__name { min-width: 0; overflow-wrap: anywhere; }
/* Pushed to the far edge so the counts line up in a column down the page. */
.team__count {
  flex: none; margin-left: auto;
  min-width: 21px; padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--green-soft); color: var(--green-dark);
  font-family: var(--font-b);
  font-size: 11px; font-weight: 700; line-height: 19px;
  letter-spacing: 0; text-align: center;
}

/* ============ Member tile grid ============ */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}
.tiles__cell { min-width: 0; }
.tiles__cell[hidden] { display: none; }

.tile {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 100%; padding: 0; border: none; background: none;
  cursor: pointer; text-align: center; text-decoration: none;
  -webkit-user-select: none; user-select: none;
  transition: transform .15s ease;
}
.tile:active { transform: scale(.96); }
.tile[disabled] { cursor: not-allowed; opacity: .5; }
.tile[disabled]:active { transform: none; }

.tile__frame {
  position: relative; display: block; width: 100%; aspect-ratio: 1 / 1;
  border-radius: var(--r-tile); overflow: hidden;
  border: 2px solid var(--border-2); background: var(--bg-soft);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.tile:hover .tile__frame { border-color: var(--green); }
.tile:focus-visible { outline: none; }
.tile:focus-visible .tile__frame {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31,174,92,.3);
}
.tile__img { display: block; width: 100%; height: 100%; object-fit: cover; }

.tile__name {
  font-size: 12.5px; font-weight: 700; line-height: 1.25; color: var(--text);
  overflow-wrap: anywhere;
}
.tile__meta {
  font-size: 10.5px; font-weight: 600; color: var(--text-3); line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}

/* Corner badge, e.g. the time someone checked in */
.tile__badge {
  position: absolute; left: 4px; right: 4px; bottom: 4px;
  padding: 2px 4px; border-radius: 7px;
  font-size: 10px; font-weight: 700; line-height: 1.3;
  background: rgba(16,32,26,.78); color: #fff;
  backdrop-filter: blur(2px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Attendance states on the dashboard */
.tile.is-in   .tile__frame { border-color: var(--z-green); }
.tile.is-in   .tile__badge { background: var(--green-dark); }
.tile.is-late .tile__frame { border-color: var(--z-amber); }
.tile.is-late .tile__badge { background: #9A6B00; }
.tile.is-sub  .tile__frame { border-color: #1F5C8B; }
.tile.is-sub  .tile__badge { background: #1F5C8B; }
.tile.is-out  .tile__frame { border-color: var(--border); }
.tile.is-out  .tile__img   { filter: grayscale(1); opacity: .55; }

/* The face the timekeeper has picked. A filled frame rather than another ring,
   so it stays obvious next to a Green member's ring instead of competing
   with it. */
.tile.is-selected .tile__frame {
  border-color: var(--green-dark);
  box-shadow: 0 0 0 3px rgba(31,174,92,.28);
}
.tile.is-selected .tile__name { color: var(--green-dark); }
.tile.is-green.is-selected .tile__frame {
  border-color: var(--green-dark);
  box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--green-dark);
}

/* Green members get a longer speaking slot. Marked with a detached outer ring
   rather than a border colour, so the mark survives on the dashboard where the
   border is already carrying the attendance state: inner edge = present/late,
   outer ring = Green. The white gap keeps the two readable as separate rings. */
.tile.is-green .tile__frame {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--green);
}
.tile.is-green:focus-visible .tile__frame {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--green), 0 0 0 7px rgba(31,174,92,.3);
}

/* ============ Empty state ============ */
.empty {
  text-align: center; padding: 28px 16px; color: var(--text-3);
}
.empty b { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 2px; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; min-height: 46px; padding: 0 18px;
  border-radius: var(--r-pill); border: 1.5px solid var(--border-2);
  background: #fff; font-weight: 700; font-size: 15px; cursor: pointer;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--green-dark); border-color: var(--green-dark); color: #fff; box-shadow: 0 6px 16px -6px rgba(19,119,63,.55); }
.btn--primary:hover { background: #0F5F32; border-color: #0F5F32; }
.btn--outline { background: #fff; border-color: var(--border-2); color: var(--text); }
.btn--outline:hover { background: var(--bg-soft); border-color: var(--text-3); }
.btn--sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--green-dark); }
.btn--block { width: 100%; justify-content: center; }

.btn-text-link {
  background: none; border: none; padding: 6px 12px;
  color: var(--green-dark); font-size: 13px; font-weight: 700;
  cursor: pointer; border-radius: 8px; display: inline-flex; align-items: center; gap: 4px;
  transition: background-color .15s ease, color .15s ease;
}
.btn-text-link:hover, .btn-text-link:focus-visible {
  background: var(--green-soft); color: #0F5F32;
}

.starter-pin-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: 14px;
  background: #FFFBEB; border: 1.5px solid #FDE68A; color: #92400E;
  margin-bottom: 2px;
}
.starter-pin-banner__icon {
  font-size: 24px; flex-shrink: 0;
}
.starter-pin-banner__content {
  flex: 1; text-align: left;
}
.starter-pin-banner__content strong {
  display: block; font-size: 13px; font-weight: 700; color: #78350F;
}
.starter-pin-banner__content p {
  font-size: 11.5px; margin: 2px 0 0; color: #92400E; line-height: 1.3;
}

/* ============ Rules / dividers ============ */
.rule { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* ============ Venue gate banner ============ */
.gate-banner {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 13px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 600; line-height: 1.35;
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--text-2);
  animation: popIn .5s cubic-bezier(.16,1,.3,1) backwards;
}
.gate-banner[data-state="ok"]      { background: var(--green-soft); border-color: var(--green-mid); color: var(--green-dark); }
.gate-banner[data-state="pending"] { background: var(--amber-bg);   border-color: #F2DDAC;        color: var(--amber-text); }
.gate-banner[data-state="bad"]     { background: var(--red-bg);     border-color: #F3C7CD;        color: var(--red-text); }

/* Spinner while checking; becomes a status dot once resolved. */
.gate-banner__spin {
  flex: 0 0 auto; width: 15px; height: 15px; border-radius: 50%;
  border: 2.5px solid var(--border-2); border-top-color: var(--text-3);
  animation: spin .7s linear infinite;
}
.gate-banner[data-state="ok"] .gate-banner__spin,
.gate-banner[data-state="pending"] .gate-banner__spin,
.gate-banner[data-state="bad"] .gate-banner__spin {
  animation: none; border: none; width: 9px; height: 9px; margin: 0 3px;
  background: currentColor;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .gate-banner__spin { animation: none !important; }
}

/* ============ Blocked / explain screens ============ */
.gate-card { text-align: center; padding: 26px 18px 20px; }
.gate-card__icon {
  width: 54px; height: 54px; margin: 0 auto 12px;
  display: grid; place-items: center; border-radius: 16px;
}
.gate-card__icon svg { width: 28px; height: 28px; }
.gate-card__icon.is-info { background: var(--green-soft); color: var(--green-dark); }
.gate-card__icon.is-bad  { background: var(--red-bg);     color: var(--red-text); }
.gate-card__body {
  color: var(--text-2); font-size: 14px; line-height: 1.55;
  margin: 6px auto 0; max-width: 34ch;
}

/* ============ Screen code entry ============ */
.code-row { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.code-input {
  flex: 1; min-width: 0; height: 54px; text-align: center;
  font-family: var(--font-h); font-size: 26px; font-weight: 700;
  letter-spacing: .35em; text-indent: .35em;
  border: 1.5px solid var(--border-2); border-radius: 14px; background: var(--bg-soft);
  font-variant-numeric: tabular-nums;
}
.code-input:focus { border-color: var(--green); background: #fff; outline: none; }

/* ============ Status tags ============ */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
  border: 1px solid transparent;
}
.tag--good { background: var(--green-soft); border-color: var(--green-mid); color: var(--green-dark); }
.tag--warn { background: var(--amber-bg);   border-color: #F2DDAC;        color: var(--amber-text); }
.tag--bad  { background: var(--red-bg);     border-color: #F3C7CD;        color: var(--red-text); }
.tag--info { background: #E6EDF5;           border-color: #C9DAEA;        color: #1F5C8B; }

/* ============ Notes & small print ============ */
.note {
  padding: 9px 11px; border-radius: 12px; font-size: 13px;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--text-2);
  margin: 10px 0;
}
.note--warn { background: var(--amber-bg); border-color: #F2DDAC; color: var(--amber-text); }
.note--bad  { background: var(--red-bg);   border-color: #F3C7CD; color: var(--red-text); }
.note--good { background: var(--green-soft); border-color: var(--green-mid); color: var(--green-dark); }
.footnote { font-size: 11.5px; color: var(--text-3); margin-top: 10px; line-height: 1.5; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

/* ============ Dev: rules preview ============ */
.rules-form {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  padding: 12px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--bg-soft); margin-bottom: 12px;
}
.rules-form__field { display: flex; flex-direction: column; }
.rules-form input {
  height: 40px; padding: 0 10px; border: 1.5px solid var(--border-2);
  border-radius: 10px; background: #fff;
}
.rules-form input:focus { border-color: var(--green); outline: none; }
.rules-summary {
  font-size: 13.5px; color: var(--text-2); line-height: 1.6;
  padding: 10px 12px; border-radius: 12px;
  background: var(--green-softer); border: 1px solid var(--border-2);
}

.rules-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rules-table th {
  text-align: left; padding: 7px 8px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; color: var(--text-3);
  border-bottom: 1px solid var(--border-2); white-space: nowrap;
}
.rules-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.rules-table tr.is-edge td { background: var(--green-softer); font-weight: 600; }
.rules-table tr:last-child td { border-bottom: none; }
.rules-table small { font-size: 10.5px; margin-left: 4px; }

/* ============ Footer ============ */
.app-footer {
  border-top: 1px solid var(--border); margin-top: 8px;
  padding: 16px 14px calc(18px + env(safe-area-inset-bottom, 0px));
  text-align: center; color: var(--text-3); font-size: 12px;
}
.app-footer__logos { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.app-footer__sep { width: 1px; height: 22px; background: var(--border); display: inline-block; }
.footer-logo { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.footer-logo__img { width: 26px; height: 26px; border-radius: 6px; }
.footer-logo__img--app { width: 24px; height: 24px; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,0.14); object-fit: cover; }
.footer-logo__text { font-family: var(--font-h); font-weight: 700; font-size: 14px; color: var(--text); }
.footer-logo__accent { color: var(--green); }
.bni-logo-svg { width: 76px; height: 40px; }
.footer-shortcut-cta { margin: 8px 0 10px; display: flex; justify-content: center; }
.btn-footer-shortcut {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 15px; border-radius: var(--r-pill);
  background: #FFFFFF; border: 1.5px solid var(--border-2);
  color: var(--text); font-family: var(--font-b); font-size: 12.5px; font-weight: 600;
  cursor: pointer; min-height: 44px; transition: all .18s ease;
  box-shadow: var(--shadow-sm);
  text-decoration: none;   /* it is a link to the hub in the attendance app */
}
.btn-footer-shortcut:hover {
  background: var(--bg-soft); border-color: #CF2030; color: #CF2030;
  transform: translateY(-1px); box-shadow: var(--shadow-md);
  text-decoration: none;
}
.btn-footer-shortcut:active { transform: scale(0.98); }
.btn-footer-shortcut.is-installed {
  background: var(--green-soft); border-color: var(--green-border); color: var(--green-dark);
  cursor: default; pointer-events: none;
}
.footer-shortcut-icon { width: 18px; height: 18px; border-radius: 4px; flex-shrink: 0; }
.app-footer__credit { margin-top: 4px; }
.app-footer .heart { color: var(--z-red); }

/* ============ Screen view transitions ============ */
.screen-view[hidden] { display: none !important; }

/* ============ Screen 2: Keypad ============ */
.keypad-card {
  padding: 16px 14px 20px;
  animation: popIn .45s cubic-bezier(.16,1,.3,1) backwards;
}
.keypad-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 12px;
}
.btn-back {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: var(--r-pill);
  background: var(--bg-soft); border: 1.5px solid var(--border-2);
  font-size: 13px; font-weight: 700; color: var(--text-2);
  cursor: pointer; min-height: 44px; transition: background .15s ease;
}
.btn-back:hover { background: #fff; color: var(--text); border-color: var(--green); }
.btn-back:active { transform: scale(.97); }

.keypad-profile {
  text-align: center; margin-bottom: 16px;
}
.keypad-profile__avatar {
  width: 72px; height: 72px; margin: 0 auto 10px;
  border-radius: 50%; overflow: hidden;
  border: 3px solid var(--green); background: var(--bg-soft);
  box-shadow: 0 4px 14px rgba(19,119,63,.18);
}
.keypad-profile__avatar img,
.keypad-profile__avatar svg {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.keypad-profile__name {
  font-family: var(--font-h); font-weight: 800; font-size: 21px; line-height: 1.2;
  color: var(--text);
}
.keypad-profile__meta {
  font-size: 13px; font-weight: 600; color: var(--text-3); margin-top: 2px;
}
.keypad-prompt {
  font-size: 14px; font-weight: 700; color: var(--green-dark);
  margin-top: 10px; min-height: 20px;
}

/* 4 PIN Bubbles */
.pin-bubbles {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin: 12px 0 16px; min-height: 28px;
}
.pin-bubble {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border-2); background: var(--bg-soft);
  transition: transform .15s cubic-bezier(.175, .885, .32, 1.275), background-color .15s ease, border-color .15s ease;
}
.pin-bubble.is-filled {
  background: var(--green-dark); border-color: var(--green-dark);
  transform: scale(1.18);
  box-shadow: 0 0 0 3px rgba(31,174,92,.25);
}
.pin-bubbles.is-shaking {
  animation: shake .4s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes shake {
  10%, 90% { transform: translateX(-3px); }
  20%, 80% { transform: translateX(5px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

.pin-feedback {
  max-width: 320px; margin: 0 auto 12px;
  padding: 8px 12px; border-radius: 12px;
  font-size: 13px; font-weight: 600; line-height: 1.35; text-align: center;
}
.pin-feedback.is-error {
  background: var(--red-bg); border: 1px solid #F3C7CD; color: var(--red-text);
}
.pin-feedback.is-warn {
  background: var(--amber-bg); border: 1px solid #F2DDAC; color: var(--amber-text);
}
.pin-feedback.is-info {
  background: var(--green-soft); border: 1px solid var(--green-mid); color: var(--green-dark);
}

/* Numeric Keypad Grid: targets >= 44px */
.keypad {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; max-width: 320px; margin: 0 auto;
}
.keypad__btn {
  display: flex; align-items: center; justify-content: center;
  min-height: 56px; /* target >= 44px */
  border-radius: 16px; border: 1.5px solid var(--border-2);
  background: var(--bg-soft); color: var(--text);
  font-family: var(--font-h); font-size: 25px; font-weight: 700;
  cursor: pointer; user-select: none; -webkit-user-select: none;
  transition: transform .1s ease, background-color .12s ease, border-color .12s ease;
}
.keypad__btn:active {
  transform: scale(.93); background: var(--green-soft); border-color: var(--green);
}
.keypad__btn:focus-visible {
  outline: 3px solid var(--green); outline-offset: 2px;
}
.keypad__btn--action {
  font-size: 17px; font-weight: 800; color: var(--text-2); background: #fff;
}
.keypad__btn--action:active {
  background: var(--border);
}
.keypad-footer {
  margin-top: 14px;
}

/* ============ Screen 3: Confirmation ============ */
.confirm-card {
  display: flex; flex-direction: column; gap: 14px;
  animation: popIn .5s cubic-bezier(.16,1,.3,1) backwards;
}
.confirm-hero {
  text-align: center; padding: 22px 14px 18px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: 0 4px 18px rgba(16,32,26,.05);
}
.confirm-hero__icon {
  width: 68px; height: 68px; margin: 0 auto 12px;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--green-soft); color: var(--green-dark);
  box-shadow: 0 8px 24px rgba(31,174,92,.25);
  animation: popIn .6s cubic-bezier(.175, .885, .32, 1.275);
}
.confirm-hero__icon.is-late {
  background: var(--amber-bg); color: var(--amber-text);
  box-shadow: 0 8px 24px rgba(242,169,0,.25);
}
.confirm-hero__title {
  font-family: var(--font-h); font-weight: 800; font-size: 26px; line-height: 1.2;
  color: var(--green-dark);
}
.confirm-hero__sub {
  font-size: 16px; font-weight: 600; color: var(--text-2); margin-top: 4px;
}
.confirm-badges {
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
  margin-top: 10px;
}

/* 6-Month Record Card */
.record-card {
  padding: 16px 14px;
}
.record-card__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  margin-bottom: 12px;
}
.record-card__title {
  font-family: var(--font-h); font-weight: 800; font-size: 17px; line-height: 1.2;
  color: var(--text);
}
.record-stats {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  margin-bottom: 14px;
}
@media (min-width: 480px) {
  .record-stats { grid-template-columns: repeat(4, 1fr); }
}
.record-stat {
  padding: 10px 8px; border-radius: 14px;
  background: var(--bg-soft); border: 1px solid var(--border);
  text-align: center;
}
.record-stat--primary {
  background: var(--green-softer); border-color: var(--green-mid);
}
.record-stat__value {
  display: block; font-family: var(--font-h); font-size: 22px; font-weight: 800;
  line-height: 1.1; color: var(--text);
}
.record-stat--primary .record-stat__value { color: var(--green-dark); }
.record-stat__label {
  display: block; font-size: 11px; font-weight: 700; color: var(--text-3);
  margin-top: 4px; text-transform: uppercase; letter-spacing: .02em;
}

/* History Dots */
.record-history__title {
  font-size: 12.5px; font-weight: 700; color: var(--text-2); margin-bottom: 8px;
}
.history-dots {
  display: flex; align-items: center; gap: 6px; overflow-x: auto;
  padding-bottom: 4px;
}
.history-dot {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 8px; border-radius: 10px; border: 1px solid var(--border);
  background: #fff; font-size: 11px; min-width: 64px; text-align: center;
}
.history-dot__badge {
  width: 9px; height: 9px; border-radius: 50%; display: inline-block;
}
.history-dot__date { font-weight: 700; color: var(--text-2); }
.history-dot__status { font-size: 10px; color: var(--text-3); font-weight: 600; }

/* Auto-reset progress bar */
.confirm-timer {
  text-align: center; margin: 4px 0;
}
.timer-bar {
  height: 4px; width: 100%; background: var(--border);
  border-radius: var(--r-pill); overflow: hidden; margin-bottom: 6px;
}
.timer-bar__fill {
  height: 100%; width: 100%; background: var(--green);
  transition: width 1s linear;
}
.timer-text {
  font-size: 12.5px; font-weight: 600; color: var(--text-3);
}

/* Offline banner */
.offline-banner {
  background: var(--amber-bg); border-color: #F2DDAC; color: var(--amber-text);
}

/* ============ Larger screens ============ */
@media (min-width: 560px) {
  .card { padding: 18px 16px; }
  .tiles { gap: 12px; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); }
  .card__title { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ============ BNI Attendance PWA & Shortcut UI ============ */
.bni-pwa-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(207, 32, 48, 0.16);
  box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.12);
  transform: translateY(115%);
  transition: transform .36s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
.bni-pwa-banner.is-visible {
  transform: translateY(0);
  pointer-events: auto;
}
.bni-pwa-banner__inner {
  max-width: 540px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap;
}
.bni-pwa-content {
  display: flex; align-items: center; gap: 12px; flex: 1 1 240px;
}
.bni-pwa-icon {
  width: 46px; height: 46px; border-radius: 11px; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(207, 32, 48, 0.22);
}
.bni-pwa-text { text-align: left; }
.bni-pwa-title {
  font-family: var(--font-h); font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.2;
}
.bni-pwa-desc {
  font-size: 12px; color: var(--text-2); line-height: 1.35; margin-top: 2px;
}
.bni-pwa-actions {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.bni-pwa-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 15px; border-radius: var(--r-pill);
  font-family: var(--font-b); font-size: 13px; font-weight: 700;
  cursor: pointer; min-height: 44px; transition: all .16s ease;
  border: none;
}
.bni-pwa-btn--add {
  background: linear-gradient(135deg, #DE162A 0%, #A00C1F 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(222, 22, 42, 0.32);
}
.bni-pwa-btn--add:hover {
  background: linear-gradient(135deg, #EB1C31 0%, #B20E23 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(222, 22, 42, 0.42);
}
.bni-pwa-btn--add:active { transform: scale(0.97); }
.bni-pwa-btn--dismiss {
  background: transparent; color: var(--text-3); border: 1px solid transparent;
}
.bni-pwa-btn--dismiss:hover {
  background: var(--bg-soft); color: var(--text); border-color: var(--border);
}

/* iOS & Generic Modal Guide */
.bni-pwa-modal-backdrop {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(15, 23, 42, 0.65); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.bni-pwa-modal-backdrop.is-open {
  opacity: 1; pointer-events: auto;
}
.bni-pwa-modal {
  background: #FFFFFF; border-radius: var(--r-card); width: 100%; max-width: 410px;
  box-shadow: var(--shadow-lg); overflow: hidden;
  transform: scale(0.94); transition: transform .25s cubic-bezier(0.16, 1, 0.3, 1);
}
.bni-pwa-modal-backdrop.is-open .bni-pwa-modal {
  transform: scale(1);
}
.bni-pwa-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.bni-pwa-modal-title {
  font-family: var(--font-h); font-size: 17px; font-weight: 700; color: var(--text); margin: 0;
}
.bni-pwa-modal-sub {
  font-size: 12px; color: var(--text-3); margin: 2px 0 0;
}
.bni-pwa-modal-close {
  background: var(--bg-soft); border: none; width: 34px; height: 34px; border-radius: 50%;
  font-size: 15px; color: var(--text-2); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.bni-pwa-modal-close:hover { background: var(--border); color: var(--text); }
.bni-pwa-modal-body { padding: 18px; }
.bni-pwa-guide-intro {
  font-size: 13.5px; color: var(--text-2); margin-bottom: 14px; line-height: 1.4;
}
.bni-pwa-step {
  display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px;
}
.bni-pwa-step-num {
  width: 24px; height: 24px; border-radius: 50%;
  background: #CF2030; color: #FFFFFF;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px;
}
.bni-pwa-step-desc {
  font-size: 13px; color: var(--text); line-height: 1.45;
}
.bni-pwa-inline-icon {
  display: inline-flex; vertical-align: middle; padding: 2px 4px;
  background: var(--bg-soft); border-radius: 4px; margin: 0 2px;
}
.bni-pwa-modal-foot {
  padding: 12px 18px 16px; border-top: 1px solid var(--border); background: var(--bg-soft);
}

/* =========================================================
   Member Portal & Asks & Gives Chapter Hub
   ========================================================= */

.portal-profile-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  gap: 12px;
}
.portal-profile-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.portal-profile-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--green);
  background: var(--green-soft);
}
.portal-profile-avatar img,
.portal-profile-avatar .tile__initials {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
}
.portal-profile-name {
  font-family: var(--font-h);
  font-weight: 700;
  font-size: 15.5px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.portal-profile-meta {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.portal-logout-btn {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--red-text);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.portal-logout-btn:hover {
  background: var(--red-bg);
  border-color: var(--red-text);
}

/* Attendance Status Card */
.portal-meeting-card {
  background: linear-gradient(135deg, #F2FAF5 0%, #FFFFFF 100%);
  border: 1px solid var(--green-mid);
  border-radius: var(--r-card);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 14px rgba(31, 174, 92, 0.08);
}
.portal-meeting-status-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.portal-status-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--green-soft);
  color: var(--green-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.portal-status-icon-wrap.is-late {
  background: var(--amber-bg);
  color: var(--amber-text);
}
/* Signed in, not yet marked present. Deliberately neutral rather than amber:
   amber already means "marked late", and the two must not look alike. */
.portal-status-icon-wrap.is-pending {
  background: var(--bg-soft);
  color: var(--text-3);
  border: 1px solid var(--border-2);
}
.portal-meeting-info {
  flex: 1;
  min-width: 0;
}
.portal-meeting-info h2 {
  font-family: var(--font-h);
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 2px;
}
.portal-meeting-info p {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.4;
}

.portal-meeting-meta-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.meeting-meta-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  gap: 8px;
}
.meeting-meta-item .meta-label {
  color: var(--text-3);
  font-weight: 500;
}
.meeting-meta-item .meta-val {
  font-weight: 700;
  color: var(--text);
  text-align: right;
}

/* Not-yet-checked-in prompt inside the portal card. Amber rather than red:
   nothing has gone wrong, there is simply one more tap to make — and on most
   Fridays that tap is the only thing standing between the member and being
   marked present. */
.portal-checkin {
  background: var(--amber-bg);
  border: 1px solid #F2DDAC;
  border-radius: 12px;
  padding: 12px 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.portal-checkin__msg {
  font-size: 13px;
  line-height: 1.45;
  color: var(--amber-text);
  font-weight: 600;
}
/* The button sits on an amber field, so it needs its own footing. */
.portal-checkin .btn { width: 100%; }

/* Meeting-day reminder opt-in. Neutral rather than amber: it is an offer,
   not something the member still has to do. Sits below the check-in row. */
.portal-reminders {
  background: var(--bg-soft);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  padding: 12px 13px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.portal-reminders__msg {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-2);
}
.portal-reminders .btn { width: 100%; min-height: 44px; }

/* Portal Tabs */
.portal-tabs {
  display: flex;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.portal-tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 8px;
  border-radius: 9px;
  font-family: var(--font-h);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.portal-tab-btn.is-active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* Week Selector Pills */
.ag-week-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.ag-week-pill {
  flex: 1;
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.ag-week-pill.is-selected {
  border-color: var(--green);
  background: var(--green-softer);
  color: var(--green-dark);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(31,174,92,0.12);
}

/* Form Fields */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.field__label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.field__input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  border: 1.5px solid var(--border-2);
  border-radius: 11px;
  background: #fff;
  font-size: 14.5px;
  color: var(--text);
  font-family: var(--font-b);
  transition: border-color .15s ease, box-shadow .15s ease;
  line-height: 1.4;
}
.field__input:focus {
  border-color: var(--green);
  outline: none;
  box-shadow: 0 0 0 3px rgba(31, 174, 92, 0.15);
  background: #fff;
}
.field__input::placeholder {
  color: var(--text-3);
  font-size: 13.5px;
}
textarea.field__input {
  min-height: 58px;
  resize: vertical;
}

/* Unified Ask & Give Sections */
.ag-unified-card {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px 14px 16px;
  margin-bottom: 14px;
  transition: border-color 0.2s;
}
.ag-unified-card--give {
  border-top: 3.5px solid var(--green);
  background: linear-gradient(180deg, #F4FBF7 0%, #FFFFFF 34px);
}
.ag-unified-card--ask {
  border-top: 3.5px solid #6366F1;
  background: linear-gradient(180deg, #F4F6FE 0%, #FFFFFF 34px);
}
.ag-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.ag-section-header__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-h);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
/* Says in the heading what the form has always allowed: either half on its
   own is a valid submission. */
.ag-section-optional {
  font-family: var(--font-b);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-3);
  border: 1px solid var(--border-2);
  border-radius: var(--r-pill);
  padding: 1px 7px;
}

.ag-section-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2.5px 8px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}
.ag-section-badge--give {
  background: var(--green-soft);
  color: var(--green-dark);
}
.ag-section-badge--ask {
  background: #EEF2FF;
  color: #4338CA;
}

/* Duplicate Give Warning Banner */
.ag-duplicate-banner {
  background: #FFFBEB;
  border: 1.5px solid #F59E0B;
  color: #92400E;
  padding: 12px 14px;
  border-radius: 12px;
  margin-top: 10px;
  margin-bottom: 4px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.45;
  animation: popIn 0.25s ease-out;
}
.ag-duplicate-banner svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: #D97706;
}
[hidden],
.ag-duplicate-banner[hidden] {
  display: none !important;
}

/* Feed Cards */
.ag-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
  transition: border-color 0.2s;
}
.ag-card:hover {
  border-color: var(--border-2);
}

/* ============ Asks & Gives: compact feed list ============
   One hairline-separated list rather than a stack of cards. The chapter feed
   is something members skim for a name they recognise, so the job here is to
   fit as many legible entries on a phone screen as possible — the old cards
   managed about four. Give and Ask are told apart by the coloured left edge,
   which survives at a glance while scrolling. */
.agf-list {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.agf {
  padding: 10px 12px 10px 11px;
  border-left: 3px solid var(--border-2);
}
.agf + .agf { border-top: 1px solid var(--border); }
.agf--give { border-left-color: var(--green); }
.agf--ask  { border-left-color: #6366F1; }

/* Baseline alignment, so the tag and the date sit on the same line as the
   first line of a contact name that wraps. */
.agf__top { display: flex; align-items: baseline; gap: 7px; }

.agf__tag {
  flex: none;
  font-size: 10px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 6px; border-radius: 5px;
}
.agf--give .agf__tag { background: var(--green-soft); color: var(--green-dark); }
.agf--ask  .agf__tag { background: #EEF2FF; color: #4338CA; }

.agf__title {
  flex: 1 1 auto; min-width: 0;
  font-family: var(--font-b);
  font-size: 13.5px; font-weight: 700; line-height: 1.35;
  color: var(--text);
  overflow-wrap: anywhere;
}
/* The company rides along after the contact name instead of claiming a line. */
.agf__co { font-weight: 500; color: var(--text-2); }

.agf__date {
  flex: none;
  font-size: 10.5px; font-weight: 600; color: var(--text-3);
  white-space: nowrap;
}

.agf__by {
  margin-top: 2px;
  font-size: 11.5px; line-height: 1.4; color: var(--text-3);
}
.agf__to { color: var(--green-dark); font-weight: 700; margin-left: 6px; }

/* Two lines is enough to judge whether an entry is worth following up; a
   member's own full text is in My History. */
.agf__note {
  margin-top: 3px;
  font-size: 12px; line-height: 1.4; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Rows the member owns, in My History, carry a delete control. It is pulled
   out of the text flow and centred in the right margin: inline it would either
   add a line to every row or be a 28px-tall tap target, and neither is
   acceptable. 44px square meets the touch minimum without changing the row
   height the rest of the list uses. */
.agf--own { position: relative; padding-right: 52px; }
.agf__del {
  position: absolute; top: 50%; right: 4px; transform: translateY(-50%);
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: none; cursor: pointer;
  color: var(--text-3); border-radius: 50%;
  transition: background .15s ease, color .15s ease;
}
.agf__del:hover { background: var(--red-bg); color: var(--red-text); }
.agf__del:focus-visible {
  outline: none; color: var(--red-text);
  box-shadow: 0 0 0 2px var(--red-text);
}
.ag-badge--give {
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 700;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ag-badge--ask {
  background: #EEF2FF;
  color: #4338CA;
  font-weight: 700;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Modals */
.app-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.app-modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}
.app-modal {
  background: #fff;
  width: 100%;
  max-width: 440px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0,0,0,0.2);
  transform: translateY(12px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.app-modal-backdrop.is-open .app-modal {
  transform: translateY(0) scale(1);
}
.app-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.app-modal-title {
  font-family: var(--font-h);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.app-modal-close {
  background: var(--bg-soft);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.app-modal-body {
  padding: 18px;
}
.app-modal-foot {
  padding: 12px 18px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}


/* ===================================================================
   Timekeeper — the presentation timer (timekeeper.php)

   Designed to be read at a glance from arm's length while standing, so the
   digits are the largest thing on the page by a wide margin and the controls
   are big enough to hit without looking.
   =================================================================== */

/* 10px rather than 14px: on a phone this is the difference between the slot
   length card peeking above the fold and sitting fully inside it. Small on
   its own, but it is one of several deliberate trims (see .tk__card--strip,
   the clock's font clamp, and the merged note below the presets) made so the
   whole screen — roster strip, clock, and controls — fits without scrolling
   on an ordinary phone, which was the point of dropping the collapsing
   picker in the first place. */
.tk { display: flex; flex-direction: column; gap: 10px; }

.tk__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tk__card { padding: 14px 16px; }

/* Speaker strip.
 *
 * This used to be a grid that collapsed once someone was picked, so choosing
 * the NEXT speaker meant reopening it — the roster and the clock were never
 * both usable at the same time. A single thumb-scrollable row fixes that by
 * construction: it has a fixed, short height, so it never has to hide itself
 * to make room for the clock below it. Picking someone is a tap sideways
 * through faces, not a trip to another state of the page. */
.tk__card--strip { padding: 10px 10px 12px; }
.tk__card--strip .search { margin-bottom: 8px; }

.tk-strip {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  gap: 10px;
  /* Side and top padding is real space, not decoration: the Green ring and
     the focus ring both sit outside the tile frame, and without this they get
     clipped by the scroll container the instant a tile touches the edge. */
  padding: 4px 4px 6px;
  margin: 0 -4px;
}
.tk-strip .tiles__cell {
  flex: 0 0 60px;
  scroll-snap-align: start;
}
/* Smaller than the check-in grid's tile — this is a row to scan sideways with
   a thumb, not a grid to scan line by line, and there are 28 of these. */
.tk-strip .tile__name { font-size: 10.5px; line-height: 1.15; }
.tk-strip .tile__meta { display: none; }
/* The slot length as a corner chip rather than the full-width bar the
   dashboard uses for check-in times — at this size the bar would cover half
   the face, and a timekeeper picks people by face, not by reading a label. */
.tk-strip .tile__badge {
  left: auto; right: 2px; bottom: 2px;
  padding: 1px 4px; border-radius: 5px; font-size: 9px;
}

/* Speaker roster, grouped by team.
 *
 * Replaces the flat strip above with the same grouped grid the check-in page
 * uses — a member is found among their own eight-to-ten-person team, not
 * scanned for across all twenty-eight. The thing the strip got right still
 * has to hold: picking someone must never make the roster disappear, and the
 * clock below it must never need the page scrolled to reach. Solved here by
 * giving the grid its own short, independently-scrolling panel instead of
 * the page itself growing to fit it — the panel scrolls, the page does not. */
.tk__card--teams { padding: 10px 10px 12px; }
.tk__card--teams .search { margin-bottom: 8px; }

.tk__roster {
  max-height: 38vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.tk__roster .teams { gap: 14px; }
.tk__roster .team__head { margin: 0 0 8px; padding-bottom: 5px; }
/* Smaller than the check-in grid's tile — team sections here are a shorter,
   scrollable panel rather than the whole page, so each face gets less room. */
.tk__roster .tiles { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.tk__roster .tile__name { font-size: 10.5px; line-height: 1.15; }
.tk__roster .tile__meta { display: none; }
/* The slot length as a corner chip, same reasoning as the strip's version:
   at this tile size a full-width bar would cover half the face. */
.tk__roster .tile__badge {
  left: auto; right: 2px; bottom: 2px;
  padding: 1px 4px; border-radius: 5px; font-size: 9px;
}

.tk__clock-card {
  padding: 16px 16px 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tk__speaker {
  font-family: var(--font-h);
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  min-height: 24px;          /* reserved, so selecting a speaker does not
                                shift the clock down the page */
  margin: 0;
}

.tk__clock {
  font-family: var(--font-h);
  font-weight: 800;
  /* Scales with the viewport but clamped: unreadable on a small phone is as
     bad as absurd on a desktop. */
  font-size: clamp(56px, 19vw, 132px);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--text);
  /* Tabular figures keep the digits from jiggling as the numbers change,
     which is distracting on something you stare at. */
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  padding: 6px 0;
  border-radius: var(--r-card);
  transition: color .18s ease, background-color .18s ease;
}

/* Final seconds. */
.tk__clock.is-warn { color: var(--amber-text); background: var(--amber-bg); }

/* Over time. */
.tk__clock.is-over { color: var(--red-text); background: var(--red-bg); }

/* Alarm flash, toggled by the script. Also the fallback signal when audio is
   unavailable, so it has to be unmissable on its own. */
.tk__clock.is-alarm {
  color: #fff !important;
  background: #DC2626 !important;
  box-shadow: 0 0 35px rgba(220, 38, 38, 0.85);
  transform: scale(1.02);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.tk__progress {
  height: 8px;
  background: var(--border);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.tk__progress-fill {
  height: 100%;
  width: 0;
  background: var(--green);
  border-radius: var(--r-pill);
  transition: width .1s linear;
}

.tk__state {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: .01em;
}

.tk__controls {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
}
.tk__controls--secondary {
  grid-template-columns: 1fr 1fr;
  margin-top: 2px;
}

.tk__btn-primary,
.tk__btn {
  min-height: 56px;          /* well above the 44pt minimum: this gets pressed
                                in a hurry, sometimes without looking */
  font-size: 16px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Pause reads differently from Start, so the button does not look identical
   in two opposite states. */
.tk__btn-primary.is-running {
  background: var(--amber-bg);
  color: var(--amber-text);
  border-color: #E8C87A;
}
.tk__btn-primary.is-running svg { display: none; }

.tk__presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tk__preset {
  flex: 1 1 auto;
  min-width: 68px;
  min-height: 46px;
  border: 1.5px solid var(--border-2);
  background: #fff;
  color: var(--text-2);
  border-radius: var(--r-tile);
  font-family: var(--font-h);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.tk__preset:hover { background: var(--bg-soft); }
.tk__preset.is-active {
  background: var(--green-soft);
  border-color: var(--green-border);
  color: var(--green-dark);
}

/* Landscape on a phone: the clock would otherwise push the controls off
   screen, and the timekeeper needs both visible at once. */
@media (max-height: 520px) and (orientation: landscape) {
  .tk__clock { font-size: clamp(44px, 13vh, 72px); padding: 2px 0; }
  .tk__clock-card { padding: 12px; gap: 8px; }
  .tk__btn-primary, .tk__btn { min-height: 46px; }
  .tk__card { padding: 12px; }
}

/* Someone who has asked for less motion should not get a flashing screen;
   the colour change alone still carries "time is up". */
@media (prefers-reduced-motion: reduce) {
  .tk__clock { transition: none; }
  .tk__progress-fill { transition: none; }
}

/* ============ Treasurer (dues panel) ============ */

.tr-msg {
  padding: 10px 13px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  background: var(--red-bg); border: 1px solid #F3C7CD; color: var(--red-text);
}
.tr-msg--error { background: var(--red-bg); border-color: #F3C7CD; color: var(--red-text); }

.tr-month-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.tr-month-math { font-size: 12.5px; }

.tr-section-title { margin-bottom: 10px; }

/* Pending request cards */
.tr-request {
  display: grid; grid-template-columns: 44px 1fr auto;
  gap: 10px; align-items: start;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.tr-request:last-child { border-bottom: none; }
.tr-request__body { min-width: 0; }
.tr-request__name { font-weight: 700; font-size: 14px; margin: 0 0 2px; }
.tr-request__amount { font-family: var(--font-h); font-weight: 800; color: var(--green-dark); font-size: 16px; margin: 0 0 2px; }
.tr-request__note { font-size: 12.5px; color: var(--text-2); margin: 0 0 4px; }
.tr-proof-link { font-size: 12.5px; font-weight: 700; color: var(--green-dark); text-decoration: none; }
.tr-proof-link:hover { text-decoration: underline; }
.tr-proof-link--none { color: var(--text-3); font-weight: 600; }
.tr-request__actions { display: flex; flex-direction: column; gap: 6px; }

/* Member dues rows */
.tr-row {
  display: grid; grid-template-columns: 36px 1fr auto;
  gap: 10px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.tr-row:last-child { border-bottom: none; }
.tr-row__body { min-width: 0; }
.tr-row__name { font-weight: 700; font-size: 13.5px; margin: 0 0 2px; }
.tr-row__figures { font-size: 12px; color: var(--text-2); margin: 0; }
.tr-balance { font-weight: 700; color: var(--red-text); }
.tr-balance--ok { color: var(--green-dark); }

.tr-avatar {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  border: 1.5px solid var(--border-2); background: var(--bg-soft);
  grid-row: span 1;
}
.tr-avatar--fallback {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--green-soft); color: var(--green-dark);
  font-weight: 800; font-family: var(--font-h);
}
.tr-request .tr-avatar, .tr-request .tr-avatar--fallback { width: 40px; height: 40px; }

.tr-row__toggle { grid-column: 3; }

/* Inline "add payment" form — spans the full row width underneath it */
.tr-addform {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  margin-top: 10px; padding: 12px; border-radius: 12px;
  background: var(--bg-soft); border: 1px solid var(--border-2);
}
.tr-addform label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; font-weight: 700; color: var(--text-2);
}
.tr-addform input, .tr-addform select {
  height: 38px; border-radius: 8px; border: 1.5px solid var(--border-2);
  padding: 0 10px; font-size: 14px; background: #fff;
}
.tr-addform input[type="file"] { height: auto; padding: 8px 10px; }
.tr-addform__actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.tr-addform__note { grid-column: 1 / -1; font-size: 12.5px; color: var(--red-text); margin: 0; }

@media (max-width: 480px) {
  .tr-addform { grid-template-columns: 1fr; }
}

/* ============ My Dues (member portal card) ============ */
.dues-figures { display: flex; gap: 10px; }
.dues-figure {
  flex: 1; text-align: center; padding: 10px 6px; border-radius: 12px;
  background: var(--bg-soft); border: 1px solid var(--border);
}
.dues-figure__value {
  display: block; font-family: var(--font-h); font-weight: 800; font-size: 16px; color: var(--text);
}
.dues-figure--balance .dues-figure__value { color: var(--red-text); }
.dues-figure--balance .dues-figure__value.is-settled { color: var(--green-dark); }
.dues-figure__label { display: block; font-size: 10.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .03em; margin-top: 2px; }

.dues-field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.dues-field input[type="file"] {
  border: 1.5px solid var(--border-2); border-radius: 10px; padding: 9px 10px; font-size: 13px; background: #fff;
}

.dues-hist-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.dues-hist-row:last-child { border-bottom: none; }

/* ============ Meeting script tracker ============ */
#sc-parts { display: flex; flex-direction: column; gap: 12px; }

.sc-progress-track {
  height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; margin-top: 10px;
}
.sc-progress-fill { height: 100%; background: var(--green-dark); transition: width .3s ease; }

.sc-part { transition: opacity .2s ease, border-color .2s ease; }
.sc-part.is-done { opacity: .62; }
.sc-part.is-current { border-color: var(--z-amber); box-shadow: 0 0 0 2px rgba(242,169,0,.18); }

.sc-part__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.sc-part__time {
  font-family: var(--font-h); font-weight: 700; font-size: 12px; color: var(--text-3);
  letter-spacing: .02em;
}
.sc-part__now { margin-left: auto; }

.sc-part__title { font-family: var(--font-h); font-size: 16px; font-weight: 800; color: var(--text); margin: 0 0 8px; }

.sc-part__assignee { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sc-avatar {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none;
  border: 1.5px solid var(--border-2); background: var(--bg-soft);
}
.sc-avatar--fallback {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  background: var(--green-soft); color: var(--green-dark);
  font-weight: 800; font-family: var(--font-h); font-size: 15px;
}
.sc-part__who { min-width: 0; }
.sc-part__name { font-weight: 700; font-size: 13.5px; margin: 0; }
.sc-part__role { font-size: 11.5px; color: var(--text-3); margin: 1px 0 0; }

.sc-part__body { font-size: 13px; color: var(--text-2); line-height: 1.5; margin: 0 0 12px; }
.sc-part__list { font-size: 13px; color: var(--text-2); line-height: 1.5; margin: 0 0 12px; padding-left: 20px; }
.sc-part__list li { margin: 0 0 4px; }
.sc-part__list li:last-child { margin-bottom: 0; }

.sc-mark { min-height: 42px; }
