:root {
  --church-blue: #1d6fa4;
  --church-blue-dark: #155a87;
  --church-teal: #1a8a9a;
  --church-gold: #b89a3e;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-400: #94a3b8;
  --gray-600: #475569;
  --gray-800: #1e293b;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  margin: 0;
}

/* ── Header ── */
.site-header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0; z-index: 100;
}
.site-header-inner {
  max-width: 960px; margin: 0 auto;
  padding: 0 1rem;
  display: flex; align-items: center; gap: 1rem;
  height: 56px;
}
.church-wordmark {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: inherit;
}
.church-wordmark-icon {
  width: 36px; height: 36px;
  background: var(--church-blue);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 18px; flex-shrink: 0;
}
.church-wordmark-text {
  line-height: 1.2;
}
.church-wordmark-text .line1 {
  font-size: 11px; color: var(--gray-400); font-weight: 500;
  text-transform: uppercase; letter-spacing: .04em;
}
.church-wordmark-text .line2 {
  font-size: 14px; font-weight: 700; color: var(--gray-800);
}
.header-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }

/* ── Tab nav ── */
.tab-nav {
  background: white;
  border-bottom: 1px solid var(--gray-200);
}
.tab-nav-inner {
  max-width: 960px; margin: 0 auto;
  padding: 0 1rem;
  display: flex; gap: 0;
}
.tab-nav a {
  display: inline-block;
  padding: .65rem 1.1rem;
  font-size: .875rem; font-weight: 500;
  color: var(--gray-600);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.tab-nav a:hover { color: var(--church-blue); }
.tab-nav a.active { color: var(--church-blue); border-bottom-color: var(--church-blue); font-weight: 600; }

/* ── Page content ── */
.page-content {
  max-width: 960px; margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* ── Card ── */
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
}
.card-body { padding: 1.25rem; }

/* ── Stat cards ── */
.stat-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: .75rem; margin-bottom: 1.5rem; }
@media(min-width:600px){ .stat-grid { grid-template-columns: repeat(4,1fr); } }
.stat-card {
  background: white; border: 1px solid var(--gray-200); border-radius: 8px;
  padding: 1rem; text-align: center;
}
.stat-card .stat-label { font-size: .75rem; color: var(--gray-400); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .25rem; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; color: var(--church-blue); }
.stat-card .stat-value.green { color: #16a34a; }
.stat-card .stat-value.amber { color: #d97706; }

/* ── Month nav ── */
.month-nav {
  background: white; border: 1px solid var(--gray-200); border-radius: 8px;
  display: flex; align-items: center; padding: .75rem 1rem;
  margin-bottom: 1.25rem;
}
.month-nav h2 { flex: 1; text-align: center; font-size: 1.1rem; font-weight: 700; color: var(--church-blue); margin: 0; }

/* ── Meeting card ── */
.meeting-card {
  background: white; border: 1px solid var(--gray-200); border-radius: 8px;
  margin-bottom: .875rem; overflow: hidden;
  border-left: 4px solid var(--church-blue);
}
.meeting-card.fast { border-left-color: var(--church-gold); }
.meeting-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .875rem 1.1rem;
  cursor: pointer;
  background: var(--gray-50);
  -webkit-user-select: none;
  user-select: none;
}
.meeting-header:hover { background: var(--gray-100); }
.meeting-date { font-weight: 700; color: var(--gray-800); font-size: .95rem; }
.meeting-type { font-size: .75rem; font-weight: 600; color: var(--church-blue); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.meeting-type.fast { color: var(--church-gold); }
.meeting-body { padding: 1rem 1.1rem; display: none; border-top: 1px solid var(--gray-200); }
.meeting-body.open { display: block; }

.info-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: .75rem; }
@media(min-width:600px){ .info-grid { grid-template-columns: repeat(3,1fr); } }
.info-item .info-label { font-size: .7rem; font-weight: 700; color: var(--gray-400); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.info-item .info-value { font-size: .85rem; color: var(--gray-800); }
.info-item .info-empty { font-size: .85rem; color: var(--gray-400); font-style: italic; }

/* ── Speakers list ── */
.speakers-list { margin-top: 1rem; border-top: 1px solid var(--gray-200); padding-top: .875rem; }
.speakers-list-label { font-size: .7rem; font-weight: 700; color: var(--gray-400); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .5rem; }
.speaker-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: .5rem 0; border-bottom: 1px solid var(--gray-100);
  gap: .5rem; flex-wrap: wrap;
}
.speaker-row:last-child { border-bottom: none; }
.speaker-name { font-weight: 600; font-size: .875rem; }
.speaker-topic { font-size: .75rem; color: var(--gray-400); }

/* ── Badge ── */
.badge {
  display: inline-flex; align-items: center;
  padding: .15rem .55rem; border-radius: 999px;
  font-size: .7rem; font-weight: 600;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef9c3; color: #a16207; }
.badge-error   { background: #fee2e2; color: #b91c1c; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
  padding: .45rem 1rem; border-radius: 6px;
  font-size: .875rem; font-weight: 600;
  border: none; cursor: pointer; transition: background .15s, opacity .15s;
  text-decoration: none; line-height: 1;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--church-blue); color: white; }
.btn-primary:hover { background: var(--church-blue-dark); }
.btn-outline { background: white; color: var(--church-blue); border: 1.5px solid var(--church-blue); }
.btn-outline:hover { background: var(--gray-50); }
.btn-ghost { background: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-xs { padding: .2rem .5rem; font-size: .75rem; }

/* ── Form elements ── */
.form-group { display: flex; flex-direction: column; gap: .3rem; }
.form-label { font-size: .8rem; font-weight: 600; color: var(--gray-600); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: .5rem .75rem;
  border: 1.5px solid var(--gray-200); border-radius: 6px;
  font-size: .875rem; color: var(--gray-800);
  background: white;
  transition: border-color .15s;
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--church-blue);
  box-shadow: 0 0 0 3px rgba(29,111,164,.1);
}
.form-textarea { resize: vertical; min-height: 60px; font-family: inherit; }
.form-hint { font-size: .75rem; color: var(--gray-400); }

.form-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media(min-width:480px){ .form-grid { grid-template-columns: 1fr 1fr; } }
.col-span-2 { grid-column: 1 / -1; }

/* Checkbox row */
.check-row {
  display: flex; align-items: center; gap: .6rem;
  background: var(--gray-50); border: 1.5px solid var(--gray-200);
  border-radius: 6px; padding: .65rem .85rem; cursor: pointer;
  font-size: .875rem; font-weight: 500;
}
.check-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--church-blue); cursor: pointer; }

/* Speaker form block */
.speaker-block {
  background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 6px;
  padding: .75rem; margin-bottom: .5rem;
  display: grid; grid-template-columns: 1fr 1fr; gap: .5rem;
}
@media(max-width:479px){ .speaker-block { grid-template-columns: 1fr; } }

/* ── Divider ── */
.section-divider {
  display: flex; align-items: center; gap: .5rem; margin: .5rem 0;
  font-size: .7rem; font-weight: 700; color: var(--church-blue);
  text-transform: uppercase; letter-spacing: .06em;
}
.section-divider::before, .section-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--gray-200);
}

/* ── Hino picker ── */
.hymn-picker-wrap { position: relative; }
.hymn-dropdown {
  position: absolute; top: calc(100% + 2px); left: 0; right: 0; z-index: 200;
  background: white; border: 1.5px solid var(--church-blue);
  border-radius: 6px; max-height: 200px; overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  display: none;
}
.hymn-dropdown.open { display: block; }
.hymn-option {
  padding: .4rem .75rem; cursor: pointer; font-size: .83rem;
  display: flex; gap: .5rem; align-items: center;
}
.hymn-option:hover { background: var(--gray-50); }
.hymn-num { color: var(--gray-400); min-width: 28px; font-weight: 700; font-size: .75rem; }

/* ── Modal ── */
dialog.church-modal {
  position: fixed; inset: 0;
  width: 100%; max-width: 680px;
  max-height: 92vh;
  margin: auto;
  padding: 0;
  border: none;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  background: white;
  overflow: hidden;
  display: flex; flex-direction: column;
}
dialog.church-modal:not([open]) { display: none; }
dialog.church-modal::backdrop { background: rgba(0,0,0,.45); }
.modal-header {
  background: var(--church-blue); color: white;
  padding: 1rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-header h3 { margin: 0; font-size: 1rem; font-weight: 700; }
.modal-body { padding: 1.25rem; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--gray-200);
  display: flex; justify-content: space-between; align-items: center;
  flex-shrink: 0; background: var(--gray-50);
}

/* ── Table ── */
.church-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.church-table th {
  text-align: left; font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--gray-400); padding: .6rem .75rem;
  border-bottom: 1.5px solid var(--gray-200);
}
.church-table td { padding: .65rem .75rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.church-table tr:last-child td { border-bottom: none; }
.church-table tr:hover td { background: var(--gray-50); }

/* ── WhatsApp btn ── */
.wa-btn {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .2rem .55rem; background: #25D366; color: white;
  border-radius: 999px; border: none; cursor: pointer;
  font-size: .72rem; font-weight: 600; text-decoration: none;
}
.wa-btn:hover { background: #1ebe5d; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--gray-400); }
.empty-state .icon { font-size: 3rem; margin-bottom: .75rem; }
.empty-state p { font-size: .9rem; line-height: 1.5; }

/* ── Toast ── */
#toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999;
  padding: .7rem 1.1rem; border-radius: 6px;
  font-size: .875rem; font-weight: 500; color: white;
  background: var(--gray-800);
  transform: translateY(80px); opacity: 0;
  transition: transform .25s, opacity .25s;
  max-width: 300px;
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.error { background: #dc2626; }
#toast.success { background: #16a34a; }

/* ── Search input ── */
.search-wrap { margin-bottom: 1rem; }
.search-input {
  width: 100%; padding: .55rem .85rem;
  border: 1.5px solid var(--gray-200); border-radius: 6px;
  font-size: .875rem; background: var(--gray-50);
  outline: none; transition: border-color .15s;
}
.search-input:focus { border-color: var(--church-blue); background: white; }

/* ── Announce block ── */
.announce-block {
  margin-top: .75rem; padding: .65rem .85rem;
  background: var(--gray-50); border-left: 3px solid var(--gray-200);
  border-radius: 0 6px 6px 0; font-size: .83rem;
}

/* ── Modal close button ── */
.modal-close { color: white; }

/* ── Delete button hidden by default ── */
.btn-delete-hidden { display: none; }

/* ── Modal footer actions ── */
.modal-footer-actions { display: flex; gap: .5rem; margin-left: auto; }

/* ── Table columns ── */
.col-actions { width: 48px; text-align: center; }
.col-hymn-num { width: 60px; }
.hymn-num-cell { font-weight: 700; color: var(--church-blue); }

/* ── Members count label ── */
.members-count { margin-top: .75rem; font-size: .8rem; color: var(--gray-400); }

/* ── Small modal ── */
.church-modal-sm { max-width: 440px; }

/* ── Modal form stack ── */
.modal-form-stack { display: flex; flex-direction: column; gap: 1rem; }

/* ── Table cell helpers ── */
.td-name { font-weight: 600; }
.td-notes { font-size: .85rem; color: var(--gray-600); }
.td-center { text-align: center; }
.td-muted { color: var(--gray-400); font-size: .85rem; }

/* ── Print ── */
@media print {
  .site-header, .tab-nav, .btn, .no-print { display: none !important; }
  .meeting-body { display: block !important; }
  .meeting-card { border: 1px solid #ccc; page-break-inside: avoid; margin-bottom: .5rem; }
}
