/* ==========================================================================
   CYD Club Members area (loaded after styles.css, reuses its color tokens)
   A working tool: calmer than the public site, same family.
   ========================================================================== */

:root {
  --panel: #ffffff;
  --canvas: #f6f5fa;
  --ok: #2f7d32;
  --ok-bg: #e9f5ea;
  --warn-bg: #fff6de;
  --warn: #8a5a00;
  --bad-bg: #fdecea;
  --muted: #6d6780;
}

body.members { background: var(--canvas); font-size: 1rem; }

/* ---------- Top bar ---------- */
.m-topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.m-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
}
.m-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--purple);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
}
.m-brand img { width: 46px; height: auto; }
.m-user { display: flex; align-items: center; gap: 14px; font-size: 0.92rem; }
.m-user a { color: var(--ink); font-weight: 700; }
.m-user form { margin: 0; }
.role-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  background: var(--tint-lime);
  color: var(--green-text);
}
.role-chip.admin { background: #efe4f6; color: var(--purple); }

.link-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--blue);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Shell ---------- */
.m-shell {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 1200px;
  margin: 0 auto;
}
@media (min-width: 880px) {
  .m-shell { grid-template-columns: 220px 1fr; gap: 28px; padding: 24px 20px 48px; }
}

.m-nav { padding: 12px 16px; }
@media (min-width: 880px) { .m-nav { padding: 0; position: sticky; top: 24px; align-self: start; } }
.m-nav-group { margin-bottom: 18px; }
.m-nav-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px 10px;
}
.m-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
@media (max-width: 879px) {
  .m-nav { display: flex; gap: 18px; overflow-x: auto; border-bottom: 1px solid var(--line); background: var(--panel); }
  .m-nav-group { margin: 0; display: flex; align-items: center; gap: 4px; }
  .m-nav-label { margin: 0 4px 0 0; }
  .m-nav ul { display: flex; }
}
.m-nav a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
}
.m-nav a:hover { background: #ece9f3; }
.m-nav a[aria-current="page"] { background: var(--purple); color: #fff; }
.count-badge {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--sun);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 800;
  text-align: center;
}
.count-badge.bad { background: var(--error); color: #fff; }

.m-main { padding: 20px 16px 48px; min-width: 0; }
@media (min-width: 880px) { .m-main { padding: 0; } }

.m-title { font-size: clamp(1.6rem, 3vw, 2rem); color: var(--purple); margin: 0 0 6px; }
.m-intro { color: var(--muted); margin: 0 0 22px; max-width: 70ch; }

/* ---------- Panels, flash, forms ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
}
.panel h2 { font-size: 1.2rem; margin: 0 0 12px; color: var(--ink); }

.flash {
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 18px;
  font-weight: 700;
  background: var(--ok-bg);
  color: var(--ok);
  border: 1px solid #cfe8d1;
}
.flash.error { background: var(--bad-bg); color: var(--error); border-color: #f5c6c1; }

.m-form { display: grid; gap: 14px; max-width: 560px; }
.m-form .field { margin: 0; }
.m-form .field-error { min-height: 0; margin: 4px 0 0; }
.inline-fields { display: grid; gap: 12px; }
@media (min-width: 640px) { .inline-fields { grid-template-columns: 1fr 1fr 180px auto; align-items: end; } }
.hint { font-size: 0.875rem; color: var(--muted); margin: 4px 0 0; }
.checkbox { display: flex; align-items: flex-start; gap: 10px; font-weight: 600; }
.checkbox input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--purple); }

.btn-small { min-height: 36px; padding: 6px 14px; font-size: 0.875rem; box-shadow: none; }
.btn-plain { background: #fff; color: var(--ink); border: 2px solid var(--line); }
.btn-plain:hover { border-color: var(--purple); }
.btn-danger { background: #fff; color: var(--error); border: 2px solid #f0b8b2; }
.btn-danger:hover { background: var(--bad-bg); }
.actions-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions-row form { margin: 0; }

textarea.filters-box {
  width: 100%;
  min-height: 220px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ---------- Stats ---------- */
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.stat-num { display: block; font-family: var(--font-display); font-weight: 800; font-size: 2rem; line-height: 1.1; color: var(--purple); font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-weight: 700; font-size: 0.9rem; }

/* ---------- Tabs + tables ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.tab {
  padding: 7px 14px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  font-size: 0.9rem;
}
.tab[aria-current="page"] { border-color: var(--purple); background: var(--purple); color: #fff; }
.search { display: flex; gap: 8px; margin-left: auto; }
.search input { border: 2px solid var(--line); border-radius: 999px; padding: 7px 14px; font: inherit; min-width: 0; width: 220px; }

.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.data th, table.data td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); background: #faf9fc; }
table.data tr:last-child td { border-bottom: none; }
table.data td.num { font-variant-numeric: tabular-nums; }
table.data select {
  font: inherit;
  font-size: 0.9rem;
  padding: 5px 10px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
table.data a.row-link { color: var(--ink); font-weight: 800; text-decoration: none; }
table.data a.row-link:hover { color: var(--purple); text-decoration: underline; }
.snippet { color: var(--muted); display: block; max-width: 48ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }

.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 800; white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--error); }
.chip.muted { background: #eeecf3; color: var(--muted); }

.empty { padding: 28px; text-align: center; color: var(--muted); }

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 0.9rem; color: var(--muted); }
.pager a { font-weight: 800; color: var(--blue); }

/* ---------- Message detail ---------- */
.meta-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0 0 18px; }
.meta-list dt { font-weight: 800; color: var(--muted); }
.meta-list dd { margin: 0; overflow-wrap: anywhere; }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; background: #faf9fc; border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 0 0 18px; line-height: 1.6; }
.back-link { display: inline-block; margin-bottom: 12px; font-weight: 700; color: var(--blue); }

/* ---------- Auth pages (sign in, reset, invitation) ---------- */
body.auth { background: var(--canvas); min-height: 100vh; display: flex; flex-direction: column; }
.auth-wrap { flex: 1; display: grid; place-items: center; padding: 32px 16px; }
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px 24px;
  box-shadow: 0 18px 40px -28px rgba(30, 22, 54, 0.35);
}
.auth-card .auth-logo { display: block; width: 110px; margin: 0 auto 10px; }
.auth-card h1 { text-align: center; color: var(--purple); font-size: 1.7rem; margin: 0 0 6px; }
.auth-card .auth-sub { text-align: center; color: var(--muted); margin: 0 0 20px; }
.auth-card .m-form { max-width: none; }
.auth-card .btn { width: 100%; }
.auth-links { text-align: center; margin-top: 16px; font-size: 0.92rem; }
.auth-links a { color: var(--blue); font-weight: 700; }
.auth-foot { text-align: center; padding: 16px; font-size: 0.8rem; color: var(--muted); }
.auth-foot a { color: var(--muted); }

.m-foot { padding: 16px 20px 28px; text-align: center; font-size: 0.8rem; color: var(--muted); }

/* Read by screen readers, not shown on screen */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
