/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 1px solid var(--slate-200);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.topbar-inner {
  width: 100%;
  height: 64px;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
/* Custom logo (Config > Custom) replaces the whole brand block — icon + "Lightelec" text
   together — not just the small icon mark, since an uploaded logo typically already carries
   its own wordmark. */
.brand-logo-custom { height: 40px; width: auto; max-width: 220px; object-fit: contain; }
.brand-text { font-size: 1.1rem; line-height: 1.1; display: flex; flex-direction: column; }
.brand-text-line { line-height: 1.2; }
.brand-tagline {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-muted-bluegray);
}

.nav-pills {
  display: flex;
  gap: 0.35rem;
  flex: 1;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--slate-600);
}
.nav-pill:hover { background: var(--slate-100); text-decoration: none; }
.nav-pill.active { background: var(--blue-50); color: var(--color-primary); }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}
.topbar-divider { width: 1px; height: 28px; background: var(--slate-200); }

.user-name {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--slate-800);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
}
.user-name:hover { background: var(--slate-100); text-decoration: none; }

/* Admin/dev username dropdown (native <details>, no JS needed to open/close) */
.user-menu { position: relative; }
.user-menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--slate-800);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
}
.user-menu-toggle::-webkit-details-marker { display: none; }
.user-menu-toggle::after { content: "\25BE"; color: var(--slate-400); margin-left: 0.15rem; }
.user-menu-toggle:hover { background: var(--slate-100); }
.user-menu[open] .user-menu-toggle { background: var(--slate-100); }

.user-menu-avatar { color: var(--slate-400); width: 1.6em; height: 1.6em; }
.user-menu-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.3; }
.user-menu-name-row { display: inline-flex; align-items: center; gap: 0.4rem; }
.user-menu-email { font-size: 0.72rem; font-weight: 500; color: var(--color-muted-bluegray); }

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
  min-width: 180px;
  padding: 0.35rem;
  z-index: 60;
  display: flex;
  flex-direction: column;
}
.user-menu-dropdown a {
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--slate-800);
}
.user-menu-dropdown a:hover { background: var(--slate-100); text-decoration: none; }

/* Page containers */
.page { min-height: calc(100vh - 64px); }
.container { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }
.container-narrow { max-width: 640px; }

.page-title { font-size: 1.5rem; }
.page-subtitle { color: var(--slate-600); font-size: 0.9rem; margin: 0 0 1.5rem; }

/* Auth pages (login, 2FA) */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
}
.auth-card-centered { text-align: center; }
.auth-brand { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.25rem; }
.auth-brand-title { font-weight: 700; font-size: 1.1rem; }
.auth-brand-subtitle { font-size: 0.8rem; color: var(--slate-400); }
.auth-hint { font-size: 0.78rem; color: var(--slate-400); margin-top: 1.25rem; text-align: center; }

.error-code { font-size: 3rem; font-weight: 800; color: var(--slate-400); }

/* Admin console shell */
.admin-shell { display: flex; gap: 2rem; align-items: flex-start; }
.admin-nav {
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 0.5rem;
}
.admin-nav-item {
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--slate-600);
}
.admin-nav-item:hover { background: var(--slate-100); text-decoration: none; }
.admin-nav-item.active { background: var(--blue-50); color: var(--color-primary); }
.admin-content { flex: 1; min-width: 0; }
.admin-content-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }

@media (max-width: 768px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 0.75rem 1rem; }
  .nav-pills { order: 3; width: 100%; overflow-x: auto; }
  .admin-shell { flex-direction: column; }
  .admin-nav { width: 100%; flex-direction: row; overflow-x: auto; }
}
