/* ==========================================================================
   Library — design tokens
   Light palette on :root, dark overrides in one media block so every colour
   has a definition in both themes.
   ========================================================================== */

/*
 * Palette taken from the Sri Sathya Sai International Organisation emblem:
 * blue #004c97 and orange #ea7600, sampled from the artwork itself.
 *
 * Blue carries every interactive element — at 8.47:1 on white it is safe for
 * body text, links and button fills. The orange only reaches 2.96:1, so it is
 * never used for text or as a button background; it appears as the decorative
 * brand rule, and a darkened #9a4f00 stands in wherever orange must be read.
 * Every foreground/background pair in this file is verified against WCAG AA.
 */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-3: #eef1f5;
  --border: #e0e5ec;
  --border-strong: #818b99;

  --text: #1a1e26;
  --text-muted: #5c6470;
  --text-faint: #6a7280;

  --accent: #004c97;
  --accent-hover: #003a78;
  --accent-soft: #e4edf7;
  /* Chart series colour. Not --accent: that navy is too dark to read as a data
     mark. Validated for lightness, chroma and 3:1 contrast on --surface. */
  --chart-series: #2a78d6;
  --accent-text: #ffffff;

  /* Brand orange: decorative fills only — never text, never a button. */
  --brand-orange: #ea7600;
  /* Readable orange, for text that must carry the brand tone. */
  --brand-orange-text: #9a4f00;
  --brand-orange-soft: #fdf0e0;

  --warn: #9a4f00;
  --warn-soft: #fdf0e0;
  --danger: #a8321f;
  --danger-soft: #fbeae6;
  /* Filled red, for the one destructive action that has to be spotted fast.
     6.68:1 against its white label, so it is safe at any size. */
  --danger-solid: #a8321f;
  --danger-solid-hover: #8c2919;
  --danger-solid-text: #ffffff;
  --info: #004c97;
  --info-soft: #e4edf7;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(20, 25, 18, 0.05), 0 4px 14px rgba(20, 25, 18, 0.05);
  --shadow-lg: 0 2px 6px rgba(20, 25, 18, 0.07), 0 16px 40px rgba(20, 25, 18, 0.09);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --maxw: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1319;
    --surface: #161b23;
    --surface-2: #1b212a;
    --surface-3: #232b36;
    --border: #2a323d;
    --border-strong: #5f6a79;

    --text: #e6eaf0;
    --text-muted: #9fa9b8;
    --text-faint: #8b95a4;

    /* The brand colours lightened for a dark ground, same hues. */
    --accent: #7fb2ea;
    --accent-hover: #9cc5f2;
    --accent-soft: #152538;
    --accent-text: #08121f;
    --chart-series: #3987e5;

    --brand-orange: #f59637;
    --brand-orange-text: #f0a45a;
    --brand-orange-soft: #2e2011;

    --warn: #f0a45a;
    --warn-soft: #2e2011;
    --danger: #ef8f79;
    --danger-soft: #3a1d16;
    /* The same inversion the accent makes on a dark ground: light fill,
       dark label. 7.63:1. */
    --danger-solid: #ef8f79;
    --danger-solid-hover: #f4a894;
    --danger-solid-text: #2b0d06;
    --info: #7fb2ea;
    --info-soft: #152538;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.35), 0 16px 40px rgba(0, 0, 0, 0.4);
  }
}

/* ==========================================================================
   Base
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 0.4em;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.7rem;
}
h2 {
  font-size: 1.2rem;
}
h3 {
  font-size: 1rem;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

code,
kbd {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--surface-3);
  padding: 0.12em 0.4em;
  border-radius: 4px;
}

/* Visible focus for keyboard users, everywhere. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

main {
  flex: 1;
  padding: 28px 0 64px;
}

.site-header {
  background: var(--surface);
  /* Decorative brand stripe — carries no information on its own. */
  border-top: 3px solid var(--brand-orange);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 60px;
  flex-wrap: wrap;
  /* Anchor for the mobile dropdown menu. */
  position: relative;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  flex-shrink: 0;
  min-width: 0;
}

.brand:hover {
  text-decoration: none;
}

.brand:hover .brand-org {
  color: var(--accent);
}

.brand-mark {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.brand-org {
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-sub {
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-orange-text);
  white-space: nowrap;
}

/*
 * One awkward band: 781–900px. The navigation is still a horizontal row of
 * links (the hamburger only appears at 780px and below) and an admin has eight
 * of them, so the centre's full name would push the row onto a second line.
 * Drop it here and promote the short label instead.
 *
 * Below 780px the nav collapses behind the toggle, the space comes back, and
 * the full name returns — see the phone block further down.
 */
@media (min-width: 781px) and (max-width: 900px) {
  .brand-org {
    display: none;
  }
  .brand-sub {
    font-size: 0.85rem;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text);
    font-weight: 700;
  }
}

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  flex-wrap: wrap;
}

/* :not(.btn) so the Sign in / Create account buttons in the nav keep their
   own fill and label — a bare `.nav a` outranks `.btn` and was painting
   the label muted grey on the blue. */
.nav a:not(.btn) {
  color: var(--text-muted);
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.925rem;
  white-space: nowrap;
}

.nav a:not(.btn):hover {
  background: var(--surface-3);
  color: var(--text);
  text-decoration: none;
}

.nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.nav-account {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.nav-account-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}

.nav-account-link:hover {
  text-decoration: none;
  color: var(--text);
}

/* The member's name only has room once the menu is stacked. */
.nav-account-name {
  display: none;
  font-weight: 600;
  font-size: 0.95rem;
}

/* --- Hamburger ------------------------------------------------------------ */

.nav-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  min-height: 44px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  cursor: pointer;
}

.nav-toggle:hover {
  background: var(--surface-3);
}

.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  content: "";
}

.nav-toggle-bars {
  position: relative;
}

.nav-toggle-bars::before {
  position: absolute;
  top: -6px;
}

.nav-toggle-bars::after {
  position: absolute;
  top: 6px;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--surface-3);
}

.avatar-fallback {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.8rem;
}

/* ==========================================================================
   "Confirm your email" bar — sits directly under the header
   ========================================================================== */

.verify-bar {
  background: var(--warn-soft);
  border-bottom: 1px solid var(--warn);
  color: var(--warn);
  font-size: 0.92rem;
}

.verify-bar .wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 11px;
  padding-bottom: 11px;
}

.verify-bar p {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.verify-bar-icon {
  font-size: 1.05rem;
  line-height: 1;
}

/* Stack on a phone: the sentence and the button both need the full width. */
@media (max-width: 560px) {
  .verify-bar .wrap {
    flex-wrap: wrap;
  }

  .verify-bar .inline-form,
  .verify-bar .btn {
    width: 100%;
  }
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  color: var(--text-faint);
  font-size: 0.85rem;
  background: var(--surface);
}

.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-copy a,
.footer-meta a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-copy a:hover,
.footer-meta a:hover {
  color: var(--accent);
}

/*
 * Honeypot. Kept out of the layout without `display:none`, which some bots
 * check for. `aria-hidden` and tabindex="-1" keep it away from real users and
 * assistive tech.
 */
.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Truncate long contact-form messages in the admin table. */
.clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
  font-size: 0.88rem;
  line-height: 1.45;
}

/* ==========================================================================
   Page header
   ========================================================================== */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.page-head h1 {
  margin: 0;
}

.page-head .sub {
  color: var(--text-muted);
  margin: 4px 0 0;
  font-size: 0.95rem;
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Cards / panels
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-pad {
  padding: 20px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.card-head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
}

.section {
  margin-bottom: 28px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

@media (max-width: 860px) {
  .split {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Stat tiles — the "Currently Out" dashboard
   ========================================================================== */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
}

.stat .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  font-weight: 650;
  margin-bottom: 6px;
}

.stat .value {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat.is-alert .value {
  color: var(--danger);
}

.stat.is-good .value {
  color: var(--accent);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-size: 0.925rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.btn:hover {
  background: var(--accent-hover);
  text-decoration: none;
  color: var(--accent-text);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--surface-3);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--surface-3);
  color: var(--text);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--border-strong);
}

.btn-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Filled counterpart to .btn-danger, for an action that has to be found
   rather than merely recognised once you are looking at it. */
.btn-danger-solid {
  background: var(--danger-solid);
  color: var(--danger-solid-text);
  border-color: transparent;
}

.btn-danger-solid:hover {
  background: var(--danger-solid-hover);
  color: var(--danger-solid-text);
}

.btn-sm {
  padding: 5px 11px;
  font-size: 0.85rem;
}

.btn-block {
  width: 100%;
}

.btn-google {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-google:hover {
  background: var(--surface-3);
  color: var(--text);
}

.btn-google svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.inline-form {
  display: inline;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.field {
  margin-bottom: 15px;
}

.field label,
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  min-height: 78px;
  resize: vertical;
}

select {
  cursor: pointer;
}

.field .hint {
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-top: 4px;
}

/* The asterisk is decoration: `required` on the input is what a screen
   reader announces, so the star itself is hidden from it. */
.req {
  color: var(--danger);
  font-weight: 700;
}

.required-note {
  font-size: 0.8rem;
  color: var(--text-faint);
  margin: 0 0 15px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 15px;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 0.92rem;
  color: var(--text);
  cursor: pointer;
}

.checkbox input {
  margin-top: 3px;
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.checkbox span {
  font-weight: 500;
}

/* ==========================================================================
   Search bar
   ========================================================================== */

.searchbar {
  display: grid;
  grid-template-columns: minmax(200px, 2.2fr) repeat(5, minmax(110px, 1fr)) auto;
  gap: 9px;
  align-items: end;
}

/* The admin-only member filter gets a row of its own under the others. */
.searchbar .searchbar-admin {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 9px;
}

/*
 * Five filters plus the query box and the button stop fitting on one line well
 * above the phone breakpoint, so the filters get a row of their own first.
 * The narrower two-column reflow lives in the consolidated phone block near
 * the end of this file, and wins below 780px by coming later.
 */
@media (max-width: 980px) {
  .searchbar {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .searchbar .search-q,
  .searchbar .search-go {
    grid-column: 1 / -1;
  }
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

thead th {
  text-align: left;
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  font-weight: 700;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface-2);
}

tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: var(--surface-2);
}

td .muted,
.muted {
  color: var(--text-muted);
}

.faint {
  color: var(--text-faint);
}

.nowrap {
  white-space: nowrap;
}

.num {
  font-variant-numeric: tabular-nums;
}

.right {
  text-align: right;
}

/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--text-muted);
}

.badge-out {
  background: var(--info-soft);
  color: var(--info);
}

.badge-overdue {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-returned {
  background: var(--surface-3);
  color: var(--text-muted);
}

.badge-available {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-none {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge-admin {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-due-soon {
  background: var(--warn-soft);
  color: var(--warn);
}

.ref {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-faint);
}

/* ==========================================================================
   Book cards
   ========================================================================== */

.book-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.book-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.book-card .top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.book-card h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
}

.book-card h3 a {
  color: var(--text);
}

.book-card .author {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 2px 0 0;
}

.book-card .meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--text-faint);
  margin-top: auto;
  padding-top: 4px;
}

.book-card .copies {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.book-card .copies strong {
  color: var(--text);
}

/* ==========================================================================
   Book images
   ========================================================================== */

/*
 * Book covers are portrait (roughly 2:3), but a library also collects
 * landscape shots of spines and shelves. `contain` inside a portrait-leaning
 * box shows every image whole — a `cover` crop would slice the top and bottom
 * off a standard cover and hide the title.
 */
.book-cover {
  display: block;
  position: relative;
  margin: -16px -16px 2px;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  background: var(--surface-3);
  aspect-ratio: 3 / 4;
  padding: 8px;
}

.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.book-cover:hover img {
  opacity: 0.92;
}

.cover-count {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(12, 16, 10, 0.72);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 999px;
  backdrop-filter: blur(2px);
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.image-grid-lg {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.image-tile {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
}

.image-tile img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  display: block;
  padding: 6px;
  background: var(--surface-3);
}

.image-grid-lg .image-tile img {
  aspect-ratio: 3 / 4;
  padding: 10px;
}

.image-tile figcaption {
  padding: 7px 9px;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

input[type="file"] {
  width: 100%;
  padding: 9px 11px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

input[type="file"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input[type="file"]::file-selector-button {
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  margin-right: 10px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

input[type="file"]::file-selector-button:hover {
  background: var(--surface-3);
}

/* ==========================================================================
   Flash messages
   ========================================================================== */

.flashes {
  margin-bottom: 18px;
  display: grid;
  gap: 8px;
}

.flash {
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.92rem;
  display: flex;
  gap: 9px;
  align-items: flex-start;
}

.flash-success {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.flash-error {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.flash-info {
  background: var(--info-soft);
  border-color: var(--info);
  color: var(--info);
}

.flash-warning {
  background: var(--warn-soft);
  border-color: var(--warn);
  color: var(--warn);
}

.alert {
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid var(--danger);
  margin-bottom: 15px;
}

.notice {
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid var(--warn);
  margin-bottom: 15px;
}

/* Standing information rather than something gone wrong — amber would
   overstate it. */
.notice-info {
  background: var(--info-soft);
  color: var(--info);
  border-color: var(--info);
}

/* ==========================================================================
   Auth pages
   ========================================================================== */

.auth-wrap {
  max-width: 400px;
  margin: 40px auto;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-lg);
}

.auth-card h1 {
  font-size: 1.4rem;
  margin-bottom: 4px;
}

.auth-card .sub {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 22px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-faint);
  font-size: 0.8rem;
  margin: 18px 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-alt {
  text-align: center;
  margin-top: 18px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Empty states, pagination, misc
   ========================================================================== */

.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--text-muted);
}

.empty .icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 10px;
  opacity: 0.6;
}

.empty h3 {
  color: var(--text);
  margin-bottom: 6px;
}

.empty p {
  margin: 0 auto 14px;
  max-width: 380px;
  font-size: 0.92rem;
}

.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  margin-top: 22px;
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text-muted);
  background: var(--surface);
}

.pagination a:hover {
  background: var(--surface-3);
  text-decoration: none;
  color: var(--text);
}

.pagination .current {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  font-weight: 650;
}

.pagination .disabled {
  opacity: 0.45;
}

.chips {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.chip {
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  font-size: 0.86rem;
  color: var(--text-muted);
  background: var(--surface);
  font-weight: 550;
}

.chip:hover {
  text-decoration: none;
  background: var(--surface-3);
  color: var(--text);
}

.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 18px;
  font-size: 0.92rem;
  margin: 0;
}

.dl dt {
  color: var(--text-faint);
  font-weight: 600;
}

.dl dd {
  margin: 0;
  font-weight: 550;
}

.list-plain {
  list-style: none;
  padding: 0;
  margin: 0;
}

.list-plain li {
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.list-plain li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.hero {
  text-align: center;
  padding: 42px 20px 34px;
}

.hero h1 {
  font-size: 2.1rem;
  margin-bottom: 10px;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.02rem;
  max-width: 520px;
  margin: 0 auto 22px;
}

/* --- Centre branding on the home page ------------------------------------ */

.portal-hero {
  padding-top: 30px;
}

.portal-emblem {
  width: 118px;
  height: auto;
  display: block;
  margin: 0 auto 16px;
}

.portal-org {
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--brand-orange-text);
  margin: 0 0 2px;
  max-width: none;
}

/* Short brand rule under the hero heading, echoing the header stripe. */
.portal-hero h1::after {
  content: "";
  display: block;
  width: 64px;
  height: 3px;
  border-radius: 2px;
  background: var(--brand-orange);
  margin: 14px auto 0;
}

.hero h1 {
  margin-bottom: 12px;
}

/*
 * The portrait sits beside the text at its own aspect ratio — never cropped,
 * never used as a backdrop with text laid over it.
 */
.portal-welcome {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: 24px;
  align-items: center;
}

.portal-portrait {
  margin: 0;
}

.portal-portrait img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

@media (max-width: 720px) {
  .portal-welcome {
    grid-template-columns: 1fr;
  }
  .portal-portrait {
    max-width: 340px;
    margin: 0 auto;
  }
}

/* Numbered because the order is real — you cannot borrow before confirming
   your address. Counters rather than <ol> markers so the digit can sit in the
   accent disc. */
.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 18px;
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

/* Everything real belongs in the text column. Without this a second child
   auto-places under the number instead, and 30px of column wraps the text
   after every word. */
.steps li > * {
  grid-column: 2;
  min-width: 0;
}

.steps li::before {
  content: counter(step);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  justify-content: center;
}

.steps h3 {
  margin: 4px 0 4px;
  font-size: 0.98rem;
}

.steps p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.93rem;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.feature-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.93rem;
  color: var(--text-muted);
}

.feature-list .tick {
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
}

/* ==========================================================================
   Phones and small tablets
   ========================================================================== */

@media (max-width: 780px) {
  /* --- Brand ---------------------------------------------------------------
   * With the links behind the toggle there is room for the centre's name
   * again. It is too long for one line on a phone, so let it wrap rather than
   * truncating or hiding it — the header grows by a line and stays legible.
   */
  .brand-org {
    display: block;
    white-space: normal;
    font-size: 0.82rem;
    line-height: 1.2;
  }

  .brand-sub {
    font-size: 0.66rem;
  }

  .brand {
    flex: 1 1 auto;
    min-width: 0;
    padding: 6px 0;
  }

  /* --- Collapsible menu --------------------------------------------------- */
  .nav-toggle:not([hidden]) {
    display: inline-flex;
  }

  /* Icon only — the word "Menu" costs ~45px that the brand name needs. The
     button keeps its accessible name from aria-label. */
  .nav-toggle-text {
    display: none;
  }

  .nav-toggle {
    min-width: 44px;
    padding: 0 12px;
    flex-shrink: 0;
  }

  .site-header[data-nav="collapsed"] .nav {
    display: none;
  }

  /*
   * The open menu is a dropdown panel, not another flex row.
   *
   * As an in-flow flex item it inherited `flex: 1` from the base rule, whose
   * `flex-basis: 0` overrides `width: 100%` — so it stayed on the header's
   * first line and got squeezed to nothing beside the brand. Taking it out of
   * flow removes that whole class of problem: no sibling can compress it, and
   * the header keeps a constant height whether the menu is open or shut.
   */
  .site-header[data-nav="open"] .nav {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 30;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    padding: 8px 20px 14px;
    max-height: calc(100vh - 72px);
    overflow-y: auto;
  }

  .nav {
    flex: 0 0 auto;
    flex-direction: column;
    align-items: stretch;
    width: auto;
    gap: 2px;
    padding: 6px 0 12px;
  }

  .nav a:not(.btn) {
    /* Comfortable, unambiguous tap targets in the stacked menu. */
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    font-size: 1rem;
  }

  .nav-account {
    margin: 8px 0 0;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
  }

  .nav-account-link {
    min-height: 44px;
    padding: 0 4px;
  }

  .nav-account-name {
    display: inline;
  }

  /* --- Touch targets ------------------------------------------------------ */
  .btn {
    min-height: 44px;
    padding: 10px 18px;
  }

  .btn-sm {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 0.9rem;
  }

  /*
   * 16px is the threshold below which iOS Safari zooms the page when a field
   * receives focus, leaving the user scrolled sideways. Everything that can be
   * typed into has to clear it.
   */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="date"],
  input[type="search"],
  input[type="file"],
  select,
  textarea {
    font-size: 16px;
    padding: 11px 12px;
  }

  .checkbox input {
    width: 20px;
    height: 20px;
  }

  /* --- Tables become stacked cards --------------------------------------- */
  /*
   * Only once JS has copied the column headings onto each cell — without that
   * the labels would be missing, so the table stays scrollable instead.
   */
  .table-scroll table.table-labelled thead {
    display: none;
  }

  .table-scroll table.table-labelled,
  .table-scroll table.table-labelled tbody,
  .table-scroll table.table-labelled tr,
  .table-scroll table.table-labelled td {
    display: block;
    width: 100%;
  }

  .table-scroll table.table-labelled tr {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin: 0 0 10px;
    padding: 6px 12px;
    background: var(--surface);
  }

  .table-scroll table.table-labelled tr:hover {
    background: var(--surface);
  }

  .table-scroll table.table-labelled td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 14px;
    text-align: left;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
  }

  .table-scroll table.table-labelled td:last-child {
    border-bottom: 0;
  }

  /* Cells under a blank heading (action buttons) get no label and full width. */
  .table-scroll table.table-labelled td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 38%;
    color: var(--text-faint);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .table-scroll table.table-labelled td:not([data-label]) {
    justify-content: flex-end;
  }

  .table-scroll table.table-labelled td.right {
    text-align: right;
  }

  /* Give the action buttons room to breathe once stacked. */
  .table-scroll table.table-labelled .btn-row {
    justify-content: flex-end;
  }

  /* --- Search bar --------------------------------------------------------- */
  .searchbar {
    grid-template-columns: 1fr 1fr;
  }

  .searchbar .searchbar-admin {
    grid-template-columns: 1fr;
  }

  .searchbar .search-q,
  .searchbar .search-go {
    grid-column: 1 / -1;
  }

  /* A term like "Staying in control" takes most of the width on a phone and
     leaves its description a sliver, so the pair stacks instead. */
  .dl {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .dl dd:not(:last-child) {
    margin-bottom: 10px;
  }

  /* --- Odds and ends ------------------------------------------------------ */
  .page-head {
    align-items: flex-start;
  }

  h1 {
    font-size: 1.45rem;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .stat .value {
    font-size: 1.55rem;
  }

  .card-pad {
    padding: 16px;
  }
}

@media (max-width: 420px) {
  .wrap {
    padding: 0 14px;
  }

  .searchbar {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Stop a lone button sitting awkwardly beside a wrapped heading. */
  .page-actions .btn {
    flex: 1 1 auto;
  }

  .table-scroll table.table-labelled td[data-label]::before {
    flex-basis: 45%;
  }
}

/* ==========================================================================
   Image picker — camera capture and the editor sheet
   The plain file input is what ships; everything here is switched on by
   public/js/image-picker.js once it knows the browser can support it.
   ========================================================================== */

.image-picker[data-enhanced] > input[type="file"] {
  /* The picker's own buttons drive it from here, and it carries the files. */
  display: none;
}

.image-picker[data-dropping] {
  outline: 2px dashed var(--accent);
  outline-offset: 6px;
  border-radius: var(--radius-sm);
}

.picker-actions {
  margin-bottom: 10px;
}

.picker-count {
  font-size: 0.83rem;
}

.picker-status {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.picker-status-ok {
  color: var(--accent);
}

.picker-status-bad {
  color: var(--danger);
}

.picker-tray {
  margin-top: 4px;
}

.picker-tile-caption {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.picker-tile-actions {
  display: flex;
  gap: 6px;
}

.picker-tile-actions .btn {
  flex: 1 1 0;
}

/* ==========================================================================
   Sheet — the modal the camera and the editor open in
   ========================================================================== */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(12, 16, 10, 0.55);
  overflow-y: auto;
}

body.sheet-open {
  overflow: hidden;
}

.sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 18px;
  width: min(640px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.sheet-title {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.sheet-sub {
  margin: 0 0 14px;
  font-size: 0.88rem;
}

.sheet-actions {
  margin-top: 16px;
}

.camera-frame {
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 10px;
}

.camera-frame video {
  display: block;
  width: 100%;
  max-height: 58vh;
  object-fit: contain;
}

/* ==========================================================================
   Editor — rotate, crop, size
   ========================================================================== */

.editor-stage {
  /* The corner handles sit half outside the crop box, and the box starts flush
     with the photo — so the stage has to be padded by more than that overhang
     or the handles are clipped away exactly where they are grabbed. */
  --stage-pad: 14px;

  position: relative;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--stage-pad);
  display: flex;
  justify-content: center;
  /* Wide and tall photos both have to fit without the sheet scrolling away
     from the tools underneath. */
  max-height: 52vh;
  overflow: hidden;
}

.editor-canvas {
  max-width: 100%;
  max-height: calc(52vh - var(--stage-pad) * 2);
  height: auto;
  display: block;
  touch-action: none;
}

.crop-box {
  position: absolute;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 9999px rgba(12, 16, 10, 0.42);
  cursor: move;
  touch-action: none;
}

/* Nothing is being cropped away yet, so the dimmed surround would just be
   a dark frame around the whole photo. */
.crop-box[data-whole="true"] {
  box-shadow: none;
}

.crop-box:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.crop-handle {
  position: absolute;
  width: 18px;
  height: 18px;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 3px;
  touch-action: none;
}

.crop-handle-nw { top: -10px; left: -10px; cursor: nwse-resize; }
.crop-handle-ne { top: -10px; right: -10px; cursor: nesw-resize; }
.crop-handle-se { bottom: -10px; right: -10px; cursor: nwse-resize; }
.crop-handle-sw { bottom: -10px; left: -10px; cursor: nesw-resize; }

.editor-meta {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.editor-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 4px;
}

.editor-size {
  margin-bottom: 0;
}

.editor-size select {
  max-width: 280px;
}

@media (max-width: 560px) {
  .sheet {
    padding: 14px;
  }

  /* Thumb-sized targets on the corners people actually drag, and room in the
     stage for the extra overhang they bring. */
  .editor-stage {
    --stage-pad: 17px;
  }

  .crop-handle {
    width: 24px;
    height: 24px;
  }

  .crop-handle-nw { top: -13px; left: -13px; }
  .crop-handle-ne { top: -13px; right: -13px; }
  .crop-handle-se { bottom: -13px; right: -13px; }
  .crop-handle-sw { bottom: -13px; left: -13px; }

  .editor-tools .btn {
    flex: 1 1 46%;
  }
}

/* ==========================================================================
   Reviews — star ratings and comments
   ========================================================================== */

/* Stars carry meaning, so they use the readable orange rather than the
   decorative one. */
.stars {
  white-space: nowrap;
  letter-spacing: 1px;
  line-height: 1;
}

.stars-on {
  color: var(--brand-orange-text);
}

.stars-off {
  color: var(--border-strong);
}

.review-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
}

.book-card .rating {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.review-form fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 15px;
  min-width: 0;
}

.review-form legend {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
  padding: 0;
}

/* Rendered 5→1 and reversed, so "this star and every one before it" is a
   plain sibling selector: hovering or checking a star lights those that
   follow it in the DOM, which are the ones to its left on screen. */
.star-input {
  display: inline-flex;
  flex-direction: row-reverse;
  gap: 2px;
}

.review-form .star-input label {
  display: inline-block;
  margin: 0;
  padding: 2px;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--border-strong);
  cursor: pointer;
  transition: color 0.1s;
}

.star-input input:checked ~ label {
  color: var(--brand-orange-text);
}

/* While the pointer is over the stars they preview what a click would give,
   instead of the saved choice, and settle back when it leaves. */
.star-input:hover input:checked ~ label {
  color: var(--border-strong);
}

.star-input:hover label:hover,
.star-input:hover label:hover ~ label {
  color: var(--brand-orange-text);
}

.star-input input:focus-visible + label {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.review-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.review-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.review-list li {
  padding: 15px 20px;
  border-top: 1px solid var(--border);
}

.review-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  font-size: 0.9rem;
}

.review-remove {
  margin-left: auto;
}

.review-comment {
  margin: 8px 0 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
  color: var(--text);
}

@media print {
  .site-header,
  .site-footer,
  .page-actions,
  .nav-toggle,
  .btn {
    display: none !important;
  }
}

/* --- Charts (partials/column-chart.ejs) ----------------------------------- */
.chart {
  position: relative;
  margin: 12px 0 0;
}

.chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

/* Recessive chrome: solid hairlines one step off the surface. */
.chart-grid line {
  stroke: var(--border);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.chart-axis {
  stroke: var(--border-strong);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.chart-tick {
  fill: var(--text-faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.chart-bar {
  fill: var(--chart-series);
}

.chart-hit {
  fill: transparent;
}

/* The hovered column answers: a faint wash behind it, the bar a touch lighter. */
.chart-col:hover .chart-hit {
  fill: var(--surface-3);
}

.chart-col:hover .chart-bar {
  filter: brightness(1.15);
}

.chart-tip {
  position: absolute;
  transform: translate(-50%, calc(-100% - 6px));
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
  font-size: 13px;
}

.chart-tip strong {
  font-size: 16px;
  color: var(--text);
}

.chart-tip span {
  color: var(--text-muted);
}

.chart-table {
  margin-top: 8px;
}

.chart-table summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
}

.chart-table .table-scroll {
  max-height: 320px;
  margin-top: 8px;
}

/* Small multiples: a grid of same-sized single-series charts. */
.charts-2up {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr));
  gap: 16px;
}

.charts-2up .card {
  min-width: 0;
}

/* --- Maintenance notice (views/maintenance.ejs) ------------------------- */
.maintenance {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.maintenance-card {
  max-width: 520px;
  text-align: center;
}

.maintenance-card h1 {
  margin: 12px 0;
}

.maintenance-org {
  color: var(--brand-orange-text);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 8px 0 0;
}

/* The admin's own words; keep their line breaks. */
.maintenance-message {
  white-space: pre-line;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}
