/* ============================================================================
   THE ADMIN PORTAL shell (docs/DESIGN_LANGUAGE.md §2d)
   ----------------------------------------------------------------------------
   Desktop-first by decision (David, 2026-09-07): the Bonfire.com dashboard shape
   he liked on Team Expansion's Pathways console, tried on the camp and retreat
   admin dashboards, adopted, and extended to the super-admin console and to the
   Senders head (2026-09-08). A dark left sidebar that IS the navigation, a light
   ground, white cards in a main + side grid, a promo row of the most-used
   actions, figures inside the card they describe, dense rows with a status
   column, tool tiles. Family- and member-facing pages keep the phone-first
   column; this file is linked ONLY by a head's _AdminLayout.cshtml.

   COLORS COME FROM TOKENS ONLY (brand.css --bfc-*, bf-design.css --bf-*). The
   three aliases below are the only new names, and a per-org theme follows them
   because they point at tokens the theme already overrides. No hex here.
   Below ~900px the sidebar becomes a strip and the grid stacks so a tablet is
   not broken, but the layout is tuned for a laptop and does not pretend otherwise.
   ============================================================================ */

:root {
    --bf-sidebar: var(--bfc-slate-active);       /* the dark rail: primary, deepest */
    --bf-on-sidebar: var(--bf-on-primary);
    --bf-sidebar-mark: var(--bf-accent);          /* the current-page marker on the rail */
    --bf-portal-ground: var(--bfc-surface-sunken);
    --bf-portal-radius: 10px;
}

/* ---- Shell ---------------------------------------------------------------- */
body.bf-portal-body {
    background: var(--bf-portal-ground);
    display: block;                 /* site.css makes body a flex column for the classic footer */
    min-height: 100vh;
    /* The Senders head's site.css reserves 60px under the body for an absolutely-positioned
       footer. The shell carries its own footer inside the main column, so that reservation
       becomes a dead strip of ground below the sidebar — clear it for both heads. */
    margin-bottom: 0;
}
.bf-portal-shell {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    min-height: 100vh;
}

/* ---- Sidebar -------------------------------------------------------------- */
.bf-portal-sidebar {
    background: var(--bf-sidebar);
    color: var(--bf-on-sidebar);
    display: flex;
    flex-direction: column;
    padding: 1.25rem .875rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--bf-on-sidebar) 25%, transparent) transparent;
}
.bf-portal-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .35rem;
    padding: .25rem .75rem 1.1rem;
    color: var(--bf-on-sidebar);
    text-decoration: none;
    border-bottom: 1px solid color-mix(in srgb, var(--bf-on-sidebar) 14%, transparent);
    margin-bottom: .75rem;
}
/* An org logo may be dark artwork; on the dark rail it sits on a light plate. */
.bf-portal-brand img { max-height: 34px; width: auto; background: var(--bf-card); padding: .2rem .45rem; border-radius: 4px; }
.bf-portal-brand-name { font-size: 1.05rem; font-weight: 700; letter-spacing: .02em; line-height: 1.25; }
.bf-portal-brand-area { font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: color-mix(in srgb, var(--bf-on-sidebar) 65%, transparent); }
.bf-portal-brand:hover { text-decoration: none; color: var(--bf-on-sidebar); }

.bf-portal-nav { display: flex; flex-direction: column; gap: .125rem; }
.bf-portal-nav-label {
    margin: .875rem .75rem .25rem;
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--bf-on-sidebar) 55%, transparent);
}
.bf-portal-nav a {
    display: block;
    padding: .5rem .75rem;
    color: color-mix(in srgb, var(--bf-on-sidebar) 86%, transparent);
    font-weight: 600;
    font-size: .9375rem;
    text-decoration: none;
    border-left: 3px solid transparent;
}
.bf-portal-nav a:hover { background: color-mix(in srgb, var(--bf-on-sidebar) 8%, transparent); color: var(--bf-on-sidebar); text-decoration: none; }
.bf-portal-nav a[aria-current="page"] {
    background: color-mix(in srgb, var(--bf-on-sidebar) 14%, transparent);
    border-left-color: var(--bf-sidebar-mark);
    color: var(--bf-on-sidebar);
}
.bf-portal-sub { display: flex; flex-direction: column; margin: .125rem 0 .375rem; }
.bf-portal-sub a {
    padding: .375rem .75rem .375rem 1.625rem;
    font-size: .875rem;
    font-weight: 500;
    color: color-mix(in srgb, var(--bf-on-sidebar) 74%, transparent);
}
.bf-portal-sidebar-foot {
    margin-top: auto;
    padding: 1rem .75rem 0;
    border-top: 1px solid color-mix(in srgb, var(--bf-on-sidebar) 14%, transparent);
    display: flex;
    flex-direction: column;
    gap: .375rem;
    font-size: .875rem;
}
.bf-portal-who { color: color-mix(in srgb, var(--bf-on-sidebar) 70%, transparent); font-size: .8125rem; word-break: break-all; }
.bf-portal-sidebar-foot a { color: color-mix(in srgb, var(--bf-on-sidebar) 70%, transparent); text-decoration: none; }
.bf-portal-sidebar-foot a:hover { color: var(--bf-on-sidebar); text-decoration: underline; }

/* ---- Main column ---------------------------------------------------------- */
.bf-portal-main { display: flex; flex-direction: column; min-width: 0; }
.bf-portal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .625rem 2rem;
    background: var(--bf-card);
    border-bottom: 1px solid var(--bfc-border);
    font-size: .9375rem;
}
.bf-portal-topbar-title { font-weight: 700; color: var(--bfc-slate-active); }
.bf-portal-topbar-links { display: flex; align-items: center; gap: 1.25rem; }
.bf-portal-topbar a { color: var(--bfc-ink); }
.bf-portal-main > main { padding: 1.5rem 2rem 2rem; max-width: 1400px; width: 100%; flex: 1; }
.bf-portal-foot { padding: .75rem 2rem 1rem; color: var(--bfc-ink-muted); font-size: .8125rem; }
.bf-portal-foot a { color: var(--bfc-ink-muted); }

/* A page not yet laid out as a dashboard sits in one white card, so it reads in the same voice. */
.bf-portal-page-card { padding: 1.5rem 2rem 2rem; }
.bf-portal-page-card > h1:first-child, .bf-portal-page-card > h2:first-child { margin-top: 0; }

/* THE CARD IS THE CONTAINER. A page that has not been converted yet brings its own
   Bootstrap `.container` — that is how every module RCL page (Donors, Trips, Learning,
   Expenses) is written, because until 2026-09-08 they only ever rendered inside a head's
   phone-first `_Layout`. Nested inside the card's own padding, that container re-clamps
   the measure and re-adds gutters: measured on /ccm/Donors, a 1126px card handed its
   content 900px, adrift by 113px on each side. Flattening it here fixes every such page
   at once instead of editing ninety files, and it only ever applies to the single-card
   fallback — a dashboard lays out its own cards and is never touched.

   The two !importants are load-bearing, not laziness: Bootstrap's spacing utilities
   (`mt-4`) are themselves !important, and a few pages carry an inline
   `style="max-width: 1080px"` that a plain rule cannot outrank. */
.bf-portal-page-card [class*="container"] {
    max-width: 100% !important;
    padding-left: 0;
    padding-right: 0;
}
.bf-portal-page-card > [class*="container"]:first-child { margin-top: 0 !important; }

/* A slim page header above the cards: what this dashboard is, and its one "other view" link. */
.bf-portal-pagehead { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 0 0 1rem; }
.bf-portal-pagehead h1 { margin: 0; font-size: 1.5rem; font-weight: 700; color: var(--bfc-slate-active); }
.bf-portal-pagehead .bf-portal-pagehead-sub { color: var(--bfc-ink-muted); font-size: .9375rem; margin-left: .5rem; font-weight: 500; }

/* ---- Cards ---------------------------------------------------------------- */
.bf-portal-card {
    background: var(--bf-card);
    border: 1px solid var(--bfc-border);
    border-radius: var(--bf-portal-radius);
    padding: 1.25rem 1.5rem;
    margin: 0 0 1.25rem;
    box-shadow: 0 1px 2px color-mix(in srgb, var(--bfc-ink) 5%, transparent);
}
.bf-portal-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.bf-portal-card-title { margin: 0; font-size: 1.375rem; font-weight: 700; color: var(--bfc-slate-active); }
h2.bf-portal-card-title { font-size: 1.125rem; }
.bf-portal-card-action { font-weight: 600; white-space: nowrap; }
.bf-portal-card-note { color: var(--bfc-ink-muted); font-size: .875rem; }
.bf-portal-card-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
/* The section label inside a card loses its outer margin; the card is the frame. */
.bf-portal-card .bf-section-title { margin: 1rem 0 .5rem; }
.bf-portal-card .bf-section-title:first-child { margin-top: 0; }

/* ---- Grid: main + side ---------------------------------------------------- */
.bf-portal-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
    gap: 1.25rem;
    align-items: start;
}
.bf-portal-col-main, .bf-portal-col-side { min-width: 0; }
/* A dashboard whose main card is a wide table (the retreat families) gives the table the room. */
.bf-portal-grid.bf-portal-wide-main { grid-template-columns: minmax(0, 2.4fr) minmax(280px, 1fr); }

/* ---- Promo row ------------------------------------------------------------ */
.bf-portal-promo-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}
.bf-portal-promo {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    gap: .875rem;
    align-items: start;
    background: var(--bf-card);
    border: 1px solid var(--bfc-border);
    border-radius: var(--bf-portal-radius);
    padding: 1rem 1.125rem;
    color: var(--bfc-ink);
    text-decoration: none;
    box-shadow: 0 1px 2px color-mix(in srgb, var(--bfc-ink) 5%, transparent);
}
.bf-portal-promo:hover { border-color: var(--bf-primary); color: var(--bfc-ink); text-decoration: none; }
.bf-portal-promo:hover .bf-portal-promo-title { text-decoration: underline; }
.bf-portal-promo-text { display: flex; flex-direction: column; gap: .25rem; }
.bf-portal-promo-title { font-weight: 700; font-size: 1.0625rem; color: var(--bfc-slate-active); }
.bf-portal-promo-desc { color: var(--bfc-ink-muted); font-size: .875rem; line-height: 1.4; }
.bf-portal-promo-arrow { color: var(--bfc-ink-muted); font-size: 1.125rem; }
/* Art plates: token-coloured blocks in place of product photography. */
.bf-portal-promo-art { display: block; width: 56px; height: 56px; border-radius: 8px; }
.bf-portal-art-primary { background: color-mix(in srgb, var(--bf-primary) 35%, var(--bf-card)); }
.bf-portal-art-accent  { background: color-mix(in srgb, var(--bf-accent) 85%, var(--bf-primary)); }
.bf-portal-art-danger  { background: color-mix(in srgb, var(--bf-danger) 30%, var(--bf-card)); }
.bf-portal-art-muted   { background: var(--bf-accent-soft); }

/* ---- Figures inside a card ------------------------------------------------ */
.bf-portal-figures {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 2.5rem;
    margin: .5rem 0 .25rem;
}
.bf-portal-figures div { display: flex; flex-direction: column-reverse; }
.bf-portal-figures dt { color: var(--bfc-ink-muted); font-size: .9375rem; font-weight: 500; }
.bf-portal-figures dt a { color: inherit; }
.bf-portal-figures dd { margin: 0; font-size: 1.75rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; color: var(--bfc-slate-active); white-space: nowrap; }
.bf-portal-figures dd.bf-balance-due { color: var(--bf-danger-deep); }
.bf-portal-figures-note { margin: .25rem 0 1rem; color: var(--bfc-ink-muted); font-size: .875rem; }
.bf-portal-figures-note strong { color: var(--bfc-ink); }

/* ---- List with a status column and a gear --------------------------------- */
.bf-portal-list-head, .bf-portal-list-row {
    display: grid;
    grid-template-columns: minmax(9rem, 1fr) 7rem minmax(0, auto);
    gap: 1rem;
    align-items: center;
}
.bf-portal-list-head {
    padding: 0 .25rem .375rem;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--bfc-ink-muted);
    border-bottom: 1px solid var(--bfc-border);
}
.bf-portal-list { list-style: none; margin: 0; padding: 0; }
.bf-portal-list-row { padding: .75rem .25rem; border-bottom: 1px solid var(--bfc-border); }
.bf-portal-list-row:last-child { border-bottom: 0; }
/* The row the page below is ABOUT (the selected retreat event): a soft wash says "you are here". */
.bf-portal-list-row.bf-portal-list-current { background: color-mix(in srgb, var(--bf-accent-soft) 60%, var(--bf-card)); border-radius: 6px; padding-left: .5rem; padding-right: .5rem; }
/* A list without the status column (the org links, the event picker): title + status only. */
.bf-portal-list-plain .bf-portal-list-row { grid-template-columns: minmax(0, 1fr) auto; }
.bf-portal-list-main { display: flex; flex-direction: column; gap: .125rem; min-width: 0; }
.bf-portal-list-title { font-weight: 600; color: var(--bfc-slate-active); }
.bf-portal-list-meta { color: var(--bfc-ink-muted); font-size: .875rem; }
.bf-portal-list-side { text-align: right; font-variant-numeric: tabular-nums; font-size: .9375rem; }
.bf-portal-list-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .375rem; }
.bf-portal-gear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    color: var(--bfc-ink-muted);
    font-size: 1.125rem;
    text-decoration: none;
}
.bf-portal-gear:hover { background: var(--bfc-surface-sunken); color: var(--bfc-ink); text-decoration: none; }
/* Row-scale action links beside the gear. */
.bf-portal-list-actions .bf-btn-sm { min-height: 30px; font-size: .85rem; padding: .15rem .6rem; }

/* ---- Tool tiles ----------------------------------------------------------- */
.bf-portal-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: .75rem;
    margin-bottom: .5rem;
}
.bf-portal-tile {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    padding: .875rem 1rem;
    background: var(--bf-accent-soft);
    border: 1px solid color-mix(in srgb, var(--bf-primary) 25%, transparent);
    border-radius: 8px;
    color: var(--bfc-ink);
    text-decoration: none;
}
.bf-portal-tile:hover { border-color: var(--bf-primary); background: var(--bf-flash); color: var(--bfc-ink); text-decoration: none; }
.bf-portal-tile:hover .bf-portal-tile-title { text-decoration: underline; }
.bf-portal-tile-title { font-weight: 700; color: var(--bfc-slate-active); }
.bf-portal-tile-desc { color: var(--bfc-ink-muted); font-size: .8125rem; line-height: 1.4; }
/* The Nurse Station tile is PHI: a danger edge, the same signal its button always carried. */
.bf-portal-tile.bf-portal-tile-danger { border-color: color-mix(in srgb, var(--bf-danger) 45%, transparent); }
.bf-portal-tile.bf-portal-tile-danger .bf-portal-tile-title { color: var(--bf-danger-deep); }

/* ---- Side column: status card, compact forms, tables ---------------------- */
.bf-portal-status-art { display: block; width: 44px; height: 44px; border-radius: 50%; margin-bottom: .75rem; }
.bf-portal-status-art.is-on  { background: color-mix(in srgb, var(--bfc-success) 45%, var(--bf-card)); }
.bf-portal-status-art.is-off { background: color-mix(in srgb, var(--bfc-warning) 40%, var(--bf-card)); }
.bf-portal-status-card p { margin: 0 0 .75rem; }
.bf-portal-col-side .bf-portal-card { min-width: 0; overflow-wrap: anywhere; }
.bf-portal-col-side .form-label { margin-bottom: .2rem; font-weight: 600; font-size: .9rem; }
/* A table scrolls inside its card; the page never scrolls sideways. */
.bf-portal-scroll { overflow-x: auto; max-width: 100%; margin: .5rem 0 0; }
.bf-portal-scroll > table { margin: 0; min-width: 36rem; }

/* Summary rows reused inside a card (the classic .bf-summary look, framed by the card). */
.bf-portal-card .bf-summary { margin: .5rem 0 1rem; }

/* ---- Narrow screens: a strip, not a broken grid --------------------------- */
@media (max-width: 900px) {
    .bf-portal-shell { grid-template-columns: 1fr; }
    .bf-portal-sidebar { position: static; height: auto; }
    .bf-portal-nav { flex-direction: row; flex-wrap: wrap; gap: .25rem; }
    .bf-portal-nav a { border-left: 0; border-bottom: 3px solid transparent; }
    .bf-portal-nav a[aria-current="page"] { border-bottom-color: var(--bf-sidebar-mark); }
    .bf-portal-nav-label { display: none; }
    .bf-portal-sub { flex-direction: row; flex-wrap: wrap; }
    .bf-portal-sub a { padding-left: .75rem; }
    .bf-portal-sidebar-foot { flex-direction: row; flex-wrap: wrap; gap: 1rem; }
    .bf-portal-grid, .bf-portal-grid.bf-portal-wide-main, .bf-portal-promo-row { grid-template-columns: 1fr; }
    .bf-portal-main > main { padding: 1rem; }
    .bf-portal-topbar { padding: .625rem 1rem; }
    .bf-portal-list-head { display: none; }
    .bf-portal-list-head, .bf-portal-list-row { grid-template-columns: 1fr; gap: .5rem; }
    .bf-portal-list-side { text-align: left; }
    .bf-portal-list-actions { justify-content: flex-start; }
}
