/* ===== Kiwanis Rubot — Design System (Kiwanis Club of Leduc) ===== */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-soft: #94a3b8;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --accent: #f59e0b;
  --accent-soft: #fffbeb;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --info: #0284c7;
  --info-soft: #f0f9ff;
  --pink: #db2777;
  --pink-soft: #fdf2f8;
  --purple: #7c3aed;
  --purple-soft: #f5f3ff;
  --sidebar-w: 260px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, 0.12);
  --font: "DM Sans", system-ui, sans-serif;
  --font-display: "Nunito", "DM Sans", system-ui, sans-serif;
  --transition: 0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 15px;
  height: 100%;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden; /* project + hub screens own their scroll regions */
}

button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--primary); }

/* ===== Layout ===== */
.app {
  display: flex;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: linear-gradient(180deg, #1e1b4b 0%, #312e81 50%, #1e3a5f 100%);
  color: #e0e7ff;
  display: flex;
  flex-direction: column;
  transition: width var(--transition), min-width var(--transition);
  z-index: 40;
}

.sidebar.collapsed {
  width: 72px;
  min-width: 72px;
}

.sidebar.collapsed .brand-sub,
.sidebar.collapsed h1,
.sidebar.collapsed .nav-item span:not(.nav-icon),
.sidebar.collapsed .countdown-mini { display: none; }

.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 1rem; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 0.75rem; }
.sidebar.collapsed .nav-icon { margin: 0; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.brand-icon {
  font-size: 1.75rem;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.12);
  border-radius: 12px;
  flex-shrink: 0;
}

.sidebar-brand h1 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.brand-sub {
  font-size: 0.72rem;
  opacity: 0.7;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  color: #c7d2fe;
  font-size: 0.88rem;
  font-weight: 500;
  text-align: left;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 2px;
}

.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 #fbbf24;
}

.nav-icon { font-size: 1.05rem; width: 1.4rem; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.countdown-mini {
  font-size: 0.75rem;
  opacity: 0.85;
  font-weight: 600;
}

.btn-ghost {
  color: #c7d2fe;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* ===== Main ===== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.menu-btn {
  display: none;
  font-size: 1.25rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
}
.menu-btn:hover { background: var(--bg); }

.topbar-title { flex: 1; min-width: 0; }
.topbar-title h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.2;
}
.topbar-title p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.save-indicator {
  font-size: 0.75rem;
  color: var(--success);
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s;
}
.save-indicator.show { opacity: 1; }
.save-indicator.saving { color: var(--warning); }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  scrollbar-width: thin;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  transition: background var(--transition), transform 0.1s, box-shadow var(--transition);
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { background: var(--bg); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #047857; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
}
.btn-icon:hover { background: var(--bg); color: var(--text); }
.btn-icon.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ===== Cards & Grid ===== */
.grid {
  display: grid;
  gap: 1rem;
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.card-header h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-body { padding: 1.15rem; }

.stat-card {
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.stat-card .stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
}
.stat-card .stat-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.stat-card.indigo { border-left: 4px solid var(--primary); }
.stat-card.amber { border-left: 4px solid var(--accent); }
.stat-card.green { border-left: 4px solid var(--success); }
.stat-card.pink { border-left: 4px solid var(--pink); }
.stat-card.sky { border-left: 4px solid var(--info); }
.stat-card.purple { border-left: 4px solid var(--purple); }

/* Progress ring / bar */
.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #818cf8);
  border-radius: 99px;
  transition: width 0.4s ease;
}
.progress-bar.green > div { background: linear-gradient(90deg, var(--success), #34d399); }
.progress-bar.amber > div { background: linear-gradient(90deg, var(--accent), #fbbf24); }

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  font-weight: 500;
}

/* ===== Forms ===== */
.form-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, 1fr);
}
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid .full { grid-column: 1 / -1; }

@media (max-width: 700px) {
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.field label .req { color: var(--danger); }

/* Text/select/textarea only — not radio/checkbox (used in template picker, check lists) */
.field input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]),
.field select,
.field textarea {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.field input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]):focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.field textarea { resize: vertical; min-height: 80px; }
.field .hint {
  font-size: 0.72rem;
  color: var(--text-soft);
}

.field-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}
.field-row .field { flex: 1; }

/* ===== Checklist ===== */
.checklist-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}

.filter-chip {
  padding: 0.35rem 0.75rem;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all var(--transition);
}
.filter-chip:hover, .filter-chip.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.category-block {
  margin-bottom: 1.25rem;
}
.category-block > summary,
.category-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  font-family: var(--font-display);
  user-select: none;
}
.category-header:hover { border-color: var(--border-strong); }
.category-block > summary::-webkit-details-marker { display: none; }

.cat-badge {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font);
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  background: var(--primary-soft);
  color: var(--primary);
}

.task-list {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-left: 0.25rem;
}

.task-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), opacity var(--transition);
}
.task-item:hover { border-color: var(--border-strong); }
.task-item.done {
  opacity: 0.65;
}
.task-item.done .task-title { text-decoration: line-through; color: var(--text-muted); }

.task-check {
  width: 20px;
  height: 20px;
  accent-color: var(--success);
  cursor: pointer;
}

.task-title {
  font-weight: 500;
  font-size: 0.9rem;
}
.task-meta {
  font-size: 0.75rem;
  color: var(--text-soft);
  margin-top: 2px;
}

.priority {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}
.priority.critical { background: var(--danger-soft); color: var(--danger); }
.priority.high { background: var(--warning-soft); color: var(--warning); }
.priority.medium { background: var(--info-soft); color: var(--info); }
.priority.low { background: var(--surface-2); color: var(--text-muted); }

.phase-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--purple-soft);
  color: var(--purple);
  white-space: nowrap;
}

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
table.data-table th {
  text-align: left;
  padding: 0.65rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}
table.data-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data-table tr:hover td { background: var(--surface-2); }
table.data-table .actions {
  display: flex;
  gap: 0.25rem;
  justify-content: flex-end;
}

/* Sortable headers + filters (table-enhance.js) */
.table-enhance-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: 100%;
}
.table-filter-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.table-filter-toolbar .table-global-filter {
  flex: 1;
  min-width: 160px;
  max-width: 360px;
}
.table-filter-toolbar .table-filter-count {
  margin-left: 0.15rem;
  font-weight: 600;
}
.table-filter-toolbar .table-toggle-col-filters.is-active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}
table.data-table th.th-sortable {
  cursor: pointer;
  user-select: none;
  transition: background 0.12s, color 0.12s;
}
table.data-table th.th-sortable:hover {
  color: var(--primary);
  background: var(--primary-soft);
}
table.data-table th.th-sortable::after {
  content: " ⇅";
  opacity: 0.35;
  font-size: 0.85em;
}
table.data-table th.sorted-asc::after,
table.data-table th.sorted-desc::after {
  content: "";
}
table.data-table th.sorted-asc,
table.data-table th.sorted-desc {
  color: var(--primary);
  background: var(--primary-soft);
}
table.data-table th .th-sort-ind {
  font-size: 0.7em;
  opacity: 0.9;
  font-weight: 800;
}
table.data-table tr.table-filter-row th {
  padding: 0.35rem 0.4rem 0.5rem;
  background: #fff;
  border-bottom: 1px solid var(--border);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
table.data-table tr.table-filter-row input.col-filter {
  width: 100%;
  min-width: 4rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--surface-2);
}
table.data-table tr.table-filter-row input.col-filter:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 2px var(--primary-soft);
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge.pending { background: var(--warning-soft); color: var(--warning); }
.badge.approved, .badge.confirmed, .badge.complete, .badge.paid { background: var(--success-soft); color: var(--success); }
.badge.rejected, .badge.cancelled { background: var(--danger-soft); color: var(--danger); }
.badge.waitlist, .badge.in-progress { background: var(--info-soft); color: var(--info); }
.badge.draft { background: var(--surface-2); color: var(--text-muted); }
.badge.contacted { background: var(--purple-soft); color: var(--purple); }

/* ===== Timeline ===== */
.timeline {
  position: relative;
  padding-left: 1.5rem;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item {
  position: relative;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: calc(-1.5rem + 3px);
  top: 1.25rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--primary);
}
.timeline-item.past::before { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
.timeline-item .tl-date {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.25rem;
}
.timeline-item h4 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.timeline-item p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===== Cash flow line chart (Budget) ===== */
.cashflow-card .card-body { padding-top: 1rem; }

.cashflow-chart-wrap {
  background: linear-gradient(180deg, #fafbff 0%, #f8fafc 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 0.75rem 0.65rem;
  margin: 1rem 0 1.25rem;
}

.cashflow-chart-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  margin: 0 0.5rem 0.35rem;
  color: var(--text);
}

.cashflow-chart {
  width: 100%;
  height: auto;
  display: block;
  min-height: 240px;
}

.cf-plot-bg {
  fill: #ffffff;
  stroke: var(--border);
  stroke-width: 1;
}

.cf-grid {
  stroke: #e2e8f0;
  stroke-width: 1;
  stroke-dasharray: 3 4;
}
.cf-grid.zero { stroke: transparent; }

.cf-zero {
  stroke: #94a3b8;
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
}
.cf-zero-label {
  font-size: 10px;
  fill: #64748b;
  font-weight: 600;
}

.cf-tick {
  stroke: #94a3b8;
  stroke-width: 1;
}

.cf-axis-label {
  font-size: 10px;
  fill: #64748b;
  font-family: var(--font);
}
.cf-axis-caption {
  font-size: 10px;
  fill: #94a3b8;
  font-weight: 600;
  font-family: var(--font);
}

.cf-area.ok { fill: url(#cfAreaOk); }
.cf-area.has-shortfall { fill: url(#cfAreaWarn); }

.cf-line {
  stroke-width: 2.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cf-line.ok { stroke: #4f46e5; }
.cf-line.warn { stroke: #dc2626; }

.cf-dot {
  stroke: #fff;
  stroke-width: 1.5;
}
.cf-dot.income { fill: #059669; }
.cf-dot.expense { fill: #db2777; }
.cf-dot.open { fill: #4f46e5; }
.cf-dot.shortfall {
  fill: #dc2626;
  stroke: #fecaca;
  stroke-width: 2;
}

.cf-shortfall-mark {
  stroke: #fca5a5;
  stroke-width: 1;
  stroke-dasharray: 2 3;
  opacity: 0.85;
}

.cashflow-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.15rem;
  padding: 0.55rem 0.5rem 0.15rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}
.cashflow-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.cashflow-legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cashflow-legend .lg-dot.income { background: #059669; }
.cashflow-legend .lg-dot.expense { background: #db2777; }
.cashflow-legend .lg-dot.shortfall { background: #dc2626; box-shadow: 0 0 0 2px #fecaca; }
.cashflow-legend .lg-line {
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: #4f46e5;
}
.cashflow-legend .lg-line.ok { background: #4f46e5; }
.cashflow-legend .lg-zero {
  width: 18px;
  height: 0;
  border-radius: 0;
  border-top: 2px dashed #94a3b8;
  background: transparent;
}

.cashflow-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  margin: 0.75rem 0;
}

/* Cash flow transaction list under the chart */
.cf-table-head {
  display: grid;
  grid-template-columns: 100px 20px 1fr 110px 110px;
  gap: 0.5rem;
  padding: 0.4rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
.cf-table-head .right { text-align: right; }

.cf-timeline-list {
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.cf-row {
  display: grid;
  grid-template-columns: 100px 20px 1fr 110px 110px;
  gap: 0.5rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.86rem;
}
.cf-row:last-child { border-bottom: none; }
.cf-row:hover { background: var(--surface-2); }
.cf-row.shortfall {
  background: var(--danger-soft);
  border-left: 3px solid var(--danger);
}
.cf-row.open { background: var(--primary-soft); }

.cf-row-date {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.cf-row-rail {
  display: flex;
  justify-content: center;
}
.cf-rail-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-strong);
}
.cf-rail-dot.income { background: #059669; }
.cf-rail-dot.expense { background: #db2777; }
.cf-rail-dot.open { background: #4f46e5; }
.cf-rail-dot.shortfall { background: #dc2626; }

.cf-row-title {
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.cf-cat {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-soft);
  background: var(--surface-2);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}
.cf-row-warn {
  font-size: 0.78rem;
  color: var(--danger);
  margin-top: 0.2rem;
  font-weight: 500;
}
.cf-row-delta,
.cf-row-bal {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.85rem;
}
.cf-row-bal.pos { color: var(--success); }
.cf-row-bal.neg { color: var(--danger); }
.cf-row-bal.warn { color: var(--warning); }

.cf-shortfall-list {
  margin: 0.5rem 0 0 1.1rem;
  font-size: 0.88rem;
}
.cf-shortfall-list li { margin-bottom: 0.3rem; }

@media (max-width: 700px) {
  .cf-table-head,
  .cf-row {
    grid-template-columns: 72px 14px 1fr 72px;
  }
  .cf-row-bal,
  .cf-table-head span:last-child { display: none; }
  .cashflow-chart { min-height: 200px; }
}

/* ===== Empty state ===== */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.empty-state p { margin-bottom: 1rem; font-size: 0.9rem; }

/* ===== Section toolbar ===== */
.section-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.25rem;
}
.section-toolbar .spacer { flex: 1; }
.search-input {
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  min-width: 200px;
  background: var(--surface);
}
.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  backdrop-filter: blur(2px);
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal.wide { max-width: 720px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
}
.modal-close {
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  padding: 0.25rem;
  border-radius: 6px;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* ===== Alerts / callouts ===== */
.callout {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 1rem;
  border-left: 4px solid;
}
.callout.info { background: var(--info-soft); border-color: var(--info); color: #0c4a6e; }
.callout.warning { background: var(--warning-soft); border-color: var(--warning); color: #78350f; }
.callout.success { background: var(--success-soft); border-color: var(--success); color: #064e3b; }
.callout.danger { background: var(--danger-soft); border-color: var(--danger); color: #7f1d1d; }

/* ===== Dashboard specific ===== */
.dash-hero {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #db2777 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}
.dash-hero h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}
.dash-hero p { opacity: 0.9; font-size: 0.9rem; }
.countdown-big {
  text-align: center;
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  min-width: 140px;
}
.countdown-big .num {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
}
.countdown-big .lbl {
  font-size: 0.75rem;
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

.cat-progress-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.cat-progress-row {
  display: grid;
  grid-template-columns: 140px 1fr 50px;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.85rem;
}
.cat-progress-row .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-progress-row .pct { text-align: right; font-weight: 700; color: var(--text-muted); font-size: 0.8rem; }

/* Money display */
.money { font-variant-numeric: tabular-nums; font-weight: 600; }
.money.positive { color: var(--success); }
.money.negative { color: var(--danger); }

/* Notes */
.note-card {
  padding: 1rem;
  border-left: 4px solid var(--accent);
  margin-bottom: 0.75rem;
}
.note-card h4 { font-size: 0.95rem; margin-bottom: 0.35rem; }
.note-card p { font-size: 0.88rem; color: var(--text-muted); white-space: pre-wrap; }
.note-card .note-date { font-size: 0.72rem; color: var(--text-soft); margin-top: 0.5rem; }

/* Safety grid */
.safety-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

/* Contact card */
.contact-card {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.contact-card .name {
  font-weight: 700;
  font-family: var(--font-display);
}
.contact-card .role {
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 600;
}
.contact-card .detail {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Tabs within views */
.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.25rem;
  overflow-x: auto;
}
.tab {
  padding: 0.65rem 1rem;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Inline edit cells */
input.inline-input {
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
}
input.inline-input:hover { border-color: var(--border); background: var(--surface); }
input.inline-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 2px var(--primary-soft);
}

/* Responsive sidebar */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform var(--transition);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar.collapsed { width: var(--sidebar-w); min-width: var(--sidebar-w); }
  .sidebar.collapsed .brand-sub,
  .sidebar.collapsed h1,
  .sidebar.collapsed .nav-item span:not(.nav-icon),
  .sidebar.collapsed .countdown-mini { display: block; }
  .sidebar.collapsed .nav-item { justify-content: flex-start; padding: 0.55rem 0.75rem; }
  .menu-btn { display: block; }
  .content { padding: 1rem; }
  .topbar { padding: 0.85rem 1rem; }
  .task-item {
    grid-template-columns: auto 1fr;
    gap: 0.5rem;
  }
  .task-item .priority,
  .task-item .phase-tag,
  .task-item .actions { grid-column: 2; }
  .cat-progress-row { grid-template-columns: 100px 1fr 40px; }
}

/* Utility */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* Print */
@media print {
  .sidebar, .topbar, .btn, .modal-overlay { display: none !important; }
  .main { overflow: visible; }
  .content { overflow: visible; padding: 0; }
  body { overflow: visible; }
}

/* ===== App hub (project list) ===== */
.hub-screen {
  /* Constrain height so overflow-y can scroll (body is overflow:hidden) */
  height: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 600px at 10% -10%, #e0e7ff 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #fce7f3 0%, transparent 50%),
    var(--bg);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.hub-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.75rem;
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.hub-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.hub-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  color: #fff;
  background: linear-gradient(135deg, #4f46e5, #7c3aed 50%, #db2777);
  box-shadow: var(--shadow);
}
.hub-brand h1 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.2;
}
.hub-product {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}
.hub-ver {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 0.75rem;
  margin-left: 0.2rem;
}
.hub-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hub-main {
  flex: 1 0 auto;
  padding: 1.5rem 1.75rem 2.5rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  min-height: 0;
}
.hub-intro {
  margin-bottom: 1.25rem;
}
.hub-intro h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}
.hub-intro p {
  color: var(--text-muted);
  max-width: 60ch;
  font-size: 0.95rem;
}

.hub-project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.hub-project-card {
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color var(--transition), box-shadow var(--transition), transform 0.12s;
  cursor: default;
}
.hub-project-card:hover {
  border-color: #a5b4fc;
  box-shadow: var(--shadow-lg);
}
.hub-project-card.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.hub-project-card.is-past {
  opacity: 0.88;
  background:
    linear-gradient(135deg, rgba(148, 163, 184, 0.12), transparent 55%),
    var(--surface, #fff);
  border-color: #cbd5e1;
}
.hub-project-card.is-past .hub-card-icon {
  filter: grayscale(0.35);
}
.hub-project-card.is-today {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}
.hub-project-card .badge.project-timing {
  margin-left: 0.35rem;
  vertical-align: middle;
}
.text-past { color: #64748b; }
.hub-mini-list li.is-past-project {
  opacity: 0.85;
}
.hub-mini-list li.is-past-project strong {
  color: #64748b;
}

/* Universal past / today / upcoming badges */
.badge.project-timing.past {
  background: #e2e8f0;
  color: #475569;
}
.badge.project-timing.today {
  background: #fef3c7;
  color: #b45309;
}
.badge.project-timing.upcoming {
  background: var(--success-soft, #d1fae5);
  color: var(--success, #047857);
}
.badge.project-timing.undated {
  background: var(--surface-2);
  color: var(--text-muted);
}

.brand-timing.past { color: #fca5a5; font-weight: 700; }
.brand-timing.today { color: #fbbf24; font-weight: 700; }

.project-timing-banner {
  flex-shrink: 0;
  padding: 0.55rem 1.25rem;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
}
.project-timing-banner.is-past {
  background: #f1f5f9;
  color: #334155;
  border-bottom-color: #cbd5e1;
}
.project-timing-banner.is-today {
  background: #fffbeb;
  color: #92400e;
  border-bottom-color: #fcd34d;
}
.project-timing-banner[hidden] { display: none !important; }

#projectApp.project-is-past .sidebar-brand {
  box-shadow: inset 0 -3px 0 #94a3b8;
}
#projectApp.project-is-past .countdown-mini.is-past,
.countdown-mini.is-past {
  color: #94a3b8;
  font-weight: 700;
}

.callout.project-past-callout {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
  margin-bottom: 1rem;
}
.dash-hero.is-past {
  opacity: 0.95;
  filter: saturate(0.85);
}
tr.is-past-event td:first-child {
  box-shadow: inset 3px 0 0 #94a3b8;
}

/* Hub backup + global search */
.hub-search-bar {
  position: relative;
  padding: 0.65rem 1.75rem 0.25rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}
.hub-global-search {
  width: 100%;
  max-width: 520px;
}
.hub-search-hint { margin-left: 0.75rem; }
.hub-search-results {
  position: absolute;
  left: 1.75rem;
  right: 1.75rem;
  top: calc(100% - 0.1rem);
  z-index: 40;
  max-height: 320px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg, 0 12px 32px rgba(15, 23, 42, 0.12));
  max-width: 560px;
}
.hub-search-hit {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.6rem;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border: none;
  border-bottom: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
}
.hub-search-hit:hover { background: var(--primary-soft); }
.hub-search-empty { padding: 0.75rem; color: var(--text-muted); font-size: 0.9rem; }
.hub-backup-line {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.25rem 1.75rem 0.5rem;
  color: var(--text-muted);
  width: 100%;
}

.hub-attention-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.hub-attention-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.hub-attention-item:last-child { border-bottom: none; }
.hub-attention-item.tone-warn { color: #92400e; }
.hub-attention-item.tone-info { color: #1e40af; }

.project-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.chip-btn {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}
.chip-btn:hover { border-color: var(--primary); color: var(--primary); }
.chip-btn.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.roster-flags { margin-top: 0.25rem; display: flex; flex-wrap: wrap; gap: 0.25rem; }
tr.roster-medical-row td { background: #fffbeb; }

/* Undo toast */
.club-undo-toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #1e293b;
  color: #f8fafc;
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.35);
  font-size: 0.9rem;
  font-weight: 600;
  max-width: min(92vw, 420px);
}
.club-undo-toast[hidden] { display: none !important; }
.club-undo-toast .club-undo-dismiss {
  color: #94a3b8;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.15rem 0.35rem;
}
.club-undo-toast .btn-primary {
  background: #38bdf8;
  border-color: #38bdf8;
  color: #0f172a;
}

.hub-search-hint kbd {
  font-size: 0.75rem;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
}

@media print {
  .hub-screen,
  .sidebar,
  .topbar,
  .project-timing-banner,
  .no-print,
  .menu-btn,
  .topbar-actions,
  .section-toolbar .btn,
  .table-filter-toolbar {
    display: none !important;
  }
  #projectApp {
    display: block !important;
  }
  #projectApp.hidden { display: block !important; }
  .main, .content {
    overflow: visible !important;
    padding: 0 !important;
  }
  .dayof-roster, .print-roster {
    break-inside: avoid;
  }
  body { overflow: visible !important; background: #fff !important; }
}

.hub-card-top {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.hub-card-icon {
  font-size: 1.75rem;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border-radius: 12px;
  flex-shrink: 0;
}
.hub-card-meta h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.25;
}
.hub-card-tmpl {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 0.15rem;
}

.hub-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 0.75rem;
  font-size: 0.82rem;
}
.hub-stat-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  font-weight: 700;
  margin-bottom: 0.1rem;
}
.hub-card-progress { height: 6px; }
.hub-card-updated {
  font-size: 0.75rem;
  color: var(--text-soft);
}
.hub-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.15rem;
}

.hub-empty {
  grid-column: 1 / -1;
  padding: 1rem;
}

.hub-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 1.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.7);
}
.hub-footer-muted { opacity: 0.85; }

/* Project chrome: app label above project name */
.brand-text { min-width: 0; }
.brand-app {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a5b4fc;
  margin-bottom: 0.1rem;
}
.sidebar-brand h1 {
  font-size: 0.98rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.nav-item.hub-back {
  margin: 0.5rem 0.5rem 0.25rem;
  width: calc(100% - 1rem);
  background: rgba(255, 255, 255, 0.08);
  color: #e0e7ff;
  font-weight: 600;
}
.nav-item.hub-back:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

@media (max-width: 700px) {
  .hub-header, .hub-main, .hub-footer { padding-left: 1rem; padding-right: 1rem; }
  .hub-header-actions { width: 100%; }
  .hub-header-actions .btn { flex: 1; }
}

/* ===== Template picker (new project modal) ===== */
.template-picker {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.field .template-card,
.template-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  /* override generic .field label styles */
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
  width: 100%;
  box-sizing: border-box;
}
.field .template-card input[type="radio"],
.template-card input[type="radio"] {
  margin-top: 0.35rem;
  accent-color: var(--primary);
  flex-shrink: 0;
  width: auto;
  max-width: 1.1rem;
  height: 1.1rem;
  padding: 0;
  border: none;
  box-shadow: none;
  background: transparent;
}
.template-card-icon {
  font-size: 1.5rem;
  line-height: 1;
  margin-top: 0.1rem;
  flex-shrink: 0;
}
.template-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  flex: 1;
}
.template-card-body strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}
.template-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  font-weight: 400;
}
.template-card:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.template-card.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 1px var(--primary);
}

/* Standard Event module checklist (create project / settings) */
.module-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.35rem 0 0.25rem;
}
.module-preset-btn.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.module-preset-hint {
  margin: 0 0 0.5rem;
}
.module-checklist {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: min(42vh, 320px);
  overflow-y: auto;
  padding: 0.35rem 0.15rem;
  margin: 0.25rem 0 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft, #f8fafc);
}
.module-check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  margin: 0;
  cursor: pointer;
  border-radius: calc(var(--radius) - 2px);
  font-weight: 500;
  color: var(--text);
  width: 100%;
  box-sizing: border-box;
}
.module-check-row:hover {
  background: rgba(255, 255, 255, 0.85);
}
.module-check-row input[type="checkbox"],
.field .module-check-row input[type="checkbox"] {
  margin-top: 0.2rem;
  flex-shrink: 0;
  width: auto;
  max-width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--primary);
}
.module-check-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.module-check-body strong {
  font-size: 0.9rem;
  font-weight: 650;
}
.module-check-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
  line-height: 1.35;
}
.callout-list {
  margin: 0.4rem 0 0 1.1rem;
  padding: 0;
  line-height: 1.45;
}
.callout-list li {
  margin-bottom: 0.25rem;
}

/* ===== Kiwanis Rubot — login + cloud sync ===== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: linear-gradient(145deg, rgba(0, 56, 116, 0.92), rgba(15, 23, 42, 0.94));
  box-sizing: border-box;
}
.login-overlay.hidden {
  display: none !important;
}
body.rubot-locked #hubScreen,
body.rubot-locked #projectApp {
  visibility: hidden;
  pointer-events: none;
}
.login-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: calc(var(--radius) + 4px);
  padding: 1.5rem 1.4rem 1.25rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}
.login-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--primary, #003874);
  color: #fff;
  font-weight: 800;
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.login-brand h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text, #0f172a);
}
.login-club {
  margin: 0.1rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted, #64748b);
}
.login-lead {
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text-muted, #64748b);
  margin: 0 0 1rem;
}
.login-error {
  color: #b91c1c;
  font-size: 0.88rem;
  margin: 0.5rem 0 0;
}
.login-submit {
  width: 100%;
  margin-top: 0.85rem;
}
.login-local {
  width: 100%;
  margin-top: 0.45rem;
  font-size: 0.85rem;
}
.login-hint {
  margin: 0.85rem 0 0;
  text-align: center;
}
.rubot-sync-status {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border, #e2e8f0);
  background: #f8fafc;
  color: var(--text-muted, #64748b);
  max-width: 12rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rubot-sync-status.is-synced {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #065f46;
}
.rubot-sync-status.is-saving,
.rubot-sync-status.is-loading {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1e40af;
}
.rubot-sync-status.is-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}
.rubot-sync-status.is-local,
.rubot-sync-status.is-offline {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}
.rubot-local-banner {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 0.55rem 1rem;
  background: #fffbeb;
  border-bottom: 1px solid #fcd34d;
  color: #78350f;
  font-size: 0.85rem;
  line-height: 1.4;
}
.rubot-local-banner[hidden] {
  display: none !important;
}

/* ===== Club hub tabs & people directory ===== */
.hub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  padding: 0.35rem;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.hub-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-muted);
  border: none;
  background: transparent;
  cursor: pointer;
}
.hub-tab:hover { background: var(--primary-soft); color: var(--primary); }
.hub-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow);
}
.hub-tab-icon { font-size: 1rem; }

.hub-tab-panel { min-height: 280px; }

.hub-mini-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.hub-mini-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.hub-mini-list li:last-child { border-bottom: none; }
.hub-mini-list .btn { margin-left: auto; }

.club-check-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 180px;
  overflow-y: auto;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.club-check-list-tall { max-height: 220px; }
.club-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}
.club-check input { accent-color: var(--primary); }

/* ===== Search-based profile / business linking ===== */
.link-search-field {
  position: relative;
}
.link-search-hint {
  margin: 0.15rem 0 0.5rem;
}
.link-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-height: 2.1rem;
  margin-bottom: 0.55rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.link-chips-empty {
  padding: 0.2rem 0.1rem;
}
.link-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  padding: 0.3rem 0.35rem 0.3rem 0.55rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  font-size: 0.84rem;
}
.link-chip-single {
  border-radius: var(--radius-sm);
}
.link-chip-text {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}
.link-chip-text strong {
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 14rem;
}
.link-chip-role,
.link-search-role-pick {
  font-size: 0.75rem;
  padding: 0.15rem 0.35rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  max-width: 9.5rem;
}
.link-chip-remove {
  display: inline-grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 999px;
  font-size: 1rem;
  line-height: 1;
  color: var(--text-muted);
  flex-shrink: 0;
}
.link-chip-remove:hover {
  background: var(--danger-soft, #fee2e2);
  color: var(--danger, #b91c1c);
}
.link-search-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.link-search-input {
  flex: 1;
  min-width: 12rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}
.link-search-input:focus {
  outline: 2px solid var(--primary-soft);
  border-color: var(--primary);
}
.link-search-results {
  position: relative;
  z-index: 30;
  margin-top: 0.35rem;
  max-height: 220px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow, 0 8px 24px rgba(15, 23, 42, 0.12));
}
.link-search-hit {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
}
.link-search-hit:last-child { border-bottom: none; }
.link-search-hit:hover,
.link-search-hit:focus {
  background: var(--primary-soft);
  outline: none;
}
.link-search-hit-main {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.link-search-hit-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.link-search-empty {
  padding: 0.75rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.club-related-box {
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  font-size: 0.88rem;
  line-height: 1.45;
}
.club-mini-history {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.84rem;
  color: var(--text-muted);
}
.club-mini-history li { margin: 0.15rem 0; }

/* Profile participation history (inside edit modals) */
.profile-part-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 2px solid var(--border);
}
.profile-part-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}
.profile-part-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}
.profile-part-hint { margin: 0 0 0.75rem; }
.profile-part-list {
  margin-bottom: 1rem;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}
.profile-part-list .table-wrap { margin: 0; }
.profile-part-table { font-size: 0.86rem; }
.profile-part-empty {
  padding: 1rem;
  text-align: center;
}
.profile-part-form {
  padding: 0.85rem 1rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: none;
}
.profile-part-form-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.65rem;
}
.profile-part-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.filter-select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 0.88rem;
  min-width: 8rem;
}

@media (max-width: 700px) {
  .hub-tab { flex: 1 1 auto; justify-content: center; font-size: 0.78rem; padding: 0.5rem; }
}

/* ===== Organization health dashboard ===== */
.hub-intro-compact { margin-bottom: 0.75rem; }
.hub-intro-compact h2 { margin-bottom: 0.2rem; }
.org-health {
  margin-bottom: 1.25rem;
}
.org-health-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.org-health-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0 0 0.15rem;
}
.health-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 4.5rem;
  padding: 0.45rem 0.75rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.health-score-n {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.1;
}
.health-score-l {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.health-score-good { background: #ecfdf5; border-color: #a7f3d0; }
.health-score-good .health-score-n { color: #047857; }
.health-score-ok { background: #fffbeb; border-color: #fde68a; }
.health-score-ok .health-score-n { color: #b45309; }
.health-score-watch { background: #fef2f2; border-color: #fecaca; }
.health-score-watch .health-score-n { color: #b91c1c; }

.health-pulse {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}
.health-pulse-card {
  text-align: left;
  padding: 0.7rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
}
button.health-pulse-card:hover {
  border-color: #a5b4fc;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
}
.health-pulse-card strong {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.2;
  margin: 0.15rem 0;
}
.health-of { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.health-kicker {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.health-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
}
.health-backup-good { background: #f0fdf4; border-color: #bbf7d0; }
.health-backup-watch { background: #fff7ed; border-color: #fed7aa; }
.health-backup-status { font-size: 1.15rem !important; }

.health-pipeline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.85rem;
  padding: 0.45rem 0.15rem;
}
.health-pipeline-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.health-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
.health-panel-wide { grid-column: 1 / -1; }
.health-panel .card-header h3 {
  font-size: 0.95rem;
  margin: 0;
}
.health-panel-body {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}
.health-donut-wrap {
  position: relative;
  width: 110px;
  height: 110px;
  flex-shrink: 0;
}
.health-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.health-donut-center strong { font-size: 1.1rem; font-weight: 800; }
.health-donut-center span { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; }
.health-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.82rem;
  flex: 1;
  min-width: 140px;
}
.health-legend li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.25rem 0;
}
.health-legend i {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  flex-shrink: 0;
}
.health-legend b { margin-left: auto; font-weight: 700; }

.health-bar {
  height: 8px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
  margin: 0.35rem 0 0.65rem;
}
.health-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: #818cf8;
  transition: width 0.3s ease;
}
.health-bar.good .health-bar-fill { background: #34d399; }
.health-bar.ok .health-bar-fill { background: #fbbf24; }
.health-bar.watch .health-bar-fill { background: #f87171; }
.health-bar.indigo .health-bar-fill { background: #818cf8; }

.health-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.88rem;
  gap: 0.5rem;
}
.health-mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 0.75rem;
  margin-top: 0.35rem;
}
.health-mini-grid strong { display: block; font-size: 1.05rem; font-weight: 800; }
.mt-1 { margin-top: 0.65rem; }
.text-warn { color: #b45309; }

.health-care-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.75rem;
}
.health-care {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--text-muted);
}
.health-care.on {
  background: #fef3c7;
  color: #92400e;
}

.health-next-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: flex-start;
  margin-bottom: 0.65rem;
}
.health-next-name { font-size: 1rem; display: block; }
.health-next.empty { text-align: left; }

.health-rank-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(60px, 2fr) 2rem;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.4rem;
  font-size: 0.82rem;
}
.health-rank-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
.health-rank-bar-wrap .health-bar { margin: 0; }
.health-rank-n { text-align: right; font-weight: 700; color: var(--text-muted); }

.health-month-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  font-weight: 600;
}
.health-spark { display: block; margin-top: 0.25rem; }

@media (max-width: 800px) {
  .health-grid { grid-template-columns: 1fr; }
  .health-panel-wide { grid-column: auto; }
}

.hub-backup-line.backup-nudge {
  color: #b45309;
  font-weight: 700;
  background: #fffbeb;
  border-radius: 8px;
  padding: 0.35rem 1.75rem;
}
.hub-storage-line {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.75rem 0.35rem;
  width: 100%;
  font-size: 0.8rem;
}
.hub-storage-line.storage-high {
  color: #b45309;
  font-weight: 700;
}
.hub-intro-compact kbd {
  font-size: 0.75rem;
  padding: 0.05rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
}

.club-info-toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 210;
  padding: 0.65rem 1.1rem;
  background: #312e81;
  color: #e0e7ff;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 8px 28px rgba(49, 46, 129, 0.35);
  max-width: min(92vw, 420px);
  text-align: center;
}
.club-info-toast[hidden] { display: none !important; }

.filter-select {
  max-width: 12rem;
}

.whats-new-banner {
  background: linear-gradient(90deg, #eef2ff, #fdf2f8);
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 1rem;
}
.whats-new-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.88rem;
}
.whats-new-inner kbd {
  font-size: 0.72rem;
  padding: 0.05rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
}
