/* Shared header and controls: geometry belongs here, not in page styles. */
.topbar {
  position: sticky; top: 0; z-index: 200;
  background: var(--topbar-bg); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  height: 72px; display: flex; align-items: center; padding: 0 1.5rem; gap: .85rem;
}
.topbar-logo {
  display: flex; align-items: center; gap: .6rem; text-decoration: none; flex-shrink: 0;
}
.topbar-logo .icon-wrap {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 11px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px var(--shadow);
}
.topbar-logo .icon-wrap i { font-size: 1.05rem; color: #fff; line-height: 1; }
.topbar-logo .brand-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1rem; font-weight: 800; color: var(--text); white-space: nowrap;
}
@media (max-width: 480px) { .topbar-logo .brand-name { display: none; } }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .55rem; }

/* ── Theme pill toggle ─────────────────────────── */
.theme-pill {
  display: inline-flex; align-items: center;
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: 100px; padding: 4px; gap: 2px; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.theme-pill-opt {
  width: 32px; height: 32px; border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: var(--muted); cursor: pointer;
  transition: all .2s; font-size: .9rem; line-height: 1;
}
.theme-pill-opt.active {
  background: var(--surface); color: var(--text);
  box-shadow: 0 1px 6px rgba(0,0,0,.14);
}
[data-theme="dark"] .theme-pill-opt.active {
  background: #243050; color: var(--text);
  box-shadow: 0 1px 6px rgba(0,0,0,.4);
}

/* ── User avatar / popover ─────────────────────── */
.user-popover-wrap { position: relative; }
.user-avatar-btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .42rem .75rem .42rem .5rem;
  border-radius: 100px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: .82rem; font-weight: 600; line-height: 1;
  cursor: pointer; transition: all .18s; white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.user-avatar-btn:hover { border-color: var(--accent); background: rgba(59,110,240,.04); }
.user-avatar-btn.open { border-color: var(--accent); background: rgba(59,110,240,.06); }
.user-avatar-icon {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
}
.user-avatar-icon i { font-size: .78rem; color: #fff; line-height: 1; }
.user-avatar-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) { .user-avatar-name { display: none; } }
.topbar-official-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; font-size: .55rem;
  position: relative; cursor: default;
}
.topbar-official-badge::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: rgba(17,24,39,.88); color: #fff;
  font-family: 'Noto Sans JP', sans-serif; font-size: .72rem; font-weight: 500; white-space: nowrap;
  padding: .3rem .6rem; border-radius: 6px;
  pointer-events: none; opacity: 0; transition: opacity .15s; z-index: 10000;
}
.topbar-official-badge:hover::after { opacity: 1; }
.user-avatar-chevron {
  font-size: .65rem; color: var(--muted);
  transition: transform .18s; flex-shrink: 0;
}
.user-avatar-btn.open .user-avatar-chevron { transform: rotate(180deg); }

.user-popover-menu {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 190px;
  background: var(--surface); border: 1.5px solid var(--border2);
  border-radius: 12px; box-shadow: 0 10px 36px rgba(0,0,0,.16), 0 2px 8px rgba(0,0,0,.08);
  z-index: 9000; padding: .35rem; overflow: hidden;
  animation: popoverIn .15s ease;
}
@keyframes popoverIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }
.user-popover-wrap.open .user-popover-menu { display: block; }
.user-popover-item {
  display: flex; align-items: center; gap: .55rem;
  padding: .65rem .85rem; border-radius: 8px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: .82rem; font-weight: 600; color: var(--text);
  text-decoration: none; cursor: pointer; transition: background .12s; line-height: 1;
}
.user-popover-item:hover { background: var(--surface2); color: var(--text); }
.user-popover-item i { font-size: .85rem; color: var(--muted); flex-shrink: 0; line-height: 1; }
.user-popover-item:hover i { color: var(--accent); }
.user-popover-item.danger { color: var(--danger-c); }
.user-popover-item.danger i { color: var(--danger-c); }
.user-popover-item.danger:hover { background: rgba(239,68,68,.07); }
.user-popover-divider { height: 1px; background: var(--border); margin: .3rem 0; }

.btn-nav {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .35rem; padding: .38rem .85rem;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted);
  text-decoration: none; font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: .8rem; font-weight: 600; line-height: 1;
  transition: all .15s; white-space: nowrap; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.btn-nav:hover { color: var(--accent); border-color: var(--accent); background: rgba(59,110,240,.05); }
.btn-nav i { font-size: .8rem; line-height: 1; }
