:root {
  --bg: #f3f7fb;
  --card: #ffffff;
  --text: #163047;
  --muted: #5f7080;
  --line: #d8e2ec;
  --primary: #0f8f56;
  --primary-dark: #0a6a3f;
  --secondary: #2563eb;
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.08);
  --shadow: 0 20px 50px rgba(15, 35, 55, 0.08);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Hind Siliguri', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 30%),
    radial-gradient(circle at top right, rgba(15, 143, 86, 0.08), transparent 25%),
    var(--bg);
  color: var(--text);
}
img { max-width: 100%; display: block; }
.page-shell { width: min(1200px, calc(100% - 32px)); margin: 28px auto 60px; }
.profile-page-shell { width: min(1100px, calc(100% - 24px)); }
.hero-card,
.toolbar-card,
.table-card,
.form-section,
.loading-card,
.profile-card,
.profile-section,
.image-card,
.biodata-sheet {
  background: var(--card);
  border: 1px solid rgba(216, 226, 236, 0.9);
  box-shadow: var(--shadow);
}
.hero-card {
  border-radius: calc(var(--radius) + 6px);
  padding: 30px;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.hero-card.compact { padding: 24px 28px; }
.hero-card h1 { margin: 10px 0 8px; font-size: clamp(30px, 3vw, 42px); line-height: 1.15; }
.hero-card p { margin: 0; color: var(--muted); font-size: 17px; }
.brand-pill, .count-badge, .section-hint {
  display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; font-weight: 700;
}
.brand-pill { padding: 8px 14px; background: rgba(15, 143, 86, 0.12); color: var(--primary-dark); letter-spacing: 0.06em; font-size: 13px; }
.hero-actions, .hero-actions.multi { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.member-form { display: grid; gap: 22px; }
.form-section { border-radius: var(--radius); padding: 26px; }
.section-title-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.form-section h2, .table-head h2 { margin: 0 0 18px; font-size: 26px; }
.section-hint { padding: 8px 14px; background: rgba(37, 99, 235, 0.1); color: var(--secondary); font-size: 13px; }
.required-note { font-weight: 600; }
.required-star { color: var(--danger); font-weight: 700; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 8px; }
.field.full { grid-column: 1 / -1; }
label { font-size: 16px; font-weight: 600; }
input, textarea, .search-input {
  width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; font: inherit; color: var(--text);
  background: #fbfdff; transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
input:focus, textarea:focus, .search-input:focus {
  outline: none; border-color: rgba(37, 99, 235, 0.55); box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}
textarea { resize: vertical; }
.upload-field input { padding: 11px 12px; background: #f7fafc; }
.field-help { color: var(--muted); font-size: 13px; }
.field-error { min-height: 18px; color: var(--danger); font-size: 13px; font-weight: 600; }
.has-error input, .has-error textarea {
  border-color: rgba(220, 38, 38, 0.75); background: #fff5f5; box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.08);
}
.form-actions { display: flex; justify-content: flex-end; gap: 14px; flex-wrap: wrap; }
.btn {
  border: none; text-decoration: none; font: inherit; font-weight: 700; cursor: pointer; padding: 13px 20px; border-radius: 14px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 10px 20px rgba(15, 143, 86, 0.2); }
.btn-secondary { background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; box-shadow: 0 10px 20px rgba(37, 99, 235, 0.18); }
.btn-light { background: #eef4f8; color: var(--text); }
.message-box { margin-top: 6px; padding: 16px 18px; border-radius: 16px; font-weight: 600; }
.message-success { background: rgba(15, 143, 86, 0.1); color: var(--primary-dark); border: 1px solid rgba(15, 143, 86, 0.18); }
.message-error { background: var(--danger-soft); color: #991b1b; border: 1px solid rgba(220, 38, 38, 0.12); }
.toolbar-card, .table-card { border-radius: var(--radius); padding: 22px; }
.toolbar-card { display: flex; gap: 14px; margin-bottom: 20px; align-items: center; }
.table-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.count-badge { padding: 9px 14px; background: rgba(15, 143, 86, 0.1); color: var(--primary-dark); font-size: 14px; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 15px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.data-table th { background: #f7fafc; font-size: 15px; }
.data-table td { font-size: 16px; }
.data-table tbody tr:hover { background: rgba(15, 143, 86, 0.04); }
.name-link { color: var(--secondary); text-decoration: none; font-weight: 700; }
.name-link:hover { text-decoration: underline; }
.empty-state { text-align: center !important; color: var(--muted); padding: 28px !important; }
.profile-root { display: grid; gap: 20px; }
.loading-card,
.profile-card,
.profile-section,
.image-card,
.biodata-sheet { border-radius: var(--radius); padding: 24px; }
.biodata-sheet { padding: 28px; }
.biodata-header {
  display: grid; grid-template-columns: 1fr 180px; gap: 20px; align-items: stretch; padding-bottom: 20px; border-bottom: 2px dashed var(--line);
}
.biodata-brand h2 { margin: 14px 0 8px; font-size: clamp(28px, 3vw, 38px); }
.biodata-brand p { margin: 0; color: var(--muted); font-size: 16px; }
.biodata-photo-frame {
  min-height: 220px; border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(180deg, #fafcff, #f3f7fb); padding: 10px;
}
.biodata-photo-frame .doc-preview,
.biodata-photo-frame .image-placeholder {
  width: 100%; height: 100%; min-height: 200px;
}
.biodata-summary-strip {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 20px 0;
}
.summary-pill { padding: 14px 16px; background: #f6faff; border: 1px solid var(--line); border-radius: 16px; font-size: 15px; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.info-item { border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; background: #fbfdff; }
.info-item.full { grid-column: 1 / -1; }
.info-label { display: block; color: var(--muted); font-size: 14px; margin-bottom: 4px; }
.info-value { font-size: 17px; font-weight: 600; word-break: break-word; }
.image-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.image-card h3, .profile-section h3 { margin: 0 0 16px; font-size: 24px; }
.compact-card { padding: 18px; }
.doc-preview {
  width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 18px; border: 1px solid var(--line); background: #f4f8fb;
}
.image-placeholder {
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; text-align: center; min-height: 240px;
  border-radius: 18px; border: 1px dashed var(--line); background: #f7fafc; color: var(--muted); font-weight: 600;
}
.image-placeholder span { font-size: 13px; font-weight: 500; }
.small-muted { color: var(--muted); font-size: 14px; }

@media (max-width: 900px) {
  .grid-2, .grid-3, .info-grid, .image-grid, .biodata-header, .biodata-summary-strip { grid-template-columns: 1fr; }
  .hero-card, .toolbar-card { flex-direction: column; align-items: stretch; }
  .hero-actions, .hero-actions.multi, .form-actions { justify-content: flex-start; }
}

@media (max-width: 600px) {
  .page-shell { width: min(100% - 18px, 1200px); margin-top: 14px; margin-bottom: 30px; }
  .hero-card, .toolbar-card, .table-card, .form-section, .profile-card, .profile-section, .image-card, .loading-card, .biodata-sheet {
    padding: 18px; border-radius: 18px;
  }
  .hero-card h1 { font-size: 28px; }
  .form-section h2, .table-head h2, .profile-section h3, .image-card h3 { font-size: 22px; }
  input, textarea, .search-input, .btn { font-size: 16px; }
}

@media print {
  body { background: #fff; }
  .no-print, .btn, .toolbar-card { display: none !important; }
  .page-shell { width: 100%; margin: 0; }
  .biodata-sheet, .profile-section, .image-card {
    box-shadow: none; border: 1px solid #ddd; break-inside: avoid;
  }
  .biodata-sheet { padding: 18px; }
}


.edit-mode-banner {
  background: rgba(37, 99, 235, 0.09);
  border: 1px solid rgba(37, 99, 235, 0.18);
  color: var(--secondary);
  padding: 16px 18px;
  border-radius: 16px;
  font-weight: 700;
}
.upload-preview { margin-top: 8px; }
.preview-card {
  position: relative; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: #f8fbff;
}
.preview-card img { width: 100%; max-height: 220px; object-fit: cover; }
.preview-badge {
  position: absolute; top: 10px; left: 10px; background: rgba(15, 143, 86, 0.92); color: #fff; padding: 6px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 700;
}
.action-stack { display: flex; gap: 8px; flex-wrap: wrap; }
.mini-btn {
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; padding: 8px 12px;
  border-radius: 10px; font-size: 13px; font-weight: 700;
}
.mini-btn-view { background: rgba(37, 99, 235, 0.1); color: var(--secondary); }
.mini-btn-edit { background: rgba(15, 143, 86, 0.1); color: var(--primary-dark); }
