/* ── Variables ─────────────────────────────────────────────────── */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #dde1e7;
  --border-light: #eef0f3;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
  --radius: 8px;
  --radius-sm: 5px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; }

/* ── Header ────────────────────────────────────────────────────── */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
}
.header-logo { display: flex; align-items: center; gap: 12px; }
.header-logo img { height: 32px; width: auto; }
.header-title { font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -0.2px; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.camp-badge {
  background: var(--primary-light); color: var(--primary);
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: 0.5px;
}

/* ── Main Layout ───────────────────────────────────────────────── */
.main-content { max-width: 1200px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 20px; }

/* ── Cards ─────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 12px;
  background: #fafbfc;
}
.card-header h2 { font-size: 15px; font-weight: 600; color: var(--text); }
.step-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: white;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.card-body { padding: 20px; }
.header-right { margin-left: auto; }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; font-family: var(--font);
  cursor: pointer; border: 1px solid transparent; transition: all 0.15s ease;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-outline { background: white; color: var(--text); border-color: var(--border); }
.btn-outline:hover, .btn-outline.active { background: var(--primary); color: white; border-color: var(--primary); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 15px; font-weight: 600; }

/* ── Upload Area ───────────────────────────────────────────────── */
.upload-row { display: flex; gap: 16px; margin-bottom: 20px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.form-control {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; font-family: var(--font); background: white; color: var(--text);
  min-width: 160px;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,78,216,0.1); }

.drop-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 40px 20px; text-align: center; cursor: pointer;
  transition: all 0.2s ease; background: #fafbfc;
}
.drop-zone.drag-over { border-color: var(--primary); background: var(--primary-light); }
.drop-icon { font-size: 36px; margin-bottom: 8px; }
.drop-text { font-size: 16px; font-weight: 500; margin-bottom: 4px; }
.drop-sub { color: var(--text-muted); margin-bottom: 12px; }
.upload-status { margin-top: 14px; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; }
.upload-status.success { background: var(--success-light); color: var(--success); }
.upload-status.error { background: var(--danger-light); color: var(--danger); }
.upload-status.loading { background: var(--primary-light); color: var(--primary); }

/* ── Toolbar ───────────────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.search-wrap { position: relative; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 13px; }
.search-input {
  padding: 7px 12px 7px 32px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; width: 220px; font-family: var(--font);
}
.search-input:focus { outline: none; border-color: var(--primary); }
.filter-group { display: flex; gap: 4px; }
.select-actions { margin-left: auto; display: flex; gap: 6px; }

/* ── Summary Chips ─────────────────────────────────────────────── */
.summary-chips { display: flex; gap: 8px; }
.chip {
  padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.chip-total { background: #f1f5f9; color: #475569; }
.chip-students { background: #dbeafe; color: #1d4ed8; }
.chip-adults { background: #dcfce7; color: #16a34a; }
.chip-warn { background: var(--warning-light); color: var(--warning); }

/* ── Table ─────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 14px; }
.camper-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.camper-table thead { background: #f8fafc; }
.camper-table th {
  padding: 9px 12px; text-align: left; font-size: 11px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.camper-table td { padding: 9px 12px; border-bottom: 1px solid var(--border-light); }
.camper-table tbody tr:last-child td { border-bottom: none; }
.camper-table tbody tr:hover { background: #fafbfc; }
.camper-table tbody tr.selected-row { background: var(--primary-light); }
.camper-table tbody tr.unapproved-row { opacity: 0.65; }

.col-check { width: 36px; }
.col-type { width: 80px; }
.col-grade { width: 60px; }
.col-status { width: 100px; }
.col-data { width: 160px; font-family: monospace; font-size: 12px; color: var(--text-muted); }
.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--primary); }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.badge-child { background: #dbeafe; color: #1d4ed8; }
.badge-adult { background: #dcfce7; color: #16a34a; }
.badge-approved { background: #dcfce7; color: #16a34a; }
.badge-unapproved { background: #fef3c7; color: #92400e; }
.badge-gf { background: #fde68a; color: #78350f; font-size: 10px; margin-left: 4px; }

/* ── Selection Summary ─────────────────────────────────────────── */
.selection-summary {
  background: var(--bg); border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: 13px; color: var(--text-muted);
}
#selectedCount { font-weight: 700; color: var(--text); font-size: 15px; }

/* ── Print Section ─────────────────────────────────────────────── */
.print-options { display: flex; flex-direction: column; gap: 20px; }
.print-group { display: flex; gap: 16px; }
.print-card {
  flex: 1; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: flex; align-items: center; gap: 16px;
  background: #fafbfc;
}
.print-card-icon { font-size: 28px; }
.print-card-info { flex: 1; }
.print-card-info strong { font-size: 20px; display: block; }
.print-card-printer { font-size: 12px; color: var(--text-muted); }
.print-all-wrap { text-align: center; padding: 8px 0; }
.print-status { margin-top: 14px; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; }
.print-status.success { background: var(--success-light); color: var(--success); }
.print-status.error { background: var(--danger-light); color: var(--danger); }

/* ── Modal ─────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal {
  background: white; border-radius: var(--radius); padding: 28px;
  width: 440px; max-width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.modal-body { margin-bottom: 24px; color: var(--text-muted); line-height: 1.7; }
.modal-body strong { color: var(--text); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Utility ───────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Sort indicators ──────────────────────────────────────────── */
.sortable::after { content: ' ↕'; opacity: 0.3; font-size: 10px; }
.sortable.sort-asc::after  { content: ' ↑'; opacity: 1; color: var(--primary); }
.sortable.sort-desc::after { content: ' ↓'; opacity: 1; color: var(--primary); }

/* ── Confirm modal rows ───────────────────────────────────────── */
.confirm-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: var(--bg); border-radius: var(--radius-sm);
  margin-bottom: 8px; font-size: 14px;
}
.confirm-printer { font-weight: 600; color: var(--primary); }
.confirm-note {
  font-size: 12px; color: var(--text-muted); margin-top: 12px;
  padding: 8px 12px; background: var(--primary-light); border-radius: var(--radius-sm);
}

/* ── Print section tweaks ─────────────────────────────────────── */
.print-all-wrap { text-align: center; padding: 16px 0 4px; }
.print-group    { display: flex; gap: 16px; }
.print-card     {
  flex: 1; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; display: flex; align-items: center; gap: 14px;
  background: #fafbfc; transition: border-color 0.15s;
}
.print-card:has(button:not(:disabled)):hover { border-color: var(--primary); }
.print-card-icon { font-size: 26px; }
.print-card-info { flex: 1; line-height: 1.4; }
.print-card-info strong { font-size: 22px; display: block; line-height: 1; }
.print-card-printer { font-size: 11px; color: var(--text-muted); font-weight: 500; }

/* ── Column widths ────────────────────────────────────────────── */
.col-check  { width: 36px; }
.col-church { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-data   { font-family: 'Courier New', monospace; font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* ── Active camp banner ───────────────────────────────────────────── */
.active-camp-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--primary-light); border: 1px solid #bfdbfe;
  margin-bottom: 16px; font-size: 13px;
}
.active-camp-banner.fc {
  background: #f0fdf4; border-color: #bbf7d0;
}
.acb-label { color: var(--text-muted); }
.acb-camp  { font-weight: 700; color: var(--text); }
.acb-session { color: var(--text-muted); margin-left: auto; font-size: 12px; }
.acb-session strong { color: var(--text); }
