/*
 * The membership system's own styling, on top of Bootstrap 5.3.
 * The brand colour comes from the settings: each page sets --org-primary, --org-primary-rgb and
 * --org-primary-dark-rgb in its head, and the rules below make Bootstrap's "primary" follow them.
 */

:root {
  --org-primary: #0A6B50;
  --org-primary-rgb: 10, 107, 80;
  --org-primary-dark-rgb: 8, 86, 64;

  --bs-primary: var(--org-primary);
  --bs-primary-rgb: var(--org-primary-rgb);
  --bs-link-color: var(--org-primary);
  --bs-link-color-rgb: var(--org-primary-rgb);
  --bs-link-hover-color: rgb(var(--org-primary-dark-rgb));
  --bs-link-hover-color-rgb: var(--org-primary-dark-rgb);
}

body {
  background: var(--bs-tertiary-bg);
}

/* ---- Brand colour on Bootstrap's own components ---- */

.btn-primary {
  --bs-btn-bg: var(--org-primary);
  --bs-btn-border-color: var(--org-primary);
  --bs-btn-hover-bg: rgb(var(--org-primary-dark-rgb));
  --bs-btn-hover-border-color: rgb(var(--org-primary-dark-rgb));
  --bs-btn-active-bg: rgb(var(--org-primary-dark-rgb));
  --bs-btn-active-border-color: rgb(var(--org-primary-dark-rgb));
  --bs-btn-disabled-bg: var(--org-primary);
  --bs-btn-disabled-border-color: var(--org-primary);
  --bs-btn-focus-shadow-rgb: var(--org-primary-rgb);
}

.btn-outline-primary {
  --bs-btn-color: var(--org-primary);
  --bs-btn-border-color: var(--org-primary);
  --bs-btn-hover-bg: var(--org-primary);
  --bs-btn-hover-border-color: var(--org-primary);
  --bs-btn-active-bg: var(--org-primary);
  --bs-btn-active-border-color: var(--org-primary);
  --bs-btn-disabled-color: var(--org-primary);
  --bs-btn-disabled-border-color: var(--org-primary);
  --bs-btn-focus-shadow-rgb: var(--org-primary-rgb);
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(var(--org-primary-rgb), .65);
  box-shadow: 0 0 0 .25rem rgba(var(--org-primary-rgb), .2);
}

.form-check-input:checked,
.form-check-input[type="checkbox"]:indeterminate {
  background-color: var(--org-primary);
  border-color: var(--org-primary);
}

.form-check-input:focus {
  border-color: rgba(var(--org-primary-rgb), .65);
  box-shadow: 0 0 0 .25rem rgba(var(--org-primary-rgb), .2);
}

.nav-pills .nav-link.active,
.list-group-item.active,
.page-item.active .page-link {
  background-color: var(--org-primary);
  border-color: var(--org-primary);
}

.page-link {
  color: var(--org-primary);
}

.progress-bar {
  background-color: var(--org-primary);
}

/* ---- Pages before sign-in ---- */

.guest-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
}

.guest-card {
  width: 100%;
  max-width: 26rem;
}

.wizard-card,
.guest-card-wide {
  width: 100%;
  max-width: 46rem;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  background: var(--org-primary);
  color: #fff;
  font-size: 1.6rem;
}

/* The organisation's own logo, when it has uploaded one: on the sign-in page, and on the top bar (on a white tile, so that it reads on any colour). */
.brand-logo-lg {
  display: block;
  width: 5.5rem;
  height: 5.5rem;
  margin-left: auto;
  margin-right: auto;
  object-fit: contain;
}

.app-navbar .brand-logo {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  padding: .15rem;
  vertical-align: middle;
  object-fit: contain;
  background: #fff;
  border-radius: .4rem;
}

/* ---- The staff console and member portal frames ---- */

.app-navbar {
  background: var(--org-primary);
}

.app-navbar .navbar-brand,
.app-navbar .nav-link,
.app-navbar .navbar-text {
  color: #fff;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus {
  color: rgba(255, 255, 255, .85);
}

.app-navbar .btn-menu {
  --bs-btn-color: #fff;
  --bs-btn-border-color: rgba(255, 255, 255, .45);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: rgba(255, 255, 255, .15);
  --bs-btn-hover-border-color: rgba(255, 255, 255, .7);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: rgba(255, 255, 255, .25);
  --bs-btn-active-border-color: rgba(255, 255, 255, .7);
  --bs-btn-focus-shadow-rgb: 255, 255, 255;
}

.app-navbar .navbar-toggler {
  --bs-navbar-toggler-border-color: rgba(255, 255, 255, .45);
  --bs-navbar-toggler-focus-width: .2rem;
}

.user-name {
  max-width: 12rem;
}

.app-sidebar {
  background: var(--bs-body-bg);
  --bs-offcanvas-width: min(20rem, 85vw);   /* on a phone the drawer leaves a strip of the page to tap to close it */
}

@media (min-width: 992px) {
  .app-sidebar {
    position: sticky;
    top: 3.5rem;
    height: calc(100vh - 3.5rem);
    overflow-y: auto;
    border-right: 1px solid var(--bs-border-color);
  }
}

.side-nav .nav-heading {
  margin: 1.1rem .75rem .3rem;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
}

.side-nav .menu-search .form-control {
  min-height: 2.25rem;
}

/* A group of the menu folds shut: its heading is what is tapped, and the arrow turns when it is open. */
.side-nav .menu-summary {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin: .1rem 0;
  padding: .6rem .75rem;
  border-radius: .5rem;
  font-weight: 600;
  color: var(--bs-body-color);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.side-nav .menu-summary::-webkit-details-marker {
  display: none;
}

.side-nav .menu-summary:hover {
  background: var(--bs-tertiary-bg);
}

.side-nav .menu-summary:focus-visible {
  outline: 2px solid var(--org-primary);
  outline-offset: -2px;
}

.side-nav .menu-chevron {
  margin-left: auto;
  font-size: .8rem;
  color: var(--bs-secondary-color);
  transition: transform .15s ease;
}

.side-nav details[open] > .menu-summary .menu-chevron {
  transform: rotate(90deg);
}

.side-nav .menu-items {
  margin: 0 0 .35rem 1.1rem;
  padding-left: .5rem;
  border-left: 2px solid var(--bs-border-color);
}

.side-nav .menu-items .nav-link {
  padding-top: .5rem;
  padding-bottom: .5rem;
}

.side-nav .nav-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem .75rem;      /* big enough to tap with a thumb */
  border-radius: .5rem;
  color: var(--bs-body-color);
}

.side-nav .nav-link:hover {
  background: var(--bs-tertiary-bg);
}

.side-nav .nav-link.active {
  background: rgba(var(--org-primary-rgb), .12);
  color: var(--org-primary);
  font-weight: 600;
}

.member-nav .nav-link.active {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: .35rem;
}

/* A menu folded into the members' bar opens as a light panel, and the page being shown stands out in it. */
.member-nav .dropdown-menu {
  min-width: 12rem;
}

.app-navbar .dropdown-item.active {
  background: rgba(var(--org-primary-rgb), .12);
  color: var(--org-primary);
  font-weight: 600;
}

@media (max-width: 991.98px) {
  .member-nav .dropdown-menu {
    margin-bottom: .5rem;
  }
}

@media (min-width: 768px) {
  .member-nav .navbar-nav {
    flex-wrap: wrap;
    column-gap: .25rem;
  }

  .member-nav .nav-link {
    white-space: nowrap;
  }
}

/* ---- Forms and tables ---- */

.btn {
  min-height: 2.5rem;
}

/* On a phone the main buttons of a long form stay at the bottom of the screen. */
@media (max-width: 575.98px) {
  .form-actions-sticky {
    position: sticky;
    bottom: 0;
    margin: 0 -1rem;
    padding: .75rem 1rem;
    background: var(--bs-body-bg);
    border-top: 1px solid var(--bs-border-color);
  }
}

.form-narrow {
  max-width: 32rem;
}

.form-wide {
  max-width: 48rem;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---- Printing: just the page, without the menus ---- */

@media print {
  .no-print,
  .app-navbar,
  .app-sidebar {
    display: none !important;
  }

  body {
    background: #fff;
  }
}

/* ---- The public front: home page, About pages, downloads, the guide ---- */

.site-hero {
  background: linear-gradient(135deg, rgb(var(--org-primary-dark-rgb)), var(--org-primary));
  color: #fff;
  padding: 2.5rem 0 3rem;
}

.site-hero .lead {
  color: rgba(255, 255, 255, .92);
}

.site-article {
  max-width: 46rem;
}

/* The organisation's logo, big, at the top of its About us page. */
.about-logo {
  width: 14rem;
  max-width: 70%;
  height: auto;
}

.site-tile {
  border-color: rgba(var(--org-primary-rgb), .25);
  transition: box-shadow .15s ease, transform .15s ease;
}

.site-tile:hover,
.site-tile:focus-visible {
  box-shadow: 0 .4rem 1rem rgba(0, 0, 0, .12);
  transform: translateY(-2px);
}

.site-footer a {
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.guide-number {
  flex: 0 0 auto;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--org-primary);
  color: #fff;
  font-size: .95rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.guide-shot {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--bs-border-color);
  border-radius: .5rem;
  box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .12);
  background: #fff;
}

.guide-shot-phone {
  max-width: 17rem;
}

@media print {
  .app-navbar,
  .site-footer,
  .d-print-none {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .guide-step {
    break-inside: avoid;
  }

  .guide-task {
    break-before: auto;
  }

  .guide-shot {
    box-shadow: none;
  }
}

/* The box that suggests members as one types (app.js) inside an input group, beside a button: the box takes the room, and keeps its square corner where the button joins it. */
.input-group > .member-search-wrap {
  flex: 1 1 auto;
  width: 1%;
}

.input-group > .member-search-wrap > .form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.member-suggestions {
  max-height: 18rem;
  overflow-y: auto;
}

.member-suggestions .list-group-item-action:not(.active) {
  color: var(--bs-body-color);
}

/* ---- Text written in the rich-text editor, and plain texts shown the same way ---- */

.rich-text > :last-child {
  margin-bottom: 0;
}

.rich-text.rich-plain {
  white-space: pre-line;
}

.rich-text h2 {
  font-size: 1.4rem;
  margin: 1.25rem 0 .6rem;
}

.rich-text h3 {
  font-size: 1.2rem;
  margin: 1rem 0 .5rem;
}

.rich-text h4 {
  font-size: 1.05rem;
  margin: .9rem 0 .4rem;
}

.rich-text blockquote {
  border-left: .25rem solid var(--bs-border-color);
  margin-left: 0;
  padding-left: 1rem;
  color: var(--bs-secondary-color);
}

.rich-text pre {
  white-space: pre-wrap;
}

.rich-text table {
  max-width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.rich-text th,
.rich-text td {
  border: 1px solid var(--bs-border-color);
  padding: .4rem .6rem;
  vertical-align: top;
}

.rich-text th {
  background: var(--bs-tertiary-bg);
}

@media (max-width: 575.98px) {
  .rich-text table {
    display: block;
    overflow-x: auto;
  }
}

/* The membership card (member/card.php) and the card check page (verify.php) */
.member-card {
  max-width: 22rem;
  border: 1px solid var(--bs-border-color);
  border-radius: .75rem;
  overflow: hidden;
  background: #fff;
}

.member-card-head {
  background: var(--org-primary);
  color: #fff;
  font-weight: 600;
  padding: .6rem .9rem;
}

.member-card-body {
  display: flex;
  gap: .9rem;
  padding: .9rem;
}

.member-card-photo {
  width: 6rem;
  height: 7.5rem;
  object-fit: cover;
  border-radius: .4rem;
  border: 1px solid var(--bs-border-color);
}

.member-card-nophoto {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--bs-secondary-color);
  background: var(--bs-tertiary-bg);
}

.member-card-foot {
  text-align: center;
  padding: 0 .9rem .9rem;
}

.member-card-qr {
  width: 11rem;
  height: 11rem;
  image-rendering: pixelated;
}

/* Group chats (partials/chat-messages.php); new messages are added by app.js (data-chat) */
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-height: 60vh;
  overflow-y: auto;
  padding: .75rem;
  background: var(--bs-tertiary-bg);
  border-radius: .5rem;
}

.chat-message {
  max-width: 85%;
  align-self: flex-start;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: .75rem;
  padding: .4rem .7rem;
}

.chat-message.chat-mine {
  align-self: flex-end;
  background: rgba(var(--org-primary-rgb), .1);
}

.chat-message.chat-office {
  border-color: var(--org-primary);
}

.chat-meta {
  font-size: .75rem;
  color: var(--bs-secondary-color);
}

.chat-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* The ⋮ button of a message (or of a member on a group's info page), at its top right, and its actions below it when opened */
.has-actions {
  position: relative;
  padding-right: 2.4rem !important;
}

.chat-actions > summary {
  list-style: none;
  cursor: pointer;
}

.chat-actions > summary::-webkit-details-marker {
  display: none;
}

.chat-more {
  position: absolute;
  top: .2rem;
  right: .2rem;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--bs-secondary-color);
  font-size: 1.05rem;
}

.chat-more:hover,
.chat-actions[open] > .chat-more {
  background: var(--bs-secondary-bg);
  color: var(--bs-body-color);
}

.chat-actions-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .4rem;
  margin-top: .45rem;
  padding-top: .45rem;
  border-top: 1px solid var(--bs-border-color);
}

/* The group's name at the top of a chat: tapping it opens the group's information */
.chat-title {
  color: inherit;
  text-decoration: none;
  flex: 1 1 0;
  min-width: 0;
}

.chat-title > h1,
.chat-title > span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-title:hover h1 {
  text-decoration: underline;
}

.group-avatar {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: rgba(var(--org-accent-rgb), .15);
  color: var(--org-accent);
}

/* A member's photo beside their name: a small round picture, cut to fill its circle */
.profile-photo { object-fit: cover; flex-shrink: 0; background: var(--bs-light); }

/* An email read whole on Messages sent: a closed frame, tall enough to read it */
.email-view { height: 70vh; min-height: 24rem; }

/* ==== The app look (release 1.2) ====
 * Calm surfaces, the organisation's two colours (the main one, and a second one for highlights, as in a logo), rounder cards and buttons, and on a
 * phone the feel of an app: a top bar, a tab bar at the bottom for the pages used most, and a sheet with everything else. Pages set
 * --org-accent, --org-accent-rgb and --org-accent-text in their head with the colours. */

:root {
  --org-accent: #F2B705;
  --org-accent-rgb: 242, 183, 5;
  --org-accent-text: #1F1F1F;
  --org-soft: rgba(var(--org-primary-rgb), .08);
  --app-bg: #F3F4F6;
  --app-radius: 1rem;
  --app-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 18px rgba(16, 24, 40, .06);
  --app-tabbar-height: 4.1rem;
  --bs-border-radius: .6rem;
  --bs-border-radius-lg: .9rem;
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

body {
  background: var(--app-bg);
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

h1, .h1, h2, .h2, h3, .h3, h4, .h4 {
  letter-spacing: -.01em;
}

.card {
  border: 0;
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
}

.card > .card-header:first-child {
  border-radius: var(--app-radius) var(--app-radius) 0 0;
  background: transparent;
}

.list-group {
  --bs-list-group-border-color: rgba(16, 24, 40, .07);
}

.btn {
  border-radius: .65rem;
  font-weight: 500;
}

.btn-lg {
  border-radius: .85rem;
}

.btn-accent {
  --bs-btn-bg: var(--org-accent);
  --bs-btn-border-color: var(--org-accent);
  --bs-btn-color: var(--org-accent-text);
  --bs-btn-hover-bg: var(--org-accent);
  --bs-btn-hover-border-color: var(--org-accent);
  --bs-btn-hover-color: var(--org-accent-text);
  --bs-btn-active-bg: var(--org-accent);
  --bs-btn-active-border-color: var(--org-accent);
  --bs-btn-active-color: var(--org-accent-text);
  --bs-btn-focus-shadow-rgb: var(--org-accent-rgb);
  font-weight: 600;
}

.btn-accent:hover {
  filter: brightness(.95);
}

.text-bg-accent {
  background: var(--org-accent) !important;
  color: var(--org-accent-text) !important;
}

.table > :not(caption) > * > * {
  padding-top: .65rem;
  padding-bottom: .65rem;
}

/* the top bar: the colour, a little depth, and a line of the second colour under it */
.app-navbar {
  background: linear-gradient(120deg, var(--org-primary) 0%, rgb(var(--org-primary-dark-rgb)) 100%);
  border-bottom: 3px solid var(--org-accent);
}

.app-navbar .navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  letter-spacing: .01em;
}

.app-navbar .navbar-brand img {
  background: #fff;
  border-radius: 50%;
  padding: 2px;
  margin: 0 !important;
}

.app-navbar .nav-link.active {
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 -3px 0 var(--org-accent);
}

/* the page's own heading, with a short bar of the second colour */
main h1.h4:first-of-type,
main .page-title {
  font-weight: 650;
}

/* ---- The tab bar at the bottom of a phone (members below 768 pixels wide, staff below 992) ---- */

.app-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1035;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  min-height: var(--app-tabbar-height);
  padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .97);
  border-top: 1px solid rgba(16, 24, 40, .08);
  box-shadow: 0 -4px 18px rgba(16, 24, 40, .06);
  backdrop-filter: saturate(180%) blur(10px);
}

.app-tabbar .tab {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .15rem;
  padding: .2rem 0;
  border: 0;
  background: none;
  color: #667085;
  font-size: .7rem;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
}

.app-tabbar .tab .bi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.4rem;
  height: 1.9rem;
  border-radius: 1rem;
  font-size: 1.3rem;
  transition: background-color .15s ease;
}

.app-tabbar .tab.active {
  color: var(--org-primary);
  font-weight: 650;
}

.app-tabbar .tab.active .bi {
  background: rgba(var(--org-primary-rgb), .12);
}

.app-tabbar .tab .tab-count {
  position: absolute;
  margin: -.2rem 0 0 1.4rem;
  min-width: 1.1rem;
  padding: 0 .3rem;
  border-radius: 1rem;
  background: var(--org-accent);
  color: var(--org-accent-text);
  font-size: .65rem;
  font-weight: 700;
}

body.has-tabbar {
  padding-bottom: calc(var(--app-tabbar-height) + env(safe-area-inset-bottom) + .5rem);
}

body.has-tabbar .form-actions-sticky {
  bottom: calc(var(--app-tabbar-height) + env(safe-area-inset-bottom));
}

@media (min-width: 768px) {
  .member-tabbar {
    display: none;
  }

  body.has-member-tabbar {
    padding-bottom: 0;
  }
}

@media (min-width: 992px) {
  .staff-tabbar {
    display: none;
  }

  body.has-staff-tabbar {
    padding-bottom: 0;
  }
}

/* the sheet that comes up from the bottom with every page ("More") */
.app-sheet {
  --bs-offcanvas-height: auto;
  max-height: 85vh;
  border-radius: 1.25rem 1.25rem 0 0;
  padding-bottom: env(safe-area-inset-bottom);
}

.app-sheet .offcanvas-header::before {
  content: "";
  position: absolute;
  top: .45rem;
  left: 50%;
  width: 2.5rem;
  height: .3rem;
  margin-left: -1.25rem;
  border-radius: 1rem;
  background: rgba(16, 24, 40, .18);
}

.app-sheet .offcanvas-header {
  position: relative;
  padding-top: 1.25rem;
}

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
}

.sheet-grid a,
.sheet-grid button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  padding: .75rem .25rem;
  border: 0;
  border-radius: .9rem;
  background: var(--app-bg);
  color: var(--bs-body-color);
  font-size: .78rem;
  text-align: center;
  text-decoration: none;
}

.sheet-grid .bi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: .8rem;
  background: #fff;
  color: var(--org-primary);
  font-size: 1.3rem;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .08);
}

.sheet-grid .active {
  background: rgba(var(--org-primary-rgb), .1);
  font-weight: 650;
}

/* ---- On a phone: an app's top bar, and room to tap ---- */

@media (max-width: 767.98px) {
  .member-frame .app-navbar .navbar-toggler,
  .member-frame .app-navbar .navbar-collapse {
    display: none !important;
  }

  .btn {
    min-height: 2.75rem;
  }

  .btn-sm {
    min-height: 2.25rem;
  }

  .form-control,
  .form-select {
    min-height: 2.75rem;
    font-size: 1rem;   /* 16 pixels: a phone does not zoom into the field */
  }

  main.container,
  main.member-main {
    padding-left: .85rem;
    padding-right: .85rem;
  }

  .card {
    border-radius: .9rem;
  }
}

@media (max-width: 991.98px) {
  .staff-frame main {
    padding-left: .85rem !important;
    padding-right: .85rem !important;
  }
}

/* ---- Before signing in: a band of the colour, the logo in a white circle, and the card over it ---- */

.guest-frame {
  background:
    radial-gradient(circle at 85% 0%, rgba(var(--org-accent-rgb), .28) 0, transparent 30rem),
    linear-gradient(180deg, var(--org-primary) 0, rgb(var(--org-primary-dark-rgb)) 17rem, var(--app-bg) 17rem);
  background-repeat: no-repeat;
}

.guest-frame .guest-wrap {
  align-items: flex-start;
  padding-top: 2.5rem;
}

.guest-frame .guest-org {
  color: #fff;
}

.guest-frame .guest-org .guest-motto {
  color: rgba(255, 255, 255, .8);
  font-size: .9rem;
}

.guest-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 50%;
  background: #fff;
  padding: .35rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  color: var(--org-primary);
  font-size: 2.2rem;
}

.guest-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

.guest-frame .guest-card > .card {
  border-top: 4px solid var(--org-accent);
}

/* ---- The public home page ---- */

.site-band {
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 88% 12%, rgba(var(--org-accent-rgb), .35) 0, transparent 22rem),
    radial-gradient(circle at 5% 100%, rgba(255, 255, 255, .12) 0, transparent 18rem),
    linear-gradient(125deg, var(--org-primary) 0%, rgb(var(--org-primary-dark-rgb)) 100%);
  border-bottom: 4px solid var(--org-accent);
}

.site-band .container {
  position: relative;
  padding-top: 3rem;
  padding-bottom: 3.5rem;
}

.site-band .lead,
.site-band p {
  color: rgba(255, 255, 255, .9);
}

.site-band a:not(.btn) {
  color: #fff;
}

.site-band-logo {
  width: 8.5rem;
  height: 8.5rem;
  border-radius: 50%;
  background: #fff;
  padding: .45rem;
  object-fit: contain;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .3);
}

.site-eyebrow {
  display: inline-block;
  margin-bottom: .75rem;
  padding: .2rem .7rem;
  border-radius: 2rem;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.site-section-title {
  font-weight: 700;
}

.site-section-title::after {
  content: "";
  display: block;
  width: 3rem;
  height: .25rem;
  margin-top: .5rem;
  border-radius: 1rem;
  background: var(--org-accent);
}

.site-card {
  height: 100%;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.25rem;
  border-radius: var(--app-radius);
  background: #fff;
  box-shadow: var(--app-shadow);
  color: var(--bs-body-color);
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}

.site-card:hover,
.site-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(16, 24, 40, .12);
  color: var(--bs-body-color);
}

.site-card-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: .9rem;
  background: rgba(var(--org-primary-rgb), .1);
  color: var(--org-primary);
  font-size: 1.4rem;
}

.site-welcome {
  margin-top: -2rem;
  position: relative;
}

.site-footer {
  background: #16181d;
  color: rgba(255, 255, 255, .78);
  border-top: 4px solid var(--org-primary) !important;
}

.site-footer a,
.site-footer .fw-semibold {
  color: #fff;
}

@media (max-width: 575.98px) {
  .site-band .container {
    padding-top: 2rem;
    padding-bottom: 2.5rem;
    text-align: center;
  }

  .site-band .d-flex.flex-wrap {
    justify-content: center;
  }

  .site-band-logo {
    width: 6.5rem;
    height: 6.5rem;
  }
}

/* a picture of the guide, in a page */
.guide-picture img {
  max-width: 100%;
  height: auto;
}

.guide-picture.guide-picture-phone img {
  max-width: 18rem;
}

@media print {
  .app-tabbar,
  .app-sheet {
    display: none !important;
  }

  body.has-tabbar {
    padding-bottom: 0;
  }
}

/* ---- Meetings and events (release 1.3) ---- */

.event-date {
  flex: 0 0 auto;
  min-width: 4rem;
  padding: .3rem .5rem;
  border-radius: .8rem;
  background: rgba(var(--org-primary-rgb), .08);
  color: var(--org-primary);
  text-align: center;
}

.event-code {
  font-family: var(--bs-font-monospace);
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: .3em;
}

.quorum-bar {
  height: .6rem;
}

/* A certificate of attendance, printed on one A4 page in landscape */
.certificate {
  max-width: 60rem;
  margin: 0 auto;
  padding: 3rem 3.5rem;
  border: .6rem double var(--org-primary);
  background: #fff;
  text-align: center;
}

.certificate .certificate-title {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--org-primary);
}

.certificate .certificate-name {
  font-size: 2rem;
  font-weight: 600;
  border-bottom: 2px solid var(--org-accent);
  display: inline-block;
  padding: 0 1.5rem .25rem;
}

@media print {
  @page {
    size: A4 landscape;
    margin: 1cm;
  }

  .certificate {
    border-width: .5rem;
  }
}

/* the words of a case, with their line breaks */
.case-text {
  white-space: pre-line;
}

/* ---- The membership card (release 1.3): light cream, a border of the organisation's colour, the logo centred and the name under it ---- */

.member-card {
  max-width: 22rem;
  background: #FFF9EC;
  border: 3px solid var(--org-primary);
  border-radius: 1rem;
  box-shadow: 0 0 0 4px #FFF9EC, 0 0 0 5px rgba(var(--org-accent-rgb), .9), 0 10px 24px rgba(16, 24, 40, .12);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.member-card-head {
  background: transparent;
  color: var(--org-primary);
  text-align: center;
  padding: 1.1rem .9rem .6rem;
  border-bottom: 2px solid rgba(var(--org-accent-rgb), .8);
  margin: 0 1rem;
}

.member-card-logo {
  display: block;
  width: 4rem;
  height: 4rem;
  margin: 0 auto .4rem;
  object-fit: contain;
}

.member-card-nologo {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--org-primary);
  color: #fff;
  font-size: 1.8rem;
}

.member-card-org {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.25;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.member-card-kind {
  font-size: .75rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #6b5b3e;
}

.member-card .member-card-photo {
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(16, 24, 40, .2);
}

.member-card-foot .member-card-qr {
  background: #fff;
  padding: .35rem;
  border-radius: .5rem;
}

/* The organisation's website and phone, in a strip of its colour at the foot of the card (release 1.6) */
.member-card-strip {
  background: var(--org-primary);
  color: #fff;
  text-align: center;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .02em;
  padding: .4rem .75rem;
  border-radius: 0 0 calc(1rem - 3px) calc(1rem - 3px);
  overflow-wrap: anywhere;
}

/* A photo or a document in a chat message */
.chat-photo {
  display: block;
  max-width: min(16rem, 100%);
  max-height: 20rem;
  margin-top: .35rem;
  border-radius: .6rem;
  object-fit: cover;
}

.chat-file {
  display: inline-block;
  margin-top: .35rem;
  padding: .35rem .6rem;
  border-radius: .5rem;
  background: rgba(var(--org-primary-rgb), .08);
  text-decoration: none;
  word-break: break-all;
}

/* Cropping a photo before it is sent (app.js, data-crop) */
.crop-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(10, 12, 16, .78);
}

.crop-box {
  max-width: 24rem;
  padding: 1rem;
  border-radius: 1rem;
  background: #fff;
  text-align: center;
}

.crop-frame {
  position: relative;
  margin: 0 auto;
  overflow: hidden;
  border-radius: .5rem;
  outline: 3px solid var(--org-accent);
  background: #222;
  touch-action: none;
  cursor: grab;
}

.crop-frame img {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: none;
  transform-origin: center;
  user-select: none;
  pointer-events: none;
}

.crop-preview {
  display: block;
  width: 6rem;
  border-radius: .4rem;
  border: 1px solid var(--bs-border-color);
}

/* The birthdays of the day on a member's home page: a warm card in the organisation's accent */
.birthday-card {
  border-color: rgba(var(--org-accent-rgb), .55);
  background: linear-gradient(135deg, rgba(var(--org-accent-rgb), .16), rgba(var(--org-accent-rgb), .04));
}

.birthday-card .bi-balloon-heart,
.birthday-card .bi-cake2 {
  color: var(--org-accent);
}

/* The media library (admin/media.php): photos as tiles, files as a big icon with their kind */
.media-thumb {
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--bs-tertiary-bg);
}

.media-file-tile {
  aspect-ratio: 4 / 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  font-size: 2.5rem;
  color: var(--bs-secondary-color);
  background: var(--bs-tertiary-bg);
  text-decoration: none;
  border-radius: var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius) 0 0;
}

.media-file-tile span {
  font-size: .85rem;
  font-weight: 600;
}

/* Text written with the rich editor (partials/rich-text.php), on pages, notices and in the editor itself */
.rich-body::after {
  content: "";
  display: block;
  clear: both;
}

.rich-body h2 { font-size: 1.45rem; margin: 1.5rem 0 .6rem; }
.rich-body h3 { font-size: 1.2rem; margin: 1.25rem 0 .5rem; }
.rich-body h4 { font-size: 1.05rem; margin: 1rem 0 .5rem; }
.rich-body img { max-width: 100%; height: auto; border-radius: .375rem; }

.rich-body blockquote {
  border-left: 4px solid rgba(var(--org-accent-rgb), .85);
  padding: .25rem 0 .25rem 1rem;
  margin: 1rem 0;
  color: var(--bs-secondary-color);
}

.rich-body figure { margin: 1rem 0; }
.rich-body figure.align-center { margin-left: auto; margin-right: auto; text-align: center; }
.rich-body figure.align-left { float: left; margin: .25rem 1.25rem .75rem 0; max-width: 50%; }
.rich-body figure.align-right { float: right; margin: .25rem 0 .75rem 1.25rem; max-width: 50%; }
.rich-body figure.size-small { max-width: 260px; }
.rich-body figure.size-medium { max-width: 520px; }
.rich-body figure.size-full { max-width: 100%; }
.rich-body figcaption { font-size: .875rem; color: var(--bs-secondary-color); margin-top: .35rem; }

.rich-body .gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
  margin: 1rem 0;
}

.rich-body .gallery-cols-2 { grid-template-columns: repeat(2, 1fr); }
.rich-body .gallery-cols-4 { grid-template-columns: repeat(4, 1fr); }
.rich-body .gallery figure { margin: 0; }
.rich-body .gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; }

.rich-body a.media-file {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .8rem;
  border: 1px solid var(--bs-border-color);
  border-radius: .5rem;
  background: var(--bs-tertiary-bg);
  text-decoration: none;
}

.rich-body a.media-file::before {
  font-family: bootstrap-icons;
  content: "\f356";   /* bi-file-earmark-arrow-down */
}

.rich-body table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.rich-body th, .rich-body td { border: 1px solid var(--bs-border-color); padding: .4rem .6rem; vertical-align: top; }

@media (max-width: 575.98px) {
  .rich-body .gallery-cols-3, .rich-body .gallery-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .rich-body figure.align-left, .rich-body figure.align-right { float: none; max-width: 100%; margin: 1rem 0; }
}

/* The rich editor (app.js, data-rich-editor): Add Media and the tabs, the toolbar, the page to write in */
.rich-editor {
  border: 1px solid var(--bs-border-color);
  border-radius: .5rem;
  background: var(--bs-body-bg);
}

.rich-top {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem;
  background: var(--bs-tertiary-bg);
  border-bottom: 1px solid var(--bs-border-color);
  border-radius: .5rem .5rem 0 0;
}

.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .2rem;
  padding: .35rem .5rem;
  border-bottom: 1px solid var(--bs-border-color);
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bs-body-bg);
}

.rich-toolbar .rich-block { width: auto; margin-right: .35rem; }
.rich-toolbar .rich-gap { width: 1px; align-self: stretch; margin: 0 .25rem; background: var(--bs-border-color); }
.rich-toolbar.rich-off .rich-tool, .rich-toolbar.rich-off .rich-block { opacity: .4; pointer-events: none; }

.rich-area {
  min-height: 18rem;
  max-height: 70vh;
  overflow-y: auto;
  padding: .75rem 1rem;
  outline: none;
}

.rich-area:focus { box-shadow: inset 0 0 0 2px rgba(var(--org-primary-rgb), .25); }
.rich-editor textarea.rich-source { border: 0; border-radius: 0 0 .5rem .5rem; min-height: 18rem; font-family: var(--bs-font-monospace); font-size: .85rem; }

/* Add Media: dropping files, the library as tiles, the chosen ones ticked */
.media-drop {
  border: 2px dashed var(--bs-border-color);
  border-radius: .5rem;
  padding: 1rem;
  text-align: center;
  color: var(--bs-secondary-color);
}

.media-drop.over { border-color: var(--org-primary); background: rgba(var(--org-primary-rgb), .06); }

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: .5rem;
}

.media-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 2px solid transparent;
  border-radius: .5rem;
  background: var(--bs-tertiary-bg);
  overflow: hidden;
  text-align: left;
}

.media-tile img, .media-tile-file { width: 100%; aspect-ratio: 1; object-fit: cover; }
.media-tile-file { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 2rem; color: var(--bs-secondary-color); }
.media-tile-file span { font-size: .8rem; font-weight: 600; }
.media-tile-name { font-size: .75rem; padding: .2rem .35rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-tile-check { position: absolute; top: .3rem; right: .35rem; font-size: 1.3rem; color: var(--org-primary); display: none; background: #fff; border-radius: 50%; line-height: 1; }
.media-tile.chosen { border-color: var(--org-primary); }
.media-tile.chosen .media-tile-check { display: block; }

/* A member's profile (release 1.6): their initials in a circle of the organisation's colour, and the few words they wrote */
.profile-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: var(--org-primary);
  color: #fff;
  font-weight: 700;
  font-size: 1.25rem;
}

.profile-bio {
  white-space: pre-line;
}

.chat-meta .chat-who {
  color: inherit;
  font-weight: 600;
}

/* A notice not read yet, in the list of a member's notices (release 1.6) */
.list-group-item.notice-new {
  border-left: 4px solid var(--org-primary);
}
