/* Header bar, logo, nav, account switcher button + popover (including tier badges
   shared by the popover, sidebar, and cards). */

header { display: flex; align-items: center; justify-content: space-between; padding: 20px 0; border-bottom: 1px solid var(--border); gap: 16px; }
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; flex-shrink: 0; }
.logo-mark { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.logo-mark::after { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.15) 100%); }
.logo-mark svg { width: 18px; height: 18px; stroke: white; fill: none; position: relative; z-index: 1; }
.logo-text { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; color: var(--text-primary); }
.logo-text span { color: var(--accent-bright); }

nav { display: flex; align-items: center; gap: 4px; }
nav a { padding: 8px 14px; border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 15px; font-weight: 500; text-decoration: none; transition: all 0.2s; cursor: pointer; }
nav a:hover, nav a.active { color: var(--text-primary); background: var(--bg-elevated); }

.header-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; position: relative; }

/* Account switcher button */
.acct-switcher-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 10px 5px 5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-primary);
  transition: all 0.2s;
}
.acct-switcher-btn:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
/* Single-account: hide the chevron (nothing to switch to) but keep the
   button interactive so the popover can still show Create / Pending-invites. */
.acct-switcher-btn.single .chev { display: none; }
.acct-switcher-btn .avatar-stack { display: flex; align-items: center; gap: 0; }
.acct-switcher-btn .avatar { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: white; border: 2px solid var(--bg-elevated); }
.acct-switcher-btn .text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.acct-switcher-btn .text .sub { font-size: 11px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; }
.acct-switcher-btn .text .main { font-size: 13px; font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-switcher-btn .chev { width: 14px; height: 14px; stroke: var(--text-muted); fill: none; stroke-width: 2; margin-left: 2px; margin-right: 4px; transition: transform 0.2s; }
.acct-switcher-btn.open .chev { transform: rotate(180deg); }

/* Popover */
.acct-popover {
  position: absolute; top: calc(100% + 8px); right: 48px;
  width: 360px;
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(139,92,246,0.05);
  padding: 6px;
  z-index: 50;
  opacity: 0; transform: translateY(-6px) scale(0.98); pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
}
.acct-popover.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.acct-popover .pop-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 10px 8px; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.acct-popover .pop-header .current-user { font-family: var(--font-mono); font-size: 11px; text-transform: none; letter-spacing: 0; color: var(--text-muted); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-popover .pop-section { padding: 4px 0; }
.acct-popover .pop-divider { height: 1px; background: var(--border); margin: 4px 6px; }

.acct-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}
.acct-row:hover, .acct-row:focus-visible { background: var(--bg-elevated); outline: none; }
.acct-row.current { background: linear-gradient(90deg, rgba(139,92,246,0.08), transparent); }
.acct-row.current::before { content: ''; position: absolute; left: 2px; top: 10px; bottom: 10px; width: 3px; background: var(--accent); border-radius: 2px; }
.acct-row .avatar { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: white; flex-shrink: 0; }
.acct-row .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.acct-row .info .name { font-size: 14px; font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-row .info .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.acct-row .info .meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-muted); }
.acct-row .check { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; opacity: 0; transform: scale(0.8); transition: all 0.15s; }
.acct-row .check svg { width: 11px; height: 11px; stroke: white; stroke-width: 3; fill: none; }
.acct-row.current .check { opacity: 1; transform: scale(1); }
.acct-row .kbd { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); padding: 2px 6px; border: 1px solid var(--border); border-radius: 4px; opacity: 0; transition: opacity 0.15s; }
.acct-row:hover .kbd, .acct-row:focus-visible .kbd { opacity: 1; }

.pop-action {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}
.pop-action:hover { background: var(--bg-elevated); color: var(--text-primary); }
.pop-action .icon-wrap { width: 28px; height: 28px; border-radius: 8px; background: var(--bg-elevated); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; }
.pop-action:hover .icon-wrap { border-color: var(--border-hover); }
.pop-action svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.pop-action .badge { margin-left: auto; font-family: var(--font-mono); font-size: 11px; background: var(--accent); color: white; padding: 1px 7px; border-radius: 100px; }

/* Tier badges (shared with sidebar + cards) */
.tier-badge { padding: 2px 8px; border-radius: 100px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; display: inline-flex; align-items: center; line-height: 1.4; }
.tier-badge.free { background: rgba(100,100,120,0.15); color: #a1a1aa; }
.tier-badge.basic { background: rgba(59,130,246,0.12); color: #60a5fa; }
.tier-badge.pro { background: rgba(139,92,246,0.12); color: var(--accent-bright); }
.tier-badge.team { background: rgba(245,158,11,0.12); color: #fbbf24; }
.tier-badge.admin { background: rgba(239,68,68,0.1); color: #f87171; border: 1px solid rgba(239,68,68,0.2); }
.tier-badge.personal { background: rgba(34,197,94,0.12); color: #4ade80; }

@media (max-width: 620px) {
  .acct-switcher-btn .text { display: none; }
  .acct-popover { width: calc(100vw - 48px); right: 0; }
}

/* ─── Ghost icon button (used in header) ────────────────────── */
.btn-ghost { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-secondary); font-family: var(--font-display); font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.2s; text-decoration: none; }
.btn-ghost:hover { border-color: var(--border-hover); color: var(--text-primary); background: var(--bg-elevated); }
.btn-ghost svg { width: 14px; height: 14px; stroke: currentColor; fill: none; }
