/* ---------- Top bar ---------- */
.topbar {
  /* backdrop-filter already makes this a stacking context; give it a z-index so the
     whole bar (and its dropdowns like the profile menu) paints ABOVE the main content.
     Without it the Projects board's positioned nodes (z-index up to 10) rise over the
     topbar's auto-level context and swallow the open profile menu. */
  position: relative;
  z-index: var(--z-menu);
  flex-shrink: 0;
  height: 56px;
  display: grid;
  grid-template-columns: 290px 1fr 300px;
  gap: 14px;
  padding: 0 14px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-md);
  overflow: hidden;
}

.brand-mark svg {
  width: 30px;
  height: 30px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.12;
}

.brand-name {
  font-weight: 600;
  font-size: var(--fs-md);
  letter-spacing: -0.01em;
}

.brand-nook {
  color: #0f766e;
}

[data-theme="dark"] .brand-nook {
  color: #2bb6a6;
}

.brand-tagline {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .brand-tagline {
    display: none;
  }
}

.topbar-search {
  position: relative;
  flex: 1;
  max-width: 520px;
  margin: 0 auto;
}

.search-ico {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--faint);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 38px;
  padding: 0 36px 0 34px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--fs-base);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.search-input::placeholder {
  color: var(--faint);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--bg);
}

.search-kbd {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--faint);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  line-height: 1.4;
  background: var(--bg);
}

.header-dial-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
  padding: 0 12px;
}

.header-sep {
  position: absolute;
  width: 1px;
  height: 24px;
  background: var(--border-strong);
}

.header-sep:first-child {
  left: -14px;
}

.header-sep:last-child {
  right: -14px;
}

.header-dial {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.header-dial::-webkit-scrollbar {
  display: none;
}

.header-dial .dial-item {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  flex: 0 0 auto;   /* keep their size; the row scrolls instead of squishing or wrapping */
}

.header-dial .dial-fav {
  width: 22px;
  height: 22px;
  border-radius: 4px;
}

.dial-placeholder {
  font-size: var(--fs-sm);
  color: var(--faint);
  white-space: nowrap;
}

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

/* Cloud-sync status chip — sits left of the theme toggle. Driven by
   src/sync/syncstatus.js (v2sync + modulesync call it). Same footprint as
   .icon-btn but non-interactive (a status, not a button). */
.sync-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  color: var(--muted);
  cursor: default;
  transition: color var(--dur) var(--ease);
}
.sync-status svg { width: 18px; height: 18px; }
.sync-status[data-state="saving"] { color: var(--accent-text); }
.sync-status[data-state="saved"]  { color: var(--accent); }
.sync-status[data-state="error"]  { color: var(--danger); }
.sync-status[data-state="saving"] svg.spin { animation: sync-spin 0.8s linear infinite; }
.sync-status[data-state="saved"] svg { animation: sync-pop 0.28s var(--ease); }
@keyframes sync-spin { to { transform: rotate(360deg); } }
@keyframes sync-pop { from { transform: scale(0.6); opacity: 0.35; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .sync-status svg.spin, .sync-status[data-state="saved"] svg { animation: none; }
}

.email-chip {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-sm);
  color: var(--muted);
}

/* theme toggle icon swap */
.ico-moon {
  display: none;
}

[data-theme="dark"] .ico-sun {
  display: none;
}

[data-theme="dark"] .ico-moon {
  display: block;
}

.only-mobile {
  display: none;
}

