*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f5f5;
  color: #1a1a2e;
  min-height: 100vh;
}

/* ─── Navigation ─── */
nav {
  background: #1a1a2e;
  color: #fff;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
nav a.brand {
  color: #fff;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
nav a.brand strong {
  font-size: 0.95rem;
  font-weight: 700;
}
nav a.brand small {
  font-size: 0.68rem;
  font-weight: 400;
  opacity: 0.6;
  letter-spacing: 0.02em;
}
nav ul { list-style: none; display: flex; gap: 1.5rem; align-items: center; }
nav a { color: #fff; text-decoration: none; font-size: 0.9rem; opacity: 0.75; }
nav a:hover { opacity: 1; }
nav a[aria-current="page"] { opacity: 1; border-bottom: 2px solid rgba(255,255,255,0.6); padding-bottom: 2px; }
nav button.logout {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}
nav button.logout:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.6); }

/* ─── Layout ─── */
main {
  max-width: var(--main-width, 640px);
  margin: 2rem auto;
  padding: 0 1rem;
}

/* ─── Card ─── */
article {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.08);
  padding: 2rem;
}

/* ─── Headings ─── */
h1 { font-size: 1.3rem; margin-bottom: 0.25rem; }

/* ─── Form ─── */
form p { margin-bottom: 1.2rem; }

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: #333;
}
label .opt { font-weight: 400; color: #999; font-size: 0.8rem; }

input, textarea, select {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.95rem;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: #1a1a2e; box-shadow: 0 0 0 3px rgba(26,26,46,0.08); }
textarea { resize: vertical; min-height: 80px; }
input[type="checkbox"] { width: auto; box-shadow: none; }

button[type="submit"] {
  background: #1a1a2e;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 0.5rem;
}
button[type="submit"]:hover { background: #2d2d4e; }
button[type="submit"]:disabled { opacity: 0.6; cursor: default; }

/* ─── Fieldset sections ─── */
fieldset {
  border: none;
  padding: 0;
  margin: 1.8rem 0 0;
}
fieldset legend {
  width: 100%;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #999;
  border-top: 1px solid #eee;
  padding-top: 1.5rem;
  padding-bottom: 1rem;
}
fieldset p { margin-bottom: 1.2rem; }

/* ─── Two-column grid ─── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 480px) { .two-col { grid-template-columns: 1fr; } }

/* ─── Contact preference checkboxes ─── */
.checkboxes { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.checkboxes label {
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0;
  cursor: pointer;
}

/* ─── Status output ─── */
output {
  display: none;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
}
output.ok  { background: #e8f5e9; color: #2e7d32; display: block; }
output.err { background: #fdecea; color: #c62828; display: block; }

/* ─── Meta line (profile page) ─── */
p.meta { color: #666; font-size: 0.85rem; margin-bottom: 1.8rem; }

/* ─── Toolbar + search bar ─── */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
button.add-btn { background: #1a1a2e; color: #fff; border: none; border-radius: 4px; padding: 0.5rem 1rem; font-size: 0.9rem; cursor: pointer; }
button.add-btn:hover { opacity: 0.85; }

search { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
search input[type="search"] { width: 220px; padding: 0.5rem 0.8rem; font-size: 0.9rem; }
search label { font-size: 0.85rem; font-weight: 400; display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0; color: #555; cursor: pointer; }
search input[type="checkbox"] { margin: 0; }
search output { display: block; margin: 0; padding: 0; background: none; color: #666; font-size: 0.85rem; margin-left: auto; }

/* ─── Members table ─── */
section { background: #fff; border-radius: 8px; box-shadow: 0 2px 16px rgba(0,0,0,0.08); overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th { background: #1a1a2e; color: #fff; text-align: left; padding: 0.75rem 1rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
td { padding: 0.65rem 1rem; border-bottom: 1px solid #f0f0f0; font-size: 0.9rem; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.inactive td { opacity: 0.45; }
td.empty { text-align: center; padding: 3rem; color: #999; }

.actions { display: flex; gap: 0.4rem; }
button.action { border: none; border-radius: 4px; padding: 0.25rem 0.6rem; font-size: 0.8rem; cursor: pointer; }
button.action:disabled { opacity: 0.5; cursor: default; }
button.edit       { background: #e8eaf6; color: #3949ab; }
button.deactivate { background: #fff3e0; color: #e65100; }
button.activate   { background: #e8f5e9; color: #2e7d32; }
button.delete     { background: #fdecea; color: #c62828; }

/* ─── Dialog ─── */
dialog { border: none; border-radius: 8px; box-shadow: 0 8px 40px rgba(0,0,0,0.2); padding: 0; max-width: 560px; width: calc(100% - 2rem); max-height: 90vh; overflow-y: auto; margin: auto; }
dialog::backdrop { background: rgba(0,0,0,0.4); }
dialog header { background: #1a1a2e; color: #fff; padding: 1rem 1.5rem; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; }
dialog header h2 { font-size: 1rem; font-weight: 700; margin: 0; }
dialog header button { background: none; border: none; color: #fff; font-size: 1.4rem; cursor: pointer; line-height: 1; padding: 0; opacity: 0.7; }
dialog header button:hover { opacity: 1; }
dialog form { padding: 1.5rem; }
dialog form p { margin-bottom: 1rem; }
dialog fieldset { margin-top: 0; }
dialog fieldset legend { margin-top: 1rem; }
dialog footer { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 1.5rem; }
dialog footer button { border: none; border-radius: 4px; padding: 0.6rem 1.2rem; font-size: 0.9rem; cursor: pointer; }
dialog footer button.cancel { background: #f0f0f0; color: #333; }
dialog footer button.submit { background: #1a1a2e; color: #fff; }
dialog footer button.danger { background: #c62828; color: #fff; }
dialog output { display: none; margin: 0 1.5rem 1rem; padding: 0.65rem 0.9rem; border-radius: 4px; font-size: 0.88rem; }
dialog output.err { background: #fdecea; color: #c62828; display: block; }
dialog .status-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
dialog .status-row label { margin: 0; font-weight: 400; display: flex; align-items: center; gap: 0.4rem; cursor: pointer; }

/* ─── Role badges ─── */
.badge {
  display: inline-block;
  border-radius: 4px;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  background: #e8eaf6;
  color: #3949ab;
}
.badge-admin     { background: #fce4ec; color: #b71c1c; }
.badge-committee { background: #e8eaf6; color: #3949ab; }
.badge-member    { background: #e8f5e9; color: #2e7d32; }
