/* ForgedLife Console: the public site's forge look (site.css) applied to
   the admin dashboard. Dark ground, orange as heat, Bebas Neue headings,
   Inter body, 6px radii, one grain layer. The old variable names
   (--card, --border, --orange, --blue ...) stay as aliases because the
   views reference them inline. */

:root {
  color-scheme: dark;

  /* Site palette */
  --bg: #0B0B0C;
  --panel: #141416;
  --panel-2: #1B1B1E;
  --heat: #FF6B35;
  --heat-hover: #FF7D4F;
  --heat-dim: rgba(255, 107, 53, 0.35);
  --heat-glow: rgba(255, 107, 53, 0.18);
  --heat-tint: rgba(255, 107, 53, 0.15);
  --text: #F2EFEA;
  --muted: #A8A39C;
  --faint: #7A756E;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --line-input: rgba(255, 255, 255, 0.12);
  --row-line: rgba(255, 255, 255, 0.06);
  --row-hover: rgba(255, 255, 255, 0.03);

  /* Tints */
  --blue: #4C8DFF;
  --green: #4CAF7A;
  --purple: #9B7CFF;
  --teal: #3FBFB0;
  --yellow: #E0B341;
  --danger: #D64545;
  --danger-text: #F07B6E;

  /* Aliases used by the views */
  --card: var(--panel);
  --card-2: var(--panel-2);
  --border: var(--line);
  --border-2: var(--line-strong);
  --text-2: var(--muted);
  --text-3: var(--faint);
  --orange: var(--heat);
  --orange-2: var(--heat);
  --orange-tint: var(--heat-tint);
  --red: var(--danger);

  --shadow: none;
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
  --radius: 6px;
  --radius-sm: 6px;
  --sidebar: 250px;
  --head: 'Bebas Neue', 'Oswald', Impact, 'Arial Narrow', sans-serif;
  --body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font: var(--body);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Grain. One fixed layer, low opacity, no pointer events (same as the site). */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 220px 220px;
}
#root { position: relative; z-index: 1; }

/* Dark scrollbars. */
* { scrollbar-color: rgba(255, 255, 255, 0.18) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.26); background-clip: padding-box; }

a { color: var(--heat); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-color: var(--heat-dim); text-underline-offset: 3px; }

::selection { background: var(--heat-dim); color: var(--text); }

/* Headings: Bebas Neue with tracking. h3 is the eyebrow label used inside cards. */
h1, h2 { margin: 0 0 8px; font-family: var(--head); font-weight: 400; line-height: 1; color: var(--text); }
h1 { font-size: 28px; letter-spacing: 0.04em; }
h2 { font-size: 20px; letter-spacing: 0.05em; }
h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font-family: var(--body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--heat);
}
h3::before { content: ""; width: 18px; height: 1px; background: var(--heat); flex: none; }
p { margin: 0 0 10px; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 0.95em; }
.gold { color: var(--heat); }
.orange { color: var(--heat); }
.green { color: var(--green); }
.red { color: var(--danger-text); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

.icon { display: inline-flex; align-items: center; justify-content: center; flex: none; line-height: 0; }
.icon svg { width: 20px; height: 20px; }

/* ─── Boot and sign-in ─────────────────────────────────────────── */

.boot {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
}

.signin-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.signin-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 32px 32px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55), 0 0 60px var(--heat-glow);
}
.signin-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--heat), transparent 60%);
}
.signin-card .brand {
  flex-direction: column;
  text-align: center;
  gap: 14px;
  padding-bottom: 22px;
  margin-bottom: 4px;
  background: linear-gradient(90deg, transparent 0, var(--heat-dim) 30%, var(--heat) 50%, var(--heat-dim) 70%, transparent 100%) bottom / 100% 1px no-repeat;
}
.signin-card .brand-mark { width: 72px; height: 72px; }
.signin-card .brand-text { align-items: center; gap: 8px; }
.signin-card .brand-text > span:first-child { font-size: 44px; letter-spacing: 0.08em; }
.signin-card > p.muted { color: var(--muted); font-size: 14px; line-height: 1.5; }
.signin-card h1 { font-size: 32px; letter-spacing: 0.03em; line-height: 1; }

/* Anvil, wordmark, and the Console sub-label. */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
.brand-mark { width: 34px; height: 34px; display: block; object-fit: contain; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1; gap: 3px; }
.brand-text > span:first-child { font-family: var(--head); font-size: 22px; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1; }
.brand-sub { color: var(--heat); font-weight: 600; font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; }

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 18px 0;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }

/* ─── Layout ───────────────────────────────────────────────────── */

.app {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 20px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
}

.nav-section { display: flex; flex-direction: column; gap: 2px; }
.nav-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  line-height: 1.35;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
  padding: 0 12px;
  margin-bottom: 8px;
  font-weight: 600;
}
.nav-title .church-logo { flex: none; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 10px;
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.3;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav-link .icon { color: var(--faint); transition: color 0.15s; }
.nav-link:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); text-decoration: none; }
.nav-link:hover .icon { color: var(--muted); }
.nav-link.active { background: rgba(255, 107, 53, 0.08); border-left-color: var(--heat); color: var(--heat); font-weight: 600; }
.nav-link.active .icon { color: var(--heat); }

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.who { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--faint); padding: 0 6px; line-height: 1.3; }
.who strong { color: var(--text); display: block; font-size: 14px; font-weight: 600; }
.sidebar-footer .btn { width: 100%; }

.sidebar .menu-toggle { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.content { padding: 24px 30px 60px; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 30px;
  background: rgba(11, 11, 12, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { margin: 0; font-size: 28px; letter-spacing: 0.04em; line-height: 1; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 6px; }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  max-width: 260px;
  transition: border-color 0.15s;
}
.pill:hover { text-decoration: none; border-color: var(--line-strong); }
.pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill .church-logo { flex: none; }
/* The right side holds the church pill only (the signed-in name is in the sidebar footer); it may be empty. */
.topbar-right:empty { display: none; }

/* ─── Cards and grids ──────────────────────────────────────────── */

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--heat), transparent 60%);
  pointer-events: none;
}
.card h2 { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card h2 .badge, .card h2 .btn, .card h2 a { font-family: var(--body); letter-spacing: 0.04em; }
.card h2 a.small { font-size: 13px; font-weight: 500; letter-spacing: 0; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-bottom: 16px; }

.stat {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--text);
}
a.stat:hover { text-decoration: none; border-color: var(--line-strong); }
.stat-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 600; }
.stat-value { font-family: var(--head); font-size: 30px; line-height: 1; margin-top: 8px; letter-spacing: 0.02em; }
.stat-detail { font-size: 12px; color: var(--muted); margin-top: 4px; }
/* The number carries the meaning: amber = at risk, green = good. */
.stat.amber .stat-value { color: var(--yellow); }
.stat.green .stat-value { color: var(--green); }
.stat-row { display: flex; gap: 12px; }
.stat-row .stat { flex: 1 1 0; }

/* Stat tiles: raised dark panel, a thin colored rule on top per tint, the
   icon in a small tinted square, label, big Bebas number. */
.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 16px; }
.tile {
  --tile-fg: var(--heat);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  border-top: 2px solid var(--tile-fg);
  background: var(--panel-2);
  color: var(--text);
  min-height: 124px;
  text-decoration: none;
  transition: border-color 0.15s;
}
a.tile:hover { text-decoration: none; border-color: var(--line-strong); border-top-color: var(--tile-fg); }
.tile-icon {
  width: 34px;
  height: 34px;
  border-radius: 4px;
  background: var(--tile-tint, var(--heat-tint));
  color: var(--tile-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tile-icon svg { width: 18px; height: 18px; }
.tile-label { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.tile-value { font-family: var(--head); font-size: 32px; line-height: 1; letter-spacing: 0.02em; color: var(--text); margin-top: -4px; }
.tile-detail { font-size: 12px; color: var(--muted); margin-top: -4px; }
.tile.orange { --tile-fg: var(--heat); --tile-tint: rgba(255, 107, 53, 0.15); }
.tile.blue { --tile-fg: var(--blue); --tile-tint: rgba(76, 141, 255, 0.15); }
.tile.green { --tile-fg: var(--green); --tile-tint: rgba(76, 175, 122, 0.15); }
.tile.purple { --tile-fg: var(--purple); --tile-tint: rgba(155, 124, 255, 0.15); }
.tile.teal { --tile-fg: var(--teal); --tile-tint: rgba(63, 191, 176, 0.15); }
.tile.yellow { --tile-fg: var(--yellow); --tile-tint: rgba(224, 179, 65, 0.15); }
.tile.gray { --tile-fg: var(--muted); --tile-tint: rgba(168, 163, 156, 0.15); }

.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.code-big {
  font-family: var(--head);
  font-size: 48px;
  line-height: 1;
  letter-spacing: 0.1em;
  color: var(--heat);
}

/* The QR svg draws its own white quiet zone; the box only frames it. */
.qr-box {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  display: inline-block;
  line-height: 0;
  overflow: hidden;
}

/* Church logo (data URL) or the chapel placeholder, in several sizes. */
.church-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  overflow: hidden;
  flex: none;
}
.church-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.church-logo .icon { width: 62%; height: 62%; }
.church-logo .icon svg { width: 100%; height: 100%; }
.church-logo.lg { width: 96px; height: 96px; border-radius: var(--radius); border-color: var(--line-strong); }
.church-logo.md { width: 56px; height: 56px; border-radius: var(--radius); }
.church-logo.sm { width: 28px; height: 28px; border-radius: 4px; }

/* ─── Forms ────────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 600; }
.hint { font-size: 12px; color: var(--faint); }
.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }

input, select, textarea {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line-input);
  border-radius: var(--radius);
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--heat);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.25);
}
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--heat);
  outline-offset: 2px;
}
input[type="checkbox"] { width: auto; accent-color: var(--heat); }
input[type="file"] { display: none; }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.8); cursor: pointer; }
textarea { min-height: 120px; resize: vertical; }
select { appearance: auto; }
select option { background: var(--panel-2); color: var(--text); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 8px; }
.check input { width: 18px; height: 18px; margin: 0; }
input:disabled, select:disabled, textarea:disabled, button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Buttons. One filled (heat) button per view; the rest are outlined. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--heat);
  background: var(--heat);
  color: #0B0B0C;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn:hover:not(:disabled) { background: var(--heat-hover); border-color: var(--heat-hover); box-shadow: 0 0 0 4px var(--heat-glow); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: transparent; border-color: var(--text); box-shadow: none; }
.btn-gold { background: transparent; border-color: rgba(76, 141, 255, 0.5); color: var(--blue); }
.btn-gold:hover:not(:disabled) { background: rgba(76, 141, 255, 0.1); border-color: var(--blue); box-shadow: none; }
.btn-danger { background: transparent; border-color: rgba(214, 69, 69, 0.55); color: var(--danger-text); }
.btn-danger:hover:not(:disabled) { background: rgba(214, 69, 69, 0.12); border-color: var(--danger); box-shadow: none; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #0B0B0C; }
.btn-danger-solid:hover:not(:disabled) { background: #E25A5A; border-color: #E25A5A; box-shadow: 0 0 0 4px rgba(214, 69, 69, 0.2); }
.btn-small { padding: 5px 10px; font-size: 13px; font-weight: 600; }
.btn-wide { width: 100%; }
.btn-link { background: none; border: none; color: var(--heat); padding: 0; font: inherit; cursor: pointer; }
.btn-link:hover:not(:disabled) { background: none; box-shadow: none; text-decoration: underline; text-decoration-color: var(--heat-dim); text-underline-offset: 3px; }
.btn .icon svg { width: 16px; height: 16px; }

/* ─── Tables ───────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: transparent; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--row-line); vertical-align: middle; }
th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--faint);
  background: var(--panel);
  border-bottom: 1px solid var(--line-strong);
  position: sticky;
  top: 0;
  font-weight: 600;
  white-space: nowrap;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--row-hover); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap.compact th, .table-wrap.compact td { padding: 7px 10px; font-size: 13px; }

/* ─── Badges, avatars, lists ───────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2;
  background: rgba(168, 163, 156, 0.15);
  color: var(--muted);
  white-space: nowrap;
}
.badge.orange { background: var(--heat-tint); color: var(--heat); }
.badge.green { background: rgba(76, 175, 122, 0.15); color: var(--green); }
.badge.red { background: rgba(214, 69, 69, 0.15); color: var(--danger-text); }
.badge.blue, .badge.gold { background: rgba(76, 141, 255, 0.15); color: var(--blue); }
.badge.gray { background: rgba(168, 163, 156, 0.15); color: var(--muted); }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  color: var(--heat);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.avatar.amber { color: var(--yellow); border-color: rgba(224, 179, 65, 0.45); background: rgba(224, 179, 65, 0.12); }
.avatar.heat { color: var(--heat); border-color: rgba(255, 107, 53, 0.45); background: rgba(255, 107, 53, 0.12); }
.avatar.steel { color: var(--muted); }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }

.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person-text { min-width: 0; }
.person-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── Redesign pieces ──────────────────────────────────────────── */

/* Week N of M as segments. */
.weekbar { display: flex; gap: 4px; }
.weekbar span { flex: 1 1 0; height: 6px; border-radius: 3px; background: var(--line); }
.weekbar span.on { background: var(--heat); }

/* Filter chips. */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.chip:hover { border-color: var(--heat-dim); }
.chip.active { border-color: var(--heat); background: var(--heat-tint); color: var(--heat); }
.chip-count { font-size: 11px; color: var(--muted); }
.chip.active .chip-count { color: var(--heat); }

/* Tab strip of links (one campaign's sections). They read as controls: a
   3px rule under the strip, the active tab lifted onto a panel with the
   heat rule and full text, the others muted until hovered. The strip's
   rule is an inset shadow (not a border) so the active tab's own rule
   sits exactly on it; a negative margin would be clipped by overflow-x. */
.tabs { display: flex; gap: 4px; box-shadow: inset 0 -3px 0 var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab {
  padding: 10px 14px 12px;
  border: 1px solid transparent;
  border-bottom: 3px solid transparent;
  border-radius: var(--radius) var(--radius) 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.tab:hover { text-decoration: none; color: var(--text); background: var(--panel-2); }
.tab.active {
  color: var(--text);
  background: var(--panel);
  border-color: var(--line);
  border-bottom-color: var(--heat);
}
.tab-count { margin-left: 8px; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--panel-2); padding: 2px 7px; border-radius: 4px; vertical-align: 1px; }
.tab:hover .tab-count { background: var(--panel); }
.tab.active .tab-count { color: var(--heat); background: var(--heat-tint); }

/* Main column plus a side panel (member drawer, group members). */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.split-main { min-width: 0; }
.drawer {
  position: sticky;
  top: 90px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.drawer.hidden { display: none; }
.split:has(.drawer.hidden) { grid-template-columns: minmax(0, 1fr); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.drawer-head h2 { margin-bottom: 4px; }

/* Home: the running campaign, and the rows that need attention. */
.hero-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.hero-head h2 { font-size: 30px; margin: 6px 0 4px; }
.attention-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--row-line);
}
.attention-row:last-child { border-bottom: none; }
.attention-when { font-size: 13px; font-weight: 600; color: var(--yellow); white-space: nowrap; }
.todo-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.todo-row .todo-icon { width: 36px; height: 36px; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; flex: none; background: rgba(168, 163, 156, 0.14); color: var(--muted); }
.todo-row .todo-icon.amber { background: rgba(224, 179, 65, 0.14); color: var(--yellow); }
.todo-row .todo-text { flex: 1 1 auto; min-width: 0; }
.todo-row .todo-title { font-weight: 600; }

/* Setup checklist for a church with nothing running yet. */
.setup-step { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--row-line); }
.setup-step:last-child { border-bottom: none; }
.setup-mark {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--line-strong); color: var(--muted); font-size: 12px; font-weight: 700;
}
.setup-mark.done { background: var(--green); border-color: var(--green); color: #0B0B0C; }
.setup-mark.now { border-color: var(--heat); color: var(--heat); }
.setup-step.done .setup-title { color: var(--muted); text-decoration: line-through; }
.setup-title { font-weight: 600; font-size: 15px; }
.progress { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--green); border-radius: 6px; }

/* Campaign cards on the Campaigns page. */
.campaign-card .campaign-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.campaign-card .campaign-head h2 { font-size: 24px; margin: 0 0 4px; }
.campaign-card .campaign-week { width: 260px; max-width: 100%; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.campaign-card .campaign-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.campaign-card .campaign-foot .stat-row { flex: 1 1 auto; }
.section-label { margin: 6px 0 -6px; }

/* Code + small QR on Home. */
.code-mini { display: flex; align-items: center; gap: 14px; }
.code-mini .qr { width: 64px; height: 64px; border-radius: var(--radius); background: #FFFFFF; padding: 4px; flex: none; }
.code-mini .qr svg { width: 100%; height: 100%; display: block; }
.code-mini .code-big { font-size: 30px; }

.list { display: flex; flex-direction: column; gap: 8px; }
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.picker { position: relative; }
.picker-results { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.picker-row:hover { border-color: var(--heat); background: rgba(255, 107, 53, 0.08); }
.picker-name { font-weight: 600; }

.empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); background: transparent; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 14px 0; }
.notice {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(224, 179, 65, 0.1);
  border: 1px solid rgba(224, 179, 65, 0.35);
  border-left: 3px solid var(--yellow);
  color: var(--text);
  font-size: 14px;
}
.notice.warn { background: rgba(214, 69, 69, 0.1); border-color: rgba(214, 69, 69, 0.35); border-left-color: var(--danger); }

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  border-top-color: var(--heat);
  animation: spin 0.8s linear infinite;
  display: inline-block;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Section header inside a card (title + action button) ────── */

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.section-head h2 { margin: 0; }

/* ─── Announcements ────────────────────────────────────────────── */

.announcement { border-left: 2px solid var(--heat); padding-left: 12px; margin-bottom: 14px; }
.announcement .title { font-weight: 600; }
.announcement .body { white-space: pre-wrap; color: var(--muted); margin: 4px 0; }
.counter { font-size: 12px; color: var(--faint); text-align: right; }
.counter.over { color: var(--danger-text); }

/* ─── Charts ───────────────────────────────────────────────────── */

.chart { width: 100%; height: auto; display: block; }
.chart-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 72px; gap: 10px; align-items: center; font-size: 13px; }
.bar-track { height: 8px; background: rgba(255, 255, 255, 0.08); border-radius: 2px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--heat); border-radius: 2px; }
.bar-fill.gold, .bar-fill.blue { background: var(--blue); }

/* ─── Toasts ───────────────────────────────────────────────────── */

#toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  max-width: min(420px, calc(100vw - 32px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--green); }
.toast-text { flex: 1; word-break: break-word; }
.toast-close { background: none; border: none; color: var(--faint); cursor: pointer; font: inherit; font-size: 12px; padding: 0; }
.toast-close:hover { color: var(--text); }

/* ─── Modals ───────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 90;
}
.modal {
  position: relative;
  width: min(460px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-top: 2px solid var(--heat);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-lg);
}
.modal.wide { width: min(640px, 100%); }
.modal-title { margin-bottom: 12px; font-size: 22px; }
.modal-body p { color: var(--muted); }
.modal-body .field { margin-bottom: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* ─── Expandable table rows (group members) ───────────────────── */

tr.expand-row > td { background: rgba(255, 255, 255, 0.02); padding: 12px 16px 14px; }
tr.expand-row:hover > td { background: rgba(255, 255, 255, 0.02); }
.members { display: flex; flex-direction: column; gap: 6px; }
.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}
.member-row .row { gap: 6px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ─── Responsive ───────────────────────────────────────────────── */

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    max-height: none;
    z-index: 20;
    padding: 12px 14px;
    gap: 10px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .sidebar.collapsed .nav-section, .sidebar.collapsed .sidebar-footer { display: none; }
  .sidebar .menu-toggle { display: inline-flex; }
  .topbar { position: static; padding: 14px 16px; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .topbar h1 { font-size: 26px; }
  .content { padding: 18px 16px 50px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  .drawer { position: static; }
  .stat-row { flex-wrap: wrap; }
  .stat-row .stat { flex: 1 1 calc(50% - 6px); }
  .attention-row { grid-template-columns: minmax(0, 1fr) auto; }
  .attention-row .attention-note { display: none; }
  .hero-head h2 { font-size: 24px; }
  .bar-row { grid-template-columns: 90px 1fr 60px; }
  .code-big { font-size: 38px; }
  .pill { max-width: 180px; }
  .signin-card { padding: 28px 22px 24px; }
  .signin-card .brand-text > span:first-child { font-size: 38px; }
}

/* Phone widths: the four campaign tabs as two rows of two, each on its own
   rule, so none hides off the right edge behind a scroll. */
@media (max-width: 520px) {
  .tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; box-shadow: none; overflow: visible; }
  .tab { text-align: center; border-bottom-color: var(--line); padding: 10px 8px 11px; font-size: 14px; }
  .tab.active { border-bottom-color: var(--heat); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .spinner { animation-duration: 1.6s; }
}

/* ─── Shared bits for the Campaign and Members pages ─────────────────── */

.badge.amber { background: rgba(224, 179, 65, 0.15); color: var(--yellow); }
.amber-text { color: var(--yellow); }
.green-text { color: var(--green); }

/* Row menu (the "more" button on a table row). */
.row-menu {
  position: absolute; z-index: 80; min-width: 200px; padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.row-menu-item {
  background: none; border: none; color: var(--text); font: inherit; font-size: 13px; font-weight: 500;
  text-align: left; justify-content: flex-start; padding: 8px 10px; border-radius: 4px; cursor: pointer;
}
.row-menu-item:hover:not(:disabled) { background: var(--row-hover); }
.row-menu-item.danger { color: var(--danger-text); }

/* ─── Campaign page ──────────────────────────────────────────────────── */

.campaign-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 32px; margin: 0 0 6px; }
.campaign-title .badge { font-family: var(--body); letter-spacing: 0.08em; }
.count-note { font-family: var(--body); font-weight: 500; letter-spacing: 0; }
.group-selected > td { background: rgba(255, 107, 53, 0.08); }
.groups-table td:first-child { min-width: 130px; }
.groups-table.drawer-open .col-leader { display: none; }
.drawer-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--row-line); }
.drawer-row:last-of-type { border-bottom: none; }
.drawer-row .person { flex: 1 1 auto; min-width: 0; }
.drawer-row .person-name { overflow: hidden; text-overflow: ellipsis; }
.drawer-row .person-text > div + div { white-space: normal; line-height: 1.35; }
.drawer-row .row { flex: none; }
.person-name .badge { margin-left: 8px; vertical-align: 1px; }
/* A name with a badge after it (Leader, Guest) wraps in a narrow column instead of clipping the badge away. */
.person-name:has(.badge) { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; row-gap: 3px; white-space: normal; overflow: visible; line-height: 1.35; }
.person-name:has(.badge) .badge { margin-left: 0; }
/* Two badges in one cell ("2 at risk", "1 waiting") sit side by side and wrap when the column is narrow. */
.badges { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
/* A checkbox with a label and a hint under it: the group drawer's approval
   switch, and the campaign forms' "Public study" box (.opt-*). */
.approval-row, .opt-row { align-items: flex-start; gap: 10px; margin: 14px 0 6px; cursor: pointer; }
.approval-row input, .opt-row input { margin-top: 2px; flex: none; }
.approval-row:has(input:disabled), .opt-row:has(input:disabled) { cursor: default; }
.approval-text, .opt-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.approval-label, .opt-label { font-weight: 600; font-size: 14px; }
.approval-hint, .opt-hint { font-size: 12px; color: var(--faint); line-height: 1.45; }
.modal-body .opt-row { margin: 4px 0 10px; }
.drawer-section { margin: 12px 0 0; }
.drawer-section.amber { color: var(--yellow); }
.drawer-section.amber::before { background: var(--yellow); }
.waiting-block { margin-bottom: 2px; }

/* ─── Members page ───────────────────────────────────────────────────── */

.members-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.members-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-box {
  display: flex; align-items: center; gap: 8px; width: 220px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel-2); color: var(--faint);
}
.search-box:focus-within { border-color: var(--heat); box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.25); }
.search-box .icon svg { width: 15px; height: 15px; }
.search-box input { border: none; background: none; padding: 7px 0; font-size: 13px; }
.search-box input:focus { border: none; box-shadow: none; outline: none; }
.members-table td:first-child { min-width: 180px; }
.members-table.drawer-open .col-streak { display: none; }
.members-table.drawer-open th, .members-table.drawer-open td { padding-left: 8px; padding-right: 8px; }
.members-table td:last-child .btn { padding-left: 6px; padding-right: 6px; }
.members-table.drawer-open .person { gap: 8px; }
.members-table.drawer-open .member-tags { gap: 6px; }
.members-table .member-cell { flex-wrap: nowrap; }
.member-tags { display: flex; align-items: center; gap: 8px; min-width: 0; }
.member-name { font-weight: 600; white-space: nowrap; }
.member-selected > td { background: rgba(255, 107, 53, 0.08); }
.drawer-body { display: flex; flex-direction: column; gap: 14px; }
.drawer-person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.drawer-person h2 { font-size: 24px; }
.drawer .stat-row { gap: 10px; }
.drawer .stat { padding: 10px 12px; }
.drawer .stat-value { font-size: 26px; }

@media (max-width: 860px) {
  .campaign-title { font-size: 26px; }
  .members-head { align-items: stretch; }
  .members-tools { width: 100%; }
  .search-box { flex: 1 1 160px; width: auto; }
}

/* ─── Help page ──────────────────────────────────────────────────────── */
/* #/help: a sticky table of contents on the left, one card per section.
   Sections carry scroll-margin so a jump lands under the sticky top bar. */

.help-page { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.help-body { min-width: 0; }
.help-toc { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 2px; }
.help-toc h3 { margin: 0 0 8px; padding-left: 10px; }
.help-toc-link {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 10px;
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.help-toc-link:hover { text-decoration: none; color: var(--text); background: rgba(255, 255, 255, 0.04); }
.help-toc-link.active { color: var(--heat); border-left-color: var(--heat); background: rgba(255, 107, 53, 0.08); font-weight: 600; }
.help-toc-num { font-family: var(--head); font-size: 15px; letter-spacing: 0.04em; color: var(--faint); min-width: 12px; }
.help-toc-link.active .help-toc-num { color: var(--heat); }

.help-section { scroll-margin-top: 84px; }
.help-section h2 { font-size: 24px; margin-bottom: 14px; }
.help-section p { line-height: 1.55; }
.help-section p:last-child { margin-bottom: 0; }
.help-section a { font-weight: 600; }
.help-lead { color: var(--muted); }

/* The diagram scales with the card. Two drawings of the same picture:
   the wide one down to about 760px, the stacked one on a phone, so the
   text never shrinks past reading size. */
.help-diagram-wrap { margin: 4px 0 16px; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.help-diagram { display: block; width: 100%; height: auto; }
.help-diagram text { font-family: var(--body); }
.help-diagram-narrow { display: none; max-width: 460px; margin: 0 auto; }

/* Glossary: term on the left, meaning on the right; stacked on a phone. */
.help-glossary { display: grid; grid-template-columns: 190px minmax(0, 1fr); margin: 0; }
.help-glossary dt { font-weight: 600; padding: 10px 16px 10px 0; border-top: 1px solid var(--row-line); }
.help-glossary dd { margin: 0; padding: 10px 0; border-top: 1px solid var(--row-line); color: var(--muted); line-height: 1.5; }
.help-glossary dt:first-of-type, .help-glossary dt:first-of-type + dd { border-top: none; padding-top: 0; }

/* Numbered steps (getting started, the member's flow). */
.help-steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.help-steps li { display: flex; align-items: flex-start; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--row-line); line-height: 1.5; }
.help-steps li:first-child { padding-top: 2px; }
.help-steps li:last-child { border-bottom: none; padding-bottom: 2px; }
.help-step-num {
  width: 28px; height: 28px; border-radius: 50%; flex: none; margin-top: 1px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--line-strong); color: var(--heat); font-size: 12px; font-weight: 700;
}
.help-step-text { min-width: 0; }
.help-step-title { display: block; font-weight: 600; }
.help-step-detail { display: block; color: var(--muted); }

/* Plain list with a heat dot. */
.help-list { margin: 0; padding: 0; list-style: none; }
.help-list li { position: relative; padding: 9px 0 9px 18px; border-bottom: 1px solid var(--row-line); line-height: 1.5; }
.help-list li:last-child { border-bottom: none; }
.help-list li::before { content: ""; position: absolute; left: 0; top: 17px; width: 6px; height: 6px; border-radius: 50%; background: var(--heat); }

/* Question and answer. */
.help-qa { margin: 0; }
.help-qa dt { font-weight: 600; padding-top: 12px; border-top: 1px solid var(--row-line); }
.help-qa dt:first-of-type { border-top: none; padding-top: 0; }
.help-qa dd { margin: 4px 0 12px; color: var(--muted); line-height: 1.5; }
.help-qa dd:last-of-type { margin-bottom: 0; }

@media (max-width: 860px) {
  .help-page { grid-template-columns: 1fr; gap: 14px; }
  /* The contents become a chip row above the sections; the sidebar head
     stays sticky at the top, so jumps land just under it. */
  .help-toc { position: static; flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .help-toc h3 { width: 100%; padding-left: 0; margin-bottom: 4px; }
  .help-toc-link { border: 1px solid var(--line-strong); border-radius: 999px; padding: 6px 12px; font-size: 13px; }
  .help-toc-link.active { border-color: var(--heat); background: var(--heat-tint); }
  .help-toc-num { font-size: 14px; min-width: 0; }
  .help-section { scroll-margin-top: 72px; }
  .help-section h2 { font-size: 22px; }
  .help-glossary { grid-template-columns: 1fr; }
  .help-glossary dt { padding-bottom: 2px; padding-right: 0; }
  .help-glossary dd { border-top: none; padding-top: 0; }
}

@media (max-width: 760px) {
  .help-diagram-wide { display: none; }
  .help-diagram-narrow { display: block; }
}

/* ─── Challenges page ─────────────────────────────────────────────────── */
/* #/challenges (ForgedLife admin): a totals row with a twelve-month strip,
   a filter row (chips, selects, dates, sort, search), a paged table, and
   the read-only drawer with members, tasks, and a seven-day strip. */

.filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; }
.filter-group { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.filter-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 600; }
.filter-group select, .filter-group input[type="date"] { width: auto; min-width: 150px; padding: 6px 10px; font-size: 13px; }
.filter-group input[type="date"] { min-width: 140px; }
.filter-search { flex: 1 1 200px; }
.filter-search .search-box { width: 100%; max-width: 320px; }
.filter-hint { margin-top: 10px; }
.chip:disabled { opacity: 0.45; cursor: not-allowed; }
.chip:disabled:hover { border-color: var(--line-strong); }
.count-note { font-family: var(--body); font-weight: 500; letter-spacing: 0; text-transform: none; }

/* Started per month, team over church: one column per month. */
.month-strip-wrap { margin-top: 16px; }
.month-strip { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; align-items: end; }
.month-col { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.month-num { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; line-height: 1; min-height: 11px; }
.month-bars { display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; width: 100%; max-width: 34px; height: 72px; }
.month-bars > span { display: block; width: 100%; border-radius: 2px 2px 0 0; min-height: 0; }
.month-team { background: var(--heat); }
.month-church { background: var(--blue); }
.month-bars > span[style="height:0%"] { display: none; }
.month-label { font-size: 11px; color: var(--faint); white-space: nowrap; }
.strip-legend { display: flex; gap: 16px; margin-top: 8px; }
.strip-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.swatch.team { background: var(--heat); }
.swatch.church { background: var(--blue); }

/* The table. With the drawer open the main column is 380px narrower, so
   the leader and last-activity columns step aside (the drawer has both). */
.challenges-table td:first-child { min-width: 180px; }
.challenge-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.challenge-title { font-weight: 600; }
.challenge-selected > td { background: rgba(255, 107, 53, 0.08); }
.challenges-table.drawer-open .col-leader, .challenges-table.drawer-open .col-activity { display: none; }
.challenges-table.drawer-open th, .challenges-table.drawer-open td { padding-left: 8px; padding-right: 8px; }
.challenges-table.drawer-open td:first-child { min-width: 150px; }
.filter-search .search-box { flex: none; }

/* Drawer: facts as a two-column list, then members, tasks, activity. */
.drawer-kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: 13.5px; }
.drawer-kv dt { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; padding-top: 3px; }
.drawer-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.drawer-kv dd .btn-small { padding: 2px 8px; font-size: 12px; }
.members-list { display: flex; flex-direction: column; }
.member-line.gone .person-name { color: var(--muted); }
.task-list { display: flex; flex-direction: column; }
.task-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--row-line); font-size: 13.5px; }
.task-line:last-child { border-bottom: none; }
.task-name { min-width: 0; overflow-wrap: anywhere; }
.task-points { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }

/* Seven-day strip: members whose last activity was that day. */
.day-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; align-items: end; }
.day-col { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.day-num { font-size: 11px; color: var(--faint); line-height: 1; min-height: 11px; font-variant-numeric: tabular-nums; }
.day-bar { display: flex; align-items: flex-end; width: 100%; max-width: 30px; height: 44px; background: rgba(255, 255, 255, 0.05); border-radius: 2px; overflow: hidden; }
.day-bar > span { display: block; width: 100%; background: var(--green); border-radius: 2px 2px 0 0; }
.day-label { font-size: 11px; color: var(--faint); white-space: nowrap; }

@media (max-width: 860px) {
  .filters { gap: 10px 12px; }
  .filter-group select, .filter-group input[type="date"] { min-width: 120px; }
  .filter-search { flex-basis: 100%; }
  .filter-search .search-box { max-width: none; }
  .month-strip { gap: 3px; }
  .month-label { font-size: 10px; }
  .month-bars { height: 56px; }
  .drawer-kv { grid-template-columns: 96px minmax(0, 1fr); }
}

/* Phone widths: twelve month labels do not fit, so every third one shows
   (the bar's title still names each month). */
@media (max-width: 520px) {
  .month-col:not(:nth-child(3n + 1)) .month-label { visibility: hidden; }
  .month-num { font-size: 10px; }
}
