/* ── Beheer (admin) styles ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Ubuntu', 'Roboto', sans-serif;
  background: #f0f4f8;
  color: #1a3a50;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
.site-header {
  background: linear-gradient(135deg, #005577, #003d55);
  color: #fff;
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.header-brand { display: flex; align-items: center; gap: 10px; }
.header-title h1 { font-size: 1.1rem; font-weight: 700; }
.header-title span { font-size: 0.75rem; opacity: 0.7; }
.header-user {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.82rem; opacity: 0.9;
}
.btn-logout {
  background: rgba(255,255,255,0.15); border: none; color: #fff;
  padding: 5px 12px; border-radius: 20px; font-family: inherit;
  font-size: 0.78rem; cursor: pointer;
}
.btn-logout:hover { background: rgba(255,255,255,0.25); }
.gold-bar { height: 4px; background: linear-gradient(90deg, #c8973f, #e8b84b, #c8973f); }

/* ── Login screen ── */
#login-screen {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 20px;
}
.login-card {
  background: #fff; border-radius: 14px; padding: 40px 36px;
  max-width: 400px; width: 100%; text-align: center;
  box-shadow: 0 4px 20px rgba(0,85,119,0.1);
}
.login-card h2 { font-size: 1.3rem; margin-bottom: 8px; }
.login-card p { font-size: 0.88rem; color: #5a7080; margin-bottom: 28px; }
.btn-ms {
  display: inline-flex; align-items: center; gap: 10px;
  background: #0078d4; color: #fff;
  border: none; border-radius: 8px;
  padding: 11px 22px; font-family: inherit; font-size: 0.92rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
.btn-ms:hover { background: #106ebe; }
.login-error { color: #c0392b; font-size: 0.82rem; margin-top: 14px; }

/* ── App ── */
#app-screen { flex: 1; display: none; flex-direction: column; }
#app-screen.is-visible { display: flex; }

/* ── Tabs ── */
.tabs {
  background: #fff; border-bottom: 1px solid #dce8f0;
  display: flex; gap: 0; padding: 0 24px;
}
.tab-btn {
  background: none; border: none; border-bottom: 3px solid transparent;
  padding: 13px 18px; font-family: inherit; font-size: 0.88rem; font-weight: 500;
  color: #5a7080; cursor: pointer; transition: all 0.15s;
}
.tab-btn:hover { color: #005577; }
.tab-btn.is-active { color: #005577; border-bottom-color: #005577; font-weight: 700; }

/* ── Tab panels ── */
.tab-panel { display: none; padding: 24px; max-width: 1200px; width: 100%; margin: 0 auto; }
.tab-panel.is-active { display: block; }

/* ── Panel header ── */
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.panel-header h2 { font-size: 1.05rem; font-weight: 700; }
.btn-add {
  background: #005577; color: #fff; border: none; border-radius: 8px;
  padding: 8px 16px; font-family: inherit; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; gap: 6px;
}
.btn-add:hover { background: #004466; }

/* ── Spinner ── */
.spinner {
  width: 28px; height: 28px;
  border: 3px solid #c8daea; border-top-color: #005577;
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state { display: flex; gap: 10px; align-items: center; color: #5a7080; font-size: 0.88rem; padding: 20px 0; }

/* ── Table ── */
.table-wrap { overflow-x: auto; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,85,119,0.07); }
table { width: 100%; border-collapse: collapse; background: #fff; font-size: 0.85rem; }
th { background: #eaf2f8; color: #1a3a50; font-weight: 700; padding: 10px 12px; text-align: left; white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid #eef4f8; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f5f9fc; }

.group-header-row td {
  background: #f0f6fa; font-weight: 700; color: #005577;
  font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 7px 12px; border-bottom: 1px solid #d0e4f0;
}
.group-count { font-size: 0.75rem; font-weight: 400; color: #8aa8c0; margin-left: 6px; text-transform: none; }

/* Pincode cell */
.pin-cell { display: flex; align-items: center; gap: 4px; font-family: monospace; }
.pin-hidden { letter-spacing: 0.15em; color: #1a3a50; }
.pin-visible { display: none; color: #1a3a50; letter-spacing: 0.05em; }
.btn-eye {
  background: none; border: none; cursor: pointer; color: #8aa8c0; padding: 2px;
  display: flex; align-items: center;
}
.btn-eye:hover { color: #005577; }

/* Status badge */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.73rem; padding: 2px 8px; border-radius: 20px; font-weight: 500;
}
.badge-active   { background: #d4edda; color: #155724; }
.badge-inactive { background: #f8d7da; color: #721c24; }

/* Action buttons */
.btn-icon {
  background: none; border: 1px solid transparent; border-radius: 6px;
  padding: 4px 8px; cursor: pointer; font-size: 0.78rem; font-family: inherit;
  display: inline-flex; align-items: center; gap: 4px;
  transition: all 0.12s;
}
.btn-edit  { color: #005577; border-color: #c8daea; }
.btn-edit:hover  { background: #eaf2f8; }
.btn-del   { color: #c0392b; border-color: #f5c6cb; }
.btn-del:hover   { background: #fdf0f0; }

/* ── Modal / Drawer ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,30,50,0.5); z-index: 900;
  align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.is-open { display: flex; }
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,40,60,0.2);
}
.modal-header {
  background: linear-gradient(135deg, #005577, #003d55); color: #fff;
  padding: 20px 24px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 1;
}
.modal-header h2 { font-size: 1rem; font-weight: 700; }
.modal-close {
  background: rgba(255,255,255,0.15); border: none; color: #fff;
  width: 28px; height: 28px; border-radius: 50%; font-size: 0.9rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: rgba(255,255,255,0.3); }
.modal-body { padding: 24px; }

/* Form */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-full { grid-column: 1 / -1; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 5px; color: #1a3a50; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 9px 11px;
  border: 1.5px solid #c8daea; border-radius: 7px;
  font-family: inherit; font-size: 0.88rem; color: #1a3a50;
  background: #fff; transition: border-color 0.15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: #005577;
}
.form-group textarea { min-height: 72px; resize: vertical; }
.form-check { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.form-check input { width: auto; }
.form-check label { font-size: 0.88rem; font-weight: 400; }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid #eef4f8; }
.btn-cancel {
  background: none; border: 1.5px solid #c8daea; color: #5a7080;
  padding: 8px 18px; border-radius: 7px; font-family: inherit; font-size: 0.88rem; cursor: pointer;
}
.btn-cancel:hover { border-color: #8aa8c0; color: #1a3a50; }
.btn-save {
  background: #005577; color: #fff; border: none;
  padding: 9px 20px; border-radius: 7px; font-family: inherit; font-size: 0.88rem; font-weight: 600;
  cursor: pointer;
}
.btn-save:hover { background: #004466; }
.btn-save:disabled { background: #8aa8c0; cursor: not-allowed; }

/* Confirm dialog */
.confirm-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,30,50,0.55); z-index: 950;
  align-items: center; justify-content: center; padding: 20px;
}
.confirm-overlay.is-open { display: flex; }
.confirm-box {
  background: #fff; border-radius: 12px; padding: 28px;
  max-width: 380px; width: 100%; text-align: center;
  box-shadow: 0 10px 40px rgba(0,40,60,0.2);
}
.confirm-box h3 { font-size: 1rem; margin-bottom: 10px; }
.confirm-box p { font-size: 0.85rem; color: #5a7080; margin-bottom: 22px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }
.btn-confirm-del { background: #c0392b; color: #fff; border: none; padding: 9px 22px; border-radius: 7px; font-family: inherit; font-size: 0.88rem; font-weight: 600; cursor: pointer; }
.btn-confirm-del:hover { background: #a93226; }

/* Toast */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #1a3a50; color: #fff;
  padding: 10px 18px; border-radius: 8px; font-size: 0.85rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: toast-in 0.2s ease;
}
.toast.toast-error { background: #c0392b; }
.toast.toast-ok { background: #1a6640; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── Footer ── */
.site-footer { text-align: center; padding: 14px; font-size: 0.75rem; color: #8aa8c0; }

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .tabs { padding: 0 12px; }
  .tab-btn { padding: 11px 10px; font-size: 0.8rem; }
  .tab-panel { padding: 16px; }
}
