/* --- top bar --------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding: 8px 24px;
  flex-wrap: wrap;
  background: var(--surface);
  border-bottom: var(--border-w) solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
}

.brand:hover {
  color: var(--ink);
  text-decoration: none;
}

/* --- design-variant picker ------------------------------------------- */

.variant-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

button.variant-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 8px 10px;
  background: transparent;
  border: var(--border-w) solid transparent;
  border-radius: var(--radius);
  color: var(--ink);
  font-weight: 400;
  text-align: left;
}

button.variant-option:hover:not(:disabled) {
  background: var(--chip);
  color: var(--ink);
}

button.variant-option.active {
  background: var(--accent-soft);
  color: var(--ink);
}

.variant-swatch {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid var(--line);
}

/* Each swatch shows its variant's own ground and accent, whatever is active. */
.variant-swatch[data-swatch="paper"] {
  background: linear-gradient(135deg, #f4f1ea 50%, #2b4ba0 50%);
}

.variant-swatch[data-swatch="poster"] {
  background: linear-gradient(135deg, #f2f1ec 50%, #ff6a2b 50%);
}

.variant-swatch[data-swatch="sage"] {
  background: linear-gradient(135deg, #eef1ec 50%, #0f6e63 50%);
}

.variant-text {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-width: 0;
}

.variant-name {
  font-size: 15px;
  font-weight: 500;
}

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

/* --- top bar, right-hand cluster -------------------------------------- */

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* The server out of reach: a pill beside the dot. */
.offline-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: var(--chip);
  color: var(--chip-ink);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* Backend health: a small status dot, detail in the title tooltip. */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--pending);
}

.status-dot.ok {
  background: var(--ok);
}

.status-dot.down {
  background: var(--danger);
}

.status-dot.pending {
  background: var(--pending);
}

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
}

.profile-link {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 12px 0 6px;
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.profile-link:hover {
  color: var(--ink);
  border-color: var(--accent);
  text-decoration: none;
}

/* The profile button opens a menu; it is a <button> dressed as the link it
   used to be, and the anchor the menu hangs from. */
button.profile-link {
  min-height: 0;
  background: var(--surface);
  font-size: 14px;
  anchor-name: --profile-menu;
}

/* The visitor's button: the look settings, behind one icon. */
button.guest-link {
  gap: 6px;
  padding: 0 10px;
}

button.profile-link:hover:not(:disabled) {
  background: var(--surface);
}

.profile-link .chevron {
  color: var(--muted);
  transition: transform 160ms ease;
}

button.profile-link:has(+ .profile-menu:popover-open) .chevron {
  transform: rotate(180deg);
}

/* --- search ---------------------------------------------------------- */

/* What a search matched, wherever it shows. */
mark.hit {
  padding: 0 1px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: inherit;
}

/* The top bar's way into the palette: a button dressed as a search field. */
button.search-trigger {
  flex: 0 1 280px;
  min-width: 0;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 8px 0 12px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

button.search-trigger:hover:not(:disabled) {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--ink);
}

.search-trigger-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

kbd {
  flex-shrink: 0;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--chip);
  color: var(--muted);
  font-family: inherit;
  font-size: 11px;
  line-height: 1;
}

.search-trigger-key {
  margin-left: auto;
}

.card-search > .ico {
  position: absolute;
  left: 12px;
  color: var(--muted);
  pointer-events: none;
}

.card-search input[type="search"] {
  /* The browser's own search-field look, sunken edges and all, goes. */
  appearance: none;
  width: 100%;
  /* The height of the bar's other controls. */
  min-height: 44px;
  padding: 0 12px 0 36px;
  font-size: 14px;
}
