/* ============================================================
   Fundraise Tap — Admin (full-page Laravel build)
   Loaded after hifi.css + hifi-admin.css. Turns the fixed
   1440x900 prototype frame into a responsive full-page shell
   and adds the STATIC page badge.
   ============================================================ */

html, body { height: 100%; }
body { background: var(--surface); }

/* full-page shell: override the fixed prototype frame */
.admin {
  width: 100%;
  height: 100vh;
  flex: none;
  border: 0;
  border-radius: 0;
}

/* centered auth / wizard screens.
   min-height (not height) so a card taller than the viewport — at high zoom,
   or on a short laptop screen — grows the page and scrolls instead of being
   centre-clipped, where the top overflow is unreachable by any scrollbar. */
.admin.auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  height: auto;
  padding: 24px 16px;
  background: var(--surface);
}
.admin.auth.top { align-items: flex-start; }

/* STATIC marker badge — flags pages that are not wired to data yet */
.badge.b-static {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: transparent;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-family: var(--mono);
  font-size: 10px;
}

/* normalise <select> to match the design system (custom chevron, no native arrow) */
select.filter,
select.input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235c6877' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}
select.filter { line-height: 1.2; }
select.filter:hover { border-color: var(--primary); }
select.filter:focus,
select.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* Checkboxes and radios in the brand navy rather than the browser's own blue,
   which was the one control on the page still painted by the operating system.
   accent-color rather than a hand-built control: the native input keeps its
   keyboard behaviour, its screen-reader role and its indeterminate state, and
   a replacement would have to reimplement all three to gain nothing but a
   colour. Size is left alone — several forms position their checkbox against
   wrapped text by hand, and resizing would knock those out of alignment. */
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--primary);
  cursor: pointer;
}
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
input[type="checkbox"]:disabled,
input[type="radio"]:disabled { cursor: not-allowed; opacity: .55; }

/* saved billing card visual */
.pay-card {
  width: 300px;
  border-radius: 14px;
  padding: 18px 20px 16px;
  background: linear-gradient(135deg, var(--primary), #0e2e4f);
  color: #fff;
  box-shadow: var(--el-pop);
  position: relative;
  overflow: hidden;
}
.pay-card::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .06);
}
.pay-card .pc-top { display: flex; align-items: center; justify-content: space-between; }
.pay-card .pc-chip { width: 32px; height: 22px; border-radius: 5px; background: linear-gradient(135deg, #e7c873, #c9a13b); }
.pay-card .pc-brand { font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: 14px; }
.pay-card .pc-num { font-family: var(--mono); font-size: 17px; letter-spacing: 2px; margin: 22px 0 14px; }
.pay-card .pc-meta { display: flex; justify-content: space-between; font-size: 11px; opacity: .85; text-transform: uppercase; letter-spacing: .04em; }
.pay-card .pc-meta b { font-weight: 600; font-size: 13px; letter-spacing: .5px; }

/* button loading spinner (shown on form submit) */
.btn-spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: -2px;
  margin-right: 8px;
}

/* full-page submit veil for slow actions (e.g. charity create → Stripe) */
.page-loading {
  position: fixed;
  inset: 0;
  background: rgba(247, 248, 250, .72);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  z-index: 2000;
}
.page-loading.on { display: flex; }
.page-loading .spin { width: 48px; height: 48px; }
.page-loading .msg { font-size: 14px; color: var(--text-muted); font-weight: 600; }

/* plan picker pills (Add-Charity wizard) */
.plan-radio { position: absolute; opacity: 0; width: 0; height: 0; }
.plan-radio:checked + .plan-label { background: var(--primary); color: #fff; border-color: var(--primary); }
.plan-radio:focus-visible + .plan-label { box-shadow: 0 0 0 3px var(--primary-soft); }

/* wizard stepper */
.stepper { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 24px; }
.stepper .st { display: flex; align-items: center; gap: 8px; }
.stepper .st .num { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; background: var(--surface); color: var(--text-subtle); }
.stepper .st.on .num, .stepper .st.done .num { background: var(--primary); color: #fff; }
.stepper .st .lbl { font-size: 14px; color: var(--text-subtle); }
.stepper .st.on .lbl { color: var(--text); font-weight: 600; }
.stepper .sep { width: 40px; height: 1px; background: var(--border); margin: 0 6px; }

/* flash notifications */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 11px 14px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.4;
}
.flash .flash-k {
  flex: none;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  border: 1px solid currentColor;
  border-radius: 4px;
  padding: 1px 6px;
  opacity: .85;
}
.flash .flash-msg { flex: 1; }
.flash .flash-x {
  flex: none;
  background: none;
  border: 0;
  color: inherit;
  opacity: .55;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  line-height: 1;
}
.flash .flash-x:hover { opacity: 1; }
.flash-success { background: var(--success-soft); border-color: #bfe3cd; color: #15703f; }
.flash-error   { background: var(--error-soft);   border-color: #e9b8b8; color: var(--error); }
.flash-info    { background: var(--info-soft);    border-color: #cfe0f1; color: #1f4a78; }
.flash-warning { background: var(--warning-soft); border-color: #ecd9a6; color: #8a6312; }

/* chart bar hover tooltip */
.chart-bars .bar { cursor: pointer; outline: none; }
.chart-bars .bar:hover, .chart-bars .bar:focus-visible { filter: brightness(1.08); }
.chart-bars .bar .bar-tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--primary);
  color: #fff;
  border-radius: var(--r-sm);
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  text-align: center;
  box-shadow: var(--el-pop);
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s, transform .12s;
  z-index: 5;
}
.chart-bars .bar .bar-tip span { display: block; opacity: .8; font-size: 11px; }
.chart-bars .bar .bar-tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--primary);
}
.chart-bars .bar:hover .bar-tip,
.chart-bars .bar:focus-visible .bar-tip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* a thin banner used at the top of each page body */
.static-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--warning-soft);
  border: 1px dashed var(--warning);
  color: #8a6312;
  border-radius: var(--r-sm);
  padding: 8px 14px;
  font-size: 12px;
  margin-bottom: 22px;
}
.static-banner .badge { flex: none; }

/* ============================================================
   Responsive — the shell was a fixed 1440x900 prototype with no
   breakpoints at all. Three steps down:
     <=1100px  sidebar becomes an off-canvas drawer (hamburger)
     <=900px   top bar stacks, multi-column grids halve, tables scroll
     <=600px   single column throughout, tighter padding
   ============================================================ */

/* Hamburger is desktop-hidden; the drawer machinery only exists below 1100px. */
.admin-nav .nav-brand { display: none; }
.nav-toggle {
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: none; margin-right: 2px;
  border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--nav-text); cursor: pointer;
}
.nav-toggle:hover { background: var(--nav-hover-bg); }
.nav-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.nav-toggle svg { width: 22px; height: 22px; }

@media (max-width: 1100px) {
  .admin {
    grid-template-columns: 1fr;
    grid-template-rows: 60px auto 1fr;
    grid-template-areas: "brand" "topbar" "main";
  }
  .admin-brand { border-right: 0; gap: 8px; padding: 0 14px; }
  .nav-toggle { display: inline-flex; }

  /* Drawer: fixed so it overlays content instead of reflowing it. */
  .admin-nav {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 120;
    width: 270px; max-width: 84vw;
    border-right: 1px solid var(--nav-border);
    box-shadow: var(--el-modal);
    transform: translateX(-100%);
    transition: transform .22s ease;
    overflow-y: auto;
  }
  .admin.nav-open .admin-nav { transform: none; }

  /* Drawer gets its own brand row — the header logo is behind the overlay. */
  .admin-nav .nav-brand { display: flex; align-items: center; padding: 4px 6px 14px; margin-bottom: 4px; border-bottom: 1px solid var(--nav-border); }
  .admin-nav .nav-brand img { height: 26px; width: auto; object-fit: contain; display: block; }
  .nav-backdrop {
    position: fixed; inset: 0; z-index: 110;
    background: rgba(20, 59, 99, .38);
  }
  .admin-top { padding: 10px 16px; gap: 10px; flex-wrap: wrap; height: auto; min-height: 56px; }
  .admin-main-inner { padding: 24px 16px; }
}

/* Wide tables scroll inside their card rather than overflowing the page.
   Applies at every width: with the sidebar open, the content column can be
   too narrow for all columns (e.g. Donations) even on desktop viewports, and
   the inline overflow:hidden on the card would clip the last column (Status)
   with no way to reach it. !important overrides that inline style. */
.card:has(> .tbl) { overflow-x: auto !important; }

/* ============================================================
   Public donation page (TASK 21)
   Mobile-first: a single readable column that grows into a
   centred card. Most donors arrive on a phone from a QR code
   or a link, so the narrow layout is the base and the desktop
   one is the enhancement.
   ============================================================ */
.donate-body {
  margin: 0;
  background: var(--surface);
  font-family: 'Bricolage Grotesque', system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  /* No sideways scroll at any width. */
  overflow-x: hidden;
}
.donate { max-width: 560px; margin: 0 auto; padding: 28px 16px 40px; }
.donate-narrow { max-width: 460px; }

/* The page hides and shows sections with the `hidden` attribute, which the UA
   implements as a plain `display: none` — and every class rule below (.field,
   .donate-check with display:flex, …) outranks it. Without this the custom
   amount box, the Gift Aid address fields and the payment step are all visible
   from the start. */
.donate [hidden] { display: none !important; }

.donate-head { text-align: center; margin-bottom: 20px; }
.donate-logo { max-height: 60px; max-width: 200px; width: auto; object-fit: contain; margin: 0 auto 14px; display: block; }
.donate-title { font-size: 25px; line-height: 1.2; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.donate-site { display: inline-block; margin-top: 6px; font-size: 13px; color: var(--text-muted); }

.donate-card {
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  padding: 22px 20px; box-shadow: 0 6px 24px rgba(20, 59, 99, .07);
}

/* ---- Frequency ---- */
.donate-freq {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  background: var(--surface); border-radius: 10px; padding: 4px; margin-bottom: 22px;
}
.donate-freq-opt { position: relative; }
.donate-freq-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.donate-freq-opt span {
  display: block; text-align: center; padding: 10px 8px; border-radius: 8px;
  font-size: 14px; font-weight: 600; color: var(--text-muted); cursor: pointer;
}
.donate-freq-opt input:checked + span { background: #fff; color: var(--donate-primary); box-shadow: 0 1px 3px rgba(0, 0, 0, .09); }
.donate-freq-opt input:focus-visible + span { outline: 2px solid var(--donate-primary); outline-offset: 2px; }

/* ---- Amounts ---- */
.donate-amounts { border: 0; padding: 0; margin: 0 0 6px; }
.donate-label { font-size: 14px; font-weight: 600; padding: 0; margin-bottom: 10px; }
/* auto-fit, so 3 / 6 / 12 tiles all lay out sensibly without the count
   being written into the CSS (TASK 19 made it variable). */
.donate-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 8px; }
.donate-tile { position: relative; }
.donate-tile input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.donate-tile span {
  display: block; text-align: center; padding: 14px 6px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 16px; font-weight: 600; cursor: pointer; transition: border-color .12s, background .12s;
}
.donate-tile input:checked + span {
  border-color: var(--donate-primary); background: var(--donate-primary); color: #fff;
}
.donate-tile input:focus-visible + span { outline: 2px solid var(--donate-primary); outline-offset: 2px; }
.donate-tile-other span { font-size: 14px; }
.donate-custom { margin-top: 12px; }

/* ---- Checkboxes and details ---- */
.donate-check {
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: 16px; padding: 12px 14px;
  background: var(--surface); border-radius: 10px;
  font-size: 13px; line-height: 1.5; cursor: pointer;
}
.donate-check input { margin-top: 2px; flex: none; }
.donate-details { margin-top: 20px; }
.donate-details .field { margin-bottom: 14px; }
.donate-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.donate-hint-inline { font-weight: 400; color: var(--text-subtle); font-size: 12px; }

/* ---- Actions ---- */
.donate-submit {
  display: block; width: 100%; margin-top: 20px; padding: 15px 20px;
  background: var(--donate-primary); color: #fff; border: 0; border-radius: 10px;
  font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; text-align: center; text-decoration: none;
}
.donate-submit:hover:not(:disabled) { filter: brightness(1.08); }
.donate-submit:disabled { opacity: .6; cursor: default; }
.donate-submit-alt { background: transparent; color: var(--donate-primary); border: 1.5px solid var(--donate-primary); }
.donate-back {
  display: block; width: 100%; margin-top: 10px; padding: 10px;
  background: none; border: 0; font: inherit; font-size: 13px; color: var(--text-muted); cursor: pointer;
}

.donate-summary {
  padding: 12px 14px; margin-bottom: 16px;
  background: var(--surface); border-radius: 10px;
  font-size: 15px; font-weight: 600; text-align: center;
}
.donate-error {
  margin: 14px 0 0; padding: 11px 14px; border-radius: 8px;
  background: var(--error-soft); color: var(--error); font-size: 13px; line-height: 1.5;
}
.donate-secure {
  display: flex; align-items: center; justify-content: center; gap: 7px; flex-wrap: wrap;
  margin: 18px 0 0; font-size: 12px; line-height: 1.5; color: var(--text-subtle); text-align: center;
}

/* ---- Thank you ---- */
.donate-thanks { text-align: center; }
.donate-tick {
  width: 54px; height: 54px; margin: 4px auto 14px; border-radius: 50%;
  background: var(--success-soft); color: var(--success);
  font-size: 27px; line-height: 54px; font-weight: 700;
}
.donate-thanks-lead { font-size: 15px; line-height: 1.6; margin: 10px 0 0; }
.donate-thanks-ga { font-size: 14px; line-height: 1.6; color: var(--success); margin: 10px 0 0; }
.donate-ref { font-size: 12px; color: var(--text-subtle); margin: 14px 0 0; }

/* ---- Footer ---- */
.donate-foot { margin-top: 22px; text-align: center; font-size: 12px; line-height: 1.6; color: var(--text-subtle); }
.donate-foot p { margin: 0 0 6px; }
.donate-powered { color: var(--text-subtle); }

/* ---- Desktop: a little more room, nothing structural ---- */
@media (min-width: 600px) {
  .donate { padding: 44px 20px 56px; }
  .donate-card { padding: 30px 28px; }
  .donate-title { font-size: 29px; }
}

/* ---- Very narrow phones: keep the two-up fields from cramping ---- */
@media (max-width: 380px) {
  .donate-two { grid-template-columns: 1fr; }
  .donate-tiles { grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); }
}

/* ============================================================
   Sign-in screen (TASK 20)
   Two columns on desktop — a branded panel and the form — and
   one column below the tablet breakpoint, where the panel
   becomes a slim header so the form stays above the fold.
   ============================================================ */
.signin {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  width: 100%;
  max-width: 1040px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(20, 59, 99, .10);
}

/* ---- Brand panel ---- */
.signin-brand {
  /* The navy brand scale, not the warm nav surface: this is product
     marketing rather than chrome. */
  background: linear-gradient(160deg, var(--primary) 0%, #0e2e4f 100%);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 48px 44px;
}
.signin-brand-inner { max-width: 380px; }
/* The mark is dark-on-light artwork, so it is knocked out to white here
   rather than sitting in a light box on the gradient. */
.signin-logo { height: 30px; width: auto; display: block; margin-bottom: 32px; filter: brightness(0) invert(1); }
.signin-tagline { font-size: 34px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; margin: 0 0 16px; }
.signin-blurb { font-size: 15px; line-height: 1.6; margin: 0 0 24px; color: rgba(255, 255, 255, .82); }
.signin-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.signin-points li {
  position: relative; padding-left: 26px;
  font-size: 14px; line-height: 1.5; color: rgba(255, 255, 255, .92);
}
.signin-points li::before {
  content: ""; position: absolute; left: 0; top: 6px;
  width: 14px; height: 8px;
  border-left: 2px solid rgba(255, 255, 255, .85);
  border-bottom: 2px solid rgba(255, 255, 255, .85);
  transform: rotate(-45deg);
}

/* ---- Form side ---- */
.signin-main { display: flex; flex-direction: column; justify-content: center; padding: 44px 44px 32px; }
.signin-card { width: 100%; max-width: 400px; margin: 0 auto; }
.signin-head { margin-bottom: 24px; }
.signin-logo-sm { display: none; height: 28px; width: auto; margin: 0 0 18px; }
.signin-title { font-size: 26px; font-weight: 700; letter-spacing: -.01em; margin: 0; color: var(--text); }
.signin-sub { font-size: 14px; color: var(--text-muted); margin: 6px 0 0; line-height: 1.5; }

.signin-form .field { margin-bottom: 16px; }
.signin-optional { font-weight: 400; color: var(--text-subtle); font-size: 12px; }

.signin-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 20px; }
.signin-remember { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); cursor: pointer; }
.signin-link { font-size: 13px; color: var(--text-muted); text-decoration: none; }
.signin-link:hover { color: var(--primary); text-decoration: underline; }

.signin-error,
.signin-note {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--r-sm);
  font-size: 13px; line-height: 1.5; margin-bottom: 18px;
}
.signin-error { background: var(--error-soft); color: var(--error); }
.signin-note { background: var(--success-soft); color: var(--success); }

/* Rule with the label sitting in the gap. */
.signin-divider { display: flex; align-items: center; gap: 12px; margin: 24px 0 16px; }
.signin-divider::before,
.signin-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.signin-divider span { font-size: 12px; color: var(--text-subtle); white-space: nowrap; }

.signin-providers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.signin-passkey { margin-top: 10px; }
.signin-passkey-msg { display: none; font-size: 13px; color: var(--error); text-align: center; margin: 10px 0 0; }

/* Pricing — visible without competing with the sign-in button. Its own
   tinted block below the form rather than a link lost among the others. */
.signin-pricing {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 24px; padding: 14px 16px;
  background: var(--primary-soft); border-radius: var(--r-sm);
}
.signin-pricing-text { font-size: 13px; color: var(--text-muted); }

.signin-foot {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px;
  margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border);
}
.signin-dot { color: var(--border); }
.signin-copyright { text-align: center; font-size: 12px; color: var(--text-subtle); margin: 22px 0 0; }

/* ---- Tablet: one column, brand panel becomes a header strip ---- */
@media (max-width: 900px) {
  .signin { grid-template-columns: 1fr; max-width: 480px; }
  /* The tagline and bullet list are the first thing that should go — on a
     narrow screen the form is what someone came for. */
  .signin-brand { padding: 26px 28px; }
  .signin-brand-inner { max-width: none; text-align: center; margin: 0 auto; }
  .signin-logo { margin: 0 auto 12px; }
  .signin-tagline { font-size: 22px; }
  .signin-tagline br { display: none; }
  .signin-blurb, .signin-points { display: none; }
  .signin-main { padding: 32px 28px 26px; }
}

/* ---- Phone: drop the brand strip entirely, logo moves above the form ---- */
@media (max-width: 560px) {
  .signin { border: 0; border-radius: 12px; box-shadow: 0 8px 28px rgba(20, 59, 99, .08); }
  .signin-brand { display: none; }
  .signin-logo-sm { display: block; }
  .signin-main { padding: 28px 20px 22px; }
  .signin-title { font-size: 23px; }
  /* Stacked, so neither provider button truncates its label. */
  .signin-providers { grid-template-columns: 1fr; }
  .signin-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  /* Full-width and stacked: side by side, the button wraps its own label at
     ~320px, which is what "broken spacing" looks like. */
  .signin-pricing { flex-direction: column; align-items: stretch; text-align: center; }
  .signin-pricing .btn { justify-content: center; }
}

/* No horizontal scrolling at any width — the ticket's explicit requirement.
   The sign-in card is the only wide thing on this page, so it is capped to
   the viewport rather than relying on its max-width alone. */
.admin.auth { max-width: 100vw; overflow-x: hidden; }
.signin { max-width: min(1040px, 100%); }
/* max-width only — `height: auto` here would outrank .signin-logo's own
   height (class+element beats class) and blow the logos up to full size. */
.signin img { max-width: 100%; }

/* ============================================================
   Donation amount rows (Branding → Donation settings)
   A wrapping row of narrow inputs rather than a fixed grid, so
   the list can be any length from one to the maximum.
   ============================================================ */
.amount-rows { display: flex; flex-wrap: wrap; gap: 8px; }
.amount-row { display: flex; align-items: center; gap: 2px; }
.amount-row .input-currency { width: 104px; }
.amount-row .amount-remove { padding: 0 6px; min-width: 0; color: var(--text-subtle); }
.amount-row .amount-remove:hover:not(:disabled) { color: var(--error); }
.amount-row .amount-remove:disabled { opacity: .3; cursor: not-allowed; }

/* ============================================================
   Dashboard panels — shared chrome
   One head rule for every card-with-a-title panel below, so they
   cannot drift apart as more are added.
   ============================================================ */
.panel-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
}

/* ============================================================
   Receipt box (donation detail)
   ============================================================ */
.rb-panel { padding: 0; overflow: hidden; }
.rb-body { padding: 20px 24px; }
/* Capped rather than full-width: an email field stretched across the page
   invites a wall of text and reads as a bulk-send form, which it is not. */
.rb-form { max-width: 460px; }
.rb-hint { margin: 6px 0 0; }
.rb-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

@media (max-width: 760px) {
  .rb-body { padding-left: 16px; padding-right: 16px; }
  .rb-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* ============================================================
   Refund & cancellation history (donation detail)
   ============================================================ */
.rh-panel { padding: 0; overflow: hidden; }
.rh-empty { padding: 24px; }
.rh-list { list-style: none; margin: 0; padding: 0; }
.rh-item { padding: 20px 24px; }
.rh-item + .rh-item { border-top: 1px solid var(--border); }

.rh-item-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rh-amount { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rh-when { margin-left: auto; font-size: 12px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }

.rh-actor { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 12px 0 0; font-size: 14px; }
/* The reason is quoted because it is somebody's words, not our summary. */
.rh-reason { margin: 8px 0 0; font-size: 14px; font-style: italic; }
.rh-failure { margin: 8px 0 0; color: var(--error); }

/* Fixed-width columns rather than a grid of equal thirds: the two money
   figures are short and the two Stripe references are long. */
.rh-facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 20px; margin: 14px 0 0;
  padding-top: 14px; border-top: 1px dashed var(--border);
}
.rh-facts dt { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-subtle); }
.rh-facts dd { margin: 3px 0 0; font-size: 13px; overflow-wrap: anywhere; }

/* ---- The refund form on the donation header ---- */
/* <details> so the reason field is out of the way until wanted, but the
   whole thing stays on the page — no second route, no modal plumbing. */
.refund-box { position: relative; }
.refund-box > summary { list-style: none; cursor: pointer; }
.refund-box > summary::-webkit-details-marker { display: none; }
.refund-box > form {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30;
  width: 320px; text-align: left;
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: var(--el-card); padding: 16px;
}
.refund-box-note { margin: 0 0 10px; }
.refund-box .field { margin-bottom: 10px; }
.refund-box textarea.input { min-height: 72px; resize: vertical; }

@media (max-width: 760px) {
  .rh-item, .rh-empty { padding-left: 16px; padding-right: 16px; }
  .rh-when { margin-left: 0; width: 100%; }
  /* A 320px popover anchored right runs off a phone screen — inline it. */
  .refund-box > form { position: static; width: 100%; margin-top: 8px; }
}

/* ============================================================
   Last 10 Donations (dashboard)
   ============================================================ */
.rd-panel { padding: 0; overflow: hidden; }
.rd-empty { padding: 28px 24px; margin: 0; }
/* The panel's own table has no card padding to fight, and its last row
   should not draw a border against the card edge. */
.rd-table tbody tr:last-child td { border-bottom: 0; }
.rd-table td, .rd-table th { padding-left: 24px; padding-right: 24px; }
.rd-table td:not(:first-child), .rd-table th:not(:first-child) { padding-left: 0; }
/* The row is clickable, but this is the real link on it — styled as
   ordinary text so the row still reads as one target. */
.rd-link { color: inherit; text-decoration: none; font-variant-numeric: tabular-nums; }
.rd-link:hover { text-decoration: underline; }
.rd-amount { font-weight: 600; font-variant-numeric: tabular-nums; }
/* Refunded: the amount is struck through as well as the row being tinted.
   The money left again, and the figure should not read as a total. */
.rd-amount.is-struck { text-decoration: line-through; color: var(--text-muted); font-weight: 500; }

@media (max-width: 760px) {
  .rd-table td, .rd-table th { padding-left: 16px; padding-right: 16px; }
  .rd-table td:not(:first-child), .rd-table th:not(:first-child) { padding-left: 0; }
  .panel-head { padding-left: 16px; padding-right: 16px; }
}

/* ============================================================
   Most-used payment types (dashboard)
   A ranked bar list rather than a pie: the question is "which is
   used most", which is an ordering, and a pie makes similar
   shares almost impossible to rank by eye.
   ============================================================ */
.ct-panel { padding: 0; overflow: hidden; }
/* As .panel-head, but the coverage badge sits beside a two-line title. */
.ct-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
}
.ct-empty { padding: 28px 24px; margin: 0; }
.ct-list { list-style: none; margin: 0; padding: 8px 0; }

/* Fixed columns so labels, counts and amounts line up down the list;
   only the bar flexes. */
.ct-row {
  display: grid; align-items: center; gap: 14px;
  grid-template-columns: minmax(120px, 1fr) minmax(60px, 3fr) 52px 52px 96px;
  padding: 9px 24px;
}
.ct-label { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-bar { height: 8px; border-radius: 999px; background: var(--surface); overflow: hidden; }
.ct-fill { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.ct-count { font-size: 13px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.ct-share, .ct-amount { font-size: 12px; color: var(--text-muted); text-align: right; font-variant-numeric: tabular-nums; }

/* Unknown is the absence of an answer, so it is greyed rather than
   coloured like a real type — it should never read as a brand. */
.ct-row.is-unknown .ct-label { font-weight: 500; color: var(--text-muted); }
.ct-row.is-unknown .ct-fill { background: var(--border); }

.ct-sub { padding: 4px 24px 16px; border-top: 1px solid var(--border); margin-top: 8px; }
.ct-sub-head { margin: 14px 0 10px; font-weight: 600; }
.ct-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.ct-chip {
  font-size: 12px; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px;
}
.ct-chip b { color: var(--text); font-weight: 600; }
.ct-chip.is-unknown { border-style: dashed; }
.ct-note { padding: 0 24px 18px; margin: 0; }

@media (max-width: 760px) {
  /* The bar is the first thing to go: the numbers carry the meaning. */
  .ct-row { grid-template-columns: 1fr 52px 52px; }
  .ct-bar, .ct-amount { display: none; }
  .ct-head, .ct-row, .ct-empty, .ct-sub, .ct-note { padding-left: 16px; padding-right: 16px; }
}

/* ============================================================
   Last 10 Activities panel (dashboard)
   Rows are anchors, so the hit target is the whole row and the
   list is keyboard-navigable — the padding lives on the <a>,
   not the <li>, or only the text would be clickable.
   ============================================================ */
.act-panel { padding: 0; overflow: hidden; }
/* Identical to .panel-head; kept as its own selector so existing markup
   need not change, and shares the rule rather than repeating it. */
.act-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 18px 24px; border-bottom: 1px solid var(--border); }
.act-list { list-style: none; margin: 0; padding: 0; }
.act-list > li + li { border-top: 1px solid var(--border); }
.act-empty { padding: 28px 24px; margin: 0; }

.act-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 24px; text-decoration: none; color: inherit;
}
.act-row:hover { background: var(--primary-soft); }
.act-row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

/* Tone-coloured icon chip — the same success/error language the tables use. */
.act-ic {
  flex: none; display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--surface); color: var(--text-muted);
}
.act-success .act-ic { background: var(--success-soft); color: var(--success); }
.act-error   .act-ic { background: var(--error-soft);   color: var(--error); }
.act-info    .act-ic { background: var(--info-soft);    color: var(--info); }

/* min-width:0 so a long donor email ellipsises instead of stretching the row. */
.act-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.act-title { font-size: 14px; font-weight: 600; }
.act-meta {
  font-size: 12px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.act-when { flex: none; font-size: 12px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.act-chev { flex: none; color: var(--text-subtle); }

@media (max-width: 600px) {
  .act-head, .act-row, .act-empty { padding-left: 16px; padding-right: 16px; }
  /* The chevron is decorative once the row is the full width of the screen. */
  .act-chev { display: none; }
}

/* Users who asked for less motion get the drawer without the slide. */
@media (prefers-reduced-motion: reduce) {
  .admin-nav { transition: none; }
}

@media (max-width: 900px) {
  .admin-top { flex-direction: column; align-items: stretch; }
  .admin-top > .row { justify-content: flex-start; flex-wrap: wrap; }

  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .conn-grid { grid-template-columns: repeat(2, 1fr); }
  .report-grid, .link-grid { grid-template-columns: 1fr; }
  .ga-grid, .ga-form-grid { grid-template-columns: repeat(2, 1fr); }

  /* Keep columns readable once the card scrolls (rule lives above the
     media queries so it also covers narrow desktop content columns). */
  .tbl { min-width: 700px; }

  /* Fixed-width detail sidebars become full width. */
  .row.gap24 > .col[style*="width:340px"] { width: 100% !important; }
  .row.gap24 { flex-wrap: wrap; }
}

@media (max-width: 600px) {
  .admin { grid-template-rows: 56px auto 1fr; }
  .admin-main-inner { padding: 18px 12px; }
  .kpi-row, .conn-grid, .ga-grid, .ga-form-grid { grid-template-columns: 1fr; }
  .filter-bar { --ctl-h: 42px; }
  .filter-bar .search { min-width: 100%; }
  .t-display { font-size: 32px; line-height: 40px; }
  .t-h1 { font-size: 24px; line-height: 32px; }
  .admin-foot { flex-direction: column; align-items: flex-start; gap: 8px; }
  /* Keep the signed-in name visible even on the narrowest screens (FE-08) —
     the name ellipsises rather than dropping out. Role and address do drop:
     the three-line chip from the client's reference does not fit a phone bar,
     so they reappear in the panel head, which has the room for them. */
  .user-chip { max-width: 150px; padding-right: 8px; }
  .user-chip-meta { display: flex; }
  .user-menu > summary { max-width: 160px; }
  .user-menu > summary .user-chip-name { overflow: hidden; text-overflow: ellipsis; }
  .user-menu > summary .user-chip-role,
  .user-menu > summary .user-chip-mail { display: none; }
  .user-menu-head { display: flex; }
  /* A flyout anchored to the right of the panel opens off the edge of a phone.
     Inline accordion instead — same markup, same click, no horizontal scroll. */
  .acct-support .nav-support-items {
    position: static; min-width: 0; margin: 2px 0 4px 23px; padding-left: 8px;
    border: 0; border-left: 1px solid var(--border); border-radius: 0; box-shadow: none;
  }
  /* The dropdown is anchored to the right of a narrow screen, so cap it to the
     viewport instead of letting it push a horizontal scrollbar. */
  .user-menu-items { min-width: 0; width: max-content; max-width: calc(100vw - 24px); }
  /* Label drops to a dot — the colour is the message. Clipped rather than
     display:none, or the link loses its accessible name entirely. */
  .tfa-status { padding: 5px 8px; }
  .tfa-status span:not(.tfa-dot) {
    display: inline-block; width: 1px; height: 1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .ga-card, .report-card, .link-card, .ga-form { padding: 18px; }
}
