:root {
  --bg-a: #eef7f5;
  --bg-b: #fdfcf6;
  --card: #ffffff;
  --text: #132a2a;
  --muted: #4f6868;
  --accent: #0f766e;
  --accent-strong: #0a5d57;
  --border: #d9e8e4;
  --danger: #b42318;
  --success: #12704b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, var(--bg-a), var(--bg-b));
  min-height: 100vh;
}

.container {
  width: min(920px, 92%);
  margin: 2rem auto;
}

.admin-container {
  width: min(98vw, 1600px);
  margin: 1rem auto;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 12px 40px rgba(19, 42, 42, 0.08);
}

h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 2vw, 2rem);
}

.subtitle {
  margin: 0 0 1.2rem;
  color: var(--muted);
}

.form {
  display: grid;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.4rem;
}

.member-fields {
  display: grid;
  gap: 0.55rem;
}

.member-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

label {
  font-weight: 600;
  font-size: 0.95rem;
}

input,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.72rem 0.8rem;
  font: inherit;
  color: var(--text);
  background: #fff;
}

input:focus,
select:focus {
  outline: 3px solid rgba(15, 118, 110, 0.16);
  border-color: var(--accent);
}

input[type="number"] {
  appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.btn {
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  padding: 0.8rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.btn:hover {
  background: var(--accent-strong);
}

.btn.secondary {
  background: #d7e7e3;
  color: #123a36;
}

.btn.danger {
  background: #b42318;
  color: #fff;
}

.btn.danger:hover {
  background: #991b1b;
}

.admin-link-wrap {
  margin-top: 0.9rem;
  color: var(--muted);
}

a,
.text-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

a:hover,
.text-link:hover {
  text-decoration: underline;
}

.message {
  min-height: 1.2rem;
  margin-top: 0.8rem;
  font-weight: 600;
}

.message.success {
  color: var(--success);
}

.message.error {
  color: var(--danger);
}

.hidden {
  display: none;
}

.admin-container .card {
  padding: 1.2rem;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.admin-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.status-chip {
  margin: 0;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-weight: 700;
  background: #f3faf8;
}

.stat-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem;
  background: #fafdfc;
}

.stat-box h2 {
  font-size: 0.95rem;
  margin: 0 0 0.3rem;
  color: var(--muted);
}

.stat-box p {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
}

.filter-row {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) auto minmax(200px, 1fr) auto;
  align-items: end;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.filter-row label {
  margin-right: 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  text-align: left;
  padding: 0.72rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: #f7fcfb;
}

th {
  background: #f3faf8;
}

.empty-cell {
  text-align: center;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 30;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(560px, 100%);
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 1rem;
  box-shadow: 0 18px 40px rgba(19, 42, 42, 0.2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.9rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.member-list {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
}

@media (max-width: 760px) {
  .field-row {
    grid-template-columns: 1fr;
  }

  .member-row {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .admin-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-actions {
    width: 100%;
    justify-content: space-between;
  }

  .filter-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .admin-control-row {
    flex-direction: column;
    align-items: stretch;
  }
}
