/* ═══ 5. HEADER / NAV ═════════════════════════════════════════════════ */

.hdr {
  position: relative;   /* containing block for .activity-menu's page-centered popover below */
  grid-column: 1 / 9; grid-row: 1;
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 14px;
  align-items: center;
}
.logo {
  grid-column: 1 / 4;
  font-size: var(--text-xl); line-height: var(--lh-title);
  letter-spacing: .3px;
}
.logo-sub {
  display: block;
  font-size: var(--text-xs); color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: .08em;
  margin-top: 3px;
}
.tabs {
  grid-column: 5 / 8;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.tab {
  position: relative;
  font-size: var(--text-xl); line-height: var(--lh-title);
  letter-spacing: .3px;
  color: var(--ink-soft);
  text-align: right;
  padding: 8px 4px;
  border-radius: var(--radius-md);
  transition: color var(--dur-fast), transform var(--dur-fast), background var(--dur-fast);
}
.tab:hover { color: var(--fg); background: var(--hover-bg); }
.tab:active { transform: scale(0.94); }
.tab.active { color: var(--fg); }
.tab.active::after {
  content: ""; position: absolute; left: 4px; right: 4px; bottom: 0;
  height: 2px; background: var(--fg);
}
.nav-badge {
  position: absolute; top: 0; right: -6px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--bad); color: var(--on-status-fg);
  font-size: var(--text-xs); line-height: 16px; text-align: center;
  letter-spacing: 0;
  /* Shared by the activity/priority/to-do badges — all three go through
     hidden = true/false at the 0 ↔ 1 boundary (see attention-board.js,
     todo.js, activity-bell.js), never on a re-render while already shown,
     so this only replays on a genuine "something new" transition. */
  animation: badge-pop-in var(--dur-fast) ease-out;
}
@keyframes badge-pop-in {
  from { opacity: 0; transform: scale(0.6); }
}
/* ── header-right icon cluster: bell + user menu ──────────────────────── */

.hdr-actions {
  grid-column: 8 / 9;
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
}
.hdr-icon-btn {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: 1px solid transparent; border-radius: 50%;
  color: var(--ink-soft);
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.hdr-icon-btn:hover { background: var(--hover-bg); color: var(--fg); }
.hdr-icon-btn[aria-expanded="true"] {
  background: var(--hover-bg); border-color: var(--hairline); color: var(--fg);
}
.hdr-icon-btn:active { transform: scale(0.94); }
.hdr-icon-btn .nav-badge { top: -2px; right: -2px; }

/* Icon-anchored containing block for both popovers on desktop. Mobile drops
   this back to static (mobile.css) so .activity-menu falls through to .hdr
   (see above) and centers on the header instead of the bell icon there. */
.hdr-popover-wrap { position: relative; }
.user-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  display: flex; flex-direction: column; gap: 1px;
  background: var(--popover-bg);
  -webkit-backdrop-filter: var(--popover-blur);
  backdrop-filter: var(--popover-blur);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  padding: 5px;
  min-width: 184px;
  z-index: 60;
  animation: menu-pop-in var(--dur-fast) ease-out;
}
/* Every row — the theme switch and the two action buttons — shares one padding
   box so their labels start on the same left edge and none of them feels
   cramped against the menu's border. */
.user-menu .btn {
  justify-content: flex-start; border-color: transparent;
  padding: 8px 12px; white-space: nowrap;
}
.user-menu .btn:hover { border-color: var(--hairline); }
.user-menu-empty {
  padding: 8px 12px;
  font-size: var(--text-sm); color: var(--ink-faint);
  white-space: nowrap;
}
/* Hairline divider between the theme switch and the account actions. */
.user-menu-sep { height: 1px; margin: 4px 6px; background: var(--line); }

/* ── theme switch: label + iOS-style sliding toggle, one hit target ──────── */
.user-menu-toggle {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; width: 100%;
  padding: 8px 12px;
  border: 1px solid transparent; border-radius: var(--radius-md);
  color: var(--ink); background: transparent;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.user-menu-toggle:hover { background: var(--hover-bg); border-color: var(--hairline); }
.user-menu-toggle:active { transform: scale(0.98); }
.user-menu-label {
  font-size: var(--text-base); letter-spacing: .2px; white-space: nowrap;
}
.switch {
  position: relative; flex: none; box-sizing: border-box;
  width: 30px; height: 17px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong); background: transparent;
  transition: background var(--dur-fast) ease-out, border-color var(--dur-fast) ease-out;
}
.switch-knob {
  position: absolute; top: 50%; left: 2px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--ink-soft);
  transform: translateY(-50%);
  /* The slide is the whole point of the control, so it gets the longer,
     settled duration; colour crossfades on the shorter one. */
  transition: transform var(--dur-base) ease-out, background var(--dur-fast) ease-out;
}
.user-menu-toggle[aria-checked="true"] .switch {
  background: var(--fg); border-color: var(--fg);
}
.user-menu-toggle[aria-checked="true"] .switch-knob {
  background: var(--bg);
  transform: translateY(-50%) translateX(13px);
}

/* ═══ 6. ROW-2 CHROME: headings ═══════════════════════════════════════ */

.hd {
  font-size: var(--text-lg); font-weight: 400;
  line-height: var(--lh-heading); letter-spacing: .2px;
  align-self: end;
}
.hd-overview { grid-column: 1; grid-row: 2; }
.hd-priority {
  grid-column: 5; grid-row: 2; position: relative;
  display: flex; align-items: flex-start; width: fit-content;
}
.hd-todo {
  grid-column: 7; grid-row: 2; position: relative;
  display: flex; align-items: flex-start; width: fit-content;
}
/* Reused nav-badge style, but inline right after the short heading text
   instead of pinned to the box's far edge (which would float past "To-Do"). */
.nav-badge.panel-badge { position: static; margin-left: 6px; transform: translateY(-3px); }
.hd-timeline { grid-column: 1; grid-row: 6; }

.span-select {
  grid-column: 2 / 4; grid-row: 6;
  display: flex; gap: 6px; align-self: end;
}

/* Row-2 dashboard chrome hides when a cover owns the row */
body:not([data-tab="dashboard"]) .dash-chrome { visibility: hidden; }

