/* Staff dashboard. --brand and --accent come from the church (see base.html). */
:root {
  --brand: #7A1B1E; --accent: #C5A028;
  --bg: #f7f3ec; --surface: #fffdf9; --ink: #1f1b18; --ink-2: #4b4540; --muted: #7a716a; --line: #e7dfd3;
  --good: #2f7a4b; --good-bg: #e6f2ea; --warning: #9a6a00; --warning-bg: #fbf0d6; --critical: #a4262c; --critical-bg: #f9e3e2;
  --r: 12px; --serif: "Playfair Display", Georgia, serif; --sans: "Inter", "Noto Sans Ethiopic", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font: 700 clamp(1.7rem, 3vw, 2.2rem)/1.15 var(--serif); }
h2 { font: 600 1.05rem/1.3 var(--sans); margin-bottom: 14px; }
small { display: block; color: var(--muted); font-size: .82rem; }
.muted { color: var(--muted); }
.ge { font-family: "Noto Sans Ethiopic", var(--sans); }
.link { background: none; border: 0; color: var(--brand); font-weight: 600; font-size: .88rem; cursor: pointer; }
.link:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Shell */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--brand); color: #fff; padding: 22px 16px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--accent); }
.church { display: flex; gap: 12px; align-items: center; padding: 4px 6px; }
.church img, .church .mono { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: rgba(255,255,255,.12); border: 2px solid var(--accent); }
.church .mono { display: grid; place-items: center; font: 700 1.2rem var(--serif); color: var(--accent); }
.church b { display: block; font: 600 .98rem/1.25 var(--serif); }
.church small { color: rgba(255,255,255,.7); }
.switch select { width: 100%; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 8px; padding: 8px; }
.switch option { color: var(--ink); }
.side nav { display: grid; gap: 2px; }
.side nav a { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 8px; color: rgba(255,255,255,.82); font-weight: 500; }
.side nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.side nav a[aria-current="page"] { background: rgba(255,255,255,.14); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.side nav a.subtle { font-size: .85rem; opacity: .8; margin-top: 8px; }
.count { background: var(--accent); color: var(--ink); font-size: .74rem; font-weight: 700; min-width: 22px; height: 22px; border-radius: 11px; display: grid; place-items: center; padding: 0 6px; }
.me { margin-top: auto; padding: 14px 12px 0; border-top: 1px solid rgba(255,255,255,.16); display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .88rem; }
.me small { color: rgba(255,255,255,.6); }
.me .link { color: var(--accent); white-space: nowrap; }
.me > span { min-width: 0; overflow-wrap: anywhere; }
.site { font-size: .82rem; color: rgba(255,255,255,.7); padding: 0 12px; }
.site:hover { color: #fff; }
.main { padding: 32px clamp(16px, 3vw, 40px) 60px; max-width: 1200px; width: 100%; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-content: start; }
.menu-btn { display: none; }
@media (min-width: 861px) and (max-width: 1100px) { .shell { grid-template-columns: 208px 1fr; } .side { padding: 20px 10px; } }
@media (max-width: 860px) {
  /* Phones and tablets held upright: the sidebar becomes a top bar with a Menu button that opens the whole menu
     (dashboard.js toggles .open). minmax(0, 1fr) keeps wide content from widening the page. */
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .side { position: sticky; top: 0; z-index: 5; height: auto; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; gap: 10px;
          display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .church { padding: 0; min-width: 0; }
  .church img, .church .mono { width: 36px; height: 36px; }
  .church > span { min-width: 0; }
  .church b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .church small { display: none; }
  .menu-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 8px 14px; border-radius: 10px; cursor: pointer;
              background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.28); color: #fff; font-weight: 600; }
  .menu-btn i { width: 18px; height: 12px; border-top: 2px solid; border-bottom: 2px solid; position: relative; }
  .menu-btn i::after { content: ""; position: absolute; inset: 3px 0 auto; border-top: 2px solid; }
  .menu-btn .count { min-width: 20px; height: 20px; }
  .switch, .side nav, .me, .site { display: none; grid-column: 1 / -1; }
  .side.open { max-height: 100dvh; overflow-y: auto; box-shadow: 0 18px 40px rgba(0,0,0,.3); }
  .side.open .switch, .side.open .site { display: block; }
  .side.open nav { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
  .side.open .me { display: flex; margin: 0; }
  .side nav a { padding: 13px 12px; min-height: 46px; background: rgba(255,255,255,.06); }
  .side nav a.subtle { margin-top: 0; }
  .site { padding: 0 2px 4px; }
  .main { padding: 20px 16px 48px; }
  input, select, textarea { font-size: 16px !important; }  /* smaller text makes iPhones zoom in on every field */
}
@media (max-width: 360px) { .side.open nav { grid-template-columns: 1fr; } }

/* Header, flash */
.head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; }
.head .muted { margin-top: 4px; }
.eyebrow { font-size: .78rem; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--brand); }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: -10px; }
.crumbs a:hover { color: var(--brand); }
.meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; font-size: .88rem; }
.flash p { padding: 12px 16px; border-radius: 10px; background: var(--good-bg); color: var(--good); font-weight: 500; }
.flash p.error { background: var(--critical-bg); color: var(--critical); }

/* Buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: .92rem; cursor: pointer; transition: border-color .15s, background .15s; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--critical); border-color: var(--critical); }
.btn.block { width: 100%; }
.form { display: grid; gap: 14px; margin-top: 6px; }
.form > div { display: grid; gap: 5px; }
.form label, .login label { font-size: .85rem; font-weight: 600; display: grid; gap: 5px; }
.form input, .form select, .form textarea, .login input, .filters input {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px; font-size: .95rem; }
.form input:focus, .form select:focus, .form textarea:focus, .login input:focus, .filters input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent); }
.form .helptext { font-size: .8rem; color: var(--muted); }
.errorlist { list-style: none; color: var(--critical); font-size: .84rem; }
.error { color: var(--critical); font-size: .9rem; margin: 6px 0; }
details summary { cursor: pointer; font-weight: 600; padding: 6px 0; color: var(--ink-2); }
details + details { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 8px; }

/* Cards, tiles */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.card.flush { padding: 0; overflow-x: auto; }
.card .pad { padding: 18px 20px 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.card.note { border-left: 4px solid var(--warning); }
.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .tiles { grid-template-columns: 1fr 1fr; } .tiles > :last-child:nth-child(odd) { grid-column: 1 / -1; } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: grid; gap: 2px; transition: border-color .15s; }
a.tile:hover { border-color: var(--brand); }
.tile small { font-size: .78rem; font-weight: 600; color: var(--ink-2); }
.tile b { font: 700 1.9rem/1.2 var(--serif); color: var(--ink); }
.tile span { font-size: .8rem; color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 860px) { .two { grid-template-columns: 1fr; } }
.item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); }
.card:not(.flush) .item { margin: 0 -20px; }
.card:not(.flush) .card-head + .item { border-top: 0; }
.item:hover { background: color-mix(in srgb, var(--brand) 4%, transparent); }
.item b { font-weight: 600; }
.chev { font-size: .82rem; font-weight: 600; color: var(--brand); }
.amt { font-weight: 600; white-space: nowrap; }
.empty { color: var(--muted); padding: 18px 20px; text-align: center; font-size: .92rem; }

/* Status: reserved colours, always with an icon and a label */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; padding: 3px 10px 3px 4px; border-radius: 999px; white-space: nowrap; }
.status i { font-style: normal; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; font-size: .66rem; color: #fff; }
.status.good { background: var(--good-bg); color: var(--good); } .status.good i { background: var(--good); }
.status.warning { background: var(--warning-bg); color: var(--warning); } .status.warning i { background: var(--warning); }
.status.critical { background: var(--critical-bg); color: var(--critical); } .status.critical i { background: var(--critical); }
.status.muted { background: #efebe5; color: var(--ink-2); } .status.muted i { background: #9b928a; }
.good-text { color: var(--good); }
.missed { color: var(--critical); font-weight: 600; }

/* Member page, dues by year: 12 month boxes per year, two rows of 6 when the column is narrow, never scrolls */
.dues-years { container-type: inline-size; }
.dy + .dy { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.dy-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.dy-months { list-style: none; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; }
.dy-months li { text-align: center; padding: 5px 2px; border-radius: 6px; background: var(--bg); color: var(--muted);
                font-size: .88rem; font-variant-numeric: tabular-nums; line-height: 1.3; }
.dy-months li small { font-size: .68rem; text-transform: uppercase; letter-spacing: .3px; }
.dy-months li.paid { background: var(--good-bg); color: var(--ink); font-weight: 600; }
.dy-months li.miss { background: var(--critical-bg); color: var(--critical); font-weight: 600; }
@container (max-width: 560px) { .dy-months { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* Bar chart: one series in the church colour, 4px rounded tops anchored to the baseline */
.chart { position: relative; display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; height: 220px; padding: 8px 0 26px; margin-top: 6px; }
.chart .grid { position: absolute; inset: 8px 0 26px; display: grid; grid-template-rows: repeat(3, 1fr); pointer-events: none; }
.chart .grid span { border-top: 1px dashed var(--line); }
.chart .grid::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; border-top: 1px solid #cfc5b7; }
.col { position: relative; display: flex; flex-direction: column; align-items: center; outline: none; cursor: default; }
.bar-wrap { position: relative; flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bar { width: min(60%, 34px); min-height: 2px; background: var(--brand); border-radius: 4px 4px 0 0; transition: filter .15s; }
.col:hover .bar, .col:focus-visible .bar { filter: brightness(1.25); }
.bar-label { position: absolute; bottom: calc(100% + 4px); font-size: .78rem; font-weight: 600; color: var(--ink); white-space: nowrap; }
.col:last-child .bar-label { position: static; order: -1; margin-bottom: 4px; }
.col:last-child .bar-wrap { flex-direction: column; justify-content: flex-end; }
.tick { position: absolute; bottom: -22px; font-size: .75rem; color: var(--muted); }
.tip { position: absolute; bottom: 100%; z-index: 2; background: var(--ink); color: #fff; font-size: .8rem; padding: 6px 10px; border-radius: 8px; white-space: nowrap; pointer-events: none; opacity: 0; transform: translateY(4px); transition: .15s; }
.tip b { display: block; font-weight: 600; font-size: .74rem; color: rgba(255,255,255,.7); }
.col:hover .tip, .col:focus-visible .tip { opacity: 1; transform: none; }
.col:first-child .tip { left: 0; } .col:last-child .tip { right: 0; }
.as-table { margin-top: 10px; font-size: .88rem; }
.as-table table { margin-top: 8px; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .76rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--line); background: #faf6ef; }
td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.list tbody tr { cursor: pointer; }
.list tbody tr:hover { background: color-mix(in srgb, var(--brand) 4%, transparent); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap { overflow-wrap: anywhere; }
.list.tight th, .list.tight td { padding-left: 12px; padding-right: 12px; }
.nowrap { white-space: nowrap; }
@media (max-width: 860px) {
  /* the month-by-month grid stays a grid and scrolls sideways; the name column stays in view */
  .year-grid td, .year-grid th { padding: 8px 6px; }
  .year-grid td:first-child, .year-grid th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); max-width: 46vw;
                                                         padding-left: 12px; box-shadow: 1px 0 0 var(--line); }
  .year-grid thead th:first-child, .year-grid tfoot th:first-child { background: #faf6ef; }
}
@media (max-width: 600px) {
  /* Tables on phones: every row becomes a small card, each value next to its column name
     (dashboard.js copies the column names into data-label). Nothing is hidden and nothing scrolls sideways. */
  td, th { padding: 10px 12px; }
  .list:not(.year-grid) thead { display: none; }
  .list:not(.year-grid), .list:not(.year-grid) tbody, .list:not(.year-grid) td { display: block; }
  .list:not(.year-grid) tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .list:not(.year-grid) tr:last-child { border-bottom: 0; }
  .list:not(.year-grid) td { border: 0; padding: 0; text-align: left; overflow-wrap: anywhere; }
  .list:not(.year-grid) td[data-label]::before { content: attr(data-label); display: block; font-size: .68rem; font-weight: 600;
      text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
  .list:not(.year-grid) td:first-child, .list:not(.year-grid) td:not([data-label]) { grid-column: 1 / -1; }
  .list:not(.year-grid) td:first-child { font-size: 1.02rem; }
  .list:not(.year-grid) td:first-child::before { content: none; }
  .list:not(.year-grid) td.empty { padding: 18px 0; text-align: center; }
  .list:not(.year-grid) td .btn, .list:not(.year-grid) td form.inline { margin: 2px 0; }
  .list input[type=checkbox], .list input[type=radio] { width: 22px; height: 22px; }
  .card.flush { overflow-x: visible; }
}

/* Filters */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.filters input { max-width: 320px; border-radius: 999px; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pills a { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .86rem; font-weight: 500; display: inline-flex; gap: 6px; align-items: baseline; }
.pills a small { display: inline; font-size: .76rem; }
.pills a[aria-current="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.pills a[aria-current="true"] small { color: rgba(255,255,255,.75); }
@media (max-width: 700px) {
  /* one line per filter, swiped sideways, so the list starts higher on the screen */
  .filters { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .pills { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px; scrollbar-width: none; }
  .pills::-webkit-scrollbar { display: none; }
  .pills a, .pills span { flex: none; white-space: nowrap; }
  .pills a { padding: 9px 14px; }
  .pills.small a { padding: 7px 12px; }
  .card .pills { margin: 0; padding: 2px 0; }
}

/* Member detail */
.detail { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (min-width: 961px) { .detail.wide-list { grid-template-columns: minmax(0, 1fr) 340px; } }
@media (max-width: 960px) { .detail { grid-template-columns: minmax(0, 1fr); } .detail > .stack:last-child { order: -1; } .detail.in-order > .stack:last-child { order: 0; } }
.stack { display: grid; gap: 20px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.facts .wide { grid-column: 1 / -1; }
.facts dt { font-size: .76rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.facts dd a { color: var(--brand); }
.person { padding: 10px 0; border-top: 1px solid var(--line); }
.person:first-of-type { border-top: 0; padding-top: 0; }
.dues { border-top: 4px solid var(--accent); }
.big { font: 700 2rem/1.2 var(--serif); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--brand); background-image: radial-gradient(circle at 20% 10%, rgba(255,255,255,.08), transparent 40%); }
.login .card { width: min(400px, 100%); padding: 32px; display: grid; gap: 14px; box-shadow: 0 30px 60px rgba(0,0,0,.25); border-top: 4px solid var(--accent); }
.login .cross { font-size: 2rem; color: var(--accent); line-height: 1; }

/* Multi-field forms (add member, service requests) */
.grid-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px; }
.grid-form .wide { grid-column: span 2; }
@media (max-width: 800px) { .grid-form { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .grid-form { grid-template-columns: 1fr; } .grid-form .wide { grid-column: auto; } }
.grid-form > div { display: grid; gap: 5px; align-content: start; }
.grid-form label { font-size: .85rem; font-weight: 600; }
.grid-form input:not([type=checkbox]), .grid-form select, .grid-form textarea { width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 11px; font-size: .93rem; }
.grid-form input:focus, .grid-form select:focus, .grid-form textarea:focus { outline: none; border-color: var(--brand); }
.grid-form .check { display: flex; align-items: center; gap: 8px; padding-top: 24px; }
.grid-form .check label { order: 2; }
.person-row { border: 0; border-top: 1px solid var(--line); padding: 16px 0 6px; }
.person-row:first-of-type { border-top: 0; padding-top: 6px; }
.person-row legend { font-weight: 600; font-size: .9rem; color: var(--brand); padding-right: 8px; }
.small-note { font-size: .88rem; margin: -6px 0 6px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.status.info { background: #e3ebf6; color: #2b5287; } .status.info i { background: #2b5287; }
.warn-text { color: var(--warning); }
.select-pill { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-size: .88rem; }
[hidden] { display: none !important; }
.tiles-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .tiles-4 { grid-template-columns: 1fr 1fr; } }
.pills.small a { padding: 4px 10px; font-size: .8rem; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.form input[type=checkbox] { width: auto; }
code { background: #efe9df; padding: 1px 5px; border-radius: 4px; font-size: .88em; }
form.inline { display: inline; margin-left: 8px; }

/* Reports charts. Money sources keep one colour each everywhere (validated for colour-blind readers; three are light,
   so every chart has a legend and a "Show as table"). Status bars use the status colours with a text label. */
:root { --src-dues: #2a78d6; --src-donations: #eb6834; --src-pledge_paid: #1baf7a; --src-offerings: #eda100; --src-other: #e87ba4; }
.src-dues { background: var(--src-dues); } .src-donations { background: var(--src-donations); }
.src-pledge_paid { background: var(--src-pledge_paid); } .src-offerings { background: var(--src-offerings); } .src-other { background: var(--src-other); }
.tone-good { background: var(--good); } .tone-warning { background: #d99a1e; } .tone-critical { background: var(--critical); }
.tone-muted { background: #9a8f86; } .tone-neutral { background: #cbbfae; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: 0; flex-shrink: 0; }
.tiles-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1100px) { .tiles-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) { .tiles-6 { grid-template-columns: 1fr 1fr; } }
.tile.lead { background: var(--brand); border-color: var(--brand); }
.tile.lead small, .tile.lead span { color: rgba(255,255,255,.78); } .tile.lead b { color: #fff; }
.tile small { display: flex; align-items: center; }
.tiles-6 .tile b { font-size: 1.55rem; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .82rem; color: var(--ink-2); margin: -4px 0 4px; }
.legend li { display: flex; align-items: center; }
.chart.stacked .sbar { width: min(64%, 40px); min-height: 2px; display: flex; flex-direction: column-reverse; gap: 2px; transition: filter .15s; }
.chart.stacked .sbar span { display: block; min-height: 2px; flex-basis: 0; }
.chart.stacked .sbar span:last-child { border-radius: 4px 4px 0 0; }
.chart.stacked .col:hover .sbar, .chart.stacked .col:focus-visible .sbar { filter: brightness(1.12); }
.chart.stacked .col.future .sbar { opacity: .35; }
.chart.stacked .bar-label { position: static; order: -1; margin-bottom: 4px; }
.chart.stacked .bar-wrap { flex-direction: column; justify-content: flex-end; align-items: center; }
.tip-row { display: flex; align-items: center; gap: 2px; white-space: nowrap; }
.tip-row em { font-style: normal; font-weight: 600; margin-left: auto; padding-left: 14px; font-variant-numeric: tabular-nums; }
.tip-row.total { border-top: 1px solid rgba(255,255,255,.25); margin-top: 3px; padding-top: 3px; }
.share-bar { display: flex; gap: 2px; height: 14px; border-radius: 7px; overflow: hidden; margin: 2px 0 16px; }
.share-bar span { flex-basis: 0; min-width: 2px; }
.hbars { list-style: none; display: grid; gap: 12px; }
.hbars + .small-note { margin-top: 14px; }
.hbars li { display: grid; grid-template-columns: minmax(0, 9.5rem) minmax(0, 1fr) auto; align-items: center; gap: 12px; font-size: .9rem; }
.hb-label { display: flex; align-items: center; min-width: 0; }
.hb-track { height: 12px; background: var(--bg); border-radius: 0 4px 4px 0; overflow: hidden; }
.hb-track span { display: block; height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; }
.hb-value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 4.5rem; }
.hb-value small { display: inline; margin-left: 6px; font-weight: 500; }
@media (max-width: 520px) { .hbars li { grid-template-columns: minmax(0, 1fr) auto; } .hb-track { grid-column: 1 / -1; grid-row: 2; } }
.chart .tick { white-space: nowrap; }
@media (max-width: 600px) { .chart.stacked .tick { font-size: .66rem; } .chart.stacked .bar-label { font-size: .68rem; } }

/* Payment and gift history on a member or donor page: fits the card, Edit is a small button at the end */
.btn.small { padding: 5px 12px; font-size: .8rem; color: var(--brand); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.btn.small:hover { background: color-mix(in srgb, var(--brand) 6%, var(--surface)); border-color: var(--brand); }
.pay-history td small { overflow-wrap: anywhere; }
.pay-history td:last-child { white-space: nowrap; }
table.pay-history td .btn.pay-edit { display: flex; width: max-content; margin: 8px 0 0 auto; padding: 6px 16px; white-space: nowrap; }
@media (max-width: 600px) { table.pay-history td .btn.pay-edit { display: inline-flex; margin: 0 0 0 12px; vertical-align: middle; } }
.month-amounts { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin: 6px 0; }
.month-amounts label { font-weight: 500; }
.form .label { font-size: .85rem; font-weight: 600; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.two-col > div { display: grid; gap: 5px; }
.dy-months li button { all: unset; display: block; width: 100%; cursor: pointer; border-radius: 6px; }
.dy-months li button:hover { text-decoration: underline; }
.dy-months li button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Radio choices (payment and gift forms) */
.form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 6px; }
.form legend { font-size: .85rem; font-weight: 600; padding: 0; }
.form input[type=radio] { width: auto; margin: 0; accent-color: var(--brand); }
.form div:has(> div > label > input[type=radio]) { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.form label:has(> input[type=radio]) { display: flex; align-items: center; gap: 8px; font-weight: 500; }

/* Small phones (placed last so it wins over the component rules above) */
@media (max-width: 520px) {
  body { font-size: 14.5px; }
  .card { padding: 16px; }
  .card:not(.flush) .item { margin: 0 -16px; padding: 12px 16px; }
  .head { align-items: start; }
  .head > .btn, .head-actions, .head > form { width: 100%; }
  .head > .btn, .head-actions .btn, .head > form .btn { width: 100%; }
  .filters input { max-width: none; }
  .tile b { font-size: 1.6rem; }
  .big { font-size: 1.7rem; }
  .facts { grid-template-columns: 1fr; }
  .card-head { flex-wrap: wrap; }
  .btn { min-height: 44px; }
}
