/* ==========================================================================
   Design tokens - dark, rich theme
   ========================================================================== */
:root {
  --bg: #0a0a0d;
  --bg-elevated: #121319;
  --bg-card: #171822;
  --bg-card-hover: #1c1e2b;
  --border: rgba(201, 169, 97, 0.16);
  --border-soft: rgba(255, 255, 255, 0.06);
  --gold: #c9a961;
  --gold-bright: #e3c680;
  --gold-dim: rgba(201, 169, 97, 0.5);
  --emerald: #1f6f54;
  --emerald-bright: #34a67c;
  --text: #f1ece0;
  --text-dim: #a8a196;
  --text-faint: #6d6759;
  --danger: #c25c50;
  --danger-bg: rgba(194, 92, 80, 0.12);
  --success-bg: rgba(52, 166, 124, 0.12);
  --radius-lg: 18px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-lg: 0 30px 80px -30px rgba(0, 0, 0, 0.75);
  --shadow: 0 12px 32px -14px rgba(0, 0, 0, 0.6);
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --header-h: 64px;
  --bottom-nav-h: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 600px at 15% -10%, rgba(201, 169, 97, 0.09), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(31, 111, 84, 0.10), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0 0 0.4em;
  color: var(--text);
}

a { color: var(--gold-bright); text-decoration: none; }
p { margin: 0 0 1em; color: var(--text-dim); }

/* ==========================================================================
   Layout helpers
   ========================================================================== */
.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}

.card-pad { padding: 20px; }

/* ==========================================================================
   Auth screen (login)
   ========================================================================== */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-box {
  width: 100%;
  max-width: 420px;
  padding: 32px 24px;
  text-align: center;
}

.auth-mark {
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--gold-bright);
  background: linear-gradient(160deg, rgba(201, 169, 97, 0.14), transparent);
}

.auth-box h1 {
  font-size: 26px;
  margin-bottom: 6px;
}

.auth-sub {
  color: var(--text-faint);
  font-size: 14px;
  margin-bottom: 26px;
}

.field {
  text-align: left;
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 600;
}

.field-input-wrap {
  position: relative;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="email"],
.field input[type="tel"] {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 50px;
}

.field input:focus {
  outline: none;
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.12);
}

.toggle-pass {
  position: absolute;
  right: 6px;
  top: 6px;
  bottom: 6px;
  padding: 0 12px;
  background: transparent;
  border: none;
  color: var(--text-faint);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.toggle-pass:hover { color: var(--gold-bright); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-body);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.05s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #17130a;
}
.btn-primary:hover { opacity: 0.92; }

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--gold-dim); color: var(--gold-bright); }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(194, 92, 80, 0.25);
}

.alert {
  text-align: left;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 18px;
}
.alert-error {
  background: var(--danger-bg);
  color: #e8b3ab;
  border: 1px solid rgba(194, 92, 80, 0.3);
}
.alert-success {
  background: var(--success-bg);
  color: #a9e6c9;
  border: 1px solid rgba(52, 166, 124, 0.3);
}

.demo-hint {
  margin-top: 22px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  font-size: 13px;
  color: var(--text-faint);
  text-align: left;
}
.demo-hint strong { color: var(--text-dim); }

/* ==========================================================================
   App shell (dashboard + admin)
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(10, 10, 13, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}

.app-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--text);
}
.brand .dot { color: var(--gold-bright); }

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--gold), var(--emerald));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #10110a;
}

.app-main {
  padding: 24px 0 calc(var(--bottom-nav-h) + 32px);
}

.page-title {
  margin-bottom: 22px;
}
.page-title h1 { font-size: 24px; }
.page-title .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  color: var(--gold-dim);
  font-weight: 700;
  display: block;
  margin-bottom: 6px;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
}

.stat {
  padding: 18px;
}
.stat .label {
  font-size: 12px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.stat .value {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--gold-bright);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge-active { background: var(--success-bg); color: #7ed3ac; }
.badge-inactive { background: var(--danger-bg); color: #e0968b; }
.badge-admin { background: rgba(201, 169, 97, 0.14); color: var(--gold-bright); }
.badge-member { background: rgba(255, 255, 255, 0.06); color: var(--text-dim); }

/* form rows inside cards */
.form-row {
  margin-bottom: 16px;
}
.form-row label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 6px;
  font-weight: 700;
}
.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  min-height: 46px;
}
.form-row input:disabled { color: var(--text-faint); opacity: 0.7; }
.form-row textarea { min-height: 90px; resize: vertical; }

.actions-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.actions-row .btn { width: auto; flex: 1 1 160px; }

/* ==========================================================================
   Admin member list -> stacked cards on mobile, table on desktop
   ========================================================================== */
.member-list { display: flex; flex-direction: column; gap: 10px; }

.member-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
}
.member-row .who { display: flex; align-items: center; gap: 12px; }
.member-row .meta { font-size: 13px; color: var(--text-faint); }
.member-row .name { font-weight: 700; }

.search-bar {
  margin-bottom: 16px;
}
.search-bar input {
  width: 100%;
  padding: 13px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  min-height: 48px;
}

/* ==========================================================================
   Bottom nav (mobile) / top nav (desktop)
   ========================================================================== */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  height: var(--bottom-nav-h);
  display: flex;
  background: rgba(10, 10, 13, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-soft);
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 700;
}
.bottom-nav a.active { color: var(--gold-bright); }
.bottom-nav svg { width: 20px; height: 20px; }

@media (min-width: 860px) {
  .bottom-nav { display: none; }
  .app-main { padding-bottom: 40px; }
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 14px;
  font-weight: 600;
}
.back-link:hover { color: var(--gold-bright); }
