:root {
  --bg: #12141c;
  --surface: #1b1e29;
  --surface-2: #232733;
  --line: #2c3040;
  --text: #e8e6de;
  --muted: #9a9fb0;
  --gold: #c9a227;
  --gold-dim: #8a7020;
  --teal: #4fb0ae;
  --admin: #b4432f;

  --font-head: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-body: -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 42px 42px;
  opacity: 0.12;
  pointer-events: none;
  z-index: 0;
}

.screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 24px;
}

/* ---------- Auth screen ---------- */
#authScreen {
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 36px 30px;
}

.brand { text-align: center; margin-bottom: 28px; }

.brand-mark {
  color: var(--gold);
  font-size: 22px;
  display: block;
  margin-bottom: 6px;
}

.brand h1 {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 6px;
  letter-spacing: 0.2px;
}

.sub { color: var(--muted); font-size: 14px; margin: 0; }

.providers { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.providers[hidden], .divider[hidden] { display: none !important; }

.btn-provider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  font-size: 14.5px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.btn-provider:hover { border-color: var(--gold-dim); }

.btn-provider .icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border-radius: 50%;
  background: var(--line);
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12.5px;
  margin-bottom: 18px;
}

.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.email-form { display: flex; flex-direction: column; gap: 10px; }

.email-form input {
  padding: 11px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.email-form input:focus {
  outline: none;
  border-color: var(--teal);
}

.email-actions { display: flex; gap: 10px; margin-top: 4px; }

.btn-secondary {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--gold-dim);
  border-radius: 5px;
  color: var(--gold);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-secondary:hover { background: rgba(201, 162, 39, 0.08); }

.error-msg {
  margin-top: 16px;
  padding: 10px 12px;
  background: rgba(180, 67, 47, 0.12);
  border: 1px solid rgba(180, 67, 47, 0.4);
  border-radius: 5px;
  color: #e0897a;
  font-size: 13px;
}

/* ---------- Dashboard ---------- */
.welcome-banner {
  max-width: 900px;
  margin: 0 auto 14px;
  padding: 8px 14px;
  background: rgba(79, 176, 174, 0.1);
  border: 1px solid rgba(79, 176, 174, 0.35);
  border-radius: 5px;
  color: var(--teal);
  font-size: 13.5px;
  text-align: center;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 900px;
  margin: 0 auto 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.brand-small { font-family: var(--font-head); font-size: 17px; display: flex; align-items: center; gap: 8px; }

.btn-ghost {
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
}

.btn-ghost:hover { color: var(--text); border-color: var(--muted); }

.dash-grid {
  max-width: 900px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
}

@media (max-width: 640px) {
  .dash-grid { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 22px;
}

.profile-panel { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; }

.avatar {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--line);
}

.avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--gold);
  font-family: var(--font-head);
  font-size: 24px;
}

.profile-info h2 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }

.muted { color: var(--muted); }
.small { font-size: 13px; }

.badge {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
}

.badge-admin {
  background: rgba(180, 67, 47, 0.15);
  border-color: rgba(180, 67, 47, 0.4);
  color: #e0897a;
}

.notif-badge {
  position: absolute;
  top: -8px;
  left: -10px;
  background: var(--admin);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.modules-panel h3 { margin: 0 0 6px; font-size: 16px; }

.module-stub {
  margin-top: 12px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: 5px;
  color: var(--muted);
  font-size: 14px;
}

.module-link {
  display: block;
  text-decoration: none;
  border: 1px solid var(--gold-dim);
  color: var(--gold) !important;
  cursor: pointer;
  transition: background 0.15s ease;
}

.module-link:hover { background: rgba(201, 162, 39, 0.08); }

.admin-panel {
  max-width: 900px;
  margin: 20px auto 0;
  border-color: rgba(180, 67, 47, 0.3);
}

.admin-panel h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 4px; font-size: 16px; }

.users-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }

.user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 5px;
  font-size: 13.5px;
}

.role-select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12.5px;
  cursor: pointer;
}

.role-select:disabled { opacity: 0.5; cursor: not-allowed; }

.admin-subsection {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.admin-subsection h4 { margin: 0 0 10px; font-size: 13.5px; color: var(--muted); }

.btn-danger {
  border-color: rgba(180, 67, 47, 0.5);
  color: #e0897a;
}

.btn-danger:hover { background: rgba(180, 67, 47, 0.1); }
