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

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: #0a0806;
  color: #fef9ef;
  min-height: 100vh;
}

/* ─── Header ─── */
header {
  border-bottom: 1px solid rgba(212,160,23,0.08);
  background: rgba(10,8,6,0.8);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.6rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left { display: flex; align-items: center; gap: 0.75rem; }
.header-home { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: inherit; }
.header-logo { font-size: 1.5rem; color: #d4a017; }
.header-text { line-height: 1.15; }
.header-text h1 { font-size: 1rem; font-weight: 600; color: #fef9ef; }
.header-sub { font-size: 0.65rem; color: rgba(254,249,239,0.3); }

.header-right { display: flex; align-items: center; gap: 0.6rem; }

.login-link {
  padding: 0.25em 0.8em;
  font-size: 0.78rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(212,160,23,0.2);
  border-radius: 50px;
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.login-link:hover { border-color: rgba(212,160,23,0.4); color: #d4a017; }

.user-chip {
  display: none;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25em 0.7em;
  border-radius: 50px;
  font-size: 0.78rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(212,160,23,0.1);
  color: #d4a017;
}
.user-chip.visible { display: inline-flex; }

.chip-link {
  color: rgba(254,249,239,0.3);
  cursor: pointer;
  text-decoration: none;
  font-size: 0.72rem;
  line-height: 1;
}
.chip-link:hover { color: #3498db; }

.logout-link {
  color: rgba(254,249,239,0.3);
  cursor: pointer;
  text-decoration: none;
  font-size: 0.72rem;
}
.logout-link:hover { color: #e74c3c; }

/* ─── Admin Gate ─── */
.admin-gate {
  position: fixed; inset: 0; z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  padding: 1.5rem;
}
.admin-gate.visible { display: flex; }

.admin-gate-inner {
  text-align: center;
  max-width: 400px;
  padding: 2rem;
  background: rgba(20,18,16,0.9);
  border: 1px solid rgba(212,160,23,0.12);
  border-radius: 24px;
}

.gate-icon { font-size: 2.5rem; display: block; margin-bottom: 0.75rem; }

.admin-gate-inner h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: #fef9ef;
  margin-bottom: 0.5rem;
}

.admin-gate-inner p {
  font-size: 0.82rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.5);
  margin-bottom: 1.2rem;
}

.gate-btn {
  display: inline-block;
  margin: 0.25rem;
  padding: 0.6em 1.5em;
  border-radius: 50px;
  border: none;
  background: linear-gradient(135deg, #d4a017, #e67e22);
  color: #0a0806;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: all 0.3s;
}
.gate-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(212,160,23,0.3); }
.gate-btn-secondary { background: rgba(255,255,255,0.06); color: #fef9ef; border: 1px solid rgba(212,160,23,0.15); }

/* ─── Main content ─── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.2rem 3rem;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.admin-header h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: #fef9ef;
}

.admin-tabs { display: flex; gap: 0; }

.tab {
  padding: 0.5em 1.2em;
  border: none;
  background: none;
  color: rgba(254,249,239,0.4);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.tab:hover { color: rgba(254,249,239,0.7); }
.tab.active { color: #d4a017; border-bottom-color: #d4a017; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─── Stats ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(212,160,23,0.06);
  border-radius: 16px;
  padding: 1.2rem;
  text-align: center;
}

.stat-value {
  display: block;
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 600;
  color: #d4a017;
  margin-bottom: 0.2rem;
}

.stat-label {
  font-size: 0.75rem;
  color: rgba(254,249,239,0.4);
}

/* ─── Info Card ─── */
.info-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(212,160,23,0.06);
  border-radius: 16px;
  padding: 1.2rem;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.5;
}
.info-card strong { color: #d4a017; }
.info-card code {
  font-family: 'JetBrains Mono', monospace;
  background: rgba(255,255,255,0.04);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.82em;
}

/* ─── Search ─── */
.search-bar {
  margin-bottom: 1rem;
}

.search-bar input {
  width: 100%;
  max-width: 400px;
  padding: 0.55em 0.9em;
  border-radius: 10px;
  border: 1px solid rgba(212,160,23,0.1);
  background: rgba(255,255,255,0.02);
  color: #fef9ef;
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.search-bar input:focus { border-color: rgba(212,160,23,0.3); }
.search-bar input::placeholder { color: rgba(254,249,239,0.2); }

/* ─── Table ─── */
.table-wrap {
  overflow-x: auto;
  margin-bottom: 0.75rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.data-table th {
  text-align: left;
  padding: 0.6em 0.8em;
  color: rgba(254,249,239,0.3);
  font-weight: 500;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(212,160,23,0.08);
  white-space: nowrap;
}

.data-table td {
  padding: 0.6em 0.8em;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: rgba(254,249,239,0.7);
  white-space: nowrap;
}

.data-table tr:hover td { background: rgba(255,255,255,0.02); }

.data-table .role-badge {
  display: inline-block;
  padding: 0.1em 0.5em;
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}
.role-badge.admin { background: rgba(212,160,23,0.15); color: #d4a017; }
.role-badge.user { background: rgba(255,255,255,0.04); color: rgba(254,249,239,0.4); }

.data-table .fb-up { color: #2ecc71; font-weight: 600; }
.data-table .fb-down { color: #e74c3c; font-weight: 600; }

.table-btn {
  padding: 0.25em 0.7em;
  border-radius: 6px;
  border: 1px solid rgba(212,160,23,0.15);
  background: rgba(212,160,23,0.06);
  color: #d4a017;
  font-size: 0.72rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.table-btn:hover { background: rgba(212,160,23,0.12); border-color: rgba(212,160,23,0.3); }

.table-count {
  font-size: 0.72rem;
  color: rgba(254,249,239,0.25);
}

/* ─── Auth Modal (shared styles) ─── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,0.6); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #1a1816; border: 1px solid rgba(212,160,23,0.12); border-radius: 20px;
  max-width: 400px; width: 100%; padding: 1.5rem; position: relative;
}
.modal-close { position: absolute; top: 0.75rem; right: 0.75rem; background: none; border: none; color: rgba(254,249,239,0.3); font-size: 1.4rem; cursor: pointer; font-family: inherit; }
.modal-tabs { display: flex; gap: 0; margin-bottom: 1rem; border-bottom: 1px solid rgba(212,160,23,0.12); }
.auth-tab {
  flex: 1; padding: 0.6em; text-align: center; border: none; background: none;
  color: rgba(254,249,239,0.5); font-size: 0.85rem; cursor: pointer; font-family: inherit;
  border-bottom: 2px solid transparent;
}
.auth-tab.active { color: #d4a017; border-bottom-color: #d4a017; }
.modal-body { margin-bottom: 1rem; }
.form-group { margin-bottom: 0.75rem; }
.form-group label { display: block; font-size: 0.75rem; color: rgba(254,249,239,0.3); margin-bottom: 0.25rem; }
.form-group input {
  width: 100%; padding: 0.6em 0.8em; border-radius: 10px; border: 1px solid rgba(212,160,23,0.12);
  background: rgba(255,255,255,0.03); color: #fef9ef; font-size: 0.85rem; font-family: inherit; outline: none;
}
.form-group input:focus { border-color: rgba(212,160,23,0.3); }
.form-error { color: #e74c3c; font-size: 0.75rem; margin-top: 0.3rem; min-height: 1em; }
.modal-submit {
  width: 100%; padding: 0.7em; border-radius: 12px; border: none; font-size: 0.85rem; font-weight: 600;
  background: linear-gradient(135deg, #d4a017, #e67e22); color: #0a0806; cursor: pointer; font-family: inherit;
}
.modal-submit:disabled { opacity: 0.5; cursor: default; }
.form-footer { text-align: center; margin-top: 0.75rem; }

/* ─── Responsive ─── */
@media (max-width: 700px) {
  .admin-header { flex-direction: column; align-items: flex-start; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .data-table { font-size: 0.72rem; }
  .data-table th, .data-table td { padding: 0.4em 0.5em; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .stat-card { padding: 0.8rem; }
  .stat-value { font-size: 1.5rem; }
}
