/*
 * Fireball & B2SB Management — single stylesheet, no framework.
 * Palette follows Rotary International brand guidelines:
 *   Royal Blue #17458f (PMS 286C)  — primary
 *   Gold       #f7a81b (PMS 130C)  — secondary/accent
 *   Azure      #0067c8, Sky Blue #00a2e0, Orange #ff7600, Cranberry #d41367 — secondary palette
 * Typography per Rotary guidance: Open Sans for body text, Georgia for
 * headings/serif moments. Program indicator colors are configurable in
 * Admin → Programs and arrive via /branding/programs.css as --prog-color.
 */
:root {
  --royal: #17458f;
  --royal-dark: #10305f;
  --gold: #f7a81b;
  --azure: #0067c8;
  --sky: #00a2e0;
  --cranberry: #d41367;
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #5f6672;
  --line: #dde1e8;
  --ok: #1e7d3c;
  --warn: #a06a00;
  --err: #b3261e;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: 'Open Sans', 'Segoe UI', system-ui, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 16px/1.5 var(--sans);
  background: var(--bg); color: var(--ink);
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; width: min(1100px, 96vw); margin: 1.2rem auto; }
a { color: var(--azure); }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; color: var(--royal); }
h1 { font-size: 1.6rem; margin: 0.2rem 0 0.8rem; }
h2 { font-size: 1.2rem; margin: 0.2rem 0 0.6rem; }
h3 { font-size: 1.02rem; }

.topbar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--royal); color: #fff; padding: 0.5rem 1rem;
  border-bottom: 3px solid var(--gold);
}
.topbar .brand {
  font-family: var(--serif); font-weight: 700; letter-spacing: 0.02em;
  display: flex; align-items: center; gap: 0.55rem;
}
.orglogo { height: 34px; width: auto; max-width: 140px; object-fit: contain; background: #fff; border-radius: 5px; padding: 2px 5px; }
.topbar nav { display: flex; gap: 0.15rem; flex-wrap: wrap; }
.topbar nav a { color: #dbe6f7; text-decoration: none; padding: 0.3rem 0.65rem; border-radius: 6px; }
.topbar nav a:hover { background: var(--royal-dark); color: #fff; }
.topbar nav a.active { background: var(--royal-dark); color: var(--gold); font-weight: 600; }
.userbox { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; }
.userbox a { color: #dbe6f7; text-decoration: none; }

footer { text-align: center; color: var(--muted); font-family: var(--serif); font-style: italic; font-size: 0.9rem; padding: 1rem; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 1rem 1.2rem; margin-bottom: 1rem; box-shadow: 0 1px 2px rgba(23,69,143,0.06);
}
.card.narrow { max-width: 640px; }
.card.center { margin: 3rem auto; }
.proggrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.progcard {
  text-decoration: none; color: inherit; display: block;
  border-top: 5px solid var(--prog-color, var(--royal));
}
.progcard:hover { border-color: var(--prog-color, var(--royal)); box-shadow: 0 2px 8px rgba(23,69,143,0.15); }
.progcard .proglogo { max-height: 56px; max-width: 100%; object-fit: contain; display: block; margin-bottom: 0.4rem; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; }
.cols3 { display: grid; grid-template-columns: 2fr 1fr 0.8fr; gap: 0.6rem; align-items: end; }

.muted { color: var(--muted); }
.count { color: var(--muted); font-weight: 400; font-size: 0.9em; font-family: var(--sans); }
.overdue { color: var(--err); font-weight: 600; }
.prewrap { white-space: pre-wrap; }
.notes { font-size: 0.85em; color: var(--muted); display: inline-block; max-width: 34ch; }

.listhead { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.listhead h1, .listhead h2 { margin: 0; flex: 0 1 auto; }
.listhead .btn.primary { margin-left: auto; }
.searchform, .filterform { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.inlinecheck { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }

.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th { text-align: left; color: var(--royal); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
th, td { padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:hover td { background: #f7f9fc; }
tr.row-overdue td { background: #fdf1ef; }
tr.row-inactive td { opacity: 0.55; }
.rowactions { white-space: nowrap; font-size: 0.85rem; }

.field { display: block; margin-bottom: 0.7rem; }
.field span { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.15rem; }
.field.checkbox { display: flex; align-items: center; gap: 0.5rem; }
.field.checkbox span { margin: 0; color: var(--ink); }
input, select, textarea {
  font: inherit; padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: 6px;
  width: 100%; background: #fff; color: var(--ink);
}
.inline input, .inline select { width: auto; }
input[type="checkbox"] { width: auto; }
input[type="color"] { padding: 0.15rem; height: 2.4rem; cursor: pointer; }
input[type="file"] { padding: 0.3rem; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--sky); outline-offset: 0; border-color: var(--sky); }

.btn {
  display: inline-block; font: inherit; padding: 0.45rem 0.9rem; border-radius: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--royal); color: var(--royal); }
.btn.primary { background: var(--royal); border-color: var(--royal); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--royal-dark); color: #fff; }
.btn.danger { background: #fff; color: var(--err); border-color: var(--err); }
.btn.danger:hover { background: var(--err); color: #fff; }
.btn.small { padding: 0.2rem 0.6rem; font-size: 0.85rem; }
.btn.wide { width: 100%; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.8rem; align-items: center; }
form.inline { display: inline; }
.linklike {
  background: none; border: none; padding: 0; font: inherit; color: var(--azure);
  cursor: pointer; text-decoration: underline; font-size: 0.9em;
}
.danger-link { color: var(--err); }

.flash { padding: 0.6rem 0.9rem; border-radius: 8px; margin-bottom: 0.9rem; }
.flash.ok { background: #e7f4ea; color: var(--ok); }
.flash.warn { background: #fdf3df; color: var(--warn); }
.flash.err { background: #fdecea; color: var(--err); }

.badge {
  display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; white-space: nowrap; background: #eee;
  font-family: var(--sans);
}
/* Program indicator chip — background color comes from --prog-color, set per
   program in /branding/programs.css (configurable in Admin → Programs). */
.chip {
  display: inline-block; padding: 0.12rem 0.6rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700; white-space: nowrap; color: #fff;
  background: var(--prog-color, var(--muted));
}
.status-todo { background: #e6e9ee; color: #4c5361; }
.status-in_progress { background: #dcebfb; color: var(--azure); }
.status-blocked { background: #fdecea; color: var(--err); }
.status-done { background: #e7f4ea; color: var(--ok); }
.status-cancelled { background: #eef0f3; color: var(--muted); text-decoration: line-through; }
.prio-low { background: #eef0f3; color: var(--muted); }
.prio-normal { background: #e6e9ee; color: #4c5361; }
.prio-high { background: #fdf3df; color: var(--warn); }
.prio-critical { background: #fdecea; color: var(--err); }
.vstatus-active, .sstatus-paid { background: #e7f4ea; color: var(--ok); }
.vstatus-prospect, .sstatus-prospect, .sstatus-contacted { background: #dcebfb; color: var(--azure); }
.vstatus-avoid, .sstatus-declined { background: #fdecea; color: var(--err); }
.vstatus-inactive { background: #eef0f3; color: var(--muted); }
.sstatus-pledged { background: #fdf3df; color: var(--warn); }
.reimb-club_paid { background: #e6e9ee; color: #4c5361; }
.istatus-proposed { background: #dcebfb; color: var(--azure); }
.istatus-accepted { background: #fdf3df; color: var(--warn); }
.istatus-in_progress { background: #dcebfb; color: var(--azure); font-weight: 600; }
.istatus-done { background: #e7f4ea; color: var(--ok); }
.istatus-declined { background: #eef0f3; color: var(--muted); text-decoration: line-through; }
.reimb-pending { background: #fdf3df; color: var(--warn); }
.reimb-reimbursed { background: #e7f4ea; color: var(--ok); }
.warn-badge { background: #fdf3df; color: var(--warn); }
.prog-badge { background: #e4ebf7; color: var(--royal); }
.role { padding: 0.05rem 0.45rem; border-radius: 999px; font-size: 0.72rem; background: var(--gold); color: var(--royal-dark); }

.memberlist { margin: 0.3rem 0 0.6rem; padding-left: 1.2rem; }
.memberlist li { margin-bottom: 0.15rem; }
.addmember, .createuser { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.temppw {
  font-family: ui-monospace, Consolas, monospace; font-size: 1.3rem; font-weight: 700;
  background: #eef0f3; padding: 0.6rem; border-radius: 8px; letter-spacing: 0.05em;
  user-select: all;
}
dl.detail { display: grid; grid-template-columns: 9rem 1fr; gap: 0.3rem 0.8rem; }
dl.detail dt { color: var(--muted); font-size: 0.9rem; }
dl.detail dd { margin: 0; }
hr { border: none; border-top: 1px solid var(--line); margin: 1rem 0; }

/* ---- sortable tables ---- */
th.sorth { cursor: pointer; user-select: none; }
th.sorth:hover { color: var(--azure); }
th.sorth[data-dir="asc"]::after { content: " ▲"; font-size: 0.7em; }
th.sorth[data-dir="desc"]::after { content: " ▼"; font-size: 0.7em; }

/* ---- quick filter + intros ---- */
.quickfilter { max-width: 15rem; }
.small { font-size: 0.82rem; }
.introrow { margin-top: 0; }
.introedit { text-decoration: none; font-size: 0.95em; }
.logothumb { height: 22px; width: 22px; object-fit: contain; vertical-align: middle; border-radius: 3px; background: #fff; border: 1px solid var(--line); }

/* ---- compact committees grid ---- */
.comgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 0.6rem; }
.comcard { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.comcard[open] { box-shadow: 0 2px 8px rgba(23,69,143,0.12); }
.comcard summary {
  cursor: pointer; padding: 0.55rem 0.8rem; display: flex; align-items: center; gap: 0.5rem;
  flex-wrap: wrap; list-style-position: inside;
}
.comcard summary:hover { background: #f7f9fc; }
.comcard .comname { font-family: var(--serif); font-weight: 700; color: var(--royal); }
.comcard .comsummary { font-size: 0.83rem; }
.comcard .combody { padding: 0 0.9rem 0.8rem; border-top: 1px solid var(--line); }

.brandrow { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.logopreview { max-height: 60px; max-width: 220px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 4px; }
.uploadform { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.genbox { background: #f2f6fc; border-color: #c9d8ef; }

@media (max-width: 640px) {
  .cols3 { grid-template-columns: 1fr; }
  dl.detail { grid-template-columns: 1fr; }
  dl.detail dt { margin-top: 0.4rem; }
}

/* ---- fundraising thermometer (dashboard) ---- */
.thermo { height: 26px; border-radius: 13px; overflow: hidden; margin: 0.5rem 0 0.6rem; line-height: 0; }
.thermo svg { display: block; }
.tseg-track { fill: #e9edf3; }
.tseg-received { fill: var(--royal); }
.tseg-race { fill: var(--gold); }
.tseg-pledged { fill: #5b8ede; }
.tseg-gap { fill: var(--card); }
.thermo-legend { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; margin: 0; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; }
.sw-received { background: var(--royal); }
.sw-race { background: var(--gold); }
.sw-pledged { background: #5b8ede; }

/* race-stats trend charts — SVG line charts, CSP-safe (classes, no inline
   styles). Rotary royal/sky/gold; every point carries a direct text label.
   No text-anchor here — the SVG sets it per label (edge-aware anchoring). */
.chartrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.rchart { margin: 0; }
.rchart figcaption { font-size: 0.85rem; font-weight: 600; color: var(--muted); margin-bottom: 0.2rem; }
.rchart svg { width: 100%; height: auto; display: block; }
.rchart .ln { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rchart .area { stroke: none; fill-opacity: 0.08; }
.rchart .dot { stroke: var(--card); stroke-width: 2; }
.rchart .hit { fill: #fff; fill-opacity: 0; }
.series-signups .ln { stroke: var(--royal); } .series-signups .area, .series-signups .dot { fill: var(--royal); }
.series-regfees .ln { stroke: var(--sky); } .series-regfees .area, .series-regfees .dot { fill: var(--sky); }
.series-donations .ln { stroke: var(--gold); } .series-donations .area, .series-donations .dot { fill: var(--gold); }
.chartval { font: 600 11px var(--sans); fill: var(--ink); }
.chartlab { font: 11px var(--sans); fill: var(--muted); }
.baseline { stroke: var(--line); stroke-width: 1; }

.yearbox { width: 6em; }
.qtybox { width: 5.5em; }
.tierbenefits { background: #f2f6fc; border: 1px solid #c9d8ef; border-radius: 6px; padding: 0.35rem 0.6rem; margin: -0.3rem 0 0.7rem; }

/* ---- task activity trail & comments ---- */
.activity { list-style: none; margin: 0.8rem 0 0; padding: 0; }
.actentry { padding: 0.45rem 0.2rem; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 0.1rem; }
.actmeta { font-size: 0.78rem; color: var(--muted); }
.actwhat { font-size: 0.92rem; }
.actcomment .commenttext {
  display: block; background: #f2f6fc; border: 1px solid #c9d8ef; border-radius: 8px;
  padding: 0.4rem 0.6rem; margin-top: 0.15rem;
}

/* grouped settings block (e.g. RunSignUp API keys on the Admin page) */
fieldset.subfields {
  border: 1px solid #c9d8ef; border-radius: 8px;
  padding: 0.6rem 0.9rem 0.8rem; margin: 0.8rem 0;
}
fieldset.subfields legend { font-weight: 600; font-size: 0.92rem; padding: 0 0.35rem; color: #3b5a86; }
