:root {
  --ink: #222222;
  --ink-soft: #52514e;
  --border: #eeeeee;
  --border-soft: #c3c2b7;
  --bg: #f5f5f5;
  --surface: #ffffff;
  --header: #0d3b66;
  --header-dark: #0a2f52;
  --accent: #0d6efd;
  --accent-bright: #4da3ff;
  --accent-soft: #e7eefc;
  --warn: #d03b3b;
  --warn-soft: #fbe5e5;
  --badge: #ffe69c;
  --badge-ink: #664d03;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
}

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

header.site {
  background: var(--header);
  color: #ffffff;
  padding: 0.6rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header.site .brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: #ffffff;
}
header.site .brand:hover { text-decoration: none; }
/* The navy emblem sits on the navy bar, so give it a thin white ring. */
header.site .brand img { display: block; height: 48px; width: 48px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85); }

header.site .admin-link {
  color: #ffffff;
  font-size: 0.85rem;
  opacity: 0.85;
}
header.site .admin-link:hover { opacity: 1; }
header.site .header-right { display: flex; align-items: center; gap: 1rem; }
header.site .signout { margin: 0; }
header.site .signout button {
  background: transparent;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 4px;
  padding: 0.25rem 0.7rem;
  font-size: 0.85rem;
  cursor: pointer;
}
header.site .signout button:hover { background: rgba(255, 255, 255, 0.15); }

nav.tabs {
  display: flex;
  background: var(--header-dark);
  padding: 0 1.5rem;
  flex-wrap: wrap;
}

nav.tabs a {
  color: #cfe0f0;
  padding: 0.8rem 1.2rem;
  font-size: 0.95rem;
  border-bottom: 3px solid transparent;
}

nav.tabs a.current,
nav.tabs a:hover {
  color: #ffffff;
  border-bottom-color: var(--accent-bright);
  text-decoration: none;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem;
}

h1 { font-size: 1.6rem; margin: 0 0 8px; }
h2 { font-size: 1.15rem; margin: 32px 0 10px; color: var(--ink); }
p.intro { color: var(--ink-soft); margin-top: 0; }

.back-link { display: inline-block; margin-bottom: 16px; font-size: 0.9rem; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 20px 0 8px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.2rem;
}

.stat-card .value { font-size: 2.1rem; font-weight: 600; font-variant-numeric: proportional-nums; }
.stat-card .label { color: var(--ink-soft); font-size: 0.78rem; margin-top: 0.3rem; }
.stat-card.warn { background: var(--warn-soft); }
.stat-card.warn .value { color: var(--warn); }

.report-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.report-links li a {
  display: block;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  color: var(--ink);
}

.report-links li a:hover {
  color: var(--accent);
  text-decoration: none;
}

.filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}

.filters input[type="search"],
.filters select {
  font: inherit;
  padding: 0.4rem;
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  background: var(--surface);
}

.filters input[type="search"] { min-width: 220px; width: 320px; max-width: 100%; }
.filters .count { color: var(--ink-soft); font-size: 0.85rem; margin-left: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

th {
  background: #f0f0f0;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  position: sticky;
  top: 0;
}

tr:last-child td { border-bottom: none; }
tr.filtered-out { display: none; }
table:not(.mail-mode) .mail-cell { display: none; }
.mail-cell { width: 2rem; text-align: center; }
.mail-bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: .25rem 0 .75rem; }
.mail-bar .help { flex-basis: 100%; margin: 0; }
.mail-bar button:disabled { opacity: .5; cursor: default; }
.mail-batches { flex-basis: 100%; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--badge);
  color: var(--badge-ink);
}
.badge.deferred { background: var(--warn); color: #ffffff; }

.empty { color: var(--ink-soft); font-style: italic; }

.table-scroll { overflow-x: auto; }

.hidden { display: none !important; }

.btn-primary,
.btn-secondary {
  display: inline-block;
  font: inherit;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #ffffff; }
.btn-primary:hover { background: #0b5ed7; text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--border-soft); }
.btn-secondary:hover { background: #eef1f4; text-decoration: none; }

.form-section {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}
.form-section h2 { margin: 0 0 0.75rem; font-size: 1rem; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem 1rem;
}

.field { display: flex; flex-direction: column; gap: 0.25rem; }
.field label { font-size: 0.8rem; color: var(--ink-soft); font-weight: 600; }

.form-section input[type="text"],
.form-section input[type="email"],
.form-section input[type="tel"],
.form-section input[type="date"],
.form-section input[type="file"],
.form-section select,
.form-section textarea {
  font: inherit;
  padding: 0.4rem;
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  background: var(--surface);
  width: 100%;
}
.form-section textarea { resize: vertical; }

.checkbox-row { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.checkbox-field { display: flex; align-items: center; gap: 0.4rem; font-weight: 500; cursor: pointer; }
.checkbox-field input { width: auto; }

.formset-table { width: 100%; border-collapse: collapse; margin-bottom: 0.75rem; }
.formset-table th { text-align: left; font-size: 0.75rem; color: var(--ink-soft); padding: 0.3rem 0.5rem; }
.formset-table td { padding: 0.3rem 0.5rem; vertical-align: middle; }

.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }

@media (max-width: 700px) {
  main { padding: 20px 14px 48px; }
  table.stacked, table.stacked thead, table.stacked tbody,
  table.stacked th, table.stacked td, table.stacked tr { display: block; }
  table.stacked thead { display: none; }
  table.stacked tr { border-bottom: 1px solid var(--border); padding: 8px 0; }
  table.stacked td { border: none; padding: 3px 0; }
  table.stacked td::before { content: attr(data-label) ": "; font-weight: 600; color: var(--ink-soft); }
}

.owner-picker { position: relative; }
.owner-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.5rem; min-height: 1.6rem; align-items: center; }
.owner-none { color: var(--ink-soft); }
.owner-chip { background: #e9e9e6; color: var(--ink); border-radius: 999px; padding: 0.15rem 0.6rem; font-weight: 500; }
.owner-chip.committee { background: var(--accent-soft); color: var(--header); font-weight: 600; }
.owner-chip a { margin-left: 0.4rem; color: inherit; opacity: 0.6; font-weight: 700; }
.owner-chip a:hover { opacity: 1; }
.owner-search { width: 100%; max-width: 22rem; }
.owner-results {
  position: absolute;
  z-index: 10;
  list-style: none;
  margin: 0.2rem 0 0;
  padding: 0.25rem 0;
  min-width: 16rem;
  max-height: 16rem;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.owner-results li { padding: 0.35rem 0.75rem; cursor: pointer; }
.owner-results li.committee { font-weight: 600; }
.owner-results li.active, .owner-results li:hover { background: var(--accent-soft); }

.update-list { list-style: none; margin: 1rem 0 0; padding: 0; }
.update-list li { padding: 0.5rem 0; border-top: 1px solid var(--border); }
.update-meta { display: inline-block; margin-right: 0.5rem; color: var(--ink-soft); font-size: 0.85rem; font-weight: 600; }

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

.field-action { margin-top: 0.75rem; text-align: center; }

.flash { margin: 0 0 1rem; padding: 0.6rem 1rem; border-radius: 6px; background: var(--accent-soft); font-weight: 600; }

.autosave-note { display: inline-block; margin-left: 0.5rem; color: var(--ink-soft); font-size: 0.85rem; min-height: 1em; }
.autosave-note.error { color: var(--warn); }

.running-label { margin: 0.4rem 0 0; font-weight: 600; color: var(--header); }
.schedule-buttons { margin-top: 0.5rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; color: var(--ink-soft); }
.schedule-buttons .btn-secondary { padding: 0.2rem 0.7rem; }

.not-assigned { color: var(--ink-soft); font-style: italic; }

main.wide { max-width: 1700px; }
.wrap { min-width: 16rem; max-width: 44rem; white-space: normal; overflow-wrap: anywhere; }

.log-toolbar { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
tr.group-header td { background: var(--bg); font-weight: 700; padding-top: 0.9rem; border-bottom: 2px solid var(--border-soft); }
tr.group-header.committee td { color: var(--header); background: var(--accent-soft); }
.group-count { font-weight: 400; color: var(--ink-soft); font-size: 0.85rem; margin-left: 0.4rem; }
@media (max-width: 700px) {
  table.stacked tr.group-header td::before { content: none; }
}

.nowrap { white-space: nowrap; }
.status-chip { display: inline-block; padding: 0.15rem 0.65rem; border-radius: 999px; font-size: 0.85rem; font-weight: 600; white-space: nowrap; }
.status-chip.not_started { background: #e9e9e6; color: #3a3a37; }
.status-chip.in_progress { background: #dbe9ff; color: #0b4a9e; }
.status-chip.blocked { background: #fde8c8; color: #8a4b00; }
.status-chip.completed { background: #d8f0dc; color: #1d6b34; }
.status-chip.discussion { background: #efe5f8; color: #5b2a86; }
.status-chip.archived { background: #ecebe7; color: #6b6a66; }

.view-chips { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.view-chip { border: 1px solid var(--border-soft); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 0.3rem 0.9rem; font: inherit; font-weight: 600; cursor: pointer; }
.view-chip:hover { background: var(--accent-soft); }
.view-chip.active { background: var(--header); border-color: var(--header); color: #ffffff; }
.view-chip .chip-count { margin-left: 0.3rem; font-weight: 400; opacity: 0.8; }

.latest-meta { display: block; font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); }
.latest-meta:empty { display: none; }
.add-update-link { display: block; margin-top: 0.25rem; font-size: 0.85rem; }
.inline-update textarea { width: 100%; min-width: 14rem; margin-top: 0.35rem; }

.task-cell { position: relative; }
.notes-popover {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 20;
  width: max-content;
  max-width: 30rem;
  padding: 0.6rem 0.8rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  font-size: 0.9rem;
  font-weight: 400;
  white-space: pre-wrap;
  pointer-events: none;
}
.task-title:hover + .notes-popover, .task-title:focus + .notes-popover { display: block; }
@media (max-width: 700px) {
  .notes-popover { display: none !important; }
}

.status-chip.status-select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  padding-right: 1.6rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23555' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
}
.status-chip.status-select:hover { filter: brightness(0.96); }
.status-chip.status-select.just-saved { box-shadow: 0 0 0 2px #2e9d57; }
.status-chip.status-select.save-failed { box-shadow: 0 0 0 2px var(--warn); }

/* Looks like an unticked checkbox until you hover: an invitation, not a status. */
.btn-complete {
  display: inline-flex;
  align-items: center;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.22rem 0.9rem 0.22rem 0.55rem;
  border: 2px solid #1fb6a3;
  border-radius: 999px;
  color: #12806f;
  background: var(--surface);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.btn-complete::before {
  content: "";
  box-sizing: border-box;
  width: 1.1em;
  height: 1.1em;
  margin-right: 0.5rem;
  border: 2px solid currentColor;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95em;
  line-height: 1;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn-complete:hover,
.btn-complete:focus-visible {
  color: #ffffff;
  border-color: transparent;
  background: linear-gradient(135deg, #2e9d57, #1fb6a3);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(31, 182, 163, 0.45);
}
.btn-complete:hover::before,
.btn-complete:focus-visible::before {
  content: "\2713";
  font-size: 0.7em;
  font-weight: 800;
  color: #1c8a55;
  background: #ffffff;
  border-color: #ffffff;
}
.btn-complete:active { transform: translateY(0); }

/* Member badges: one colour each so they can be told apart at a glance. */
.badge.role { background: var(--accent-soft); color: var(--header); }
.badge.lead { background: #d6f1ee; color: #0d6b5f; }
.badge.soloist { background: #ece0fb; color: #5b2a9e; }
.badge.minor { background: #fde8c8; color: #8a4b00; }
/* A reminder, not an error: muted amber with a dashed outline and a warning sign. */
.badge.whatsapp { background: #fff7dc; color: #7a5b00; border: 1px dashed #d9aa00; cursor: help; }
.badge.whatsapp::before { content: "\26A0\FE0E"; margin-right: 0.3rem; }

/* Many chips: let the chip row take the full width (wrapping onto extra lines) and push search below. */
.view-chips.own-row { flex: 1 1 100%; }

tr.instrument-break td { border-top: 2px solid var(--border-soft); }

/* Member type badge: only on the All chip (an empty data-active-type), where rows are mixed. */
.badge.type { display: none; background: #ececec; color: #555; }
table[data-active-type=""] .badge.type { display: inline-block; }

/* Owner picker on the action log */
.owner-cell { position: relative; }
.owner-panel {
  position: absolute; z-index: 20; left: 0; top: 100%; width: 16rem; padding: 0.5rem;
  background: #fff; border: 1px solid var(--border, #ccc); border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.owner-panel-search { width: 100%; margin-bottom: 0.4rem; }
.owner-panel-list { list-style: none; margin: 0 0 0.5rem; padding: 0; max-height: 14rem; overflow-y: auto; }
.owner-panel-list li { padding: 0.1rem 0.25rem; }
.owner-panel-list li.committee { font-weight: 600; }
.owner-panel-list li[hidden] { display: none; }
.owner-panel-actions { display: flex; gap: 0.6rem; align-items: center; }

/* Subs screen */
.muted { color: var(--ink-soft); font-size: 0.85rem; }
.muted-title { color: var(--ink-soft); font-weight: 400; font-size: 1.1rem; margin-left: 0.5rem; }
.period-picker { display: flex; gap: 1rem; align-items: center; margin: 0 0 1rem; }
.card { background: var(--surface); border-radius: 8px; padding: 1rem 1.25rem; margin: 1rem 0; }
.card h2, .card h3 { margin-top: 0; }
.pay-entry form { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: flex-end; }
.pay-entry label, .inline-form label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.85rem; font-weight: 600; }
.pay-entry label.grow { flex: 1 1 14rem; }
#pay-person { min-width: 14rem; }
.pay-list { list-style: none; margin: 0.4rem 0 0; padding: 0; }
.pay-item { display: flex; flex-wrap: wrap; gap: 0.2rem 0.75rem; align-items: baseline; padding: 0.3rem 0; border-top: 1px solid var(--border); }
.pay-who { font-weight: 600; }
.pay-amount { font-weight: 700; }
.pay-meta { color: var(--ink-soft); font-size: 0.85rem; }
.pay-item a { font-size: 0.85rem; }
.pay-item a.danger { color: var(--warn); }
.row-payments summary { cursor: pointer; font-size: 0.8rem; color: var(--ink-soft); }
.row-payments .pay-list { min-width: 22rem; white-space: normal; }
.amount-input { width: 6rem; }
.setup summary { cursor: pointer; font-weight: 700; }
.inline-form { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: flex-end; margin-top: 0.75rem; }
.status-chip.sub-not_asked { background: #e9e9e6; color: #3a3a37; }
.status-chip.sub-asked { background: #dbe9ff; color: #0b4a9e; }
.status-chip.sub-part_paid { background: #fde8c8; color: #8a4b00; }
.status-chip.sub-paid { background: #d8f0dc; color: #1d6b34; }
tr.just-saved-row td { background: #eaf7ee; transition: background 1s; }
.save-failed { box-shadow: 0 0 0 2px var(--warn); }
.badge.overpaid { background: #fde8c8; color: #8a4b00; font-weight: 600; }
.bulk-bar { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; margin: 0.5rem 0; padding: 0.5rem 0.75rem; background: var(--accent-soft); border-radius: 6px; }
.bulk-bar label { display: flex; gap: 0.4rem; align-items: center; font-weight: 600; }
.select-cell { width: 2rem; text-align: center; }
#subs-table:not(.select-mode) .select-cell { display: none; }

/* Member list: one colour per section */
.sec-conductor { --sec: #7a3fb0; --sec-soft: #efe5f8; }
.sec-strings   { --sec: #b8402c; --sec-soft: #fbe6e1; }
.sec-woodwind  { --sec: #1f7a4d; --sec-soft: #dff3e8; }
.sec-brass     { --sec: #a86a00; --sec-soft: #fdefd0; }
.sec-percussion{ --sec: #0b7285; --sec-soft: #dcf1f6; }
.sec-keyboard  { --sec: #3f51b5; --sec-soft: #e3e7f8; }
.sec-none      { --sec: #6b6a66; --sec-soft: #ececea; }

.section-tiles { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.5rem 0 0.75rem; }
.section-tile {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font: inherit; font-weight: 600; cursor: pointer;
  padding: 0.5rem 0.95rem; border-radius: var(--radius);
  border: 2px solid var(--sec, var(--border-soft)); background: var(--sec-soft, var(--surface)); color: var(--sec, var(--ink));
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.section-tile:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.section-tile.active { background: var(--sec, var(--header)); color: #ffffff; border-color: var(--sec, var(--header)); }
.section-tile.empty:not(.active) { opacity: 0.45; }
.section-tile .tile-icon { font-size: 1.25rem; line-height: 1; }
.section-tile .chip-count { font-weight: 400; opacity: 0.85; }

tr.group-header[class*="sec-"] td { background: var(--sec-soft); color: var(--sec); border-bottom: 2px solid var(--sec); }
tr.group-header[class*="sec-"] .group-count { color: inherit; opacity: 0.75; }
.group-icon { margin-right: 0.45rem; font-size: 1.15rem; vertical-align: -0.05em; }
tr.member-row td.name-cell { border-left: 4px solid var(--sec, transparent); }

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.9rem; height: 1.9rem; margin-right: 0.55rem; border-radius: 50%;
  background: var(--sec-soft, #ececea); color: var(--sec, var(--ink-soft));
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em; vertical-align: middle;
}
.inst { display: inline-block; margin-right: 0.75rem; white-space: nowrap; }
.inst-icon { margin-right: 0.3rem; }
@media (max-width: 700px) {
  .section-tile { padding: 0.4rem 0.7rem; }
}
.name-sub { margin-left: 2.45rem; }

/* Action log */
.status-tiles { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.5rem 0 0.75rem; }
.status-tile {
  display: inline-flex; align-items: center; gap: 0.45rem; font: inherit; font-weight: 600; cursor: pointer;
  padding: 0.5rem 0.95rem; border-radius: var(--radius);
  border: 2px solid var(--st, var(--border-soft)); background: var(--st-soft, var(--surface)); color: var(--st, var(--ink));
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.status-tile:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.status-tile.active { background: var(--st, var(--header)); color: #ffffff; border-color: var(--st, var(--header)); }
.status-tile.empty:not(.active) { opacity: 0.45; }
.status-tile .tile-icon { font-size: 1.2rem; line-height: 1; }
.status-tile .chip-count { font-weight: 400; opacity: 0.85; }

.st-not_started { --st: #6b6a66; --st-soft: #ececea; }
.st-in_progress { --st: #0b4a9e; --st-soft: #dbe9ff; }
.st-blocked     { --st: #b86200; --st-soft: #fde8c8; }
.st-completed   { --st: #1d6b34; --st-soft: #d8f0dc; }
.st-discussion  { --st: #7a3fb0; --st-soft: #efe5f8; }
.st-archived    { --st: #8a8984; --st-soft: #ecebe7; }

tr.act-row td.stripe-cell { border-left: 4px solid var(--st, transparent); }
tr.act-row.st-blocked td { background: #fff8ee; }
tr.act-row.deferred td.stripe-cell { border-left-style: dashed; }
tr.act-row.deferred td { color: var(--ink-soft); }

td.age-warn { color: #8a4b00; font-weight: 600; }
td.age-bad { color: var(--warn); font-weight: 700; }

.owner-tag { display: inline-flex; align-items: center; gap: 0.35rem; margin-right: 0.6rem; white-space: nowrap; }
.avatar.sm { width: 1.5rem; height: 1.5rem; margin-right: 0; font-size: 0.65rem; background: var(--sec-soft, #ececea); color: var(--sec, var(--ink-soft)); }
tr.group-header .avatar { background: #ffffff; }
tr.group-header .badge.role { vertical-align: middle; }

/* Subs: section scoreboard */
.section-board { display: flex; flex-wrap: wrap; gap: 0.9rem; margin: 0.25rem 0 1rem; }
.board-card {
  display: flex; align-items: center; gap: 0.8rem; min-width: 12.5rem;
  padding: 0.65rem 1rem 0.65rem 0.75rem; background: var(--surface); border-radius: var(--radius);
  border: 2px solid var(--sec-soft, var(--border)); box-shadow: var(--shadow);
}
.board-card .ring { position: relative; width: 72px; height: 72px; flex: none; }
.board-card .ring-track { stroke: var(--sec-soft, #ececea); }
.board-card .ring-fill { stroke: var(--sec, var(--header)); transition: stroke-dasharray 0.6s ease; }
.board-card .ring-icon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; }
.board-name { font-weight: 700; color: var(--sec, var(--ink)); }
.board-figures { font-size: 0.85rem; color: var(--ink-soft); }
.board-percent { font-size: 1.35rem; font-weight: 800; line-height: 1.1; color: var(--sec, var(--ink)); }
.board-card.complete { border-color: #e0a800; background: linear-gradient(135deg, #fffbea, #fff3c4); }
.board-card.complete .ring-fill { stroke: #e0a800; }
.board-card.complete .board-figures { color: #8a6500; font-weight: 700; }
.ring-star { position: absolute; top: -0.45rem; right: -0.55rem; font-size: 1.25rem; animation: board-pop 0.6s ease-out; }
@keyframes board-pop { 0% { transform: scale(0.2) rotate(-30deg); opacity: 0; } 70% { transform: scale(1.35) rotate(10deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
@media (prefers-reduced-motion: reduce) { .ring-star { animation: none; } .board-card .ring-fill { transition: none; } }

/* Subs: totals card sits first in the scoreboard row */
.board-totals { border-color: var(--header); gap: 1.4rem; padding-right: 1.4rem; }
.board-totals .totals-label { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); }
.board-totals .totals-figure { font-size: 1.9rem; font-weight: 800; line-height: 1.15; color: var(--warn); }
.board-totals.settled { border-color: #2e9d57; background: #f1faf4; }
.board-totals.settled .totals-figure { color: #1d6b34; }
.board-totals .totals-side { font-size: 0.9rem; font-weight: 600; }
.board-totals .totals-side span { display: inline-block; min-width: 4.4rem; font-weight: 400; color: var(--ink-soft); }
.board-totals .totals-over { color: #8a4b00; }
.recent-details { margin-top: 0.9rem; }
.recent-details > summary { cursor: pointer; font-weight: 700; font-size: 1rem; }
.recent-details > summary .chip-count { font-weight: 400; color: var(--ink-soft); margin-left: 0.3rem; }
.board-totals .totals-note { color: var(--ink-soft); font-size: 0.8rem; font-weight: 400; max-width: 17rem; }
.board-totals .totals-note span { display: block; min-width: 0; font-weight: 700; color: #8a4b00; }

/* Concerts */
.status-chip.av-confirmed { background: #d8f0dc; color: #1d6b34; }
.status-chip.av-unavailable { background: #fbe0e0; color: #a12b2b; }
.status-chip.av-no_reply { background: #ececea; color: #55544f; }
.avail-summary { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: center; margin: 0.25rem 0 0.75rem; }
.avail-pill { display: inline-block; padding: 0.15rem 0.7rem; border-radius: 999px; font-size: 0.85rem; font-weight: 600; white-space: nowrap; }
.avail-pill.av-confirmed { background: #d8f0dc; color: #1d6b34; }
.avail-pill.av-unavailable { background: #fbe0e0; color: #a12b2b; }
.avail-pill.av-no_reply { background: #ececea; color: #55544f; }
.status-chip.av-not_needed { background: #e4e8ee; color: #3d4a5c; }
.avail-pill.av-not_needed { background: #e4e8ee; color: #3d4a5c; }

/* Labelled filter rows (concert page): who they are, and what they have answered */
.filter-rows { flex-direction: column; align-items: stretch; }
.filter-line { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.filter-line .count { margin-left: 0.5rem; }
.filter-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); }
.filter-line > .filter-label:not(:first-child) { margin-left: 0.4rem; }

/* Dashboard: "Needs attention" widget */
.attention-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.2rem; margin-top: 20px; }
.attention-card h2 { margin: 0 0 0.6rem; font-size: 1.1rem; }
.attention-item { display: flex; align-items: baseline; gap: 0.7rem; padding: 0.55rem 0.7rem; border-radius: 6px; border-left: 4px solid var(--border-soft); text-decoration: none; color: inherit; }
.attention-item + .attention-item { margin-top: 0.4rem; }
.attention-item:hover { background: var(--warn-soft); }
.attention-item strong { font-size: 1.5rem; font-variant-numeric: proportional-nums; min-width: 2ch; }
.attention-item.warn { border-left-color: var(--warn); }
.attention-item.bad { border-left-color: #c0392b; }

/* Dashboard graphics */
.dash-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.2rem; margin-top: 1rem; }
.dash-card h2 { margin: 0 0 0.7rem; font-size: 1.1rem; }
.dash-card h2 a { color: inherit; text-decoration: none; }
.dash-card h2 a:hover { text-decoration: underline; }
.dash-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.dash-row .dash-card { margin-top: 1rem; }
.legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; margin: 0.7rem 0 0; font-size: 0.8rem; color: var(--ink-soft); }
.legend strong { color: var(--ink); }
.swatch { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 3px; margin-right: 0.35rem; vertical-align: -0.1em; background: #888; }

/* Next concert: mini platform + section strength */
.concert-grid { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 720px) { .concert-grid { grid-template-columns: 1fr; } }
.mini-platform-link { display: block; text-decoration: none; color: inherit; }
.mini-platform { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px 6px; padding: 0.6rem; background: var(--bg); border-radius: 6px; }
.mini-block { display: flex; flex-wrap: wrap; gap: 3px; align-content: flex-start; justify-content: center; }
.dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--sec, #6b6a66); box-sizing: border-box; }
.dot.seated { background: var(--sec, #6b6a66); }
.dot.spare { border-style: dashed; opacity: 0.35; }
.mini-audience { text-align: center; font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); margin-top: 0.3rem; }
.strength-total { margin: 0 0 0.6rem; }
.strength-row { display: grid; grid-template-columns: 5.5rem 1fr auto; gap: 0.6rem; align-items: center; margin-bottom: 0.45rem; }
.strength-name { font-weight: 600; color: var(--sec, var(--ink)); }
.strength-track { position: relative; display: flex; height: 12px; background: var(--sec-soft, #ececea); border-radius: 4px; overflow: visible; }
.strength-track .seg { height: 100%; }
.strength-track .seg:first-child { border-radius: 4px 0 0 4px; }
.strength-track .seg.seated, .swatch.seated { background: var(--sec, #6b6a66); }
.strength-track .seg.available { background: color-mix(in srgb, var(--sec, #6b6a66) 55%, white); }
.strength-track .seg.awaiting { background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--sec, #6b6a66) 40%, white) 0 3px, transparent 3px 6px); }
.wanted-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); border-radius: 1px; }
.strength-figures { font-size: 0.85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.short-flag { color: var(--warn); font-weight: 600; margin-left: 0.3rem; }
.legend .swatch.seated { background: #555; }
.legend .swatch.available { background: #aaa; }
.legend .swatch.awaiting { background: repeating-linear-gradient(45deg, #bbb 0 3px, transparent 3px 6px); border: 1px solid #ccc; }
.legend .swatch.wanted { width: 2px; height: 0.9rem; border-radius: 1px; background: var(--ink); margin-right: 0.5rem; }

/* Subs strip */
.subs-money { margin: 0 0 0.6rem; }
.subs-bar { display: flex; gap: 2px; height: 16px; border-radius: 4px; overflow: hidden; }
.subs-bar .seg { height: 100%; }
.subs-bar .paid, .swatch.sub-paid { background: #1f7a4d; }
.subs-bar .part, .swatch.sub-part { background: #e0a800; }
.subs-bar .asked, .swatch.sub-asked { background: #8fb0d6; }
.subs-bar .notasked, .swatch.sub-notasked { background: #cfcfc8; }

/* Membership donut */
.mix { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.donut { position: relative; width: 120px; height: 120px; flex: none; }
.donut-track { stroke: #ececea; }
.donut-centre { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.donut-centre strong { font-size: 1.6rem; }
.donut-centre span { font-size: 0.75rem; color: var(--ink-soft); }
.donut-seg.mix-active, .swatch.mix-active { stroke: var(--header); background: var(--header); }
.donut-seg.mix-dep, .swatch.mix-dep { stroke: #4da3ff; background: #4da3ff; }
.donut-seg.mix-waiting, .swatch.mix-waiting { stroke: #e0a800; background: #e0a800; }
.donut-seg { background: none !important; }
.stacked-legend { flex-direction: column; margin: 0; }

/* Section vacancies (members page) */
.vacancy-badge { display: inline-block; margin-left: 0.4rem; padding: 0.05rem 0.5rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; background: #dff3e8; color: #1f6b44; }
.vacancy-badge.low { background: #fdefd0; color: #8a5a00; }
.vacancy-badge.high { background: #fbe0dc; color: #a12a1a; }
.section-tile.active .vacancy-badge { background: rgba(255, 255, 255, 0.92); }
.vacancy-details { margin: 0 0 1rem; }
.vacancy-details summary { cursor: pointer; font-weight: 600; margin-bottom: 0.4rem; }
.vacancy-table { border-collapse: collapse; margin: 0.5rem 0; min-width: 480px; }
.vacancy-table th { text-align: left; font-size: 0.75rem; color: var(--ink-soft); padding: 0.3rem 0.8rem; }
.vacancy-table td { padding: 0.3rem 0.8rem; border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.vacancy-table .vac-name { font-weight: 600; color: var(--sec, var(--ink)); }
.vacancy-table tr.not-sorted { font-style: italic; color: var(--ink-soft); }

/* Dashboard: who we're missing */
.fill-meter { position: relative; height: 18px; background: #ececea; border-radius: 9px; overflow: hidden; margin-bottom: 1rem; }
.fill-meter-bar { display: block; height: 100%; background: linear-gradient(90deg, var(--header), var(--accent-bright)); border-radius: 9px; transition: width 0.6s ease; }
.fill-meter-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; color: var(--ink); mix-blend-mode: normal; text-shadow: 0 0 3px #fff; }
.vacancy-full { font-weight: 700; color: #1f6b44; }
.board-sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.2rem 1.6rem; }
.board-section h3 { margin: 0 0 0.4rem; font-size: 0.95rem; color: var(--sec); border-bottom: 2px solid var(--sec-soft); padding-bottom: 0.25rem; }
.board-row { display: grid; grid-template-columns: 1.4rem 8rem 1fr 2rem; gap: 0.4rem; align-items: center; padding: 0.15rem 0; }
.board-name-sm { font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-dots { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.bdot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; box-sizing: border-box; border: 2px solid var(--sec, #6b6a66); vertical-align: -0.1em; margin-right: 0.15rem; }
.bdot.have { background: var(--sec, #6b6a66); }
.bdot.gap { border: 2px dashed var(--warn); background: transparent; animation: gap-pulse 2.4s ease-in-out infinite; }
@keyframes gap-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .bdot.gap { animation: none; } .fill-meter-bar { transition: none; } }
.board-spare { font-size: 0.7rem; color: var(--ink-soft); margin-left: 0.2rem; }
.board-count { text-align: right; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.board-count strong { color: var(--warn); }
.vacancy-board .legend .bdot { margin-right: 0.35rem; }
.wanted-input { width: 4rem; font: inherit; padding: 0.15rem 0.3rem; border: 1px solid var(--border-soft); border-radius: 5px; text-align: center; }
.wanted-input.save-failed { box-shadow: 0 0 0 2px var(--warn); }
.add-group { margin: 0.6rem 0; }
.add-group > summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; }
.add-group-form { display: flex; flex-wrap: wrap; gap: 0.6rem 0.9rem; align-items: flex-end; margin: 0.6rem 0; }
.add-group-form label { display: flex; flex-direction: column; font-size: 0.75rem; font-weight: 600; color: var(--ink-soft); gap: 0.2rem; }
.add-group-form input, .add-group-form select { font: inherit; padding: 0.35rem; border: 1px solid var(--border-soft); border-radius: 5px; background: var(--surface); }
.add-group-form input[type="number"] { width: 5rem; }
.bdot.cover { background: linear-gradient(90deg, var(--sec, #6b6a66) 50%, transparent 50%); }
.cover-note { font-size: 0.78rem; color: var(--ink-soft); background: #eef2f7; border-radius: 999px; padding: 0.05rem 0.45rem; margin-left: 0.3rem; }

/* Delete controls: set apart and quiet until used */
.danger-zone { margin: 2rem 0 1rem; padding-top: 1rem; border-top: 1px solid var(--border-soft); display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center; }
.btn-danger { background: var(--surface); color: var(--warn); border: 1px solid var(--warn); border-radius: 6px; padding: 0.45rem 0.9rem; font: inherit; font-weight: 600; cursor: pointer; }
.btn-danger:hover { background: var(--warn); color: #fff; }

.group-header.pinned td { background: #efe5f8; border-top: 2px solid #7a3fb0; }
.act-row td form { display: inline-block; margin: 0 0.25rem 0.25rem 0; }
